|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32test.h> |
|
17 #include <f32file.h> |
|
18 #include <badesca.h> |
|
19 |
|
20 #include "srvrepos_noc.h" |
|
21 #include "srvres.h" |
|
22 #include "cachemgr.h" |
|
23 #include "sessnotf.h" |
|
24 #include "t_cenrep_helper.h" |
|
25 |
|
26 #include "testexecute/SWI/src/tui.h" |
|
27 #include <swi/launcher.h> |
|
28 #include "swi/sisregistrysession.h" |
|
29 #include "swi/sisregistrypackage.h" |
|
30 #include "swi/sisregistryentry.h" |
|
31 |
|
32 |
|
33 RTest TheTest(_L("Central Repository FOTx Unit Tests")); |
|
34 |
|
35 _LIT(KCachedVersionFile,"C:\\private\\10202be9\\romversion\\romversion_info.txt"); |
|
36 _LIT(KModified2RepositoryCre,"z:\\private\\10202be9\\10033333_modified2.cre"); |
|
37 _LIT(KPersistsRepositoryCre,"C:\\private\\10202be9\\persists\\10033333.cre"); |
|
38 _LIT(KStoredSWIRepository,"z:\\private\\10202be9\\10033333_modified3.cre"); |
|
39 _LIT(KSWIInstallRepository,"C:\\private\\10202be9\\10033333.cre"); |
|
40 _LIT(KModifiedSwVersion, "z:\\private\\10202be9\\sw_modified.txt"); |
|
41 _LIT(KStoredRepository,"z:\\private\\10202be9\\10033340_reserved.cre"); |
|
42 _LIT(KStoredRepository2,"z:\\private\\10202be9\\10033341_orig.cre"); |
|
43 _LIT(KPersistsBasedRepository,"C:\\private\\10202be9\\persists\\10033340.cre"); |
|
44 _LIT(KPersistsBasedRepository2,"C:\\private\\10202be9\\persists\\10033341.cre"); |
|
45 |
|
46 _LIT(KRomRepositoryCre1,"z:\\private\\10202be9\\10043336_persists.cre"); |
|
47 _LIT(KRomRepositoryCre2,"z:\\private\\10202be9\\10043337_persists.cre"); |
|
48 _LIT(KRomRepositoryCre3,"z:\\private\\10202be9\\10043338_persists.cre"); |
|
49 _LIT(KPersistsRepositoryCre1,"C:\\private\\10202be9\\persists\\10043336.cre"); |
|
50 _LIT(KPersistsRepositoryCre2,"C:\\private\\10202be9\\persists\\10043337.cre"); |
|
51 _LIT(KPersistsRepositoryCre3,"C:\\private\\10202be9\\persists\\10043338.cre"); |
|
52 |
|
53 |
|
54 _LIT(KSisFile,"z:\\private\\10202be9\\RF1.sis"); |
|
55 _LIT(KSisFile2,"z:\\private\\10202be9\\RF4.sis"); |
|
56 |
|
57 const TUid KUidRomRepositoryList[] = {0x10033333,0x10033340,0x10033341,0x10043336,0x10043337,0x10043338}; |
|
58 const TUint32 KNewSettingList[] = {1000,1001,0x2300,0x02010000}; |
|
59 const TUint32 KModifiedSettingList[] = {0x04010200,0x04010400,0x03010100}; |
|
60 const TUint32 KDeletedSettingList[] = {0x03010500,0x04010100,0x02010300}; |
|
61 const TUint32 KSWIBasedSettingList[] = {0x08010100}; |
|
62 const TInt KSettingValueList[] = {1234,1111,12345,10,200,400}; |
|
63 |
|
64 /////////////////////////////////////////////////////////////////////////////////////// |
|
65 /////////////////////////////////////////////////////////////////////////////////////// |
|
66 //Test macroses and functions |
|
67 |
|
68 LOCAL_C void DeleteFilesL() |
|
69 { |
|
70 _LIT( KOldInstallFiles, "c:\\private\\10202BE9\\*.cre" ); |
|
71 _LIT( KOldPersistsFiles, "c:\\private\\10202BE9\\persists\\100*.cre" ); |
|
72 _LIT( KOldRomVersionFiles, "c:\\private\\10202BE9\\romversion\\romversion_info.t*" ); |
|
73 CFileMan* fm = CFileMan::NewL( TServerResources::iFs ); |
|
74 CleanupStack::PushL( fm ); |
|
75 |
|
76 TInt r = fm->Delete( KOldInstallFiles ); |
|
77 if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound ) |
|
78 User::Leave(r); |
|
79 r = fm->Delete( KOldPersistsFiles); |
|
80 if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound ) |
|
81 User::Leave(r); |
|
82 r = fm->Delete( KOldRomVersionFiles,CFileMan::ERecurse); |
|
83 if ( r != KErrNone && r != KErrNotFound && r != KErrPathNotFound ) |
|
84 User::Leave(r); |
|
85 |
|
86 CleanupStack::PopAndDestroy( fm ); |
|
87 } |
|
88 |
|
89 LOCAL_C void Check( TInt aValue, TInt aLine ) |
|
90 { |
|
91 if ( !aValue ) |
|
92 { |
|
93 TheTest( EFalse, aLine ); |
|
94 } |
|
95 } |
|
96 |
|
97 LOCAL_C void Check( TInt aValue, TInt aExpected, TInt aLine ) |
|
98 { |
|
99 if ( aValue != aExpected ) |
|
100 { |
|
101 RDebug::Print( _L( "*** Expected error: %d, got: %d\r\n"), aExpected, aValue ); |
|
102 TheTest( EFalse, aLine ); |
|
103 } |
|
104 } |
|
105 |
|
106 #define TEST(arg) ::Check((arg), __LINE__) |
|
107 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) |
|
108 |
|
109 /////////////////////////////////////////////////////////////////////////////////////// |
|
110 /////////////////////////////////////////////////////////////////////////////////////// |
|
111 |
|
112 LOCAL_C void CleanUp() |
|
113 { |
|
114 // If cache manager is initialized and used before, we flush it |
|
115 if (TServerResources::iCacheManager) |
|
116 { |
|
117 TServerResources::iCacheManager->FlushCache(); |
|
118 } |
|
119 // To get rid of the iOpenRepositories array leaking problem during OOM testing. |
|
120 TServerResources::iObserver->CloseiOpenRepositories(); |
|
121 TServerResources::iObserver->Reset(); |
|
122 // To get rid of the array leaking problems during OOM testing. |
|
123 TServerResources::iOwnerIdLookUpTable.Reset(); |
|
124 User::After(KGeneralDelay); |
|
125 } |
|
126 |
|
127 LOCAL_C void PerformSWIinstallL(const TDesC& aSisFileName) |
|
128 { |
|
129 //******************************************************** |
|
130 //Requires stub file to be set up before it will work |
|
131 //requires techview |
|
132 //******************************************************** |
|
133 using namespace Swi; |
|
134 TUI* Ui = new(ELeave) TUI(); |
|
135 CInstallPrefs* prefs = CInstallPrefs::NewLC(); |
|
136 TInt err = Launcher::Install(*Ui, aSisFileName, *prefs); |
|
137 delete Ui; |
|
138 TEST2(err, KErrNone); |
|
139 CleanupStack::PopAndDestroy();//prefs |
|
140 |
|
141 User::After(KGeneralDelay); |
|
142 |
|
143 // If cache manager is initialized and used before, we flush it |
|
144 CleanUp(); |
|
145 } |
|
146 |
|
147 LOCAL_C void UserModifyRepositoryL() |
|
148 { |
|
149 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
150 CleanupStack::PushL(notifier); |
|
151 |
|
152 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
153 CleanupStack::PushL(repository); |
|
154 |
|
155 repository->OpenL(KUidRomRepositoryList[0],*notifier); |
|
156 |
|
157 User::LeaveIfError(repository->StartTransaction(EReadWriteTransaction)); |
|
158 |
|
159 TInt err = repository->TransactionDeleteL(KDeletedSettingList[0]); |
|
160 TEST2(err,KErrNone); |
|
161 |
|
162 err = repository->TransactionCreateL(KNewSettingList[1],KSettingValueList[0],NULL); |
|
163 TEST2(err,KErrNone); |
|
164 err = repository->TransactionCreateL(KNewSettingList[2],KSettingValueList[0],NULL); |
|
165 TEST2(err,KErrNone); |
|
166 err = repository->TransactionDeleteL(KDeletedSettingList[2]); |
|
167 TEST2(err,KErrNone); |
|
168 err = repository->TransactionDeleteL(KNewSettingList[1]);//remove a setting added by the user |
|
169 TEST2(err,KErrNone); |
|
170 err = repository->TransactionSetL(KModifiedSettingList[2],KSettingValueList[2]); |
|
171 TEST2(err,KErrNone); |
|
172 |
|
173 TUint32 tempKeyInfo; |
|
174 User::LeaveIfError(repository->CommitTransaction(tempKeyInfo)); |
|
175 |
|
176 repository->Close(); |
|
177 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
178 } |
|
179 |
|
180 LOCAL_C void UserModifyRepository2L() |
|
181 { |
|
182 //Have the user add,delete and modify some entries |
|
183 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
184 CleanupStack::PushL(notifier); |
|
185 |
|
186 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
187 CleanupStack::PushL(repository); |
|
188 repository->OpenL(KUidRomRepositoryList[0],*notifier); |
|
189 |
|
190 User::LeaveIfError(repository->StartTransaction(EReadWriteTransaction)); |
|
191 //0x03010500 has been deleted by user in modified persisted repository. |
|
192 //but this rom based deleted setting, should have been reinstated by the SWI, which also contains it. |
|
193 TInt settingValue = 0; |
|
194 TInt r = repository->Get(KDeletedSettingList[2], settingValue); |
|
195 TEST(r == KErrNone); |
|
196 |
|
197 //delete the SWI and rom based setting, it should be reinstated after the rom update. |
|
198 r = repository->TransactionDeleteL(KDeletedSettingList[2]); |
|
199 TEST2(r,KErrNone); |
|
200 // |
|
201 //Modify setting |
|
202 r = repository->TransactionSetL(KModifiedSettingList[2],KSettingValueList[2]); |
|
203 TEST2(r,KErrNone); |
|
204 //Add and delete a user setting |
|
205 r = repository->TransactionCreateL(KNewSettingList[1],KSettingValueList[0],NULL); |
|
206 TEST2(r,KErrNone); |
|
207 r = repository->TransactionDeleteL(KNewSettingList[1]);//remove a setting added by the user |
|
208 TEST2(r,KErrNone); |
|
209 //Add a user setting |
|
210 r = repository->TransactionCreateL(KNewSettingList[2],KSettingValueList[0],NULL); |
|
211 TEST2(r,KErrNone); |
|
212 |
|
213 TUint32 tempKeyInfo; |
|
214 User::LeaveIfError(repository->CommitTransaction(tempKeyInfo)); |
|
215 repository->Close(); |
|
216 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
217 } |
|
218 |
|
219 LOCAL_C void VerifyCorrectMergingL(TInt aVerifySwi = EFalse) |
|
220 { |
|
221 //Check the merge content for correctness. |
|
222 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
223 CleanupStack::PushL(notifier); |
|
224 |
|
225 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
226 CleanupStack::PushL(repository); |
|
227 |
|
228 repository->OpenL(KUidRomRepositoryList[0],*notifier); |
|
229 |
|
230 //Get the rom based user deleted setting, it should have been reinstated. |
|
231 TInt settingValue = 0; |
|
232 TInt r = repository->Get(KDeletedSettingList[2], settingValue); |
|
233 TEST(r == KErrNone); |
|
234 //Get the user based deleted setting, it should still be missing. |
|
235 r = repository->Get(KNewSettingList[1], settingValue); |
|
236 TEST(r == KErrNotFound); |
|
237 //Get the user added setting. |
|
238 r = repository->Get(KNewSettingList[2], settingValue); |
|
239 TEST(r == KErrNone); |
|
240 //Get user modified settings. It should contain the user modification |
|
241 r = repository->Get(KModifiedSettingList[2], settingValue); |
|
242 TEST(r == KErrNone); |
|
243 TEST(settingValue == KSettingValueList[2]); |
|
244 |
|
245 if(aVerifySwi) |
|
246 { |
|
247 //Get SWI modified settings for a clean rom value. It should contain the SWI modification |
|
248 settingValue = 0; |
|
249 r = repository->Get(KModifiedSettingList[0], settingValue); |
|
250 TEST(r == KErrNone); |
|
251 TEST(settingValue == KSettingValueList[2]); |
|
252 //Get SWI added setting |
|
253 r = repository->Get(KNewSettingList[0], settingValue); |
|
254 TEST(r == KErrNone); |
|
255 } |
|
256 repository->Close(); |
|
257 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
258 } |
|
259 |
|
260 /** |
|
261 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4025 |
|
262 @SYMTestCaseDesc This test verifies that a locally persisted copy of the rom version file |
|
263 is created after a call to CheckROMReflashL |
|
264 @SYMTestPriority High |
|
265 @SYMTestActions Remove locally persisted rom version file. |
|
266 Call CheckROMReflashL to simulate a reboot of cenrep. |
|
267 Check that locally persisted copy of rom version file is created. |
|
268 @SYMTestExpectedResults Persisted copy of rom version file has been created. |
|
269 @SYMCR CR1198 |
|
270 */ |
|
271 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4025L() |
|
272 { |
|
273 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4025 " ) ); |
|
274 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
275 |
|
276 // Remove locally stored rom version file if it exists |
|
277 TInt err = fm->Delete(KCachedVersionFile); |
|
278 if((err != KErrNotFound) && (err != KErrNone)) |
|
279 { |
|
280 RDebug::Print( _L( "*** UnExpected error: %d\r\n"), err ); |
|
281 TheTest( EFalse, __LINE__ ); |
|
282 } |
|
283 |
|
284 delete fm;//fm |
|
285 CServerRepository::CheckROMReflashL(); |
|
286 User::After(KGeneralDelay);//Allow the filesystem to write the files. |
|
287 |
|
288 TEntry entry; |
|
289 TEST(TServerResources::iFs.Entry(KCachedVersionFile,entry) == KErrNone); |
|
290 |
|
291 } |
|
292 |
|
293 /** |
|
294 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4026 |
|
295 @SYMTestCaseDesc This test verifies that when the locally persisted copy of the rom version file |
|
296 is equal to the rom version file then no merging takes place. |
|
297 @SYMTestPriority High |
|
298 @SYMTestActions Remove a rom based setting. |
|
299 Call CheckROMReflashL to simulate a reboot of cenrep. |
|
300 Check that the deleted value hasnt been reinstated. |
|
301 @SYMTestExpectedResults Deleted value hasnt been reinstated, demonstrating that no merge took place. |
|
302 @SYMCR CR1198 |
|
303 */ |
|
304 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4026L() |
|
305 { |
|
306 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4026 " ) ); |
|
307 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
308 |
|
309 //Initial cleanup |
|
310 fm->Delete(KPersistsRepositoryCre); |
|
311 delete fm;//fm |
|
312 |
|
313 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
314 CleanupStack::PushL(notifier); |
|
315 |
|
316 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
317 CleanupStack::PushL(repository); |
|
318 |
|
319 repository->OpenL(KUidRomRepositoryList[0],*notifier); |
|
320 |
|
321 //Attempt to retrieve a setting before deleting it. |
|
322 User::LeaveIfError(repository->StartTransaction(EReadWriteTransaction)); |
|
323 TInt settingValue = 0; |
|
324 TInt r = repository->Get(KDeletedSettingList[0], settingValue); |
|
325 TEST(r == KErrNone); |
|
326 |
|
327 repository->TransactionDeleteL(KDeletedSettingList[0]); |
|
328 TUint32 tempKeyInfo; |
|
329 User::LeaveIfError(repository->CommitTransaction(tempKeyInfo)); |
|
330 |
|
331 repository->Close(); |
|
332 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
333 |
|
334 //Dont Copy modified stored rom version info so that no rom update should take place |
|
335 |
|
336 // flush cache |
|
337 CleanUp(); |
|
338 |
|
339 CServerRepository::CheckROMReflashL(); |
|
340 |
|
341 notifier = new(ELeave)CSessionNotifier; |
|
342 CleanupStack::PushL(notifier); |
|
343 |
|
344 repository = new(ELeave) CServerRepository(); |
|
345 CleanupStack::PushL(repository); |
|
346 |
|
347 repository->OpenL(KUidRomRepositoryList[0],*notifier); |
|
348 |
|
349 r = repository->Get(KDeletedSettingList[0], settingValue); |
|
350 TEST(r == KErrNotFound);//It hasnt been reinstated. |
|
351 |
|
352 repository->Close(); |
|
353 |
|
354 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
355 |
|
356 // If cache manager is initialized and used before, we flush it |
|
357 CleanUp(); |
|
358 } |
|
359 |
|
360 /** |
|
361 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4027 |
|
362 @SYMTestCaseDesc This test verifies that after a rom flash, rom and user modified values are merged correctly. |
|
363 @SYMTestPriority High |
|
364 @SYMTestActions Open a repository and create two settings. |
|
365 Delete a rom based setting. |
|
366 Delete on of the new settings. |
|
367 Remove a rom based setting. |
|
368 Modify a rom based setting. |
|
369 Call CheckROMReflashL to simulate a reboot of cenrep. |
|
370 Check that the deleted rom base value has been reinstated. |
|
371 Check that the deleted user setting hasnt been reinstated. |
|
372 |
|
373 @SYMTestExpectedResults Deleted user value hasnt been reinstated. |
|
374 Deleted rom based value has been reinstated. |
|
375 Other User added setting is present. |
|
376 User modified setting contains user value. |
|
377 @SYMCR CR1198 |
|
378 */ |
|
379 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4027L() |
|
380 { |
|
381 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4027 " ) );//Force a rom update for this repository. |
|
382 |
|
383 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
384 CleanupStack::PushL(fm); |
|
385 |
|
386 //Initial cleanup |
|
387 fm->Delete(KPersistsRepositoryCre); |
|
388 |
|
389 //Copy of modified stored rom version info |
|
390 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
391 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
392 User::After(KGeneralDelay); |
|
393 |
|
394 UserModifyRepositoryL(); |
|
395 |
|
396 // flush the cache manager contents. |
|
397 CleanUp(); |
|
398 |
|
399 CServerRepository::CheckROMReflashL(); |
|
400 |
|
401 VerifyCorrectMergingL(EFalse); |
|
402 |
|
403 //Final Cleanup |
|
404 fm->Delete(KPersistsRepositoryCre); |
|
405 |
|
406 CleanupStack::PopAndDestroy();//fm |
|
407 |
|
408 // If cache manager is initialized and used before, we flush it |
|
409 CleanUp(); |
|
410 } |
|
411 |
|
412 /** |
|
413 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4028 |
|
414 @SYMTestCaseDesc This test verifies that repositories that exist in persists directory but have |
|
415 no basis in install or rom are removed after a rom update. |
|
416 @SYMTestPriority High |
|
417 @SYMTestActions Copy a repository into the persists directory that has no rom or SWI equivalent. |
|
418 Call CheckROMReflashL to simulate a reboot of cenrep. |
|
419 Verify that the persisted repository is removed. |
|
420 |
|
421 @SYMTestExpectedResults Persisted repository is removed during rom update. |
|
422 @SYMCR CR1198 |
|
423 */ |
|
424 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4028L() |
|
425 { |
|
426 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4028 " ) ); |
|
427 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
428 CleanupStack::PushL(fm); |
|
429 |
|
430 //Initial cleanup |
|
431 fm->Delete(KPersistsBasedRepository); |
|
432 |
|
433 //Place a repository in persists that has no basis in SWI or rom and it should be removed. |
|
434 //by the rom update as it will look like a rom based repository that has been removed by |
|
435 //the update. |
|
436 |
|
437 //Copy the repository that isnt in SWI or ROM to persists |
|
438 //Copy 100333340_reserved to 100333340.cre persists |
|
439 User::LeaveIfError(fm->Copy(KStoredRepository,KPersistsBasedRepository,CFileMan::EOverWrite)); |
|
440 User::LeaveIfError(fm->Attribs(KPersistsBasedRepository,0,KEntryAttReadOnly,TTime(0))); |
|
441 User::After(KGeneralDelay); |
|
442 //Copy of modified stored rom version info |
|
443 |
|
444 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
445 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
446 User::After(KGeneralDelay); |
|
447 CleanupStack::PopAndDestroy();//fm |
|
448 |
|
449 CServerRepository::CheckROMReflashL(); |
|
450 TEntry entry; |
|
451 |
|
452 TEST(TServerResources::iFs.Entry(KPersistsBasedRepository,entry) == KErrNotFound); |
|
453 |
|
454 } |
|
455 |
|
456 /** |
|
457 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4029 |
|
458 @SYMTestCaseDesc This test verifies that a repository is merged correctly with SWI and user changes after a rom update. |
|
459 @SYMTestPriority High |
|
460 @SYMTestActions Copy a prepared repository into the persists directory that contains clean |
|
461 settings that do not exist in its rom equivalent,missing settings that exist in |
|
462 its rom equivalent and user modified settings that differ from its rom equivalent. |
|
463 Perform an SWI install to modify and add some settings. |
|
464 The user adds,deletes and modifies some settings. |
|
465 Copy a modified rom version file over the locally persisted rom version file. |
|
466 Call CheckROMReflashL to simulate a reboot of cenrep. |
|
467 @SYMTestExpectedResults Verify that the persisted repository clean settings that do not exist in rom equivalent are removed. |
|
468 Verify that settings in the rom repository that are not in the persisted repository are added. |
|
469 Verify that user modified settings retain user values. |
|
470 Verify that the rom based user deleted setting are reinstated. |
|
471 Verify that the user based deleted setting is not present. |
|
472 Verify the user added setting exists. |
|
473 @SYMCR CR1198 |
|
474 */ |
|
475 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4029L() |
|
476 { |
|
477 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4029 " ) ); |
|
478 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
479 CleanupStack::PushL(fm); |
|
480 |
|
481 //Initial cleanup |
|
482 fm->Delete(KPersistsRepositoryCre); |
|
483 |
|
484 //Merge User, Rom and SWI settings. |
|
485 //Need to copy a repository into the persists, that has a variance from the rom based |
|
486 //repository to give the impression that some of the rom based entries have been modified, |
|
487 // removed and added by the rom update. |
|
488 //Copy a modified repository |
|
489 |
|
490 User::LeaveIfError(fm->Copy(KModified2RepositoryCre,KPersistsRepositoryCre,CFileMan::EOverWrite)); |
|
491 User::LeaveIfError(fm->Attribs(KPersistsRepositoryCre,0,KEntryAttReadOnly,TTime(0))); |
|
492 User::After(KGeneralDelay); |
|
493 //Have SWI add and modify some entries. |
|
494 TFileName SisFileName; |
|
495 SisFileName.Copy(KSisFile); |
|
496 |
|
497 PerformSWIinstallL(SisFileName); |
|
498 User::After(KGeneralDelay*5); |
|
499 |
|
500 UserModifyRepository2L(); |
|
501 |
|
502 //flush cachemanager contents |
|
503 CleanUp(); |
|
504 |
|
505 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
506 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
507 User::After(KGeneralDelay); |
|
508 |
|
509 CleanupStack::PopAndDestroy();//fm |
|
510 |
|
511 CServerRepository::CheckROMReflashL(); |
|
512 |
|
513 VerifyCorrectMergingL(ETrue); |
|
514 |
|
515 // If cache manager is initialized and used before, we flush it |
|
516 CleanUp(); |
|
517 } |
|
518 |
|
519 /** |
|
520 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4030 |
|
521 @SYMTestCaseDesc A repository is removed from the ROM but has an SWI, it remains on the C:\ |
|
522 but all clean settings that do not exist in the SWI install file are removed. |
|
523 @SYMTestPriority High |
|
524 @SYMTestActions Copy a prepared repository into the persists directory that has no basis |
|
525 in ROM. |
|
526 Perform an SWI, that adds new keys to the persisted repository. |
|
527 Have the user create a new entry. |
|
528 Have the user modify a rom based entry. |
|
529 Update the locally persisted rom version file. |
|
530 Call CheckROMReflashL to simulate a centrep reboot. |
|
531 @SYMTestExpectedResults Verify the user modified rom based setting exists. |
|
532 Verify that a clean rom based setting is removed. |
|
533 Verify that a sample of the SWI based setting exists. |
|
534 @SYMCR CR1198 |
|
535 */ |
|
536 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4030L() |
|
537 { |
|
538 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4030 " ) ); |
|
539 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
540 CleanupStack::PushL(fm); |
|
541 |
|
542 //Initial cleanup |
|
543 DeleteFilesL(); |
|
544 |
|
545 //Remove ROM and Merge User and SWI settings. |
|
546 //Need to copy a prepared repository into the persists,that has more entries than the SWI based |
|
547 //repository to simulate that some of the rom based entries have been removed, |
|
548 //by the rom update. All the clean entries should be removed, leaving only user modified ones and common SWI ones. |
|
549 User::LeaveIfError(fm->Copy(KStoredRepository2,KPersistsBasedRepository2,CFileMan::EOverWrite)); |
|
550 User::LeaveIfError(fm->Attribs(KPersistsBasedRepository2,0,KEntryAttReadOnly,TTime(0))); |
|
551 User::After(KGeneralDelay); |
|
552 //Have SWI add some entries 0x08010100-500. |
|
553 TFileName SisFileName; |
|
554 SisFileName.Copy(KSisFile2); |
|
555 |
|
556 PerformSWIinstallL(SisFileName); |
|
557 User::After(KGeneralDelay*2); |
|
558 |
|
559 //Have the user add and modify some rom based entries |
|
560 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
561 CleanupStack::PushL(notifier); |
|
562 |
|
563 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
564 CleanupStack::PushL(repository); |
|
565 repository->OpenL(KUidRomRepositoryList[2],*notifier); |
|
566 |
|
567 User::LeaveIfError(repository->StartTransaction(EReadWriteTransaction)); |
|
568 // |
|
569 //Modify setting |
|
570 TInt r = repository->TransactionSetL(KModifiedSettingList[2],KSettingValueList[2]); |
|
571 TEST2(r,KErrNone); |
|
572 |
|
573 //Add a setting |
|
574 r = repository->TransactionCreateL(KNewSettingList[2],KSettingValueList[0],NULL); |
|
575 TEST2(r,KErrNone); |
|
576 |
|
577 //Get some clean rom based settings to show they are present |
|
578 TInt settingValue = 0; |
|
579 r = repository->Get(KModifiedSettingList[0], settingValue); |
|
580 TEST(r == KErrNone); |
|
581 |
|
582 //Get some clean rom based settings to show they are present |
|
583 settingValue = 0; |
|
584 r = repository->Get(KModifiedSettingList[1], settingValue); |
|
585 TEST(r == KErrNone); |
|
586 |
|
587 TUint32 tempKeyInfo; |
|
588 User::LeaveIfError(repository->CommitTransaction(tempKeyInfo)); |
|
589 repository->Close(); |
|
590 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
591 |
|
592 // If cache manager is initialized and used before, we flush it |
|
593 CleanUp(); |
|
594 |
|
595 //Copy of modified stored rom version info |
|
596 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
597 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
598 User::After(KGeneralDelay); |
|
599 CleanupStack::PopAndDestroy();//fm |
|
600 |
|
601 CServerRepository::CheckROMReflashL(); |
|
602 |
|
603 //Check the merge content for correctness. |
|
604 notifier = new(ELeave)CSessionNotifier; |
|
605 CleanupStack::PushL(notifier); |
|
606 |
|
607 repository = new(ELeave) CServerRepository(); |
|
608 CleanupStack::PushL(repository); |
|
609 repository->OpenL(KUidRomRepositoryList[2],*notifier); |
|
610 |
|
611 //Get the rom based user modified setting it should still be there |
|
612 settingValue = 0; |
|
613 r = repository->Get(KModifiedSettingList[2], settingValue); |
|
614 TEST(r == KErrNone); |
|
615 |
|
616 //Get the rom only based clean setting, it should still be missing. |
|
617 r = repository->Get(KModifiedSettingList[0], settingValue); |
|
618 TEST(r == KErrNotFound); |
|
619 |
|
620 //Get the rom only based clean setting, it should still be missing. |
|
621 r = repository->Get(KModifiedSettingList[1], settingValue); |
|
622 TEST(r == KErrNotFound); |
|
623 |
|
624 //Get SWI based setting. It should be there |
|
625 r = repository->Get(KSWIBasedSettingList[0], settingValue); |
|
626 TEST(r == KErrNone); |
|
627 |
|
628 //Get user based setting. It should be there |
|
629 r = repository->Get(KNewSettingList[2], settingValue); |
|
630 TEST(r == KErrNone); |
|
631 repository->Close(); |
|
632 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
633 |
|
634 // If cache manager is initialized and used before, we flush it |
|
635 CleanUp(); |
|
636 } |
|
637 |
|
638 /** |
|
639 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4031 |
|
640 @SYMTestCaseDesc Test that repository settings that are altered by SWI value are not overwritten by a rom flash. |
|
641 SWI values dominate ROM values. |
|
642 @SYMTestPriority High |
|
643 @SYMTestActions Copy a prepared repository into the persists directory and into the install directory. |
|
644 There exists and equivalent rom based version of this repository with different values. |
|
645 Update the locally persisted rom version file. |
|
646 Call CheckROMReflashL to simulate a centrep reboot. |
|
647 @SYMTestExpectedResults Verify the user modified rom based setting exists. |
|
648 Verify that some settings that exists within ROM and SWI has SWI values. |
|
649 @SYMCR CR1198 |
|
650 */ |
|
651 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4031L() |
|
652 { |
|
653 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4031 " ) ); |
|
654 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
655 CleanupStack::PushL(fm); |
|
656 |
|
657 //Initial cleanup |
|
658 fm->Delete(KPersistsRepositoryCre); |
|
659 fm->Delete(KSWIInstallRepository); |
|
660 |
|
661 //Simulate an SWI install by having the modified repository in the install and persists directory. |
|
662 User::LeaveIfError(fm->Copy(KStoredSWIRepository,KPersistsRepositoryCre,CFileMan::EOverWrite)); |
|
663 User::LeaveIfError(fm->Attribs(KPersistsRepositoryCre,0,KEntryAttReadOnly,TTime(0))); |
|
664 User::After(KGeneralDelay); |
|
665 User::LeaveIfError(fm->Copy(KStoredSWIRepository,KSWIInstallRepository,CFileMan::EOverWrite)); |
|
666 User::LeaveIfError(fm->Attribs(KSWIInstallRepository,0,KEntryAttReadOnly,TTime(0))); |
|
667 User::After(KGeneralDelay); |
|
668 |
|
669 //Copy of modified stored rom version info |
|
670 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
671 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
672 User::After(KGeneralDelay); |
|
673 CleanupStack::PopAndDestroy();//fm |
|
674 |
|
675 CServerRepository::CheckROMReflashL(); |
|
676 |
|
677 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
678 CleanupStack::PushL(notifier); |
|
679 |
|
680 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
681 CleanupStack::PushL(repository); |
|
682 repository->OpenL(KUidRomRepositoryList[0],*notifier); |
|
683 |
|
684 //Get the rom based user modified setting it should still be there |
|
685 TInt settingValue = 0; |
|
686 TInt r = repository->Get(KModifiedSettingList[0], settingValue); |
|
687 TEST(r == KErrNone); |
|
688 TEST(settingValue == KSettingValueList[4]); |
|
689 |
|
690 //Get the rom and SWI setting it should have SWI value |
|
691 r = repository->Get(KModifiedSettingList[1], settingValue); |
|
692 TEST(r == KErrNone); |
|
693 TEST(settingValue == KSettingValueList[5]); |
|
694 |
|
695 //Get the rom and SWI setting it should have SWI value |
|
696 r = repository->Get(KModifiedSettingList[2], settingValue); |
|
697 TEST(r == KErrNone); |
|
698 TEST(settingValue == KSettingValueList[2]); |
|
699 |
|
700 repository->Close(); |
|
701 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
702 |
|
703 // If cache manager is initialized and used before, we flush it |
|
704 CleanUp(); |
|
705 } |
|
706 |
|
707 /** |
|
708 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-UT-4032 |
|
709 @SYMTestCaseDesc This test checks that after a rom flash that contains a corrupt repository. |
|
710 The corrupt repository is skipped and the non corrupt repositories are processed as normal. |
|
711 @SYMTestPriority High |
|
712 @SYMTestActions Copy 3 prepared repositories into persists dir. |
|
713 Two user new settings are added[1000,1001]. |
|
714 One user setting is deleted [1001]. |
|
715 One rom setting is deleted [0x04010100]. |
|
716 One rom setting is modified [0x04010200]. |
|
717 Copy modified rom version file over local persisted version |
|
718 Call CheckRomFlash |
|
719 @SYMTestExpectedResults Verfiy that the corrupt repository 10043337 is skipped and the other repositories are processed. |
|
720 @SYMCR CR1198 |
|
721 */ |
|
722 LOCAL_C void SYSLIB_CENTRALREPOSITORY_UT_4032L() |
|
723 { |
|
724 TheTest.Next( _L( " @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-UT-4032 " ) ); |
|
725 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
726 CleanupStack::PushL(fm); |
|
727 |
|
728 //Initial cleanup |
|
729 fm->Delete(KPersistsRepositoryCre1); |
|
730 fm->Delete(KPersistsRepositoryCre2); |
|
731 fm->Delete(KPersistsRepositoryCre3); |
|
732 //Copy of modified stored rom version info |
|
733 |
|
734 //Copy 10043336,10043337 and 10043338 prepared repositories into persists directory. |
|
735 //These repositories have a two user added,1 user deleted,1 rom deleted and 1 rom modified settings. |
|
736 User::LeaveIfError(fm->Copy(KRomRepositoryCre1,KPersistsRepositoryCre1,CFileMan::EOverWrite)); |
|
737 User::LeaveIfError(fm->Attribs(KPersistsRepositoryCre1,0,KEntryAttReadOnly,TTime(0))); |
|
738 User::LeaveIfError(fm->Copy(KRomRepositoryCre2,KPersistsRepositoryCre2,CFileMan::EOverWrite)); |
|
739 User::LeaveIfError(fm->Attribs(KPersistsRepositoryCre2,0,KEntryAttReadOnly,TTime(0))); |
|
740 User::LeaveIfError(fm->Copy(KRomRepositoryCre3,KPersistsRepositoryCre3,CFileMan::EOverWrite)); |
|
741 User::LeaveIfError(fm->Attribs(KPersistsRepositoryCre3,0,KEntryAttReadOnly,TTime(0))); |
|
742 User::After(KGeneralDelay); |
|
743 |
|
744 //Copy of modified stored rom version info |
|
745 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
746 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
747 User::After(KGeneralDelay); |
|
748 CleanupStack::PopAndDestroy();//fm |
|
749 |
|
750 CServerRepository::CheckROMReflashL(); |
|
751 |
|
752 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
753 CleanupStack::PushL(notifier); |
|
754 |
|
755 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
756 CleanupStack::PushL(repository); |
|
757 |
|
758 TInt ii = 3; |
|
759 while(ii < 6) |
|
760 { |
|
761 repository->OpenL(KUidRomRepositoryList[ii],*notifier); |
|
762 //Get the user added setting it should still be there |
|
763 TInt settingValue = 0; |
|
764 TInt r = repository->Get(KNewSettingList[0], settingValue); |
|
765 TEST(r == KErrNone); |
|
766 |
|
767 //Get the rom added value |
|
768 r = repository->Get(KNewSettingList[3], settingValue); |
|
769 if(ii == 4)//Corrupted rom repository is skipped, so it wont have been added |
|
770 { |
|
771 TEST2(r, KErrNotFound); |
|
772 } |
|
773 else |
|
774 { |
|
775 TEST2(r, KErrNone); |
|
776 } |
|
777 |
|
778 //Get the rom deleted value, it will have been reinstated |
|
779 r = repository->Get(KDeletedSettingList[1], settingValue); |
|
780 if(ii == 4)//Corrupted rom repository is skipped, so it wont have been added |
|
781 { |
|
782 TEST2(r, KErrNotFound); |
|
783 } |
|
784 else |
|
785 { |
|
786 TEST2(r, KErrNone); |
|
787 } |
|
788 |
|
789 //Get the user added and deleted value, it shouldnt be there. |
|
790 r = repository->Get(KNewSettingList[1], settingValue); |
|
791 TEST2(r, KErrNotFound); |
|
792 |
|
793 // Close repository |
|
794 repository->Close(); |
|
795 ii++; |
|
796 } |
|
797 |
|
798 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
799 |
|
800 // If cache manager is initialized and used before, we flush it |
|
801 CleanUp(); |
|
802 } |
|
803 |
|
804 /** |
|
805 @SYMTestCaseID PDS-CENTRALREPOSITORY-UT-4083 |
|
806 @SYMTestCaseDesc This test verifies that after a rom flash, rom and user modified values are merged correctly |
|
807 and all policies/meta are set correctly |
|
808 @SYMTestPriority High |
|
809 @SYMTestActions The test is used to simulate the rom flashing.It starts with 2 ROM keyspaces, the 2nd rom keyspace |
|
810 CADACADA been the "updated" ROM keyspace. The test starts with loading old rom keyspace, modify |
|
811 keyspace and then persisted under the "updated" ROM keyspace UID. So next time when we open |
|
812 the "updated" ROM keyspace, a remerging will happen. The properites of the keyspace and the |
|
813 individual settings are verified wrt the policies and metadata |
|
814 @SYMTestExpectedResults The merging is correct with policies and meta specified in new ROM correctly applied to the |
|
815 persisted file |
|
816 @SYMDEF INC134085 |
|
817 */ |
|
818 |
|
819 //class to allow direct access to TSecurityPolicy class |
|
820 class TCompiledSecurityPolicy |
|
821 { |
|
822 public: |
|
823 TCompiledSecurityPolicy(TSecurityPolicy aPolicy):iPolicy(aPolicy){} |
|
824 TBool IsTypeFail() |
|
825 { |
|
826 return iPolicy.iType==TSecurityPolicy::ETypeFail; |
|
827 } |
|
828 TBool IsTypePass() |
|
829 { |
|
830 return iPolicy.iType==TSecurityPolicy::ETypePass; |
|
831 } |
|
832 public: |
|
833 TSecurityPolicy iPolicy; |
|
834 }; |
|
835 |
|
836 LOCAL_C void INC134085L() |
|
837 { |
|
838 TheTest.Next( _L( " @SYMTestCaseID:PDS-CENTRALREPOSITORY-UT-4083 " ) ); |
|
839 CFileMan* fm = CFileMan::NewL(TServerResources::iFs); |
|
840 CleanupStack::PushL(fm); |
|
841 |
|
842 //orig_rom Test Uid |
|
843 const TUid KTestUid={0xCABACABA}; |
|
844 //updated_rom Test Uid |
|
845 const TUid KUpdatedRomUid={0xCADACADA}; |
|
846 |
|
847 //Initial cleanup |
|
848 _LIT(KPersistsRepositoryCre,"C:\\private\\10202be9\\persists\\cadacada.cre"); |
|
849 fm->Delete(KPersistsRepositoryCre); |
|
850 |
|
851 //Copy of modified stored rom version info |
|
852 User::LeaveIfError(fm->Copy(KModifiedSwVersion,KCachedVersionFile,CFileMan::EOverWrite)); |
|
853 User::LeaveIfError(fm->Attribs(KCachedVersionFile,0,KEntryAttReadOnly,TTime(0))); |
|
854 User::After(KGeneralDelay); |
|
855 |
|
856 |
|
857 //-------------------------Modify one of the settings-------------------------------- |
|
858 CSessionNotifier* notifier = new(ELeave)CSessionNotifier; |
|
859 CleanupStack::PushL(notifier); |
|
860 CServerRepository* repository = new(ELeave) CServerRepository(); |
|
861 CleanupStack::PushL(repository); |
|
862 |
|
863 //Need to reset the Uid to the new ROM value to ensure when persisting it is persisted |
|
864 //under the new ROM Uid value in order to simulate the ROM Reflash later |
|
865 repository->OpenL(KTestUid,*notifier); |
|
866 repository->iUid=KUpdatedRomUid; |
|
867 repository->iRepository->SetUid(KUpdatedRomUid); |
|
868 TServerResources::iObserver->RemoveObserver(KTestUid,repository,0); |
|
869 TServerResources::iObserver->RemoveSharedRepositoryInfo(KTestUid); |
|
870 |
|
871 TServerResources::iObserver->AddObserverL(KUpdatedRomUid, repository); |
|
872 TServerResources::iObserver->AddSharedRepositoryInfoL(KUpdatedRomUid); |
|
873 |
|
874 //set a string key |
|
875 TBuf8<100> KTestString; |
|
876 KTestString.Copy(_L("voicemailboxnumber")); |
|
877 User::LeaveIfError(repository->StartTransaction(EReadWriteTransaction)); |
|
878 TInt err = repository->TransactionSetL(1,KTestString); |
|
879 TEST2(err,KErrNone); |
|
880 //a old ROM setting that has been modified by the user remains there even |
|
881 //when the new ROM does not contain that setting |
|
882 err = repository->TransactionSetL(0x300,5); |
|
883 TEST2(err,KErrNone); |
|
884 TUint32 tempKeyInfo; |
|
885 User::LeaveIfError(repository->CommitTransaction(tempKeyInfo)); |
|
886 |
|
887 repository->Close(); |
|
888 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
889 |
|
890 //--------------------------Simulate the ROM Reflash--------------------------------- |
|
891 // flush the cache manager contents. |
|
892 CleanUp(); |
|
893 CServerRepository::CheckROMReflashL(); |
|
894 |
|
895 |
|
896 //--------------------------Validate the merging-------------------------------------- |
|
897 notifier-new (ELeave)CSessionNotifier; |
|
898 CleanupStack::PushL(notifier); |
|
899 repository = new(ELeave) CServerRepository(); |
|
900 CleanupStack::PushL(repository); |
|
901 repository->OpenL(KUpdatedRomUid,*notifier); |
|
902 |
|
903 //validate the keyspace global properties |
|
904 RSettingsArray& settings=repository->iRepository->iSimRep->SettingsArray(); |
|
905 TEST2(settings.Count(),22); |
|
906 RArray<TUint32>& deletedArray=repository->iRepository->iSimRep->DeletedSettingsArray(); |
|
907 TEST2(deletedArray.Count(),0) ; |
|
908 RRangePolicyArray& rangePolicy=repository->iRepository->iSimRep->RangePolicyArray(); |
|
909 TEST2(rangePolicy.Count(),1); |
|
910 RPointerArray<TSettingsAccessPolicy>& individualPolicy=repository->iRepository->iSimRep->SinglePolicyArray(); |
|
911 TEST2(individualPolicy.Count(),20); |
|
912 |
|
913 RDefaultMetaArray& rangeMeta=repository->iRepository->iSimRep->RangeMetaArray(); |
|
914 TEST2(rangeMeta.Count(),1); |
|
915 for (TInt i=0;i<settings.Count();i++) |
|
916 { |
|
917 TUint32 key=settings[i].Key(); |
|
918 |
|
919 //-------------validate the meta------------ |
|
920 //validate the meta only the modfiied setting will be not clean |
|
921 if (key!=1 && key!=0x300) |
|
922 TEST(settings[i].IsClean()); |
|
923 else |
|
924 TEST(!settings[i].IsClean()); |
|
925 TUint32 meta=settings[i].Meta(); |
|
926 if (key==0 || key==0x11) |
|
927 TEST(settings[i].Meta()==0x81000000); |
|
928 //settings that have been modified |
|
929 else if (key==1) |
|
930 TEST(settings[i].Meta()==0x01000000); |
|
931 //settings that used the range defined meta |
|
932 else if (key==0x300) |
|
933 TEST(settings[i].Meta()==300); |
|
934 else |
|
935 TEST(settings[i].Meta()==0x80000000); |
|
936 |
|
937 //------------validate the security policies----- |
|
938 TCompiledSecurityPolicy r_tsp(*(settings[i].GetReadAccessPolicy())); |
|
939 TEST(r_tsp.IsTypePass()); |
|
940 TCompiledSecurityPolicy w_tsp(*(settings[i].GetWriteAccessPolicy())); |
|
941 if (key==5 || key==9 || key==16 || key==22) |
|
942 TEST(w_tsp.IsTypeFail()); |
|
943 |
|
944 } |
|
945 |
|
946 repository->Close(); |
|
947 CleanupStack::PopAndDestroy(2);//repository, notifier |
|
948 CleanupStack::PopAndDestroy();//fm |
|
949 |
|
950 // If cache manager is initialized and used before, we flush it |
|
951 CleanUp(); |
|
952 } |
|
953 |
|
954 LOCAL_C void FuncTestsL() |
|
955 { |
|
956 SYSLIB_CENTRALREPOSITORY_UT_4025L(); |
|
957 SYSLIB_CENTRALREPOSITORY_UT_4026L(); |
|
958 SYSLIB_CENTRALREPOSITORY_UT_4027L(); |
|
959 SYSLIB_CENTRALREPOSITORY_UT_4028L(); |
|
960 SYSLIB_CENTRALREPOSITORY_UT_4029L(); |
|
961 SYSLIB_CENTRALREPOSITORY_UT_4030L(); |
|
962 SYSLIB_CENTRALREPOSITORY_UT_4031L(); |
|
963 SYSLIB_CENTRALREPOSITORY_UT_4032L(); |
|
964 INC134085L(); |
|
965 } |
|
966 |
|
967 LOCAL_C void DoTestsL() |
|
968 { |
|
969 |
|
970 TheTest.Start( _L( "FOTA functionality" ) ); |
|
971 FuncTestsL(); |
|
972 TheTest.End(); |
|
973 |
|
974 } |
|
975 |
|
976 LOCAL_C void MainL() |
|
977 { |
|
978 __UHEAP_MARK; |
|
979 TheTest.Start( _L( "Fota Tests" ) ); |
|
980 |
|
981 // create and install the active scheduler we need |
|
982 CActiveScheduler* s = new(ELeave) CActiveScheduler; |
|
983 CleanupStack::PushL( s ); |
|
984 CActiveScheduler::Install( s ); |
|
985 |
|
986 TServerResources::InitialiseL(); |
|
987 |
|
988 DeleteFilesL(); |
|
989 |
|
990 DoTestsL(); |
|
991 |
|
992 DeleteFilesL(); |
|
993 TServerResources::Close(); |
|
994 |
|
995 // Cleanup the scheduler |
|
996 CleanupStack::PopAndDestroy( s ); |
|
997 |
|
998 TheTest.End(); |
|
999 TheTest.Close(); |
|
1000 __UHEAP_MARKEND; |
|
1001 } |
|
1002 |
|
1003 TInt E32Main() |
|
1004 { |
|
1005 __UHEAP_MARK; |
|
1006 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
1007 if ( !cleanup ) |
|
1008 return KErrNoMemory; |
|
1009 |
|
1010 TRAPD( err, MainL() ); |
|
1011 TEST2(err, KErrNone); |
|
1012 |
|
1013 delete cleanup; |
|
1014 __UHEAP_MARKEND; |
|
1015 |
|
1016 return 0; |
|
1017 } |
|
1018 |