|
1 // Copyright (c) 2003-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 // Test code for CBioDatabase |
|
15 // Author Julia Blumin |
|
16 // Date Aug 1999 |
|
17 // |
|
18 // |
|
19 |
|
20 #include <e32test.h> |
|
21 #include <e32hal.h> |
|
22 #include <f32fsys.h> |
|
23 #include <s32file.h> |
|
24 #include <barsc.h> |
|
25 #include "biotestutils.h" |
|
26 |
|
27 #include <e32uid.h> |
|
28 |
|
29 #include "BIODB.H" |
|
30 #include <biouids.h> |
|
31 |
|
32 //---------------------------------------------------------------------------------------- |
|
33 |
|
34 // Id array |
|
35 const TBioMsgIdType KId0Type=EBioMsgIdIana; |
|
36 const CApaDataRecognizerType::TRecognitionConfidence KId0Confidence=CApaDataRecognizerType::EPossible; |
|
37 const TBioMsgIdText KId0Text=_L("text/x-bio"); |
|
38 const TInt16 KId0Port=0; |
|
39 const TUid KId0CharacterSet={0x10003b10}; |
|
40 const TInt16 KId0GeneralIdData=0x0000; |
|
41 |
|
42 const TBioMsgIdType KId1Type=EBioMsgIdWap; |
|
43 const TBioMsgIdText KId1Text=_L(""); |
|
44 |
|
45 const TBioMsgIdText KId2Text=_L(""); |
|
46 |
|
47 const TBioMsgIdType KId3Type=EBioMsgIdIana; |
|
48 const CApaDataRecognizerType::TRecognitionConfidence KId3Confidence=CApaDataRecognizerType::EPossible; |
|
49 const TBioMsgIdText KId3Text=_L(""); |
|
50 const TInt16 KId3Port=0; |
|
51 const TUid KId3CharacterSet={0x1000aaaa}; |
|
52 const TInt16 KId3GeneralIdData=0; |
|
53 |
|
54 |
|
55 |
|
56 const TUid KUidBioMsgTypeEmailNotification = {0x10005530}; |
|
57 const TUid KUidBioMsgTypeVCal = {0x10005533}; |
|
58 |
|
59 LOCAL_D CActiveScheduler scheduler; |
|
60 |
|
61 // end of test data. |
|
62 //---------------------------------------------------------------------------------------- |
|
63 |
|
64 #include "CMSTD.H" |
|
65 |
|
66 |
|
67 //---------------------------------------------------------------------------------------- |
|
68 RTest gTest(_L("BIODB.dll Test Harness")); |
|
69 LOCAL_D RFs gFs; |
|
70 LOCAL_D CBioTestUtils* testUtils; |
|
71 //---------------------------------------------------------------------------------------- |
|
72 #define KBifDir _L("c:\\resource\\messaging\\Bif\\") |
|
73 |
|
74 #ifdef __WINS__ |
|
75 #define KRscPath _L("z:\\system\\data\\") |
|
76 #else |
|
77 #define KRscPath _L("c:\\system\\data\\") |
|
78 #endif |
|
79 |
|
80 |
|
81 |
|
82 //---------------------------------------------------------------------------------------- |
|
83 void TestScheduler::ErrorL( TInt anError ) const |
|
84 //---------------------------------------------------------------------------------------- |
|
85 { |
|
86 User::Leave( anError ); |
|
87 } |
|
88 |
|
89 |
|
90 //---------------------------------------------------------------------------------------- |
|
91 LOCAL_C void InitTestUtils() |
|
92 //---------------------------------------------------------------------------------------- |
|
93 { |
|
94 testUtils = CBioTestUtils::NewLC(gTest,ETuCleanMessageFolder); |
|
95 gTest.Start(_L("CBIODatabase")); |
|
96 gTest.Console()->ClearScreen(); |
|
97 } |
|
98 |
|
99 //---------------------------------------------------------------------------------------- |
|
100 LOCAL_C void CloseTestUtils() |
|
101 //---------------------------------------------------------------------------------------- |
|
102 { |
|
103 testUtils->TestHarnessCompleted(); |
|
104 CleanupStack::PopAndDestroy(testUtils); |
|
105 //gTest.Console()->SetPos(0, 13); |
|
106 gTest.End(); |
|
107 gTest.Close(); |
|
108 } |
|
109 |
|
110 //---------------------------------------------------------------------------------------- |
|
111 LOCAL_C void OpenFileSession() |
|
112 //---------------------------------------------------------------------------------------- |
|
113 { |
|
114 gFs.Connect(); |
|
115 gFs.MkDir(KBifDir); |
|
116 gFs.SetSessionPath(KBifDir); |
|
117 |
|
118 CActiveScheduler::Install( &scheduler ); |
|
119 } |
|
120 |
|
121 |
|
122 //---------------------------------------------------------------------------------------- |
|
123 LOCAL_C void CloseFileSession() |
|
124 //---------------------------------------------------------------------------------------- |
|
125 { |
|
126 gFs.Close( ); |
|
127 } |
|
128 |
|
129 //---------------------------------------------------------------------------------------- |
|
130 LOCAL_C void GetBearerText(TInt aBearer, TBuf<100>& rBearerString) |
|
131 //---------------------------------------------------------------------------------------- |
|
132 { |
|
133 switch (aBearer) |
|
134 { |
|
135 case EBioMsgIdIana: |
|
136 rBearerString.Copy(_L("Iana")); |
|
137 break; |
|
138 case EBioMsgIdNbs: |
|
139 rBearerString.Copy(_L("Nbs")); |
|
140 break; |
|
141 case EBioMsgIdWap: |
|
142 rBearerString.Copy(_L("Wap")); |
|
143 break; |
|
144 case EBioMsgIdWapSecure: |
|
145 rBearerString.Copy(_L("WapSecure")); |
|
146 break; |
|
147 case EBioMsgIdUnknown: |
|
148 default: |
|
149 rBearerString.Copy(_L("Unknown")); |
|
150 break; |
|
151 } |
|
152 } |
|
153 //---------------------------------------------------------------------------------------- |
|
154 |
|
155 //---------------------------------------------------------------------------------------- |
|
156 LOCAL_C void DumpBifFiles(TInt aTestNumber) |
|
157 //---------------------------------------------------------------------------------------- |
|
158 { |
|
159 HBufC* commentText = HBufC::NewLC(100); |
|
160 |
|
161 gTest.Printf(_L("Opening & Searching DB\n")); |
|
162 testUtils->TestStart( aTestNumber, _L("Opening & Searching DB")); |
|
163 |
|
164 CBIODatabase* bioDB = CBIODatabase::NewL(gFs); |
|
165 CleanupStack::PushL( bioDB ); |
|
166 gTest.Printf(_L("Opened DB Successfully!\n")); |
|
167 |
|
168 (commentText->Des()).Format(_L("<%D> Bif files read\n"), bioDB->BIOCount()); |
|
169 testUtils->WriteComment(commentText->Des()); |
|
170 gTest.Printf(commentText->Des()); |
|
171 |
|
172 const CArrayFix<TBioMsgId>* ent = NULL; |
|
173 |
|
174 for (TInt i=0; i < bioDB->BIOCount(); i++) |
|
175 { |
|
176 const CBioInfoFileReader& bifReader = bioDB->BifReader(i); |
|
177 |
|
178 TPtrC desc; |
|
179 desc.Set(bifReader.Description()); |
|
180 gTest.Printf(_L("File: %d: "), i); |
|
181 gTest.Printf(_L("Desc: %S "), &desc); |
|
182 |
|
183 (commentText->Des()).Format(_L("%D: '%S'"), i, &desc); |
|
184 testUtils->WriteComment(commentText->Des()); |
|
185 |
|
186 ent = bioDB->BIOEntryLC(i); |
|
187 gTest.Printf(_L("Has %d identifiers \n"), ent->Count()); |
|
188 CleanupStack::PopAndDestroy(); // ent |
|
189 |
|
190 } |
|
191 // |
|
192 gTest.Printf(_L("Looking for all Wap Ports to Watch\n")); |
|
193 testUtils->WriteComment(_L("Looking for all Wap Ports to Watch\n")); |
|
194 |
|
195 TPtrC desc; |
|
196 TInt pos; |
|
197 ent = bioDB->BioEntryByTypeLC(CBIODatabase::EStart, EBioMsgIdWap, pos); |
|
198 |
|
199 while(pos < bioDB->BIOCount()) |
|
200 { |
|
201 desc.Set(bioDB->BifReader(pos).Description()); |
|
202 gTest.Printf(_L("Desc: %S \n"), &desc); |
|
203 |
|
204 for (TInt i = 0; ent && i < ent->Count(); i++) |
|
205 { |
|
206 if ((*ent)[i].iType == EBioMsgIdWap) |
|
207 { |
|
208 gTest.Printf(_L("Wap Port number %D\n"), (*ent)[i].iPort); |
|
209 (commentText->Des()).Format(_L("%D: '%S' Port#:%D"), i, &desc, (*ent)[i].iPort); |
|
210 testUtils->WriteComment(commentText->Des()); |
|
211 } |
|
212 |
|
213 } |
|
214 if (ent) |
|
215 CleanupStack::PopAndDestroy(); // ent |
|
216 ent = bioDB->BioEntryByTypeLC(CBIODatabase::ENext, EBioMsgIdWap, pos); |
|
217 } |
|
218 |
|
219 if (ent) |
|
220 CleanupStack::PopAndDestroy(); // ent |
|
221 // |
|
222 |
|
223 gTest.Printf(_L("Looking for all NBS Ports to Watch\n")); |
|
224 testUtils->WriteComment(_L("Looking for all NBS Ports to Watch\n")); |
|
225 |
|
226 ent = bioDB->BioEntryByTypeLC(CBIODatabase::EStart, EBioMsgIdNbs, pos); |
|
227 |
|
228 while(pos < bioDB->BIOCount()) |
|
229 { |
|
230 desc.Set(bioDB->BifReader(pos).Description()); |
|
231 gTest.Printf(_L("Desc: %S \n"), &desc); |
|
232 |
|
233 for (TInt i = 0; ent && i < ent->Count(); i++) |
|
234 { |
|
235 if ((*ent)[i].iType == EBioMsgIdNbs) |
|
236 { |
|
237 gTest.Printf(_L("Wap Port number %D\n"), (*ent)[i].iPort); |
|
238 (commentText->Des()).Format(_L("%D: '%S' String:%S"), i, &desc, &((*ent)[i].iText)); |
|
239 testUtils->WriteComment(commentText->Des()); |
|
240 } |
|
241 |
|
242 } |
|
243 if (ent) |
|
244 CleanupStack::PopAndDestroy(); // ent |
|
245 ent = bioDB->BioEntryByTypeLC(CBIODatabase::ENext, EBioMsgIdNbs, pos); |
|
246 } |
|
247 |
|
248 if (ent) |
|
249 CleanupStack::PopAndDestroy(); // ent |
|
250 |
|
251 CleanupStack::PopAndDestroy(); // bioDB |
|
252 CleanupStack::PopAndDestroy(); // commentText |
|
253 |
|
254 // |
|
255 //To improve coverage. |
|
256 |
|
257 CBIODatabase* bioDB1 = CBIODatabase::NewL(gFs); |
|
258 CleanupStack::PushL( bioDB1 ); |
|
259 gTest.Printf(_L("Opened DB1 Successfully!\n")); |
|
260 |
|
261 const CBioInfoFileReader& bifReader1 = bioDB1->BifReader(0); |
|
262 |
|
263 |
|
264 bifReader1.MessageAppCtrlName(); |
|
265 bifReader1.IconsFilename(); |
|
266 // TRAP_IGNORE(bifReader1.ZoomLevelsLC()); // Depricated |
|
267 bifReader1.MessageAppUid(); |
|
268 //bifReader1.MessageAppCtrlUid(); //Depricated |
|
269 bifReader1.GeneralData1(); |
|
270 bifReader1.GeneralData2(); |
|
271 bifReader1.GeneralData3(); |
|
272 bifReader1.ZoomLevelsCount(); |
|
273 bifReader1.BifEntry(); |
|
274 |
|
275 CleanupStack::PopAndDestroy(); // bioDB |
|
276 |
|
277 |
|
278 testUtils->TestFinish( aTestNumber,0 ); |
|
279 } |
|
280 |
|
281 //---------------------------------------------------------------------------------------- |
|
282 LOCAL_C void TestAPIs(TInt aTestNumber) |
|
283 //---------------------------------------------------------------------------------------- |
|
284 { |
|
285 CBIODatabase* bioDB = CBIODatabase::NewL(gFs); |
|
286 CleanupStack::PushL( bioDB ); |
|
287 |
|
288 testUtils->TestStart( aTestNumber, _L("Testing APIs")); |
|
289 |
|
290 testUtils->WriteComment(_L("RemoveBifL")); |
|
291 TUid msgID; |
|
292 TInt error = 0; |
|
293 while (bioDB->BIOCount()) |
|
294 { |
|
295 bioDB->GetBioMsgID(0,msgID); |
|
296 TRAP(error, bioDB->RemoveBifL(msgID)); |
|
297 if (error) |
|
298 testUtils->TestFinish( aTestNumber,error ); |
|
299 break; |
|
300 } |
|
301 CleanupStack::PopAndDestroy(); // bioDB |
|
302 testUtils->TestFinish( aTestNumber,error ); |
|
303 } |
|
304 |
|
305 |
|
306 //---------------------------------------------------------------------------------------- |
|
307 LOCAL_C void DumpWapBifFiles(TInt aTestNumber) |
|
308 //---------------------------------------------------------------------------------------- |
|
309 { |
|
310 // gets a list of port numbers for WAP Port type |
|
311 TInt pos; |
|
312 |
|
313 HBufC* commentText = HBufC::NewLC(100); |
|
314 CBIODatabase* bioDB = CBIODatabase::NewL(gFs); |
|
315 CleanupStack::PushL( bioDB ); |
|
316 |
|
317 gTest.Printf(_L("Dump WAP Bif Files...\n")); |
|
318 testUtils->TestStart( aTestNumber, _L("Dump WAP Bif Files...")); |
|
319 |
|
320 const CArrayFix<TBioMsgId>* bioMsgIDs = bioDB->BioEntryByTypeLC( |
|
321 CBIODatabase::EStart, |
|
322 EBioMsgIdWap, pos); |
|
323 while (bioMsgIDs) |
|
324 { |
|
325 TUid msgUID; |
|
326 bioDB->GetBioMsgID(pos, msgUID); |
|
327 gTest.Printf(_L("Message %D "),msgUID ); |
|
328 |
|
329 TPtrC parserName; |
|
330 parserName.Set(bioDB->GetBioParserNameL(msgUID)); |
|
331 gTest.Printf(_L("Parser %S\n"),&parserName ); |
|
332 |
|
333 TPtrC ext; |
|
334 ext.Set(bioDB->GetFileExtL(msgUID)); |
|
335 gTest.Printf(_L("File Extension '%S'\n"),&ext ); |
|
336 |
|
337 TPtrC desc; |
|
338 desc.Set(bioDB->BifReader(pos).Description()); |
|
339 (commentText->Des()).Format(_L("<%S> BioUID:%D\tParserName:%S\tFileExt:%S"), &desc, msgUID, &parserName, &ext); |
|
340 testUtils->WriteComment(commentText->Des()); |
|
341 |
|
342 for (TInt i = 0; i < bioMsgIDs->Count(); i++) |
|
343 { |
|
344 // Really should make a copy contructor & = operator |
|
345 gTest.Printf(_L("Type\t: %D\n"),bioMsgIDs->At(i).iType ); |
|
346 gTest.Printf(_L("Confidence\t:%D\n"),bioMsgIDs->At(i).iConfidence ); |
|
347 gTest.Printf(_L("IANA\t:%S\n"),&(bioMsgIDs->At(i).iText) ); |
|
348 gTest.Printf(_L("Wap Port\t: %D\n"),bioMsgIDs->At(i).iPort ); |
|
349 gTest.Printf(_L("CharSet\t: %D\n"),bioMsgIDs->At(i).iCharacterSet ); |
|
350 |
|
351 TBuf<100> bearerString; |
|
352 GetBearerText(bioMsgIDs->At(i).iType, bearerString); |
|
353 (commentText->Des()).Format(_L("\tType:%S\tConf:%D\tIANA:%S\tPort:%D\t"), |
|
354 &bearerString, |
|
355 bioMsgIDs->At(i).iConfidence, |
|
356 &(bioMsgIDs->At(i).iText), |
|
357 bioMsgIDs->At(i).iPort); |
|
358 |
|
359 testUtils->WriteComment(commentText->Des()); |
|
360 } |
|
361 CleanupStack::PopAndDestroy(); // bioMsgID |
|
362 |
|
363 bioMsgIDs = bioDB->BioEntryByTypeLC( |
|
364 CBIODatabase::ENext, |
|
365 EBioMsgIdWap, pos); |
|
366 } |
|
367 |
|
368 |
|
369 TInt portNumber = 0; |
|
370 TRAPD(leaveValue, bioDB->GetPortNumberL(KUidBioMsgTypeEmailNotification, |
|
371 EBioMsgIdWap, |
|
372 portNumber)); |
|
373 |
|
374 gTest.Printf(_L("Email Notify is Wap Port %d \n"), portNumber); |
|
375 (commentText->Des()).Format(_L("Email Notify is Wap Port %d"),portNumber); |
|
376 testUtils->WriteComment(commentText->Des()); |
|
377 |
|
378 TBioMsgIdText ianaString; |
|
379 TRAPD(leaveValue2, bioDB->GetIdentifierTextL(KUidBioMsgTypeEmailNotification, |
|
380 EBioMsgIdIana, |
|
381 ianaString)); |
|
382 gTest.Printf(_L("Email Notify is IANA String %S \n"), &ianaString); |
|
383 (commentText->Des()).Format(_L("Email Notify is IANA String %d"), &ianaString); |
|
384 testUtils->WriteComment(commentText->Des()); |
|
385 |
|
386 |
|
387 CleanupStack::PopAndDestroy(); // bioDB |
|
388 CleanupStack::PopAndDestroy(); // commentText |
|
389 |
|
390 testUtils->TestFinish( aTestNumber,0 ); |
|
391 } |
|
392 |
|
393 //---------------------------------------------------------------------------------------- |
|
394 LOCAL_C void CheckBioness(TInt aTestNumber) |
|
395 //---------------------------------------------------------------------------------------- |
|
396 { |
|
397 HBufC* commentText = HBufC::NewLC(100); |
|
398 testUtils->TestStart( aTestNumber, _L("Check Bioness...")); |
|
399 |
|
400 // Check if message is bio |
|
401 CBIODatabase* bioDB = CBIODatabase::NewL(gFs); |
|
402 CleanupStack::PushL( bioDB ); |
|
403 TUid bioMsgId; |
|
404 |
|
405 gTest.Printf(_L("Searching if this data type is a BIO Message\n")); |
|
406 (commentText->Des()).Format(_L("Searching if this data type is a BIO Message")); |
|
407 testUtils->WriteComment(commentText->Des()); |
|
408 |
|
409 TBioMsgId bioMessageData; |
|
410 bioMessageData.iType= KId0Type; |
|
411 bioMessageData.iConfidence= KId0Confidence; |
|
412 bioMessageData.iText= KId0Text; |
|
413 bioMessageData.iPort= KId0Port; |
|
414 bioMessageData.iCharacterSet= KId0CharacterSet; |
|
415 bioMessageData.iGeneralIdData= KId0GeneralIdData; |
|
416 if (bioDB->IsBioMessageL(bioMessageData, bioMsgId)) |
|
417 { |
|
418 gTest.Printf(_L("This is a BIO Message\n")); |
|
419 } |
|
420 else |
|
421 { |
|
422 gTest.Printf(_L("This is not a BIO Message\n")); |
|
423 } |
|
424 |
|
425 bioMessageData.iType= KId3Type; |
|
426 bioMessageData.iConfidence= KId3Confidence; |
|
427 bioMessageData.iText= KId3Text; |
|
428 bioMessageData.iPort= KId3Port; |
|
429 bioMessageData.iCharacterSet= KId3CharacterSet; |
|
430 bioMessageData.iGeneralIdData= KId3GeneralIdData; |
|
431 |
|
432 if (bioDB->IsBioMessageL(bioMessageData, bioMsgId)) |
|
433 { |
|
434 gTest.Printf(_L("This is a BIO Message\n")); |
|
435 } |
|
436 else |
|
437 { |
|
438 gTest.Printf(_L("This is not a BIO Message\n")); |
|
439 } |
|
440 |
|
441 bioMessageData.iText= _L("text/X-vCard"); |
|
442 if (bioDB->IsBioMessageL(bioMessageData, bioMsgId)) |
|
443 { |
|
444 gTest.Printf(_L("This is a BIO Message\n")); |
|
445 } |
|
446 else |
|
447 { |
|
448 gTest.Printf(_L("This is not a BIO Message\n")); |
|
449 } |
|
450 |
|
451 |
|
452 bioMessageData.iType = KId1Type; |
|
453 |
|
454 bioDB->IsBioMessageL(bioMessageData, bioMsgId); |
|
455 if (bioMsgId != KNullUid) |
|
456 gTest.Printf(_L("This is a BIO Message\n")); |
|
457 else |
|
458 gTest.Printf(_L("This is not a BIO Message\n")); |
|
459 |
|
460 TBioMsgIdText text = _L("//MLAP11"); |
|
461 _LIT(KIsBioFormat, "%S is a BIO Message with Uid: %D\n"); |
|
462 _LIT(KIsNotBioFormat, "%S is NOT a BIO Message\n"); |
|
463 |
|
464 bioDB->IsBioMessageL(EBioMsgIdNbs, text, 0, bioMsgId); |
|
465 if (bioMsgId != KNullUid) |
|
466 gTest.Printf(KIsBioFormat, &text, bioMsgId); |
|
467 else |
|
468 gTest.Printf(KIsNotBioFormat, &text); |
|
469 |
|
470 text = _L("Some Bogus Text"); |
|
471 bioDB->IsBioMessageL(EBioMsgIdWapSecure, text, 9, bioMsgId); |
|
472 if (bioMsgId != KNullUid) |
|
473 gTest.Printf(KIsBioFormat, &text, bioMsgId ); |
|
474 else |
|
475 gTest.Printf(KIsNotBioFormat, &text); |
|
476 |
|
477 TBuf<KMaxBioIdText*2> testBuf; |
|
478 testBuf.Fill('a', KMaxBioIdText*2); |
|
479 bioDB->IsBioMessageL(EBioMsgIdWapSecure, testBuf, 9, bioMsgId); |
|
480 if (bioMsgId != KNullUid) |
|
481 gTest.Printf(KIsBioFormat, &text, bioMsgId ); |
|
482 else |
|
483 gTest.Printf(KIsNotBioFormat, &text); |
|
484 |
|
485 CleanupStack::PopAndDestroy(); // bioDB |
|
486 CleanupStack::PopAndDestroy(); // commentText |
|
487 testUtils->TestFinish( aTestNumber,0 ); |
|
488 } |
|
489 |
|
490 //---------------------------------------------------------------------------------------- |
|
491 LOCAL_C void DefaultSendBearer(TInt aTestNumber) |
|
492 //---------------------------------------------------------------------------------------- |
|
493 { |
|
494 HBufC* commentText = HBufC::NewLC(100); |
|
495 TBuf<100> bearerString; |
|
496 testUtils->TestStart( aTestNumber, _L("DefaultSendBearer...")); |
|
497 |
|
498 // Check if message is bio |
|
499 CBIODatabase* bioDB = CBIODatabase::NewL(gFs); |
|
500 CleanupStack::PushL( bioDB ); |
|
501 |
|
502 gTest.Printf(_L("Getting Default Send Bearer info\n")); |
|
503 |
|
504 TBioMsgId aBioMsgIdentifier; |
|
505 TRAPD(err, bioDB->GetDefaultSendBearerL(KUidBioMsgTypeEmailNotification, aBioMsgIdentifier)); |
|
506 if (!err) |
|
507 { |
|
508 GetBearerText(aBioMsgIdentifier.iType, bearerString); |
|
509 (commentText->Des()).Format(_L("Default Send Bearer for EmailNotifciation: %S"),&bearerString); |
|
510 gTest.Printf(_L("Default Send Bearer for EmailNotifciation %d \n"), aBioMsgIdentifier.iType); |
|
511 } |
|
512 else if (err == KErrNotFound) |
|
513 { |
|
514 gTest.Printf(_L("Default Send Bearer for EmailNotifciation cannot be found \n")); |
|
515 (commentText->Des()).Format(_L("Default Send Bearer for EmailNotifciation cannot be found")); |
|
516 } |
|
517 else |
|
518 { |
|
519 gTest.Printf(_L("Unexepect Error %d"), err); |
|
520 (commentText->Des()).Format(_L("Unexepect Error %d"), err); |
|
521 } |
|
522 |
|
523 testUtils->WriteComment(commentText->Des()); |
|
524 |
|
525 TBioMsgIdType aPortType = EBioMsgIdWap; |
|
526 TRAP( err, bioDB->GetDefaultSendBearerTypeL(KUidBioMsgTypeVCal, aPortType)); |
|
527 if (!err) |
|
528 { |
|
529 gTest.Printf(_L("Default Send Bearer for KUidBioMsgTypeVCal %d \n"), aPortType); |
|
530 GetBearerText(aPortType, bearerString); |
|
531 (commentText->Des()).Format(_L("Default Send Bearer for vCalendar %S"),&bearerString); |
|
532 } |
|
533 else if (err == KErrNotFound) |
|
534 { |
|
535 gTest.Printf(_L("Default Send Bearer for KUidBioMsgTypeVCal cannot be found\n")); |
|
536 (commentText->Des()).Format(_L("Default Send Bearer for KUidBioMsgTypeVCal cannot be found")); |
|
537 } |
|
538 else |
|
539 { |
|
540 gTest.Printf(_L("Unexepect Error %d"), err); |
|
541 (commentText->Des()).Format(_L("Unexepect Error %d"), err); |
|
542 } |
|
543 testUtils->WriteComment(commentText->Des()); |
|
544 |
|
545 |
|
546 TRAP(err, bioDB->GetDefaultSendBearerByTypeL(KUidBioMsgTypeEmailNotification, EBioMsgIdWapSecure, aBioMsgIdentifier)); |
|
547 if (!err) |
|
548 { |
|
549 gTest.Printf(_L(" Send Bearer for KUidBioMsgTypeVCard, WAPSecure: Port %d \n"), aBioMsgIdentifier.iPort); |
|
550 (commentText->Des()).Format(_L("Secure WAP Bearer for vCalendar %d"),aBioMsgIdentifier.iPort); |
|
551 |
|
552 } |
|
553 else if (err == KErrNotFound) |
|
554 { |
|
555 gTest.Printf(_L("Default Send Bearer for KUidBioMsgTypeVCard cannot be found \n")); |
|
556 } |
|
557 else |
|
558 { |
|
559 gTest.Printf(_L("Unexepect Error %d"), err); |
|
560 (commentText->Des()).Format(_L("Unexepect Error %d"), err); |
|
561 } |
|
562 |
|
563 testUtils->WriteComment(commentText->Des()); |
|
564 |
|
565 TInt tt = 1; |
|
566 TUid uidId = TUid::Uid(10); |
|
567 bioDB->GetBioControlName(tt); |
|
568 |
|
569 CleanupStack::PopAndDestroy(); // bioDB |
|
570 CleanupStack::PopAndDestroy(); // commentText |
|
571 testUtils->TestFinish( aTestNumber,0 ); |
|
572 } |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 //---------------------------------------------------------------------------------------- |
|
578 LOCAL_C void doMainL() |
|
579 //---------------------------------------------------------------------------------------- |
|
580 { |
|
581 TInt testNumber = 1; |
|
582 |
|
583 OpenFileSession(); |
|
584 InitTestUtils(); |
|
585 |
|
586 __UHEAP_MARK; |
|
587 DumpBifFiles(testNumber++); |
|
588 //gTest.Printf(_L("Hit a key to continue...")); |
|
589 //gTest.Getch(); |
|
590 |
|
591 TestAPIs(testNumber++); |
|
592 //gTest.Printf(_L("Hit a key to continue...")); |
|
593 //gTest.Getch(); |
|
594 |
|
595 DumpWapBifFiles(testNumber++); |
|
596 //gTest.Printf(_L("Hit a key to continue...")); |
|
597 //gTest.Getch(); |
|
598 |
|
599 CheckBioness(testNumber++); |
|
600 //gTest.Printf(_L("Hit a key to continue...")); |
|
601 //gTest.Getch(); |
|
602 |
|
603 DefaultSendBearer(testNumber++); |
|
604 //gTest.Printf(_L("Hit a key to continue...")); |
|
605 //gTest.Getch(); |
|
606 |
|
607 __UHEAP_MARKEND; |
|
608 CloseFileSession(); |
|
609 CloseTestUtils(); |
|
610 } |
|
611 |
|
612 |
|
613 |
|
614 GLDEF_C TInt E32Main() |
|
615 { |
|
616 __UHEAP_MARK; |
|
617 CTrapCleanup* theCleanup = CTrapCleanup::New(); |
|
618 TRAPD(ret,doMainL()); |
|
619 gTest(ret==KErrNone); |
|
620 delete theCleanup; |
|
621 __UHEAP_MARKEND; |
|
622 return(KErrNone); |
|
623 } |