|
1 // Copyright (c) 1998-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 // Name of test harness: T_SMTSND |
|
15 // Component: IMCM |
|
16 // Owner: KP |
|
17 // Brief description of test harness: |
|
18 // Tests SMTP SendAs functionality - creates SMTP messages; adds recipients; |
|
19 // store the body text; saves message; adds/removes attachments; |
|
20 // Detailed description of test harness: |
|
21 // As above. |
|
22 // Input files required to run test harness: |
|
23 // \MSG\IMCMTSRC\rfc82201.txt <DRIVE>:\msgtest\imcm\rfc82201.txt |
|
24 // Intermediate files produced while running test harness: |
|
25 // <DRIVE>:\msglogs\T_SMTSND\T_IMCM.log |
|
26 // Output files produced by running test harness: |
|
27 // <DRIVE>:\msglogs\T_SMTSND.<PLATFORM>.<VARIANT>.LOG.txt |
|
28 // Description of how to build test harness: |
|
29 // cd \msg\imcm\ |
|
30 // bldmake bldfiles |
|
31 // abld test build |
|
32 // Description of how to run test harness: |
|
33 // The following instructions are the same for all platforms: |
|
34 // 1. Build T_DB test harness from COMMDB component: |
|
35 // cd \commdb\group |
|
36 // bldmake bldfiles |
|
37 // abld test build t_db |
|
38 // 2. Build the test utilities: |
|
39 // cd \msg\testutils\group\ |
|
40 // bldmake bldfiles |
|
41 // abld build |
|
42 // WINS running instructions: |
|
43 // 1. \epoc32\release\wins\<VARIANT>\T_SMTSND.exe can be used at the command prompt |
|
44 // or executable can be run from Windows Explorer. |
|
45 // All other platform running instructions: |
|
46 // 1. Copy \epoc32\release\<PLATFORM>\<VARIANT>\T_SMTSND.exe onto the other platform |
|
47 // 2. Copy \epoc32\release\<PLATFORM>\<VARIANT>\MSVTESTUTILS.DLL into |
|
48 // <DRIVE>:\system\libs on the other platform |
|
49 // 3. Copy \epoc32\release\<PLATFORM>\<VARIANT>\EMAILTESTUTILS.DLL into |
|
50 // <DRIVE>:\system\libs on the other platform |
|
51 // 4. Run T_SMTSND.exe on the other platform |
|
52 // |
|
53 // |
|
54 |
|
55 #include "emailtestutils.h" |
|
56 #include <e32uid.h> |
|
57 #include <txtrich.h> |
|
58 #include <msvids.h> |
|
59 #include "smtcmtm.h" // CSmtpClientMtm |
|
60 #include "smtpset.h" // CImSmtpSettings |
|
61 #include <miutmsg.h> |
|
62 #include "miutlog.h" // CImLog |
|
63 #include <mtmuids.h> |
|
64 #include <mtmdef.h> |
|
65 #include <cemailaccounts.h> |
|
66 |
|
67 #include <mmsvattachmentmanager.h> |
|
68 #include <sendas2.h> |
|
69 |
|
70 RTest test(_L("SMTP SendAs Testrig")); |
|
71 LOCAL_D CTrapCleanup* theCleanup; |
|
72 LOCAL_D CEmailTestUtils* testUtils; |
|
73 LOCAL_D CImLog* log; |
|
74 |
|
75 #define KRecipient _L("test@psion9.demon.co.uk") |
|
76 #define KRecipientAlias _L("Test Account") |
|
77 |
|
78 |
|
79 // |
|
80 |
|
81 |
|
82 // |
|
83 |
|
84 LOCAL_C void InitL() |
|
85 { |
|
86 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
|
87 CActiveScheduler::Install(scheduler); |
|
88 CleanupStack::PushL(scheduler); |
|
89 |
|
90 testUtils = CEmailTestUtils::NewLC(test); |
|
91 testUtils->CreateAllTestDirectories(); |
|
92 testUtils->FileSession().SetSessionPath(_L("C:\\")); |
|
93 testUtils->CleanMessageFolderL(); |
|
94 testUtils->ClearEmailAccountsL(); |
|
95 |
|
96 testUtils->GoServerSideL(); |
|
97 |
|
98 test.Next(_L("Create Data Component FileStores")); |
|
99 testUtils->CreateSmtpServerMtmRegL(); |
|
100 |
|
101 // Loading the DLLs |
|
102 testUtils->CreateRegistryObjectAndControlL(); |
|
103 testUtils->InstallSmtpMtmGroupL(); |
|
104 |
|
105 log = CImLog::NewL(_L("c:\\logs\\email\\T_IMCM.log"), EAppend); |
|
106 CleanupStack::PushL(log); |
|
107 log->AppendComment(_L8("******** T_SMTSND Test (SMTP) Send As API ********")); |
|
108 TBuf8<80> buf; |
|
109 #if defined(__WINS__) |
|
110 buf.Append(_L8("WINS ")); |
|
111 #else |
|
112 buf.Append(_L8("MARM ")); |
|
113 #endif |
|
114 #if defined(_UNICODE) |
|
115 buf.Append(_L8("U")); |
|
116 #endif |
|
117 #if defined(_DEBUG) |
|
118 buf.Append(_L8("DEB")); |
|
119 #else |
|
120 buf.Append(_L8("REL")); |
|
121 #endif |
|
122 log->AppendComment(buf); |
|
123 } |
|
124 |
|
125 LOCAL_C void Closedown() |
|
126 { |
|
127 log->AppendComment(_L8("********** T_SMTSND Tests Complete **********")); |
|
128 log->AppendComment(_L8("")); |
|
129 |
|
130 CleanupStack::PopAndDestroy(3); //testUtils, log, scheduler |
|
131 } |
|
132 |
|
133 // |
|
134 |
|
135 LOCAL_C void TestSMTSendL(CMsvEntry& aEntry, TMsvId aDestination) |
|
136 { |
|
137 // Get count of children |
|
138 aEntry.SetEntryL(KMsvRootIndexEntryId); |
|
139 aEntry.SetEntryL(aDestination); |
|
140 TInt children = aEntry.Count(); |
|
141 |
|
142 CTestTimer* timer = CTestTimer::NewL(); |
|
143 timer->After(0x200000); |
|
144 CActiveScheduler::Start(); |
|
145 delete timer; |
|
146 |
|
147 // rich text |
|
148 CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); |
|
149 CleanupStack::PushL(paraFormatLayer); |
|
150 |
|
151 CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); |
|
152 CleanupStack::PushL(charFormatLayer); |
|
153 |
|
154 CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256); |
|
155 CleanupStack::PushL(bodyText); |
|
156 |
|
157 TBuf<100> bodyContents = _L("Test body contents so that we can test the SendAs API. We \06 can try using a delimiter"); |
|
158 bodyText->InsertL(0, bodyContents); |
|
159 |
|
160 |
|
161 RSendAs sa; |
|
162 TInt err = sa.Connect(); |
|
163 User::LeaveIfError(err); |
|
164 CleanupClosePushL(sa); |
|
165 |
|
166 RSendAsMessage sa_msg; |
|
167 sa_msg.CreateL(sa, KUidMsgTypeSMTP); |
|
168 |
|
169 CleanupClosePushL(sa_msg); |
|
170 |
|
171 sa_msg.AddRecipientL(KRecipient, RSendAsMessage::ESendAsRecipientTo); |
|
172 sa_msg.AddRecipientL(KRecipient, KRecipientAlias, RSendAsMessage::ESendAsRecipientTo); |
|
173 |
|
174 sa_msg.SetSubjectL(_L("t_smtsnd message test 1")); |
|
175 sa_msg.SetBodyTextL(*bodyText); |
|
176 |
|
177 sa_msg.SaveMessageAndCloseL(); |
|
178 |
|
179 CleanupStack::Pop(); // sa_msg |
|
180 CleanupStack::PopAndDestroy(); // sa |
|
181 |
|
182 |
|
183 // Check child count has increased |
|
184 aEntry.SetEntryL(KMsvRootIndexEntryId); |
|
185 aEntry.SetEntryL(aDestination); |
|
186 test(aEntry.Count() == children + 1); |
|
187 |
|
188 // Check the body text |
|
189 |
|
190 // ok, need to find the message entry |
|
191 TMsvId message = 0x00000000; |
|
192 TMsvEntry msgEntry; |
|
193 TBool found = EFalse; |
|
194 CMsvEntrySelection* sel = aEntry.ChildrenL(); |
|
195 CleanupStack::PushL(sel); |
|
196 |
|
197 // Loop through the sub-entries |
|
198 for(TInt i=0;i<sel->Count();i++) |
|
199 { |
|
200 // Reset the entry to the child[i] |
|
201 aEntry.SetEntryL(sel->At(i)); |
|
202 msgEntry = aEntry.Entry(); |
|
203 if (msgEntry.iDescription.Compare(_L("t_smtsnd message test 1")) == 0) |
|
204 { |
|
205 message = aEntry.EntryId(); |
|
206 found = ETrue; |
|
207 break; |
|
208 } |
|
209 } |
|
210 |
|
211 CleanupStack::PopAndDestroy(); // sel |
|
212 |
|
213 // make sure we actually found our message |
|
214 if (!found) |
|
215 User::Leave(KErrNotFound); |
|
216 |
|
217 |
|
218 // Check we've got what we wanted |
|
219 aEntry.SetEntryL(message); |
|
220 test(aEntry.Entry().Parent() == aDestination); |
|
221 |
|
222 CRichText* validRichText1=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256); |
|
223 CleanupStack::PushL(validRichText1); |
|
224 |
|
225 CMsvOperationWait* iWait=CMsvOperationWait::NewLC(); |
|
226 |
|
227 CImEmailMessage* imEmailMessage = CImEmailMessage::NewLC(*testUtils->iMsvEntry); |
|
228 imEmailMessage->GetBodyTextL(iWait->iStatus, msgEntry.Id(), CImEmailMessage::EThisMessageOnly, *validRichText1, *paraFormatLayer, *charFormatLayer); |
|
229 iWait->Start(); |
|
230 CActiveScheduler::Start(); // wait for the asynch operation to complete |
|
231 |
|
232 TBuf<100> bufa = bodyText->Read(0); |
|
233 TBuf<100> bufb = validRichText1->Read(0); |
|
234 |
|
235 test((bufa.Compare(bufb))==0); |
|
236 |
|
237 aEntry.SetEntryL(msgEntry.Id()); |
|
238 CMsvStore* store = aEntry.ReadStoreL(); |
|
239 CleanupStack::PushL(store); |
|
240 CImHeader* header = CImHeader::NewLC(); |
|
241 header->RestoreL(*store); |
|
242 |
|
243 // check that there are 2 recipients |
|
244 test(header->ToRecipients().Count() == 2); |
|
245 |
|
246 // check that the alias in the second recipient is not lost! |
|
247 TBuf<50> recipient; |
|
248 recipient.Append('\"'); |
|
249 recipient.Append(KRecipientAlias); |
|
250 recipient.Append('\"'); |
|
251 recipient.Append(' '); |
|
252 recipient.Append('<'); |
|
253 recipient.Append(KRecipient); |
|
254 recipient.Append('>'); |
|
255 |
|
256 TPtrC toRecipient = header->ToRecipients()[1]; |
|
257 test(toRecipient.CompareF(recipient)==0); |
|
258 |
|
259 CleanupStack::PopAndDestroy(header); |
|
260 CleanupStack::PopAndDestroy(store); |
|
261 |
|
262 CleanupStack::PopAndDestroy(2); //imEmailMessage, iWait |
|
263 |
|
264 CleanupStack::PopAndDestroy(4); //bodyText, validRichText1, paraFormatLayer, charFormatLayer |
|
265 } |
|
266 |
|
267 LOCAL_C void TestSMTSendL() |
|
268 { |
|
269 TMsvDummyObserver* ob = new(ELeave) TMsvDummyObserver; |
|
270 CleanupStack::PushL(ob); |
|
271 |
|
272 CMsvSession* session = CMsvSession::OpenSyncL(*ob); |
|
273 CleanupStack::PushL(session); |
|
274 |
|
275 CMsvEntry* cEntry = session->GetEntryL(KMsvRootIndexEntryId); |
|
276 CleanupStack::PushL(cEntry); |
|
277 |
|
278 |
|
279 // with the new SendAs2 API messages are always created in Drafts |
|
280 TestSMTSendL(*cEntry, KMsvDraftEntryId); |
|
281 |
|
282 |
|
283 CleanupStack::PopAndDestroy(3); // cEntry, session, ob |
|
284 } |
|
285 |
|
286 LOCAL_C void TestCapabilityL() |
|
287 { |
|
288 |
|
289 RSendAs sa; |
|
290 User::LeaveIfError(sa.Connect()); |
|
291 CleanupClosePushL(sa); |
|
292 |
|
293 sa.FilterAgainstCapability(KUidMtmQuerySupportedBody); |
|
294 sa.FilterAgainstCapability(KUidMtmQuerySupportAttachments); |
|
295 sa.FilterAgainstCapability(KUidMtmQuerySupportSubject); |
|
296 sa.FilterAgainstCapability(KUidMtmQueryCanSendMsg); |
|
297 |
|
298 CSendAsMessageTypes* msgTypes = CSendAsMessageTypes::NewL(); |
|
299 CleanupStack::PushL(msgTypes); |
|
300 |
|
301 sa.FilteredMessageTypesL(*msgTypes); |
|
302 |
|
303 // make sure SMTP is still in the list |
|
304 TInt found = 0; |
|
305 TInt count = msgTypes->Count(); |
|
306 for (TInt i = 0; i < count; i++) |
|
307 { |
|
308 if (msgTypes->MessageTypeUid(i) == KUidMsgTypeSMTP) |
|
309 { |
|
310 found++; |
|
311 break; |
|
312 } |
|
313 } |
|
314 |
|
315 test(found > 0); |
|
316 |
|
317 // now set a capability not supported by SMTP |
|
318 msgTypes->Reset(); |
|
319 sa.FilterAgainstCapability(KUidMtmQuerySupportsFolder); |
|
320 sa.FilteredMessageTypesL(*msgTypes); |
|
321 |
|
322 // make sure SMTP is no longer in the list |
|
323 found = EFalse; |
|
324 count = msgTypes->Count(); |
|
325 for (TInt i = 0; i < count; i++) |
|
326 { |
|
327 if (msgTypes->MessageTypeUid(i) == KUidMsgTypeSMTP) |
|
328 { |
|
329 found = ETrue; |
|
330 break; |
|
331 } |
|
332 } |
|
333 |
|
334 test(found == 0); |
|
335 |
|
336 CleanupStack::PopAndDestroy(2); // sa, msgTypes |
|
337 |
|
338 } |
|
339 |
|
340 LOCAL_C void TestValidationL() |
|
341 { |
|
342 |
|
343 // Looks line validation functionality is not part of the new SendAs2 API, so we skip this test |
|
344 } |
|
345 |
|
346 LOCAL_C void TestAttachmentL(CMsvEntry& aEntry, TMsvId aDestination) |
|
347 { |
|
348 // Get count of children |
|
349 aEntry.SetEntryL(KMsvRootIndexEntryId); |
|
350 aEntry.SetEntryL(aDestination); |
|
351 TInt childCount = aEntry.Count(); |
|
352 |
|
353 CTestTimer* timer = CTestTimer::NewL(); |
|
354 timer->After(0x200000); |
|
355 CActiveScheduler::Start(); |
|
356 delete timer; |
|
357 |
|
358 // rich text |
|
359 CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL(); |
|
360 CleanupStack::PushL(paraFormatLayer); |
|
361 |
|
362 CCharFormatLayer* charFormatLayer=CCharFormatLayer::NewL(); |
|
363 CleanupStack::PushL(charFormatLayer); |
|
364 |
|
365 CRichText* bodyText=CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256); |
|
366 CleanupStack::PushL(bodyText); |
|
367 |
|
368 TBuf<100> bodyContents = _L("Test body contents so that we can test the SendAs API. We \06 can try using a delimiter"); |
|
369 bodyText->InsertL(0, bodyContents); |
|
370 |
|
371 |
|
372 RSendAs sa; |
|
373 User::LeaveIfError(sa.Connect()); |
|
374 CleanupClosePushL(sa); |
|
375 |
|
376 RSendAsMessage sa_msg; |
|
377 sa_msg.CreateL(sa, KUidMsgTypeSMTP); |
|
378 CleanupClosePushL(sa_msg); |
|
379 |
|
380 sa_msg.AddRecipientL(KRecipient, RSendAsMessage::ESendAsRecipientTo); |
|
381 |
|
382 sa_msg.SetSubjectL(_L("t_smtsnd message test 2")); |
|
383 sa_msg.SetBodyTextL(*bodyText); |
|
384 |
|
385 TRequestStatus status; |
|
386 sa_msg.AddAttachment(_L("C:\\mailtest\\imcm\\rfc82201.txt"), status); |
|
387 User::WaitForRequest(status); |
|
388 |
|
389 sa_msg.SaveMessageAndCloseL(); |
|
390 |
|
391 TMsvId message = 0x00000000; |
|
392 TMsvEntry msgEntry; |
|
393 TBool found = EFalse; |
|
394 |
|
395 aEntry.SetEntryL(KMsvRootIndexEntryId); |
|
396 aEntry.SetEntryL(aDestination); |
|
397 |
|
398 CMsvEntrySelection* sel = aEntry.ChildrenL(); |
|
399 CleanupStack::PushL(sel); |
|
400 |
|
401 // Loop through the sub-entries |
|
402 for(TInt i=0;i<sel->Count();i++) |
|
403 { |
|
404 // Reset the entry to the child[i] |
|
405 aEntry.SetEntryL(sel->At(i)); |
|
406 msgEntry = aEntry.Entry(); |
|
407 if (msgEntry.iDescription.Compare(_L("t_smtsnd message test 2")) == 0) |
|
408 { |
|
409 message = aEntry.EntryId(); |
|
410 found = ETrue; |
|
411 break; |
|
412 } |
|
413 } |
|
414 |
|
415 CleanupStack::PopAndDestroy(); // sel |
|
416 |
|
417 // make sure we actually found our message |
|
418 if (!found) |
|
419 User::Leave(KErrNotFound); |
|
420 |
|
421 // Check child count has increased |
|
422 aEntry.SetEntryL(KMsvRootIndexEntryId); |
|
423 aEntry.SetEntryL(aDestination); |
|
424 test(aEntry.Count() == childCount + 1); |
|
425 |
|
426 // Check we've got what we wanted |
|
427 aEntry.SetEntryL(message); |
|
428 test(aEntry.Entry().Parent() == aDestination); |
|
429 testUtils->iMsvEntry->SetEntryL(msgEntry.Id()); |
|
430 |
|
431 |
|
432 CImEmailMessage* imEmailMessage = CImEmailMessage::NewLC(*testUtils->iMsvEntry); |
|
433 |
|
434 // Testing the message has one attachment using attachment manager |
|
435 TInt count = imEmailMessage->AttachmentManager().AttachmentCount(); |
|
436 test(count == 1); |
|
437 |
|
438 // open the file for read, using index |
|
439 RFile file = imEmailMessage->AttachmentManager().GetAttachmentFileL(count-1); |
|
440 CleanupClosePushL(file); |
|
441 TInt size = 0; |
|
442 test(KErrNone == file.Size(size)); |
|
443 HBufC8* buf8 = HBufC8::NewLC(size); |
|
444 TPtr8 des = buf8->Des(); |
|
445 test(KErrNone == file.Read(des)); |
|
446 CleanupStack::PopAndDestroy(2,&file); // buf8, file |
|
447 |
|
448 // open the file for read, using attachment id |
|
449 |
|
450 // with the new API we don't know the attachment ID, so we skip this test for SendAs2 |
|
451 |
|
452 _LIT8(KTestData,"Some test data"); |
|
453 |
|
454 // open the file for write, using index |
|
455 file = imEmailMessage->AttachmentManager().GetAttachmentFileForWriteL(count-1); |
|
456 CleanupClosePushL(file); |
|
457 TInt filePosition = size; |
|
458 test(KErrNone == file.Write(filePosition,KTestData)); |
|
459 file.Flush(); |
|
460 |
|
461 |
|
462 // get the updated file size |
|
463 test(KErrNone == file.Size(size)); |
|
464 CleanupStack::PopAndDestroy(&file); |
|
465 |
|
466 // get the attachment info, using index |
|
467 CMsvAttachment* attachmentInfo = imEmailMessage->AttachmentManager().GetAttachmentInfoL(count-1); |
|
468 CleanupStack::PushL(attachmentInfo); |
|
469 |
|
470 |
|
471 // modify size information in attachment info |
|
472 attachmentInfo->SetSize(size); |
|
473 |
|
474 // Test modify the attachment info |
|
475 CTestActive* testActive = new (ELeave) CTestActive(); |
|
476 CleanupStack::Pop(attachmentInfo); // pass ownership to attachment manager |
|
477 CleanupStack::PushL(testActive); |
|
478 |
|
479 imEmailMessage->AttachmentManager().ModifyAttachmentInfoL(attachmentInfo,testActive->iStatus); |
|
480 |
|
481 testActive->StartL(); |
|
482 CActiveScheduler::Start(); // wait for the asynch operation to complete |
|
483 TInt result = testActive->iStatus.Int(); |
|
484 |
|
485 |
|
486 CleanupStack::PopAndDestroy(2,imEmailMessage); // testActive , imEmailMessage |
|
487 testUtils->iMsvEntry->SetEntryL(msgEntry.Id()); |
|
488 |
|
489 |
|
490 // Check that the structure of message is: |
|
491 // MESSAGE |
|
492 // FOLDER_MIX |
|
493 // TEXT |
|
494 // ATTACHMENT |
|
495 |
|
496 CMsvEntrySelection* children = testUtils->iMsvEntry->ChildrenL(); |
|
497 CleanupStack::PushL(children); |
|
498 test(children->Count() == 1); |
|
499 |
|
500 TMsvId serviceId; |
|
501 TMsvEmailEntry entry; |
|
502 testUtils->iMsvEntry->Session().GetEntry(children->At(0), serviceId, entry); |
|
503 test(entry.MessageFolderType() == EFolderTypeMixed); |
|
504 |
|
505 testUtils->SetEntryL(children->At(0)); |
|
506 |
|
507 CleanupStack::PopAndDestroy(); //children |
|
508 children = testUtils->iMsvEntry->ChildrenL(); |
|
509 CleanupStack::PushL(children); |
|
510 test(children->Count() == 2); |
|
511 testUtils->iMsvEntry->Session().GetEntry(children->At(0), serviceId, entry); |
|
512 test(entry.iType == KUidMsvAttachmentEntry); |
|
513 |
|
514 |
|
515 testUtils->iMsvEntry->Session().GetEntry(children->At(1), serviceId, entry); |
|
516 test(entry.iType == KUidMsvEmailTextEntry); |
|
517 |
|
518 CleanupStack::PopAndDestroy(children); //children |
|
519 CleanupStack::PopAndDestroy(2); //sendAs, bodyText |
|
520 CleanupStack::PopAndDestroy(3); // ob, paraFormatLayer, charFormatLayer |
|
521 } |
|
522 |
|
523 LOCAL_C void TestAttachmentL() |
|
524 { |
|
525 TMsvDummyObserver* ob = new(ELeave) TMsvDummyObserver; |
|
526 CleanupStack::PushL(ob); |
|
527 |
|
528 CMsvSession* session = CMsvSession::OpenSyncL(*ob); |
|
529 CleanupStack::PushL(session); |
|
530 |
|
531 CMsvEntry* cEntry = session->GetEntryL(KMsvRootIndexEntryId); |
|
532 CleanupStack::PushL(cEntry); |
|
533 |
|
534 |
|
535 // with the new SendAs2 API messages are always created in Drafts |
|
536 TestAttachmentL(*cEntry, KMsvDraftEntryId); |
|
537 |
|
538 CleanupStack::PopAndDestroy(3); // cEntry, session, ob |
|
539 } |
|
540 |
|
541 LOCAL_C void doMainL() |
|
542 { |
|
543 InitL(); |
|
544 |
|
545 testUtils->GoClientSideL(); |
|
546 |
|
547 TMsvId smtpService = testUtils->CreateSmtpServiceL(); |
|
548 |
|
549 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
|
550 TSmtpAccount smtpAccount; |
|
551 accounts->GetSmtpAccountL(smtpService, smtpAccount); |
|
552 accounts->SetDefaultSmtpAccountL(smtpAccount); |
|
553 CleanupStack::PopAndDestroy(accounts); |
|
554 |
|
555 testUtils->TestStart(1); |
|
556 test.Start(_L("Send SMTP message")); |
|
557 TestSMTSendL(); |
|
558 log->AppendComment(_L8("Test 1 OK\n")); |
|
559 testUtils->TestFinish(1); |
|
560 |
|
561 testUtils->TestStart(2); |
|
562 test.Next(_L("Query message capability")); |
|
563 TestCapabilityL(); |
|
564 log->AppendComment(_L8("Test 2 OK\n")); |
|
565 testUtils->TestFinish(2); |
|
566 |
|
567 testUtils->TestStart(3); |
|
568 test.Next(_L("Message validation")); |
|
569 TestValidationL(); |
|
570 log->AppendComment(_L8("Test 3 OK\n")); |
|
571 testUtils->TestFinish(3); |
|
572 |
|
573 testUtils->TestStart(4); |
|
574 test.Next(_L("Add attachment Test")); |
|
575 TestAttachmentL(); |
|
576 log->AppendComment(_L8("Test 4 OK\n")); |
|
577 testUtils->TestFinish(4); |
|
578 |
|
579 log->AppendComment(_L8("Tests completed\n")); |
|
580 testUtils->TestHarnessCompleted(); |
|
581 |
|
582 Closedown(); |
|
583 } |
|
584 |
|
585 GLDEF_C TInt E32Main() |
|
586 { |
|
587 __UHEAP_MARK; |
|
588 theCleanup=CTrapCleanup::New(); |
|
589 TRAPD(ret,doMainL()); |
|
590 test(ret == KErrNone); |
|
591 delete theCleanup; |
|
592 test.End(); |
|
593 test.Close(); |
|
594 __UHEAP_MARKEND; |
|
595 return(KErrNone); |
|
596 } |