|
1 // Copyright (c) 2002-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 the test harness : T_MSGCONNTEST |
|
15 // Component: IMUT |
|
16 // Owner: |
|
17 // Brief description of test harness: |
|
18 // Tests the changes IMUT for multihoming which allows more than one connection |
|
19 // Detailed description of test harness: |
|
20 // Implements a range of tests for IMUT testing the following |
|
21 // funtionality: |
|
22 // -Single default connection |
|
23 // -Single specified connection |
|
24 // -Two Default connections serially (both the connections being default) |
|
25 // -Two Default connections parallelly |
|
26 // -Two Different connections serially(one Default and the other Specified) |
|
27 // -Two Different connections parallelly |
|
28 // -Two Connection , one default connection and another explicit connection |
|
29 // to the default IAP. |
|
30 // Input files required to run test harness: |
|
31 // Intermediate files produced while running test harness: |
|
32 // Output files produced by running test harness: |
|
33 // \msglogs\T_MSGCONNTEST.WINS.DEB |
|
34 // Description of how to build test harness: |
|
35 // -Get the 3GComms code from the directory ---TYPHOON CODE----- and build it |
|
36 // -Get the messagiing code from //EPOC/development/messaging/3gcomm/msg/ (Perforce database) |
|
37 // and build it. |
|
38 // Description of how to run test harness: |
|
39 // -Navigate to the directory \epoc32\release\wins\udeb from the command prompt |
|
40 // -Run T_MsgConnTest.exe from this directory. |
|
41 // -To view the test results check the file \epoc32\wins\c\MsgLogs\T_MSGCONNTEST.WINS.DEB |
|
42 // |
|
43 // |
|
44 |
|
45 #include <nd_err.h> |
|
46 #include <imsk.h> |
|
47 #include <iapprefs.h> |
|
48 #include "t_ConnUtils.h" |
|
49 #include "emailtestutils.h" |
|
50 |
|
51 #define EActivePriorityLow -1 |
|
52 |
|
53 #define ETestSingleDefaultConn '1' |
|
54 #define ETestSingleSpecifiedConn '2' |
|
55 #define ETestTwoDefaultSerialConns '3' |
|
56 #define ETestTwoDefaultParallelConns '4' |
|
57 #define ETestTwoDifferentSerialConns '5' |
|
58 #define ETestTwoDifferentParallelConns '6' |
|
59 #define ETestExplicitDefaultConn '7' |
|
60 #define ETestAllCases 'a' |
|
61 |
|
62 const TInt KMaxSizeOfBinaryData = 200; |
|
63 |
|
64 LOCAL_D RTest g_Test(_L("T_MSG_CONN CImTextServerSession Test")); |
|
65 LOCAL_D CTrapCleanup* theCleanup; |
|
66 LOCAL_D CEmailTestUtils* gTestUtils; |
|
67 LOCAL_D TBuf8<KMaxSizeOfBinaryData> someBinaryData=_L8(""); |
|
68 |
|
69 LOCAL_D TBuf<30> KPipexServer =_L("pop.dial.pipex.com"); |
|
70 LOCAL_D TBuf8<30> KPipexUser= _L8("USER abf75\r\n"); |
|
71 LOCAL_D TBuf8<30> KPipexPass= _L8("PASS oodifama\r\n"); |
|
72 LOCAL_D TInt KPopPort=110; |
|
73 // Can use either the demon server or the fastmail.fm account |
|
74 LOCAL_D TBuf<16> KDemonServer = _L("194.217.242.59");//_L("209.61.183.86");// |
|
75 LOCAL_D TBuf8<30> KDemonUser = _L8("USER psion8\r\n");//_L8("USER catherine2k\r\n");// |
|
76 LOCAL_D TBuf8<30> KDemonPass = _L8("PASS Bag8Nut\r\n");//_L8("PASS junkjunk\r\n");// |
|
77 |
|
78 LOCAL_D TInt g_NoOfConnections; |
|
79 LOCAL_D TInt g_Count; |
|
80 |
|
81 //=======================================// |
|
82 |
|
83 #if defined (__WINS__) |
|
84 #define PDD_NAME _L("ECDRV") |
|
85 #define LDD_NAME _L("ECOMM") |
|
86 #define LDD_FNAME _L("ECOMM") |
|
87 #else |
|
88 #define PDD_NAME _L("EUART1") |
|
89 #define PDD2_NAME _L("EUART2") |
|
90 #define LDD_NAME _L("ECOMM") |
|
91 #define LDD_FNAME _L("FCOMM") |
|
92 #endif |
|
93 |
|
94 TInt CTestHarnessUtil::CommInit() |
|
95 { |
|
96 TInt err=User::LoadPhysicalDevice(PDD_NAME); |
|
97 if (err!=KErrNone && err!=KErrAlreadyExists) |
|
98 return err; |
|
99 |
|
100 err=User::LoadLogicalDevice(LDD_NAME); |
|
101 if (err!=KErrNone && err!=KErrAlreadyExists) |
|
102 return err; |
|
103 |
|
104 return KErrNone; |
|
105 } |
|
106 |
|
107 // Installs the scheduler |
|
108 void CTestHarnessUtil::InitSchedulerL() |
|
109 { |
|
110 iScheduler = new (ELeave) CActiveScheduler(); |
|
111 CActiveScheduler::Install( iScheduler ); |
|
112 } |
|
113 |
|
114 CTestHarnessUtil* CTestHarnessUtil::NewL() |
|
115 { |
|
116 CTestHarnessUtil* me = new (ELeave) CTestHarnessUtil(); |
|
117 CleanupStack::PushL(me); |
|
118 me->ConstructL(); |
|
119 CleanupStack::Pop(me); |
|
120 return me; |
|
121 } |
|
122 |
|
123 void CTestHarnessUtil::ConstructL() |
|
124 { |
|
125 User::LeaveIfError(iFs.Connect()); |
|
126 iFs.SetSessionPath(_L("C:\\")); |
|
127 iFs.SetSessionPath(_L("c:\\")); |
|
128 iFs.MkDir(_L("c:\\logs\\")); |
|
129 iFs.MkDir(_L("c:\\logs\\email\\")); |
|
130 |
|
131 InitSchedulerL(); |
|
132 CommInit(); |
|
133 } |
|
134 |
|
135 CTestHarnessUtil::CTestHarnessUtil() |
|
136 { |
|
137 } |
|
138 |
|
139 CTestHarnessUtil::~CTestHarnessUtil() |
|
140 { |
|
141 delete iScheduler; |
|
142 iFs.Close(); |
|
143 } |
|
144 |
|
145 |
|
146 //=====================================// |
|
147 //CTestHarnessParent |
|
148 |
|
149 CTestHarnessParent::CTestHarnessParent() // construct high-priority active object |
|
150 : CActive(EPriorityHigh) |
|
151 { |
|
152 } |
|
153 |
|
154 CTestHarnessParent *CTestHarnessParent::NewLC() |
|
155 { |
|
156 CTestHarnessParent* self=new (ELeave) CTestHarnessParent(); |
|
157 CleanupStack::PushL(self); |
|
158 self->ConstructL(); |
|
159 return self; |
|
160 } |
|
161 |
|
162 CTestHarnessParent *CTestHarnessParent::NewL() |
|
163 { |
|
164 CTestHarnessParent* self=NewLC(); |
|
165 CleanupStack::Pop(); |
|
166 return self; |
|
167 } |
|
168 |
|
169 void CTestHarnessParent::ConstructL() |
|
170 { |
|
171 iState=EConnect; |
|
172 iPopCmdServiceA=NULL; |
|
173 iPopCmdServiceB=NULL; |
|
174 |
|
175 CActiveScheduler::Add(this); // add to active scheduler |
|
176 } |
|
177 |
|
178 CTestHarnessParent::~CTestHarnessParent() |
|
179 { |
|
180 Cancel(); // make sure we're cancelled |
|
181 if(iPopCmdServiceA!=NULL) |
|
182 { |
|
183 delete iPopCmdServiceA; |
|
184 iPopCmdServiceA=NULL; |
|
185 } |
|
186 |
|
187 if(iPopCmdServiceB!=NULL) |
|
188 { |
|
189 delete iPopCmdServiceB; |
|
190 iPopCmdServiceB=NULL; |
|
191 } |
|
192 } |
|
193 |
|
194 void CTestHarnessParent::TestSingleDefaultConnL() |
|
195 { |
|
196 gTestUtils->WriteComment(_L("Test Single Default Connection Started")); |
|
197 iPopCmdServiceA=MakeBasicConnectionLC(KPipexServer, |
|
198 KPipexUser, |
|
199 KPipexPass); |
|
200 iPopCmdServiceA->ConnectionL(); |
|
201 iState = ESend; |
|
202 iStatus = KRequestPending; |
|
203 SetActive(); |
|
204 CActiveScheduler::Start(); |
|
205 |
|
206 gTestUtils->WriteComment(_L("End of Single Default Connection")); |
|
207 gTestUtils->WriteComment(_L("\r\n")); |
|
208 } |
|
209 |
|
210 void CTestHarnessParent::TestSingleSpecifiedConnL() |
|
211 { |
|
212 gTestUtils->WriteComment(_L("Test Single Specified Connection Started")); |
|
213 iPopCmdServiceA=MakeOverrideConnectionLC(KDemonServer, |
|
214 KDemonUser, |
|
215 KDemonPass); |
|
216 |
|
217 iPopCmdServiceA->ConnectionL(); |
|
218 iState = ESend; |
|
219 iStatus = KRequestPending; |
|
220 SetActive(); |
|
221 CActiveScheduler::Start(); |
|
222 |
|
223 gTestUtils->WriteComment(_L("End of Single Specified Connection")); |
|
224 gTestUtils->WriteComment(_L("\r\n")); |
|
225 } |
|
226 |
|
227 void CTestHarnessParent::TestTwoDefaultConnectionsSeriallyL() |
|
228 { |
|
229 gTestUtils->WriteComment(_L("Test Two Default Serial Connections Started")); |
|
230 |
|
231 iPopCmdServiceA=MakeBasicConnectionLC(KPipexServer, |
|
232 KPipexUser, |
|
233 KPipexPass); |
|
234 |
|
235 iPopCmdServiceB=MakeBasicConnectionLC(KDemonServer, |
|
236 KDemonUser, |
|
237 KDemonPass); |
|
238 iPopCmdServiceA->ConnectionL(); |
|
239 iState = ESend; |
|
240 iStatus = KRequestPending; |
|
241 SetActive(); |
|
242 CActiveScheduler::Start(); |
|
243 |
|
244 gTestUtils->WriteComment(_L("End of Test Two Default Serial Connections ")); |
|
245 gTestUtils->WriteComment(_L("\r\n")); |
|
246 } |
|
247 |
|
248 void CTestHarnessParent::TestTwoDefaultConnectionsParallellyL() |
|
249 { |
|
250 gTestUtils->WriteComment(_L("Test Two Default Parallel Connections Started")); |
|
251 gTestUtils->WriteComment(_L("\nFirst Connection Start")); |
|
252 iPopCmdServiceA=MakeBasicConnectionLC(KPipexServer, |
|
253 KPipexUser, |
|
254 KPipexPass); |
|
255 iPopCmdServiceA->ConnectionL(); |
|
256 |
|
257 gTestUtils->WriteComment(_L("\nSecond Connection Start")); |
|
258 iPopCmdServiceB=MakeBasicConnectionLC(KDemonServer, |
|
259 KDemonUser, |
|
260 KDemonPass); |
|
261 iPopCmdServiceB->ConnectionL(); |
|
262 |
|
263 iState = ESend; |
|
264 iStatus = KRequestPending; |
|
265 SetActive(); |
|
266 CActiveScheduler::Start(); |
|
267 |
|
268 gTestUtils->WriteComment(_L("End of Test Two Default Parallel Connections ")); |
|
269 gTestUtils->WriteComment(_L("\r\n")); |
|
270 } |
|
271 |
|
272 void CTestHarnessParent::TestTwoDifferentConnectionsSeriallyL() |
|
273 { |
|
274 gTestUtils->WriteComment(_L("Test Two Different Serial Connections Started")); |
|
275 gTestUtils->WriteComment(_L("\nFirst Connection Start")); |
|
276 |
|
277 iPopCmdServiceA=MakeBasicConnectionLC(KPipexServer, |
|
278 KPipexUser, |
|
279 KPipexPass); |
|
280 |
|
281 iPopCmdServiceB=MakeOverrideConnectionLC(KDemonServer, |
|
282 KDemonUser, |
|
283 KDemonPass); |
|
284 iPopCmdServiceA->ConnectionL(); |
|
285 iState = ESend; |
|
286 iStatus = KRequestPending; |
|
287 SetActive(); |
|
288 CActiveScheduler::Start(); |
|
289 |
|
290 gTestUtils->WriteComment(_L("End of Test Two Different Serial Connections ")); |
|
291 gTestUtils->WriteComment(_L("\r\n")); |
|
292 |
|
293 } |
|
294 |
|
295 void CTestHarnessParent::TestTwoDifferentConnectionsParallellyL() |
|
296 { |
|
297 gTestUtils->WriteComment(_L("Test Two Differenet Parallel Connections Started")); |
|
298 gTestUtils->WriteComment(_L("\nFirst Connection Start")); |
|
299 |
|
300 iPopCmdServiceA=MakeBasicConnectionLC(KPipexServer, |
|
301 KPipexUser, |
|
302 KPipexPass); |
|
303 iPopCmdServiceA->ConnectionL(); |
|
304 |
|
305 gTestUtils->WriteComment(_L("\nSecond Connection Start")); |
|
306 iPopCmdServiceB=MakeOverrideConnectionLC(KDemonServer, |
|
307 KDemonUser, |
|
308 KDemonPass); |
|
309 iPopCmdServiceB->ConnectionL(); |
|
310 |
|
311 iState = ESend; |
|
312 iStatus = KRequestPending; |
|
313 SetActive(); |
|
314 CActiveScheduler::Start(); |
|
315 |
|
316 gTestUtils->WriteComment(_L("End of Test Two Different Parallel Connections ")); |
|
317 gTestUtils->WriteComment(_L("\r\n")); |
|
318 } |
|
319 |
|
320 |
|
321 void CTestHarnessParent::TestExplicitDefaultConnL() |
|
322 { |
|
323 gTestUtils->WriteComment(_L("Test Explicit-Default Parallel Connections Started")); |
|
324 gTestUtils->WriteComment(_L("\nFirst Connection Start")); |
|
325 |
|
326 iPopCmdServiceA=MakeBasicConnectionLC(KPipexServer, |
|
327 KPipexUser, |
|
328 KPipexPass); |
|
329 iPopCmdServiceA->ConnectionL(); |
|
330 |
|
331 gTestUtils->WriteComment(_L("\nSecond Connection Start")); |
|
332 iPopCmdServiceB=MakeExplicitDefaultConnectionLC(KDemonServer, |
|
333 KDemonUser, |
|
334 KDemonPass); |
|
335 iPopCmdServiceB->ConnectionL(); |
|
336 |
|
337 iState = ESend; |
|
338 iStatus = KRequestPending; |
|
339 SetActive(); |
|
340 CActiveScheduler::Start(); |
|
341 |
|
342 gTestUtils->WriteComment(_L("End of Test Explicit-Default Parallel Connections")); |
|
343 gTestUtils->WriteComment(_L("\r\n")); |
|
344 } |
|
345 |
|
346 void CTestHarnessParent::DoCancel() |
|
347 { |
|
348 } |
|
349 |
|
350 void CTestHarnessParent::SetTestMode(TTestMode aTestMode) |
|
351 { |
|
352 iTestMode=aTestMode; |
|
353 } |
|
354 |
|
355 // Called by active scheduler if there is an outstanding task |
|
356 void CTestHarnessParent::RunL() |
|
357 { |
|
358 switch(iTestMode) |
|
359 { |
|
360 case ESingleDefaultConn: |
|
361 SingleDefaultConnection(); |
|
362 break; |
|
363 |
|
364 case ESingleSpecifiedConn: |
|
365 SingleDefaultConnection(); |
|
366 break; |
|
367 |
|
368 case ETwoDefaultSerialConn: |
|
369 case ETwoDifferentSerialConn: |
|
370 TwoSerialConnectionsL(); |
|
371 break; |
|
372 |
|
373 case ETwoDefaultParallelConn: |
|
374 case ETwoDifferentParallelConn: |
|
375 case EExplicitDefaultConn: |
|
376 TwoParallelConnections(); |
|
377 break; |
|
378 default: |
|
379 break; |
|
380 } |
|
381 } |
|
382 |
|
383 void CTestHarnessParent::TwoSerialConnectionsL() |
|
384 { |
|
385 switch (iState) |
|
386 { |
|
387 case EConnect: |
|
388 break; |
|
389 case ESend: |
|
390 g_Count=g_NoOfConnections; |
|
391 iState=EDisConnect; |
|
392 iStatus = KRequestPending; |
|
393 SetActive(); |
|
394 |
|
395 if(!iPopCmdServiceA->IsChildCompleteSet()) |
|
396 { |
|
397 if(iPopCmdServiceA->iStatus.Int() == KErrNone || |
|
398 iPopCmdServiceA->iStatus.Int() == KErrInUse) |
|
399 { |
|
400 iPopCmdServiceA->List(); |
|
401 } |
|
402 } |
|
403 else |
|
404 ChildFinished(); |
|
405 break; |
|
406 case EDisConnect: |
|
407 g_Count=g_NoOfConnections; |
|
408 iState=EConnect2; |
|
409 iStatus = KRequestPending; |
|
410 SetActive(); |
|
411 if(!iPopCmdServiceA->IsChildCompleteSet()) |
|
412 { |
|
413 iPopCmdServiceA->DisConnect(); |
|
414 } |
|
415 else |
|
416 ChildFinished(); |
|
417 break; |
|
418 case EConnect2: |
|
419 g_Count=g_NoOfConnections; |
|
420 iPopCmdServiceB->ConnectionL(); |
|
421 iState=ESend2; |
|
422 iStatus = KRequestPending; |
|
423 SetActive(); |
|
424 break; |
|
425 case ESend2: |
|
426 g_Count=g_NoOfConnections; |
|
427 iState=EDisConnect2; |
|
428 iStatus = KRequestPending; |
|
429 SetActive(); |
|
430 |
|
431 if(!iPopCmdServiceB->IsChildCompleteSet()) |
|
432 { |
|
433 if(iPopCmdServiceB->iStatus.Int() == KErrNone || |
|
434 iPopCmdServiceB->iStatus.Int() == KErrInUse) |
|
435 { |
|
436 iPopCmdServiceB->List(); |
|
437 } |
|
438 } |
|
439 else |
|
440 ChildFinished(); |
|
441 break; |
|
442 case EDisConnect2: |
|
443 g_Count=g_NoOfConnections; |
|
444 iState=EStop; |
|
445 iStatus = KRequestPending; |
|
446 SetActive(); |
|
447 |
|
448 if(!iPopCmdServiceB->IsChildCompleteSet()) |
|
449 { |
|
450 iPopCmdServiceB->DisConnect(); |
|
451 } |
|
452 else |
|
453 ChildFinished(); |
|
454 break; |
|
455 case EStop: |
|
456 CActiveScheduler::Stop(); |
|
457 break; |
|
458 default: |
|
459 break; |
|
460 } |
|
461 } |
|
462 |
|
463 |
|
464 void CTestHarnessParent::TwoParallelConnections() |
|
465 { |
|
466 switch (iState) |
|
467 { |
|
468 case EConnect: |
|
469 break; |
|
470 case ESend: // have set encryption |
|
471 g_Count=g_NoOfConnections; |
|
472 iState=EDisConnect; |
|
473 iStatus = KRequestPending; |
|
474 SetActive(); |
|
475 |
|
476 if(!iPopCmdServiceA->IsChildCompleteSet()) |
|
477 { |
|
478 if(iPopCmdServiceA->iStatus.Int() == KErrNone || |
|
479 iPopCmdServiceA->iStatus.Int() == KErrInUse) |
|
480 { |
|
481 iPopCmdServiceA->List(); |
|
482 } |
|
483 } |
|
484 else |
|
485 ChildFinished(); |
|
486 |
|
487 if(!iPopCmdServiceB->IsChildCompleteSet()) |
|
488 { |
|
489 if(iPopCmdServiceB->iStatus.Int() == KErrNone || |
|
490 iPopCmdServiceB->iStatus.Int() == KErrInUse) |
|
491 { |
|
492 iPopCmdServiceB->List(); |
|
493 } |
|
494 } |
|
495 else |
|
496 ChildFinished(); |
|
497 break; |
|
498 case EDisConnect: |
|
499 g_Count=g_NoOfConnections; |
|
500 iState=EStop; |
|
501 iStatus = KRequestPending; |
|
502 SetActive(); |
|
503 |
|
504 if(!iPopCmdServiceA->IsChildCompleteSet()) |
|
505 iPopCmdServiceA->DisConnect(); |
|
506 else |
|
507 ChildFinished(); |
|
508 |
|
509 if(!iPopCmdServiceB->IsChildCompleteSet()) |
|
510 iPopCmdServiceB->DisConnect(); |
|
511 else |
|
512 ChildFinished(); |
|
513 break; |
|
514 case EStop: |
|
515 CActiveScheduler::Stop(); |
|
516 break; |
|
517 default: |
|
518 break; |
|
519 } // end of switch |
|
520 } |
|
521 |
|
522 void CTestHarnessParent::SingleDefaultConnection() |
|
523 { |
|
524 switch (iState) |
|
525 { |
|
526 case EConnect: |
|
527 break; |
|
528 case ESend: |
|
529 g_Count=g_NoOfConnections; |
|
530 iState=EDisConnect; |
|
531 iStatus = KRequestPending; |
|
532 SetActive(); |
|
533 if(!iPopCmdServiceA->IsChildCompleteSet()) |
|
534 { |
|
535 if(iPopCmdServiceA->iStatus.Int() == KErrNone || |
|
536 iPopCmdServiceA->iStatus.Int() == KErrInUse) |
|
537 { |
|
538 iPopCmdServiceA->List(); |
|
539 } |
|
540 } |
|
541 else |
|
542 ChildFinished(); |
|
543 break; |
|
544 case EDisConnect: |
|
545 g_Count=g_NoOfConnections; |
|
546 iState=EStop; |
|
547 iStatus = KRequestPending; |
|
548 SetActive(); |
|
549 |
|
550 if(!iPopCmdServiceA->IsChildCompleteSet()) |
|
551 { |
|
552 iPopCmdServiceA->DisConnect(); |
|
553 } |
|
554 else |
|
555 ChildFinished(); |
|
556 break; |
|
557 case EStop: |
|
558 CActiveScheduler::Stop(); |
|
559 break; |
|
560 default: |
|
561 break; |
|
562 } // end of switch |
|
563 } |
|
564 |
|
565 void CTestHarnessParent::ChildFinished() |
|
566 { |
|
567 TRequestStatus *status; |
|
568 status = &iStatus; |
|
569 g_Count-- ; |
|
570 if(g_Count==0) |
|
571 User::RequestComplete(status,KErrNone); |
|
572 } |
|
573 |
|
574 // Default connection |
|
575 CSendPopCommandMessage* CTestHarnessParent::MakeBasicConnectionLC(TDes& aServAddress, TDes8& aUser, TDes8& aPass/*,CTestHarnessParent* aParent*/) |
|
576 { |
|
577 CSendPopCommandMessage* popCmdService = CSendPopCommandMessage::NewL(aServAddress,KPopPort, aUser, aPass,this); |
|
578 return popCmdService; |
|
579 } |
|
580 |
|
581 // Override connection |
|
582 CSendPopCommandMessage* CTestHarnessParent::MakeOverrideConnectionLC(TDes& aServAddress, TDes8& aUser, TDes8& aPass/*,CTestHarnessParent* aParent*/) |
|
583 { |
|
584 CSendPopCommandMessage* popCmdService = CSendPopCommandMessage::NewL(aServAddress,KPopPort, aUser, aPass, this); |
|
585 |
|
586 TImIAPChoice choice; |
|
587 choice.iIAP = 1; // Specified IAP |
|
588 choice.iDialogPref = ECommDbDialogPrefDoNotPrompt; |
|
589 CImIAPPreferences* theIAPPreferences = CImIAPPreferences::NewLC(); |
|
590 theIAPPreferences->AddIAPL(choice); |
|
591 |
|
592 popCmdService->SetConnectionPrefs(theIAPPreferences); |
|
593 CleanupStack::Pop(theIAPPreferences); |
|
594 return popCmdService; |
|
595 } |
|
596 |
|
597 // Explicit connection to the default IAP |
|
598 CSendPopCommandMessage* CTestHarnessParent::MakeExplicitDefaultConnectionLC(TDes& aServAddress, TDes8& aUser, TDes8& aPass) |
|
599 { |
|
600 CSendPopCommandMessage* popCmdService = CSendPopCommandMessage::NewL(aServAddress,KPopPort, aUser, aPass, this); |
|
601 |
|
602 TImIAPChoice choice; |
|
603 choice.iIAP = 0; // Explicitly connecting to the default IAP |
|
604 choice.iDialogPref = ECommDbDialogPrefDoNotPrompt; |
|
605 CImIAPPreferences* theIAPPreferences = CImIAPPreferences::NewLC(); |
|
606 theIAPPreferences->AddIAPL(choice); |
|
607 |
|
608 popCmdService->SetConnectionPrefs(theIAPPreferences); |
|
609 CleanupStack::Pop(theIAPPreferences); |
|
610 return popCmdService; |
|
611 } |
|
612 |
|
613 // Displays the error code |
|
614 void CSendPopCommandMessage::DisplayErrorReason(TInt& aReason) |
|
615 { |
|
616 if (aReason!=KErrNone) |
|
617 { |
|
618 gTestUtils->WriteComment(_L("\nERROR - ")); |
|
619 } |
|
620 |
|
621 TBuf<64> logString; |
|
622 switch (aReason) |
|
623 { |
|
624 case KErrNone: |
|
625 gTestUtils->WriteComment(_L("Session completed successfully")); |
|
626 break; |
|
627 case KErrCancel: |
|
628 gTestUtils->WriteComment(_L("Session cancelled")); |
|
629 logString.Format(_L(" Session Cancelled %d"),KErrCancel); |
|
630 gTestUtils->WriteComment(logString); |
|
631 break; |
|
632 case KErrAlreadyExists: |
|
633 gTestUtils->WriteComment(_L(" something Already Exists")); |
|
634 logString.Format(_L(" something Already Exists %d"),KErrAlreadyExists); |
|
635 gTestUtils->WriteComment(logString); |
|
636 break; |
|
637 case KErrEof: |
|
638 gTestUtils->WriteComment(_L("No messages to send")); |
|
639 logString.Format(_L(" No messages to send %d"),KErrEof); |
|
640 gTestUtils->WriteComment(logString); |
|
641 break; |
|
642 case KErrNoMemory: |
|
643 gTestUtils->WriteComment(_L("No memory")); |
|
644 logString.Format(_L(" No Memory %d"),KErrNoMemory); |
|
645 gTestUtils->WriteComment(logString); |
|
646 break; |
|
647 case KErrAccessDenied: |
|
648 gTestUtils->WriteComment(_L("Switch link off")); |
|
649 logString.Format(_L(" Switch link off %d"),KErrAccessDenied); |
|
650 gTestUtils->WriteComment(logString); |
|
651 break; |
|
652 case KErrExitNoModem: |
|
653 gTestUtils->WriteComment(_L("No modem")); |
|
654 logString.Format(_L(" No Modem %d"),KErrExitNoModem); |
|
655 gTestUtils->WriteComment(logString); |
|
656 break; |
|
657 case KErrExitLoginFail: |
|
658 gTestUtils->WriteComment(_L("Login failed")); |
|
659 logString.Format(_L(" Login Failed %d"),KErrExitLoginFail); |
|
660 gTestUtils->WriteComment(logString); |
|
661 break; |
|
662 case KErrExitModemError: |
|
663 gTestUtils->WriteComment(_L("Modem error")); |
|
664 logString.Format(_L(" Modem Error %d"),KErrExitModemError); |
|
665 gTestUtils->WriteComment(logString); |
|
666 break; |
|
667 case KErrExitScriptError: |
|
668 gTestUtils->WriteComment(_L("Script error")); |
|
669 logString.Format(_L(" Script Error %d"),KErrExitScriptError); |
|
670 gTestUtils->WriteComment(logString); |
|
671 break; |
|
672 case KImskErrorDNSNotFound: |
|
673 gTestUtils->WriteComment(_L("Failed to find SMTP server")); |
|
674 logString.Format(_L(" Failed to find SMTP server %d"),KImskErrorDNSNotFound); |
|
675 gTestUtils->WriteComment(logString); |
|
676 break; |
|
677 case KErrTimedOut: |
|
678 gTestUtils->WriteComment(_L("Timed out waiting to communicate to server")); |
|
679 logString.Format(_L(" Timed out waiting to communicate to server %d"),KErrTimedOut); |
|
680 gTestUtils->WriteComment(logString); |
|
681 break; |
|
682 case KErrDisconnected: |
|
683 gTestUtils->WriteComment(_L("Server disconnected from socket")); |
|
684 logString.Format(_L(" Server disconnected from socket %d"),KErrDisconnected); |
|
685 gTestUtils->WriteComment(logString); |
|
686 break; |
|
687 case KErrCouldNotConnect: |
|
688 gTestUtils->WriteComment(_L("Could not connect to the server")); |
|
689 logString.Format(_L(" Could not connect to the server %d"),KErrCouldNotConnect); |
|
690 gTestUtils->WriteComment(logString); |
|
691 break; |
|
692 case KErrCouldNotDisconnect: |
|
693 gTestUtils->WriteComment(_L("Could not disconnect from the server")); |
|
694 logString.Format(_L(" Could not disconnect from the server %d"),KErrCouldNotDisconnect); |
|
695 gTestUtils->WriteComment(logString); |
|
696 break; |
|
697 case KErrServerTerminated: |
|
698 gTestUtils->WriteComment(_L("Server terminated")); |
|
699 logString.Format(_L(" Server terminated %d"),KErrServerTerminated); |
|
700 gTestUtils->WriteComment(logString); |
|
701 break; |
|
702 default: |
|
703 // unknown error |
|
704 logString.Format(_L(" Error %d"),aReason); |
|
705 gTestUtils->WriteComment(logString); |
|
706 } |
|
707 } |
|
708 |
|
709 |
|
710 // create an active object to send the message |
|
711 |
|
712 CSendPopCommandMessage::CSendPopCommandMessage() |
|
713 : CActive(EPriorityHigh), |
|
714 iServerAddress(KPipexServer), |
|
715 iPort(KPopPort), |
|
716 iUserName(KPipexUser), |
|
717 iPass(KPipexPass) |
|
718 { |
|
719 } |
|
720 |
|
721 CSendPopCommandMessage::CSendPopCommandMessage(TDesC& aServerAddress, |
|
722 TInt aPort, |
|
723 TDesC8& aUser, |
|
724 TDesC8& aPass , |
|
725 CTestHarnessParent* aParent, |
|
726 CImIAPPreferences* aConnPref) |
|
727 : CActive(EPriorityHigh), |
|
728 iServerAddress(aServerAddress), |
|
729 iPort(aPort), |
|
730 iUserName(aUser), |
|
731 iPass(aPass), |
|
732 iParent(aParent), |
|
733 iIAPPreferences(aConnPref) |
|
734 |
|
735 { |
|
736 } |
|
737 |
|
738 CSendPopCommandMessage *CSendPopCommandMessage::NewLC(TDesC& aServerAddress, |
|
739 TInt aPort, |
|
740 TDesC8& aUser, |
|
741 TDesC8& aPass, |
|
742 CTestHarnessParent* aParent, |
|
743 CImIAPPreferences* aConnPref) |
|
744 { |
|
745 CSendPopCommandMessage* self=new (ELeave) CSendPopCommandMessage(aServerAddress, |
|
746 aPort, |
|
747 aUser, |
|
748 aPass, |
|
749 aParent, |
|
750 aConnPref); |
|
751 CleanupStack::PushL(self); |
|
752 self->ConstructL(); |
|
753 return self; |
|
754 } |
|
755 |
|
756 CSendPopCommandMessage *CSendPopCommandMessage::NewL(TDesC& aServerAddress, |
|
757 TInt aPort, |
|
758 TDesC8& aUser, |
|
759 TDesC8& aPass, |
|
760 CTestHarnessParent* aParent, |
|
761 CImIAPPreferences* aConnPref) |
|
762 { |
|
763 CSendPopCommandMessage* self=NewLC(aServerAddress, aPort, aUser, aPass, |
|
764 aParent,aConnPref); |
|
765 CleanupStack::Pop(); |
|
766 return self; |
|
767 } |
|
768 |
|
769 void CSendPopCommandMessage::ConstructL() |
|
770 { |
|
771 iSendState=EConnect; |
|
772 CActiveScheduler::Add(this); // add to active scheduler |
|
773 iImSocket= CImTextServerSession::NewL(); |
|
774 iReceive=EFalse; |
|
775 } |
|
776 |
|
777 TBool CSendPopCommandMessage::IsChildCompleteSet() |
|
778 { |
|
779 return iComplete; |
|
780 } |
|
781 |
|
782 void CSendPopCommandMessage::SetConnectionPrefs(CImIAPPreferences* aConnPref) |
|
783 { |
|
784 if (iIAPPreferences) |
|
785 delete iIAPPreferences; |
|
786 iIAPPreferences = aConnPref; |
|
787 } |
|
788 |
|
789 CSendPopCommandMessage::~CSendPopCommandMessage() |
|
790 { |
|
791 Cancel(); // make sure we're cancelled |
|
792 delete iImSocket; |
|
793 delete iBuf; |
|
794 delete iIAPPreferences; |
|
795 } |
|
796 |
|
797 void CSendPopCommandMessage::SetSelfComplete(TBool aComplete) |
|
798 { |
|
799 iComplete=aComplete; |
|
800 } |
|
801 |
|
802 void CSendPopCommandMessage::DoCancel() |
|
803 { |
|
804 iImSocket->Cancel(); |
|
805 } |
|
806 |
|
807 void CSendPopCommandMessage::SetLastError(TInt aError) |
|
808 { |
|
809 iLastError=aError; |
|
810 } |
|
811 |
|
812 TInt CSendPopCommandMessage::GetLastError() |
|
813 { |
|
814 return iLastError; |
|
815 } |
|
816 |
|
817 // Displays the error reason, disconnects the server connection and starts the active |
|
818 void CSendPopCommandMessage::Complete(TInt aError) |
|
819 { |
|
820 iImSocket->LogError(_L8("\t\tEnd of POP3 g_Test session; completion code="),aError); |
|
821 TBuf8<KImMailMaxBufferSize> buffer; |
|
822 iLineStatus=iImSocket->GetCurrentTextLine(buffer); |
|
823 g_Test.Printf(TRefByValue<const TDesC>_L("Final %S\n "),&buffer); |
|
824 |
|
825 SetSelfComplete(ETrue); |
|
826 DisplayErrorReason(aError); |
|
827 if (aError==KErrNone) |
|
828 gTestUtils->WriteComment(_L("PASSED g_Test")); |
|
829 else |
|
830 gTestUtils->WriteComment(_L("FAILED g_Test")); |
|
831 } |
|
832 |
|
833 // Called by active scheduler if there is an outstanding task |
|
834 void CSendPopCommandMessage::RunL() |
|
835 { |
|
836 switch (iSendState) |
|
837 { |
|
838 case EConnect: |
|
839 if(iStatus.Int()==KErrNone || iStatus.Int()==KErrInUse) |
|
840 { |
|
841 iReceive=ETrue; |
|
842 QueueNextReceive(); |
|
843 iSendState = EConnectDone; |
|
844 } |
|
845 else |
|
846 { |
|
847 SetLastError(iStatus.Int()); |
|
848 DisConnect(); |
|
849 } |
|
850 break; |
|
851 case EConnectDone: |
|
852 iParent->ChildFinished(); |
|
853 iSendState = EUserName; |
|
854 break; |
|
855 case EStat: // have set encryption |
|
856 iReceive=EFalse; |
|
857 RequestSend(); |
|
858 iSendState=EList; |
|
859 break; |
|
860 case EUserName: // response from sending user name |
|
861 case EPassword: // response from sending password` |
|
862 case EList: |
|
863 List(); |
|
864 break; |
|
865 case EQuit: |
|
866 Quit(); |
|
867 break; |
|
868 case EQuitDone: |
|
869 iParent->ChildFinished(); |
|
870 break; |
|
871 case EComplete: |
|
872 Complete(GetLastError()); |
|
873 iParent->ChildFinished(); |
|
874 break; |
|
875 default: |
|
876 break; |
|
877 } // end of switch |
|
878 } |
|
879 |
|
880 // Called by RunL when it leaves |
|
881 TInt CSendPopCommandMessage::RunError(TInt aError) |
|
882 { |
|
883 Cancel(); // make sure we're cancelled |
|
884 delete iImSocket; |
|
885 delete iBuf; |
|
886 delete iIAPPreferences; |
|
887 |
|
888 if(aError != KErrNone) |
|
889 return aError; |
|
890 |
|
891 return KErrNone; |
|
892 } |
|
893 |
|
894 // Disconect the server connection |
|
895 void CSendPopCommandMessage::DisConnect() |
|
896 { |
|
897 iImSocket->Disconnect(iStatus); |
|
898 iSendState=EComplete; |
|
899 SetActive(); |
|
900 } |
|
901 |
|
902 // USER,PASS and LIST command sent to the server |
|
903 void CSendPopCommandMessage::List() |
|
904 { |
|
905 someBinaryData=_L8(""); |
|
906 if(iStatus.Int()!=KErrNone) |
|
907 { |
|
908 SetLastError(iStatus.Int()); |
|
909 DisConnect(); |
|
910 return; |
|
911 } |
|
912 else |
|
913 { |
|
914 TBuf8<40> buffer; |
|
915 TBuf<40> buffer16; |
|
916 iLineStatus=iImSocket->GetCurrentTextLine(buffer); |
|
917 buffer16.Copy(buffer); |
|
918 g_Test.Printf(TRefByValue<const TDesC>_L("%S"),&buffer16); |
|
919 if(iReceive) |
|
920 { |
|
921 if(iLineStatus==EBufferTooSmall) |
|
922 { |
|
923 while(iLineStatus!=ECRLFTerminated) |
|
924 { |
|
925 iLineStatus=iImSocket->GetCurrentTextLine(buffer); |
|
926 g_Test.Printf(TRefByValue<const TDesC>_L("%S"),&buffer); |
|
927 } |
|
928 } |
|
929 iReceive=EFalse; |
|
930 RequestSend(); |
|
931 TInt iSt = (TInt) iSendState; |
|
932 iSt++; |
|
933 iSendState = (TSendState)iSt; |
|
934 } |
|
935 else |
|
936 { |
|
937 iReceive=ETrue; |
|
938 QueueNextReceive(); |
|
939 } |
|
940 } |
|
941 } |
|
942 |
|
943 // Receives the data from the server and sends the QUIT message |
|
944 void CSendPopCommandMessage::Quit() |
|
945 { |
|
946 TInt length=0; |
|
947 if(iStatus.Int()!=KErrNone) |
|
948 { |
|
949 SetLastError(iStatus.Int()); |
|
950 DisConnect(); |
|
951 return; |
|
952 } |
|
953 length=someBinaryData.Length(); |
|
954 if (length>2) |
|
955 { |
|
956 TBuf<KMaxSizeOfBinaryData> buffer16; |
|
957 buffer16.Copy(someBinaryData); |
|
958 g_Test.Printf(TRefByValue<const TDesC>_L("%S"),&buffer16); |
|
959 if ((someBinaryData[length-3]=='.' && someBinaryData[length-2]==0x0D |
|
960 && someBinaryData[length-1]==0x0A) |
|
961 ||(someBinaryData[length-3]=='-' && someBinaryData[length-2]=='E' |
|
962 && someBinaryData[length-1]=='R')) |
|
963 { |
|
964 // got ".CRLF" string (-ERR string) from LIST command, so go onto next state |
|
965 iReceive=EFalse; |
|
966 RequestSend(); |
|
967 iSendState=EQuitDone; |
|
968 return; |
|
969 } |
|
970 } |
|
971 // queue a read |
|
972 iReceive=ETrue; |
|
973 iImSocket->ReceiveBinaryData(iStatus,someBinaryData,someBinaryData.MaxLength()); |
|
974 SetActive(); |
|
975 } |
|
976 |
|
977 // Receives new request from socket |
|
978 void CSendPopCommandMessage::QueueNextReceive() |
|
979 { |
|
980 //queues a new request from the socket |
|
981 iImSocket->QueueReceiveNextTextLine(iStatus); |
|
982 SetActive(); |
|
983 } |
|
984 |
|
985 // Request function for the active object |
|
986 void CSendPopCommandMessage::RequestSend() |
|
987 { |
|
988 _LIT8(KImStat,"STAT\r\n"); |
|
989 _LIT8(KImList,"LIST\r\n"); |
|
990 _LIT8(KImQuit,"QUIT\r\n"); |
|
991 |
|
992 switch(iSendState) |
|
993 { |
|
994 case EConnect: |
|
995 case EConnectDone: |
|
996 case EQuitDone: |
|
997 break; |
|
998 case EUserName: |
|
999 gTestUtils->WriteComment(_L("IP address of client is ")); |
|
1000 gTestUtils->WriteComment(iImSocket->LocalName()); |
|
1001 |
|
1002 TUint32 convalue; |
|
1003 TInt err; |
|
1004 err=iImSocket->GetIAPValue(convalue); |
|
1005 if(err==KErrNone) |
|
1006 g_Test.Printf(_L("GetIAPValue returned %u\n"),convalue); |
|
1007 else |
|
1008 g_Test.Printf(_L("GetIAPValue error %d\n"),err); |
|
1009 err=iImSocket->GetIAPBearer(convalue); |
|
1010 if(err==KErrNone) |
|
1011 g_Test.Printf(_L("GetIAPBearer returned %u\n"),convalue); |
|
1012 else |
|
1013 g_Test.Printf(_L("GetIAPBearer error %d\n"),err); |
|
1014 iImSocket->Send(iStatus,iUserName); |
|
1015 gTestUtils->WriteComment(_L("\tSent Message USER")); |
|
1016 g_Test.Printf(_L("\tSent Message USER\n")); |
|
1017 break; |
|
1018 case EPassword: |
|
1019 iImSocket->Send(iStatus,iPass); |
|
1020 gTestUtils->WriteComment(_L("\tSent Message PASS")); |
|
1021 g_Test.Printf(_L("\tSent Message PASS\n")); |
|
1022 break; |
|
1023 case EStat: |
|
1024 iImSocket->Send(iStatus,KImStat()); |
|
1025 gTestUtils->WriteComment(_L("\tSent Message STAT")); |
|
1026 g_Test.Printf(_L("\tSent Message STAT\n")); |
|
1027 break; |
|
1028 case EList: |
|
1029 iImSocket->Send(iStatus,KImList()); |
|
1030 gTestUtils->WriteComment(_L("\tSent Message LIST")); |
|
1031 g_Test.Printf(_L("\tSent Message LIST\n")); |
|
1032 break; |
|
1033 case EQuit: |
|
1034 iImSocket->Send(iStatus,KImQuit()); |
|
1035 gTestUtils->WriteComment(_L("\tSent Message QUIT")); |
|
1036 g_Test.Printf(_L("\tSent Message QUIT\n")); |
|
1037 break; |
|
1038 case EComplete: |
|
1039 gTestUtils->WriteComment(_L("\tReq Complete")); |
|
1040 break; |
|
1041 } |
|
1042 SetActive(); |
|
1043 } |
|
1044 |
|
1045 void CSendPopCommandMessage::ConnectionL() |
|
1046 { |
|
1047 g_Test.Next(_L("QueueConnect")); |
|
1048 SetSelfComplete(EFalse); |
|
1049 if (!iIAPPreferences) |
|
1050 { |
|
1051 iIAPPreferences = CImIAPPreferences::NewLC(); |
|
1052 CleanupStack::Pop(); // iIAPPrefernces |
|
1053 } |
|
1054 iImSocket->QueueConnectL(iStatus,iServerAddress,iPort,*iIAPPreferences); |
|
1055 SetActive(); |
|
1056 g_Test.Next(_L("Connect Queued")); |
|
1057 gTestUtils->WriteComment(_L("Connect Queued")); |
|
1058 } |
|
1059 |
|
1060 //=========================================// |
|
1061 |
|
1062 // Clears the screen |
|
1063 LOCAL_C void ClearScreen() |
|
1064 { |
|
1065 g_Test.Console()->ClearScreen(); |
|
1066 } |
|
1067 |
|
1068 // Draws menu on screen for user input |
|
1069 /* |
|
1070 LOCAL_C void DrawMenu() |
|
1071 { |
|
1072 g_Test.Printf(_L("\r\n")); |
|
1073 g_Test.Printf(_L("(1) Single Default Connection (IAP A)\r\n")); |
|
1074 g_Test.Printf(_L("(2) Single Specified Connection (IAP B)\r\n")); |
|
1075 g_Test.Printf(_L("(3) Two Default Connections Serially (IAP A and B)\r\n")); |
|
1076 g_Test.Printf(_L("(4) Two Default Connections Parallelly (IAP A and B)\r\n")); |
|
1077 g_Test.Printf(_L("(5) One Default and One Specified Connections Serially (IAP A and B)\r\n")); |
|
1078 g_Test.Printf(_L("(6) One Default and One Specified Connections Parallely (IAP A and B)\r\n")); |
|
1079 g_Test.Printf(_L("(7) Explicitly connecting to the default IAP\r\n")); |
|
1080 g_Test.Printf(_L("(a) Test All Cases\r\n")); |
|
1081 g_Test.Printf(_L("(x) Exit\r\n")); |
|
1082 g_Test.Printf(_L("\r\n")); |
|
1083 g_Test.Printf(_L("Select: ")); |
|
1084 } |
|
1085 */ |
|
1086 //Accepts the user input and calls the desired test case |
|
1087 LOCAL_C void doMainL() |
|
1088 { |
|
1089 TChar option('0'); |
|
1090 g_NoOfConnections=0; |
|
1091 |
|
1092 CTestHarnessUtil* testHarnessUtil=CTestHarnessUtil::NewL(); |
|
1093 CleanupStack::PushL(testHarnessUtil); |
|
1094 |
|
1095 gTestUtils = CEmailTestUtils::NewLC(g_Test); |
|
1096 gTestUtils->WriteComment(_L("T_MSG_CONN Testing Email Test Socket")); |
|
1097 gTestUtils->WriteComment(_L("Please make sure that pipex is the default IAP.")); |
|
1098 |
|
1099 CTestHarnessParent *test_harness = NULL; |
|
1100 test_harness=CTestHarnessParent::NewL(); |
|
1101 CleanupStack::PushL(test_harness); |
|
1102 |
|
1103 // DrawMenu(); |
|
1104 // option = TChar(g_Test.Getch()); |
|
1105 // g_Test.Printf(_L("%c\r\n"), option); |
|
1106 // ClearScreen(); |
|
1107 option=ETestAllCases; |
|
1108 |
|
1109 switch(option) |
|
1110 { |
|
1111 case ETestSingleDefaultConn: |
|
1112 g_NoOfConnections=1; |
|
1113 g_Count=g_NoOfConnections; |
|
1114 test_harness->SetTestMode(ESingleDefaultConn); |
|
1115 test_harness->TestSingleDefaultConnL(); |
|
1116 break; |
|
1117 case ETestSingleSpecifiedConn: |
|
1118 g_NoOfConnections=1; |
|
1119 g_Count=g_NoOfConnections; |
|
1120 test_harness->SetTestMode(ESingleSpecifiedConn); |
|
1121 test_harness->TestSingleSpecifiedConnL(); |
|
1122 break; |
|
1123 case ETestTwoDefaultSerialConns: |
|
1124 g_NoOfConnections=1; //Coz, connections one after the other |
|
1125 g_Count=g_NoOfConnections; |
|
1126 test_harness->SetTestMode(ETwoDefaultSerialConn); |
|
1127 test_harness->TestTwoDefaultConnectionsSeriallyL(); |
|
1128 break; |
|
1129 case ETestTwoDefaultParallelConns: |
|
1130 g_NoOfConnections=2; |
|
1131 g_Count=g_NoOfConnections; |
|
1132 test_harness->SetTestMode(ETwoDefaultParallelConn); |
|
1133 test_harness->TestTwoDefaultConnectionsParallellyL(); |
|
1134 break; |
|
1135 case ETestTwoDifferentSerialConns: |
|
1136 g_NoOfConnections=1; //Coz, connections one after the other |
|
1137 g_Count=g_NoOfConnections; |
|
1138 test_harness->SetTestMode(ETwoDifferentSerialConn); |
|
1139 test_harness->TestTwoDifferentConnectionsSeriallyL(); |
|
1140 break; |
|
1141 case ETestTwoDifferentParallelConns: |
|
1142 g_NoOfConnections=2; |
|
1143 g_Count=g_NoOfConnections; |
|
1144 test_harness->SetTestMode(ETwoDifferentParallelConn); |
|
1145 test_harness->TestTwoDifferentConnectionsParallellyL(); |
|
1146 break; |
|
1147 case ETestExplicitDefaultConn: |
|
1148 g_NoOfConnections=2; |
|
1149 g_Count=g_NoOfConnections; |
|
1150 test_harness->SetTestMode(EExplicitDefaultConn); |
|
1151 test_harness->TestExplicitDefaultConnL(); |
|
1152 break; |
|
1153 case ETestAllCases: |
|
1154 g_NoOfConnections=1; |
|
1155 g_Count=g_NoOfConnections; |
|
1156 test_harness->SetTestMode(ESingleDefaultConn); |
|
1157 test_harness->TestSingleDefaultConnL(); |
|
1158 |
|
1159 g_NoOfConnections=1; |
|
1160 g_Count=g_NoOfConnections; |
|
1161 test_harness->SetTestMode(ESingleSpecifiedConn); |
|
1162 test_harness->TestSingleSpecifiedConnL(); |
|
1163 |
|
1164 g_NoOfConnections=1; //Coz, connections one after the other |
|
1165 g_Count=g_NoOfConnections; |
|
1166 test_harness->SetTestMode(ETwoDefaultSerialConn); |
|
1167 test_harness->TestTwoDefaultConnectionsSeriallyL(); |
|
1168 |
|
1169 g_NoOfConnections=2; |
|
1170 g_Count=g_NoOfConnections; |
|
1171 test_harness->SetTestMode(ETwoDefaultParallelConn); |
|
1172 test_harness->TestTwoDefaultConnectionsParallellyL(); |
|
1173 |
|
1174 g_NoOfConnections=1; //Coz, connections one after the other |
|
1175 g_Count=g_NoOfConnections; |
|
1176 test_harness->SetTestMode(ETwoDifferentSerialConn); |
|
1177 test_harness->TestTwoDifferentConnectionsSeriallyL(); |
|
1178 |
|
1179 g_NoOfConnections=2; |
|
1180 g_Count=g_NoOfConnections; |
|
1181 test_harness->SetTestMode(ETwoDifferentParallelConn); |
|
1182 test_harness->TestTwoDifferentConnectionsParallellyL(); |
|
1183 |
|
1184 g_NoOfConnections=2; |
|
1185 g_Count=g_NoOfConnections; |
|
1186 test_harness->SetTestMode(EExplicitDefaultConn); |
|
1187 test_harness->TestExplicitDefaultConnL(); |
|
1188 break; |
|
1189 default: |
|
1190 gTestUtils->WriteComment(_L("Exit")); |
|
1191 } |
|
1192 ClearScreen(); |
|
1193 gTestUtils->WriteComment(_L("********** T_MSG_CONN Tests Complete **********")); |
|
1194 gTestUtils->TestHarnessCompleted(); |
|
1195 |
|
1196 CleanupStack::PopAndDestroy(test_harness); |
|
1197 CleanupStack::PopAndDestroy(gTestUtils); |
|
1198 CleanupStack::PopAndDestroy(testHarnessUtil); |
|
1199 } |
|
1200 |
|
1201 // Entry point |
|
1202 GLDEF_C TInt E32Main() |
|
1203 { |
|
1204 g_Test.Title(); |
|
1205 g_Test.Start(_L("Testing Email Text Socket")); |
|
1206 __UHEAP_MARK; |
|
1207 |
|
1208 theCleanup=CTrapCleanup::New(); |
|
1209 g_Test (theCleanup!=NULL); |
|
1210 TRAPD(ret,doMainL()); |
|
1211 g_Test (ret==KErrNone); |
|
1212 delete theCleanup; |
|
1213 |
|
1214 __UHEAP_MARKEND; |
|
1215 g_Test.End(); |
|
1216 return 0; |
|
1217 } |