21 #include "../common/inc/srvdefs.h" |
21 #include "../common/inc/srvdefs.h" |
22 #include "../cenrepsrv/srvparams.h" |
22 #include "../cenrepsrv/srvparams.h" |
23 |
23 |
24 using namespace NCentralRepositoryConstants; |
24 using namespace NCentralRepositoryConstants; |
25 |
25 |
26 RTest TheTest(_L("Central Repository Tests")); |
26 RTest TheTest(_L("t_cenrep.exe")); |
|
27 |
|
28 _LIT( KCentralRepositoryServerName, "Centralrepositorysrv"); |
27 |
29 |
28 TBool OomTesting; |
30 TBool OomTesting; |
29 |
31 |
30 const TUid KUidTestRepository1 = { 0x00000001 }; |
32 const TUid KUidTestRepository1 = { 0x00000001 }; |
31 const TUid KUidCreTestRepository1 = { 0x22222221 }; |
33 const TUid KUidCreTestRepository1 = { 0x22222221 }; |
32 const TUid KUidTestRepository2 = { 0x00000002 }; |
34 const TUid KUidTestRepository2 = { 0x00000002 }; |
33 |
35 |
|
36 #if defined(SYMBIAN_INCLUDE_APP_CENTRIC) |
|
37 const TUid KUidTxtPMATestRepos1 = { 0xf1000111 }; //ROM PMA txt repos |
|
38 const TUid KUidCrePMATestRepos1 = { 0xf1000112 }; //ROM PMA cre repos |
|
39 const TUid KUidCrePMAinPMADriveTestRepos1 = { 0xf1000113 }; //PMA drive cre repos |
|
40 const TUid KUidCorruptRepos1 = { 0xf1000114 }; //Non-PMA Repos in PMA drive |
|
41 const TUid KUidCorruptRepos2 = { 0xf1000115 }; //PMA Repos in persist folder |
|
42 const TUid KUidTxtInPMADriveRepos1 = { 0xf1000116 }; //TXT Repos in PMA drive |
|
43 const TUid KUidPmaTxtInInstallDir1 = { 0xf1000117 }; //TXT Repos in PMA drive |
|
44 const TUid KUidPmaCreInInstallDir1 = { 0xf1000118 }; //TXT Repos in PMA drive |
|
45 #endif |
|
46 |
|
47 |
34 const TUid KUidCorruptRepository = { 0x00000003 }; |
48 const TUid KUidCorruptRepository = { 0x00000003 }; |
35 const TUid KUidResetTestRepository = { 0x00000004 }; |
49 const TUid KUidResetTestRepository = { 0x00000004 }; |
36 |
50 |
37 const TUid KUidDriveCRepository = { 0x00000010 }; |
51 const TUid KUidDriveZRepository = { 0x00000010 }; |
38 |
52 |
39 const TUid KUidDriveCOnlyRepository = { 0x00000013 }; |
53 const TUid KUidDriveCOnlyRepository = { 0x00000013 }; |
40 |
54 |
41 const TUid KUidTestRepository3 = { 0x00000103 }; |
55 const TUid KUidTestRepository3 = { 0x00000103 }; |
42 |
56 |
100 |
114 |
101 |
115 |
102 |
116 |
103 /////////////////////////////////////////////////////////////////////////////////////// |
117 /////////////////////////////////////////////////////////////////////////////////////// |
104 /////////////////////////////////////////////////////////////////////////////////////// |
118 /////////////////////////////////////////////////////////////////////////////////////// |
105 //Test macroses and functions |
119 //Test macros and functions |
106 |
120 |
107 LOCAL_C void CheckL(TInt aValue, TInt aLine) |
121 LOCAL_C void CheckL(TInt aValue, TInt aLine) |
108 { |
122 { |
109 if(!aValue) |
123 if(!aValue) |
110 { |
124 { |
111 CleanupCDriveL(); |
125 CleanupCDriveL(); |
|
126 User::LeaveIfError(KillProcess(KCentralRepositoryServerName)); |
112 TheTest(EFalse, aLine); |
127 TheTest(EFalse, aLine); |
113 } |
128 } |
114 } |
129 } |
|
130 |
115 LOCAL_C void CheckL(TInt aValue, TInt aExpected, TInt aLine) |
131 LOCAL_C void CheckL(TInt aValue, TInt aExpected, TInt aLine) |
116 { |
132 { |
117 if(aValue != aExpected) |
133 if(aValue != aExpected) |
118 { |
134 { |
119 CleanupCDriveL(); |
135 CleanupCDriveL(); |
|
136 User::LeaveIfError(KillProcess(KCentralRepositoryServerName)); |
120 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
137 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); |
121 TheTest(EFalse, aLine); |
138 TheTest(EFalse, aLine); |
122 } |
139 } |
123 } |
140 } |
124 #define TEST(arg) ::CheckL((arg), __LINE__) |
141 #define TEST(arg) ::CheckL((arg), __LINE__) |
168 //This function restores the state of the files required for this test |
185 //This function restores the state of the files required for this test |
169 //Existing files are deleted and then the required files are copied |
186 //Existing files are deleted and then the required files are copied |
170 //back from the Z drive to the c drive |
187 //back from the Z drive to the c drive |
171 LOCAL_C void RestoreTestFilesL() |
188 LOCAL_C void RestoreTestFilesL() |
172 { |
189 { |
173 //Delete all files from C:\\private\\10202BE9\\persists\\ dir |
|
174 //and C:\\private\\10202BE9\\ dir |
|
175 CleanupCDriveL(); |
190 CleanupCDriveL(); |
176 |
191 |
177 RFs fs; |
192 RFs fs; |
178 User::LeaveIfError(fs.Connect()); |
193 User::LeaveIfError(fs.Connect()); |
179 CleanupClosePushL(fs); |
194 CleanupClosePushL(fs); |
180 |
195 |
181 CFileMan* fm = CFileMan::NewL(fs); |
196 CFileMan* fm = CFileMan::NewL(fs); |
182 CleanupStack::PushL(fm); |
197 CleanupStack::PushL(fm); |
183 |
198 |
184 // _LIT(KPersistTargetPath, "c:\\private\\10202BE9\\persists\\*.txt"); |
199 // The target path's drive will be patched with the correct |
185 _LIT(KPersistTargetPath, "z:\\private\\10202BE9\\*.txt"); |
200 // system drive in CopyTestFilesL |
|
201 _LIT(KPersistTargetPath, "C:\\private\\10202BE9\\*.txt"); |
186 _LIT(KPersistSourcePath, "Z:\\private\\10202BE9\\*.txc"); |
202 _LIT(KPersistSourcePath, "Z:\\private\\10202BE9\\*.txc"); |
187 _LIT(KInstallTargetPath, "C:\\private\\10202BE9\\*.txt"); |
203 _LIT(KInstallTargetPath, "C:\\private\\10202BE9\\*.txt"); |
188 _LIT(KInstallSourcePath, "Z:\\private\\10202BE9\\*.txi"); |
204 _LIT(KInstallSourcePath, "Z:\\private\\10202BE9\\*.txi"); |
189 |
205 |
190 //copy test files from Z: to C: |
206 //copy test files from Z: to C: |
191 CopyTestFilesL(*fm,KPersistSourcePath, KPersistTargetPath); |
207 CopyTestFilesL(*fm,KPersistSourcePath, KPersistTargetPath); |
192 CopyTestFilesL(*fm,KInstallSourcePath, KInstallTargetPath); |
208 CopyTestFilesL(*fm,KInstallSourcePath, KInstallTargetPath); |
|
209 |
|
210 #if defined(SYMBIAN_INCLUDE_APP_CENTRIC) |
|
211 //Copy cre files to PMA protected folder for testing |
|
212 _LIT(KPMASourcePath, "Z:\\private\\10202BE9\\*.pma"); |
|
213 _LIT(KPMATargetPath, "C:\\private\\10202BE9\\persists\\protected\\*.cre"); |
|
214 CopyTestFilesL(*fm,KPMASourcePath, KPMATargetPath); |
|
215 |
|
216 //Copy PMA protected cre file to persist folder for testing |
|
217 _LIT(KPMACreSourcePath, "Z:\\private\\10202BE9\\f1000115.crp"); |
|
218 _LIT(KPMACreTargetPath, "C:\\private\\10202BE9\\persists\\*.cre"); |
|
219 CopyTestFilesL(*fm,KPMACreSourcePath, KPMACreTargetPath); |
|
220 |
|
221 //Copy PMA protected txt file to persist folder for testing |
|
222 _LIT(KPMATxtSourcePath, "Z:\\private\\10202BE9\\f1000116.txp"); |
|
223 _LIT(KPMATxtTargetPath, "C:\\private\\10202BE9\\persists\\protected\\*.txt"); |
|
224 CopyTestFilesL(*fm,KPMATxtSourcePath, KPMATxtTargetPath); |
|
225 #endif |
193 |
226 |
194 CleanupStack::PopAndDestroy(2); |
227 CleanupStack::PopAndDestroy(2); |
195 |
228 |
196 } |
229 } |
197 |
230 |
261 @SYMTestPriority High |
293 @SYMTestPriority High |
262 @SYMTestActions Tests for CRepository::Get(),CRepository::Set() functions |
294 @SYMTestActions Tests for CRepository::Get(),CRepository::Set() functions |
263 @SYMTestExpectedResults Test must not fail |
295 @SYMTestExpectedResults Test must not fail |
264 @SYMREQ REQ0000 |
296 @SYMREQ REQ0000 |
265 */ |
297 */ |
|
298 /** |
|
299 @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4114 |
|
300 @SYMTestCaseDesc Tests for CRepository's Integer,Real,String's Get and Set functions on PMA keyspace |
|
301 @SYMTestPriority High |
|
302 @SYMTestActions Tests for CRepository::Get(),CRepository::Set() functions |
|
303 @SYMTestExpectedResults Test should get the correct value of a setting and set operation must not fail. |
|
304 @SYMREQ REQ42876 |
|
305 */ |
266 LOCAL_C void GetSetL(const TUid& aUid) |
306 LOCAL_C void GetSetL(const TUid& aUid) |
267 { |
307 { |
268 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1298 ")); |
308 CRepository* repository(NULL); |
269 CRepository* repository; |
|
270 User::LeaveIfNull(repository = CRepository::NewLC(aUid)); |
309 User::LeaveIfNull(repository = CRepository::NewLC(aUid)); |
271 |
310 |
272 _LIT8(KString12_InitialValue, "string"); |
311 _LIT8(KString12_InitialValue, "string"); |
273 TPtrC8 p8(KString12_InitialValue); |
312 TPtrC8 p8(KString12_InitialValue); |
274 |
313 |
909 @SYMTestPriority High |
947 @SYMTestPriority High |
910 @SYMTestActions Test for CRepository::NotifyRequest() functions |
948 @SYMTestActions Test for CRepository::NotifyRequest() functions |
911 @SYMTestExpectedResults Test must not fail |
949 @SYMTestExpectedResults Test must not fail |
912 @SYMREQ REQ0000 |
950 @SYMREQ REQ0000 |
913 */ |
951 */ |
914 LOCAL_C void NotifyL() |
952 /** |
|
953 @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4115 |
|
954 @SYMTestCaseDesc Tests for CRepository's notification functionality test on PMA keyspaces |
|
955 @SYMTestPriority High |
|
956 @SYMTestActions Tests for CRepository::NotifyRequest() functions |
|
957 @SYMTestExpectedResults Notification request of a setting should behave as expected. |
|
958 i.e. non-existent setting should return KErrNotFound |
|
959 Duplicate notification should not be created |
|
960 Other request should return KErrNone. |
|
961 @SYMREQ REQ42876 |
|
962 */ |
|
963 LOCAL_C void NotifyL(TUid aReposUid) |
915 { |
964 { |
916 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1300 ")); |
965 CRepository* repository(NULL); |
917 CRepository* repository; |
966 User::LeaveIfNull(repository = CRepository::NewLC(aReposUid)); |
918 User::LeaveIfNull(repository = CRepository::NewLC(KUidTestRepository1)); |
|
919 |
967 |
920 TInt r = KErrNone; |
968 TInt r = KErrNone; |
921 TInt intval; |
969 TInt intval; |
922 TRequestStatus intStatus; |
970 TRequestStatus intStatus; |
923 TRequestStatus realStatus; |
971 TRequestStatus realStatus; |
1998 r = repositoryA->Reset(); |
2053 r = repositoryA->Reset(); |
1999 TEST2(r, KErrNone); |
2054 TEST2(r, KErrNone); |
2000 |
2055 |
2001 CleanupStack::PopAndDestroy(repositoryA); |
2056 CleanupStack::PopAndDestroy(repositoryA); |
2002 } |
2057 } |
|
2058 |
|
2059 #if defined(SYMBIAN_INCLUDE_APP_CENTRIC) |
|
2060 /** |
|
2061 @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4117 |
|
2062 @SYMTestCaseDesc Tests for resetting the new changes on CRepository (PMA repository) |
|
2063 @SYMTestPriority High |
|
2064 @SYMTestActions Tests for CRepository::Reset() function on a PMA repository |
|
2065 Tests for reset on a single setting that exists in the original ROM-based settings. |
|
2066 Tests for reset for a single setting that does not exist in the original ROM-based settings. |
|
2067 Tests for repository-wide reset for a repository that exists on ROM. |
|
2068 @SYMTestExpectedResults Test must not fail |
|
2069 @SYMREQ REQ42876 |
|
2070 */ |
|
2071 LOCAL_C void ResetPMAL(TUid aReposUid) |
|
2072 { |
|
2073 CRepository* repository(NULL); |
|
2074 User::LeaveIfNull(repository = CRepository::NewLC(aReposUid)); |
|
2075 |
|
2076 // |
|
2077 // Test reset on a single setting that exists in the |
|
2078 // original ROM-based settings (we'll use KInt1) |
|
2079 // |
|
2080 |
|
2081 // Ensure KInt1 is set to a different value to its initial value |
|
2082 TInt r = repository->Set(KInt1, KInt1_InitialValue+10); |
|
2083 TEST2(r, KErrNone); |
|
2084 |
|
2085 r = repository->Reset(KInt1); |
|
2086 TEST2(r, KErrNotSupported); |
|
2087 |
|
2088 // Check KInt1 now still has the new value |
|
2089 TInt x; |
|
2090 r = repository->Get(KInt1, x); |
|
2091 TEST2(r, KErrNone); |
|
2092 TEST(x==KInt1_InitialValue+10); |
|
2093 |
|
2094 // |
|
2095 // Test reset for a single setting that does not exist |
|
2096 // in the original ROM-based settings. |
|
2097 // Test repository-wide reset for a repository |
|
2098 // that exists on ROM. |
|
2099 // |
|
2100 const TInt KIntValue = 1234; |
|
2101 r = repository->Create(KNewInt, KIntValue); |
|
2102 TEST2(r, KErrNone); |
|
2103 |
|
2104 //Reset a setting should fail as it is supported on PMA repositories |
|
2105 r = repository->Reset(KNewInt); |
|
2106 TEST2(r, KErrNotSupported); |
|
2107 |
|
2108 //Reset whole repository should fail as it is supported on PMA repositories |
|
2109 r = repository->Reset(); |
|
2110 TEST2(r, KErrNotSupported); |
|
2111 |
|
2112 //Check that KNewInt is still there |
|
2113 r = repository->Get(KNewInt, x); |
|
2114 TEST2(r, KErrNone); |
|
2115 TEST(x==KIntValue); |
|
2116 |
|
2117 CleanupStack::PopAndDestroy(repository); |
|
2118 } |
|
2119 |
|
2120 /** |
|
2121 @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4118 |
|
2122 @SYMTestCaseDesc Tests for CentRep's repository type check during opening. |
|
2123 @SYMTestPriority High |
|
2124 @SYMTestActions Tests for opening a PMA repository that is stored in persist folder |
|
2125 Tests for opening a non-PMA repository that is stored in PMA drive |
|
2126 @SYMTestExpectedResults Must return with KErrNotSupported in both cases |
|
2127 @SYMREQ REQ42876 |
|
2128 */ |
|
2129 LOCAL_C void CorruptPMAL(TUid aReposUid, TInt aExpectedResult) |
|
2130 { |
|
2131 CRepository* repository(NULL); |
|
2132 TRAPD(err, repository = CRepository::NewL(aReposUid)); |
|
2133 TEST2(err, aExpectedResult); |
|
2134 TEST(repository == NULL); |
|
2135 |
|
2136 // We should only test for KErrNotFound if aExpectedResult is not the same. |
|
2137 // No point to test again for KErrNotFound. |
|
2138 if (aExpectedResult != KErrNotFound) |
|
2139 { |
|
2140 //The corrupted repository should be deleted, so it should get KErrNotFound |
|
2141 TRAP(err, repository = CRepository::NewL(aReposUid)); |
|
2142 TEST2(err, KErrNotFound); |
|
2143 TEST(repository == NULL); |
|
2144 } |
|
2145 |
|
2146 } |
|
2147 |
|
2148 /** |
|
2149 @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4119 |
|
2150 @SYMTestCaseDesc Tests for opening PMA txt repos in PMA drive. |
|
2151 @SYMTestPriority High |
|
2152 @SYMTestActions Tests for opening PMA txt repos that is stored in PMA drive |
|
2153 @SYMTestExpectedResults Must return with KErrNotFound |
|
2154 @SYMREQ REQ42876 |
|
2155 */ |
|
2156 LOCAL_C void OpenTxtInPMAL(TUid aReposUid) |
|
2157 { |
|
2158 CRepository* repository(NULL); |
|
2159 TRAPD(err, repository = CRepository::NewL(aReposUid)); |
|
2160 |
|
2161 TEST2(err, KErrNotFound); |
|
2162 TEST(repository == NULL); |
|
2163 } |
|
2164 |
|
2165 /** |
|
2166 @SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4175 |
|
2167 @SYMTestCaseDesc Tests for opening PMA txt and cre repos in install directory. |
|
2168 @SYMTestPriority High |
|
2169 @SYMTestActions Open PMA txt and cre repos in install directory |
|
2170 @SYMTestExpectedResults Both cases must return with KErrNotSupported and |
|
2171 the PMA files must be deleted from the install directory |
|
2172 @SYMREQ REQ42876 |
|
2173 */ |
|
2174 LOCAL_C void OpenPmaRepInInstallDirL() |
|
2175 { |
|
2176 RFs fs; |
|
2177 TEntry entry; |
|
2178 CRepository* repository(NULL); |
|
2179 |
|
2180 TInt err = fs.Connect(); |
|
2181 TEST2(err, KErrNone); |
|
2182 |
|
2183 CFileMan* fm = CFileMan::NewL(fs); |
|
2184 CleanupStack::PushL(fm); |
|
2185 |
|
2186 // Copying the test repository files here to the install directory, because |
|
2187 // if they are copied before the Central Repository server has started, when |
|
2188 // the server starts they will be deleted, as PMA repositories are not |
|
2189 // allowed in the install directory. |
|
2190 _LIT(KPMATxtInstallSourcePath, "Z:\\private\\10202BE9\\f1000117.txi"); |
|
2191 _LIT(KPMATxtInstallTargetPath, "C:\\private\\10202BE9\\f1000117.txt"); |
|
2192 CopyTestFilesL(*fm,KPMATxtInstallSourcePath, KPMATxtInstallTargetPath); |
|
2193 |
|
2194 _LIT(KPMACreInstallSourcePath, "Z:\\private\\10202BE9\\f1000118.cri"); |
|
2195 _LIT(KPMACreInstallTargetPath, "C:\\private\\10202BE9\\f1000118.cre"); |
|
2196 CopyTestFilesL(*fm,KPMACreInstallSourcePath, KPMACreInstallTargetPath); |
|
2197 |
|
2198 CleanupStack::PopAndDestroy(fm); |
|
2199 |
|
2200 |
|
2201 |
|
2202 TRAP(err, repository = CRepository::NewL(KUidPmaTxtInInstallDir1)); |
|
2203 TEST2(err, KErrNotSupported); |
|
2204 TEST(repository == NULL); |
|
2205 |
|
2206 //The PMA txt file in the install directory should be deleted after the open attempt |
|
2207 err = fs.Entry(KPMATxtInstallTargetPath,entry); |
|
2208 TEST2(err, KErrNotFound); |
|
2209 |
|
2210 TRAP(err, repository = CRepository::NewL(KUidPmaCreInInstallDir1)); |
|
2211 TEST2(err, KErrNotSupported); |
|
2212 TEST(repository == NULL); |
|
2213 |
|
2214 //The PMA cre file in the install directory should be deleted after the open attempt |
|
2215 err = fs.Entry(KPMACreInstallTargetPath,entry); |
|
2216 TEST2(err, KErrNotFound); |
|
2217 } |
|
2218 #endif |
2003 |
2219 |
2004 /** |
2220 /** |
2005 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-1304 |
2221 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-1304 |
2006 @SYMTestCaseDesc Tests for initialising file searching |
2222 @SYMTestCaseDesc Tests for initialising file searching |
2007 @SYMTestPriority High |
2223 @SYMTestPriority High |
2009 @SYMTestExpectedResults Test must not fail |
2225 @SYMTestExpectedResults Test must not fail |
2010 @SYMREQ REQ0000 |
2226 @SYMREQ REQ0000 |
2011 */ |
2227 */ |
2012 LOCAL_C void IniFileSearching() |
2228 LOCAL_C void IniFileSearching() |
2013 { |
2229 { |
2014 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1304 ")); |
2230 RFs fs; |
|
2231 User::LeaveIfError(fs.Connect()); |
|
2232 |
|
2233 //The purpose of this test case is to prove that ROM version of the |
|
2234 // keyspace will be used before the install version. |
|
2235 // So we want to delete the persisted version here, otherwise it will |
|
2236 // be picked up before the ROM version. |
|
2237 _LIT(KReposFileName,"c:\\private\\10202be9\\persists\\00000010.cre"); |
|
2238 TInt r = fs.Delete(KReposFileName); |
|
2239 if (r != KErrNone && r != KErrNotFound && r != KErrPathNotFound) |
|
2240 { |
|
2241 User::Leave(r); |
|
2242 } |
|
2243 |
2015 const TInt KSettingKey = 1; |
2244 const TInt KSettingKey = 1; |
2016 |
2245 |
2017 _LIT(KDriveZ, "drive z"); |
2246 _LIT(KDriveZ, "drive z"); |
2018 |
2247 |
2019 const TInt KBufLen = 7; // = Max of 3 above string lengths |
2248 const TInt KBufLen = 7; // = Max of 3 above string lengths |
2020 |
2249 |
2021 // |
2250 CRepository* repository = CRepository::NewL(KUidDriveZRepository); |
2022 // File on drive C should take precedence |
|
2023 // |
|
2024 CRepository* repository = CRepository::NewL(KUidDriveCRepository); |
|
2025 |
2251 |
2026 TBuf<KBufLen> str; |
2252 TBuf<KBufLen> str; |
2027 TInt r = repository->Get(KSettingKey, str); |
2253 r = repository->Get(KSettingKey, str); |
2028 TEST2(r, KErrNone); |
2254 TEST2(r, KErrNone); |
2029 TEST(str==KDriveZ); |
2255 TEST(str==KDriveZ); |
2030 |
2256 |
2031 delete repository; |
2257 delete repository; |
2032 } |
2258 } |
2312 LOCAL_C void FuncTestsL() |
2535 LOCAL_C void FuncTestsL() |
2313 { |
2536 { |
2314 TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-0494 Open/Close repository ")); |
2537 TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-0494 Open/Close repository ")); |
2315 OpenRepositoryL(); |
2538 OpenRepositoryL(); |
2316 |
2539 |
2317 TheTest.Next(_L("Get/Set .ini")); |
2540 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1298 Get/Set .ini")); |
2318 GetSetL(KUidTestRepository1); |
2541 GetSetL(KUidTestRepository1); |
2319 |
2542 |
2320 TheTest.Next(_L("Get/Set .cre")); |
2543 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1298 Get/Set .cre")); |
2321 GetSetL(KUidCreTestRepository1); |
2544 GetSetL(KUidCreTestRepository1); |
2322 |
2545 |
2323 TheTest.Next(_L("Find")); |
2546 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1299 Find")); |
2324 FindL(); |
2547 FindL(); |
2325 |
2548 |
2326 TheTest.Next(_L("Notify")); |
2549 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1300 Notify")); |
2327 NotifyL(); |
2550 NotifyL(KUidTestRepository1); |
2328 |
2551 |
2329 TheTest.Next(_L("Create/Delete .ini")); |
2552 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1301 Create/Delete .ini")); |
2330 CreateDeleteL(KUidTestRepository1); |
2553 CreateDeleteL(KUidTestRepository1); |
2331 |
2554 |
2332 TheTest.Next(_L("Create/Delete .cre")); |
2555 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1301 Create/Delete .cre")); |
2333 CreateDeleteL(KUidCreTestRepository1); |
2556 CreateDeleteL(KUidCreTestRepository1); |
2334 |
2557 |
2335 TheTest.Next(_L("Initialisation file searching")); |
2558 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1304 Initialisation file searching")); |
2336 IniFileSearching(); |
2559 IniFileSearching(); |
2337 |
2560 |
2338 TheTest.Next(_L("Repository on Drive C only")); |
2561 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1305 Repository on Drive C only")); |
2339 RepositoryOnDriveC(); |
2562 RepositoryOnDriveC(); |
2340 |
2563 |
2341 TheTest.Next(_L("Multiple clients")); |
2564 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1302 Multiple clients")); |
2342 MultiClientL(); |
2565 MultiClientL(); |
2343 |
2566 |
2344 TheTest.Next(_L("Restore factory settings")); |
2567 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1303 Restore factory settings")); |
2345 ResetL(); |
2568 ResetL(); |
2346 |
2569 |
2347 TheTest.Next(_L("Restore factory settings from binary based rep")); |
2570 TheTest.Next(_L("Restore factory settings from binary based rep")); |
2348 ResetCreL(); |
2571 ResetCreL(); |
2349 |
2572 |
2350 TheTest.Next(_L("Negative testing for the notification cancelling")); |
2573 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3400 Negative testing for the notification cancelling")); |
2351 CancelNotificationsL(); |
2574 CancelNotificationsL(); |
2352 |
2575 |
2353 TheTest.Next(_L("Notify-only client optimizations")); |
2576 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1656 Notify-only client optimizations")); |
2354 NotifyOnlyL(); |
2577 NotifyOnlyL(); |
2355 |
2578 |
2356 TheTest.Next(_L("Meta data after a Range Delete in transaction")); |
2579 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4113 Meta data after a Range Delete in transaction")); |
2357 RangeDeleteMetaL(); |
2580 RangeDeleteMetaL(); |
2358 |
2581 |
2359 TheTest.End(); |
2582 #if defined(SYMBIAN_INCLUDE_APP_CENTRIC) |
|
2583 // The following tests are done on PMA based repositories |
|
2584 |
|
2585 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4114 Get/Set PMA .txt in ROM")); |
|
2586 GetSetL(KUidTxtPMATestRepos1); |
|
2587 |
|
2588 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4114 Get/Set PMA .cre in ROM")); |
|
2589 GetSetL(KUidCrePMATestRepos1); |
|
2590 |
|
2591 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4114 Get/Set PMA .cre in PMA drive")); |
|
2592 GetSetL(KUidCrePMAinPMADriveTestRepos1); |
|
2593 |
|
2594 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4115 Notify PMA")); |
|
2595 NotifyL(KUidTxtPMATestRepos1); |
|
2596 |
|
2597 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4116 Create/Delete PMA .txt in ROM")); |
|
2598 CreateDeleteL(KUidTxtPMATestRepos1); |
|
2599 |
|
2600 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4116 Create/Delete PMA .cre in ROM")); |
|
2601 CreateDeleteL(KUidCrePMATestRepos1); |
|
2602 |
|
2603 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4116 Create/Delete PMA .cre in PMA drive")); |
|
2604 CreateDeleteL(KUidCrePMAinPMADriveTestRepos1); |
|
2605 |
|
2606 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4117 Restore factory settings on PMA repository")); |
|
2607 ResetPMAL(KUidTxtPMATestRepos1); |
|
2608 |
|
2609 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4117 Restore factory settings on binary based PMA repository")); |
|
2610 ResetPMAL(KUidCrePMATestRepos1); |
|
2611 |
|
2612 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4118 Opening a non-PMA repos that is in PMA drive")); |
|
2613 CorruptPMAL(KUidCorruptRepos1, KErrNotSupported); |
|
2614 |
|
2615 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4118 Opening a PMA repos that is in persist folder")); |
|
2616 CorruptPMAL(KUidCorruptRepos2, KErrNotFound); |
|
2617 |
|
2618 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4119 Opening a txt repos that is in PMA drive")); |
|
2619 OpenTxtInPMAL(KUidTxtInPMADriveRepos1); |
|
2620 |
|
2621 TheTest.Next(_L(" @SYMTestCaseID:PDS-CENTRALREPOSITORY-CT-4175 Opening PMA repositories that only exists in the install directory")); |
|
2622 OpenPmaRepInInstallDirL(); |
|
2623 |
|
2624 #endif // SYMBIAN_INCLUDE_APP_CENTRIC |
|
2625 |
|
2626 TheTest.End(); |
2360 } |
2627 } |
2361 |
2628 |
2362 /** |
2629 /** |
2363 OomTest |
2630 OomTest |
2364 Function to convert a test into an OOM test |
2631 Function to convert a test into an OOM test |
2405 User::__DbgSetAllocFail(RHeap::EUser, RHeap::ENone, 1); |
2672 User::__DbgSetAllocFail(RHeap::EUser, RHeap::ENone, 1); |
2406 } |
2673 } |
2407 |
2674 |
2408 LOCAL_C void OomTestsL() |
2675 LOCAL_C void OomTestsL() |
2409 { |
2676 { |
2410 TheTest.Start(_L("Open/Close repository")); |
2677 TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1297 Open/Close repository")); |
2411 OomTest(OpenRepositoryL); |
2678 OomTest(OpenRepositoryL); |
2412 |
2679 |
2413 TheTest.Next(_L("GetSet for KUidTestRepository1")); |
2680 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1298 GetSet for KUidTestRepository1")); |
2414 GetSetL(KUidTestRepository1); |
2681 GetSetL(KUidTestRepository1); |
2415 TheTest.Next(_L("GetSet for KUidCreTestRepository1")); |
2682 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1298 GetSet for KUidCreTestRepository1")); |
2416 GetSetL(KUidCreTestRepository1); |
2683 GetSetL(KUidCreTestRepository1); |
2417 |
2684 |
2418 TheTest.Next(_L("Find")); |
2685 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-1299 Find")); |
2419 OomTest(FindL); |
2686 OomTest(FindL); |
2420 |
2687 |
2421 TheTest.End(); |
2688 TheTest.End(); |
2422 } |
2689 } |
2423 |
2690 |
2424 //This function tests the replacement of RFile with RFileBuf in CIniFileOut class (inifile.h) |
2691 //This function tests the replacement of RFile with RFileBuf in CIniFileOut class (inifile.h) |
2425 //It shows that there is approx. 20% (LUBBOCK) performance boost when using simple "Set" |
2692 //It shows that there is approx. 20% (LUBBOCK) performance boost when using simple "Set" |
2426 //operations. It may be even better when using "Commit" functionality. |
2693 //operations. It may be even better when using "Commit" functionality. |
2427 static void PerformanceTestL() |
2694 static void PerformanceTestL() |
2428 { |
2695 { |
2429 CRepository* repository = CRepository::NewL(KUidDriveCOnlyRepository); |
2696 CRepository* repository = CRepository::NewL(KUidDriveCOnlyRepository); |
2430 CleanupStack::PushL(repository); |
2697 CleanupStack::PushL(repository); |
2431 //Test settings IDs |
2698 //Test settings IDs |
2432 const TUint KIntId = 101; |
2699 const TUint KIntId = 101; |
2433 const TUint KRealId = 102; |
2700 const TUint KRealId = 102; |
2434 const TUint KDes16Id = 103; |
2701 const TUint KDes16Id = 103; |
2435 const TUint KDes8Id = 104; |
2702 const TUint KDes8Id = 104; |
2436 //Create test settings |
2703 //Create test settings |
2437 TInt err = repository->Create(KIntId, 1); |
2704 TInt err = repository->Create(KIntId, 1); |
2438 TEST2(err, KErrNone); |
2705 TEST2(err, KErrNone); |
2439 err = repository->Create(KRealId, 1.1); |
2706 err = repository->Create(KRealId, 1.1); |
2440 TEST2(err, KErrNone); |
2707 TEST2(err, KErrNone); |
2441 err = repository->Create(KDes16Id, _L16("DES16")); |
2708 err = repository->Create(KDes16Id, _L16("DES16")); |
2442 TEST2(err, KErrNone); |
2709 TEST2(err, KErrNone); |
2443 err = repository->Create(KDes8Id, _L8("DES8")); |
2710 err = repository->Create(KDes8Id, _L8("DES8")); |
2444 TEST2(err, KErrNone); |
2711 TEST2(err, KErrNone); |
2445 //Performance test |
2712 //Performance test |
2446 TBuf16<32> buf16; |
2713 TBuf16<32> buf16; |
2447 TBuf8<32> buf8; |
2714 TBuf8<32> buf8; |
2448 TUint timeStart = User::TickCount(); |
2715 TUint timeStart = User::TickCount(); |
2449 for(TInt i=0;i<500;++i) |
2716 for(TInt i=0;i<500;++i) |
2450 { |
2717 { |
2451 buf16.Zero(); |
2718 buf16.Zero(); |
2452 buf16.AppendNum(i); |
2719 buf16.AppendNum(i); |
2453 buf8.Zero(); |
2720 buf8.Zero(); |
2454 buf8.AppendNum(i); |
2721 buf8.AppendNum(i); |
2455 |
2722 |
2456 TInt err = repository->Set(KIntId, i); |
2723 TInt err = repository->Set(KIntId, i); |
2457 TEST2(err, KErrNone); |
2724 TEST2(err, KErrNone); |
2458 err = repository->Set(KRealId, (TReal)i); |
2725 err = repository->Set(KRealId, (TReal)i); |
2459 TEST2(err, KErrNone); |
2726 TEST2(err, KErrNone); |
2460 err = repository->Set(KDes16Id, buf16); |
2727 err = repository->Set(KDes16Id, buf16); |
2461 TEST2(err, KErrNone); |
2728 TEST2(err, KErrNone); |
2462 err = repository->Set(KDes8Id, buf8); |
2729 err = repository->Set(KDes8Id, buf8); |
2463 TEST2(err, KErrNone); |
2730 TEST2(err, KErrNone); |
2464 } |
2731 } |
2465 TUint timeEnd = User::TickCount(); |
2732 TUint timeEnd = User::TickCount(); |
2466 CleanupStack::PopAndDestroy(repository); |
2733 CleanupStack::PopAndDestroy(repository); |
2467 TheTest.Printf(_L("\nPerformanceTestL - %d ticks\n"), timeEnd-timeStart); |
2734 TheTest.Printf(_L("\nPerformanceTestL - %d ticks\n"), timeEnd-timeStart); |
2468 } |
2735 } |
2469 |
2736 |
2470 /** |
2737 /** |
2471 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-0497 |
2738 @SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-0497 |
2472 @SYMTestCaseDesc CentralRepository functionality test |
2739 @SYMTestCaseDesc CentralRepository functionality test |
2473 @SYMTestPriority High |
2740 @SYMTestPriority High |