|
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 // |
|
15 |
|
16 #include "SelectionTests.h" |
|
17 #include "CStubbedAgent.h" |
|
18 |
|
19 // |
|
20 // Test case NC-2-1 |
|
21 // |
|
22 |
|
23 CNetConTest0201* CNetConTest0201::NewLC() |
|
24 { |
|
25 CNetConTest0201* self = new(ELeave) CNetConTest0201(); |
|
26 CleanupStack::PushL(self); |
|
27 self->ConstructL(); |
|
28 return self; |
|
29 } |
|
30 |
|
31 CNetConTest0201::CNetConTest0201() |
|
32 { |
|
33 |
|
34 iConnectType = EConnStartExplicit; |
|
35 iConnectionAttempt = 1; |
|
36 iLastConnectionError = KErrNone; |
|
37 iAvailableBearers = KCommDbBearerCSD; |
|
38 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
39 iDialogBoxError = KErrNone; |
|
40 iExpectedError = KErrNone; |
|
41 } |
|
42 |
|
43 void CNetConTest0201::ConstructL() |
|
44 { |
|
45 |
|
46 CNetConSelectionRequestTestBase::ConstructL(); |
|
47 |
|
48 iAgent = new(ELeave) CStubbedAgent(); |
|
49 } |
|
50 |
|
51 CNetConTest0201::~CNetConTest0201() |
|
52 { } |
|
53 |
|
54 const TDesC& CNetConTest0201::Name() const |
|
55 { |
|
56 |
|
57 _LIT(KTestName, "Test Case NC-2-1"); |
|
58 return KTestName(); |
|
59 } |
|
60 |
|
61 TInt CNetConTest0201::FindExistingAgentForSelection(CNifAgentBase*& aAgent, CCommsDbAccess*) const |
|
62 { |
|
63 |
|
64 ASSERT(iAgent); |
|
65 aAgent = iAgent; |
|
66 return KErrNone; |
|
67 } |
|
68 |
|
69 void CNetConTest0201::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
70 { |
|
71 |
|
72 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
73 |
|
74 if(aError!=iExpectedError) |
|
75 { |
|
76 CompleteTest(MNetConTest::EFailed); |
|
77 return; |
|
78 } |
|
79 |
|
80 ASSERT(iAgent); |
|
81 |
|
82 TNifAgentInfo info; |
|
83 iAgent->Info(info); |
|
84 |
|
85 if(aRequest->AgentName() == info.iName) |
|
86 { |
|
87 CompleteTest(MNetConTest::EPassed); |
|
88 } |
|
89 else |
|
90 { |
|
91 CompleteTest(MNetConTest::EFailed); |
|
92 } |
|
93 } |
|
94 |
|
95 |
|
96 // |
|
97 // Test case NC-2-2 |
|
98 // |
|
99 |
|
100 CNetConTest0202* CNetConTest0202::NewLC() |
|
101 { |
|
102 CNetConTest0202* self = new(ELeave) CNetConTest0202(); |
|
103 CleanupStack::PushL(self); |
|
104 self->ConstructL(); |
|
105 return self; |
|
106 } |
|
107 |
|
108 CNetConTest0202::CNetConTest0202() |
|
109 { |
|
110 |
|
111 iConnectType = EConnStartExplicit; |
|
112 iConnectionAttempt = 3; |
|
113 iLastConnectionError = KErrNone; |
|
114 iAvailableBearers = KCommDbBearerCSD; |
|
115 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
116 iDialogBoxError = KErrNone; |
|
117 iExpectedError = KErrOverflow; |
|
118 } |
|
119 |
|
120 const TDesC& CNetConTest0202::Name() const |
|
121 { |
|
122 |
|
123 _LIT(KTestName, "Test Case NC-2-2"); |
|
124 return KTestName(); |
|
125 } |
|
126 |
|
127 |
|
128 // |
|
129 // Test case NC-2-3 |
|
130 // |
|
131 |
|
132 CNetConTest0203* CNetConTest0203::NewLC() |
|
133 { |
|
134 CNetConTest0203* self = new(ELeave) CNetConTest0203(); |
|
135 CleanupStack::PushL(self); |
|
136 self->ConstructL(); |
|
137 return self; |
|
138 } |
|
139 |
|
140 CNetConTest0203::CNetConTest0203() |
|
141 { |
|
142 |
|
143 iConnectType = EConnStartImplicit; |
|
144 iConnectionAttempt = 1; |
|
145 iLastConnectionError = KErrNone; |
|
146 iAvailableBearers = KCommDbBearerCSD; |
|
147 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
148 iDialogBoxError = KErrNone; |
|
149 iExpectedError = KErrNone; |
|
150 } |
|
151 |
|
152 void CNetConTest0203::ConstructL() |
|
153 { |
|
154 |
|
155 CNetConSelectionRequestTestBase::ConstructL(); |
|
156 |
|
157 iAgent = new(ELeave) CStubbedAgent(); |
|
158 |
|
159 TNifAgentInfo info; |
|
160 iAgent->Info(info); |
|
161 |
|
162 iImplicitAgentName = info.iName.AllocL(); |
|
163 } |
|
164 |
|
165 CNetConTest0203::~CNetConTest0203() |
|
166 { |
|
167 |
|
168 if(iImplicitAgentName) |
|
169 delete iImplicitAgentName; |
|
170 } |
|
171 |
|
172 const TDesC& CNetConTest0203::Name() const |
|
173 { |
|
174 |
|
175 _LIT(KTestName, "Test Case NC-2-3"); |
|
176 return KTestName(); |
|
177 } |
|
178 |
|
179 TInt CNetConTest0203::FindExistingAgentForSelection(CNifAgentBase*& aAgent, CCommsDbAccess*) const |
|
180 { |
|
181 |
|
182 ASSERT(iAgent); |
|
183 aAgent = iAgent; |
|
184 return KErrNone; |
|
185 } |
|
186 |
|
187 const HBufC* CNetConTest0203::ImplicitConnectionAgentName() const |
|
188 { |
|
189 |
|
190 return iImplicitAgentName; |
|
191 } |
|
192 |
|
193 const TConnPref& CNetConTest0203::ImplicitConnectionPrefs() const |
|
194 { |
|
195 |
|
196 return iImplicitConnPref; |
|
197 } |
|
198 |
|
199 void CNetConTest0203::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
200 { |
|
201 |
|
202 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
203 |
|
204 if(aError!=iExpectedError) |
|
205 { |
|
206 CompleteTest(MNetConTest::EFailed); |
|
207 return; |
|
208 } |
|
209 |
|
210 ASSERT(iAgent); |
|
211 |
|
212 TNifAgentInfo info; |
|
213 iAgent->Info(info); |
|
214 |
|
215 if(aRequest->AgentName() == info.iName) |
|
216 { |
|
217 CompleteTest(MNetConTest::EPassed); |
|
218 } |
|
219 else |
|
220 { |
|
221 CompleteTest(MNetConTest::EFailed); |
|
222 } |
|
223 } |
|
224 |
|
225 |
|
226 // |
|
227 // Test case NC-2-4 |
|
228 // |
|
229 |
|
230 CNetConTest0204* CNetConTest0204::NewLC() |
|
231 { |
|
232 CNetConTest0204* self = new(ELeave) CNetConTest0204(); |
|
233 CleanupStack::PushL(self); |
|
234 self->ConstructL(); |
|
235 return self; |
|
236 } |
|
237 |
|
238 CNetConTest0204::CNetConTest0204() |
|
239 { |
|
240 |
|
241 iConnectType = EConnStartExplicit; |
|
242 iConnectionAttempt = 1; |
|
243 iLastConnectionError = KErrNone; |
|
244 iAvailableBearers = KCommDbBearerCSD; |
|
245 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
246 iDialogBoxError = KErrNone; |
|
247 iExpectedError = KErrNone; |
|
248 iNetworkId = 204; |
|
249 } |
|
250 |
|
251 CNetConTest0204::~CNetConTest0204() |
|
252 {} |
|
253 |
|
254 const TDesC& CNetConTest0204::Name() const |
|
255 { |
|
256 |
|
257 _LIT(KTestName, "Test Case NC-2-4"); |
|
258 return KTestName(); |
|
259 } |
|
260 |
|
261 void CNetConTest0204::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
262 { |
|
263 |
|
264 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
265 |
|
266 |
|
267 if(aError!=iExpectedError) |
|
268 { |
|
269 CompleteTest(MNetConTest::EFailed); |
|
270 return; |
|
271 } |
|
272 |
|
273 ASSERT(iAgent); |
|
274 |
|
275 TNifAgentInfo info; |
|
276 iAgent->Info(info); |
|
277 |
|
278 if(aRequest->AgentName() == info.iName) |
|
279 { |
|
280 CompleteTest(MNetConTest::EPassed); |
|
281 } |
|
282 else |
|
283 { |
|
284 CompleteTest(MNetConTest::EFailed); |
|
285 } |
|
286 } |
|
287 |
|
288 |
|
289 // |
|
290 // Test case NC-2-5 |
|
291 // |
|
292 |
|
293 CNetConTest0205* CNetConTest0205::NewLC() |
|
294 { |
|
295 CNetConTest0205* self = new(ELeave) CNetConTest0205(); |
|
296 CleanupStack::PushL(self); |
|
297 self->ConstructL(); |
|
298 return self; |
|
299 } |
|
300 |
|
301 CNetConTest0205::CNetConTest0205() |
|
302 { |
|
303 |
|
304 iConnectType = EConnStartExplicit; |
|
305 iConnectionAttempt = 1; |
|
306 iLastConnectionError = KErrNone; |
|
307 iAvailableBearers = KCommDbBearerCSD; |
|
308 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
309 iDialogBoxError = KErrNone; |
|
310 iExpectedError = KErrNone; |
|
311 iNetworkId = 205; |
|
312 } |
|
313 |
|
314 CNetConTest0205::~CNetConTest0205() |
|
315 { } |
|
316 |
|
317 const TDesC& CNetConTest0205::Name() const |
|
318 { |
|
319 |
|
320 _LIT(KTestName, "Test Case NC-2-5"); |
|
321 return KTestName(); |
|
322 } |
|
323 |
|
324 void CNetConTest0205::ConstructL() |
|
325 // |
|
326 // Override ConstructL() in CNetConSelectionRequestTestBase so that we can |
|
327 // pass in some actual connection preferences. |
|
328 // |
|
329 { |
|
330 CNetConRequestTestBase::ConstructL(); |
|
331 |
|
332 TCommDbConnPref prefs; |
|
333 prefs.SetDirection(ECommDbConnectionDirectionIncoming); |
|
334 |
|
335 iRequest = CSelectionRequest::NewL(this, this, iConnectType, prefs, iConnectionAttempt, iLastConnectionError); |
|
336 } |
|
337 |
|
338 void CNetConTest0205::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
339 { |
|
340 |
|
341 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
342 |
|
343 if(aError!=iExpectedError) |
|
344 { |
|
345 CompleteTest(MNetConTest::EFailed); |
|
346 return; |
|
347 } |
|
348 |
|
349 ASSERT(iAgent); |
|
350 |
|
351 TNifAgentInfo info; |
|
352 iAgent->Info(info); |
|
353 |
|
354 if(aRequest->AgentName() == info.iName) |
|
355 { |
|
356 CompleteTest(MNetConTest::EPassed); |
|
357 } |
|
358 else |
|
359 { |
|
360 CompleteTest(MNetConTest::EFailed); |
|
361 } |
|
362 } |
|
363 |
|
364 void CNetConTest0205::GetCurrentSettingsL(TConnectionSettings& aSettings, TCommDbConnectionDirection aDirection, TUint32 aRank) |
|
365 { |
|
366 |
|
367 if(aDirection!=ECommDbConnectionDirectionIncoming) |
|
368 { |
|
369 CompleteTest(MNetConTest::EFailed); |
|
370 return; |
|
371 } |
|
372 |
|
373 if(aRank!=(TUint32)iConnectionAttempt) |
|
374 { |
|
375 CompleteTest(MNetConTest::EFailed); |
|
376 return; |
|
377 } |
|
378 |
|
379 iSettings.iRank = aRank; |
|
380 iSettings.iDirection = aDirection; |
|
381 iSettings.iDialogPref = ECommDbDialogPrefDoNotPrompt; |
|
382 iSettings.iBearerSet = KCommDbBearerCSD; |
|
383 iSettings.iIAPId = 5; |
|
384 iSettings.iServiceId = 2; |
|
385 iSettings.iServiceType = TPtrC(DIAL_IN_ISP); |
|
386 iSettings.iBearerId = 2; |
|
387 iSettings.iLocationId = 2; |
|
388 iSettings.iChargeCardId = 0; |
|
389 |
|
390 aSettings = iSettings; |
|
391 } |
|
392 |
|
393 |
|
394 // |
|
395 // Test case NC-2-6 |
|
396 // |
|
397 |
|
398 CNetConTest0206* CNetConTest0206::NewLC() |
|
399 { |
|
400 CNetConTest0206* self = new(ELeave) CNetConTest0206(); |
|
401 CleanupStack::PushL(self); |
|
402 self->ConstructL(); |
|
403 return self; |
|
404 } |
|
405 |
|
406 CNetConTest0206::CNetConTest0206() |
|
407 { |
|
408 |
|
409 iConnectType = EConnStartExplicit; |
|
410 iConnectionAttempt = 1; |
|
411 iLastConnectionError = KErrNone; |
|
412 iAvailableBearers = KCommDbBearerCSD; |
|
413 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
414 iDialogBoxError = KErrNone; |
|
415 iExpectedError = KErrNone; |
|
416 iNetworkId = 206; |
|
417 } |
|
418 |
|
419 CNetConTest0206::~CNetConTest0206() |
|
420 { } |
|
421 |
|
422 const TDesC& CNetConTest0206::Name() const |
|
423 { |
|
424 |
|
425 _LIT(KTestName, "Test Case NC-2-6"); |
|
426 return KTestName(); |
|
427 } |
|
428 |
|
429 void CNetConTest0206::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
430 { |
|
431 |
|
432 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
433 |
|
434 if(aError!=iExpectedError) |
|
435 { |
|
436 CompleteTest(MNetConTest::EFailed); |
|
437 return; |
|
438 } |
|
439 |
|
440 ASSERT(iAgent); |
|
441 |
|
442 TNifAgentInfo info; |
|
443 iAgent->Info(info); |
|
444 |
|
445 if(aRequest->AgentName() == info.iName) |
|
446 { |
|
447 CompleteTest(MNetConTest::EPassed); |
|
448 } |
|
449 else |
|
450 { |
|
451 CompleteTest(MNetConTest::EFailed); |
|
452 } |
|
453 } |
|
454 |
|
455 |
|
456 // |
|
457 // Test case NC-2-7 |
|
458 // Removed as its not easy after a user prompt to check for |
|
459 // Bearer availablility |
|
460 |
|
461 |
|
462 // |
|
463 // Test case NC-2-8 |
|
464 // |
|
465 |
|
466 CNetConTest0208* CNetConTest0208::NewLC() |
|
467 { |
|
468 CNetConTest0208* self = new(ELeave) CNetConTest0208(); |
|
469 CleanupStack::PushL(self); |
|
470 self->ConstructL(); |
|
471 return self; |
|
472 } |
|
473 |
|
474 CNetConTest0208::CNetConTest0208() |
|
475 { |
|
476 |
|
477 iConnectType = EConnStartExplicit; |
|
478 iConnectionAttempt = 1; |
|
479 iLastConnectionError = KErrNone; |
|
480 iAvailableBearers = KCommDbBearerCSD; |
|
481 iDialogBoxPref = ECommDbDialogPrefPrompt; |
|
482 iDialogBoxError = KErrNone; |
|
483 iExpectedError = KErrNone; |
|
484 iNetworkId = 208; |
|
485 } |
|
486 |
|
487 CNetConTest0208::~CNetConTest0208() |
|
488 { } |
|
489 |
|
490 const TDesC& CNetConTest0208::Name() const |
|
491 { |
|
492 |
|
493 _LIT(KTestName, "Test Case NC-2-8"); |
|
494 return KTestName(); |
|
495 } |
|
496 |
|
497 void CNetConTest0208::DialogCbComplete() |
|
498 { |
|
499 |
|
500 ASSERT(iDialogBoxObserver); |
|
501 |
|
502 switch(iDialogBoxAction) |
|
503 { |
|
504 case ESelectModemLocation: |
|
505 iDialogBoxObserver->MDPOSelectModemAndLocationComplete(iDialogBoxError, iSettings); |
|
506 break; |
|
507 |
|
508 case ESelectConnection: |
|
509 iDialogBoxObserver->MDPOSelectComplete(iDialogBoxError, iSettings); |
|
510 break; |
|
511 |
|
512 default: |
|
513 User::Invariant(); |
|
514 } |
|
515 |
|
516 iDialogBoxObserver = NULL; |
|
517 iDialogBoxError = KErrNone; |
|
518 } |
|
519 |
|
520 void CNetConTest0208::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
521 { |
|
522 |
|
523 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
524 |
|
525 |
|
526 if(aError!=iExpectedError) |
|
527 { |
|
528 CompleteTest(MNetConTest::EFailed); |
|
529 return; |
|
530 } |
|
531 |
|
532 ASSERT(iAgent); |
|
533 |
|
534 TNifAgentInfo info; |
|
535 iAgent->Info(info); |
|
536 |
|
537 if(aRequest->AgentName() == info.iName) |
|
538 { |
|
539 CompleteTest(MNetConTest::EPassed); |
|
540 } |
|
541 else |
|
542 { |
|
543 CompleteTest(MNetConTest::EFailed); |
|
544 }; |
|
545 } |
|
546 |
|
547 |
|
548 // |
|
549 // Test case NC-2-9 |
|
550 // |
|
551 |
|
552 CNetConTest0209* CNetConTest0209::NewLC() |
|
553 { |
|
554 CNetConTest0209* self = new(ELeave) CNetConTest0209(); |
|
555 CleanupStack::PushL(self); |
|
556 self->ConstructL(); |
|
557 return self; |
|
558 } |
|
559 |
|
560 CNetConTest0209::CNetConTest0209() |
|
561 { |
|
562 |
|
563 iConnectType = EConnStartExplicit; |
|
564 iConnectionAttempt = 1; |
|
565 iLastConnectionError = KErrNone; |
|
566 iAvailableBearers = KCommDbBearerCSD; |
|
567 iDialogBoxPref = ECommDbDialogPrefWarn; |
|
568 iDialogBoxError = KErrNone; |
|
569 iExpectedError = KErrNone; |
|
570 iNetworkId = 209; |
|
571 } |
|
572 |
|
573 CNetConTest0209::~CNetConTest0209() |
|
574 { } |
|
575 |
|
576 const TDesC& CNetConTest0209::Name() const |
|
577 { |
|
578 |
|
579 _LIT(KTestName, "Test Case NC-2-9"); |
|
580 return KTestName(); |
|
581 } |
|
582 |
|
583 void CNetConTest0209::DialogCbComplete() |
|
584 { |
|
585 |
|
586 ASSERT(iDialogBoxObserver); |
|
587 ASSERT(iDialogBoxAction == EWarnNewConnection); |
|
588 |
|
589 TBool response; |
|
590 if(iDialogBoxError == KErrNone) |
|
591 response = ETrue; |
|
592 else |
|
593 response = EFalse; |
|
594 |
|
595 iDialogBoxObserver->MDPOWarnComplete(iDialogBoxError, response); |
|
596 iDialogBoxObserver = NULL; |
|
597 iDialogBoxError = KErrNone; |
|
598 } |
|
599 |
|
600 void CNetConTest0209::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
601 { |
|
602 |
|
603 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
604 |
|
605 if(aError!=iExpectedError) |
|
606 { |
|
607 CompleteTest(MNetConTest::EFailed); |
|
608 return; |
|
609 } |
|
610 |
|
611 TNifAgentInfo info; |
|
612 iAgent->Info(info); |
|
613 |
|
614 if(aRequest->AgentName() == info.iName) |
|
615 { |
|
616 CompleteTest(MNetConTest::EPassed); |
|
617 } |
|
618 else |
|
619 { |
|
620 CompleteTest(MNetConTest::EFailed); |
|
621 } |
|
622 } |
|
623 |
|
624 // |
|
625 // Test case NC-2-10 |
|
626 // |
|
627 |
|
628 CNetConTest0210* CNetConTest0210::NewLC() |
|
629 { |
|
630 CNetConTest0210* self = new(ELeave) CNetConTest0210(); |
|
631 CleanupStack::PushL(self); |
|
632 self->ConstructL(); |
|
633 return self; |
|
634 } |
|
635 |
|
636 CNetConTest0210::CNetConTest0210() |
|
637 { |
|
638 |
|
639 iConnectType = EConnStartExplicit; |
|
640 iConnectionAttempt = 1; |
|
641 iLastConnectionError = KErrNone; |
|
642 iAvailableBearers = KCommDbBearerCSD; |
|
643 iDialogBoxPref = ECommDbDialogPrefWarn; |
|
644 iDialogBoxError = KErrCancel; |
|
645 iExpectedError = KErrCancel; |
|
646 iNetworkId = 210; |
|
647 } |
|
648 |
|
649 CNetConTest0210::~CNetConTest0210() |
|
650 { } |
|
651 |
|
652 const TDesC& CNetConTest0210::Name() const |
|
653 { |
|
654 |
|
655 _LIT(KTestName, "Test Case NC-2-10"); |
|
656 return KTestName(); |
|
657 } |
|
658 |
|
659 void CNetConTest0210::DialogCbComplete() |
|
660 { |
|
661 |
|
662 ASSERT(iDialogBoxObserver); |
|
663 ASSERT(iDialogBoxAction == EWarnNewConnection); |
|
664 |
|
665 TBool response; |
|
666 if(iDialogBoxError == KErrNone) |
|
667 response = ETrue; |
|
668 else |
|
669 response = EFalse; |
|
670 |
|
671 iDialogBoxObserver->MDPOWarnComplete(iDialogBoxError, response); |
|
672 iDialogBoxObserver = NULL; |
|
673 iDialogBoxError = KErrNone; |
|
674 } |
|
675 |
|
676 |
|
677 // |
|
678 // Test case NC-2-11 |
|
679 // |
|
680 |
|
681 CNetConTest0211* CNetConTest0211::NewLC() |
|
682 { |
|
683 CNetConTest0211* self = new(ELeave) CNetConTest0211(); |
|
684 CleanupStack::PushL(self); |
|
685 self->ConstructL(); |
|
686 return self; |
|
687 } |
|
688 |
|
689 CNetConTest0211::CNetConTest0211() |
|
690 { |
|
691 |
|
692 iConnectType = EConnStartExplicit; |
|
693 iConnectionAttempt = 1; |
|
694 iLastConnectionError = KErrNone; |
|
695 iDialogBoxPref = ECommDbDialogPrefPromptIfWrongMode; |
|
696 iDialogBoxError = KErrNone; |
|
697 iExpectedError = KErrNone; |
|
698 iNetworkId = 211; |
|
699 } |
|
700 |
|
701 CNetConTest0211::~CNetConTest0211() |
|
702 { } |
|
703 |
|
704 const TDesC& CNetConTest0211::Name() const |
|
705 { |
|
706 |
|
707 _LIT(KTestName, "Test Case NC-2-11"); |
|
708 return KTestName(); |
|
709 } |
|
710 |
|
711 void CNetConTest0211::GetCurrentSettingsL(TConnectionSettings& aSettings, TCommDbConnectionDirection aDirection, TUint32 aRank) |
|
712 { |
|
713 |
|
714 if(aRank!=(TUint32)iConnectionAttempt) |
|
715 { |
|
716 CompleteTest(MNetConTest::EFailed); |
|
717 return; |
|
718 } |
|
719 |
|
720 iSettings.iRank = aRank; |
|
721 iSettings.iDirection = aDirection; |
|
722 iSettings.iDialogPref = ECommDbDialogPrefPromptIfWrongMode; |
|
723 iSettings.iIAPId = 5; |
|
724 iSettings.iServiceId = 2; |
|
725 iSettings.iBearerId = 2; |
|
726 iSettings.iLocationId = 2; |
|
727 iSettings.iChargeCardId = 0; |
|
728 |
|
729 aSettings = iSettings; |
|
730 } |
|
731 |
|
732 RMobilePhone::TMobilePhoneNetworkMode CNetConTest0211::NetworkMode() const |
|
733 { |
|
734 } |
|
735 |
|
736 void CNetConTest0211::DialogCbComplete() |
|
737 { |
|
738 |
|
739 ASSERT(iDialogBoxObserver); |
|
740 ASSERT(iDialogBoxAction == ESelectConnection); |
|
741 |
|
742 iDialogBoxObserver->MDPOSelectComplete(iDialogBoxError, iSettings); |
|
743 iDialogBoxObserver = NULL; |
|
744 iDialogBoxError = KErrNone; |
|
745 } |
|
746 |
|
747 |
|
748 // |
|
749 // Test case NC-2-12 |
|
750 // |
|
751 |
|
752 CNetConTest0212* CNetConTest0212::NewLC() |
|
753 { |
|
754 CNetConTest0212* self = new(ELeave) CNetConTest0212(); |
|
755 CleanupStack::PushL(self); |
|
756 self->ConstructL(); |
|
757 return self; |
|
758 } |
|
759 |
|
760 CNetConTest0212::CNetConTest0212() |
|
761 { |
|
762 |
|
763 iConnectType = EConnStartExplicit; |
|
764 iConnectionAttempt = 1; |
|
765 iLastConnectionError = KErrNone; |
|
766 iDialogBoxPref = ECommDbDialogPrefPromptIfWrongMode; |
|
767 iDialogBoxError = KErrNone; |
|
768 iExpectedError = KErrNone; |
|
769 iNetworkId = 212; |
|
770 } |
|
771 |
|
772 CNetConTest0212::~CNetConTest0212() |
|
773 { } |
|
774 |
|
775 const TDesC& CNetConTest0212::Name() const |
|
776 { |
|
777 |
|
778 _LIT(KTestName, "Test Case NC-2-12"); |
|
779 return KTestName(); |
|
780 } |
|
781 |
|
782 void CNetConTest0212::GetCurrentSettingsL(TConnectionSettings& aSettings, TCommDbConnectionDirection aDirection, TUint32 aRank) |
|
783 { |
|
784 |
|
785 if(aRank!=(TUint32)iConnectionAttempt) |
|
786 { |
|
787 CompleteTest(MNetConTest::EFailed); |
|
788 return; |
|
789 } |
|
790 |
|
791 iSettings.iRank = aRank; |
|
792 iSettings.iDirection = aDirection; |
|
793 iSettings.iDialogPref = ECommDbDialogPrefPromptIfWrongMode; |
|
794 iSettings.iIAPId = 5; |
|
795 iSettings.iServiceId = 2; |
|
796 iSettings.iBearerId = 2; |
|
797 iSettings.iLocationId = 2; |
|
798 iSettings.iChargeCardId = 0; |
|
799 |
|
800 aSettings = iSettings; |
|
801 } |
|
802 |
|
803 RMobilePhone::TMobilePhoneNetworkMode CNetConTest0212::NetworkMode() const |
|
804 { |
|
805 } |
|
806 |
|
807 void CNetConTest0212::DialogCbComplete() |
|
808 { |
|
809 |
|
810 ASSERT(iDialogBoxObserver); |
|
811 ASSERT(iDialogBoxAction == ESelectConnection); |
|
812 |
|
813 iDialogBoxObserver->MDPOSelectComplete(iDialogBoxError, iSettings); |
|
814 iDialogBoxObserver = NULL; |
|
815 iDialogBoxError = KErrNone; |
|
816 } |
|
817 |
|
818 |
|
819 // |
|
820 // Test case NC-2-13 |
|
821 // |
|
822 |
|
823 CNetConTest0213* CNetConTest0213::NewLC() |
|
824 { |
|
825 CNetConTest0213* self = new(ELeave) CNetConTest0213(); |
|
826 CleanupStack::PushL(self); |
|
827 self->ConstructL(); |
|
828 return self; |
|
829 } |
|
830 |
|
831 CNetConTest0213::CNetConTest0213() |
|
832 { |
|
833 |
|
834 iConnectType = EConnStartExplicit; |
|
835 iConnectionAttempt = 1; |
|
836 iLastConnectionError = KErrNone; |
|
837 iAvailableBearers = KCommDbBearerCSD; |
|
838 iDialogBoxPref = ECommDbDialogPrefPromptIfWrongMode; |
|
839 iDialogBoxError = KErrNone; |
|
840 iExpectedError = KErrNone; |
|
841 iNetworkId = 213; |
|
842 } |
|
843 |
|
844 CNetConTest0213::~CNetConTest0213() |
|
845 { } |
|
846 |
|
847 const TDesC& CNetConTest0213::Name() const |
|
848 { |
|
849 |
|
850 _LIT(KTestName, "Test Case NC-2-13"); |
|
851 return KTestName(); |
|
852 } |
|
853 |
|
854 void CNetConTest0213::GetCurrentSettingsL(TConnectionSettings& aSettings, TCommDbConnectionDirection aDirection, TUint32 aRank) |
|
855 { |
|
856 |
|
857 if(aRank!=(TUint32)iConnectionAttempt) |
|
858 { |
|
859 CompleteTest(MNetConTest::EFailed); |
|
860 return; |
|
861 } |
|
862 |
|
863 iSettings.iRank = aRank; |
|
864 iSettings.iDirection = aDirection; |
|
865 iSettings.iDialogPref = ECommDbDialogPrefPromptIfWrongMode; |
|
866 iSettings.iIAPId = 5; |
|
867 iSettings.iServiceId = 2; |
|
868 iSettings.iBearerId = 2; |
|
869 iSettings.iLocationId = 2; |
|
870 iSettings.iChargeCardId = 0; |
|
871 |
|
872 aSettings = iSettings; |
|
873 } |
|
874 |
|
875 RMobilePhone::TMobilePhoneNetworkMode CNetConTest0213::NetworkMode() const |
|
876 { |
|
877 } |
|
878 |
|
879 void CNetConTest0213::DialogCbComplete() |
|
880 { |
|
881 |
|
882 ASSERT(iDialogBoxObserver); |
|
883 ASSERT(iDialogBoxAction == ESelectConnection); |
|
884 |
|
885 iDialogBoxObserver->MDPOSelectComplete(iDialogBoxError, iSettings); |
|
886 iDialogBoxObserver = NULL; |
|
887 iDialogBoxError = KErrNone; |
|
888 } |
|
889 |
|
890 |
|
891 // |
|
892 // Test case NC-2-14 |
|
893 // |
|
894 |
|
895 CNetConTest0214* CNetConTest0214::NewLC() |
|
896 { |
|
897 CNetConTest0214* self = new(ELeave) CNetConTest0214(); |
|
898 CleanupStack::PushL(self); |
|
899 self->ConstructL(); |
|
900 return self; |
|
901 } |
|
902 |
|
903 CNetConTest0214::CNetConTest0214() |
|
904 { |
|
905 |
|
906 iConnectType = EConnStartExplicit; |
|
907 iConnectionAttempt = 1; |
|
908 iLastConnectionError = KErrNone; |
|
909 iAvailableBearers = KCommDbBearerCSD; |
|
910 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
911 iDialogBoxError = KErrNone; |
|
912 iExpectedError = KErrNone; |
|
913 iNetworkId = 214; |
|
914 } |
|
915 |
|
916 CNetConTest0214::~CNetConTest0214() |
|
917 { } |
|
918 |
|
919 const TDesC& CNetConTest0214::Name() const |
|
920 { |
|
921 |
|
922 _LIT(KTestName, "Test Case NC-2-14"); |
|
923 return KTestName(); |
|
924 } |
|
925 |
|
926 |
|
927 // |
|
928 // Test case NC-2-15 |
|
929 // |
|
930 |
|
931 CNetConTest0215* CNetConTest0215::NewLC() |
|
932 { |
|
933 CNetConTest0215* self = new(ELeave) CNetConTest0215(); |
|
934 CleanupStack::PushL(self); |
|
935 self->ConstructL(); |
|
936 return self; |
|
937 } |
|
938 |
|
939 CNetConTest0215::CNetConTest0215() |
|
940 { |
|
941 |
|
942 iConnectType = EConnStartExplicit; |
|
943 iConnectionAttempt = 1; |
|
944 iLastConnectionError = KErrNone; |
|
945 iAvailableBearers = KCommDbBearerCSD; |
|
946 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
947 iDialogBoxError = KErrNone; |
|
948 iExpectedError = KErrNone; |
|
949 } |
|
950 |
|
951 void CNetConTest0215::ConstructL() |
|
952 { |
|
953 |
|
954 CNetConSelectionRequestTestBase::ConstructL(); |
|
955 |
|
956 iAgent = new(ELeave) CStubbedAgent(); |
|
957 } |
|
958 |
|
959 CNetConTest0215::~CNetConTest0215() |
|
960 { } |
|
961 |
|
962 const TDesC& CNetConTest0215::Name() const |
|
963 { |
|
964 |
|
965 _LIT(KTestName, "Test Case NC-2-15"); |
|
966 return KTestName(); |
|
967 } |
|
968 |
|
969 TInt CNetConTest0215::FindExistingAgentForSelection(CNifAgentBase*& aAgent, CCommsDbAccess*) const |
|
970 { |
|
971 |
|
972 ASSERT(iAgent); |
|
973 aAgent = iAgent; |
|
974 return KErrNone; |
|
975 } |
|
976 |
|
977 void CNetConTest0215::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
978 { |
|
979 |
|
980 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
981 |
|
982 if(aError!=iExpectedError) |
|
983 { |
|
984 CompleteTest(MNetConTest::EFailed); |
|
985 return; |
|
986 } |
|
987 |
|
988 TNifAgentInfo info; |
|
989 iAgent->Info(info); |
|
990 |
|
991 if(aRequest->AgentName() == info.iName) |
|
992 { |
|
993 CompleteTest(MNetConTest::EPassed); |
|
994 } |
|
995 else |
|
996 { |
|
997 CompleteTest(MNetConTest::EFailed); |
|
998 } |
|
999 } |
|
1000 |
|
1001 |
|
1002 // |
|
1003 // Test case NC-2-16 |
|
1004 // |
|
1005 |
|
1006 CNetConTest0216* CNetConTest0216::NewLC() |
|
1007 { |
|
1008 CNetConTest0216* self = new(ELeave) CNetConTest0216(); |
|
1009 CleanupStack::PushL(self); |
|
1010 self->ConstructL(); |
|
1011 return self; |
|
1012 } |
|
1013 |
|
1014 CNetConTest0216::CNetConTest0216() |
|
1015 { |
|
1016 |
|
1017 iConnectType = EConnStartExplicit; |
|
1018 iConnectionAttempt = 1; |
|
1019 iLastConnectionError = KErrNone; |
|
1020 iAvailableBearers = KCommDbBearerCSD; |
|
1021 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1022 iDialogBoxError = KErrNone; |
|
1023 iExpectedError = KErrNone; |
|
1024 iNetworkId = 216; |
|
1025 } |
|
1026 |
|
1027 CNetConTest0216::~CNetConTest0216() |
|
1028 {} |
|
1029 |
|
1030 const TDesC& CNetConTest0216::Name() const |
|
1031 { |
|
1032 |
|
1033 _LIT(KTestName, "Test Case NC-2-16"); |
|
1034 return KTestName(); |
|
1035 } |
|
1036 |
|
1037 void CNetConTest0216::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
1038 { |
|
1039 |
|
1040 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
1041 |
|
1042 if(aError!=iExpectedError) |
|
1043 { |
|
1044 CompleteTest(MNetConTest::EFailed); |
|
1045 return; |
|
1046 } |
|
1047 |
|
1048 TNifAgentInfo info; |
|
1049 iAgent->Info(info); |
|
1050 |
|
1051 if(aRequest->AgentName() == info.iName) |
|
1052 { |
|
1053 CompleteTest(MNetConTest::EPassed); |
|
1054 } |
|
1055 else |
|
1056 { |
|
1057 CompleteTest(MNetConTest::EFailed); |
|
1058 } |
|
1059 } |
|
1060 |
|
1061 |
|
1062 // |
|
1063 // Test case NC-2-17 |
|
1064 // |
|
1065 |
|
1066 CNetConTest0217* CNetConTest0217::NewLC() |
|
1067 { |
|
1068 CNetConTest0217* self = new(ELeave) CNetConTest0217(); |
|
1069 CleanupStack::PushL(self); |
|
1070 self->ConstructL(); |
|
1071 return self; |
|
1072 } |
|
1073 |
|
1074 CNetConTest0217::CNetConTest0217() |
|
1075 { |
|
1076 |
|
1077 iConnectType = EConnStartExplicit; |
|
1078 iConnectionAttempt = 1; |
|
1079 iLastConnectionError = KErrNone; |
|
1080 iAvailableBearers = KCommDbBearerCSD; |
|
1081 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1082 iDialogBoxError = KErrNone; |
|
1083 iExpectedError = KErrNone; |
|
1084 iNetworkId = 217; |
|
1085 } |
|
1086 |
|
1087 CNetConTest0217::~CNetConTest0217() |
|
1088 {} |
|
1089 |
|
1090 const TDesC& CNetConTest0217::Name() const |
|
1091 { |
|
1092 |
|
1093 _LIT(KTestName, "Test Case NC-2-17"); |
|
1094 return KTestName(); |
|
1095 } |
|
1096 |
|
1097 void CNetConTest0217::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
1098 { |
|
1099 |
|
1100 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
1101 |
|
1102 if(aError!=iExpectedError) |
|
1103 { |
|
1104 CompleteTest(MNetConTest::EFailed); |
|
1105 return; |
|
1106 } |
|
1107 |
|
1108 TNifAgentInfo info; |
|
1109 iAgent->Info(info); |
|
1110 |
|
1111 if(aRequest->AgentName() == info.iName) |
|
1112 { |
|
1113 CompleteTest(MNetConTest::EPassed); |
|
1114 } |
|
1115 else |
|
1116 { |
|
1117 CompleteTest(MNetConTest::EFailed); |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 |
|
1122 // |
|
1123 // Test case NC-2-18 |
|
1124 // |
|
1125 |
|
1126 CNetConTest0218* CNetConTest0218::NewLC() |
|
1127 { |
|
1128 CNetConTest0218* self = new(ELeave) CNetConTest0218(); |
|
1129 CleanupStack::PushL(self); |
|
1130 self->ConstructL(); |
|
1131 return self; |
|
1132 } |
|
1133 |
|
1134 CNetConTest0218::CNetConTest0218() |
|
1135 { |
|
1136 |
|
1137 iConnectType = EConnStartExplicit; |
|
1138 iConnectionAttempt = 1; |
|
1139 iLastConnectionError = KErrNone; |
|
1140 iAvailableBearers = KCommDbBearerCSD; |
|
1141 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1142 iDialogBoxError = KErrNone; |
|
1143 iExpectedError = KErrNotFound; |
|
1144 iNetworkId = 218; |
|
1145 } |
|
1146 |
|
1147 CNetConTest0218::~CNetConTest0218() |
|
1148 {} |
|
1149 |
|
1150 const TDesC& CNetConTest0218::Name() const |
|
1151 { |
|
1152 |
|
1153 _LIT(KTestName, "Test Case NC-2-18"); |
|
1154 return KTestName(); |
|
1155 } |
|
1156 |
|
1157 void CNetConTest0218::GetDesL(const TDesC& aTable, const TDesC& aField, TDes16& aValue) |
|
1158 { |
|
1159 |
|
1160 if(aField == TPtrC(AGENT_NAME)) |
|
1161 { |
|
1162 _LIT(KAgentName, "MissingAgent"); |
|
1163 aValue = KAgentName(); |
|
1164 } |
|
1165 else |
|
1166 { |
|
1167 CNetConSelectionRequestTestBase::GetDesL( aTable, aField, aValue ); |
|
1168 } |
|
1169 } |
|
1170 |
|
1171 |
|
1172 // |
|
1173 // Test case NC-2-19 |
|
1174 // |
|
1175 |
|
1176 CNetConTest0219* CNetConTest0219::NewLC() |
|
1177 { |
|
1178 CNetConTest0219* self = new(ELeave) CNetConTest0219(); |
|
1179 CleanupStack::PushL(self); |
|
1180 self->ConstructL(); |
|
1181 return self; |
|
1182 } |
|
1183 |
|
1184 CNetConTest0219::CNetConTest0219() |
|
1185 { |
|
1186 |
|
1187 iConnectType = EConnStartExplicit; |
|
1188 iConnectionAttempt = 1; |
|
1189 iLastConnectionError = KErrNone; |
|
1190 iAvailableBearers = (KCommDbBearerCSD | KCommDbBearerPSD); |
|
1191 iDialogBoxPref = ECommDbDialogPrefPrompt; |
|
1192 iDialogBoxError = KErrNone; |
|
1193 iExpectedError = KErrNone; |
|
1194 iNetworkId = 219; |
|
1195 } |
|
1196 |
|
1197 void CNetConTest0219::ConstructL() |
|
1198 // |
|
1199 // Override ConstructL() in CNetConSelectionRequestTestBase so that we can |
|
1200 // pass in some actual connection preferences. |
|
1201 // |
|
1202 { |
|
1203 CNetConRequestTestBase::ConstructL(); |
|
1204 |
|
1205 TCommDbConnPref prefs; |
|
1206 prefs.SetBearerSet(KCommDbBearerPSD); |
|
1207 prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); |
|
1208 prefs.SetDirection(ECommDbConnectionDirectionOutgoing); |
|
1209 prefs.SetIapId(7); |
|
1210 prefs.SetNetId(3); |
|
1211 |
|
1212 iRequest = CSelectionRequest::NewL(this, this, iConnectType, prefs, iConnectionAttempt, iLastConnectionError); |
|
1213 } |
|
1214 |
|
1215 CNetConTest0219::~CNetConTest0219() |
|
1216 {} |
|
1217 |
|
1218 const TDesC& CNetConTest0219::Name() const |
|
1219 { |
|
1220 |
|
1221 _LIT(KTestName, "Test Case NC-2-19"); |
|
1222 return KTestName(); |
|
1223 } |
|
1224 |
|
1225 void CNetConTest0219::SetOverridesL(CCommDbOverrideSettings* aOverrides) |
|
1226 { |
|
1227 |
|
1228 if(!aOverrides) |
|
1229 return; |
|
1230 |
|
1231 // check that the overrides match our preferences |
|
1232 |
|
1233 CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref overPrefs; |
|
1234 |
|
1235 overPrefs.iDirection = ECommDbConnectionDirectionOutgoing; |
|
1236 overPrefs.iRanking = iConnectionAttempt; |
|
1237 TRAPD(err, aOverrides->GetConnectionPreferenceOverride(overPrefs)); |
|
1238 ASSERT(err==KErrNone); |
|
1239 |
|
1240 if((overPrefs.iBearer.iBearerSet != KCommDbBearerPSD) || |
|
1241 (overPrefs.iBearer.iIapId != 7) || |
|
1242 (overPrefs.iDialogPref != ECommDbDialogPrefDoNotPrompt)) |
|
1243 { |
|
1244 CompleteTest(MNetConTest::EFailed); |
|
1245 return; |
|
1246 } |
|
1247 |
|
1248 // update settings to reflect overrides |
|
1249 iSettings.iRank = iConnectionAttempt; |
|
1250 iSettings.iDirection = ECommDbConnectionDirectionOutgoing; |
|
1251 iSettings.iDialogPref = ECommDbDialogPrefDoNotPrompt; |
|
1252 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1253 iSettings.iBearerSet = KCommDbBearerPSD; |
|
1254 iSettings.iIAPId = 7; |
|
1255 } |
|
1256 |
|
1257 void CNetConTest0219::DialogCbComplete() |
|
1258 { |
|
1259 |
|
1260 // this should not be called since the preferences say Do Not Prompt |
|
1261 CompleteTest(MNetConTest::EFailed); |
|
1262 } |
|
1263 |
|
1264 void CNetConTest0219::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
1265 { |
|
1266 |
|
1267 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
1268 |
|
1269 if(aError!=iExpectedError) |
|
1270 { |
|
1271 CompleteTest(MNetConTest::EFailed); |
|
1272 return; |
|
1273 } |
|
1274 |
|
1275 ASSERT(iAgent); |
|
1276 |
|
1277 TNifAgentInfo info; |
|
1278 iAgent->Info(info); |
|
1279 |
|
1280 if(aRequest->AgentName() == info.iName) |
|
1281 { |
|
1282 CompleteTest(MNetConTest::EPassed); |
|
1283 } |
|
1284 else |
|
1285 { |
|
1286 CompleteTest(MNetConTest::EFailed); |
|
1287 } |
|
1288 } |
|
1289 |
|
1290 |
|
1291 // |
|
1292 // Test case NC-2-20 |
|
1293 // |
|
1294 |
|
1295 CNetConTest0220* CNetConTest0220::NewLC() |
|
1296 { |
|
1297 CNetConTest0220* self = new(ELeave) CNetConTest0220(); |
|
1298 CleanupStack::PushL(self); |
|
1299 self->ConstructL(); |
|
1300 return self; |
|
1301 } |
|
1302 |
|
1303 CNetConTest0220::CNetConTest0220() |
|
1304 { |
|
1305 |
|
1306 iConnectType = EConnStartExplicit; |
|
1307 iConnectionAttempt = 1; |
|
1308 iLastConnectionError = KErrNone; |
|
1309 iAvailableBearers = (KCommDbBearerCSD | KCommDbBearerPSD); |
|
1310 iDialogBoxPref = ECommDbDialogPrefPrompt; |
|
1311 iDialogBoxError = KErrNone; |
|
1312 iExpectedError = KErrNone; |
|
1313 iNetworkId = 220; |
|
1314 } |
|
1315 |
|
1316 void CNetConTest0220::ConstructL() |
|
1317 // |
|
1318 // Override ConstructL() in CNetConSelectionRequestTestBase so that we can |
|
1319 // pass in some actual connection preferences. |
|
1320 // |
|
1321 { |
|
1322 CNetConRequestTestBase::ConstructL(); |
|
1323 |
|
1324 TCommDbConnPref prefs; |
|
1325 prefs.SetDialogPreference(ECommDbDialogPrefWarn); |
|
1326 |
|
1327 iRequest = CSelectionRequest::NewL(this, this, iConnectType, prefs, iConnectionAttempt, iLastConnectionError); |
|
1328 } |
|
1329 |
|
1330 CNetConTest0220::~CNetConTest0220() |
|
1331 {} |
|
1332 |
|
1333 const TDesC& CNetConTest0220::Name() const |
|
1334 { |
|
1335 |
|
1336 _LIT(KTestName, "Test Case NC-2-20"); |
|
1337 return KTestName(); |
|
1338 } |
|
1339 |
|
1340 void CNetConTest0220::SetOverridesL(CCommDbOverrideSettings* aOverrides) |
|
1341 { |
|
1342 |
|
1343 if(!aOverrides) |
|
1344 return; |
|
1345 |
|
1346 // check that the overrides match our preferences |
|
1347 |
|
1348 CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref overPrefs; |
|
1349 |
|
1350 overPrefs.iDirection = ECommDbConnectionDirectionOutgoing; |
|
1351 overPrefs.iRanking = iConnectionAttempt; |
|
1352 TRAPD(err, aOverrides->GetConnectionPreferenceOverride(overPrefs)); |
|
1353 ASSERT(err==KErrNone); |
|
1354 |
|
1355 if((overPrefs.iDialogPref != ECommDbDialogPrefWarn) || |
|
1356 (overPrefs.iBearer.iIapId != iSettings.iIAPId) || |
|
1357 (overPrefs.iBearer.iBearerSet != iSettings.iBearerSet)) |
|
1358 { |
|
1359 CompleteTest(MNetConTest::EFailed); |
|
1360 return; |
|
1361 } |
|
1362 |
|
1363 // update settings to reflect overrides |
|
1364 iDialogBoxPref = ECommDbDialogPrefWarn; |
|
1365 } |
|
1366 |
|
1367 void CNetConTest0220::SelectConnection(MDialogProcessorObserver&, const TConnectionPrefs&) |
|
1368 { |
|
1369 CompleteTest(MNetConTest::EFailed); |
|
1370 } |
|
1371 |
|
1372 void CNetConTest0220::SelectConnection(MDialogProcessorObserver&, const TConnectionPrefs&, TInt) |
|
1373 { |
|
1374 CompleteTest(MNetConTest::EFailed); |
|
1375 } |
|
1376 |
|
1377 void CNetConTest0220::SelectModemAndLocation(MDialogProcessorObserver&) |
|
1378 { |
|
1379 CompleteTest(MNetConTest::EFailed); |
|
1380 } |
|
1381 |
|
1382 void CNetConTest0220::DialogCbComplete() |
|
1383 { |
|
1384 |
|
1385 ASSERT(iDialogBoxObserver); |
|
1386 ASSERT(iDialogBoxAction == EWarnNewConnection); |
|
1387 |
|
1388 TBool response; |
|
1389 if(iDialogBoxError == KErrNone) |
|
1390 response = ETrue; |
|
1391 else |
|
1392 response = EFalse; |
|
1393 |
|
1394 iDialogBoxObserver->MDPOWarnComplete(iDialogBoxError, response); |
|
1395 |
|
1396 iDialogBoxObserver = NULL; |
|
1397 iDialogBoxError = KErrNone; |
|
1398 } |
|
1399 |
|
1400 void CNetConTest0220::RequestComplete(const CSelectionRequest* aRequest, TInt aError) |
|
1401 { |
|
1402 |
|
1403 ASSERT((CNetConRequestBase*)aRequest == iRequest); |
|
1404 |
|
1405 if(aError!=iExpectedError) |
|
1406 { |
|
1407 CompleteTest(MNetConTest::EFailed); |
|
1408 return; |
|
1409 } |
|
1410 |
|
1411 ASSERT(iAgent); |
|
1412 |
|
1413 TNifAgentInfo info; |
|
1414 iAgent->Info(info); |
|
1415 |
|
1416 if(aRequest->AgentName() == info.iName) |
|
1417 { |
|
1418 CompleteTest(MNetConTest::EPassed); |
|
1419 } |
|
1420 else |
|
1421 { |
|
1422 CompleteTest(MNetConTest::EFailed); |
|
1423 } |
|
1424 } |
|
1425 |
|
1426 |
|
1427 // |
|
1428 // Test case NC-2-21 (was NC-1-14) |
|
1429 // |
|
1430 |
|
1431 CNetConTest0221* CNetConTest0221::NewLC() |
|
1432 { |
|
1433 CNetConTest0221* self = new(ELeave) CNetConTest0221(); |
|
1434 CleanupStack::PushL(self); |
|
1435 self->ConstructL(); |
|
1436 return self; |
|
1437 } |
|
1438 |
|
1439 CNetConTest0221::CNetConTest0221() |
|
1440 { |
|
1441 |
|
1442 iConnectType = EConnStartExplicit; |
|
1443 iConnectionAttempt = 1; |
|
1444 iLastConnectionError = KErrNone; |
|
1445 iAvailableBearers = (KCommDbBearerCSD | KCommDbBearerPSD); |
|
1446 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1447 iDialogBoxError = KErrNone; |
|
1448 iExpectedError = KErrNone; |
|
1449 iNetworkId = 221; |
|
1450 } |
|
1451 |
|
1452 void CNetConTest0221::ConstructL() |
|
1453 { |
|
1454 |
|
1455 CNetConRequestTestBase::ConstructL(); |
|
1456 |
|
1457 TCommDbConnPref connPref1; |
|
1458 connPref1.SetIapId(222); |
|
1459 |
|
1460 TCommDbConnPref connPref2; |
|
1461 connPref2.SetIapId(111); |
|
1462 |
|
1463 User::LeaveIfError(iMultiPref.SetPreference(1, connPref1)); |
|
1464 User::LeaveIfError(iMultiPref.SetPreference(2, connPref2)); |
|
1465 |
|
1466 iRequest = CSelectionRequest::NewL(this, this, iConnectType, iMultiPref, iConnectionAttempt, iLastConnectionError); |
|
1467 } |
|
1468 |
|
1469 CNetConTest0221::~CNetConTest0221() |
|
1470 { |
|
1471 } |
|
1472 |
|
1473 const TDesC& CNetConTest0221::Name() const |
|
1474 { |
|
1475 |
|
1476 _LIT(KTestName, "Test Case NC-2-21"); |
|
1477 return KTestName(); |
|
1478 } |
|
1479 |
|
1480 void CNetConTest0221::SetOverridesL(CCommDbOverrideSettings* aOverrides) |
|
1481 { |
|
1482 |
|
1483 if(!aOverrides) |
|
1484 return; |
|
1485 |
|
1486 // check that the overrides match our preferences |
|
1487 CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref overPrefs; |
|
1488 overPrefs.iDirection = ECommDbConnectionDirectionOutgoing; |
|
1489 overPrefs.iRanking = iConnectionAttempt; |
|
1490 TRAPD(err, aOverrides->GetConnectionPreferenceOverride(overPrefs)); |
|
1491 ASSERT(err==KErrNone); |
|
1492 |
|
1493 if((overPrefs.iDialogPref != iSettings.iDialogPref) || |
|
1494 (overPrefs.iBearer.iIapId != 222) || |
|
1495 (overPrefs.iBearer.iBearerSet != iSettings.iBearerSet)) |
|
1496 { |
|
1497 CompleteTest(MNetConTest::EFailed); |
|
1498 return; |
|
1499 } |
|
1500 |
|
1501 // update settings to reflect overrides |
|
1502 iSettings.iIAPId = 222; |
|
1503 } |
|
1504 |
|
1505 void CNetConTest0221::RequestComplete(const CSelectionRequest*, TInt aError) |
|
1506 { |
|
1507 |
|
1508 if(aError==KErrNone) |
|
1509 CompleteTest(MNetConTest::EPassed); |
|
1510 else |
|
1511 CompleteTest(MNetConTest::EFailed); |
|
1512 } |
|
1513 |
|
1514 |
|
1515 // |
|
1516 // Test case NC-2-22 (was NC-1-15) |
|
1517 // |
|
1518 |
|
1519 CNetConTest0222* CNetConTest0222::NewLC() |
|
1520 { |
|
1521 CNetConTest0222* self = new(ELeave) CNetConTest0222(); |
|
1522 CleanupStack::PushL(self); |
|
1523 self->ConstructL(); |
|
1524 return self; |
|
1525 } |
|
1526 |
|
1527 CNetConTest0222::CNetConTest0222() |
|
1528 { |
|
1529 |
|
1530 iConnectType = EConnStartExplicit; |
|
1531 iConnectionAttempt = 2; |
|
1532 iLastConnectionError = KErrNone; |
|
1533 iAvailableBearers = (KCommDbBearerCSD | KCommDbBearerPSD); |
|
1534 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1535 iDialogBoxError = KErrNone; |
|
1536 iExpectedError = KErrNone; |
|
1537 iNetworkId = 222; |
|
1538 } |
|
1539 |
|
1540 void CNetConTest0222::ConstructL() |
|
1541 { |
|
1542 |
|
1543 CNetConRequestTestBase::ConstructL(); |
|
1544 |
|
1545 TCommDbConnPref connPref1; |
|
1546 connPref1.SetIapId(222); |
|
1547 |
|
1548 TCommDbConnPref connPref2; |
|
1549 connPref2.SetIapId(111); |
|
1550 |
|
1551 User::LeaveIfError(iMultiPref.SetPreference(1, connPref1)); |
|
1552 User::LeaveIfError(iMultiPref.SetPreference(2, connPref2)); |
|
1553 |
|
1554 iRequest = CSelectionRequest::NewL(this, this, iConnectType, iMultiPref, iConnectionAttempt, iLastConnectionError); |
|
1555 } |
|
1556 |
|
1557 CNetConTest0222::~CNetConTest0222() |
|
1558 { |
|
1559 } |
|
1560 |
|
1561 const TDesC& CNetConTest0222::Name() const |
|
1562 { |
|
1563 |
|
1564 _LIT(KTestName, "Test Case NC-2-22"); |
|
1565 return KTestName(); |
|
1566 } |
|
1567 |
|
1568 void CNetConTest0222::SetOverridesL(CCommDbOverrideSettings* aOverrides) |
|
1569 { |
|
1570 |
|
1571 if(!aOverrides) |
|
1572 return; |
|
1573 |
|
1574 // check that the overrides match our preferences |
|
1575 CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref overPrefs; |
|
1576 overPrefs.iDirection = ECommDbConnectionDirectionOutgoing; |
|
1577 overPrefs.iRanking = iConnectionAttempt; |
|
1578 TRAPD(err, aOverrides->GetConnectionPreferenceOverride(overPrefs)); |
|
1579 ASSERT(err==KErrNone); |
|
1580 |
|
1581 if((overPrefs.iDialogPref != iSettings.iDialogPref) || |
|
1582 (overPrefs.iBearer.iIapId != 111) || |
|
1583 (overPrefs.iBearer.iBearerSet != iSettings.iBearerSet)) |
|
1584 { |
|
1585 CompleteTest(MNetConTest::EFailed); |
|
1586 return; |
|
1587 } |
|
1588 |
|
1589 // update settings to reflect overrides |
|
1590 iSettings.iIAPId = 111; |
|
1591 } |
|
1592 |
|
1593 void CNetConTest0222::RequestComplete(const CSelectionRequest*, TInt aError) |
|
1594 { |
|
1595 |
|
1596 if(aError==KErrNone) |
|
1597 CompleteTest(MNetConTest::EPassed); |
|
1598 else |
|
1599 CompleteTest(MNetConTest::EFailed); |
|
1600 } |
|
1601 |
|
1602 |
|
1603 // |
|
1604 // Test case NC-2-23 (was NC-1-16) |
|
1605 // |
|
1606 |
|
1607 CNetConTest0223* CNetConTest0223::NewLC() |
|
1608 { |
|
1609 CNetConTest0223* self = new(ELeave) CNetConTest0223(); |
|
1610 CleanupStack::PushL(self); |
|
1611 self->ConstructL(); |
|
1612 return self; |
|
1613 } |
|
1614 |
|
1615 CNetConTest0223::CNetConTest0223() |
|
1616 { |
|
1617 |
|
1618 iConnectType = EConnStartExplicit; |
|
1619 iConnectionAttempt = 2; |
|
1620 iLastConnectionError = KErrNone; |
|
1621 iAvailableBearers = (KCommDbBearerCSD | KCommDbBearerPSD); |
|
1622 iDialogBoxPref = ECommDbDialogPrefDoNotPrompt; |
|
1623 iDialogBoxError = KErrNone; |
|
1624 iExpectedError = KErrNone; |
|
1625 iNetworkId = 223; |
|
1626 } |
|
1627 |
|
1628 void CNetConTest0223::ConstructL() |
|
1629 { |
|
1630 |
|
1631 CNetConRequestTestBase::ConstructL(); |
|
1632 |
|
1633 TCommDbConnPref connPref1; |
|
1634 connPref1.SetIapId(222); |
|
1635 |
|
1636 TCommDbConnPref connPref2; |
|
1637 connPref2.SetIapId(111); |
|
1638 |
|
1639 User::LeaveIfError(iMultiPref.SetPreference(1, connPref1)); |
|
1640 User::LeaveIfError(iMultiPref.SetPreference(2, connPref2)); |
|
1641 |
|
1642 iMultiPref.SetConnectionAttempts(1); |
|
1643 |
|
1644 iRequest = CSelectionRequest::NewL(this, this, iConnectType, iMultiPref, iConnectionAttempt, iLastConnectionError); |
|
1645 } |
|
1646 |
|
1647 CNetConTest0223::~CNetConTest0223() |
|
1648 { |
|
1649 } |
|
1650 |
|
1651 const TDesC& CNetConTest0223::Name() const |
|
1652 { |
|
1653 |
|
1654 _LIT(KTestName, "Test Case NC-2-23"); |
|
1655 return KTestName(); |
|
1656 } |
|
1657 |
|
1658 void CNetConTest0223::RequestComplete(const CSelectionRequest*, TInt aError) |
|
1659 { |
|
1660 |
|
1661 if(aError!=KErrNone) |
|
1662 CompleteTest(MNetConTest::EPassed); |
|
1663 else |
|
1664 CompleteTest(MNetConTest::EFailed); |
|
1665 } |
|
1666 |
|
1667 |
|
1668 // |
|
1669 // Test case NC-2-24 |
|
1670 // |
|
1671 |
|
1672 CNetConTest0224* CNetConTest0224::NewLC() |
|
1673 { |
|
1674 CNetConTest0224* self = new(ELeave) CNetConTest0224(); |
|
1675 CleanupStack::PushL(self); |
|
1676 self->ConstructL(); |
|
1677 return self; |
|
1678 } |
|
1679 |
|
1680 CNetConTest0224::CNetConTest0224() |
|
1681 { |
|
1682 |
|
1683 iConnectType = EConnStartExplicit; |
|
1684 iConnectionAttempt = 1; |
|
1685 iLastConnectionError = KErrNone; |
|
1686 iAvailableBearers = KCommDbBearerCSD; |
|
1687 iDialogBoxPref = ECommDbDialogPrefPrompt; |
|
1688 iDialogBoxError = KErrCancel; |
|
1689 iExpectedError = KErrCancel; |
|
1690 iNetworkId = 224; |
|
1691 } |
|
1692 |
|
1693 CNetConTest0224::~CNetConTest0224() |
|
1694 { } |
|
1695 |
|
1696 const TDesC& CNetConTest0224::Name() const |
|
1697 { |
|
1698 |
|
1699 _LIT(KTestName, "Test Case NC-2-24"); |
|
1700 return KTestName(); |
|
1701 } |
|
1702 |
|
1703 void CNetConTest0224::DialogCbComplete() |
|
1704 { |
|
1705 |
|
1706 ASSERT(iDialogBoxObserver); |
|
1707 ASSERT(iDialogBoxAction == ESelectConnection); |
|
1708 |
|
1709 iDialogBoxObserver->MDPOSelectComplete(KErrCancel, iSettings); |
|
1710 iDialogBoxObserver = NULL; |
|
1711 iDialogBoxError = KErrNone; |
|
1712 } |
|
1713 |
|
1714 |