|
1 // Copyright (c) 2006-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 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 |
|
23 #include <e32uid.h> |
|
24 #include <f32file.h> |
|
25 #include <bautils.h> |
|
26 #include <apmrec.h> |
|
27 #include <ecom/ecom.h> |
|
28 #include "T_MimeStep.h" |
|
29 |
|
30 |
|
31 // |
|
32 _LIT8(KTextPlainData,"text/plain"); |
|
33 _LIT(KTextFile,"z:\\system\\data\\emime\\testrec.text"); |
|
34 _LIT(KTxtFile,"z:\\system\\data\\emime\\testrec.txt"); |
|
35 _LIT(KWordFile,"z:\\system\\data\\emime\\word.doc"); |
|
36 _LIT(KLeavingRecognizer,"TLEAVINGRECOGNIZER"); |
|
37 |
|
38 const TUid KWordAppUid={0x10003A64}; |
|
39 |
|
40 const TUid KLeavingRecogniserUid={0x1d1F75EB}; |
|
41 const TUid KTestEcomDataRecognizerUid={0x101F7DA1}; |
|
42 const TInt KTestDataRecognizerError=-420; // some random number for test error code |
|
43 _LIT(KDeceptiveRecognizerToken, "c:\\test\\appfwk\\emime\\deceptive_recognizer.token"); |
|
44 // |
|
45 |
|
46 /* Construction of CTestDataRecognitionType Object*/ |
|
47 |
|
48 CTestDataRecognizerType* CTestDataRecognizerType::NewDataRecogTypeL(RFs &aIfs) |
|
49 { |
|
50 CTestDataRecognizerType *dataRecogTypeObj=new(ELeave)CTestDataRecognizerType(aIfs); |
|
51 CleanupStack::PushL(dataRecogTypeObj); |
|
52 CleanupStack::Pop(dataRecogTypeObj); |
|
53 return dataRecogTypeObj; |
|
54 |
|
55 } |
|
56 /* Constructor*/ |
|
57 |
|
58 CTestDataRecognizerType::CTestDataRecognizerType (RFs &aIfs) |
|
59 :CApaDataRecognizer(aIfs) |
|
60 { |
|
61 |
|
62 |
|
63 } |
|
64 |
|
65 CTestDataRecognizerType::~CTestDataRecognizerType() |
|
66 { |
|
67 |
|
68 } |
|
69 /** |
|
70 Auxiliary Fn for Test Case ID T-MimeStep-testScanningMimeTheRecognizerL |
|
71 |
|
72 This method is used to verify the functionality of Locking and Unlocking the recognizer |
|
73 with the UID of the recognizer .Whenever the Recognizer is Locked the return value of |
|
74 Locked() function should be a value greater than zero. And When the recognizer is tried to |
|
75 Unload , the unloading operation would fail with return code KErrLocked. |
|
76 When the recognizer is in Unlocked condition the return value of Locked() is zero. |
|
77 And Function to Unload the Recognizer is called again after unlocking the recognizer , and the |
|
78 Recognizer is unloaded without any Error.And the return code will be KErrNone. |
|
79 |
|
80 This method is also used to verify the return values of Mimetype() and Confidence(), |
|
81 When the recognizer is not added . And hence the values are default when the |
|
82 Recognizers are not added. |
|
83 |
|
84 */ |
|
85 void CT_MimeStep::ChkLockAndUnlockL(RFs &aIfs) |
|
86 { |
|
87 |
|
88 CTestDataRecognizerType *testLockAndUnLock=CTestDataRecognizerType::NewDataRecogTypeL(aIfs); |
|
89 CleanupStack::PushL(testLockAndUnLock); |
|
90 TRAPD(ret,testLockAndUnLock->AddDataL(iData)); |
|
91 INFO_PRINTF2(_L("Val of AddDataL %d"), ret); |
|
92 |
|
93 TInt valBeforeLock=iData->Locked(); |
|
94 INFO_PRINTF2(_L("Val of Lock Before %d"), valBeforeLock); |
|
95 TEST(valBeforeLock==0); |
|
96 |
|
97 iData->Lock(); |
|
98 TInt valAfterLock=iData->Locked(); |
|
99 INFO_PRINTF2(_L("Val of Lock %d"), valAfterLock); |
|
100 TEST(valAfterLock > 0); |
|
101 |
|
102 TInt remDataAfterLock=testLockAndUnLock->RemoveData(iData); |
|
103 TEST(remDataAfterLock==KErrLocked); |
|
104 INFO_PRINTF2(_L("Val of remDataAfterLock %d"), remDataAfterLock); |
|
105 |
|
106 TRAP(ret,testLockAndUnLock->UpdateDataTypesL()); |
|
107 TEST(ret==KErrNone); |
|
108 |
|
109 iData->Unlock(); |
|
110 TInt valAfterUnlock=iData->Locked(); |
|
111 INFO_PRINTF2(_L("Val of Loc k %d"), valAfterUnlock); |
|
112 TEST(valAfterUnlock==0); |
|
113 |
|
114 TInt remDataAfterUnLock=testLockAndUnLock->RemoveData(iData); |
|
115 TEST(remDataAfterUnLock==KErrNone); |
|
116 INFO_PRINTF2(_L("Val of remDataAfterLock %d"), remDataAfterUnLock); |
|
117 |
|
118 |
|
119 CleanupStack::PopAndDestroy(testLockAndUnLock); |
|
120 } |
|
121 /** |
|
122 Auxiliary Fn for Test Case ID T-MimeStep-testScanningMimeTheRecognizerL |
|
123 |
|
124 This method is used to verify the return values of Mimetype() and Confidence(), |
|
125 When the recognizer is not added . And hence the values are default when the |
|
126 Recognizers are not added. */ |
|
127 |
|
128 |
|
129 void CT_MimeStep::ChkConfAndMimeL(RFs &aIfs,const TUid &aUid) |
|
130 { |
|
131 CTestDataRecognizerType *confAndMimeDataRec=CTestDataRecognizerType::NewDataRecogTypeL(aIfs); |
|
132 CleanupStack::PushL(confAndMimeDataRec); |
|
133 TRAPD(ret,iData=CApaDataRecognizerType::CreateDataRecognizerL(aUid)); |
|
134 TEST(ret==KErrNone); |
|
135 TDataType dataType= iData->MimeType(); |
|
136 TInt confidenceVal=iData->Confidence(); |
|
137 TEST(dataType.Uid().iUid==0); |
|
138 TEST(confidenceVal==0); |
|
139 INFO_PRINTF2(_L("Val of confidence %d"), confidenceVal); |
|
140 CleanupStack::PopAndDestroy(confAndMimeDataRec); |
|
141 } |
|
142 |
|
143 |
|
144 /** |
|
145 Auxiliary Fn for Test Case ID T-MimeStep-testScanningMimeTheRecognizerL |
|
146 |
|
147 This function checks a return value, and prints it in an Error return value. |
|
148 |
|
149 */ |
|
150 void CT_MimeStep::DoTest(TInt aReturnValue) |
|
151 { |
|
152 if (aReturnValue!=KErrNone) |
|
153 INFO_PRINTF2(_L("\nError: %D\n"),aReturnValue); |
|
154 TEST(aReturnValue==KErrNone); |
|
155 } |
|
156 |
|
157 |
|
158 /** |
|
159 Auxiliary Fn for Test Case ID T-MimeStep-testScanningMimeTheRecognizerL |
|
160 |
|
161 This function checks the integrity of a Recognizer. |
|
162 |
|
163 */ |
|
164 void CT_MimeStep::testRecognizer(const CApaScanningDataRecognizer::TRecognizer& aRec) |
|
165 { |
|
166 _LIT(KRecText,"RECTXT"); |
|
167 _LIT(KRecWeb,"RECWEB"); |
|
168 _LIT(KRecApp2,"RECAPP2"); |
|
169 _LIT(KRecJar,"RECJAR"); |
|
170 _LIT(KBookMarkRec,"EBOOKMARKREC"); |
|
171 _LIT(KRecMda,"RECMDA"); |
|
172 _LIT(KRecOffice,"RECOFFICE"); |
|
173 _LIT(KRecWap,"RECWAP"); |
|
174 _LIT(KRVersit,"RVERSIT"); |
|
175 _LIT(KWebUrlRec,"WEBURLREC"); |
|
176 _LIT(TTestEcomDataRec,"TTESTECOMDATAREC"); |
|
177 |
|
178 if (aRec.iUid.iUid==0x100012FB) |
|
179 { |
|
180 TEST(aRec.iDrive==25); |
|
181 TEST(aRec.Name().CompareF(KRecText)==0); |
|
182 } |
|
183 else if (aRec.iUid.iUid==0x10001315) |
|
184 { |
|
185 TEST(aRec.iDrive==25); |
|
186 TEST(aRec.Name().CompareF(KRecWeb)==0); |
|
187 } |
|
188 else if (aRec.iUid.iUid==0x1000415F) |
|
189 { |
|
190 TEST(aRec.iDrive==25); |
|
191 TEST(aRec.Name().CompareF(KRecApp2)==0); |
|
192 } |
|
193 else if (aRec.iUid.iUid==0x1000967A) |
|
194 { |
|
195 TEST(aRec.iDrive==25); |
|
196 TEST(aRec.Name().CompareF(KRecJar)==0); |
|
197 } |
|
198 else if (aRec.iUid.iUid==0x10008ED4) |
|
199 { |
|
200 TEST(aRec.iDrive==25); |
|
201 TEST(aRec.Name().CompareF(KBookMarkRec)==0); |
|
202 } |
|
203 else if (aRec.iUid.iUid==0x10005617) |
|
204 { |
|
205 TEST(aRec.iDrive==25); |
|
206 TEST(aRec.Name().CompareF(KRecMda)==0); |
|
207 } |
|
208 else if (aRec.iUid.iUid==0x10008A2F) |
|
209 { |
|
210 TEST(aRec.iDrive==25); |
|
211 TEST(aRec.Name().CompareF(KRecOffice)==0); |
|
212 } |
|
213 else if (aRec.iUid.iUid==0x1000515E) |
|
214 { |
|
215 TEST(aRec.iDrive==25); |
|
216 TEST(aRec.Name().CompareF(KRecWap)==0); |
|
217 } |
|
218 else if (aRec.iUid.iUid==0x100047EB) |
|
219 { |
|
220 TEST(aRec.iDrive==25); |
|
221 TEST(aRec.Name().CompareF(KRVersit)==0); |
|
222 } |
|
223 else if (aRec.iUid.iUid==0x100064DE) |
|
224 { |
|
225 TEST(aRec.iDrive==25); |
|
226 TEST(aRec.Name().CompareF(KWebUrlRec)==0); |
|
227 } |
|
228 else if (aRec.iUid==KLeavingRecogniserUid) |
|
229 { |
|
230 INFO_PRINTF1(_L("Testing a recogniser(TLEAVINGRECOGNIZER) with >12 chars length")); |
|
231 TEST(aRec.iDrive==25); |
|
232 TEST(aRec.Name().CompareF(KLeavingRecognizer)==0); |
|
233 } |
|
234 else if(aRec.iUid.iUid==0x101F7DA0) |
|
235 { |
|
236 TEST(aRec.Name().CompareF(KRecText)==0); |
|
237 } |
|
238 else if(aRec.iUid.iUid==0x101F7D9F) |
|
239 { |
|
240 TEST(aRec.Name().CompareF(KRecApp2)==0); |
|
241 } |
|
242 else if(aRec.iUid==KTestEcomDataRecognizerUid) |
|
243 { |
|
244 INFO_PRINTF1(_L("Testing the presence of ecom style TTESTECOMDATAREC recognizer")); |
|
245 TEST(aRec.Name().CompareF(TTestEcomDataRec)==0); |
|
246 } |
|
247 } |
|
248 |
|
249 |
|
250 /** |
|
251 @SYMTestCaseID T-MimeStep-testScanningMimeTheRecognizerL |
|
252 |
|
253 @SYMPREQ |
|
254 |
|
255 @SYMTestCaseDesc Tests the Scanning File-Recognizer |
|
256 |
|
257 @SYMTestPriority High |
|
258 |
|
259 @SYMTestStatus Implemented |
|
260 |
|
261 @SYMTestActions The test verifies the Scannig File-Recognizer by testing |
|
262 the getter and setter functions. It creates a temporal list of recognizers to |
|
263 check the getter function, and then goes through the whole list of recognizers |
|
264 testing each one.\n |
|
265 Also, the setter function is checked, by adding a recognizer that's already |
|
266 added, and adding one that doesn't exist, and verifying that correct return |
|
267 value. Finally, it is checked if specific recognizers are loaded or not.\n |
|
268 This test Also checks for the functionality of the Locking and Unlocking |
|
269 Mechanism of the recognizer and checks that the When the recognizers are not |
|
270 added in CAPARecognizertype class , The properties of the Recognizer will be |
|
271 the defaulted. |
|
272 API Calls:\n |
|
273 CApaScanningDataRecognizer::NewL(RFs& aFs) \n |
|
274 CApaScanningDataRecognizer::TRecognizer(HBufC* aName) \n |
|
275 CApaScanningDataRecognizer::RecognizerListLC() \n |
|
276 CApaScanningDataRecognizer::RecognizerCount() \n |
|
277 CApaScanningDataRecognizer::UpdateCounter() const \n |
|
278 CApaScanningDataRecognizer::SetRecognizerL() \n |
|
279 CApaScanningDataRecognizer::SetEcomRecognizerL() \n |
|
280 CApaDataRecognizerType::MimeType() \n |
|
281 CApaDataRecognizerType::Confidence() \n |
|
282 CApaDataRecognizerType::Lock() \n |
|
283 CApaDataRecognizerType::Unlock() \n |
|
284 @SYMTestExpectedResults Test should complete without any panic. |
|
285 |
|
286 */ |
|
287 void CT_MimeStep::testScanningMimeTheRecognizerL() |
|
288 { |
|
289 INFO_PRINTF1(_L("Testing the Scanning File-Recognizer")); |
|
290 // |
|
291 // construct - this scans for TheRecognizer plug-ins |
|
292 TRAPD(ret, iRecognizer=CApaScanningDataRecognizer::NewL(iFs) ); |
|
293 DoTest(ret); |
|
294 TEST(iRecognizer->RecognizerCount()>=3); |
|
295 TEST(iRecognizer->UpdateCounter()>=3); |
|
296 // |
|
297 INFO_PRINTF1(_L("Testing the getter and setter functions")); |
|
298 // |
|
299 // check the getter function |
|
300 CApaScanningDataRecognizer::CRecognizerArray* tempListOfRecognizers = iRecognizer->RecognizerListLC(); |
|
301 TInt listCount = tempListOfRecognizers->Count(); |
|
302 |
|
303 for (TInt ii=0;ii<listCount;ii++) |
|
304 { |
|
305 testRecognizer((*tempListOfRecognizers)[ii]); |
|
306 } |
|
307 |
|
308 CleanupStack::PopAndDestroy(1); // tmpListOfRecogniszers |
|
309 |
|
310 //for testing ecom style plugin |
|
311 INFO_PRINTF1(_L("Testing the ecom style TTESTECOMDATAREC recognizer is loaded or not")); |
|
312 CApaScanningDataRecognizer::TRecognizer testEcomDataRecognizer; |
|
313 testEcomDataRecognizer.iUid=KTestEcomDataRecognizerUid; |
|
314 testEcomDataRecognizer.iDrive=25; |
|
315 TRAP(ret,iRecognizer->SetEcomRecognizerL(testEcomDataRecognizer)); |
|
316 TEST(ret==KErrNone); |
|
317 // for testing Lock() ,Unlock of the recognizers. |
|
318 INFO_PRINTF1(_L("Test Confidence and MimeType APIs of CApaDataRecognizerType ")); |
|
319 TRAP(ret,ChkConfAndMimeL(iFs,testEcomDataRecognizer.iUid)); |
|
320 TEST(ret==KErrNone); |
|
321 |
|
322 INFO_PRINTF1(_L("Test Lock And Unlock APIs of CApaDataRecognizerType ")); |
|
323 TRAP(ret,ChkLockAndUnlockL(iFs)); |
|
324 TEST(ret==KErrNone); |
|
325 |
|
326 INFO_PRINTF1(_L("Testing the TECOMLEAVINGRECOGNIZER recogniser is loaded or not")); |
|
327 CApaScanningDataRecognizer::TRecognizer ecomLeavingRecognizer; |
|
328 ecomLeavingRecognizer.iUid.iUid = 0x10203630; |
|
329 ecomLeavingRecognizer.iDrive = 25; |
|
330 TRAP(ret,iRecognizer->SetEcomRecognizerL(ecomLeavingRecognizer)); |
|
331 TEST(ret==KErrNone); |
|
332 TEST(iRecognizer->UpdateCounter()>=3); |
|
333 } |
|
334 |
|
335 |
|
336 /** |
|
337 @SYMTestCaseID T-MimeStep-testTDataTypeL |
|
338 |
|
339 @SYMPREQ |
|
340 |
|
341 @SYMTestCaseDesc Test TDataType structure by creating new automatic variables |
|
342 |
|
343 @SYMTestPriority High |
|
344 |
|
345 @SYMTestStatus Implemented |
|
346 |
|
347 @SYMTestActions The test creates new TDataType automatic variables. |
|
348 It creates a first TDataType using the constructor taking a UID. The data |
|
349 type must be a native Symbian data type, with an associated UID equal |
|
350 to the original UID from which the UID was constructed.\n |
|
351 A second TDataType is created using a pointer descriptor to the data |
|
352 type previously created. Also, the data type must be a native Symbian data |
|
353 type, with the same associated UID than the previously data type created.\n |
|
354 API Calls:\n |
|
355 TDataType::TDataType() \n |
|
356 TDataType::TDataType(const TDesC8& aDataType) \n |
|
357 TDataType::IsNative() \n |
|
358 TDataType::Uid() \n |
|
359 |
|
360 @SYMTestExpectedResults Test should complete without any panic. |
|
361 |
|
362 */ |
|
363 void CT_MimeStep::testTDataTypeL() |
|
364 // check TDataType constructors |
|
365 { |
|
366 TUid uid={0x12345678}; |
|
367 TDataType dataType(uid); |
|
368 TEST(dataType.IsNative()); |
|
369 TEST(dataType.Uid()==uid); |
|
370 TDataType secondType(dataType.Des8()); |
|
371 TEST(secondType==dataType); |
|
372 TEST(secondType.IsNative()); |
|
373 TEST(secondType.Uid()==uid); |
|
374 } |
|
375 |
|
376 |
|
377 /** |
|
378 @SYMTestCaseID T-MimeStep-testRecognizersL |
|
379 |
|
380 @SYMPREQ |
|
381 |
|
382 @SYMTestCaseDesc Tests file recognizers using RecognizerL function |
|
383 |
|
384 @SYMTestPriority High |
|
385 |
|
386 @SYMTestStatus Implemented |
|
387 |
|
388 @SYMTestActions The test uses the RecognizeL function to recognize the |
|
389 data type of the data in the files, corresponding to three types of file formats:\n |
|
390 (1) .text file, containing plain text. The recognized data type must be |
|
391 equal to a plain text TDataType. When no TDataType is defined, the error must |
|
392 be propagated accordingly.\n |
|
393 (2) .txt file, containing plain text. The recognized data type must be equal to |
|
394 a plain text TDataType.\n |
|
395 (3) Word file (.doc format). The recognized data type must be equal to |
|
396 a word file TDataType.\n |
|
397 API Calls:\n |
|
398 CApaScanningDataRecognizer::RecognizeL(const TDesC& aName, const TDesC8& aBuffer)\n |
|
399 |
|
400 @SYMTestExpectedResults Test should complete without any panic. |
|
401 |
|
402 */ |
|
403 void CT_MimeStep::testRecognizersL() |
|
404 { |
|
405 // |
|
406 // do other stuff... |
|
407 |
|
408 INFO_PRINTF1(_L("Testing the text file recognizer")); |
|
409 CArrayFixFlat<TDataType>* array=new(ELeave) CArrayFixFlat<TDataType>(5); |
|
410 CleanupStack::PushL(array); |
|
411 iRecognizer->DataTypeL(*array); |
|
412 |
|
413 TInt minNumDataTypes = 1; // txt/plain |
|
414 minNumDataTypes++; // dodgy/app |
|
415 |
|
416 TEST(array->Count()>=minNumDataTypes); |
|
417 CleanupStack::PopAndDestroy(); // array |
|
418 // I don't know what order these will be in - I can't test them |
|
419 |
|
420 TInt bufSize=iRecognizer->PreferredBufSize(); |
|
421 HBufC8* buf=HBufC8::NewLC(bufSize); |
|
422 RFile rfile; |
|
423 TInt err=rfile.Open(iFs,KTextFile,EFileShareReadersOnly); |
|
424 TEST(err==KErrNone); |
|
425 TPtr8 des=buf->Des(); |
|
426 if (err==KErrNone) |
|
427 { |
|
428 err=rfile.Read(des); |
|
429 if (err!=KErrNone) |
|
430 des.SetLength(0); |
|
431 } |
|
432 rfile.Close(); |
|
433 TDataType textplain(KTextPlainData); |
|
434 // recognizes the plain text |
|
435 TEST(iRecognizer->RecognizeL(KTextFile, des).iDataType==textplain); |
|
436 // test by passing a empty file name |
|
437 TEST(iRecognizer->RecognizeL(TPtrC(), des).iDataType==textplain); |
|
438 |
|
439 //Test the propagation of error (leave) occured in a recognizer, |
|
440 //if there is no probable data type matched. |
|
441 // There is a V1 version and a V2 (ECom) version of this recognizer. |
|
442 INFO_PRINTF1(_L("Propagates error if a recognizer leaves with no probable data type found")); |
|
443 TDataType dataType; |
|
444 des.SetLength(0); |
|
445 TRAPD(ret,dataType=iRecognizer->RecognizeL(KTextFile, des).iDataType); |
|
446 TEST(dataType==TDataType()); |
|
447 INFO_PRINTF2(_L("Propagated error:%d, it should should be equal to KTestDataRecognizerError(-420)"), ret); |
|
448 TEST(ret==KTestDataRecognizerError); |
|
449 |
|
450 err=rfile.Open(iFs,KTxtFile,EFileShareReadersOnly); |
|
451 TEST(err==KErrNone); |
|
452 des=buf->Des(); |
|
453 if (err==KErrNone) |
|
454 { |
|
455 err=rfile.Read(des); |
|
456 if (err!=KErrNone) |
|
457 des.SetLength(0); |
|
458 } |
|
459 rfile.Close(); |
|
460 |
|
461 TRAP(ret,dataType=iRecognizer->RecognizeL(KTxtFile, des).iDataType); |
|
462 TEST(dataType==textplain); |
|
463 TEST(err==KErrNone); |
|
464 |
|
465 des.SetLength(0); |
|
466 TRAP(ret,dataType=iRecognizer->RecognizeL(KTxtFile, des).iDataType); |
|
467 TEST(dataType==textplain); |
|
468 TEST(err==KErrNone); |
|
469 |
|
470 INFO_PRINTF1(_L("Testing the EIKON app recognizer")); |
|
471 des.SetLength(0); |
|
472 err=rfile.Open(iFs,KWordFile,EFileShareReadersOnly); |
|
473 TEST(err==KErrNone); |
|
474 des=buf->Des(); |
|
475 if (err==KErrNone) |
|
476 { |
|
477 err=rfile.Read(des); |
|
478 if (err!=KErrNone) |
|
479 des.SetLength(0); |
|
480 } |
|
481 |
|
482 rfile.Close(); |
|
483 TRAP(ret,dataType=iRecognizer->RecognizeL(KWordFile, des).iDataType); |
|
484 TEST(dataType==TDataType(KWordAppUid)); |
|
485 TEST(err==KErrNone); |
|
486 CleanupStack::PopAndDestroy(buf); // buf |
|
487 |
|
488 delete iRecognizer; |
|
489 } |
|
490 |
|
491 CT_MimeStep::~CT_MimeStep() |
|
492 /** |
|
493 Destructor |
|
494 */ |
|
495 { |
|
496 } |
|
497 |
|
498 CT_MimeStep::CT_MimeStep() |
|
499 /** |
|
500 Constructor |
|
501 */ |
|
502 { |
|
503 // Call base class method to set up the human readable name for logging |
|
504 SetTestStepName(KT_MimeStep); |
|
505 } |
|
506 |
|
507 |
|
508 TVerdict CT_MimeStep::doTestStepL() |
|
509 { |
|
510 INFO_PRINTF1(_L("Test Started - Testing the APMIME dll")); |
|
511 |
|
512 // set up the directory structure |
|
513 User::LeaveIfError(iFs.Connect()); |
|
514 |
|
515 |
|
516 INFO_PRINTF1(_L("Create token file for deceptive leaving recognizer activation")); |
|
517 RFile file; |
|
518 CleanupClosePushL(file); |
|
519 TInt r = iFs.MkDirAll(KDeceptiveRecognizerToken); |
|
520 TEST(r == KErrNone || r == KErrAlreadyExists); |
|
521 TEST(file.Create(iFs, KDeceptiveRecognizerToken, EFileWrite|EFileShareExclusive) == KErrNone); |
|
522 CleanupStack::PopAndDestroy(&file); |
|
523 |
|
524 // run the testcode (inside an alloc heaven harness) |
|
525 __UHEAP_MARK; |
|
526 |
|
527 CActiveScheduler* pS=new(ELeave) CActiveScheduler; |
|
528 TEST(pS!=NULL); |
|
529 CActiveScheduler::Install(pS); |
|
530 TRAP(r,CT_MimeStep::testScanningMimeTheRecognizerL()); |
|
531 TEST(r==KErrNone); |
|
532 TRAP(r,CT_MimeStep::testRecognizersL()); |
|
533 TEST(r==KErrNone); |
|
534 TRAP(r,CT_MimeStep::testTDataTypeL()); |
|
535 TEST(r==KErrNone); |
|
536 |
|
537 delete pS; |
|
538 REComSession::FinalClose(); |
|
539 __UHEAP_MARKEND; |
|
540 |
|
541 |
|
542 // Removes token file for deceptive leaving recognizer |
|
543 INFO_PRINTF1(_L("Remove token file for deceptive leaving recognizer deactivation")); |
|
544 TEST(iFs.Delete(KDeceptiveRecognizerToken) == KErrNone); |
|
545 |
|
546 iFs.Close(); |
|
547 |
|
548 INFO_PRINTF1(_L("Test Finished")); |
|
549 return TestStepResult(); |
|
550 } |
|
551 |
|
552 |