|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "ctestimapsession.h" |
|
17 |
|
18 #include "cfakeinputstream.h" |
|
19 #include "cfakeoutputstream.h" |
|
20 #include "cactivewaiter.h" |
|
21 |
|
22 #include "moutputstream.h" |
|
23 #include "cimapsession.h" |
|
24 |
|
25 #include "cimapservergreetinginfo.h" |
|
26 #include "cimapcapabilityinfo.h" |
|
27 #include "cimapfolderinfo.h" |
|
28 #include "cimaputils.h" |
|
29 |
|
30 class CImapSettings; |
|
31 class CImapMailStore; |
|
32 |
|
33 CTestImapSession::CTestImapSession() |
|
34 : iInputStream(NULL) |
|
35 , iOutputStream(NULL) |
|
36 , iActiveWaiter(NULL) |
|
37 , iImapSession(NULL) |
|
38 {} |
|
39 |
|
40 CTestImapSession::~CTestImapSession() |
|
41 { |
|
42 delete iImapSession; |
|
43 delete iActiveWaiter; |
|
44 delete iOutputStream; |
|
45 delete iInputStream; |
|
46 CImapUtils::Delete(); |
|
47 } |
|
48 |
|
49 void CTestImapSession::SetupL() |
|
50 { |
|
51 ASSERT(iInputStream == NULL); |
|
52 ASSERT(iOutputStream == NULL); |
|
53 ASSERT(iActiveWaiter == NULL); |
|
54 ASSERT(iImapSession == NULL); |
|
55 |
|
56 CImapUtils::CreateL(); |
|
57 iInputStream = CFakeInputStream::NewL(Logger()); |
|
58 iOutputStream = CFakeOutputStream::NewL(Logger()); |
|
59 iActiveWaiter = new(ELeave)CActiveWaiter(Logger()); |
|
60 |
|
61 CImapSettings* imapSettings=NULL; |
|
62 CImapMailStore* imapMailStore=NULL; |
|
63 |
|
64 iImapSession = CImapSession::NewL(*imapSettings, *imapMailStore, *iInputStream, *iOutputStream); |
|
65 } |
|
66 |
|
67 void CTestImapSession::TearDownL() |
|
68 { |
|
69 delete iImapSession; |
|
70 iImapSession = NULL; |
|
71 |
|
72 delete iActiveWaiter; |
|
73 iActiveWaiter = NULL; |
|
74 |
|
75 delete iOutputStream; |
|
76 iOutputStream = NULL; |
|
77 |
|
78 delete iInputStream; |
|
79 iInputStream = NULL; |
|
80 |
|
81 CImapUtils::Delete(); |
|
82 } |
|
83 |
|
84 void CTestImapSession::SetupServerGreetingL() |
|
85 { |
|
86 INFO_PRINTF1(_L("Setup: ServerGreeting")); |
|
87 iInputStream->ResetInputStrings(); |
|
88 iInputStream->AppendInputStringL(_L8("* OK Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 (lon-cn-exchng2k.msexchange2k.closedtest.intra) ready.\r\n")); |
|
89 |
|
90 ASSERT_EQUALS(CImapSession::EServerStateNone, iImapSession->ServerState()); |
|
91 |
|
92 iImapSession->ReadServerGreetingL(iActiveWaiter->iStatus); |
|
93 iActiveWaiter->WaitActive(); |
|
94 |
|
95 ASSERT_EQUALS(CImapSession::EServerStateNotAuthenticated, iImapSession->ServerState()); |
|
96 |
|
97 INFO_PRINTF1(_L("Setup: Complete")); |
|
98 } |
|
99 |
|
100 // Tests |
|
101 void CTestImapSession::TestOneLineL() |
|
102 { |
|
103 SetupServerGreetingL(); |
|
104 |
|
105 INFO_PRINTF1(_L("TestOneLineL")); |
|
106 |
|
107 iInputStream->ResetInputStrings(); |
|
108 iInputStream->AppendInputStringL(_L8("1 OK LOGOUT completed\r\n")); |
|
109 |
|
110 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
111 iActiveWaiter->WaitActive(); |
|
112 |
|
113 INFO_PRINTF1(_L("Complete")); |
|
114 } |
|
115 |
|
116 void CTestImapSession::TestTwoLinesSimpleL() |
|
117 { |
|
118 SetupServerGreetingL(); |
|
119 |
|
120 INFO_PRINTF1(_L("TestTwoLinesSimpleL")); |
|
121 |
|
122 iInputStream->ResetInputStrings(); |
|
123 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r\n")); |
|
124 iInputStream->AppendInputStringL(_L8("1 OK LOGOUT completed\r\n")); |
|
125 |
|
126 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
127 iActiveWaiter->WaitActive(); |
|
128 |
|
129 INFO_PRINTF1(_L("Complete")); |
|
130 } |
|
131 |
|
132 void CTestImapSession::TestTwoLinesSplitBeforeFirstCrlfL() |
|
133 { |
|
134 SetupServerGreetingL(); |
|
135 |
|
136 INFO_PRINTF1(_L("TestTwoLinesSplitBeforeFirstCrlfL")); |
|
137 |
|
138 iInputStream->ResetInputStrings(); |
|
139 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Serv")); |
|
140 iInputStream->AppendInputStringL(_L8("er logging out\r\n1 OK LOGOUT completed\r\n")); |
|
141 |
|
142 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
143 iActiveWaiter->WaitActive(); |
|
144 |
|
145 INFO_PRINTF1(_L("Complete")); |
|
146 } |
|
147 |
|
148 void CTestImapSession::TestTwoLinesSplitAfterFirstCrlfL() |
|
149 { |
|
150 SetupServerGreetingL(); |
|
151 |
|
152 INFO_PRINTF1(_L("TestTwoLinesSplitAfterFirstCrlfL")); |
|
153 |
|
154 iInputStream->ResetInputStrings(); |
|
155 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r\n1 OK LOGOUT co")); |
|
156 iInputStream->AppendInputStringL(_L8("mpleted\r\n")); |
|
157 |
|
158 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
159 iActiveWaiter->WaitActive(); |
|
160 |
|
161 INFO_PRINTF1(_L("Complete")); |
|
162 } |
|
163 |
|
164 void CTestImapSession::TestTwoLinesSplitOverFirstCrlfL() |
|
165 { |
|
166 SetupServerGreetingL(); |
|
167 |
|
168 INFO_PRINTF1(_L("TestTwoLinesSplitOverFirstCrlfL")); |
|
169 |
|
170 iInputStream->ResetInputStrings(); |
|
171 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r")); |
|
172 iInputStream->AppendInputStringL(_L8("\n1 OK LOGOUT completed\r\n")); |
|
173 |
|
174 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
175 iActiveWaiter->WaitActive(); |
|
176 |
|
177 INFO_PRINTF1(_L("Complete")); |
|
178 } |
|
179 |
|
180 void CTestImapSession::TestTwoLinesSplitHeavilyOverFirstCrlfL() |
|
181 { |
|
182 SetupServerGreetingL(); |
|
183 |
|
184 INFO_PRINTF1(_L("TestTwoLinesSplitHeavilyOverFirstCrlfL")); |
|
185 |
|
186 iInputStream->ResetInputStrings(); |
|
187 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r")); |
|
188 iInputStream->AppendInputStringL(_L8("\n")); // <<== This line needs special handling in CImapSession |
|
189 iInputStream->AppendInputStringL(_L8("1 OK LOGOUT completed\r\n")); |
|
190 |
|
191 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
192 iActiveWaiter->WaitActive(); |
|
193 |
|
194 INFO_PRINTF1(_L("Complete")); |
|
195 } |
|
196 |
|
197 void CTestImapSession::TestTwoLinesInOneBlockL() |
|
198 { |
|
199 SetupServerGreetingL(); |
|
200 |
|
201 INFO_PRINTF1(_L("TestTwoLinesInOneBlockL")); |
|
202 |
|
203 iInputStream->ResetInputStrings(); |
|
204 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r\n1 OK LOGOUT completed\r\n")); |
|
205 |
|
206 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
207 iActiveWaiter->WaitActive(); |
|
208 |
|
209 INFO_PRINTF1(_L("Complete")); |
|
210 } |
|
211 |
|
212 void CTestImapSession::TestSevenLinesSimpleL() |
|
213 { |
|
214 SetupServerGreetingL(); |
|
215 |
|
216 INFO_PRINTF1(_L("TestSevenLinesSimpleL")); |
|
217 |
|
218 iInputStream->ResetInputStrings(); |
|
219 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r\n")); |
|
220 iInputStream->AppendInputStringL(_L8("* BYE second\r\n")); |
|
221 iInputStream->AppendInputStringL(_L8("* BYE third\r\n")); |
|
222 iInputStream->AppendInputStringL(_L8("* BYE fourth\r\n")); |
|
223 iInputStream->AppendInputStringL(_L8("* BYE fifth\r\n")); |
|
224 iInputStream->AppendInputStringL(_L8("* BYE sixth\r\n")); |
|
225 iInputStream->AppendInputStringL(_L8("1 OK LOGOUT completed\r\n")); |
|
226 |
|
227 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
228 iActiveWaiter->WaitActive(); |
|
229 |
|
230 INFO_PRINTF1(_L("Complete")); |
|
231 } |
|
232 |
|
233 void CTestImapSession::TestSevenLinesIn3ChunksL() |
|
234 { |
|
235 SetupServerGreetingL(); |
|
236 |
|
237 INFO_PRINTF1(_L("TestSevenLinesIn3ChunksL")); |
|
238 |
|
239 iInputStream->ResetInputStrings(); |
|
240 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r\n* BYE second")); |
|
241 iInputStream->AppendInputStringL(_L8("\r\n* BYE third\r\n* BYE fourth\r\n* BYE fi")); |
|
242 iInputStream->AppendInputStringL(_L8("fth\r\n* BYE sixth\r\n1 OK LOGOUT completed\r\n")); |
|
243 |
|
244 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
245 iActiveWaiter->WaitActive(); |
|
246 |
|
247 INFO_PRINTF1(_L("Complete")); |
|
248 } |
|
249 |
|
250 void CTestImapSession::TestOneLineFragmentedL() |
|
251 { |
|
252 SetupServerGreetingL(); |
|
253 |
|
254 INFO_PRINTF1(_L("TestOneLineFragmentedL")); |
|
255 |
|
256 iInputStream->ResetInputStrings(); |
|
257 iInputStream->AppendInputStringL(_L8("1 O")); |
|
258 iInputStream->AppendInputStringL(_L8("K LOG")); |
|
259 iInputStream->AppendInputStringL(_L8("O")); |
|
260 iInputStream->AppendInputStringL(_L8("UT co")); |
|
261 iInputStream->AppendInputStringL(_L8("mpleted")); |
|
262 iInputStream->AppendInputStringL(_L8("\r\n")); |
|
263 |
|
264 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
265 iActiveWaiter->WaitActive(); |
|
266 |
|
267 INFO_PRINTF1(_L("Complete")); |
|
268 } |
|
269 |
|
270 void CTestImapSession::TestOneLineHeavilyFragmentedL() |
|
271 { |
|
272 SetupServerGreetingL(); |
|
273 |
|
274 INFO_PRINTF1(_L("TestOneLineHeavilyFragmentedL")); |
|
275 |
|
276 iInputStream->ResetInputStrings(); |
|
277 iInputStream->AppendInputStringL(_L8("1")); |
|
278 iInputStream->AppendInputStringL(_L8(" ")); |
|
279 iInputStream->AppendInputStringL(_L8("O")); |
|
280 iInputStream->AppendInputStringL(_L8("K")); |
|
281 iInputStream->AppendInputStringL(_L8(" ")); |
|
282 iInputStream->AppendInputStringL(_L8("L")); |
|
283 iInputStream->AppendInputStringL(_L8("O")); |
|
284 iInputStream->AppendInputStringL(_L8("G")); |
|
285 iInputStream->AppendInputStringL(_L8("O")); |
|
286 iInputStream->AppendInputStringL(_L8("U")); |
|
287 iInputStream->AppendInputStringL(_L8("T")); |
|
288 iInputStream->AppendInputStringL(_L8(" ")); |
|
289 iInputStream->AppendInputStringL(_L8("c")); |
|
290 iInputStream->AppendInputStringL(_L8("o")); |
|
291 iInputStream->AppendInputStringL(_L8("m")); |
|
292 iInputStream->AppendInputStringL(_L8("p")); |
|
293 iInputStream->AppendInputStringL(_L8("l")); |
|
294 iInputStream->AppendInputStringL(_L8("e")); |
|
295 iInputStream->AppendInputStringL(_L8("t")); |
|
296 iInputStream->AppendInputStringL(_L8("e")); |
|
297 iInputStream->AppendInputStringL(_L8("d")); |
|
298 iInputStream->AppendInputStringL(_L8("\r")); |
|
299 iInputStream->AppendInputStringL(_L8("\n")); |
|
300 |
|
301 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
302 iActiveWaiter->WaitActive(); |
|
303 |
|
304 INFO_PRINTF1(_L("Complete")); |
|
305 } |
|
306 |
|
307 void CTestImapSession::TestLoginSequenceL() |
|
308 { |
|
309 INFO_PRINTF1(_L("TestLoginSequenceL")); |
|
310 |
|
311 INFO_PRINTF1(_L("...ServerGreeting")); |
|
312 iInputStream->ResetInputStrings(); |
|
313 iInputStream->AppendInputStringL(_L8("* OK Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 (lon-cn-exchng2k.msexchange2k.closedtest.intra) ready.\r\n")); |
|
314 |
|
315 ASSERT_EQUALS(CImapServerGreetingInfo::ETagNone, iImapSession->ServerGreetingInfo().ResponseTag()); |
|
316 |
|
317 iImapSession->ReadServerGreetingL(iActiveWaiter->iStatus); |
|
318 iActiveWaiter->WaitActive(); |
|
319 |
|
320 ASSERT_EQUALS(CImapServerGreetingInfo::ETagOk, iImapSession->ServerGreetingInfo().ResponseTag()); |
|
321 |
|
322 |
|
323 INFO_PRINTF1(_L("...Capability")); |
|
324 iInputStream->ResetInputStrings(); |
|
325 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT) |
|
326 iInputStream->AppendInputStringL(_L8("* CAPABILITY IMAP4rev1 STARTTLS AUTH=GSSAPI LOGINDISABLED BINARY\r\n")); |
|
327 #else |
|
328 iInputStream->AppendInputStringL(_L8("* CAPABILITY IMAP4rev1 STARTTLS AUTH=GSSAPI LOGINDISABLED\r\n")); |
|
329 #endif |
|
330 iInputStream->AppendInputStringL(_L8("1 OK CAPABILITY completed\r\n")); |
|
331 |
|
332 iImapSession->CapabilityL(iActiveWaiter->iStatus); |
|
333 iActiveWaiter->WaitActive(); |
|
334 |
|
335 const CImapCapabilityInfo& capabilityInfo = iImapSession->CapabilityInfo(); |
|
336 |
|
337 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EVersion4Rev1)); |
|
338 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EStartTls)); |
|
339 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::ELoginDisabled)); |
|
340 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EIdle)); |
|
341 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EAuthPlain)); |
|
342 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT) |
|
343 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EBinaryCap)); |
|
344 #endif |
|
345 |
|
346 INFO_PRINTF1(_L("...StartTLS")); |
|
347 iInputStream->ResetInputStrings(); |
|
348 iInputStream->AppendInputStringL(_L8("2 OK Begin TLS negotiation now\r\n")); |
|
349 |
|
350 iImapSession->StartTlsL(iActiveWaiter->iStatus); |
|
351 iActiveWaiter->WaitActive(); |
|
352 |
|
353 |
|
354 INFO_PRINTF1(_L("...Capability")); |
|
355 iInputStream->ResetInputStrings(); |
|
356 iInputStream->AppendInputStringL(_L8("* CAPABILITY IMAP4rev1 AUTH=GSSAPI AUTH=PLAIN IDLE\r\n")); |
|
357 iInputStream->AppendInputStringL(_L8("3 OK CAPABILITY completed\r\n")); |
|
358 |
|
359 iImapSession->CapabilityL(iActiveWaiter->iStatus); |
|
360 iActiveWaiter->WaitActive(); |
|
361 |
|
362 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EVersion4Rev1)); |
|
363 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EStartTls)); |
|
364 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::ELoginDisabled)); |
|
365 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EIdle)); |
|
366 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EAuthPlain)); |
|
367 |
|
368 |
|
369 INFO_PRINTF1(_L("...Login")); |
|
370 iInputStream->ResetInputStrings(); |
|
371 iInputStream->AppendInputStringL(_L8("4 OK [CAPABILITY IMAP4rev1 IDLE] LOGIN completed\r\n")); |
|
372 |
|
373 iImapSession->LoginL(iActiveWaiter->iStatus, _L8("username"), _L8("password")); |
|
374 iActiveWaiter->WaitActive(); |
|
375 |
|
376 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EVersion4Rev1)); |
|
377 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EStartTls)); |
|
378 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::ELoginDisabled)); |
|
379 ASSERT_TRUE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EIdle)); |
|
380 ASSERT_FALSE(capabilityInfo.QueryFlag(CImapCapabilityInfo::EAuthPlain)); |
|
381 |
|
382 INFO_PRINTF1(_L("Complete")); |
|
383 } |
|
384 |
|
385 void CTestImapSession::TestServerStateL() |
|
386 { |
|
387 INFO_PRINTF1(_L("TestServerStateL")); |
|
388 |
|
389 INFO_PRINTF1(_L("...ServerGreeting")); |
|
390 iInputStream->ResetInputStrings(); |
|
391 iInputStream->AppendInputStringL(_L8("* OK Microsoft Exchange 2000 IMAP4rev1 server version 6.0.6249.0 (lon-cn-exchng2k.msexchange2k.closedtest.intra) ready.\r\n")); |
|
392 |
|
393 ASSERT_EQUALS(CImapSession::EServerStateNone, iImapSession->ServerState()); |
|
394 |
|
395 iImapSession->ReadServerGreetingL(iActiveWaiter->iStatus); |
|
396 iActiveWaiter->WaitActive(); |
|
397 |
|
398 ASSERT_EQUALS(CImapSession::EServerStateNotAuthenticated, iImapSession->ServerState()); |
|
399 |
|
400 |
|
401 INFO_PRINTF1(_L("...Login")); |
|
402 iInputStream->ResetInputStrings(); |
|
403 iInputStream->AppendInputStringL(_L8("1 OK LOGIN completed\r\n")); |
|
404 |
|
405 iImapSession->LoginL(iActiveWaiter->iStatus, _L8("username"), _L8("password")); |
|
406 iActiveWaiter->WaitActive(); |
|
407 |
|
408 ASSERT_EQUALS(CImapSession::EServerStateAuthenticated, iImapSession->ServerState()); |
|
409 |
|
410 |
|
411 INFO_PRINTF1(_L("...Select inbox")); |
|
412 iInputStream->ResetInputStrings(); |
|
413 iInputStream->AppendInputStringL(_L8("2 OK [READ-WRITE] SELECT completed\r\n")); |
|
414 |
|
415 CImapFolderInfo* folderInfo = CImapFolderInfo::NewL(); |
|
416 CleanupStack::PushL(folderInfo); |
|
417 |
|
418 folderInfo->SetNameL(_L16("inbox")); |
|
419 CleanupStack::Pop(folderInfo); |
|
420 iImapSession->SelectL(iActiveWaiter->iStatus, folderInfo); |
|
421 iActiveWaiter->WaitActive(); |
|
422 |
|
423 ASSERT_EQUALS(CImapSession::EServerStateSelected, iImapSession->ServerState()); |
|
424 ASSERT_EQUALS(folderInfo, iImapSession->SelectedFolderInfo()); |
|
425 folderInfo = NULL; |
|
426 |
|
427 |
|
428 INFO_PRINTF1(_L("...Close")); |
|
429 iInputStream->ResetInputStrings(); |
|
430 iInputStream->AppendInputStringL(_L8("3 OK CLOSE completed\r\n")); |
|
431 |
|
432 iImapSession->CloseL(iActiveWaiter->iStatus); |
|
433 iActiveWaiter->WaitActive(); |
|
434 |
|
435 ASSERT_EQUALS(CImapSession::EServerStateAuthenticated, iImapSession->ServerState()); |
|
436 ASSERT_NULL(iImapSession->SelectedFolderInfo()); |
|
437 |
|
438 |
|
439 INFO_PRINTF1(_L("...Logout")); |
|
440 iInputStream->ResetInputStrings(); |
|
441 iInputStream->AppendInputStringL(_L8("* BYE IMAP4rev1 Server logging out\r\n4 OK LOGOUT completed\r\n")); |
|
442 |
|
443 iImapSession->LogoutL(iActiveWaiter->iStatus); |
|
444 iActiveWaiter->WaitActive(); |
|
445 |
|
446 ASSERT_EQUALS(CImapSession::EServerStateNone, iImapSession->ServerState()); |
|
447 |
|
448 |
|
449 INFO_PRINTF1(_L("Complete")); |
|
450 } |
|
451 |
|
452 void CTestImapSession::TestLiteralL() |
|
453 { |
|
454 INFO_PRINTF1(_L("TestLiteralL")); |
|
455 |
|
456 SetupServerGreetingL(); |
|
457 |
|
458 INFO_PRINTF1(_L("...Login")); |
|
459 iInputStream->ResetInputStrings(); |
|
460 iInputStream->AppendInputStringL(_L8("1 OK LOGIN completed\r\n")); |
|
461 |
|
462 iImapSession->LoginL(iActiveWaiter->iStatus, _L8("username"), _L8("password")); |
|
463 iActiveWaiter->WaitActive(); |
|
464 |
|
465 |
|
466 INFO_PRINTF1(_L("...Status")); |
|
467 iInputStream->ResetInputStrings(); |
|
468 /* |
|
469 iInputStream->AppendInputStringL(_L8("* STATUS {12}\r\nHello\r\nWorld (MESSAGES 231)\r\n")); |
|
470 iInputStream->AppendInputStringL(_L8("3 OK STATUS completed\r\n")); |
|
471 */ |
|
472 iInputStream->AppendInputStringL(_L8("* STATUS {12}\r\nHello\r\nWor")); |
|
473 iInputStream->AppendInputStringL(_L8("ld (MESSAGES 231)\r\n")); |
|
474 iInputStream->AppendInputStringL(_L8("2 OK STATUS completed\r\n")); |
|
475 |
|
476 |
|
477 CImapFolderInfo* folderInfo = CImapFolderInfo::NewL(); |
|
478 CleanupStack::PushL(folderInfo); |
|
479 |
|
480 iImapSession->StatusL(iActiveWaiter->iStatus, _L16("Hello\r\nWorld"), _L8("MESSAGES"), *folderInfo); |
|
481 iActiveWaiter->WaitActive(); |
|
482 |
|
483 CleanupStack::PopAndDestroy(folderInfo); |
|
484 |
|
485 INFO_PRINTF1(_L("Complete")); |
|
486 } |
|
487 |
|
488 |
|
489 CTestSuite* CTestImapSession::CreateSuiteL(const TDesC& aName) |
|
490 // static |
|
491 { |
|
492 SUB_SUITE; |
|
493 ADD_ASYNC_TEST_STEP(TestOneLineL); |
|
494 ADD_ASYNC_TEST_STEP(TestTwoLinesSimpleL); |
|
495 ADD_ASYNC_TEST_STEP(TestTwoLinesSplitBeforeFirstCrlfL); |
|
496 ADD_ASYNC_TEST_STEP(TestTwoLinesSplitAfterFirstCrlfL); |
|
497 ADD_ASYNC_TEST_STEP(TestTwoLinesSplitOverFirstCrlfL); |
|
498 ADD_ASYNC_TEST_STEP(TestTwoLinesSplitHeavilyOverFirstCrlfL); |
|
499 ADD_ASYNC_TEST_STEP(TestTwoLinesInOneBlockL); |
|
500 ADD_ASYNC_TEST_STEP(TestSevenLinesSimpleL); |
|
501 ADD_ASYNC_TEST_STEP(TestSevenLinesIn3ChunksL); |
|
502 ADD_ASYNC_TEST_STEP(TestOneLineFragmentedL); |
|
503 ADD_ASYNC_TEST_STEP(TestOneLineHeavilyFragmentedL); |
|
504 ADD_ASYNC_TEST_STEP(TestLoginSequenceL); |
|
505 ADD_ASYNC_TEST_STEP(TestServerStateL); |
|
506 ADD_ASYNC_TEST_STEP(TestLiteralL); |
|
507 END_SUITE; |
|
508 } |
|
509 |