sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <x86tool/centralrepository.h>
|
sl@0
|
17 |
#include <e32test.h>
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
|
sl@0
|
20 |
#ifdef __TOOLS2__
|
sl@0
|
21 |
#define CENREP_PC_TEST
|
sl@0
|
22 |
#endif
|
sl@0
|
23 |
|
sl@0
|
24 |
enum TestMode{
|
sl@0
|
25 |
ETxt,
|
sl@0
|
26 |
ECre,
|
sl@0
|
27 |
EAutoCre,
|
sl@0
|
28 |
EAutoTxt
|
sl@0
|
29 |
};
|
sl@0
|
30 |
|
sl@0
|
31 |
RTest TheTest(_L("Central Repository Tests"));
|
sl@0
|
32 |
RFs TheFs;
|
sl@0
|
33 |
|
sl@0
|
34 |
//uid for txt testing purpose
|
sl@0
|
35 |
const TUid uid={0x000001FF};
|
sl@0
|
36 |
//uid for cre testing purpose
|
sl@0
|
37 |
const TUid uidcre={0x00001FFF};
|
sl@0
|
38 |
const TUid uidcretest = {0x000002FF};
|
sl@0
|
39 |
#ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS
|
sl@0
|
40 |
const TUid uidcrev1= {0x00004FFF};
|
sl@0
|
41 |
#endif
|
sl@0
|
42 |
|
sl@0
|
43 |
const TUid uidmetatest = {0x00022222};
|
sl@0
|
44 |
|
sl@0
|
45 |
#ifndef __TOOLS2__
|
sl@0
|
46 |
/** FILES FOR MAN NEWL TESTING */
|
sl@0
|
47 |
_LIT(KTemplateTxtFile,"c:\\000001ff.txt");
|
sl@0
|
48 |
_LIT(KTemplateTxtOutFile,"c:\\000001ff.cre");
|
sl@0
|
49 |
//cre equivalent is generated through centrepconv of the txt version
|
sl@0
|
50 |
_LIT(KTemplateCreFile,"c:\\00001fff.cre");
|
sl@0
|
51 |
_LIT(KCopyTemplateCreFile,"c:\\copy00001fff.cre");
|
sl@0
|
52 |
//the target output is set to a different name
|
sl@0
|
53 |
_LIT(KTemplateCreOutFile,"c:\\00001eee.cre");
|
sl@0
|
54 |
|
sl@0
|
55 |
_LIT(KMetaTxtTestInFile,"c:\\00022222.txt"); // Txt test input
|
sl@0
|
56 |
_LIT(KMetaTestCreFile,"c:\\00022222.cre"); // Txt test output, Cre test in/output
|
sl@0
|
57 |
_LIT(KMetaTestCreCopy,"c:\\copy00022222.cre");
|
sl@0
|
58 |
_LIT(KMetaTxtTestOgnFile, "c:\\00022222.ogn");
|
sl@0
|
59 |
|
sl@0
|
60 |
/** FILES FOR AUTO NEWL TESTING */
|
sl@0
|
61 |
_LIT(KPrivateTemplateCreFile,"c:\\private\\00000000\\00001fff.cre");
|
sl@0
|
62 |
#ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS
|
sl@0
|
63 |
_LIT(KPrivateTemplateCreV1File,"c:\\private\\00000000\\00004fff.cre");
|
sl@0
|
64 |
_LIT(KCopyPrivateTemplateCreV1File,"c:\\private\\00000000\\copy00004fff.cre");
|
sl@0
|
65 |
#endif
|
sl@0
|
66 |
_LIT(KCopyPrivateTemplateCreFile,"c:\\private\\00000000\\copy00001fff.cre");
|
sl@0
|
67 |
_LIT(KPrivateTemplateTxtFile,"c:\\private\\0000000\\000001ff.txt");
|
sl@0
|
68 |
_LIT(KPrivateTemplateTxtOutFile,"c:\\private\\00000000\\000001ff.cre");
|
sl@0
|
69 |
|
sl@0
|
70 |
//for comparison test
|
sl@0
|
71 |
_LIT(KPrivateCreFileForCreTest,"c:\\private\\00000000\\000002ff.cre");
|
sl@0
|
72 |
_LIT(KCopyCreFileForCreTest,"c:\\private\\00000000\\copy000002ff.cre");
|
sl@0
|
73 |
_LIT(KTxtTestRefFile,"c:\\private\\00000000\\ref_winscwtxt.cre");
|
sl@0
|
74 |
_LIT(KCreTestRefFile,"c:\\private\\00000000\\ref_winscwcre.cre");
|
sl@0
|
75 |
_LIT(KTxtTestGenFile,"c:\\private\\00000000\\winscwtxt.cre");
|
sl@0
|
76 |
_LIT(KCreTestGenFile,"c:\\private\\00000000\\winscwcre.cre");
|
sl@0
|
77 |
|
sl@0
|
78 |
// Make sure the contents of the following 2 files is the same as crc.txt and
|
sl@0
|
79 |
// ref_00022222.cre, which are generated by the WINSCW t_cenrepcs.exe test.
|
sl@0
|
80 |
_LIT(KCrcRecordFile,"c:\\common_crc.txt");
|
sl@0
|
81 |
_LIT(KMetaTestRefFile,"c:\\private\\00000000\\common_ref_00022222.cre");
|
sl@0
|
82 |
|
sl@0
|
83 |
_LIT(KOgnFile1FF, "c:\\private\\00000000\\000001ff.ogn");
|
sl@0
|
84 |
_LIT(KOgnFile1FFF, "c:\\private\\00000000\\00001fff.ogn");
|
sl@0
|
85 |
_LIT(KOgnFile2FF, "c:\\private\\00000000\\000002ff.ogn");
|
sl@0
|
86 |
_LIT(KOgnFile22222, "c:\\private\\00000000\\00022222.ogn");
|
sl@0
|
87 |
|
sl@0
|
88 |
_LIT(KMetaTestFile,"c:\\private\\00000000\\00022222.cre");
|
sl@0
|
89 |
_LIT(KMetaTestCopy,"c:\\private\\00000000\\copy00022222.cre");
|
sl@0
|
90 |
|
sl@0
|
91 |
// __TOOLS2__
|
sl@0
|
92 |
#else
|
sl@0
|
93 |
/** FILES FOR MAN NEWL TESTING */
|
sl@0
|
94 |
//in TOOLS2 this is relative
|
sl@0
|
95 |
_LIT(KTemplateTxtFile,"000001ff.txt");
|
sl@0
|
96 |
_LIT(KTemplateTxtOutFile,"000001ff.cre");
|
sl@0
|
97 |
//cre equivalent is generated through centrepconv of the txt version
|
sl@0
|
98 |
_LIT(KTemplateCreFile,"00001fff.cre");
|
sl@0
|
99 |
_LIT(KCopyTemplateCreFile,"copy00001fff.cre");
|
sl@0
|
100 |
_LIT(KTemplateCreOutFile,"00001eee.cre");
|
sl@0
|
101 |
|
sl@0
|
102 |
_LIT(KMetaTxtTestInFile,"00022222.txt"); // Txt test input
|
sl@0
|
103 |
_LIT(KMetaTestCreFile,"00022222.cre"); // Txt test output, Cre test in/output
|
sl@0
|
104 |
_LIT(KMetaTestCreCopy,"copy00022222.cre");
|
sl@0
|
105 |
_LIT(KMetaTxtTestOgnFile, "00022222.ogn");
|
sl@0
|
106 |
|
sl@0
|
107 |
/** FILES FOR AUTO NEWL TESTING */
|
sl@0
|
108 |
_LIT(KPrivateTemplateCreFile,"00001fff.cre");
|
sl@0
|
109 |
#ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS
|
sl@0
|
110 |
_LIT(KPrivateTemplateCreV1File,"00004fff.cre");
|
sl@0
|
111 |
_LIT(KCopyPrivateTemplateCreV1File,"copy00004fff.cre");
|
sl@0
|
112 |
#endif
|
sl@0
|
113 |
_LIT(KCopyPrivateTemplateCreFile,"copy00001fff.cre");
|
sl@0
|
114 |
_LIT(KPrivateTemplateTxtFile,"000001ff.txt");
|
sl@0
|
115 |
_LIT(KPrivateTemplateTxtOutFile,"000001ff.cre");
|
sl@0
|
116 |
|
sl@0
|
117 |
//for comparison test
|
sl@0
|
118 |
_LIT(KPrivateCreFileForCreTest,"000002ff.cre");
|
sl@0
|
119 |
_LIT(KCopyCreFileForCreTest,"copy000002ff.cre");
|
sl@0
|
120 |
_LIT(KTxtTestRefFile,"ref_winscwtxt.cre");
|
sl@0
|
121 |
_LIT(KCreTestRefFile,"ref_winscwcre.cre");
|
sl@0
|
122 |
_LIT(KTxtTestGenFile,"winscwtxt.cre");
|
sl@0
|
123 |
_LIT(KCreTestGenFile,"winscwcre.cre");
|
sl@0
|
124 |
// if start with \epoc32, symfile resolves the address related to EPOCROOT
|
sl@0
|
125 |
|
sl@0
|
126 |
// Make sure the contents of the following 2 files is the same as crc.txt and
|
sl@0
|
127 |
// ref_00022222.cre, which are generated by the WINSCW t_cenrepcs.exe test.
|
sl@0
|
128 |
_LIT(KCrcRecordFile,"\\epoc32\\winscw\\c\\common_crc.txt");
|
sl@0
|
129 |
_LIT(KMetaTestRefFile,"\\epoc32\\winscw\\c\\private\\00000000\\common_ref_00022222.cre");
|
sl@0
|
130 |
|
sl@0
|
131 |
_LIT(KOgnFile1FF, "000001ff.ogn");
|
sl@0
|
132 |
_LIT(KOgnFile1FFF, "00001fff.ogn");
|
sl@0
|
133 |
_LIT(KOgnFile2FF, "000002ff.ogn");
|
sl@0
|
134 |
_LIT(KOgnFile22222, "00022222.ogn");
|
sl@0
|
135 |
|
sl@0
|
136 |
|
sl@0
|
137 |
_LIT(KMetaTestFile,"00022222.cre");
|
sl@0
|
138 |
_LIT(KMetaTestCopy,"copy00022222.cre");
|
sl@0
|
139 |
#endif
|
sl@0
|
140 |
|
sl@0
|
141 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
142 |
|
sl@0
|
143 |
LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
if(aValue != aExpected)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
|
sl@0
|
148 |
TheTest(EFalse, aLine);
|
sl@0
|
149 |
}
|
sl@0
|
150 |
}
|
sl@0
|
151 |
|
sl@0
|
152 |
#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
|
sl@0
|
153 |
|
sl@0
|
154 |
///////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
155 |
|
sl@0
|
156 |
//DEFINED IN THE COMMON CPP FILE
|
sl@0
|
157 |
extern TInt CopyFile(const TDesC& aSource, const TDesC& aTarget);
|
sl@0
|
158 |
extern void ObjectCreateDeleteOOM(TUid aUid,const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode);
|
sl@0
|
159 |
extern void OomTest(void (*testFuncL)(CRepository* aRepository),TUid aUid,const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode);
|
sl@0
|
160 |
extern void BasicFunctionL(TUid aUid,const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode);
|
sl@0
|
161 |
extern void OomBasicFunction(TUid aUid,const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode);
|
sl@0
|
162 |
extern void DoFileCompL(const TDesC& aGenerated, const TDesC& aReference, TUint32& aCrcValue);
|
sl@0
|
163 |
extern void DoCrcCompL(const TUint32& aCrcValue, const TDesC& aCrcRecord, TBool aCrcOfTxt);
|
sl@0
|
164 |
extern void DEF130394L(TUid aUid);
|
sl@0
|
165 |
|
sl@0
|
166 |
void InitialiseLC(CRepository*& aRepository,TUid aUid,const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
#ifdef CENREP_PC_TEST
|
sl@0
|
169 |
if (aTestMode==ETxt || aTestMode==ECre)
|
sl@0
|
170 |
aRepository=CRepository::NewLC(aInFilePath,aOutFilePath);
|
sl@0
|
171 |
else
|
sl@0
|
172 |
#endif
|
sl@0
|
173 |
aRepository=CRepository::NewLC(aUid);
|
sl@0
|
174 |
}
|
sl@0
|
175 |
|
sl@0
|
176 |
void ClearOgns()
|
sl@0
|
177 |
{
|
sl@0
|
178 |
TheFs.Delete(KMetaTxtTestOgnFile);
|
sl@0
|
179 |
TheFs.Delete(KOgnFile1FF);
|
sl@0
|
180 |
TheFs.Delete(KOgnFile1FFF);
|
sl@0
|
181 |
TheFs.Delete(KOgnFile2FF);
|
sl@0
|
182 |
TheFs.Delete(KOgnFile22222);
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
void SetupEnv(const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode)
|
sl@0
|
186 |
{
|
sl@0
|
187 |
ClearOgns();
|
sl@0
|
188 |
if (aTestMode==ETxt || aTestMode==EAutoTxt)
|
sl@0
|
189 |
TheFs.Delete(aOutFilePath);
|
sl@0
|
190 |
if (aTestMode==ECre)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
//always copy so we always start the OOM with fresh original cre file
|
sl@0
|
193 |
CopyFile(KCopyTemplateCreFile,aInFilePath);
|
sl@0
|
194 |
TheFs.Delete(aOutFilePath);
|
sl@0
|
195 |
}
|
sl@0
|
196 |
if (aTestMode==EAutoCre)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
TheFs.Delete(aOutFilePath);
|
sl@0
|
199 |
#ifndef SYMBIAN_CENTREP_SUPPORT_MULTIROFS
|
sl@0
|
200 |
CopyFile(KCopyPrivateTemplateCreFile,aInFilePath);
|
sl@0
|
201 |
#else
|
sl@0
|
202 |
if (aInFilePath.Compare(KPrivateTemplateCreFile)==0)
|
sl@0
|
203 |
CopyFile(KCopyPrivateTemplateCreFile,aInFilePath);
|
sl@0
|
204 |
else
|
sl@0
|
205 |
CopyFile(KCopyPrivateTemplateCreV1File,aInFilePath);
|
sl@0
|
206 |
#endif
|
sl@0
|
207 |
}
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
// If testsymcenrep or t_cenreppc fails, common_crc.txt and common_ref_00022222.cre might need
|
sl@0
|
211 |
// to be updated (with the versions generated by the WINSCW t_cenrepcs.exe test,
|
sl@0
|
212 |
// crc.txt and ref_00022222.cre), if the format of the repository files has changed.
|
sl@0
|
213 |
void CrcComparisonTestL()
|
sl@0
|
214 |
{
|
sl@0
|
215 |
// Auto Txt Test
|
sl@0
|
216 |
TUint32 txtTestCrcVal;
|
sl@0
|
217 |
BasicFunctionL(uid,KPrivateTemplateTxtFile,KPrivateTemplateTxtOutFile,EAutoTxt);
|
sl@0
|
218 |
CopyFile(KPrivateTemplateTxtOutFile, KTxtTestGenFile);
|
sl@0
|
219 |
DoFileCompL(KTxtTestGenFile, KTxtTestRefFile, txtTestCrcVal);
|
sl@0
|
220 |
DoCrcCompL(txtTestCrcVal, KCrcRecordFile, EFalse);
|
sl@0
|
221 |
|
sl@0
|
222 |
// Auto Cre Test
|
sl@0
|
223 |
TUint32 creTestCrcVal;
|
sl@0
|
224 |
TheFs.Delete(KPrivateCreFileForCreTest);
|
sl@0
|
225 |
CopyFile(KCopyCreFileForCreTest, KPrivateCreFileForCreTest);
|
sl@0
|
226 |
BasicFunctionL(uidcretest,KNullDesC,KNullDesC,EAutoTxt);
|
sl@0
|
227 |
CopyFile(KPrivateCreFileForCreTest, KCreTestGenFile);
|
sl@0
|
228 |
DoFileCompL(KCreTestGenFile, KCreTestRefFile, creTestCrcVal);
|
sl@0
|
229 |
DoCrcCompL(creTestCrcVal, KCrcRecordFile, ETrue);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
|
sl@0
|
232 |
void FlushFunctionalityTestingL(CRepository* aRepository)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
TInt r= aRepository->StartTransaction(CRepository::EConcurrentReadWriteTransaction);
|
sl@0
|
235 |
TheTest(r==KErrNone);
|
sl@0
|
236 |
aRepository->CleanupFailTransactionPushL();
|
sl@0
|
237 |
|
sl@0
|
238 |
User::LeaveIfError(aRepository->Set(1,9));
|
sl@0
|
239 |
|
sl@0
|
240 |
CleanupStack::Pop();
|
sl@0
|
241 |
aRepository->FailTransaction();
|
sl@0
|
242 |
|
sl@0
|
243 |
User::LeaveIfError(aRepository->Flush());
|
sl@0
|
244 |
TInt value=0;
|
sl@0
|
245 |
User::LeaveIfError(aRepository->Get(1,value));
|
sl@0
|
246 |
TheTest(value==9);
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
void FlushTestingL(TUid aUid,const TDesC& aInFilePath,const TDesC& aOutFilePath,TUint aTestMode)
|
sl@0
|
250 |
{
|
sl@0
|
251 |
__UHEAP_MARK;
|
sl@0
|
252 |
SetupEnv(aInFilePath,aOutFilePath,aTestMode);
|
sl@0
|
253 |
|
sl@0
|
254 |
//basic functionality test
|
sl@0
|
255 |
CRepository* repository=NULL;
|
sl@0
|
256 |
InitialiseLC(repository,aUid,aInFilePath,aOutFilePath,aTestMode);
|
sl@0
|
257 |
|
sl@0
|
258 |
//made some modification
|
sl@0
|
259 |
FlushFunctionalityTestingL(repository);
|
sl@0
|
260 |
CleanupStack::PopAndDestroy();
|
sl@0
|
261 |
|
sl@0
|
262 |
//oom functionality test
|
sl@0
|
263 |
OomTest(FlushFunctionalityTestingL,aUid,aInFilePath,aOutFilePath,aTestMode);
|
sl@0
|
264 |
|
sl@0
|
265 |
__UHEAP_MARKEND;
|
sl@0
|
266 |
}
|
sl@0
|
267 |
|
sl@0
|
268 |
/**
|
sl@0
|
269 |
@SYMTestCaseID PDS-CENTRALREPOSITORY-CT-4080
|
sl@0
|
270 |
@SYMTestCaseDesc Test for DEF130394
|
sl@0
|
271 |
@SYMTestPriority Medium
|
sl@0
|
272 |
@SYMTestActions This is Part 2 of the test - Part 1 is in t_cenrrepcs.cpp
|
sl@0
|
273 |
Loading a repository multiple times and then compare
|
sl@0
|
274 |
(using CRC compare) the created cre file with the reference
|
sl@0
|
275 |
cre from CS test.
|
sl@0
|
276 |
@SYMTestExpectedResults Cre file is identical as the reference cre.
|
sl@0
|
277 |
@SYMDEF DEF130394
|
sl@0
|
278 |
*/
|
sl@0
|
279 |
void TestLoadingDEF130394L(const TDesC& aInFilePath, const TDesC& aOutFilePath)
|
sl@0
|
280 |
{
|
sl@0
|
281 |
CRepository* repos = NULL;
|
sl@0
|
282 |
|
sl@0
|
283 |
repos = CRepository::NewLC(aInFilePath, aOutFilePath);
|
sl@0
|
284 |
TInt err = repos->Create(1,1);
|
sl@0
|
285 |
TEST2(err, KErrNone);
|
sl@0
|
286 |
|
sl@0
|
287 |
CleanupStack::PopAndDestroy();
|
sl@0
|
288 |
|
sl@0
|
289 |
// Second time we need to load from output file it self, otherwise it is not loading
|
sl@0
|
290 |
// a repository multiple times because changes of the first time loading is not
|
sl@0
|
291 |
// flushed into input file.
|
sl@0
|
292 |
repos = CRepository::NewLC(aOutFilePath, aOutFilePath);
|
sl@0
|
293 |
err = repos->Create(1,1);
|
sl@0
|
294 |
TEST2(err, KErrAlreadyExists);
|
sl@0
|
295 |
|
sl@0
|
296 |
CleanupStack::PopAndDestroy();
|
sl@0
|
297 |
}
|
sl@0
|
298 |
|
sl@0
|
299 |
void TestForDEF130394L()
|
sl@0
|
300 |
{
|
sl@0
|
301 |
TUint32 dummy;
|
sl@0
|
302 |
|
sl@0
|
303 |
// NewLC Txt=>Cre Loading test
|
sl@0
|
304 |
ClearOgns();
|
sl@0
|
305 |
TheFs.Delete(KMetaTestCreFile);
|
sl@0
|
306 |
TestLoadingDEF130394L(KMetaTxtTestInFile, KMetaTestCreFile);
|
sl@0
|
307 |
DoFileCompL(KMetaTestCreFile, KMetaTestRefFile, dummy);
|
sl@0
|
308 |
|
sl@0
|
309 |
// NewLC Cre=>Cre Loading test
|
sl@0
|
310 |
ClearOgns();
|
sl@0
|
311 |
TheFs.Delete(KMetaTestCreFile);
|
sl@0
|
312 |
CopyFile(KMetaTestCreCopy, KMetaTestCreFile);
|
sl@0
|
313 |
TestLoadingDEF130394L(KMetaTestCreFile, KMetaTestCreFile);
|
sl@0
|
314 |
DoFileCompL(KMetaTestCreFile, KMetaTestRefFile, dummy);
|
sl@0
|
315 |
|
sl@0
|
316 |
// Auto Loading Cre test
|
sl@0
|
317 |
ClearOgns();
|
sl@0
|
318 |
TheFs.Delete(KMetaTestFile);
|
sl@0
|
319 |
CopyFile(KMetaTestCopy, KMetaTestFile);
|
sl@0
|
320 |
DEF130394L(uidmetatest);
|
sl@0
|
321 |
DoFileCompL(KMetaTestRefFile, KMetaTestFile, dummy);
|
sl@0
|
322 |
|
sl@0
|
323 |
//Auto Loading Txt test
|
sl@0
|
324 |
ClearOgns();
|
sl@0
|
325 |
TheFs.Delete(KMetaTestFile);
|
sl@0
|
326 |
DEF130394L(uidmetatest);
|
sl@0
|
327 |
DoFileCompL(KMetaTestRefFile, KMetaTestFile, dummy);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
|
sl@0
|
330 |
/**
|
sl@0
|
331 |
@SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-4041
|
sl@0
|
332 |
@SYMTestCaseDesc PC-side CentralRepository functionality test
|
sl@0
|
333 |
@SYMTestPriority High
|
sl@0
|
334 |
@SYMTestActions Wrapper function calling up test functions. Test functions include test for basic
|
sl@0
|
335 |
functions of the component, OOm test and CRC comparison test.
|
sl@0
|
336 |
@SYMTestExpectedResults Test must not fail
|
sl@0
|
337 |
@SYMPREQ PREQ2111
|
sl@0
|
338 |
*/
|
sl@0
|
339 |
LOCAL_C void MainL()
|
sl@0
|
340 |
{
|
sl@0
|
341 |
//Note these files are equivalent, the cre being generated from txt
|
sl@0
|
342 |
User::LeaveIfError(TheFs.Connect());
|
sl@0
|
343 |
|
sl@0
|
344 |
//TXT => CRE
|
sl@0
|
345 |
TheTest.Start(_L("Functional NewLC TXT tests"));
|
sl@0
|
346 |
BasicFunctionL(uid,KTemplateTxtFile(),KTemplateTxtOutFile(),ETxt);
|
sl@0
|
347 |
TheTest.Next(_L("OOM NewLC TXT tests"));
|
sl@0
|
348 |
ObjectCreateDeleteOOM(uid,KTemplateTxtFile(),KTemplateTxtOutFile(),ETxt);
|
sl@0
|
349 |
OomBasicFunction(uid,KTemplateTxtFile(),KTemplateTxtOutFile(),ETxt);
|
sl@0
|
350 |
|
sl@0
|
351 |
//CRE => CRE
|
sl@0
|
352 |
TheTest.Next(_L("Functional NewLC CRE tests"));
|
sl@0
|
353 |
BasicFunctionL(uidcre,KTemplateCreFile(),KTemplateCreOutFile,ECre);
|
sl@0
|
354 |
TheTest.Next(_L("OOM NewL CRE tests"));
|
sl@0
|
355 |
ObjectCreateDeleteOOM(uidcre,KTemplateCreFile(),KTemplateCreOutFile,ECre);
|
sl@0
|
356 |
OomBasicFunction(uidcre,KTemplateCreFile(),KTemplateCreOutFile,ECre);
|
sl@0
|
357 |
|
sl@0
|
358 |
//CRE exists only
|
sl@0
|
359 |
TheTest.Next(_L("Functional NewLC Auto CRE tests"));
|
sl@0
|
360 |
BasicFunctionL(uidcre,KPrivateTemplateCreFile(),KPrivateTemplateCreFile(),EAutoCre);
|
sl@0
|
361 |
TheTest.Next(_L("OOM NewLC Auto CRE tests"));
|
sl@0
|
362 |
ObjectCreateDeleteOOM(uidcre,KPrivateTemplateCreFile(),KPrivateTemplateCreFile(),EAutoCre);
|
sl@0
|
363 |
OomBasicFunction(uidcre,KPrivateTemplateCreFile(),KPrivateTemplateCreFile(),EAutoCre);
|
sl@0
|
364 |
|
sl@0
|
365 |
//TXT exists only
|
sl@0
|
366 |
TheTest.Next(_L("Functional NewLC Auto TXT tests"));
|
sl@0
|
367 |
BasicFunctionL(uid,KPrivateTemplateTxtFile(),KPrivateTemplateTxtOutFile(),EAutoTxt);
|
sl@0
|
368 |
TheTest.Next(_L("OOM NewLC Auto TXT tests"));
|
sl@0
|
369 |
ObjectCreateDeleteOOM(uid,KPrivateTemplateTxtFile(),KPrivateTemplateTxtOutFile(),EAutoTxt);
|
sl@0
|
370 |
OomBasicFunction(uid,KPrivateTemplateTxtFile(),KPrivateTemplateTxtOutFile(),EAutoTxt);
|
sl@0
|
371 |
|
sl@0
|
372 |
//PC side only testing
|
sl@0
|
373 |
TheTest.Next(_L("Flush Functionality test"));
|
sl@0
|
374 |
FlushTestingL(uidcre,KPrivateTemplateCreFile(),KPrivateTemplateCreFile(),EAutoCre);
|
sl@0
|
375 |
FlushTestingL(uid,KPrivateTemplateTxtFile(),KPrivateTemplateTxtOutFile(),EAutoTxt);
|
sl@0
|
376 |
|
sl@0
|
377 |
TheTest.Next(_L("CRC comparison test"));
|
sl@0
|
378 |
CrcComparisonTestL();
|
sl@0
|
379 |
|
sl@0
|
380 |
#ifdef SYMBIAN_CENTREP_SUPPORT_MULTIROFS
|
sl@0
|
381 |
//perform testing on CREV1 , only CRE exists only
|
sl@0
|
382 |
TheTest.Next(_L("Functional NewLC Auto CREV1 tests"));
|
sl@0
|
383 |
BasicFunctionL(uidcrev1,KPrivateTemplateCreV1File(),KPrivateTemplateCreV1File(),EAutoCre);
|
sl@0
|
384 |
TheTest.Next(_L("OOM NewLC Auto CREV1 tests"));
|
sl@0
|
385 |
ObjectCreateDeleteOOM(uidcrev1,KPrivateTemplateCreV1File(),KPrivateTemplateCreV1File(),EAutoCre);
|
sl@0
|
386 |
OomBasicFunction(uidcrev1,KPrivateTemplateCreV1File(),KPrivateTemplateCreV1File(),EAutoCre);
|
sl@0
|
387 |
|
sl@0
|
388 |
#endif
|
sl@0
|
389 |
|
sl@0
|
390 |
TheTest.Next(_L("Test for DEF130394L"));
|
sl@0
|
391 |
TestForDEF130394L();
|
sl@0
|
392 |
|
sl@0
|
393 |
TheFs.Close();
|
sl@0
|
394 |
TheTest.End();
|
sl@0
|
395 |
TheTest.Close();
|
sl@0
|
396 |
}
|
sl@0
|
397 |
|
sl@0
|
398 |
TInt E32Main()
|
sl@0
|
399 |
{
|
sl@0
|
400 |
__UHEAP_MARK;
|
sl@0
|
401 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
sl@0
|
402 |
if(!cleanup)
|
sl@0
|
403 |
return KErrNoMemory;
|
sl@0
|
404 |
|
sl@0
|
405 |
TRAPD(err, MainL());
|
sl@0
|
406 |
if (err != KErrNone)
|
sl@0
|
407 |
User::Panic(_L("Testing failed: "), err);
|
sl@0
|
408 |
|
sl@0
|
409 |
delete cleanup;
|
sl@0
|
410 |
__UHEAP_MARKEND;
|
sl@0
|
411 |
|
sl@0
|
412 |
return 0;
|
sl@0
|
413 |
}
|