browser/src/BrCtlApiTestObserver.cpp
author Brendan Donegan <brendand@symbian.org>
Fri, 14 May 2010 08:53:07 +0100
branchSymbian3
changeset 37 39b95dd8b504
parent 3 235c00e46fb7
permissions -rw-r--r--
Fixes for App Install and Profile Management smoke tests
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     1
/*
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     8
*
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    11
*
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    12
* Contributors:
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    13
*
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    14
* Description:  BrCtlApiTest
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    15
*
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    16
*/
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    17
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    18
// INCLUDE FILES
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    19
#include <apmrec.h>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    20
#include <apgcli.h>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    21
#include <eikappui.h>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    22
#include <eikenv.h>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    23
#include <eikbtgpc.h>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    24
#include "BrCtlApiTestObserver.h"
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    25
#include <avkon.hrh>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    26
#include <aknmessagequerydialog.h>
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    27
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    28
#ifndef RD_PF_SEC_APPARC
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    29
//#include <genericparam.h>  
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    30
#else
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    31
#include "AiwGenericParam.h"
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    32
#endif
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    33
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    34
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    35
// ================= MEMBER FUNCTIONS =======================
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    36
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    37
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    38
// CBrCtlApiTestObserver::UpdateBrowserVScrollBarL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    39
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    40
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    41
void CBrCtlApiTestObserver::UpdateBrowserVScrollBarL(TInt /* aDocumentHeight */, 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    42
                                      TInt /* aDisplayHeight */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    43
                                      TInt /* aDisplayPosY */ ) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    44
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    45
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    46
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    47
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    48
// CBrCtlApiTestObserver::UpdateBrowserHScrollBarL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    49
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    50
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    51
void CBrCtlApiTestObserver::UpdateBrowserHScrollBarL(TInt /* aDocumentWidth */, 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    52
                                      TInt /* aDisplayWidth */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    53
                                      TInt /* aDisplayPosX */ ) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    54
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    55
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    56
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    57
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    58
// CBrCtlApiTestObserver::NotifyLayoutChange
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    59
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    60
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    61
void CBrCtlApiTestObserver::NotifyLayoutChange( TBrCtlLayout /* aNewLayout */) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    62
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    63
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    64
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    65
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    66
// CBrCtlSampleAppLayoutObserver::UpdateTitle
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    67
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    68
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    69
void CBrCtlApiTestObserver::UpdateTitleL( const TDesC& /*aTitle*/ )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    70
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    71
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    72
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    73
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    74
// CBrCtlApiTestObserver::UpdateSoftkeyL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    75
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    76
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    77
void CBrCtlApiTestObserver::UpdateSoftkeyL(TBrCtlKeySoftkey /* aKeySoftkey */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    78
                            const TDesC& /* aLabel */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    79
                            TUint32 /* aCommandId */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    80
                            TBrCtlSoftkeyChangeReason /* aBrCtlSoftkeyChangeReason */) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    81
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    82
    return; 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    83
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    84
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    85
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    86
// CBrCtlApiTestObserver::NetworkConnectionNeededL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    87
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    88
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    89
void CBrCtlApiTestObserver::NetworkConnectionNeededL(TInt* /*aConnectionPtr*/,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    90
                                      TInt* /*aSockSvrHandle*/,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    91
                                      TBool* /*aNewConn*/,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    92
                                      TApBearerType* /*aBearerType*/) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    93
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    94
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    95
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    96
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    97
// CBrCtlApiTestObserver::HandleRequestL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    98
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
    99
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   100
TBool CBrCtlApiTestObserver::HandleRequestL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   101
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   102
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   103
    TInt i;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   104
	
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   105
    // The 2 arrays must be in sync. Each element in iTypeArray 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   106
    // identifies the type of the corresponding element in iDesArray.
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   107
    if( aTypeArray->Count() != aDesArray->Count() )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   108
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   109
        User::Leave( KErrArgument );
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   110
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   111
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   112
	// get url
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   113
    HBufC* url = NULL;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   114
    // Serach url in the param list
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   115
    for(i = 0; i < aTypeArray->Count(); i++)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   116
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   117
        if( (*aTypeArray)[i] == EParamRequestUrl )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   118
            {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   119
            // the url is found
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   120
            url = HBufC::NewLC( (*aDesArray)[i].Length() );
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   121
            url->Des().Copy( (*aDesArray)[i] );
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   122
            break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   123
            }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   124
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   125
    if( !url )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   126
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   127
        // The url wasn't found. 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   128
        User::Leave( KErrArgument );
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   129
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   130
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   131
	// get referrer header
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   132
    HBufC* refererHeader = NULL;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   133
    // Serach url in the param list
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   134
    for( i = 0; i < aTypeArray->Count(); i++ )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   135
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   136
        if( (*aTypeArray)[i] == EParamRefererHeader )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   137
            {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   138
            // the referer Header is found
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   139
            refererHeader = HBufC::NewLC( (*aDesArray)[i].Length() );
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   140
            refererHeader->Des().Copy( (*aDesArray)[i] );
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   141
            break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   142
            }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   143
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   144
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   145
    if( refererHeader )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   146
		{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   147
			CleanupStack::PopAndDestroy( 1 ); // refererHeader
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   148
		}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   149
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   150
    CleanupStack::PopAndDestroy( 1 ); // url
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   151
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   152
    return ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   153
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   154
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   155
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   156
// CBrCtlApiTestObserver::HandleDownloadL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   157
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   158
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   159
TBool CBrCtlApiTestObserver::HandleDownloadL(RArray<TUint>* aTypeArray, CDesCArrayFlat* aDesArray)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   160
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   161
    TInt i = 0;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   162
    TInt count = aTypeArray->Count();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   163
    for (i = 0; i < count; i++)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   164
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   165
        if ((*aTypeArray)[i] == EParamLocalFileName && aDesArray[i].Length() > 0)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   166
            {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   167
            TInt j = 0;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   168
            for (j = 0; j < count; j++)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   169
                {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   170
                if ((*aTypeArray)[j] == EParamReceivedContentType)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   171
                    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   172
                    HBufC8* dataType8 = HBufC8::NewLC((*aDesArray)[j].Length());
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   173
                    dataType8->Des().Copy((*aDesArray)[j]);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   174
                    TDataType dataType(*dataType8);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   175
                    iHandler->OpenFileEmbeddedL((*aDesArray)[i], dataType);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   176
                    CleanupStack::PopAndDestroy();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   177
                    break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   178
                    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   179
                }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   180
            break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   181
            }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   182
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   183
    return EFalse;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   184
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   185
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   186
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   187
// CBrCtlApiTestObserver::HandleBrowserLoadEventL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   188
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   189
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   190
void CBrCtlApiTestObserver::HandleBrowserLoadEventL( TBrCtlDefs::TBrCtlLoadEvent /* aLoadEvent */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   191
                                                 TUint /* aSize */, TUint16 /* aTransactionId */ ) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   192
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   193
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   194
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   195
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   196
// CBrCtlApiTestObserver::ResolveEmbeddedLinkL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   197
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   198
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   199
TBool CBrCtlApiTestObserver::ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   200
    		                       const TDesC& /* aCurrentUrl */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   201
        	                       TBrCtlLoadContentType /* aLoadContentType */, 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   202
                                   MBrCtlLinkContent& aEmbeddedLinkContent) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   203
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   204
    if (IsFileScheme(aEmbeddedUrl))
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   205
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   206
        GetFileNameL(aEmbeddedUrl);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   207
        HBufC8* buf = ReadFileLC(*iFileName);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   208
        HBufC* contentType = NULL;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   209
        TPtrC p(NULL, 0);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   210
        contentType = RecognizeLC(*iFileName, *buf);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   211
        aEmbeddedLinkContent.HandleResolveComplete(*contentType, p, buf);        
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   212
        CleanupStack::PopAndDestroy(2); // contentType, buf
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   213
        return ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   214
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   215
    return EFalse;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   216
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   217
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   218
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   219
// CBrCtlApiTestObserver::ResolveLinkL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   220
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   221
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   222
TBool CBrCtlApiTestObserver::ResolveLinkL(const TDesC& aUrl, const TDesC& /* aCurrentUrl */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   223
                   MBrCtlLinkContent& aBrCtlLinkContent) 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   224
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   225
    if (IsFileScheme(aUrl))
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   226
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   227
        GetFileNameL(aUrl);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   228
        HBufC8* buf = ReadFileLC(*iFileName);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   229
        HBufC* contentType = NULL;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   230
        TPtrC p(NULL, 0);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   231
        contentType = RecognizeLC(*iFileName, *buf);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   232
        aBrCtlLinkContent.HandleResolveComplete(*contentType, p, buf);        
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   233
        CleanupStack::PopAndDestroy(2); // contentType, buf
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   234
        return ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   235
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   236
    return EFalse;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   237
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   238
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   239
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   240
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   241
// CBrCtlApiTestObserver::CancelAll
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   242
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   243
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   244
void CBrCtlApiTestObserver::CancelAll() 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   245
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   246
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   247
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   248
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   249
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   250
// CBrCtlApiTestObserver::ConstructL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   251
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   252
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   253
void CBrCtlApiTestObserver::ConstructL()
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   254
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   255
    iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()) ;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   256
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   257
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   258
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   259
// CBrCtlApiTestObserver::~CBrCtlApiTestObserver
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   260
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   261
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   262
CBrCtlApiTestObserver::~CBrCtlApiTestObserver()
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   263
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   264
    delete iFileName;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   265
    delete iHandler;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   266
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   267
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   268
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   269
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   270
// CBrCtlApiTestObserver::NewL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   271
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   272
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   273
CBrCtlApiTestObserver* CBrCtlApiTestObserver::NewL()
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   274
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   275
  CBrCtlApiTestObserver* self = new(ELeave)CBrCtlApiTestObserver;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   276
  CleanupStack::PushL(self);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   277
  self->ConstructL();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   278
  CleanupStack::Pop();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   279
  return self;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   280
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   281
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   282
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   283
// CBrCtlApiTestObserver::IsFileScheme
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   284
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   285
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   286
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   287
TBool CBrCtlApiTestObserver::IsFileScheme(const TDesC& aFileName)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   288
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   289
    _LIT(KFileScheme, "file://");
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   290
    if (aFileName.Length() > 0 && aFileName.Ptr() != NULL)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   291
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   292
        if (aFileName.FindF(KFileScheme) == 0)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   293
            {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   294
            return ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   295
            }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   296
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   297
    return EFalse;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   298
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   299
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   300
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   301
// CBrCtlApiTestObserver::ReadFile
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   302
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   303
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   304
HBufC8* CBrCtlApiTestObserver::ReadFileLC(const TDesC& aFileName)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   305
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   306
    RFs rfs;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   307
    RFile file;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   308
    User::LeaveIfError(rfs.Connect());
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   309
    CleanupClosePushL(rfs);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   310
    User::LeaveIfError(file.Open(rfs, aFileName, EFileRead));
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   311
    CleanupClosePushL(file);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   312
    TInt size;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   313
    User::LeaveIfError(file.Size(size));
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   314
    HBufC8* buf = HBufC8::NewLC(size);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   315
    TPtr8 bufPtr(buf->Des());
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   316
    User::LeaveIfError(file.Read(bufPtr));
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   317
    CleanupStack::Pop(); // buf
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   318
    CleanupStack::PopAndDestroy(2); // file, rfs
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   319
    CleanupStack::PushL(buf);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   320
    return buf;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   321
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   322
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   323
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   324
// CBrCtlApiTestObserver::RecognizeL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   325
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   326
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   327
HBufC* CBrCtlApiTestObserver::RecognizeLC(const TDesC& aFileName, const TDesC8& aData)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   328
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   329
    TDataRecognitionResult dataType;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   330
    RApaLsSession apaSession;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   331
    TInt ret;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   332
    HBufC* contentTypeString = NULL;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   333
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   334
    User::LeaveIfError(apaSession.Connect());
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   335
    // Ask the application architecture to find the file type
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   336
    ret = apaSession.RecognizeData(aFileName, aData, dataType);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   337
    apaSession.Close();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   338
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   339
    if (ret == KErrNone &&
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   340
        (dataType.iConfidence == CApaDataRecognizerType::ECertain) ||
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   341
        (dataType.iConfidence == CApaDataRecognizerType::EProbable))
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   342
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   343
        // If the file type was found, try to match it to a known file type
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   344
        TPtrC8 mimeTypePtr = dataType.iDataType.Des8();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   345
        TInt len = mimeTypePtr.Length() + 1;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   346
        contentTypeString = HBufC::NewL(len); 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   347
        contentTypeString->Des().Copy(mimeTypePtr);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   348
        contentTypeString->Des().ZeroTerminate();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   349
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   350
    CleanupStack::PushL(contentTypeString);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   351
    return contentTypeString;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   352
    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   353
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   354
// -----------------------------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   355
// CBrCtlApiTestObserver::GetFileNameL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   356
// Translate the file name from a URL to a valid file name in the system.
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   357
// -----------------------------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   358
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   359
TBool CBrCtlApiTestObserver::GetFileNameL(const TDesC& aFileName)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   360
    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   361
    // This function accepts URLs in the following format:
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   362
    // file://filename.xxx
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   363
    // file:///filename.xxx
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   364
    // file://c:/filename.xxx
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   365
    // file:///c:/filename.xxx
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   366
    //
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   367
    _LIT(KFileScheme, "file://");
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   368
    _LIT(KDefaultDrivePath, "C:\\");
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   369
    _LIT(KPathChar, "\\");
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   370
    
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   371
    TInt count;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   372
    TInt index = 0;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   373
    TBool drvLetter = EFalse;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   374
    TUint16 c;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   375
    
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   376
    // Verify the file scheme
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   377
    TPtrC urlPtr(aFileName);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   378
    if (urlPtr.FindF(KFileScheme) != 0)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   379
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   380
        return EFalse;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   381
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   382
    urlPtr.Set(urlPtr.Mid(KFileScheme().Length()));
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   383
    
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   384
    // make sure there are enough characters in the filename before
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   385
    // trying to check them
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   386
    count = urlPtr.Length();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   387
    if(count == 0)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   388
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   389
        return EFalse;            // no filename, so can't look at urlPtr[0]
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   390
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   391
    
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   392
    // Skip the first '/' if there is one
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   393
    if (urlPtr[0] == '/')
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   394
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   395
        urlPtr.Set(urlPtr.Mid(1));
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   396
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   397
    count = urlPtr.Length();
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   398
    
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   399
    // Is there a drive letter?
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   400
    if(count > 1)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   401
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   402
        // can check for drive letter
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   403
        if (urlPtr[1 + index] == ':')
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   404
            {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   405
            drvLetter = ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   406
            }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   407
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   408
    if(drvLetter == EFalse)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   409
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   410
        // 3 additional characters for the string "c:\"
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   411
        count = urlPtr.Length() + 3;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   412
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   413
    iFileName = HBufC::NewL(count);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   414
    if (!drvLetter)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   415
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   416
        iFileName->Des().Append(KDefaultDrivePath);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   417
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   418
    
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   419
    TBool fragment(EFalse);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   420
    // Convert relative path containing /./ and /../ to absolute path
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   421
    for (; index < urlPtr.Length() && !fragment; index ++)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   422
        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   423
        switch(urlPtr[index])
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   424
            {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   425
            case '#':    //Check if there is a fragment '#'
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   426
                {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   427
                fragment = ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   428
                continue; // Just stop there
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   429
                }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   430
                
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   431
            case '/':
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   432
                {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   433
                iFileName->Des().Append(KPathChar);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   434
                break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   435
                }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   436
            case '.':
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   437
                {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   438
                if (index > 1 && urlPtr[index - 1] == '/')
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   439
                    {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   440
                    if (index < count - 1 && urlPtr[index + 1] == '/')
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   441
                        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   442
                        index ++; // skip  ./
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   443
                        break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   444
                        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   445
                    if (index > 2 && index < count - 3 &&
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   446
                        urlPtr[index + 1] == '.' && urlPtr[index + 2] == '/')
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   447
                        {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   448
                        TInt i = index - 2;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   449
                        
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   450
                        for (; i > 0 && urlPtr[i] != '/'; i--) {} // skip  /../
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   451
                        
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   452
                        iFileName->Des().SetLength(iFileName->Des().Length() - (index - i));
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   453
                        index += 2;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   454
                        break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   455
                        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   456
                    }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   457
                }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   458
                // no break
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   459
                //lint -fallthrough
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   460
                
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   461
            default:
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   462
                {
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   463
                c = urlPtr[index];
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   464
                iFileName->Des().Append(&c, 1);
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   465
                break;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   466
                }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   467
            }	// end of switch
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   468
        }
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   469
    return ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   470
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   471
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   472
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   473
// CBrCtlApiTestObserver::NewDownloadL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   474
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   475
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   476
TBool CBrCtlApiTestObserver::NewDownloadL(TUint /* aTransactionID */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   477
									   const TDesC& /* aFileName */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   478
									   const TDesC& /* aContentType */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   479
									   const TDesC& /* aUrl */)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   480
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   481
	return ETrue;
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   482
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   483
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   484
void CBrCtlApiTestObserver::ResumeDownloadL(TUint /* aTransactionID */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   485
                                         TUint /* aLength */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   486
									   const TDesC& /* aFileName */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   487
									   const TDesC& /* aContentType */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   488
									   const TDesC& /* aUrl */)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   489
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   490
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   491
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   492
void CBrCtlApiTestObserver::HandleDownloadEventL( TUint /* aTransactionID */, 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   493
											  TBrCtlDownloadEvent /* aDownloadEvent */,
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   494
											  TUint /* aValue*/ )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   495
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   496
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   497
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   498
// Dummy function definitions for the functions from CBrCtlWindowObserver class - Added for Widget Extension Test
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   499
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   500
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   501
// CBrCtlApiTestObserver::OpenWindowL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   502
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   503
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   504
CBrCtlInterface* CBrCtlApiTestObserver::OpenWindowL(TDesC& aUrl, TDesC* aTargetName, TBool aUserInitiated, 
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   505
     TAny* aReserved)
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   506
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   507
	
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   508
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   509
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   510
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   511
// CBrCtlApiTestObserver::FindWindowL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   512
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   513
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   514
CBrCtlInterface* CBrCtlApiTestObserver::FindWindowL( const TDesC& aTargetName ) const
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   515
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   516
	
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   517
}            
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   518
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   519
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   520
// CBrCtlApiTestObserver::HandleWindowCommandL
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   521
// ---------------------------------------------------------
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   522
//
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   523
void CBrCtlApiTestObserver::HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand )
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   524
{
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   525
	
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   526
}
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   527
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   528
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   529
235c00e46fb7 Added Symbian3 smoketests
Maciej Seroka <maciejs@symbian.org>
parents:
diff changeset
   530
// End of File