|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <e32std.h> |
|
17 #include <e32test.h> |
|
18 #include <msvstd.h> |
|
19 #include <msvids.h> |
|
20 #include <msvuids.h> |
|
21 #include <pushentry.h> |
|
22 #include <push/pushlog.h> |
|
23 #include <push/cwappushmsgutils.h> |
|
24 #include "testlog.h" |
|
25 #include "t_serviceutils.h" |
|
26 #include "t_pushentry.h" |
|
27 |
|
28 |
|
29 _LIT(KPushEntryTestTitle,"T_PushEntry"); |
|
30 _LIT(KFilename,"picture.jpg"); |
|
31 _LIT(KFilename2,"image.gif"); |
|
32 |
|
33 // Uncomment the following define to switch on Heap Failure Testing |
|
34 // #define __HEAP_FAILURE_TESTING |
|
35 |
|
36 |
|
37 |
|
38 // Global variables |
|
39 RTest gTest(_L("t_PushMessage Test Harness")); |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 /** Active scheduler defined for this testcode to catch error */ |
|
47 void CTestScheduler::Error(TInt aError) const |
|
48 { |
|
49 CActiveScheduler::Stop(); |
|
50 gTest.Printf(_L("\nLeave signalled, reason=%d\n"),aError); |
|
51 } |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 CMessageDetails* CMessageDetails::NewL() |
|
58 { |
|
59 CMessageDetails* self = new (ELeave) CMessageDetails(); |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop(); |
|
63 return self; |
|
64 } |
|
65 |
|
66 void CMessageDetails::ConstructL() |
|
67 { |
|
68 iPushMsgType =0; //Uid of message type goes in iBioType |
|
69 iStatusFlag = 0; |
|
70 iActionFlag =0; |
|
71 iSiId = HBufC::NewL(100); |
|
72 iCreated = Time::NullTTime(); //.DateTime(); |
|
73 iExpires = Time::NullTTime(); |
|
74 iURL = HBufC::NewL(100); |
|
75 iText = HBufC::NewL(100); |
|
76 iFrom = HBufC8::NewL(100); |
|
77 iHeader = HBufC8::NewL(100); |
|
78 iContentType=HBufC::NewL(100); |
|
79 iMessageBody =HBufC8::NewL(300); |
|
80 iMsgDetails =HBufC::NewL(300); |
|
81 iMsgDescription =HBufC::NewL(300); |
|
82 iFilename = HBufC::NewL(100); |
|
83 } |
|
84 |
|
85 CMessageDetails::CMessageDetails() |
|
86 { |
|
87 } |
|
88 |
|
89 CMessageDetails::~CMessageDetails() |
|
90 { |
|
91 delete iSiId; |
|
92 delete iURL; |
|
93 delete iText; |
|
94 delete iFrom; |
|
95 delete iHeader; |
|
96 delete iContentType; |
|
97 delete iMessageBody; |
|
98 delete iMsgDetails; |
|
99 delete iMsgDescription; |
|
100 delete iFilename; |
|
101 } |
|
102 |
|
103 void CMessageDetails::ResetL() |
|
104 { |
|
105 iPushMsgType =0; //Uid of message type goes in iBioType |
|
106 iStatusFlag = 0; |
|
107 iActionFlag =0; |
|
108 delete iSiId; |
|
109 iSiId = NULL; |
|
110 iSiId = HBufC::NewL(100); |
|
111 |
|
112 iCreated= Time::NullTTime(); |
|
113 iExpires = Time::NullTTime(); |
|
114 |
|
115 delete iURL; |
|
116 iURL =NULL; |
|
117 iURL = HBufC::NewL(100); |
|
118 |
|
119 delete iText; |
|
120 iText = NULL; |
|
121 iText = HBufC::NewL(100); |
|
122 |
|
123 delete iFrom; |
|
124 iFrom = NULL; |
|
125 iFrom = HBufC8::NewL(100); |
|
126 |
|
127 delete iHeader; |
|
128 iHeader = NULL; |
|
129 iHeader = HBufC8::NewL(100); |
|
130 |
|
131 delete iContentType; |
|
132 iContentType =NULL; |
|
133 iContentType = HBufC::NewL(100); |
|
134 |
|
135 delete iMessageBody; |
|
136 iMessageBody=NULL; |
|
137 iMessageBody = HBufC8::NewL(300); |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 // Test Harness - Active Object with a lot of states. Tests Get/Set, Save/Retrieve & Update, |
|
143 // for Push Entries. Also tests the Message Utilities. Use both together during the operations. |
|
144 CPushEntryTester* CPushEntryTester::NewL(MWapPushLog& aLog) |
|
145 { |
|
146 CPushEntryTester* self = new (ELeave) CPushEntryTester(aLog); |
|
147 CleanupStack::PushL(self); |
|
148 self->ConstructL(); |
|
149 CleanupStack::Pop(); |
|
150 return self; |
|
151 } |
|
152 |
|
153 void CPushEntryTester::ConstructL() |
|
154 { |
|
155 __LOG_ALWAYS("Test Results"); |
|
156 __LOG_ALWAYS(" "); |
|
157 |
|
158 iPushUtilities = CWapPushMsgUtils::NewL(); |
|
159 iSISLPushUtilities = CSISLPushMsgUtils::NewL(); |
|
160 iDetails = CMessageDetails::NewL(); |
|
161 iMsvEntry = iPushUtilities->Session().GetEntryL(KMsvRootIndexEntryId); |
|
162 CActiveScheduler::Add(this); |
|
163 } |
|
164 |
|
165 |
|
166 CPushEntryTester::CPushEntryTester(MWapPushLog& aLog) |
|
167 :CActive(CActive::EPriorityIdle), iLog(aLog) |
|
168 { |
|
169 } |
|
170 |
|
171 |
|
172 CPushEntryTester::~CPushEntryTester() |
|
173 { |
|
174 Cancel(); |
|
175 delete iMsvEntry; |
|
176 delete iDetails; |
|
177 delete iPushEntry; |
|
178 delete iPushUtilities; |
|
179 delete iSISLPushUtilities; |
|
180 } |
|
181 |
|
182 void CPushEntryTester::LogFormatInt(const TDesC& aFormat, TInt aInt) |
|
183 { |
|
184 iFormatBuffer.Format(aFormat, aInt); |
|
185 iLog.WPLPrintf(iFormatBuffer); |
|
186 } |
|
187 |
|
188 void CPushEntryTester::LogFormatInt(const TDesC& aFormat, TInt aInt1, TInt aInt2) |
|
189 { |
|
190 iFormatBuffer.Format(aFormat, aInt1, aInt2); |
|
191 iLog.WPLPrintf(iFormatBuffer); |
|
192 } |
|
193 |
|
194 void CPushEntryTester::LogFormatStr(const TDesC& aFormat, const TDesC& aDes) |
|
195 { |
|
196 iFormatBuffer.Format(aFormat, &aDes); |
|
197 iLog.WPLPrintf(iFormatBuffer); |
|
198 } |
|
199 |
|
200 void CPushEntryTester::LogStr(const TDesC& aDes) |
|
201 { |
|
202 iLog.WPLPrintf(aDes); |
|
203 } |
|
204 |
|
205 |
|
206 |
|
207 void CPushEntryTester::RunL() |
|
208 { |
|
209 switch(iState) |
|
210 { |
|
211 case ETestInitialising: |
|
212 __LOG_ALWAYS("========= TEST - SI GET/SET WITH PARAMETERS ========="); |
|
213 CreateMsgDetailsL(EFalse); |
|
214 SiGetSetTestL(); |
|
215 iState =ETestSIGetSet;// Test the setters getters with Non Null fields |
|
216 QueueOperationAsync(KErrNone); |
|
217 break; |
|
218 case ETestSIGetSet: |
|
219 __LOG_ALWAYS("========= TEST - SI SAVE/RETRIEVE WITH PARAMETERS ========="); |
|
220 SiSaveRetrieveTestL(); |
|
221 iState = ETestSISaveRetrieveWithStringAppID;//Test Save Retrieve with Non Null fields |
|
222 QueueOperationAsync(KErrNone); |
|
223 break; |
|
224 |
|
225 case ETestSISaveRetrieveWithStringAppID: |
|
226 __LOG_ALWAYS("========= TEST - SI SAVE/RETRIEVE WITH PARAMETERS AND STRING APPID ========="); |
|
227 SiSaveRetrieveTestL(); |
|
228 iState = ETestSISaveRetrieveWithIntAppID; |
|
229 QueueOperationAsync(KErrNone); |
|
230 break; |
|
231 |
|
232 case ETestSISaveRetrieveWithIntAppID: |
|
233 __LOG_ALWAYS("========= TEST - SI SAVE/RETRIEVE WITH PARAMETERS AND INT APPID ========="); |
|
234 iState = ETestSISaveRetrieve; |
|
235 SiSaveRetrieveTestL(); |
|
236 QueueOperationAsync(KErrNone); |
|
237 break; |
|
238 |
|
239 case ETestSISaveRetrieve: |
|
240 __LOG_ALWAYS("========= TEST - SI GET/SET WITH NULL FIELDS ========="); |
|
241 CreateMsgDetailsL(ETrue); |
|
242 SiGetSetTestL(); |
|
243 iState = ETestSIGetSetNull;// Test the setters getters with Null fields |
|
244 QueueOperationAsync(KErrNone); |
|
245 break; |
|
246 |
|
247 case ETestSIGetSetNull: |
|
248 iState = ETestSISaveRetrieveNull; //Test Save/Retrieve with Empty fields |
|
249 __LOG_ALWAYS("========= TEST - SI SAVE/RETRIEVE WITH NULL FIELDS ========="); |
|
250 SiSaveRetrieveTestL(); |
|
251 QueueOperationAsync(KErrNone); |
|
252 break; |
|
253 |
|
254 case ETestSISaveRetrieveNull: |
|
255 __LOG_ALWAYS("========= TEST - UPDATING A EXISTING SI MESSAGE ========="); |
|
256 iState = ETestSIChangeEntry; |
|
257 ChangeSIEntryTestL(); |
|
258 QueueOperationAsync(KErrNone); |
|
259 break; |
|
260 |
|
261 case ETestSIChangeEntry: |
|
262 __LOG_ALWAYS("========= TEST - SL GET/SET WITH PARAMETERS ========="); |
|
263 iState = ETestSLGetSet;//Test SL Set/Get functions with Empty fields |
|
264 CreateMsgDetailsL(EFalse); |
|
265 SlGetSetTestL(); |
|
266 QueueOperationAsync(KErrNone); |
|
267 break; |
|
268 |
|
269 case ETestSLGetSet: |
|
270 iState = ETestSLSaveRetrieve; |
|
271 __LOG_ALWAYS("========= TEST - SL SAVE/RETRIEVE WITH PARAMETERS ========="); |
|
272 SlSaveRetrieveTestL(); |
|
273 QueueOperationAsync(KErrNone); |
|
274 break; |
|
275 |
|
276 case ETestSLSaveRetrieve: |
|
277 __LOG_ALWAYS("========= TEST - SL GET/SET WITH EMPTY FIELDS ========="); |
|
278 iState = ETestSLGetSetNull;//Test SL Set/Get functions with Empty fields |
|
279 CreateMsgDetailsL(ETrue); |
|
280 SlGetSetTestL(); |
|
281 QueueOperationAsync(KErrNone); |
|
282 break; |
|
283 |
|
284 case ETestSLGetSetNull: |
|
285 __LOG_ALWAYS("========= TEST - SL SAVE/RETRIEVE WITH EMPTY FIELDS ========="); |
|
286 iState = ETestSLSaveRetrieveNull; |
|
287 SlSaveRetrieveTestL(); |
|
288 QueueOperationAsync(KErrNone); |
|
289 break; |
|
290 |
|
291 case ETestSLSaveRetrieveNull: |
|
292 __LOG_ALWAYS("========= TEST - UPDATING A EXISTING SL MESSAGE ========="); |
|
293 iState = ETestSLChangeEntry; |
|
294 ChangeSLEntryTestL(); |
|
295 QueueOperationAsync(KErrNone); |
|
296 break; |
|
297 |
|
298 case ETestSLChangeEntry: |
|
299 __LOG_ALWAYS("========= TEST - MULTI GET/SET WITH PARAMETERS ========="); |
|
300 iState = ETestMultiGetSet; |
|
301 CreateMsgDetailsL(EFalse); |
|
302 MultiGetSetTestL(); |
|
303 QueueOperationAsync(KErrNone); |
|
304 break; |
|
305 |
|
306 case ETestMultiGetSet: |
|
307 __LOG_ALWAYS("========= TEST - MULTI SAVE/RETRIEVE WITH PARAMETERS ========="); |
|
308 iState = ETestMultiSaveRetrieve; |
|
309 MultiSaveRetrieveTestL(); |
|
310 QueueOperationAsync(KErrNone); |
|
311 break; |
|
312 |
|
313 case ETestMultiSaveRetrieve: |
|
314 __LOG_ALWAYS("========= TEST - MULTI SET/GET WITH EMPTY FIELDS ========="); |
|
315 iState = ETestMultiGetSetNull; |
|
316 CreateMsgDetailsL(ETrue); |
|
317 MultiGetSetTestL(); |
|
318 QueueOperationAsync(KErrNone); |
|
319 break; |
|
320 |
|
321 case ETestMultiGetSetNull: |
|
322 __LOG_ALWAYS("========= TEST - MULTI SAVE/RETRIEVE WITH EMPTY FIELDS ========="); |
|
323 iState = ETestMultiSaveRetrieveNull; |
|
324 MultiSaveRetrieveTestL(); |
|
325 QueueOperationAsync(KErrNone); |
|
326 break; |
|
327 |
|
328 case ETestMultiSaveRetrieveNull: |
|
329 __LOG_ALWAYS("========= TEST - UNKNOWN GET/SET WITH PARAMETERS ========="); |
|
330 iState = ETestUnknownGetSet; |
|
331 CreateMsgDetailsL(EFalse); |
|
332 UnknownGetSetTestL(); |
|
333 QueueOperationAsync(KErrNone); |
|
334 break; |
|
335 |
|
336 case ETestUnknownGetSet: |
|
337 __LOG_ALWAYS("========= TEST - UNKNOWN SAVE/RETRIEVE WITH PARAMETERS =========="); |
|
338 iState = ETestUnknownSaveRetrieve; |
|
339 UnknownSaveRetrieveTestL(EFalse); |
|
340 QueueOperationAsync(KErrNone); |
|
341 break; |
|
342 |
|
343 case ETestUnknownSaveRetrieve: |
|
344 __LOG_ALWAYS("========= TEST - UNKNOWN SAVE/RETRIEVE WITH PARAMETERS AND FILENAME ========="); |
|
345 iState = ETestUnknownSaveRetrieveWithFilename; |
|
346 UnknownSaveRetrieveTestL(ETrue); |
|
347 QueueOperationAsync(KErrNone); |
|
348 break; |
|
349 |
|
350 case ETestUnknownSaveRetrieveWithFilename: |
|
351 __LOG_ALWAYS("========= TEST - UNKNOWN GET/SET WITH EMPTY FIELDS ========="); |
|
352 iState = ETestUnknownGetSetNull; |
|
353 CreateMsgDetailsL(ETrue); |
|
354 UnknownGetSetTestL(); |
|
355 QueueOperationAsync(KErrNone); |
|
356 break; |
|
357 |
|
358 case ETestUnknownGetSetNull: |
|
359 __LOG_ALWAYS("========= TEST - UNKNOWN SAVE/RETRIEVE WITH EMPTY FIELDS ========="); |
|
360 iState = ETestUnknownSaveRetrieveNull; |
|
361 UnknownSaveRetrieveTestL(EFalse); |
|
362 QueueOperationAsync(KErrNone); |
|
363 break; |
|
364 |
|
365 case ETestUnknownSaveRetrieveNull: |
|
366 __LOG_ALWAYS("========= TEST - UNKNOWN SAVE/RETRIEVE WITH EMPTY FIELDS AND FILENAME ========="); |
|
367 iState = ETestUnknownSaveRetrieveNullWithFilename; |
|
368 UnknownSaveRetrieveTestL(ETrue); |
|
369 QueueOperationAsync(KErrNone); |
|
370 break; |
|
371 |
|
372 case ETestUnknownSaveRetrieveNullWithFilename: // Test updating an Unknown Msg |
|
373 __LOG_ALWAYS("========= TEST - UPDATING A EXISTING UNKNOWN MESSAGE ========="); |
|
374 iState = ETestUnknownChangeEntry; |
|
375 ChangeUnknownEntryTestL(EFalse); |
|
376 QueueOperationAsync(KErrNone); |
|
377 break; |
|
378 |
|
379 case ETestUnknownChangeEntry: // Test updating an Unknown Msg with filename |
|
380 __LOG_ALWAYS("========= TEST - UPDATING A EXISTING UNKNOWN MESSAGE WITH FILENAME ========="); |
|
381 iState = ETestUnknownChangeEntryWithFilename; |
|
382 ChangeUnknownEntryTestL(ETrue); |
|
383 QueueOperationAsync(KErrNone); |
|
384 break; |
|
385 |
|
386 |
|
387 case ETestUnknownChangeEntryWithFilename: |
|
388 __LOG_ALWAYS("========= TEST - SI FIND BY AN ID ========="); |
|
389 iState = ETestSIFindSiId; |
|
390 CreateMoreSiMessagesL(); |
|
391 FindSiIdTestL(EFalse); // Not looking for a null ID string |
|
392 QueueOperationAsync(KErrNone); |
|
393 break; |
|
394 |
|
395 case ETestSIFindSiId: |
|
396 iState = ETestSIFindSiIdNull; //Test Find Function with Empty fields |
|
397 __LOG_ALWAYS("========= TEST - SI FIND A NULL ID ========="); |
|
398 FindSiIdTestL(ETrue); // Looking for a null ID string |
|
399 QueueOperationAsync(KErrNone); |
|
400 break; |
|
401 |
|
402 case ETestSIFindSiIdNull: |
|
403 iState = ETestSIFindSiUrl; //Test Find with Non Null URL field |
|
404 __LOG_ALWAYS("========= TEST - SI FIND A URL ========="); |
|
405 FindUrlTestL(EFalse, KUidWapPushMsgSI); |
|
406 QueueOperationAsync(KErrNone); |
|
407 break; |
|
408 |
|
409 case ETestSIFindSiUrl: |
|
410 iState = ETestSIFindSiUrlNull; //Test Find with a Null URL field |
|
411 __LOG_ALWAYS("========= TEST - SI FIND A NULL URL ========="); |
|
412 FindUrlTestL(ETrue, KUidWapPushMsgSI); |
|
413 QueueOperationAsync(KErrNone); |
|
414 break; |
|
415 |
|
416 case ETestSIFindSiUrlNull: |
|
417 __LOG_ALWAYS("========= TEST - SL FIND A URL ========="); |
|
418 iState = ETestSLFindUrl; |
|
419 CreateMoreSLMessagesL(); |
|
420 FindUrlTestL(EFalse, KUidWapPushMsgSL); |
|
421 QueueOperationAsync(KErrNone); |
|
422 break; |
|
423 |
|
424 case ETestSLFindUrl : |
|
425 __LOG_ALWAYS("========= TEST - SL FIND NULL URL ========="); |
|
426 iState = ETestSLFindUrlNull; |
|
427 FindUrlTestL(ETrue , KUidWapPushMsgSL); |
|
428 QueueOperationAsync(KErrNone); |
|
429 break; |
|
430 |
|
431 case ETestSLFindUrlNull: |
|
432 __LOG_ALWAYS("========= TEST - GET HIGHEST SI ACTION ========="); |
|
433 iState = ETestSIGetHiAction; |
|
434 GetActionTestL(KUidWapPushMsgSI); |
|
435 QueueOperationAsync(KErrNone); |
|
436 break; |
|
437 |
|
438 |
|
439 case ETestSIGetHiAction: |
|
440 __LOG_ALWAYS("========= TEST - GET HIGHEST SL ACTION ========="); |
|
441 iState = ETestSLGetHiAction ; |
|
442 GetActionTestL(KUidWapPushMsgSL); |
|
443 QueueOperationAsync(KErrNone); |
|
444 break; |
|
445 |
|
446 |
|
447 case ETestSLGetHiAction: |
|
448 iState = ETestGetExpiry; |
|
449 __LOG_ALWAYS("========= TEST - GET EARLIEST SI EXPIRY ========="); |
|
450 //DumpPushMessageDetailsL(KUidWapPushMsgSI); |
|
451 //DumpPushMessageDetailsL(KUidWapPushMsgSL); |
|
452 //DumpPushMessageDetailsL(KUidWapPushMsgMultiPart); |
|
453 //DumpPushMessageDetailsL(KUidWapPushMsgUnknown); |
|
454 GetExpiryTestL(); |
|
455 QueueOperationAsync(KErrNone); |
|
456 break; |
|
457 |
|
458 case ETestGetExpiry: |
|
459 iState = ETestGetNextExpiry; |
|
460 __LOG_ALWAYS("========= TEST - GET NEXT SI EXPIRY ========="); |
|
461 DeleteEarliestExpiryL(); |
|
462 GetExpiryTestL(); |
|
463 QueueOperationAsync(KErrNone); |
|
464 break; |
|
465 |
|
466 case ETestGetNextExpiry: |
|
467 iState = ETestComplete; |
|
468 if (!iFailures) |
|
469 { |
|
470 __LOG_ALWAYS(" "); |
|
471 __LOG_ALWAYS("Tests Completed"); |
|
472 } |
|
473 else |
|
474 { |
|
475 LogFormatInt(_L("========= TESTS FAILED !! TOTAL OF %d UNSUCESSFUL ========="), iFailures); |
|
476 } |
|
477 QueueOperationAsync(KErrNone); |
|
478 break; |
|
479 |
|
480 case ETestComplete: //finished |
|
481 User::After(10000); |
|
482 Cancel(); |
|
483 CActiveScheduler::Stop(); |
|
484 break; |
|
485 default: |
|
486 break; |
|
487 } |
|
488 User::After(500); |
|
489 } |
|
490 |
|
491 |
|
492 void CPushEntryTester::QueueOperationAsync(TInt aErr) |
|
493 { |
|
494 TRequestStatus* pS = &iStatus; |
|
495 iStatus = KRequestPending; |
|
496 User::RequestComplete(pS, aErr); |
|
497 SetActive(); |
|
498 } |
|
499 |
|
500 void CPushEntryTester::DoCancel() |
|
501 { |
|
502 } |
|
503 |
|
504 void CPushEntryTester::StartL() |
|
505 { |
|
506 iFailures = 0; |
|
507 CreateHeaders(); |
|
508 iState = ETestInitialising; |
|
509 QueueOperationAsync(KErrNone); |
|
510 } |
|
511 |
|
512 // Halt the Scheduler & inform the user |
|
513 TInt CPushEntryTester::RunError(TInt aError) |
|
514 { |
|
515 if (aError != KErrNone) |
|
516 { |
|
517 LogFormatInt(_L("Error %d occurred"), aError); |
|
518 __LOG_DEBUG("Tests Failed!"); |
|
519 iFailures++; |
|
520 CActiveScheduler::Stop(); |
|
521 } |
|
522 return KErrNone; |
|
523 } |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 // Tests use of get/set methods on a CSIPushMsgEntry |
|
529 // Create new entry,set values on TMsvEntry,set Push Entry, display & set new values |
|
530 void CPushEntryTester::SiGetSetTestL() |
|
531 { |
|
532 __LOG_ALWAYS("***** TESTING SI SETTER FUNCTIONS *****"); |
|
533 |
|
534 CSIPushMsgEntry* siEntry = NULL; |
|
535 |
|
536 #if defined (__HEAP_FAILURE_TESTING) |
|
537 TInt error; |
|
538 TBool finished = EFalse; |
|
539 TInt failCount = 0; |
|
540 |
|
541 while(!finished) |
|
542 { |
|
543 __UHEAP_FAILNEXT(failCount++); |
|
544 TRAP(error,siEntry = DoSiCreateTestL()); |
|
545 if (error == KErrNone) |
|
546 { |
|
547 __UHEAP_RESET; |
|
548 LogFormatInt(_L("Made %d attempts at calling DoSiCreateTestL()"), failCount); |
|
549 finished = ETrue; |
|
550 } |
|
551 else // Handle error |
|
552 { |
|
553 // Check if error is out of memory |
|
554 gTest(error == KErrNoMemory); |
|
555 __UHEAP_RESET; |
|
556 } |
|
557 } |
|
558 #else |
|
559 siEntry = DoSiCreateTestL(); |
|
560 #endif |
|
561 CleanupStack::PushL(siEntry); |
|
562 OutputMessageDetailsL(*siEntry); // Tests our get functions - don't allocate memory |
|
563 |
|
564 |
|
565 #if defined (__HEAP_FAILURE_TESTING) |
|
566 error = KErrNone; |
|
567 finished = EFalse; |
|
568 failCount = 0; |
|
569 |
|
570 while(!finished) |
|
571 { |
|
572 __UHEAP_FAILNEXT(failCount++); |
|
573 TRAP(error,DoSiSetTestL(*siEntry)); |
|
574 if (error == KErrNone) |
|
575 { |
|
576 __UHEAP_RESET; |
|
577 LogFormatInt(_L("Made %d attempts at calling DoSiSetTestL()"), failCount); |
|
578 finished = ETrue; |
|
579 } |
|
580 |
|
581 else // Handle error |
|
582 { |
|
583 // Check if error is out of memory |
|
584 gTest(error == KErrNoMemory); |
|
585 __UHEAP_RESET; |
|
586 } |
|
587 } |
|
588 #else |
|
589 DoSiSetTestL(*siEntry); |
|
590 #endif |
|
591 |
|
592 OutputMessageDetailsL(*siEntry); |
|
593 CleanupStack::PopAndDestroy(); |
|
594 __LOG_ALWAYS("***** SI SET/GET - TEST SUCCESSFUL ******"); |
|
595 } |
|
596 |
|
597 CSIPushMsgEntry* CPushEntryTester::DoSiCreateTestL() |
|
598 { |
|
599 TPtrC ptr; |
|
600 TMsvEntry entry; |
|
601 |
|
602 entry.iServiceId = 0x0001234; |
|
603 entry.iMtm.iUid = 0x0012345; // dummy value to check default gets set automatically! |
|
604 entry.iBioType = 0x0054321; // ditto |
|
605 entry.iType = KUidMsvMessageEntry; |
|
606 entry.SetMtmData1(0x01FF); |
|
607 ptr.Set(_L("123456@somewhere.com")); |
|
608 |
|
609 CSIPushMsgEntry* siEntry = CSIPushMsgEntry::NewL(); |
|
610 CleanupStack::PushL(siEntry); |
|
611 siEntry->SetEntry(entry); |
|
612 |
|
613 siEntry->SetExpires( TTime(_L("20020000:120000.0000")) ); |
|
614 siEntry->SetHeaderL(iDummyHeader2); |
|
615 siEntry->SetTextL(KUrl2); |
|
616 |
|
617 |
|
618 siEntry->SetMsgDescriptionL(ptr); |
|
619 siEntry->SetMsgDetailsL(_L("http;//www.garbage.com")); |
|
620 |
|
621 CleanupStack::Pop(); |
|
622 return siEntry; |
|
623 } |
|
624 |
|
625 void CPushEntryTester::DoSiSetTestL(CSIPushMsgEntry& aSiEntry) |
|
626 { |
|
627 aSiEntry.SetAction(iDetails->iActionFlag); |
|
628 aSiEntry.SetCreated( iDetails->iCreated ); |
|
629 aSiEntry.SetExpires( iDetails->iExpires); |
|
630 aSiEntry.SetFromL(*iDetails->iFrom); |
|
631 aSiEntry.SetHeaderL(*iDetails->iHeader); |
|
632 aSiEntry.SetIdL(*iDetails->iSiId); |
|
633 aSiEntry.SetStatus(iDetails->iStatusFlag); |
|
634 aSiEntry.SetTextL(*iDetails->iText); |
|
635 aSiEntry.SetUrlL(*iDetails->iURL); |
|
636 |
|
637 aSiEntry.SetMsgDetailsL(*iDetails->iMsgDetails); |
|
638 aSiEntry.SetMsgDescriptionL(*iDetails->iMsgDescription); |
|
639 } |
|
640 |
|
641 |
|
642 |
|
643 // Tests the Save and Retrieve functions - saves a message and then loads it |
|
644 // - should remain unchanged |
|
645 void CPushEntryTester::SiSaveRetrieveTestL() |
|
646 { |
|
647 __LOG_ALWAYS("***** TEST STORING NEW SI PUSH ENTRY DATA *****"); // Log details |
|
648 TMsvId msgEntryId =0; |
|
649 CSIPushMsgEntry* siSave =NULL; |
|
650 |
|
651 #if defined (__HEAP_FAILURE_TESTING) |
|
652 TInt error; |
|
653 TBool finished = EFalse; |
|
654 TInt failCount = 0; |
|
655 |
|
656 while(!finished) |
|
657 { |
|
658 __UHEAP_FAILNEXT(failCount++); |
|
659 TRAP(error, siSave = DoSiSaveTestL()); |
|
660 if (error == KErrNone) |
|
661 { |
|
662 __UHEAP_RESET; |
|
663 LogFormatInt(_L("Made %d attempts at calling DoSiSaveTestL()"), failCount); |
|
664 finished = ETrue; |
|
665 } |
|
666 |
|
667 else // Handle error |
|
668 { |
|
669 // Check if error is out of memory |
|
670 gTest(error == KErrNoMemory); |
|
671 __UHEAP_RESET; |
|
672 } |
|
673 } |
|
674 #else |
|
675 siSave = DoSiSaveTestL(); |
|
676 #endif |
|
677 |
|
678 CleanupStack::PushL(siSave); |
|
679 OutputMessageDetailsL(*siSave); |
|
680 msgEntryId = siSave->Entry().Id(); |
|
681 |
|
682 __LOG_ALWAYS("***** TEST RESTORING DATA INTO NEW PUSH ENTRY *****"); |
|
683 CSIPushMsgEntry* siLoad = NULL; |
|
684 |
|
685 #if defined (__HEAP_FAILURE_TESTING) |
|
686 error = KErrNone; //reset loop variables |
|
687 finished = EFalse; |
|
688 failCount = 0; |
|
689 while(!finished) |
|
690 { |
|
691 __UHEAP_FAILNEXT(failCount++); |
|
692 TRAP(error,siLoad = DoSiRetrieveTestL(msgEntryId)); |
|
693 if (error == KErrNone) |
|
694 { |
|
695 __UHEAP_RESET; |
|
696 LogFormatInt(_L("Made %d attempts at calling DoSiRetrieveTestL(msgEntryId)"), failCount); |
|
697 finished = ETrue; |
|
698 } |
|
699 else // Handle error |
|
700 { |
|
701 // Check if error is out of memory |
|
702 gTest(error == KErrNoMemory); |
|
703 __UHEAP_RESET; |
|
704 } |
|
705 } |
|
706 #else |
|
707 siLoad = DoSiRetrieveTestL(msgEntryId); |
|
708 #endif |
|
709 CleanupStack::PushL(siLoad); |
|
710 |
|
711 OutputMessageDetailsL(*siLoad); |
|
712 CleanupStack::PopAndDestroy(2); //siLoad, siSave |
|
713 __LOG_ALWAYS("***** SI SAVE/RETRIEVE - TEST SUCCESSFUL ******"); |
|
714 if (iDetails->iNullEntries) |
|
715 iSINullMsg = msgEntryId; // Hold the id of the null entry for a later test |
|
716 else |
|
717 iSIToChange = msgEntryId; //Hold the id of the non null entry for changing later |
|
718 } |
|
719 |
|
720 CSIPushMsgEntry* CPushEntryTester::DoSiSaveTestL() |
|
721 { |
|
722 CSIPushMsgEntry* siSave=NULL; |
|
723 if (iState==ETestSISaveRetrieveWithStringAppID) |
|
724 { |
|
725 siSave = CSIPushMsgEntry::NewL(); |
|
726 } |
|
727 else if (iState==ETestSISaveRetrieveWithIntAppID) |
|
728 { |
|
729 TInt tmp=5432; |
|
730 siSave = CSIPushMsgEntry::NewL(tmp); |
|
731 } |
|
732 else |
|
733 { |
|
734 siSave = CSIPushMsgEntry::NewL(); |
|
735 } |
|
736 |
|
737 CleanupStack::PushL(siSave); |
|
738 siSave->SetIdL(*iDetails->iSiId); |
|
739 siSave->SetHeaderL(*iDetails->iHeader); |
|
740 siSave->SetAction(iDetails->iActionFlag); |
|
741 siSave->SetStatus(iDetails->iStatusFlag); |
|
742 // siSave->SetCreated(iDetails->iCreated); |
|
743 |
|
744 siSave->SetExpires(iDetails->iExpires); |
|
745 siSave->SetUrlL(*iDetails->iURL); |
|
746 siSave->SetTextL(*iDetails->iText); |
|
747 siSave->SetFromL(*iDetails->iFrom); |
|
748 |
|
749 TTime now; |
|
750 now.UniversalTime(); |
|
751 siSave->SetCreated(now); |
|
752 |
|
753 if (iPushMsgFolderId ==KMsvNullIndexEntryId) |
|
754 iSISLPushUtilities->GetPushMsgFolderIdL(iPushMsgFolderId); |
|
755 siSave->SaveL(iPushUtilities->Session(),iPushMsgFolderId); |
|
756 CleanupStack::Pop(); |
|
757 return siSave; |
|
758 } |
|
759 |
|
760 CSIPushMsgEntry* CPushEntryTester::DoSiRetrieveTestL(TMsvId aMsgId) |
|
761 { |
|
762 CSIPushMsgEntry* siLoad = CSIPushMsgEntry::NewL(); |
|
763 CleanupStack::PushL(siLoad); |
|
764 siLoad->RetrieveL(iPushUtilities->Session(), aMsgId); |
|
765 CleanupStack::Pop(); |
|
766 return siLoad; // for displaying data |
|
767 } |
|
768 |
|
769 |
|
770 // Tests use of get/set methods on a CSLPushMsgEntry |
|
771 // Create new entry,set values on TMsvEntry,set Push Entry, display & set new values |
|
772 void CPushEntryTester::SlGetSetTestL() |
|
773 { |
|
774 CSLPushMsgEntry* slEntry = NULL; |
|
775 __LOG_ALWAYS("***** TESTING SL SETTER FUNCTIONS *****"); |
|
776 |
|
777 #if defined (__HEAP_FAILURE_TESTING) |
|
778 TInt error = KErrNone; |
|
779 TBool finished = EFalse; |
|
780 TInt failCount = 0; |
|
781 while(!finished) |
|
782 { |
|
783 __UHEAP_FAILNEXT(failCount++); |
|
784 TRAP(error,slEntry = DoSlCreateTestL()); |
|
785 if (error == KErrNone) |
|
786 { |
|
787 __UHEAP_RESET; |
|
788 LogFormatInt(_L("Made %d attempts at calling DoSlCreateTestL()"), failCount); |
|
789 finished = ETrue; |
|
790 } |
|
791 else // Handle error |
|
792 { |
|
793 // Check if error is out of memory |
|
794 gTest(error == KErrNoMemory); |
|
795 __UHEAP_RESET; |
|
796 } |
|
797 } |
|
798 #else |
|
799 slEntry = DoSlCreateTestL(); |
|
800 #endif |
|
801 CleanupStack::PushL(slEntry); |
|
802 OutputMessageDetailsL(*slEntry); |
|
803 |
|
804 #if defined (__HEAP_FAILURE_TESTING) |
|
805 error = KErrNone; |
|
806 finished = EFalse; |
|
807 failCount = 0; |
|
808 while(!finished) |
|
809 { |
|
810 __UHEAP_FAILNEXT(failCount++); |
|
811 TRAP(error,DoSlSetTestL(*slEntry)); |
|
812 if (error == KErrNone) |
|
813 { |
|
814 __UHEAP_RESET; |
|
815 LogFormatInt(_L("Made %d attempts at calling DoSlSetTestL()"), failCount); |
|
816 finished = ETrue; |
|
817 } |
|
818 else // Handle error |
|
819 { |
|
820 // Check if error is out of memory |
|
821 gTest(error == KErrNoMemory); |
|
822 __UHEAP_RESET; |
|
823 } |
|
824 } |
|
825 #else |
|
826 DoSlSetTestL(*slEntry); |
|
827 #endif |
|
828 |
|
829 OutputMessageDetailsL(*slEntry); |
|
830 CleanupStack::PopAndDestroy(); //slEntry |
|
831 __LOG_ALWAYS("***** SL PUSH ENTRY SET/GET - TEST SUCCESSFUL ******"); |
|
832 } |
|
833 |
|
834 CSLPushMsgEntry* CPushEntryTester::DoSlCreateTestL() |
|
835 { |
|
836 TMsvEntry entry; |
|
837 entry.iServiceId = 0x0999999; // Dummy value |
|
838 entry.iMtm.iUid = 0x11111111; //Silly value |
|
839 entry.iBioType = 0x44444444; //another silly value |
|
840 entry.iType = KUidMsvMessageEntry; |
|
841 entry.SetMtmData1(0x1FF); |
|
842 |
|
843 CSLPushMsgEntry* slEntry = CSLPushMsgEntry::NewL(); |
|
844 CleanupStack::PushL(slEntry); |
|
845 slEntry->SetEntry(entry); |
|
846 slEntry->SetHeaderL(iDummyHeader2); |
|
847 slEntry->SetUrlL(KUrl3); |
|
848 |
|
849 slEntry->SetMsgDescriptionL(_L("http://www.waffle.com")); |
|
850 slEntry->SetTimeSent(KDateExpiry4); |
|
851 slEntry->SetMsgDetailsL(_L("Henry Higgins")); |
|
852 |
|
853 CleanupStack::Pop(); |
|
854 return slEntry; |
|
855 } |
|
856 |
|
857 void CPushEntryTester::DoSlSetTestL(CSLPushMsgEntry& aSlEntry) |
|
858 { |
|
859 aSlEntry.SetAction(iDetails->iActionFlag); |
|
860 aSlEntry.SetFromL(*iDetails->iFrom); |
|
861 aSlEntry.SetStatus(iDetails->iStatusFlag); |
|
862 aSlEntry.SetUrlL(*iDetails->iURL); |
|
863 aSlEntry.SetTimeSent(iDetails->iCreated); |
|
864 aSlEntry.SetHeaderL(*iDetails->iHeader); |
|
865 } |
|
866 |
|
867 |
|
868 // Tests the Save and Retrieve functions - saves a message and then loads it - should remain unchanged |
|
869 void CPushEntryTester::SlSaveRetrieveTestL() |
|
870 { |
|
871 TMsvId msgEntryId; |
|
872 CSLPushMsgEntry* slSave = NULL; |
|
873 |
|
874 __LOG_ALWAYS("***** TEST STORING NEW SL PUSH ENTRY DATA *****"); // Log details |
|
875 |
|
876 #if defined (__HEAP_FAILURE_TESTING) |
|
877 TInt error = KErrNone; |
|
878 TBool finished = EFalse; |
|
879 TInt failCount = 0; |
|
880 while(!finished) |
|
881 { |
|
882 __UHEAP_FAILNEXT(failCount++); |
|
883 TRAP(error,slSave = DoSlSaveTestL()); |
|
884 if (error == KErrNone) |
|
885 { |
|
886 __UHEAP_RESET; |
|
887 LogFormatInt(_L("Made %d attempts at calling DoSlSaveTestL()"), failCount); |
|
888 finished = ETrue; |
|
889 } |
|
890 else // Handle error |
|
891 { |
|
892 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
893 __UHEAP_RESET; |
|
894 } |
|
895 } |
|
896 #else |
|
897 slSave = DoSlSaveTestL(); |
|
898 #endif |
|
899 |
|
900 CleanupStack::PushL(slSave); |
|
901 msgEntryId = slSave->Entry().Id(); |
|
902 OutputMessageDetailsL(*slSave); |
|
903 |
|
904 CSLPushMsgEntry* slLoad = NULL; |
|
905 #if defined (__HEAP_FAILURE_TESTING) |
|
906 error = KErrNone; |
|
907 finished = EFalse; |
|
908 failCount = 0; |
|
909 while(!finished) |
|
910 { |
|
911 __UHEAP_FAILNEXT(failCount++); |
|
912 TRAP(error,slLoad = DoSlRetrieveTestL(msgEntryId)); |
|
913 if (error == KErrNone) |
|
914 { |
|
915 __UHEAP_RESET; |
|
916 LogFormatInt(_L("Made %d attempts at calling DoSlRetrieveTestL()"), failCount); |
|
917 finished = ETrue; |
|
918 } |
|
919 else // Handle error |
|
920 { |
|
921 // Check if error is out of memory |
|
922 gTest(error == KErrNoMemory); |
|
923 __UHEAP_RESET; |
|
924 } |
|
925 } |
|
926 #else |
|
927 slLoad = DoSlRetrieveTestL(msgEntryId); |
|
928 #endif |
|
929 |
|
930 CleanupStack::PushL(slLoad); |
|
931 __LOG_ALWAYS("***** TEST RESTORING DATA INTO NEW PUSH ENTRY *****"); |
|
932 OutputMessageDetailsL(*slLoad); |
|
933 CleanupStack::PopAndDestroy(2); //slLoad, slSave |
|
934 |
|
935 if (iDetails->iNullEntries) |
|
936 iSLNullMsg = msgEntryId; |
|
937 else |
|
938 iSLToChange = msgEntryId; //Hold the id of the non null entry for changing later |
|
939 __LOG_ALWAYS("***** SL SAVE/RETRIEVE - TEST SUCCESSFUL ******"); |
|
940 } |
|
941 |
|
942 CSLPushMsgEntry* CPushEntryTester::DoSlSaveTestL() |
|
943 { |
|
944 CSLPushMsgEntry* slSave = CSLPushMsgEntry::NewL(); |
|
945 CleanupStack::PushL(slSave); |
|
946 slSave->SetHeaderL(*iDetails->iHeader); |
|
947 slSave->SetUrlL(*iDetails->iURL); |
|
948 slSave->SetFromL(*iDetails->iFrom); |
|
949 slSave->SetTimeSent(iDetails->iCreated); |
|
950 slSave->SetAction(iDetails->iActionFlag); |
|
951 slSave->SetStatus(iDetails->iStatusFlag); |
|
952 if (iPushMsgFolderId==KMsvNullIndexEntryId) |
|
953 iSISLPushUtilities->GetPushMsgFolderIdL(iPushMsgFolderId); |
|
954 slSave->SaveL(iPushUtilities->Session(), iPushMsgFolderId); |
|
955 CleanupStack::Pop(); |
|
956 return slSave; |
|
957 } |
|
958 |
|
959 CSLPushMsgEntry* CPushEntryTester::DoSlRetrieveTestL(TMsvId aId) |
|
960 { |
|
961 CSLPushMsgEntry* slLoad = CSLPushMsgEntry::NewL(); |
|
962 CleanupStack::PushL(slLoad); //slEntry |
|
963 slLoad->RetrieveL(iPushUtilities->Session(), aId); |
|
964 CleanupStack::Pop(); |
|
965 return slLoad; |
|
966 } |
|
967 |
|
968 |
|
969 // Tests use of get/set methods on a CMultiPushMsgEntry |
|
970 // Create new entry,set values on TMsvEntry,set Push Entry, display & set new values |
|
971 void CPushEntryTester::MultiGetSetTestL() |
|
972 { |
|
973 CMultiPartPushMsgEntry* multiEntry = NULL; |
|
974 __LOG_ALWAYS("***** TESTING MULTIPART SETTER FUNCTIONS *****"); |
|
975 #if defined (__HEAP_FAILURE_TESTING) |
|
976 TInt error = KErrNone; |
|
977 TBool finished = EFalse; |
|
978 TInt failCount = 0; |
|
979 while(!finished) |
|
980 { |
|
981 __UHEAP_FAILNEXT(failCount++); |
|
982 TRAP(error,multiEntry= DoMultiCreateTestL()); |
|
983 if (error == KErrNone) |
|
984 { |
|
985 __UHEAP_RESET; |
|
986 LogFormatInt(_L("Made %d attempts at calling DoMultiCreateTestL()"), failCount); |
|
987 finished = ETrue; |
|
988 } |
|
989 else // Handle error |
|
990 { |
|
991 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
992 __UHEAP_RESET; |
|
993 } |
|
994 } |
|
995 #else |
|
996 multiEntry = DoMultiCreateTestL();; |
|
997 #endif |
|
998 CleanupStack::PushL(multiEntry); |
|
999 OutputMessageDetailsL(*multiEntry); |
|
1000 |
|
1001 #if defined (__HEAP_FAILURE_TESTING) |
|
1002 error = KErrNone; |
|
1003 finished = EFalse; |
|
1004 failCount = 0; |
|
1005 while(!finished) |
|
1006 { |
|
1007 __UHEAP_FAILNEXT(failCount++); |
|
1008 TRAP(error,DoMultiSetTestL(*multiEntry) ); |
|
1009 if (error == KErrNone) |
|
1010 { |
|
1011 __UHEAP_RESET; |
|
1012 LogFormatInt(_L("Made %d attempts at calling DoMultiSetTestL()"), failCount); |
|
1013 finished = ETrue; |
|
1014 } |
|
1015 else // Handle error |
|
1016 { |
|
1017 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1018 __UHEAP_RESET; |
|
1019 } |
|
1020 } |
|
1021 #else |
|
1022 DoMultiSetTestL(*multiEntry); |
|
1023 #endif |
|
1024 OutputMessageDetailsL(*multiEntry); |
|
1025 CleanupStack::PopAndDestroy(); //multiEntry |
|
1026 __LOG_ALWAYS("***** MULTIPART SET/GET - TEST SUCCESSFUL ******"); |
|
1027 } |
|
1028 |
|
1029 |
|
1030 CMultiPartPushMsgEntry* CPushEntryTester::DoMultiCreateTestL() |
|
1031 { |
|
1032 TMsvEntry entry; |
|
1033 entry.iServiceId = KMsvLocalServiceIndexEntryId; |
|
1034 entry.iMtm.iUid = 0x11111111; //Silly value |
|
1035 entry.iBioType = 0x44444444; //another silly value |
|
1036 entry.iType = KUidMsvMessageEntry; |
|
1037 entry.SetMtmData1(0x1FF); |
|
1038 |
|
1039 CMultiPartPushMsgEntry* multiEntry = CMultiPartPushMsgEntry::NewL(); |
|
1040 CleanupStack::PushL(multiEntry); |
|
1041 multiEntry->SetEntry(entry); |
|
1042 multiEntry->SetFromL(_L8("Eliza Dolittle")); |
|
1043 multiEntry->SetContentTypeL(KMultiContent); |
|
1044 multiEntry->SetStatus(6); |
|
1045 multiEntry->SetTimeSent(KDateExpiry3); |
|
1046 multiEntry->SetMsgDescriptionL(*iDetails->iText); |
|
1047 |
|
1048 CleanupStack::Pop(); |
|
1049 return multiEntry; |
|
1050 } |
|
1051 |
|
1052 void CPushEntryTester::DoMultiSetTestL(CMultiPartPushMsgEntry& aMultiEntry) |
|
1053 { |
|
1054 aMultiEntry.SetFromL(*iDetails->iFrom); |
|
1055 aMultiEntry.SetHeaderL(iDummyHeader1); |
|
1056 aMultiEntry.SetStatus(iDetails->iStatusFlag); |
|
1057 aMultiEntry.SetContentTypeL(*iDetails->iContentType); |
|
1058 aMultiEntry.SetTimeSent(iDetails->iCreated); |
|
1059 } |
|
1060 |
|
1061 void CPushEntryTester::MultiSaveRetrieveTestL() |
|
1062 { |
|
1063 TMsvId msgEntryId; |
|
1064 CMultiPartPushMsgEntry* multiSave = NULL; |
|
1065 |
|
1066 #if defined (__HEAP_FAILURE_TESTING) |
|
1067 TInt error = KErrNone; |
|
1068 TBool finished = EFalse; |
|
1069 TInt failCount = 0; |
|
1070 while(!finished) |
|
1071 { |
|
1072 __UHEAP_FAILNEXT(failCount++); |
|
1073 TRAP(error,multiSave = DoMultiSaveTestL() ); |
|
1074 if (error == KErrNone) |
|
1075 { |
|
1076 __UHEAP_RESET; |
|
1077 LogFormatInt(_L("Made %d attempts at calling DoMultiSaveTestL()"), failCount); |
|
1078 finished = ETrue; |
|
1079 } |
|
1080 else // Handle error |
|
1081 { |
|
1082 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1083 __UHEAP_RESET; |
|
1084 } |
|
1085 } |
|
1086 #else |
|
1087 multiSave = DoMultiSaveTestL(); |
|
1088 #endif |
|
1089 CleanupStack::PushL(multiSave); |
|
1090 __LOG_ALWAYS("***** TEST STORING NEW MULTI PUSH ENTRY DATA *****"); // Log details |
|
1091 msgEntryId = multiSave->Entry().Id(); |
|
1092 CreateMultiChildrenL(msgEntryId); |
|
1093 OutputMessageDetailsL(*multiSave); |
|
1094 |
|
1095 __LOG_ALWAYS("***** TESTING RESTORING DATA INTO NEW PUSH ENTRY *****"); |
|
1096 CMultiPartPushMsgEntry* multiLoad = NULL; |
|
1097 |
|
1098 #if defined (__HEAP_FAILURE_TESTING) |
|
1099 error = KErrNone; |
|
1100 finished = EFalse; |
|
1101 failCount = 0; |
|
1102 while(!finished) |
|
1103 { |
|
1104 __UHEAP_FAILNEXT(failCount++); |
|
1105 TRAP(error, multiLoad = DoMultiRetrieveTestL(msgEntryId) ); |
|
1106 if (error == KErrNone) |
|
1107 { |
|
1108 __UHEAP_RESET; |
|
1109 LogFormatInt(_L("Made %d attempts at calling DoMultiRetrieveTestL()"), failCount); |
|
1110 finished = ETrue; |
|
1111 } |
|
1112 else // Handle error |
|
1113 { |
|
1114 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1115 __UHEAP_RESET; |
|
1116 } |
|
1117 } |
|
1118 #else |
|
1119 multiLoad = DoMultiRetrieveTestL(msgEntryId); |
|
1120 #endif |
|
1121 |
|
1122 CleanupStack::PushL(multiLoad); |
|
1123 OutputMessageDetailsL(*multiLoad); |
|
1124 |
|
1125 // Get the child entries - don't bother with heap testing - tested with Unknown Entries |
|
1126 iMsvEntry->SetEntryL(msgEntryId); |
|
1127 CMsvEntrySelection* children = iMsvEntry->ChildrenL(); |
|
1128 CleanupStack::PushL(children); |
|
1129 CUnknownPushMsgEntry* unknownMsg = CUnknownPushMsgEntry::NewL(); |
|
1130 CleanupStack::PushL(unknownMsg); |
|
1131 |
|
1132 for (TInt loop=0; loop<children->Count(); loop++) |
|
1133 { |
|
1134 __LOG_DEBUG("***** Details of MultiPart Child entry *****"); |
|
1135 unknownMsg->RetrieveL(iPushUtilities->Session(), children->At(loop)); |
|
1136 OutputMessageDetailsL(*unknownMsg); |
|
1137 } |
|
1138 |
|
1139 CleanupStack::PopAndDestroy(4); //unknownMsg, children, multiLoad, multiSave |
|
1140 __LOG_ALWAYS("***** MULTIPART SAVE/RETRIEVE - TEST SUCCESSFUL ******"); |
|
1141 } |
|
1142 |
|
1143 |
|
1144 CMultiPartPushMsgEntry* CPushEntryTester::DoMultiSaveTestL() |
|
1145 { |
|
1146 CMultiPartPushMsgEntry* multiSave = CMultiPartPushMsgEntry::NewL(); |
|
1147 CleanupStack::PushL(multiSave); |
|
1148 multiSave ->SetHeaderL(*iDetails->iHeader); |
|
1149 multiSave ->SetStatus(iDetails->iStatusFlag); |
|
1150 if (iDetails->iNullEntries) |
|
1151 multiSave ->SetContentTypeL(*iDetails->iContentType); |
|
1152 else |
|
1153 multiSave->SetContentTypeL(_L("multipart/related")); |
|
1154 multiSave ->SetFromL(*iDetails->iFrom); |
|
1155 multiSave ->SetTimeSent(iDetails->iCreated); |
|
1156 multiSave->SaveL(iPushUtilities->Session(),KMsvGlobalInBoxIndexEntryId); |
|
1157 CleanupStack::Pop(); |
|
1158 return multiSave; |
|
1159 } |
|
1160 |
|
1161 CMultiPartPushMsgEntry* CPushEntryTester::DoMultiRetrieveTestL(TMsvId aId) |
|
1162 { |
|
1163 CMultiPartPushMsgEntry* multiLoad = CMultiPartPushMsgEntry::NewL(); |
|
1164 CleanupStack::PushL(multiLoad); |
|
1165 multiLoad->RetrieveL(iPushUtilities->Session(), aId); |
|
1166 CleanupStack::Pop(); |
|
1167 return multiLoad; |
|
1168 } |
|
1169 |
|
1170 // Tests use of get/set methods on a CSLUnknownMsgEntry |
|
1171 // Create new entry,set values on TMsvEntry,set Push Entry, display & set new values |
|
1172 void CPushEntryTester::UnknownGetSetTestL() |
|
1173 { |
|
1174 __LOG_ALWAYS("***** TESTING UNKNOWN SETTER FUNCTIONS *****"); |
|
1175 CUnknownPushMsgEntry* unknownEntry= NULL; |
|
1176 |
|
1177 #if defined (__HEAP_FAILURE_TESTING) |
|
1178 TInt error = KErrNone; |
|
1179 TBool finished = EFalse; |
|
1180 TInt failCount = 0; |
|
1181 while(!finished) |
|
1182 { |
|
1183 __UHEAP_FAILNEXT(failCount++); |
|
1184 TRAP(error,unknownEntry = DoUnknownCreateTestL() ); |
|
1185 if (error == KErrNone) |
|
1186 { |
|
1187 __UHEAP_RESET; |
|
1188 LogFormatInt(_L("Made %d attempts at calling DoUnknownCreateTestL()"), failCount); |
|
1189 finished = ETrue; |
|
1190 } |
|
1191 else // Handle error |
|
1192 { |
|
1193 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1194 __UHEAP_RESET; |
|
1195 } |
|
1196 } |
|
1197 #else |
|
1198 unknownEntry = DoUnknownCreateTestL(); |
|
1199 #endif |
|
1200 |
|
1201 CleanupStack::PushL(unknownEntry); |
|
1202 OutputMessageDetailsL(*unknownEntry); |
|
1203 |
|
1204 #if defined (__HEAP_FAILURE_TESTING) |
|
1205 error = KErrNone; |
|
1206 finished = EFalse; |
|
1207 failCount = 0; |
|
1208 while(!finished) |
|
1209 { |
|
1210 __UHEAP_FAILNEXT(failCount++); |
|
1211 TRAP(error,DoUnknownSetTestL(*unknownEntry) ); |
|
1212 if (error == KErrNone) |
|
1213 { |
|
1214 __UHEAP_RESET; |
|
1215 LogFormatInt(_L("Made %d attempts at calling DoUnknownSetTestL()"), failCount); |
|
1216 finished = ETrue; |
|
1217 } |
|
1218 else // Handle error |
|
1219 { |
|
1220 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1221 __UHEAP_RESET; |
|
1222 } |
|
1223 } |
|
1224 #else |
|
1225 DoUnknownSetTestL(*unknownEntry); |
|
1226 #endif |
|
1227 OutputMessageDetailsL(*unknownEntry); |
|
1228 |
|
1229 __LOG_ALWAYS("***** UNKNOWN SET/GET - TEST SUCCESSFUL ******"); |
|
1230 CleanupStack::PopAndDestroy(); |
|
1231 } |
|
1232 |
|
1233 CUnknownPushMsgEntry* CPushEntryTester::DoUnknownCreateTestL() |
|
1234 { |
|
1235 TMsvEntry entry; |
|
1236 |
|
1237 entry.iServiceId = KMsvLocalServiceIndexEntryId; |
|
1238 entry.iMtm.iUid = 0x11111111; //Silly value |
|
1239 entry.iType = KUidMsvMessageEntry; |
|
1240 entry.SetMtmData1(0x1FF); //511 |
|
1241 |
|
1242 CUnknownPushMsgEntry* unknownEntry = CUnknownPushMsgEntry::NewL(); |
|
1243 CleanupStack::PushL(unknownEntry); unknownEntry->SetEntry(entry); |
|
1244 unknownEntry->SetContentTypeL(_L("multipart/unrelated")); |
|
1245 unknownEntry->SetStatus(3); |
|
1246 unknownEntry->SetTimeSent(KDateExpiry4); |
|
1247 unknownEntry->SetFromL(_L8("Henry Higgins")); |
|
1248 unknownEntry->SetHeaderL(iDummyHeader2); |
|
1249 unknownEntry->SetMessageDataL(_L8("A long long piece of text for the message body...........")); |
|
1250 unknownEntry->SetTimeSent(iDetails->iCreated); |
|
1251 unknownEntry->SetMsgDescriptionL(*iDetails->iText); |
|
1252 unknownEntry->SetContentFileNameL(KFilename); |
|
1253 |
|
1254 CleanupStack::Pop(); |
|
1255 return unknownEntry; |
|
1256 } |
|
1257 |
|
1258 |
|
1259 void CPushEntryTester::DoUnknownSetTestL(CUnknownPushMsgEntry& aUnknownEntry) |
|
1260 { |
|
1261 aUnknownEntry.SetStatus(iDetails->iStatusFlag); |
|
1262 aUnknownEntry.SetContentTypeL(*iDetails->iContentType); |
|
1263 aUnknownEntry.SetStatus(iDetails->iStatusFlag); |
|
1264 aUnknownEntry.SetFromL(*iDetails->iFrom); |
|
1265 aUnknownEntry.SetHeaderL(*iDetails->iHeader); |
|
1266 aUnknownEntry.SetTimeSent(iDetails->iCreated); |
|
1267 aUnknownEntry.SetMessageDataL(*iDetails->iMessageBody); |
|
1268 aUnknownEntry.SetContentFileNameL(*iDetails->iFilename); |
|
1269 } |
|
1270 |
|
1271 void CPushEntryTester::UnknownSaveRetrieveTestL(TBool aFilename) |
|
1272 { |
|
1273 TMsvId msgEntryId; |
|
1274 CUnknownPushMsgEntry* unknownSave= NULL; |
|
1275 CUnknownPushMsgEntry* unknownLoad = NULL; |
|
1276 |
|
1277 #if defined (__HEAP_FAILURE_TESTING) |
|
1278 TInt error = KErrNone; |
|
1279 TBool finished = EFalse; |
|
1280 TInt failCount = 0; |
|
1281 while(!finished) |
|
1282 { |
|
1283 __UHEAP_FAILNEXT(failCount++); |
|
1284 TRAP(error, unknownSave = DoUnknownSaveTestL(aFilename) ); |
|
1285 if (error == KErrNone) |
|
1286 { |
|
1287 __UHEAP_RESET; |
|
1288 LogFormatInt(_L("Made %d attempts at calling DoUnknownSaveTestL()"), failCount); |
|
1289 finished = ETrue; |
|
1290 } |
|
1291 else // Handle error |
|
1292 { |
|
1293 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1294 __UHEAP_RESET; |
|
1295 } |
|
1296 } |
|
1297 #else |
|
1298 unknownSave = DoUnknownSaveTestL(aFilename); |
|
1299 #endif |
|
1300 CleanupStack::PushL(unknownSave); |
|
1301 msgEntryId = unknownSave->Entry().Id(); |
|
1302 |
|
1303 __LOG_DEBUG("***** STORING NEW UNKNOWN PUSH ENTRY DATA *****"); |
|
1304 OutputMessageDetailsL(*unknownSave); |
|
1305 |
|
1306 #if defined (__HEAP_FAILURE_TESTING) |
|
1307 error = KErrNone; |
|
1308 finished = EFalse; |
|
1309 failCount = 0; |
|
1310 while(!finished) |
|
1311 { |
|
1312 __UHEAP_FAILNEXT(failCount++); |
|
1313 TRAP(error,unknownLoad = DoUnknownRetrieveTestL(msgEntryId) ); |
|
1314 if (error == KErrNone) |
|
1315 { |
|
1316 __UHEAP_RESET; |
|
1317 LogFormatInt(_L("Made %d attempts at calling DoUnknownRetriveTestL()()"), failCount); |
|
1318 finished = ETrue; |
|
1319 } |
|
1320 else // Handle error |
|
1321 { |
|
1322 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1323 __UHEAP_RESET; |
|
1324 } |
|
1325 } |
|
1326 #else |
|
1327 unknownLoad = DoUnknownRetrieveTestL(msgEntryId); |
|
1328 #endif |
|
1329 CleanupStack::PushL(unknownLoad); |
|
1330 |
|
1331 __LOG_DEBUG("***** TESTING RESTORING DATA INTO NEW PUSH ENTRY *****"); |
|
1332 |
|
1333 if (!iDetails->iNullEntries) |
|
1334 iUnknownToChange = msgEntryId; |
|
1335 OutputMessageDetailsL(*unknownLoad); |
|
1336 CleanupStack::PopAndDestroy(2);// unknownLoad,unknownSave |
|
1337 __LOG_ALWAYS("***** UNKNOWN SAVE/RETRIEVE - TEST SUCCESSFUL ******"); |
|
1338 } |
|
1339 |
|
1340 |
|
1341 CUnknownPushMsgEntry* CPushEntryTester::DoUnknownSaveTestL(TBool aFilename) |
|
1342 { |
|
1343 CUnknownPushMsgEntry* unknownSave = CUnknownPushMsgEntry::NewL(); |
|
1344 CleanupStack::PushL(unknownSave); |
|
1345 unknownSave->SetHeaderL(*iDetails->iHeader); |
|
1346 unknownSave->SetContentTypeL(*iDetails->iContentType); |
|
1347 if (aFilename) |
|
1348 unknownSave->SetContentFileNameL(*iDetails->iFilename); |
|
1349 unknownSave->SetMessageDataL(*iDetails->iMessageBody); |
|
1350 unknownSave->SetStatus(iDetails->iStatusFlag); |
|
1351 unknownSave->SetFromL(*iDetails->iFrom); |
|
1352 unknownSave->SetTimeSent(iDetails->iCreated); |
|
1353 |
|
1354 unknownSave->SaveL(iPushUtilities->Session(), KMsvGlobalInBoxIndexEntryId); |
|
1355 CleanupStack::Pop(); |
|
1356 return unknownSave; |
|
1357 } |
|
1358 |
|
1359 CUnknownPushMsgEntry* CPushEntryTester::DoUnknownRetrieveTestL(TMsvId aId) |
|
1360 { |
|
1361 CUnknownPushMsgEntry* unknownLoad = CUnknownPushMsgEntry::NewL(); |
|
1362 CleanupStack::PushL(unknownLoad); |
|
1363 unknownLoad->RetrieveL(iPushUtilities->Session(), aId); |
|
1364 CleanupStack::Pop(); |
|
1365 return unknownLoad; |
|
1366 } |
|
1367 |
|
1368 void CPushEntryTester::ChangeSIEntryTestL() |
|
1369 { |
|
1370 // Retrieve has already been tested previously |
|
1371 CSIPushMsgEntry* siMsg = CSIPushMsgEntry::NewL(); |
|
1372 CleanupStack::PushL(siMsg); |
|
1373 siMsg->RetrieveL(iPushUtilities->Session(), iSIToChange); |
|
1374 __LOG_DEBUG("***** ORIGINAL SI ENTRY *****"); |
|
1375 OutputMessageDetailsL(*siMsg); |
|
1376 |
|
1377 #if defined (__HEAP_FAILURE_TESTING) |
|
1378 // Uncomment the following lines & check CommitL in UpdateL if you want to test |
|
1379 // if it leaves the message in an partially changed state. |
|
1380 // for (TInt loop = 0; loop<100; loop++) |
|
1381 // { |
|
1382 TInt error = KErrNone; |
|
1383 TBool finished = EFalse; |
|
1384 TInt failCount = 0; |
|
1385 |
|
1386 while(!finished) |
|
1387 { |
|
1388 __UHEAP_FAILNEXT(failCount++); |
|
1389 TRAP(error,DoChangeSiEntryL(*siMsg) ); |
|
1390 if (error == KErrNone) |
|
1391 { |
|
1392 __UHEAP_RESET; |
|
1393 LogFormatInt(_L("Made %d attempts at calling DoChangeSiEntryL()"), failCount); |
|
1394 finished = ETrue; |
|
1395 } |
|
1396 else // Handle error |
|
1397 { |
|
1398 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1399 __UHEAP_RESET; |
|
1400 } |
|
1401 } |
|
1402 // } |
|
1403 |
|
1404 #ifndef _DEBUG |
|
1405 failCount =1; // Bodge to stop compiler complaining on Non Debug builds |
|
1406 #endif |
|
1407 |
|
1408 #else |
|
1409 // DoSiChangeEntryL(*siMsg); |
|
1410 #endif |
|
1411 |
|
1412 __LOG_DEBUG("***** UPDATED SI ENTRY *****"); |
|
1413 OutputMessageDetailsL(*siMsg); |
|
1414 __LOG_ALWAYS("***** CHANGING SI ENTRY - TEST SUCCESSFUL *****"); |
|
1415 CleanupStack::PopAndDestroy(); |
|
1416 |
|
1417 |
|
1418 } |
|
1419 |
|
1420 |
|
1421 void CPushEntryTester::DoChangeSiEntryL(CSIPushMsgEntry& aSiMsg) |
|
1422 { |
|
1423 aSiMsg.SetCreated(KDateExpiry4); |
|
1424 aSiMsg.SetExpires(KDateExpiry4); |
|
1425 aSiMsg.SetIdL(KSiID6); |
|
1426 aSiMsg.SetUrlL(KUrl2); |
|
1427 aSiMsg.SetHeaderL(iDummyHeader2); |
|
1428 aSiMsg.SetFromL(KFrom); |
|
1429 aSiMsg.SetAction(4); // Undefined value to test it |
|
1430 aSiMsg.SetStatus(4); |
|
1431 aSiMsg.SetTextL(KUrl5); |
|
1432 aSiMsg.UpdateL(iPushUtilities->Session()); |
|
1433 } |
|
1434 |
|
1435 |
|
1436 void CPushEntryTester::ChangeSLEntryTestL() |
|
1437 { |
|
1438 CSLPushMsgEntry* slMsg = CSLPushMsgEntry::NewL(); |
|
1439 CleanupStack::PushL(slMsg); |
|
1440 |
|
1441 slMsg->RetrieveL(iPushUtilities->Session(), iSLToChange); |
|
1442 __LOG_ALWAYS("***** RETRIEVING ORIGINAL SL ENTRY *****"); |
|
1443 OutputMessageDetailsL(*slMsg); |
|
1444 |
|
1445 #if defined (__HEAP_FAILURE_TESTING) |
|
1446 TInt error = KErrNone; |
|
1447 TBool finished = EFalse; |
|
1448 TInt failCount = 0; |
|
1449 while(!finished) |
|
1450 { |
|
1451 __UHEAP_FAILNEXT(failCount++); |
|
1452 TRAP(error,DoChangeSlEntryL(*slMsg) ); |
|
1453 if (error == KErrNone) |
|
1454 { |
|
1455 __UHEAP_RESET; |
|
1456 LogFormatInt(_L("Made %d attempts at calling DoChangeSlEntryL()"), failCount); |
|
1457 finished = ETrue; |
|
1458 } |
|
1459 else // Handle error |
|
1460 { |
|
1461 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1462 __UHEAP_RESET; |
|
1463 } |
|
1464 } |
|
1465 |
|
1466 #ifndef _DEBUG |
|
1467 failCount =1; // Bodge to stop compiler complaining on Non Debug builds |
|
1468 #endif |
|
1469 |
|
1470 #else |
|
1471 // DoSlChangeEntryL(*slMsg); |
|
1472 #endif |
|
1473 __LOG_ALWAYS("***** UPDATED SL ENTRY *****"); |
|
1474 OutputMessageDetailsL(*slMsg); |
|
1475 __LOG_ALWAYS("***** CHANGING SL ENTRY - TEST SUCCESSFUL *****"); |
|
1476 CleanupStack::PopAndDestroy(); |
|
1477 } |
|
1478 |
|
1479 |
|
1480 void CPushEntryTester::DoChangeSlEntryL(CSLPushMsgEntry& aSlMsg) |
|
1481 { |
|
1482 aSlMsg.SetHeaderL(iDummyHeader2); |
|
1483 aSlMsg.SetAction(3); // Undefined value to test it |
|
1484 aSlMsg.SetStatus(4); |
|
1485 aSlMsg.SetUrlL(KUrl6); |
|
1486 aSlMsg.SetTimeSent(KDateExpiry3); |
|
1487 aSlMsg.UpdateL(iPushUtilities->Session()); |
|
1488 } |
|
1489 |
|
1490 |
|
1491 void CPushEntryTester::ChangeUnknownEntryTestL(TBool aFilename) |
|
1492 { |
|
1493 CUnknownPushMsgEntry* unkMsg = CUnknownPushMsgEntry::NewL(); |
|
1494 CleanupStack::PushL(unkMsg); |
|
1495 |
|
1496 unkMsg->RetrieveL(iPushUtilities->Session(), iUnknownToChange); |
|
1497 __LOG_ALWAYS("***** RETRIEVING ORIGINAL SL ENTRY *****"); |
|
1498 OutputMessageDetailsL(*unkMsg); |
|
1499 |
|
1500 #if defined (__HEAP_FAILURE_TESTING) |
|
1501 TInt error = KErrNone; |
|
1502 TBool finished = EFalse; |
|
1503 TInt failCount = 0; |
|
1504 while(!finished) |
|
1505 { |
|
1506 __UHEAP_FAILNEXT(failCount++); |
|
1507 TRAP(error,DoChangeUnknownEntryL(*unkMsg, aFilename) ); |
|
1508 if (error == KErrNone) |
|
1509 { |
|
1510 __UHEAP_RESET; |
|
1511 LogFormatInt(_L("Made %d attempts at calling DoChangeUnknownEntryL()"), failCount); |
|
1512 finished = ETrue; |
|
1513 } |
|
1514 else // Handle error |
|
1515 { |
|
1516 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1517 __UHEAP_RESET; |
|
1518 } |
|
1519 } |
|
1520 |
|
1521 #ifndef _DEBUG |
|
1522 failCount =1; // Bodge to stop compiler complaining on Non Debug builds |
|
1523 #endif |
|
1524 |
|
1525 #else |
|
1526 DoChangeUnknownEntryL(*unkMsg, aFilename); |
|
1527 #endif |
|
1528 __LOG_ALWAYS("***** UPDATED UNKNOWN ENTRY *****"); |
|
1529 OutputMessageDetailsL(*unkMsg); |
|
1530 __LOG_ALWAYS("***** CHANGING UNKNOWN ENTRY - TEST SUCCESSFUL *****"); |
|
1531 CleanupStack::PopAndDestroy(); |
|
1532 } |
|
1533 |
|
1534 |
|
1535 void CPushEntryTester::DoChangeUnknownEntryL(CUnknownPushMsgEntry& aUnkMsg, TBool aFilename) |
|
1536 { |
|
1537 aUnkMsg.SetHeaderL(iDummyHeader2); |
|
1538 aUnkMsg.SetStatus(4); |
|
1539 aUnkMsg.SetTimeSent(KDateExpiry3); |
|
1540 if (aFilename) |
|
1541 aUnkMsg.SetContentFileNameL(KFilename2); |
|
1542 aUnkMsg.SetMessageDataL(KDummyBody2); |
|
1543 aUnkMsg.UpdateL(iPushUtilities->Session()); |
|
1544 } |
|
1545 |
|
1546 |
|
1547 |
|
1548 // Harded coded target Id string - we store the TMsvId during CreateMoreSiMessages. |
|
1549 void CPushEntryTester::FindSiIdTestL(TBool aSearchForNullStr) |
|
1550 { |
|
1551 __LOG_ALWAYS("***** TESTING FINDING SI ID *****"); |
|
1552 |
|
1553 TPtrC ptr; |
|
1554 TBuf<255> buffer; |
|
1555 if (aSearchForNullStr) |
|
1556 ptr.Set(KNullDesC); |
|
1557 else |
|
1558 ptr.Set(KSiID3); |
|
1559 |
|
1560 CMsvEntrySelection* msgSel = NULL; |
|
1561 |
|
1562 |
|
1563 #if defined (__HEAP_FAILURE_TESTING) |
|
1564 TInt error = KErrNone; |
|
1565 TBool finished = EFalse; |
|
1566 TInt failCount = 0; |
|
1567 while(!finished) |
|
1568 { |
|
1569 __UHEAP_FAILNEXT(failCount++); |
|
1570 TRAP(error, |
|
1571 msgSel = iSISLPushUtilities->FindSiIdLC(ptr); |
|
1572 CleanupStack::Pop(); |
|
1573 ); |
|
1574 if (error == KErrNone) |
|
1575 { |
|
1576 __UHEAP_RESET; |
|
1577 LogFormatInt(_L("Made %d attempts at calling msgSel = WapPushMsgUtils::FindSiIdLC(ptr)"), failCount); |
|
1578 finished = ETrue; |
|
1579 } |
|
1580 else // Handle error |
|
1581 { |
|
1582 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1583 __UHEAP_RESET; |
|
1584 } |
|
1585 } |
|
1586 |
|
1587 #ifndef _DEBUG |
|
1588 failCount =1; // Bodge to stop compiler complaining on Non Debug builds |
|
1589 #endif |
|
1590 |
|
1591 #else |
|
1592 msgSel = iSISLPushUtilities->FindSiIdLC(ptr); |
|
1593 CleanupStack::Pop(); // make the cleanup calls match Heap Testing |
|
1594 #endif |
|
1595 CleanupStack::PushL(msgSel); |
|
1596 |
|
1597 buffer.Format(_L("Search for '%S' yielded %d msg "), &ptr, msgSel->Count()); |
|
1598 LogStr(buffer); |
|
1599 |
|
1600 for (TInt count =0; count <msgSel->Count(); count++) |
|
1601 { |
|
1602 TBuf<255> buffer; |
|
1603 buffer.Format(_L("Search for '%S' yielded msg %d with Id 0x%08X"), &ptr, count, msgSel->At(count)); |
|
1604 // __LOG_DEBUG(buffer); |
|
1605 } |
|
1606 |
|
1607 // Normally Should only be one entry in array and that should be equal to iSINullMsg |
|
1608 // With Heap Failure testing switched on, get lots of partially complete entries. |
|
1609 if ( (aSearchForNullStr && (msgSel->Find(iSINullMsg)!=KErrNotFound) ) |
|
1610 || (!aSearchForNullStr && (msgSel->Find(iTargetSiIDMsg)!=KErrNotFound) ) ) |
|
1611 |
|
1612 { |
|
1613 __LOG_ALWAYS("***** FIND SI ID - TEST SUCCESSFUL *****"); |
|
1614 } |
|
1615 else |
|
1616 { |
|
1617 iFailures++; |
|
1618 __LOG_ALWAYS("***** FIND SI ID - TEST FAILED *****"); |
|
1619 } |
|
1620 CleanupStack::PopAndDestroy(); //msgSel |
|
1621 } |
|
1622 |
|
1623 |
|
1624 void CPushEntryTester::FindUrlTestL(TBool aSearchForNullStr, TUid aUid) |
|
1625 { |
|
1626 TPtrC ptr; |
|
1627 TBuf<255> buffer; |
|
1628 TMsvId targetId =KMsvNullIndexEntryId; |
|
1629 TPtrC displayPtr; |
|
1630 |
|
1631 if (aUid ==KUidWapPushMsgSI) |
|
1632 { |
|
1633 displayPtr.Set(_L("SI ")); |
|
1634 targetId = aSearchForNullStr?iSINullMsg:iTargetSIUrlMsg; |
|
1635 ptr.Set(aSearchForNullStr ? TPtrC(KNullDesC) : TPtrC(KUrl3) ); |
|
1636 } |
|
1637 else if (aUid ==KUidWapPushMsgSL) |
|
1638 { |
|
1639 displayPtr.Set(_L("SL ")); |
|
1640 targetId = aSearchForNullStr ? iSLNullMsg:iTargetSLUrlMsg; |
|
1641 ptr.Set(aSearchForNullStr ? TPtrC(KNullDesC):TPtrC(KUrl3) ); |
|
1642 } |
|
1643 |
|
1644 LogFormatStr(_L("***** TESTING FINDING A %S MSG URL *****"), displayPtr); |
|
1645 |
|
1646 TMsvId msgId = KMsvNullIndexEntryId; |
|
1647 #if defined (__HEAP_FAILURE_TESTING) |
|
1648 TInt error = KErrNone; |
|
1649 TBool finished = EFalse; |
|
1650 TInt failCount = 0; |
|
1651 while(!finished) |
|
1652 { |
|
1653 __UHEAP_FAILNEXT(failCount++); |
|
1654 TRAP(error,msgId = iSISLPushUtilities->FindUrlL(ptr, aUid) ); |
|
1655 if (error == KErrNone) |
|
1656 { |
|
1657 __UHEAP_RESET; |
|
1658 LogFormatInt(_L("Made %d attempts at calling msgSel = WapPushMsgUtils::FindSiIdLC()"), failCount); |
|
1659 finished = ETrue; |
|
1660 } |
|
1661 else // Handle error |
|
1662 { |
|
1663 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1664 __UHEAP_RESET; |
|
1665 } |
|
1666 } |
|
1667 |
|
1668 #ifndef _DEBUG |
|
1669 failCount =1; // Bodge to stop compiler complaining on Non Debug builds |
|
1670 #endif |
|
1671 |
|
1672 #else |
|
1673 msgId = iSISLPushUtilities->FindUrlL(ptr, aUid); |
|
1674 #endif |
|
1675 |
|
1676 buffer.Format(_L("Searched messages of type 0x%08X with Url '%S'"),KUidWapPushMsgSI.iUid, &ptr); |
|
1677 LogStr(buffer); |
|
1678 LogFormatInt(_L("Find operation yielded Id 0x%08X"), msgId); |
|
1679 if ( msgId == targetId) |
|
1680 { |
|
1681 LogFormatStr(_L("***** FIND %S URL - TEST SUCCESSFUL *****"), displayPtr); |
|
1682 } |
|
1683 else |
|
1684 { |
|
1685 iFailures++; |
|
1686 LogFormatStr(_L("***** FIND %S URL - TEST FAILED *****"), displayPtr); |
|
1687 } |
|
1688 } |
|
1689 |
|
1690 |
|
1691 void CPushEntryTester::GetActionTestL(TUid aPushType) |
|
1692 { |
|
1693 TPtrC ptr; |
|
1694 TMsvId targetId; |
|
1695 TMsvId resultId = KMsvNullIndexEntryId; |
|
1696 |
|
1697 if (aPushType ==KUidWapPushMsgSI) |
|
1698 { |
|
1699 ptr.Set(_L("SI")); |
|
1700 targetId = iHighestSIActionID; |
|
1701 } |
|
1702 else |
|
1703 { |
|
1704 ptr.Set(_L("SL")); |
|
1705 targetId = iHighestSLActionID; |
|
1706 } |
|
1707 LogFormatStr(_L("***** TESTING FINDING HIGHEST %S ACTION *****"), ptr); |
|
1708 |
|
1709 |
|
1710 #if defined (__HEAP_FAILURE_TESTING) |
|
1711 TInt error = KErrNone; |
|
1712 TBool finished = EFalse; |
|
1713 TInt failCount = 0; |
|
1714 while(!finished) |
|
1715 { |
|
1716 __UHEAP_FAILNEXT(failCount++); |
|
1717 TRAP(error, resultId = iSISLPushUtilities->GetHighestActionL(aPushType)); |
|
1718 if (error == KErrNone) |
|
1719 { |
|
1720 __UHEAP_RESET; |
|
1721 LogFormatInt(_L("Made %d attempts at calling msgSel = WapPushMsgUtils::GetHighestActionL()"), failCount); |
|
1722 finished = ETrue; |
|
1723 } |
|
1724 else // Handle error |
|
1725 { |
|
1726 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1727 __UHEAP_RESET; |
|
1728 } |
|
1729 } |
|
1730 #ifndef _DEBUG |
|
1731 failCount = 1; // Bodge to stop compiler complaining on Non Debug builds |
|
1732 #endif |
|
1733 |
|
1734 #else // if no Heap Failure testing |
|
1735 resultId = iSISLPushUtilities->GetHighestActionL(aPushType); |
|
1736 #endif |
|
1737 |
|
1738 |
|
1739 LogFormatInt(_L("Get Action operation for Msg Type 0x%08X, yielded Id 0x%08X"), aPushType.iUid, resultId); |
|
1740 |
|
1741 if (targetId ==resultId) |
|
1742 { |
|
1743 LogFormatStr(_L("***** FIND HIGHEST %S ACTION - TEST SUCCESSFUL *****"), ptr); |
|
1744 } |
|
1745 else |
|
1746 { |
|
1747 iFailures++; |
|
1748 LogFormatStr(_L("***** FIND HIGHEST %S ACTION - TEST FAILED *****"), ptr); |
|
1749 } |
|
1750 } |
|
1751 |
|
1752 void CPushEntryTester::GetExpiryTestL() |
|
1753 { |
|
1754 __LOG_ALWAYS("***** TESTING FINDING EARLIEST EXPIRY *****"); |
|
1755 |
|
1756 #if defined (__HEAP_FAILURE_TESTING) |
|
1757 TInt error = KErrNone; |
|
1758 TBool finished = EFalse; |
|
1759 TInt failCount = 0; |
|
1760 while(!finished) |
|
1761 { |
|
1762 __UHEAP_FAILNEXT(failCount++); |
|
1763 TRAP(error, iExpired = iSISLPushUtilities->GetNextExpiryL() ); |
|
1764 if (error == KErrNone) |
|
1765 { |
|
1766 __UHEAP_RESET; |
|
1767 LogFormatInt(_L("Made %d attempts at calling msgSel = WapPushMsgUtils::GetNextExpiryL()"), failCount); |
|
1768 finished = ETrue; |
|
1769 } |
|
1770 else // Handle error |
|
1771 { |
|
1772 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1773 __UHEAP_RESET; |
|
1774 } |
|
1775 } |
|
1776 |
|
1777 #ifndef _DEBUG |
|
1778 failCount = 1; // Bodge to stop compiler complaining on Non Debug builds |
|
1779 #endif |
|
1780 |
|
1781 #else |
|
1782 iExpired = iSISLPushUtilities->GetNextExpiryL(); |
|
1783 #endif |
|
1784 |
|
1785 CSIPushMsgEntry* siMsg = CSIPushMsgEntry::NewL(); |
|
1786 CleanupStack::PushL(siMsg); |
|
1787 if (iExpired != KMsvNullIndexEntryId) //Otherwise Retrieve panics!! |
|
1788 { |
|
1789 siMsg->RetrieveL(iPushUtilities->Session(), iExpired); |
|
1790 OutputMessageDetailsL(*siMsg); |
|
1791 TBuf<100> temp; |
|
1792 TTime expiryDate = siMsg->Expires().Int64(); |
|
1793 expiryDate.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
1794 TPtrC ptr; |
|
1795 ptr.Set(temp); |
|
1796 LogFormatStr(_L("Next Expirys date := %S"), ptr); |
|
1797 __LOG_ALWAYS("***** FIND NEXT EXPIRY - TEST SUCCESSFUL *****"); |
|
1798 |
|
1799 } |
|
1800 else |
|
1801 { |
|
1802 __LOG_ALWAYS("***** FIND NEXT EXPIRY - TEST FAILED *****"); |
|
1803 } |
|
1804 CleanupStack::PopAndDestroy(); //siMsg |
|
1805 } |
|
1806 |
|
1807 |
|
1808 void CPushEntryTester::DeleteEarliestExpiryL() |
|
1809 { |
|
1810 #if defined (__HEAP_FAILURE_TESTING) |
|
1811 TInt error = KErrNone; |
|
1812 TBool finished = EFalse; |
|
1813 TInt failCount = 0; |
|
1814 while(!finished) |
|
1815 { |
|
1816 __UHEAP_FAILNEXT(failCount++); |
|
1817 TRAP(error, iSISLPushUtilities->DeleteEntryL(iExpired)); |
|
1818 if (error == KErrNone) |
|
1819 { |
|
1820 __UHEAP_RESET; |
|
1821 LogFormatInt(_L("Made %d attempts at calling msgSel = WapPushMsgUtils::DeleteEntryL()"), failCount); |
|
1822 finished = ETrue; |
|
1823 } |
|
1824 else // Handle error |
|
1825 { |
|
1826 gTest(error == KErrNoMemory);// Check if error is out of memory |
|
1827 __UHEAP_RESET; |
|
1828 } |
|
1829 } |
|
1830 |
|
1831 #ifndef _DEBUG |
|
1832 failCount = 1; // Bodge to stop compiler complaining on Non Debug builds |
|
1833 #endif |
|
1834 |
|
1835 #else |
|
1836 iSISLPushUtilities->DeleteEntryL(iExpired); |
|
1837 #endif |
|
1838 CMsvEntry* msvEntry = iPushUtilities->Session().GetEntryL(iExpired); |
|
1839 CleanupStack::PushL(msvEntry); |
|
1840 TMsvEntry entry = msvEntry->Entry(); |
|
1841 if (CWapPushMsgUtils::IsDeleted(entry)) |
|
1842 { |
|
1843 LogFormatInt(_L("Msg 0x%08X has been flagged for deletion"), iExpired); |
|
1844 } |
|
1845 else |
|
1846 { |
|
1847 LogFormatInt(_L("Msg 0x%08X has not been flagged for deletion"), iExpired); |
|
1848 } |
|
1849 |
|
1850 CleanupStack::PopAndDestroy();//msvEntry |
|
1851 } |
|
1852 |
|
1853 |
|
1854 |
|
1855 // Use if you want to see the contents of ALL the messages for a particular type |
|
1856 void CPushEntryTester::DumpPushMessageDetailsL(TUid aPushType) |
|
1857 { |
|
1858 TPtrC ptr; |
|
1859 TBuf<255> buffer; |
|
1860 if (aPushType== KUidWapPushMsgSI) |
|
1861 ptr.Set(_L("SI")); |
|
1862 else if (aPushType ==KUidWapPushMsgSL) |
|
1863 ptr.Set(_L("SL")); |
|
1864 else if (aPushType == KUidWapPushMsgMultiPart) |
|
1865 ptr.Set(_L("MULTI")); |
|
1866 else if (aPushType == KUidWapPushMsgUnknown) |
|
1867 ptr.Set(_L("UNKNOWN")); |
|
1868 else |
|
1869 ptr.Set(_L("Unrecognised type")); |
|
1870 |
|
1871 LogFormatStr(_L("***** Displaying details of all %S messages *****"),ptr); |
|
1872 |
|
1873 TMsvSelectionOrdering sort; |
|
1874 sort.SetShowInvisibleEntries(ETrue); |
|
1875 iMsvEntry->SetSortTypeL(sort); |
|
1876 |
|
1877 if (iPushMsgFolderId ==KMsvNullIndexEntryId) // Shouldn't be |
|
1878 iSISLPushUtilities->GetPushMsgFolderIdL(iPushMsgFolderId); |
|
1879 |
|
1880 iMsvEntry->SetEntryL(iPushMsgFolderId); |
|
1881 CMsvEntrySelection* children; |
|
1882 children = iMsvEntry->ChildrenWithMtmL(KUidMtmWapPush); |
|
1883 CleanupStack::PushL(children); |
|
1884 |
|
1885 CMsvEntrySelection* pushSel = new (ELeave) CMsvEntrySelection; |
|
1886 CleanupStack::PushL(pushSel); |
|
1887 |
|
1888 for (TInt count = 0; count <children->Count(); count++) |
|
1889 { |
|
1890 iMsvEntry->SetEntryL(children->At(count)); |
|
1891 if (iMsvEntry->Entry().iBioType == aPushType.iUid) |
|
1892 pushSel->AppendL(children->At(count)); |
|
1893 } |
|
1894 |
|
1895 buffer.Format(_L("***** Have %d %S messages in folder ******"), pushSel->Count(), &ptr); |
|
1896 LogStr(buffer); |
|
1897 for (TInt out=0; out< pushSel->Count(); out++) |
|
1898 { |
|
1899 if (pushSel->At(out) != KMsvNullIndexEntryId) |
|
1900 { |
|
1901 TBool streamExists=EFalse; |
|
1902 iMsvEntry->SetEntryL(pushSel->At(out)); |
|
1903 |
|
1904 LogFormatInt(_L("Details for message %d"), out+1); |
|
1905 if (iMsvEntry->HasStoreL()) |
|
1906 { |
|
1907 CMsvStore* store = iMsvEntry->ReadStoreL(); |
|
1908 CleanupStack::PushL(store); |
|
1909 if (store->IsPresentL(aPushType) ) |
|
1910 streamExists =ETrue; |
|
1911 CleanupStack::PopAndDestroy(); |
|
1912 } |
|
1913 if (streamExists) |
|
1914 { |
|
1915 if (aPushType == KUidWapPushMsgSI) |
|
1916 { |
|
1917 CSIPushMsgEntry* siMsg = CSIPushMsgEntry::NewL(); |
|
1918 CleanupStack::PushL(siMsg); |
|
1919 siMsg->RetrieveL(iPushUtilities->Session(), pushSel->At(out)); |
|
1920 OutputMessageDetailsL(*siMsg); |
|
1921 CleanupStack::PopAndDestroy(); |
|
1922 } |
|
1923 else if (aPushType == KUidWapPushMsgSL) |
|
1924 { |
|
1925 CSLPushMsgEntry* slMsg = CSLPushMsgEntry::NewL(); |
|
1926 CleanupStack::PushL(slMsg); |
|
1927 slMsg->RetrieveL(iPushUtilities->Session(), pushSel->At(out)); |
|
1928 OutputMessageDetailsL(*slMsg); |
|
1929 CleanupStack::PopAndDestroy(); |
|
1930 } |
|
1931 else if (aPushType == KUidWapPushMsgMultiPart) |
|
1932 { |
|
1933 CMultiPartPushMsgEntry* multiMsg = CMultiPartPushMsgEntry::NewL(); |
|
1934 CleanupStack::PushL(multiMsg); |
|
1935 multiMsg->RetrieveL(iPushUtilities->Session(), pushSel->At(out)); |
|
1936 OutputMessageDetailsL(*multiMsg); |
|
1937 CleanupStack::PopAndDestroy(); |
|
1938 } |
|
1939 else if (aPushType == KUidWapPushMsgUnknown) |
|
1940 { |
|
1941 CUnknownPushMsgEntry* unknownMsg = CUnknownPushMsgEntry::NewL(); |
|
1942 CleanupStack::PushL(unknownMsg); |
|
1943 unknownMsg->RetrieveL(iPushUtilities->Session(), pushSel->At(out)); |
|
1944 OutputMessageDetailsL(*unknownMsg); |
|
1945 CleanupStack::PopAndDestroy(); |
|
1946 } |
|
1947 |
|
1948 } |
|
1949 else |
|
1950 { |
|
1951 __LOG_DEBUG("No stream found!. Not a proper a Push Message."); |
|
1952 OutputTMsvEntryDetailsL(iMsvEntry->Entry()); |
|
1953 buffer.Format(_L("%S Msg 0x%08X Stream with %S Uid not found"),ptr, iMsvEntry->Entry().Id(), ptr); |
|
1954 } |
|
1955 } |
|
1956 } |
|
1957 CleanupStack::PopAndDestroy(2); //siSel, children |
|
1958 iMsvEntry->SetEntryL(KMsvRootIndexEntryId); |
|
1959 } |
|
1960 |
|
1961 |
|
1962 |
|
1963 void CPushEntryTester::CreateHeaders() |
|
1964 { |
|
1965 TUint8 value=0; |
|
1966 TInt i; |
|
1967 for (i=0; i<34; i++) |
|
1968 { |
|
1969 value = KMessageHeader2[i]; |
|
1970 iDummyHeader1.Append(value); |
|
1971 } |
|
1972 |
|
1973 for (i=0; i<9; i++) |
|
1974 { |
|
1975 value = KMessageHeader3[i]; |
|
1976 iDummyHeader2.Append(value); |
|
1977 } |
|
1978 } |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 void CPushEntryTester::CreateMsgDetailsL(TBool aNullFields) |
|
1984 { |
|
1985 iDetails->ResetL(); |
|
1986 if (aNullFields) // ==ETrue |
|
1987 { |
|
1988 iDetails->iNullEntries = ETrue; |
|
1989 return; |
|
1990 } |
|
1991 iDetails->iNullEntries =EFalse; |
|
1992 *iDetails->iSiId = KSiID1; |
|
1993 iDetails->iStatusFlag = 4; // Not a valid value, but tests that it's set okay |
|
1994 iDetails->iActionFlag = 1; // CSIPushMsgEntry::ESIPushMsgSignalNone & CSLPushMsgEntry::ESLPushMsgExecuteLow; |
|
1995 //iCreated leave as is 00.00.00 GMT 00-00-0000 |
|
1996 iDetails->iCreated=KDateExpiry1; |
|
1997 iDetails->iExpires=KDateExpiry1; // 12.00.00 GMT 26-07-2000 |
|
1998 *iDetails->iContentType =_L("image/jpeg"); |
|
1999 *iDetails->iURL=KUrl1; |
|
2000 *iDetails->iText=_L("Some Text"); |
|
2001 *iDetails->iFrom =_L8("Fred Smith"); |
|
2002 *iDetails->iHeader =iDummyHeader1; |
|
2003 *iDetails->iMessageBody=KDummyBody; |
|
2004 *iDetails->iFilename = KFilename; |
|
2005 } |
|
2006 |
|
2007 // Create another 4 SI Push Entries in the message folder. |
|
2008 void CPushEntryTester::CreateMoreSiMessagesL() |
|
2009 { |
|
2010 TMsvId msgEntryId =0; |
|
2011 TBuf<255> buffer; |
|
2012 |
|
2013 CreateMsgDetailsL(EFalse); |
|
2014 if (iPushMsgFolderId ==KMsvNullIndexEntryId) |
|
2015 iSISLPushUtilities->GetPushMsgFolderIdL(iPushMsgFolderId); |
|
2016 __LOG_DEBUG("Created additional SI Entries"); |
|
2017 for (TInt count =0; count<4; count++) |
|
2018 { |
|
2019 CSIPushMsgEntry* siMsg = CSIPushMsgEntry::NewL(); |
|
2020 CleanupStack::PushL(siMsg); |
|
2021 |
|
2022 siMsg->SetHeaderL(*iDetails->iHeader); |
|
2023 siMsg->SetStatus(iDetails->iStatusFlag); |
|
2024 siMsg->SetCreated(iDetails->iCreated); |
|
2025 siMsg->SetTextL(*iDetails->iText); |
|
2026 siMsg->SetFromL(*iDetails->iFrom); |
|
2027 switch (count) |
|
2028 { |
|
2029 case 0: |
|
2030 siMsg->SetIdL(KSiID2); |
|
2031 siMsg->SetUrlL(KUrl2); |
|
2032 siMsg->SetExpires(KDateExpiry2); |
|
2033 break; |
|
2034 case 1: |
|
2035 siMsg->SetIdL(KSiID3); |
|
2036 siMsg->SetUrlL(KUrl3); |
|
2037 siMsg->SetExpires(KDateExpiry3); |
|
2038 break; |
|
2039 case 2: |
|
2040 siMsg->SetIdL(KSiID4); |
|
2041 siMsg->SetUrlL(KUrl4); |
|
2042 siMsg->SetExpires(KDateExpiry4); |
|
2043 break; |
|
2044 case 3: |
|
2045 siMsg->SetIdL(KSiID5); |
|
2046 siMsg->SetUrlL(KUrl5); |
|
2047 siMsg->SetExpires(KDateExpiry5); |
|
2048 break; |
|
2049 } |
|
2050 siMsg->SetAction(count+2); |
|
2051 msgEntryId = siMsg->SaveL(iPushUtilities->Session(),iPushMsgFolderId); |
|
2052 TTime expiryDate = siMsg->Expires().Int64(); |
|
2053 expiryDate.FormatL(buffer, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2054 LogFormatStr(_L("Expires date := %S"), buffer); |
|
2055 |
|
2056 |
|
2057 buffer.Format(_L("Msg 0x%08X with ID=%S, URL=%S, Action=%d"), |
|
2058 msgEntryId, &(siMsg->Id()), &(siMsg->Url()),count+2); |
|
2059 LogStr(buffer); |
|
2060 |
|
2061 if (count == 1) |
|
2062 { |
|
2063 iTargetSiIDMsg = msgEntryId; |
|
2064 iTargetSIUrlMsg = msgEntryId; |
|
2065 } |
|
2066 CleanupStack::PopAndDestroy(); |
|
2067 } |
|
2068 iHighestSIActionID = msgEntryId; //Hold on to this for later check |
|
2069 } |
|
2070 |
|
2071 |
|
2072 void CPushEntryTester::CreateMoreSLMessagesL() |
|
2073 { |
|
2074 TMsvId msgEntryId =0; |
|
2075 TBuf<255> buffer; |
|
2076 |
|
2077 CreateMsgDetailsL(EFalse); |
|
2078 if (iPushMsgFolderId ==KMsvNullIndexEntryId) |
|
2079 iSISLPushUtilities->GetPushMsgFolderIdL(iPushMsgFolderId); |
|
2080 |
|
2081 for (TInt count =0; count<4; count++) |
|
2082 { |
|
2083 CSLPushMsgEntry* slMsg = CSLPushMsgEntry::NewL(); |
|
2084 CleanupStack::PushL(slMsg); |
|
2085 |
|
2086 slMsg->SetHeaderL(*iDetails->iHeader); |
|
2087 slMsg->SetStatus(iDetails->iStatusFlag); |
|
2088 slMsg->SetFromL(*iDetails->iFrom); |
|
2089 switch (count) |
|
2090 { |
|
2091 case 0: |
|
2092 slMsg->SetUrlL(KUrl2); |
|
2093 break; |
|
2094 case 1: |
|
2095 slMsg->SetUrlL(KUrl3); |
|
2096 break; |
|
2097 case 2: |
|
2098 slMsg->SetUrlL(KUrl4); |
|
2099 break; |
|
2100 case 3: |
|
2101 slMsg->SetUrlL(KUrl5); |
|
2102 break; |
|
2103 default: |
|
2104 slMsg->SetUrlL(*iDetails->iURL); |
|
2105 |
|
2106 } |
|
2107 slMsg->SetAction(count+2); |
|
2108 msgEntryId = slMsg->SaveL(iPushUtilities->Session(),iPushMsgFolderId); |
|
2109 buffer.Format(_L("Created SL message 0x%08X with URL = %S, Action = %d"), msgEntryId, &(slMsg->Url()), count+2); |
|
2110 LogStr(buffer); |
|
2111 if (count == 1) |
|
2112 iTargetSLUrlMsg = msgEntryId; |
|
2113 CleanupStack::PopAndDestroy();//slMsg |
|
2114 } |
|
2115 iHighestSLActionID = msgEntryId; //Hold on to this for later check |
|
2116 } |
|
2117 |
|
2118 |
|
2119 |
|
2120 void CPushEntryTester::CreateMultiChildrenL(TMsvId aParentEntry) |
|
2121 { |
|
2122 // Create and Save SI child entry |
|
2123 CUnknownPushMsgEntry* child = CUnknownPushMsgEntry::NewL(); |
|
2124 CleanupStack::PushL(child); |
|
2125 child->SetHeaderL(*iDetails->iHeader); |
|
2126 child->SetMessageDataL(*iDetails->iMessageBody); |
|
2127 child->SetContentTypeL(_L("text/vnd.wap.si")); |
|
2128 child->SetFromL(*iDetails->iFrom); |
|
2129 child->SaveL(iPushUtilities->Session(),aParentEntry); |
|
2130 |
|
2131 // Create and Save SL child entry |
|
2132 child->SetHeaderL(TPtrC8(KMessageHeader3)); |
|
2133 child->SetFromL(*iDetails->iFrom); |
|
2134 child->SetContentTypeL(_L("text/vnd.wap.sl")); |
|
2135 child->SetTimeSent(iDetails->iCreated); |
|
2136 child->SetMessageDataL(_L8("The body of a binary message - needs to be processed")); |
|
2137 child->SaveL(iPushUtilities->Session(), aParentEntry); |
|
2138 |
|
2139 // Create and Save WML child entry |
|
2140 child->SetHeaderL(TPtrC8(KMessageHeader3)); |
|
2141 child->SetFromL(*iDetails->iFrom); |
|
2142 child->SetContentTypeL(_L("text/vnd.wap.wml")); |
|
2143 child->SetTimeSent(iDetails->iCreated); |
|
2144 child->SetMessageDataL(_L8("<wml>\n <card id= \"card1 \" title= \"Crystal Demo \" >\n <wml\\>")); |
|
2145 child->SaveL(iPushUtilities->Session(), aParentEntry); |
|
2146 |
|
2147 // Create and Save HTML child entry |
|
2148 child->SetHeaderL(TPtrC8(KMessageHeader3)); |
|
2149 child->SetFromL(*iDetails->iFrom); |
|
2150 child->SetContentTypeL(_L("text/html")); |
|
2151 child->SetTimeSent(iDetails->iCreated); |
|
2152 child->SetMessageDataL(_L8("<html> Some HTML for a web page <html>")); |
|
2153 child->SaveL(iPushUtilities->Session(), aParentEntry); |
|
2154 |
|
2155 // Create and Save GIF child entry |
|
2156 child->SetHeaderL(TPtrC8(KMessageHeader3)); |
|
2157 child->SetFromL(*iDetails->iFrom); |
|
2158 child->SetContentTypeL(_L("image/gif")); |
|
2159 child->SetTimeSent(iDetails->iCreated); |
|
2160 child->SetMessageDataL(_L8("A binary GIF file qasdghgf92tkug;,b voif0r.,,ASFSrrf")); |
|
2161 child->SaveL(iPushUtilities->Session(), aParentEntry); |
|
2162 |
|
2163 // Create and Save XML child entry |
|
2164 child->SetHeaderL(TPtrC8(KMessageHeader3)); |
|
2165 child->SetFromL(*iDetails->iFrom); |
|
2166 child->SetContentTypeL(_L("application/xml")); |
|
2167 child->SetTimeSent(iDetails->iCreated); |
|
2168 child->SetMessageDataL(_L8("<XML> A little bit of XML <XML\\>")); |
|
2169 child->SaveL(iPushUtilities->Session(), aParentEntry); |
|
2170 |
|
2171 CleanupStack::PopAndDestroy(); |
|
2172 } |
|
2173 |
|
2174 |
|
2175 |
|
2176 // Prints & Logs the details of a TMsvEntry |
|
2177 void CPushEntryTester::OutputTMsvEntryDetailsL(const TMsvEntry& aEntry) |
|
2178 { |
|
2179 TPtrC truePtr; |
|
2180 TPtrC falsePtr; |
|
2181 |
|
2182 truePtr.Set(_L("ETrue")); |
|
2183 falsePtr.Set(_L("EFalse")); |
|
2184 |
|
2185 LogFormatInt(_L(" iID := 0x%08X"), aEntry.Id()); |
|
2186 LogFormatInt(_L(" Parent ID := 0x%08X"), aEntry.Parent()); |
|
2187 LogFormatInt(_L(" iService := 0x%08X"), aEntry.iServiceId); |
|
2188 LogFormatInt(_L(" iType := 0x%08X"), aEntry.iType.iUid); |
|
2189 LogFormatInt(_L(" iMtm := 0x%08X"), aEntry.iMtm.iUid); |
|
2190 LogFormatInt(_L(" iBioType := 0x%08X"), aEntry.iBioType); |
|
2191 LogFormatInt(_L(" iMtmData1 := %d"), aEntry.MtmData1()); |
|
2192 LogFormatInt(_L(" iMtmData2 := %d"), aEntry.MtmData2() ); |
|
2193 LogFormatInt(_L(" iMtmData3 := %d"), aEntry.MtmData3() ); |
|
2194 } |
|
2195 |
|
2196 void CPushEntryTester::OutputPushMsgDetailsL(const CPushMsgEntryBase& aEntry) |
|
2197 { |
|
2198 TBuf<100> temp; |
|
2199 TPtrC ptr; |
|
2200 |
|
2201 TTime date = aEntry.ReceivedDate(); |
|
2202 date.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2203 ptr.Set(temp); |
|
2204 LogFormatStr(_L(" Received Date := %S"),ptr); |
|
2205 |
|
2206 ptr.Set(aEntry.MsgDetails()); |
|
2207 LogFormatStr(_L(" iDetails(Url) := %S"),ptr); |
|
2208 ptr.Set(aEntry.MsgDescription()); |
|
2209 LogFormatStr(_L(" iDescription := %S"),ptr); |
|
2210 |
|
2211 TInt intID; |
|
2212 TBool isAnInt; |
|
2213 TPtrC8 ptr8; |
|
2214 if (aEntry.AppID(ptr8, intID, isAnInt)!=KErrNotFound) |
|
2215 { |
|
2216 if (isAnInt) |
|
2217 { |
|
2218 LogFormatInt(_L(" AppID := %d"), intID); |
|
2219 } |
|
2220 else |
|
2221 { |
|
2222 temp.Copy(ptr8); |
|
2223 LogFormatStr(_L(" AppID := %S"),temp); |
|
2224 } |
|
2225 } |
|
2226 } |
|
2227 |
|
2228 // Outputs the details of a SI Message - lists TMsvEntry first, |
|
2229 // then uses Push Entry functions - should be the same values where data's mapped to TMsvEntry |
|
2230 void CPushEntryTester::OutputMessageDetailsL(CSIPushMsgEntry& aSIEntry) |
|
2231 { |
|
2232 TMsvEntry entry = aSIEntry.Entry(); |
|
2233 TBuf<200> temp; |
|
2234 TBuf8<200> viewer; |
|
2235 TPtrC bufPtr; |
|
2236 |
|
2237 __LOG_DEBUG( " TMsvEntry values"); |
|
2238 OutputTMsvEntryDetailsL(entry); |
|
2239 OutputPushMsgDetailsL(aSIEntry); |
|
2240 |
|
2241 __LOG_DEBUG( " CSIPushMsgEntry values"); |
|
2242 LogFormatInt(_L(" Message Type := 0x%08X"), aSIEntry.Entry().iMtm.iUid); |
|
2243 LogFormatInt(_L(" Push Message Type := 0x%08X"), aSIEntry.PushMsgType()); |
|
2244 LogFormatInt(_L(" Status value := %d"), aSIEntry.Status()); |
|
2245 LogFormatInt(_L(" Action value := %d"), aSIEntry.Action()); |
|
2246 |
|
2247 viewer.Copy(aSIEntry.Id()); |
|
2248 bufPtr.Set(aSIEntry.Id()); |
|
2249 LogFormatStr(_L(" SI Id := %S"), bufPtr); |
|
2250 |
|
2251 TTime entryTime = aSIEntry.Created(); |
|
2252 temp.Zero(); |
|
2253 entryTime.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2254 bufPtr.Set(temp); |
|
2255 LogFormatStr(_L(" Created := %S"), bufPtr); |
|
2256 bufPtr.Set(aSIEntry.Url()); |
|
2257 LogFormatStr(_L(" Url := %S"), bufPtr); |
|
2258 bufPtr.Set( aSIEntry.Text()); |
|
2259 LogFormatStr(_L(" Text Info := %S"), bufPtr); |
|
2260 |
|
2261 entryTime = aSIEntry.Expires(); |
|
2262 entryTime.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2263 bufPtr.Set(temp); |
|
2264 LogFormatStr(_L(" Expires := %S"), bufPtr); |
|
2265 |
|
2266 temp.Copy(aSIEntry.Header()); |
|
2267 bufPtr.Set(temp); |
|
2268 LogFormatStr(_L(" Header := %S"), bufPtr); |
|
2269 |
|
2270 temp.Copy(aSIEntry.From()); |
|
2271 bufPtr.Set(temp); |
|
2272 LogFormatStr(_L(" From := %S"), bufPtr); |
|
2273 bufPtr.Set(aSIEntry.ContentType()); |
|
2274 LogFormatStr(_L(" Content Type := %S"), bufPtr); |
|
2275 } |
|
2276 |
|
2277 |
|
2278 // Outputs the details of a SL Message - lists TMsvEntry first, |
|
2279 // then uses Push Entry functions - should be the same values where data's mapped to TMsvEntry |
|
2280 void CPushEntryTester::OutputMessageDetailsL(CSLPushMsgEntry& aSLEntry) |
|
2281 { |
|
2282 TMsvEntry entry = aSLEntry.Entry(); |
|
2283 TBuf<200> temp; |
|
2284 TPtrC bufPtr; |
|
2285 |
|
2286 __LOG_DEBUG( " TMsvEntry values"); |
|
2287 OutputTMsvEntryDetailsL(entry); |
|
2288 OutputPushMsgDetailsL(aSLEntry); |
|
2289 |
|
2290 __LOG_DEBUG( " CSLPushMsgEntry values"); |
|
2291 LogFormatInt(_L(" Message Type := 0x%08X"), aSLEntry.Entry().iMtm.iUid); |
|
2292 LogFormatInt(_L(" Push Message Type := 0x%08X"), aSLEntry.PushMsgType()); |
|
2293 TTime entryTime = aSLEntry.TimeSent(); |
|
2294 temp.Zero(); |
|
2295 entryTime.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2296 bufPtr.Set(temp); |
|
2297 LogFormatStr(_L(" Message Date := %S"), bufPtr); |
|
2298 LogFormatInt(_L(" Status value := %d"), aSLEntry.Status()); |
|
2299 LogFormatInt(_L(" Action value := %d"), aSLEntry.Action()); |
|
2300 |
|
2301 bufPtr.Set(aSLEntry.Url()); |
|
2302 LogFormatStr(_L(" Url := %S"), bufPtr); |
|
2303 |
|
2304 temp.Copy(aSLEntry.Header()); |
|
2305 bufPtr.Set(temp); |
|
2306 LogFormatStr(_L(" Header := %S"), bufPtr); |
|
2307 |
|
2308 temp.Copy(aSLEntry.From()); |
|
2309 bufPtr.Set(temp); |
|
2310 LogFormatStr(_L(" From := %S"), bufPtr); |
|
2311 bufPtr.Set(aSLEntry.ContentType()); |
|
2312 LogFormatStr(_L(" Content Type := %S"), bufPtr); |
|
2313 } |
|
2314 |
|
2315 // Outputs the details of an Unknown Push Message - lists TMsvEntry first, |
|
2316 // then uses Push Entry functions - should be the same values where data's mapped to TMsvEntry |
|
2317 void CPushEntryTester::OutputMessageDetailsL(CUnknownPushMsgEntry& aUnknownEntry) |
|
2318 { |
|
2319 TMsvEntry entry = aUnknownEntry.Entry(); |
|
2320 TBuf<200> temp; |
|
2321 TPtrC bufPtr; |
|
2322 |
|
2323 __LOG_DEBUG("TMsvEntry values"); |
|
2324 OutputTMsvEntryDetailsL(entry); |
|
2325 OutputPushMsgDetailsL(aUnknownEntry); |
|
2326 |
|
2327 __LOG_DEBUG("CUnknownPushMsgEntry values"); |
|
2328 LogFormatInt(_L(" Message Type := 0x%08X"), aUnknownEntry.Entry().iMtm.iUid); |
|
2329 LogFormatInt(_L(" Push Message Type := 0x%08X"), aUnknownEntry.PushMsgType()); |
|
2330 LogFormatInt(_L(" Status value := %d"), aUnknownEntry.Status()); |
|
2331 |
|
2332 TTime entryTime = aUnknownEntry.TimeSent(); |
|
2333 temp.Zero(); |
|
2334 entryTime.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2335 bufPtr.Set(temp); |
|
2336 LogFormatStr(_L(" Message Date := %S"), bufPtr); |
|
2337 |
|
2338 bufPtr.Set(aUnknownEntry.ContentType()); |
|
2339 LogFormatStr(_L(" Content-Type := %S"), bufPtr ); |
|
2340 bufPtr.Set(aUnknownEntry.ContentFileNameL()); |
|
2341 LogFormatStr(_L(" Content-Filename := %S"), bufPtr ); |
|
2342 |
|
2343 temp.Copy(aUnknownEntry.Header()); |
|
2344 bufPtr.Set(temp); |
|
2345 LogFormatStr(_L(" Header := %S"), bufPtr); |
|
2346 temp.Copy(aUnknownEntry.From()); |
|
2347 bufPtr.Set(temp); |
|
2348 LogFormatStr(_L(" From := %S"), bufPtr); |
|
2349 |
|
2350 |
|
2351 HBufC* buffer = HBufC::NewL(aUnknownEntry.MessageData().Length()); |
|
2352 buffer->Des().Copy(aUnknownEntry.MessageData()); |
|
2353 bufPtr.Set(buffer->Des()); |
|
2354 LogFormatStr(_L(" Message Data := %S"), bufPtr); |
|
2355 delete buffer; |
|
2356 } |
|
2357 |
|
2358 // Outputs the details of a MultiPart Message - lists TMsvEntry first, |
|
2359 // then uses Push Entry functions - should be the same values where data's mapped to TMsvEntry |
|
2360 void CPushEntryTester::OutputMessageDetailsL(CMultiPartPushMsgEntry& aMultiEntry) |
|
2361 { |
|
2362 TMsvEntry entry = aMultiEntry.Entry(); |
|
2363 TBuf<200> temp; |
|
2364 TPtrC bufPtr; |
|
2365 |
|
2366 __LOG_DEBUG( " TMsvEntry values"); |
|
2367 OutputTMsvEntryDetailsL(entry); |
|
2368 OutputPushMsgDetailsL(aMultiEntry); |
|
2369 |
|
2370 __LOG_DEBUG( " CMultiPartPushMsgEntry values"); |
|
2371 LogFormatInt(_L(" Message Type := 0x%08X"), aMultiEntry.Entry().iMtm.iUid); |
|
2372 LogFormatInt(_L(" Push Message Type := 0x%08X"), aMultiEntry.PushMsgType()); |
|
2373 LogFormatInt(_L(" Status value := %d"), aMultiEntry.Status()); |
|
2374 |
|
2375 TTime entryTime = aMultiEntry.TimeSent(); |
|
2376 temp.Zero(); |
|
2377 entryTime.FormatL(temp, _L("%-B%:0%J%:1%T%:2%S%+B %D %N %Y %4 %5 %3" ) ); |
|
2378 bufPtr.Set(temp); |
|
2379 LogFormatStr(_L(" Message Date := %S"), bufPtr); |
|
2380 |
|
2381 |
|
2382 bufPtr.Set(aMultiEntry.ContentType()); |
|
2383 LogFormatStr(_L(" Content-Type := %S"), bufPtr); |
|
2384 temp.Copy(aMultiEntry.Header()); |
|
2385 bufPtr.Set(temp); |
|
2386 LogFormatStr(_L(" Header := %S"), bufPtr); |
|
2387 temp.Copy(aMultiEntry.From()); |
|
2388 bufPtr.Set(temp); |
|
2389 LogFormatStr(_L(" From := %S"), bufPtr); |
|
2390 } |
|
2391 |
|
2392 |
|
2393 /** Set up push folder in the message server */ |
|
2394 LOCAL_C TMsvId SetupPushServiceL() |
|
2395 { |
|
2396 gTest.Printf(_L("Getting Service Id")); |
|
2397 CWapPushTestMsgUtils* myTestUtils = CWapPushTestMsgUtils::NewL(); |
|
2398 CleanupStack::PushL(myTestUtils); |
|
2399 // Uncomment this if you want to remove existing service entries |
|
2400 //myTestUtils->ClearExistingServiceEntriesL(KUidMtmWapPush); |
|
2401 |
|
2402 CMsvEntrySelection* idArray = new (ELeave) CMsvEntrySelection(); |
|
2403 CleanupStack::PushL(idArray); |
|
2404 |
|
2405 TMsvId pushService =KMsvNullIndexEntryId; |
|
2406 myTestUtils->PushServiceIdL(pushService,idArray); |
|
2407 |
|
2408 if ((pushService == KMsvNullIndexEntryId) && (idArray->Count() ==0) ) // Found no service |
|
2409 { |
|
2410 gTest.Printf(_L("No Service found - creating new one")); |
|
2411 pushService = myTestUtils->CreateServiceL(); |
|
2412 gTest.Printf(_L("Created New Service Entry Id 0x%08X"), pushService); |
|
2413 } |
|
2414 else |
|
2415 { |
|
2416 gTest.Printf(_L("Found %d service entries\n"), idArray->Count()); |
|
2417 for (TInt count=0; count < idArray->Count(); count++) |
|
2418 { |
|
2419 gTest.Printf(_L("Entry %d - Service Id 0x%08X"), count, idArray->At(count)); |
|
2420 } |
|
2421 } |
|
2422 |
|
2423 idArray->Reset(); |
|
2424 |
|
2425 // Remove the message folder - test if the Msg Utils create if it's not there. |
|
2426 // myTestUtils->RemoveAllPushFolderEntriesL(); |
|
2427 |
|
2428 TMsvId pushFolder=KMsvNullIndexEntryId; |
|
2429 myTestUtils->PushFolderIdL(pushFolder, idArray); |
|
2430 |
|
2431 if ((pushFolder == KMsvNullIndexEntryId) && (idArray->Count() ==0) ) // Found no service |
|
2432 { |
|
2433 gTest.Printf(_L("No Push Msg Folder found - creating new one")); |
|
2434 pushFolder = myTestUtils->CreatePushMsgFolderL(); |
|
2435 gTest.Printf(_L("Created New Push Folder Entry Id 0x%08X"), pushFolder); |
|
2436 |
|
2437 } |
|
2438 else |
|
2439 { |
|
2440 gTest.Printf(_L("Found %d Push Folder entries\n"), idArray->Count()); |
|
2441 for (TInt count=0; count < idArray->Count(); count++) |
|
2442 { |
|
2443 gTest.Printf(_L("Entry %d - Folder Id 0x%08X"), count, idArray->At(count)); |
|
2444 } |
|
2445 } |
|
2446 |
|
2447 //Clean out all previous push entries from under the Push Service Entry |
|
2448 //myTestUtils->RemoveServiceEntryChildrenL(pushService); |
|
2449 |
|
2450 |
|
2451 // Clean the push msg folder of existing entries |
|
2452 myTestUtils->RemoveEntriesFromLocalServiceFolderL(pushFolder, KUidMtmWapPush); |
|
2453 myTestUtils->RemoveEntriesFromLocalServiceFolderL(KMsvGlobalInBoxIndexEntryIdValue, KUidMtmWapPush); |
|
2454 |
|
2455 CleanupStack::PopAndDestroy(2); //myTestUtils, idArray |
|
2456 return pushFolder; |
|
2457 } |
|
2458 |
|
2459 |
|
2460 /** setup test environment, create CPushEntryTester object and run tests */ |
|
2461 LOCAL_C void doMainL() |
|
2462 { |
|
2463 gTest.Start(KPushEntryTestTitle); |
|
2464 gTest.Printf(_L("@SYMTestCaseID IWS-WAPBROWSER-PUSHMSGENTRY-T_PUSHENTRY-0001 ")); |
|
2465 |
|
2466 CTestScheduler* activeScheduler = new CTestScheduler; |
|
2467 gTest(activeScheduler!=NULL); |
|
2468 CActiveScheduler::Install(activeScheduler); |
|
2469 CleanupStack::PushL(activeScheduler); |
|
2470 |
|
2471 CWapPushLog* log = CWapPushLog::NewL(*gTest.Console()); |
|
2472 log->SetLogFileName(_L("TPushEntry.txt")); |
|
2473 CleanupStack::PushL(log); |
|
2474 CPushEntryTester* myTester = CPushEntryTester::NewL(*log); |
|
2475 CleanupStack::PushL(myTester); |
|
2476 TMsvId pushFolder = SetupPushServiceL(); |
|
2477 myTester->SetPushFolderId(pushFolder); |
|
2478 myTester->StartL(); |
|
2479 |
|
2480 CActiveScheduler::Start(); |
|
2481 |
|
2482 CleanupStack::PopAndDestroy(3); //activeScheduler, log, myTester |
|
2483 gTest.End(); |
|
2484 gTest.Close(); |
|
2485 } |
|
2486 |
|
2487 |
|
2488 /** entry point for test executable */ |
|
2489 GLDEF_C TInt E32Main() |
|
2490 { |
|
2491 __UHEAP_MARK; |
|
2492 |
|
2493 CTrapCleanup* theCleanup = CTrapCleanup::New(); |
|
2494 TRAPD(ret,doMainL()); |
|
2495 gTest(ret==KErrNone); |
|
2496 delete theCleanup; |
|
2497 |
|
2498 __UHEAP_MARKEND; |
|
2499 return(KErrNone); |
|
2500 } |