locsrv_plat/map_and_navigation_provider_discovery_api/tsrc/src/testmnproviderdiscovery.cpp
branchRCL_3
changeset 44 2b4ea9893b66
parent 42 02ba3f1733c6
child 45 6b6920c56e2f
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implementation of test class for map_and_navigation_provider_discovery_api
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <Stiftestinterface.h>
       
    22 #include <swinstapi.h>
       
    23 #include "testmnproviderdiscovery.h"
       
    24 
       
    25 // Literal
       
    26 // Provider app sisx path
       
    27 _LIT( KProviderSisxPath, "e:\\testing\\data\\mnrefprovider.sisx" ); 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CTestMnProviderDiscovery::Ctestmnproviderdiscovery
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CTestMnProviderDiscovery::CTestMnProviderDiscovery( 
       
    38     CTestModuleIf& aTestModuleIf ):
       
    39         CScriptBase( aTestModuleIf )
       
    40     {
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CTestMnProviderDiscovery::ConstructL
       
    45 // Symbian 2nd phase constructor can leave.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void CTestMnProviderDiscovery::ConstructL()
       
    49     {
       
    50     iLog = CStifLogger::NewL( KtestmnproviderdiscoveryLogPath, 
       
    51                           KtestmnproviderdiscoveryLogFile,
       
    52                           CStifLogger::ETxt,
       
    53                           CStifLogger::EFile,
       
    54                           EFalse );
       
    55 	InstallProvider( KProviderSisxPath );
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CTestMnProviderDiscovery::NewL
       
    60 // Two-phased constructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CTestMnProviderDiscovery* CTestMnProviderDiscovery::NewL( 
       
    64     CTestModuleIf& aTestModuleIf )
       
    65     {
       
    66     CTestMnProviderDiscovery* self = new (ELeave) CTestMnProviderDiscovery( aTestModuleIf );
       
    67 
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();
       
    70     CleanupStack::Pop();
       
    71 
       
    72     return self;
       
    73 
       
    74     }
       
    75 
       
    76 // Destructor
       
    77 CTestMnProviderDiscovery::~CTestMnProviderDiscovery()
       
    78     { 
       
    79 
       
    80     // Delete resources allocated from test methods
       
    81     Delete();
       
    82 
       
    83     // Delete logger
       
    84     delete iLog; 
       
    85 
       
    86     }
       
    87 
       
    88 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // LibEntryL is a polymorphic Dll entry point.
       
    92 // Returns: CScriptBase: New CScriptBase derived object
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 EXPORT_C CScriptBase* LibEntryL( 
       
    96     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
    97     {
       
    98 
       
    99     return ( CScriptBase* ) CTestMnProviderDiscovery::NewL( aTestModuleIf );
       
   100 
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // This method will install the provider application
       
   105 //
       
   106 // -----------------------------------------------------------------------------
       
   107 //   
       
   108 TInt CTestMnProviderDiscovery::InstallProvider( const TDesC& aPackagePath )
       
   109     {
       
   110    // iLog->Log("Installing [%S]...", aPackagePath );
       
   111 
       
   112     TInt err = KErrNone;
       
   113     SwiUI::RSWInstSilentLauncher installer;
       
   114 
       
   115     err = installer.Connect();
       
   116     if( KErrNone != err )
       
   117     	{
       
   118     	iLog->Log(_L("Connection to installer failed"));
       
   119     	return err;
       
   120     	}
       
   121     //CHECK_EQUAL( err, KErrNone, "Connection to installer failed" );
       
   122 
       
   123     SwiUI::TInstallOptionsPckg options;
       
   124     options().iUpgrade = SwiUI::EPolicyAllowed;
       
   125     options().iPackageInfo = SwiUI::EPolicyAllowed;
       
   126     options().iOverwrite = SwiUI::EPolicyAllowed;
       
   127     options().iKillApp = SwiUI::EPolicyAllowed;
       
   128 
       
   129     err = installer.SilentInstall( aPackagePath, options );
       
   130     if( KErrNone != err )
       
   131     	{
       
   132     	iLog->Log(_L("Provider Installation failed"));
       
   133     	installer.Close();
       
   134     	return err;
       
   135     	}
       
   136     	
       
   137     //CHECK_EQUAL( err, KErrNone, "Installation failed" );
       
   138 	iLog->Log(_L("Provider Installation passed"));
       
   139     installer.Close();
       
   140     return err;
       
   141     }
       
   142     
       
   143 //  End of File