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_api |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <Stiftestinterface.h> |
|
22 #include <swinstapi.h> |
|
23 #include "testmapandnavapi.h" |
|
24 |
|
25 // Literal |
|
26 // Provider app sisx path |
|
27 _LIT( KProviderSisxPath, "e:\\testing\\data\\mnrefprovider.sisx" ); |
|
28 |
|
29 |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // CTestMapAndNavApi::CTestMapAndNavApi |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CTestMapAndNavApi::CTestMapAndNavApi( |
|
40 CTestModuleIf& aTestModuleIf ): |
|
41 CScriptBase( aTestModuleIf ) |
|
42 { |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CTestMapAndNavApi::ConstructL |
|
47 // Symbian 2nd phase constructor can leave. |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 void CTestMapAndNavApi::ConstructL() |
|
51 { |
|
52 iLog = CStifLogger::NewL( KtestmapandnavapiLogPath, |
|
53 KtestmapandnavapiLogFile, |
|
54 CStifLogger::ETxt, |
|
55 CStifLogger::EFile, |
|
56 EFalse ); |
|
57 InstallProvider( KProviderSisxPath ); |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CTestMapAndNavApi::NewL |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CTestMapAndNavApi* CTestMapAndNavApi::NewL( |
|
66 CTestModuleIf& aTestModuleIf ) |
|
67 { |
|
68 CTestMapAndNavApi* self = new (ELeave) CTestMapAndNavApi( aTestModuleIf ); |
|
69 |
|
70 CleanupStack::PushL( self ); |
|
71 self->ConstructL(); |
|
72 CleanupStack::Pop(); |
|
73 |
|
74 return self; |
|
75 |
|
76 } |
|
77 |
|
78 // Destructor |
|
79 CTestMapAndNavApi::~CTestMapAndNavApi() |
|
80 { |
|
81 |
|
82 // Delete resources allocated from test methods |
|
83 Delete(); |
|
84 |
|
85 // Delete logger |
|
86 delete iLog; |
|
87 |
|
88 } |
|
89 |
|
90 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // LibEntryL is a polymorphic Dll entry point. |
|
94 // Returns: CScriptBase: New CScriptBase derived object |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C CScriptBase* LibEntryL( |
|
98 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
99 { |
|
100 |
|
101 return ( CScriptBase* ) CTestMapAndNavApi::NewL( aTestModuleIf ); |
|
102 |
|
103 } |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // This method will install the provider application |
|
107 // |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 TInt CTestMapAndNavApi::InstallProvider( const TDesC& aPackagePath ) |
|
111 { |
|
112 // iLog->Log("Installing [%S]...", aPackagePath ); |
|
113 |
|
114 TInt err = KErrNone; |
|
115 SwiUI::RSWInstSilentLauncher installer; |
|
116 |
|
117 err = installer.Connect(); |
|
118 if( KErrNone != err ) |
|
119 { |
|
120 iLog->Log(_L("Connection to installer failed")); |
|
121 return err; |
|
122 } |
|
123 //CHECK_EQUAL( err, KErrNone, "Connection to installer failed" ); |
|
124 |
|
125 SwiUI::TInstallOptionsPckg options; |
|
126 options().iUpgrade = SwiUI::EPolicyAllowed; |
|
127 options().iPackageInfo = SwiUI::EPolicyAllowed; |
|
128 options().iOverwrite = SwiUI::EPolicyAllowed; |
|
129 options().iKillApp = SwiUI::EPolicyAllowed; |
|
130 |
|
131 err = installer.SilentInstall( aPackagePath, options ); |
|
132 if( KErrNone != err ) |
|
133 { |
|
134 iLog->Log(_L("Provider Installation failed")); |
|
135 installer.Close(); |
|
136 return err; |
|
137 } |
|
138 |
|
139 //CHECK_EQUAL( err, KErrNone, "Installation failed" ); |
|
140 iLog->Log(_L("Provider Installation passed")); |
|
141 installer.Close(); |
|
142 return err; |
|
143 } |
|
144 |
|
145 |
|
146 // End of File |
|