|
1 /* |
|
2 * Copyright (c) 2004-2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @test |
|
22 @internalTechnology |
|
23 */ |
|
24 #include "tsisregistrytest.h" |
|
25 #include "tsisregistryteststep.h" |
|
26 #include "sessionstep.h" |
|
27 #include "writablesessionstep.h" |
|
28 |
|
29 _LIT(KServerName,"tSisRegistryTest"); |
|
30 CTestSisRegistry* CTestSisRegistry::NewL() |
|
31 /** |
|
32 * @return - Instance of the test server |
|
33 * Called inside the MainL() function to create and start the |
|
34 * CTestServer derived server. |
|
35 */ |
|
36 { |
|
37 CTestSisRegistry * server = new (ELeave) CTestSisRegistry(); |
|
38 CleanupStack::PushL(server); |
|
39 // CServer base class call |
|
40 server->StartL(KServerName); |
|
41 CleanupStack::Pop(server); |
|
42 return server; |
|
43 } |
|
44 |
|
45 LOCAL_C void MainL() |
|
46 /** |
|
47 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
48 */ |
|
49 { |
|
50 // Leave the hooks in for platform security |
|
51 #if (defined __DATA_CAGING__) |
|
52 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
53 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
54 #endif |
|
55 CActiveScheduler* sched=NULL; |
|
56 sched=new(ELeave) CActiveScheduler; |
|
57 CActiveScheduler::Install(sched); |
|
58 // __EDIT_ME__ Your server name |
|
59 CTestSisRegistry* server = NULL; |
|
60 // Create the CTestServer derived server |
|
61 // __EDIT_ME__ Your server name |
|
62 TRAPD(err,server = CTestSisRegistry::NewL()); |
|
63 if(!err) |
|
64 { |
|
65 // Sync with the client and enter the active scheduler |
|
66 RProcess::Rendezvous(KErrNone); |
|
67 sched->Start(); |
|
68 } |
|
69 delete server; |
|
70 delete sched; |
|
71 } |
|
72 |
|
73 GLDEF_C TInt E32Main() |
|
74 /** |
|
75 * @return - Standard Epoc error code on exit |
|
76 */ |
|
77 { |
|
78 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
79 if(cleanup == NULL) |
|
80 { |
|
81 return KErrNoMemory; |
|
82 } |
|
83 TRAP_IGNORE(MainL()); |
|
84 delete cleanup; |
|
85 return KErrNone; |
|
86 } |
|
87 |
|
88 TBool IsPerformanceTestStep(const TDesC& aStepName, TPtrC& aStrippedName) |
|
89 { |
|
90 _LIT(KPerformanceStepKeyWord, "Performance-"); |
|
91 if (KErrNotFound == aStepName.FindF(KPerformanceStepKeyWord())) |
|
92 { |
|
93 aStrippedName.Set(aStepName); |
|
94 return EFalse; |
|
95 } |
|
96 |
|
97 TInt len = KPerformanceStepKeyWord().Length(); |
|
98 aStrippedName.Set(aStepName.Mid(len)); |
|
99 return ETrue; |
|
100 } |
|
101 |
|
102 CTestStep* CTestSisRegistry::CreateTestStep(const TDesC& aStepName) |
|
103 /** |
|
104 * @return - A CTestStep derived instance |
|
105 * Implementation of CTestServer pure virtual |
|
106 */ |
|
107 { |
|
108 TBool performanceStep = EFalse; |
|
109 TPtrC strippedStepName; |
|
110 performanceStep = IsPerformanceTestStep(aStepName, strippedStepName); |
|
111 |
|
112 CTestStep* name = NULL; |
|
113 if (strippedStepName == KInstalledUids) |
|
114 { |
|
115 name = new CInstalledUidsStep; |
|
116 } |
|
117 if (strippedStepName == KInstalledPackages) |
|
118 { |
|
119 name = new CInstalledPackagesStep; |
|
120 } |
|
121 if (strippedStepName == KRemovablePackages) |
|
122 { |
|
123 name = new CRemovablePackagesStep; |
|
124 } |
|
125 if (strippedStepName == KInRomNonRemovablePackages) |
|
126 { |
|
127 name = new CInRomNonRemovablePackage; |
|
128 } |
|
129 if (strippedStepName == KInstalledDrives) |
|
130 { |
|
131 name = new CInstalledDrives; |
|
132 } |
|
133 else if (strippedStepName == KIsUidInstalled) |
|
134 { |
|
135 name = new CIsUidInstalledStep; |
|
136 } |
|
137 else if (strippedStepName == KIsPackageInstalled) |
|
138 { |
|
139 name = new CIsPackageInstalledStep; |
|
140 } |
|
141 if (strippedStepName == KGetControllers) |
|
142 { |
|
143 name = new CGetControllersStep; |
|
144 } |
|
145 if (strippedStepName == KIsControllerInstalled) |
|
146 { |
|
147 name = new CIsControllerInstalledStep; |
|
148 } |
|
149 else if (strippedStepName == KEntryUidOpenClose) |
|
150 { |
|
151 name = new CEntryUidOpenCloseStep; |
|
152 } |
|
153 else if (strippedStepName == KEntryPackageOpenClose) |
|
154 { |
|
155 name = new CEntryPackageOpenCloseStep; |
|
156 } |
|
157 else if (strippedStepName == KEntryNameOpenClose) |
|
158 { |
|
159 name = new CEntryNameOpenCloseStep; |
|
160 } |
|
161 else if (strippedStepName == KEntrySids) |
|
162 { |
|
163 name = new CEntrySidsStep; |
|
164 } |
|
165 else if (strippedStepName == KEntryMethods) |
|
166 { |
|
167 name = new CEntryMethodsStep; |
|
168 } |
|
169 else if (strippedStepName == KWritableEntryMethods) |
|
170 { |
|
171 name = new CWritableEntryMethodsStep; |
|
172 } |
|
173 else if (strippedStepName == KPoliceSids) |
|
174 { |
|
175 name = new CPoliceSidsStep; |
|
176 } |
|
177 else if (strippedStepName == KEntryDelete) |
|
178 { |
|
179 name = new CEntryDeleteStep; |
|
180 } |
|
181 else if (strippedStepName == KBackupRegistry) |
|
182 { |
|
183 name = new CBackupRegistryStep; |
|
184 } |
|
185 else if (strippedStepName == KCreateTestRegistry) |
|
186 { |
|
187 name = new CCreateTestRegistryStep; |
|
188 } |
|
189 else if (strippedStepName == KDeleteRegistry) |
|
190 { |
|
191 name = new CDeleteRegistryStep; |
|
192 } |
|
193 else if (strippedStepName == KRestoreRegistry) |
|
194 { |
|
195 name = new CRestoreRegistryStep; |
|
196 } |
|
197 else if (strippedStepName == KSidFileName) |
|
198 { |
|
199 name = new CSidFileStep; |
|
200 } |
|
201 else if (strippedStepName == KModifiableFile) |
|
202 { |
|
203 name = new CModifiableFileStep; |
|
204 } |
|
205 else if (strippedStepName == KFileHash) |
|
206 { |
|
207 name = new CFileHashStep; |
|
208 } |
|
209 else if (strippedStepName == KSaveGeneratedRegistry) |
|
210 { |
|
211 name = new CSaveRegistryStep; |
|
212 } |
|
213 else if (strippedStepName == KIsSidPresentStep) |
|
214 { |
|
215 name = new CIsSidPresentStep; |
|
216 } |
|
217 else if (strippedStepName == KIsPackagePresentStep) |
|
218 { |
|
219 name = new CIsPackagePresentStep; |
|
220 } |
|
221 else if (strippedStepName == KIntegrityCheckStep) |
|
222 { |
|
223 name = new CIntegrityCheckStep; |
|
224 } |
|
225 else if (strippedStepName == KLoggingFileInfo) |
|
226 { |
|
227 name = new CLoggingFileInfoStep; |
|
228 } |
|
229 else if (strippedStepName == KRomStubPerformanceStep) |
|
230 { |
|
231 name = new CRomStubPerformanceStep; |
|
232 } |
|
233 else if (strippedStepName == KCorruptCacheStep) |
|
234 { |
|
235 name = new CCorruptCacheStep; |
|
236 } |
|
237 else if (strippedStepName == KCorruptCacheRecoverStep) |
|
238 { |
|
239 name = new CCorruptCacheRecoverStep; |
|
240 } |
|
241 else if (strippedStepName == KDateAndTimeIntegrityCheckStep) |
|
242 { |
|
243 name = new CIntegrityDateAndTimeCheckStep; |
|
244 } |
|
245 else if (strippedStepName == KEmbeddingPackageStep) |
|
246 { |
|
247 name = new CEmbeddingPackageStep; |
|
248 } |
|
249 else if (strippedStepName == KCreateTokenByCopy) |
|
250 { |
|
251 name = new CCreateTokenByCopy; |
|
252 } |
|
253 else if (strippedStepName == KCreateTokenFromStream) |
|
254 { |
|
255 name = new CCreateTokenFromStream; |
|
256 } |
|
257 else if (strippedStepName == KCertificateChainListStep) |
|
258 { |
|
259 name = new CCertificateChainListStep; |
|
260 } |
|
261 else if (strippedStepName == KSidToPackage) |
|
262 { |
|
263 name = new CSidToPackageStep; |
|
264 } |
|
265 else if (strippedStepName == KIsSidPresentSingleStep) |
|
266 { |
|
267 name = new CIsSidPresentSingleStep; |
|
268 } |
|
269 else if (strippedStepName == KAddEntryStep) |
|
270 { |
|
271 name = new CAddEntryStep; |
|
272 } |
|
273 else if (strippedStepName == KUpdateEntryStep) |
|
274 { |
|
275 name = new CUpdateEntryStep; |
|
276 } |
|
277 else if (strippedStepName == KIsPackageExistInRomStep) |
|
278 { |
|
279 name = new CPackageExistsInRomStep; |
|
280 } |
|
281 else if (strippedStepName == KFileDescriptionsStep) |
|
282 { |
|
283 name = new CFileDescriptionsStep; |
|
284 } |
|
285 else if (strippedStepName == KIsAugmentationStep) |
|
286 { |
|
287 name = new CIsAugmentationStep; |
|
288 } |
|
289 else if (strippedStepName == KFilesStep) |
|
290 { |
|
291 name = new CFilesStep; |
|
292 } |
|
293 else if (strippedStepName == KAugmentationsStep) |
|
294 { |
|
295 name = new CAugmentationsStep; |
|
296 } |
|
297 else if (strippedStepName == KPackageStep) |
|
298 { |
|
299 name = new CPackageStep; |
|
300 } |
|
301 else if (strippedStepName == KDependentPackagesStep) |
|
302 { |
|
303 name = new CDependentPackagesStep; |
|
304 } |
|
305 else if (strippedStepName == KDependenciesStep) |
|
306 { |
|
307 name = new CDependenciesStep; |
|
308 } |
|
309 else if (strippedStepName == KEmbeddedPackagesStep) |
|
310 { |
|
311 name = new CEmbeddedPackagesStep; |
|
312 } |
|
313 else if (strippedStepName == KDeleteSingleEntry) |
|
314 { |
|
315 name = new CSingleEntryDeleteStep; |
|
316 } |
|
317 else if (strippedStepName == KCreateSisRegistryObject) |
|
318 { |
|
319 name = new CCreateSisRegistryObject; |
|
320 } |
|
321 else if (strippedStepName == KIsFileRegisteredStep) |
|
322 { |
|
323 name = new CIsFileRegisteredStep; |
|
324 } |
|
325 else if (strippedStepName == KGetComponentIdForUidStep) |
|
326 { |
|
327 name = new CGetComponentIdForUidStep; |
|
328 } |
|
329 else if (strippedStepName == KSisRegistryDependencyStep) |
|
330 { |
|
331 name = new CSisRegistryDependencyStep; |
|
332 } |
|
333 else if (strippedStepName == KSisRegistryFileDescStep) |
|
334 { |
|
335 name = new CSisRegistryFileDescStep; |
|
336 } |
|
337 else if (strippedStepName == KControllerInfoStep) |
|
338 { |
|
339 name = new CControllerInfoStep; |
|
340 } |
|
341 else if (strippedStepName == KSisRegistryPropertyStep) |
|
342 { |
|
343 name = new CSisRegistryPropertyStep; |
|
344 } |
|
345 else if (strippedStepName == KApplicationManagerStep) |
|
346 { |
|
347 name = new CSisApplicationManagerStep; |
|
348 } |
|
349 else if (aStepName == KChangeLocale) |
|
350 { |
|
351 name = new CChangeLocaleStep; |
|
352 } |
|
353 |
|
354 if(performanceStep && name) |
|
355 { |
|
356 CSisRegistryTestStepBase *baseTestStep = dynamic_cast<CSisRegistryTestStepBase*>(name); |
|
357 baseTestStep->MarkAsPerformanceStep(); |
|
358 } |
|
359 |
|
360 return name; |
|
361 } |