|
1 // Copyright (c) 2008-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 // This file contains implementations of the RConnectionUpsStep classes that test the |
|
15 // IP Networking User Prompting Functionality added in PREQ1116. |
|
16 // Each class encapsulates a complete test case and is derived from TE_RConnectionUpsStep |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 #include "TE_RConnectionUpsTestSteps.h" |
|
25 #include <test/upstestnotifierproperties.h> |
|
26 #include <comms-infras/esocktestutils.h> |
|
27 #include <test/es_dummy.h> |
|
28 |
|
29 // Location of DummyNif in Network Table in rconnectionudp.xml |
|
30 const TInt KDummyNifNetworkId = 3; |
|
31 |
|
32 |
|
33 enum TVerdict TE_RConnectionUPSCloseInterfaces::doTestStepPreambleL() |
|
34 { |
|
35 return EPass; |
|
36 } |
|
37 |
|
38 enum TVerdict TE_RConnectionUPSCloseInterfaces::doTestStepPostambleL() |
|
39 { |
|
40 return EPass; |
|
41 } |
|
42 |
|
43 TE_RConnectionUPSCloseInterfaces::~TE_RConnectionUPSCloseInterfaces() |
|
44 { |
|
45 } |
|
46 |
|
47 enum TVerdict TE_RConnectionUPSCloseInterfaces::doTestStepL(void) |
|
48 /** |
|
49 * This test step results in any open interfaces being stopped. |
|
50 * The test step is usually invoked after every test case, when ESOCK needs |
|
51 * to be shut down and restarted. Running this step speeds up the ESOCK |
|
52 * shutdown process. |
|
53 */ |
|
54 { |
|
55 RSocketServ ss; |
|
56 |
|
57 ss.Connect(); |
|
58 CleanupClosePushL(ss); |
|
59 |
|
60 TInt ret = KErrNone; |
|
61 if (KErrNone != WaitForAllInterfacesToCloseL(ss)) |
|
62 { |
|
63 INFO_PRINTF1(_L("Previous test case has left connections up that have not closed. Stopping them.")); |
|
64 TBuf<200> errDesc; |
|
65 if ((ret = ESockTestUtils::StopAllInterfaces(errDesc)) != KErrNone) |
|
66 { |
|
67 INFO_PRINTF3(_L("StopAllInterfaces() ret=%d\n%S"), ret, &errDesc); |
|
68 } |
|
69 } |
|
70 ss.Close(); |
|
71 CleanupStack::Pop(); |
|
72 |
|
73 if (ret != KErrNone) |
|
74 { |
|
75 return EFail; |
|
76 } |
|
77 |
|
78 return EPass; |
|
79 } |
|
80 |
|
81 |
|
82 enum TVerdict TE_RConnectionUPSSetNotifFileOverride::doTestStepPreambleL() |
|
83 { |
|
84 return EPass; |
|
85 } |
|
86 |
|
87 enum TVerdict TE_RConnectionUPSSetNotifFileOverride::doTestStepPostambleL() |
|
88 { |
|
89 return EPass; |
|
90 } |
|
91 |
|
92 TE_RConnectionUPSSetNotifFileOverride::~TE_RConnectionUPSSetNotifFileOverride() |
|
93 { |
|
94 } |
|
95 |
|
96 enum TVerdict TE_RConnectionUPSSetNotifFileOverride::doTestStepL(void) |
|
97 /** |
|
98 * This test step is used set a P&S property which causes |
|
99 * the UPS test Notifier to override any setting which is |
|
100 * has fetched from its configuration file, with the P&S |
|
101 * values set by this test harness. |
|
102 * |
|
103 * This test step is necessary to enable running of this |
|
104 * test harness in regression test environments where a |
|
105 * UPS test notifier config file is present. |
|
106 */ |
|
107 |
|
108 { |
|
109 User::LeaveIfError(RProperty::Set(KUidPSUPSTestNotifCategory, KUtFileOverride, KFileOverride)); |
|
110 return EPass; |
|
111 } |
|
112 |
|
113 |
|
114 enum TVerdict TE_RConnectionUPSUnsetNotifFileOverride::doTestStepPreambleL() |
|
115 { |
|
116 return EPass; |
|
117 } |
|
118 |
|
119 enum TVerdict TE_RConnectionUPSUnsetNotifFileOverride::doTestStepPostambleL() |
|
120 { |
|
121 return EPass; |
|
122 } |
|
123 |
|
124 TE_RConnectionUPSUnsetNotifFileOverride::~TE_RConnectionUPSUnsetNotifFileOverride() |
|
125 { |
|
126 } |
|
127 |
|
128 enum TVerdict TE_RConnectionUPSUnsetNotifFileOverride::doTestStepL(void) |
|
129 /** |
|
130 * This test step is used to unset a P&S property which causes |
|
131 * the UPS test Notifier to override any setting which is |
|
132 * has fetched from its configuration file, with the P&S |
|
133 * values set by this test harness. |
|
134 * |
|
135 * This test step results in the UPS test notifier using settings |
|
136 * from its configuration file, if one is present |
|
137 */ |
|
138 { |
|
139 User::LeaveIfError(RProperty::Set(KUidPSUPSTestNotifCategory, KUtFileOverride, KNoFileOverride)); |
|
140 return EPass; |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 /************************************* |
|
146 * * |
|
147 * Implicit API Call Tests * |
|
148 * * |
|
149 *************************************/ |
|
150 |
|
151 TE_RConnectionUPSTest1a::~TE_RConnectionUPSTest1a() |
|
152 { |
|
153 } |
|
154 |
|
155 enum TVerdict TE_RConnectionUPSTest1a::doTestStepL(void) |
|
156 /** |
|
157 * Test prompting behaviour when calling: |
|
158 * Implicit RSocket::Connect() on a TCP socket |
|
159 */ |
|
160 { |
|
161 TInt err; |
|
162 |
|
163 //Delete entries in the DecisionDB |
|
164 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
165 |
|
166 RSocketServ ss; |
|
167 RSocket sock; |
|
168 |
|
169 err = OpenSocketServer(ss); |
|
170 TESTEL(KErrNone == err, err); |
|
171 CleanupClosePushL(ss); |
|
172 |
|
173 err = OpenTcpSocket(sock, ss); |
|
174 TESTEL(KErrNone == err, err); |
|
175 CleanupClosePushL(sock); |
|
176 |
|
177 //Get the NotifyCount before the RSocket::...() API is called |
|
178 TInt notifyCount1 = GetNotifyCount(); |
|
179 |
|
180 //Set the Test Notifier Response |
|
181 err = SetNotifierResponse(); |
|
182 TESTEL(KErrNone == err, err); |
|
183 |
|
184 //Call Connect() |
|
185 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
186 TESTL(KErrNone == CheckResult(err)); |
|
187 |
|
188 //Get the NotifyCount after the RSocket::...() API is called |
|
189 TInt notifyCount2 = GetNotifyCount(); |
|
190 |
|
191 //Check the Prompt Occurred as expected |
|
192 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
193 TEST(KErrNone == err); |
|
194 |
|
195 err = DestroyTcpSocket(sock); |
|
196 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
197 CleanupStack::Pop(); |
|
198 |
|
199 CloseSocketServer(ss); |
|
200 CleanupStack::Pop(); |
|
201 |
|
202 return TestStepResult(); |
|
203 } // TE_RConnectionUPSTest1a |
|
204 |
|
205 |
|
206 |
|
207 TE_RConnectionUPSTest1b::~TE_RConnectionUPSTest1b() |
|
208 { |
|
209 } |
|
210 |
|
211 enum TVerdict TE_RConnectionUPSTest1b::doTestStepL(void) |
|
212 /** |
|
213 * Test prompting behaviour when calling: |
|
214 * Implicit RSocket::SendTo() on a UDP socket |
|
215 */ |
|
216 { |
|
217 TInt err; |
|
218 |
|
219 //Delete entries in the DecisionDB |
|
220 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
221 |
|
222 RSocketServ ss; |
|
223 RSocket sock; |
|
224 |
|
225 err = OpenSocketServer(ss); |
|
226 TESTEL(KErrNone == err, err); |
|
227 CleanupClosePushL(ss); |
|
228 |
|
229 err = OpenUdpSocketL(sock, ss); |
|
230 TESTEL(KErrNone == err, err); |
|
231 CleanupClosePushL(sock); |
|
232 |
|
233 //Get the NotifyCount beforethe RSocket::...() API is called |
|
234 TInt notifyCount1 = GetNotifyCount(); |
|
235 |
|
236 //Set the Test Notifier Response |
|
237 err = SetNotifierResponse(); |
|
238 TESTEL(KErrNone == err, err); |
|
239 |
|
240 //Call SendTo() and RecvFrom() |
|
241 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
242 TESTL(KErrNone == CheckResult(err)); |
|
243 |
|
244 //Get the NotifyCount after the RSocket::...() API is called |
|
245 TInt notifyCount2 = GetNotifyCount(); |
|
246 |
|
247 //Check the Prompt Occurred as expected |
|
248 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
249 TEST(KErrNone == err); |
|
250 |
|
251 DestroyUdpSocket(sock); |
|
252 CleanupStack::Pop(); |
|
253 |
|
254 CloseSocketServer(ss); |
|
255 CleanupStack::Pop(); |
|
256 |
|
257 return TestStepResult(); |
|
258 } // TE_RConnectionUPSTest1b |
|
259 |
|
260 |
|
261 |
|
262 TE_RConnectionUPSTest1c::~TE_RConnectionUPSTest1c() |
|
263 { |
|
264 } |
|
265 |
|
266 enum TVerdict TE_RConnectionUPSTest1c::doTestStepL(void) |
|
267 /** |
|
268 * Test prompting behaviour when calling: |
|
269 * Implicit Synchronous RHostResolver::GetByName() |
|
270 */ |
|
271 { |
|
272 TInt err; |
|
273 |
|
274 //Delete entries in the DecisionDB |
|
275 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
276 |
|
277 RSocketServ ss; |
|
278 RHostResolver hr; |
|
279 |
|
280 err = OpenSocketServer(ss); |
|
281 TESTEL(KErrNone == err, err); |
|
282 CleanupClosePushL(ss); |
|
283 |
|
284 err = OpenHostResolver(hr, ss); |
|
285 TESTEL(KErrNone == err, err); |
|
286 CleanupClosePushL(hr); |
|
287 |
|
288 //Get the NotifyCount before the RHostResolver::...() API is called |
|
289 TInt notifyCount1 = GetNotifyCount(); |
|
290 |
|
291 //Set the Test Notifier Response |
|
292 err = SetNotifierResponse(); |
|
293 TESTEL(KErrNone == err, err); |
|
294 |
|
295 //Call GetByName() |
|
296 err = MakeSynchronousNameRequest(hr, iTestName); |
|
297 TESTL(KErrNone == CheckResult(err)); |
|
298 |
|
299 //Get the NotifyCount after the RHostResolver::...() API is called |
|
300 TInt notifyCount2 = GetNotifyCount(); |
|
301 |
|
302 //Check the Prompt Occurred as expected |
|
303 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
304 TEST(KErrNone == err); |
|
305 |
|
306 DestroyHostResolver(hr); |
|
307 CleanupStack::Pop(); |
|
308 |
|
309 CloseSocketServer(ss); |
|
310 CleanupStack::Pop(); |
|
311 |
|
312 return TestStepResult(); |
|
313 } // TE_RConnectionUPSTest1c |
|
314 |
|
315 |
|
316 |
|
317 TE_RConnectionUPSTest1d::~TE_RConnectionUPSTest1d() |
|
318 { |
|
319 } |
|
320 |
|
321 enum TVerdict TE_RConnectionUPSTest1d::doTestStepL(void) |
|
322 /** |
|
323 * Test prompting behaviour when calling: |
|
324 * Implicit Synchronous RHostResolver::GetByAddress() |
|
325 */ |
|
326 { |
|
327 TInt err; |
|
328 |
|
329 //Delete entries in the DecisionDB |
|
330 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
331 |
|
332 RSocketServ ss; |
|
333 RHostResolver hr; |
|
334 |
|
335 err = OpenSocketServer(ss); |
|
336 TESTEL(KErrNone == err, err); |
|
337 CleanupClosePushL(ss); |
|
338 |
|
339 err = OpenHostResolver(hr, ss); |
|
340 TESTEL(KErrNone == err, err); |
|
341 CleanupClosePushL(hr); |
|
342 |
|
343 //Get the NotifyCount before the RHostResolver::...() API is called |
|
344 TInt notifyCount1 = GetNotifyCount(); |
|
345 |
|
346 //Set the Test Notifier Response |
|
347 err = SetNotifierResponse(); |
|
348 TESTEL(KErrNone == err, err); |
|
349 |
|
350 //Call GetByAddress() |
|
351 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
352 TESTL(KErrNone == CheckResult(err)); |
|
353 |
|
354 //Get the NotifyCount after the RHostResolver::...() API is called |
|
355 TInt notifyCount2 = GetNotifyCount(); |
|
356 |
|
357 //Check the Prompt Occurred as expected |
|
358 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
359 TEST(KErrNone == err); |
|
360 |
|
361 DestroyHostResolver(hr); |
|
362 CleanupStack::Pop(); |
|
363 |
|
364 CloseSocketServer(ss); |
|
365 CleanupStack::Pop(); |
|
366 |
|
367 return TestStepResult(); |
|
368 |
|
369 } // TE_RConnectionUPSTest1d |
|
370 |
|
371 |
|
372 |
|
373 TE_RConnectionUPSTest2a::~TE_RConnectionUPSTest2a() |
|
374 { |
|
375 } |
|
376 |
|
377 enum TVerdict TE_RConnectionUPSTest2a::doTestStepL(void) |
|
378 /** |
|
379 * Test prompting behaviour when calling: |
|
380 * Implicit RSocket::Connect() followed by another Implicit |
|
381 * RSocket::Connect() |
|
382 */ |
|
383 { |
|
384 TInt err; |
|
385 |
|
386 //Delete entries in the DecisionDB |
|
387 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
388 |
|
389 RSocketServ ss; |
|
390 RSocket sock; |
|
391 |
|
392 err = OpenSocketServer(ss); |
|
393 TESTEL(KErrNone == err, err); |
|
394 CleanupClosePushL(ss); |
|
395 |
|
396 err = OpenTcpSocket(sock, ss); |
|
397 TESTEL(KErrNone == err, err); |
|
398 CleanupClosePushL(sock); |
|
399 |
|
400 //Get the NotifyCount before the RSocket::...() API is called |
|
401 TInt notifyCount1 = GetNotifyCount(); |
|
402 |
|
403 //Set the Test Notifier Response |
|
404 err = SetNotifierResponse(); |
|
405 TESTEL(KErrNone == err, err); |
|
406 |
|
407 //Call Connect() |
|
408 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
409 TESTL(KErrNone == CheckResult(err)); |
|
410 |
|
411 //Get the NotifyCount after the RSocket::...() API is called |
|
412 TInt notifyCount2 = GetNotifyCount(); |
|
413 |
|
414 //Check the Prompt Occurred as expected |
|
415 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
416 TEST(KErrNone == err); |
|
417 |
|
418 |
|
419 RSocket sock2; |
|
420 err = OpenTcpSocket(sock2, ss); |
|
421 TESTEL(KErrNone == err, err); |
|
422 CleanupClosePushL(sock2); |
|
423 |
|
424 //Get the NotifyCount before the RSocket::...() API is called |
|
425 notifyCount1 = GetNotifyCount(); |
|
426 |
|
427 //Set the Test Notifier Response |
|
428 err = SetNotifierResponse(); |
|
429 TESTEL(KErrNone == err, err); |
|
430 |
|
431 //Call Connect() |
|
432 err = ConnectTcpSocket(sock2, iEchoServerAddr); |
|
433 TESTL(KErrNone == CheckResult(err)); |
|
434 |
|
435 //Get the NotifyCount after the RSocket::...() API is called |
|
436 notifyCount2 = GetNotifyCount(); |
|
437 |
|
438 //Check the Prompt Occurred as expected |
|
439 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
440 TEST(KErrNone == err); |
|
441 |
|
442 err = DestroyTcpSocket(sock2); |
|
443 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
444 CleanupStack::Pop(); //sock2 |
|
445 |
|
446 err = DestroyTcpSocket(sock); |
|
447 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
448 CleanupStack::Pop(); //sock |
|
449 |
|
450 CloseSocketServer(ss); |
|
451 CleanupStack::Pop(); //ss |
|
452 |
|
453 return TestStepResult(); |
|
454 } // TE_RConnectionUPSTest2a |
|
455 |
|
456 |
|
457 |
|
458 TE_RConnectionUPSTest2b::~TE_RConnectionUPSTest2b() |
|
459 { |
|
460 } |
|
461 |
|
462 enum TVerdict TE_RConnectionUPSTest2b::doTestStepL(void) |
|
463 /** |
|
464 * Test prompting behaviour when calling: |
|
465 * Implicit RSocket::SendTo() followed by another Implicit |
|
466 * RSocket::SendTo() |
|
467 */ |
|
468 { |
|
469 TInt err; |
|
470 |
|
471 //Delete entries in the DecisionDB |
|
472 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
473 |
|
474 RSocketServ ss; |
|
475 RSocket sock; |
|
476 |
|
477 err = OpenSocketServer(ss); |
|
478 TESTEL(KErrNone == err, err); |
|
479 CleanupClosePushL(ss); |
|
480 |
|
481 err = OpenUdpSocketL(sock, ss); |
|
482 TESTEL(KErrNone == err, err); |
|
483 CleanupClosePushL(sock); |
|
484 |
|
485 //Get the NotifyCount before the RSocket::...() API is called |
|
486 TInt notifyCount1 = GetNotifyCount(); |
|
487 |
|
488 //Set the Test Notifier Response |
|
489 err = SetNotifierResponse(); |
|
490 TESTEL(KErrNone == err, err); |
|
491 |
|
492 //Call SendTo() and RecvFrom() |
|
493 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
494 TESTL(KErrNone == CheckResult(err)); |
|
495 |
|
496 //Get the NotifyCount after the RSocket::...() API is called |
|
497 TInt notifyCount2 = GetNotifyCount(); |
|
498 |
|
499 //Check the Prompt Occurred as expected |
|
500 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
501 TEST(KErrNone == err); |
|
502 |
|
503 |
|
504 RSocket sock2; |
|
505 err = OpenUdpSocketL(sock2, ss); |
|
506 TESTEL(KErrNone == err, err); |
|
507 CleanupClosePushL(sock2); |
|
508 |
|
509 //Get the NotifyCount before the RSocket::...() API is called |
|
510 notifyCount1 = GetNotifyCount(); |
|
511 |
|
512 //Set the Test Notifier Response |
|
513 err = SetNotifierResponse(); |
|
514 TESTEL(KErrNone == err, err); |
|
515 |
|
516 //Call SendTo() and RecvFrom() |
|
517 err = TestUdpDataPathL(sock2, iDummyNifSendAddr); |
|
518 TESTL(KErrNone == CheckResult(err)); |
|
519 |
|
520 //Get the NotifyCount after the RSocket::...() API is called |
|
521 notifyCount2 = GetNotifyCount(); |
|
522 |
|
523 //Check the Prompt Occurred as expected |
|
524 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
525 TEST(KErrNone == err); |
|
526 |
|
527 DestroyUdpSocket(sock2); |
|
528 CleanupStack::Pop(); //sock2 |
|
529 |
|
530 DestroyUdpSocket(sock); |
|
531 CleanupStack::Pop(); //sock |
|
532 |
|
533 CloseSocketServer(ss); |
|
534 CleanupStack::Pop(); //ss |
|
535 |
|
536 return TestStepResult(); |
|
537 } // TE_RConnectionUPSTest2b |
|
538 |
|
539 |
|
540 |
|
541 TE_RConnectionUPSTest2c::~TE_RConnectionUPSTest2c() |
|
542 { |
|
543 } |
|
544 |
|
545 enum TVerdict TE_RConnectionUPSTest2c::doTestStepL(void) |
|
546 /** |
|
547 * Test prompting behaviour when calling: |
|
548 * Implicit Synchronous RHostResolver::GetByName() followed by an Implicit |
|
549 * Asynchronous RHostResolver::GetByName() |
|
550 */ |
|
551 { |
|
552 TInt err; |
|
553 |
|
554 //Delete entries in the DecisionDB |
|
555 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
556 |
|
557 RSocketServ ss; |
|
558 RHostResolver hr; |
|
559 |
|
560 err = OpenSocketServer(ss); |
|
561 TESTEL(KErrNone == err, err); |
|
562 CleanupClosePushL(ss); |
|
563 |
|
564 err = OpenHostResolver(hr, ss); |
|
565 TESTEL(KErrNone == err, err); |
|
566 CleanupClosePushL(hr); |
|
567 |
|
568 //Get the NotifyCount before the RHostResolver::...() API is called |
|
569 TInt notifyCount1 = GetNotifyCount(); |
|
570 |
|
571 //Set the Test Notifier Response |
|
572 err = SetNotifierResponse(); |
|
573 TESTEL(KErrNone == err, err); |
|
574 |
|
575 //Call GetByName() |
|
576 err = MakeSynchronousNameRequest(hr, iTestName); |
|
577 TESTL(KErrNone == CheckResult(err)); |
|
578 |
|
579 //Get the NotifyCount after the RHostResolver::...() API is called |
|
580 TInt notifyCount2 = GetNotifyCount(); |
|
581 |
|
582 //Check the Prompt Occurred as expected |
|
583 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
584 TEST(KErrNone == err); |
|
585 |
|
586 |
|
587 RHostResolver hr2; |
|
588 err = OpenHostResolver(hr2, ss); |
|
589 TESTEL(KErrNone == err, err); |
|
590 CleanupClosePushL(hr2); |
|
591 |
|
592 //Get the NotifyCount before the RHostResolver::...() API is called |
|
593 notifyCount1 = GetNotifyCount(); |
|
594 |
|
595 //Set the Test Notifier Response |
|
596 err = SetNotifierResponse(); |
|
597 TESTEL(KErrNone == err, err); |
|
598 |
|
599 //Call GetByName() |
|
600 err = MakeNameRequest(hr2, iTestName); |
|
601 TESTL(KErrNone == CheckResult(err)); |
|
602 |
|
603 //Get the NotifyCount after the RHostResolver::...() API is called |
|
604 notifyCount2 = GetNotifyCount(); |
|
605 |
|
606 //Check the Prompt Occurred as expected |
|
607 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
608 TEST(KErrNone == err); |
|
609 |
|
610 DestroyHostResolver(hr2); |
|
611 CleanupStack::Pop(); //hr2 |
|
612 |
|
613 DestroyHostResolver(hr); |
|
614 CleanupStack::Pop(); //hr |
|
615 |
|
616 CloseSocketServer(ss); |
|
617 CleanupStack::Pop(); //ss |
|
618 |
|
619 return TestStepResult(); |
|
620 } // TE_RConnectionUPSTest2c |
|
621 |
|
622 |
|
623 |
|
624 TE_RConnectionUPSTest2d::~TE_RConnectionUPSTest2d() |
|
625 { |
|
626 } |
|
627 |
|
628 enum TVerdict TE_RConnectionUPSTest2d::doTestStepL(void) |
|
629 /** |
|
630 * Test prompting behaviour when calling: |
|
631 * Implicit Synchronous RHostResolver::GetByAddress() followed by an Implicit |
|
632 * Asynchronous RHostResolver::GetByAddress() |
|
633 */ |
|
634 { |
|
635 TInt err; |
|
636 |
|
637 //Delete entries in the DecisionDB |
|
638 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
639 |
|
640 RSocketServ ss; |
|
641 RHostResolver hr; |
|
642 |
|
643 err = OpenSocketServer(ss); |
|
644 TESTEL(KErrNone == err, err); |
|
645 CleanupClosePushL(ss); |
|
646 |
|
647 err = OpenHostResolver(hr, ss); |
|
648 TESTEL(KErrNone == err, err); |
|
649 CleanupClosePushL(hr); |
|
650 |
|
651 //Get the NotifyCount before the RHostResolver::...() API is called |
|
652 TInt notifyCount1 = GetNotifyCount(); |
|
653 |
|
654 //Set the Test Notifier Response |
|
655 err = SetNotifierResponse(); |
|
656 TESTEL(KErrNone == err, err); |
|
657 |
|
658 //Call GetByAddress() |
|
659 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
660 TESTL(KErrNone == CheckResult(err)); |
|
661 |
|
662 //Get the NotifyCount after the RHostResolver::...() API is called |
|
663 TInt notifyCount2 = GetNotifyCount(); |
|
664 |
|
665 //Check the Prompt Occurred as expected |
|
666 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
667 TEST(KErrNone == err); |
|
668 |
|
669 |
|
670 RHostResolver hr2; |
|
671 err = OpenHostResolver(hr2, ss); |
|
672 TESTEL(KErrNone == err, err); |
|
673 CleanupClosePushL(hr2); |
|
674 |
|
675 //Get the NotifyCount before the RHostResolver::...() API is called |
|
676 notifyCount1 = GetNotifyCount(); |
|
677 |
|
678 //Set the Test Notifier Response |
|
679 err = SetNotifierResponse(); |
|
680 TESTEL(KErrNone == err, err); |
|
681 |
|
682 //Call GetByAddress() |
|
683 err = MakeAddressRequest(hr2, iLookupAddress); |
|
684 TESTL(KErrNone == CheckResult(err)); |
|
685 |
|
686 //Get the NotifyCount after the RHostResolver::...() API is called |
|
687 notifyCount2 = GetNotifyCount(); |
|
688 |
|
689 //Check the Prompt Occurred as expected |
|
690 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
691 TEST(KErrNone == err); |
|
692 |
|
693 |
|
694 DestroyHostResolver(hr2); |
|
695 CleanupStack::Pop(); //hr2 |
|
696 |
|
697 DestroyHostResolver(hr); |
|
698 CleanupStack::Pop(); //hr |
|
699 |
|
700 CloseSocketServer(ss); |
|
701 CleanupStack::Pop(); //ss |
|
702 |
|
703 return TestStepResult(); |
|
704 |
|
705 } // TE_RConnectionUPSTest2d |
|
706 |
|
707 |
|
708 |
|
709 TE_RConnectionUPSTest3a::~TE_RConnectionUPSTest3a() |
|
710 { |
|
711 } |
|
712 |
|
713 enum TVerdict TE_RConnectionUPSTest3a::doTestStepL(void) |
|
714 /** |
|
715 * Test prompting behaviour when calling: |
|
716 * Implicit RSocket::Connect(), close RSocket, followed by |
|
717 * Implicit RSocket2::Connect() |
|
718 * |
|
719 * This test should behave differently in NetworkLifetime Mode |
|
720 * when Notifier response is Session based, since decision is no |
|
721 * longer valid once first RSocket is closed i.e. once all client |
|
722 * associations with connections cease to exist |
|
723 */ |
|
724 { |
|
725 TInt err; |
|
726 |
|
727 //Delete entries in the DecisionDB |
|
728 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
729 |
|
730 RSocketServ ss; |
|
731 RSocket sock; |
|
732 |
|
733 err = OpenSocketServer(ss); |
|
734 TESTEL(KErrNone == err, err); |
|
735 CleanupClosePushL(ss); |
|
736 |
|
737 err = OpenTcpSocket(sock, ss); |
|
738 TESTEL(KErrNone == err, err); |
|
739 CleanupClosePushL(sock); |
|
740 |
|
741 //Get the NotifyCount before the RSocket::...() API is called |
|
742 TInt notifyCount1 = GetNotifyCount(); |
|
743 |
|
744 //Set the Test Notifier Response |
|
745 err = SetNotifierResponse(); |
|
746 TESTEL(KErrNone == err, err); |
|
747 |
|
748 //Call Connect() |
|
749 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
750 TESTL(KErrNone == CheckResult(err)); |
|
751 |
|
752 //Get the NotifyCount after the RSocket::...() API is called |
|
753 TInt notifyCount2 = GetNotifyCount(); |
|
754 |
|
755 //Check the Prompt Occurred as expected |
|
756 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
757 TEST(KErrNone == err); |
|
758 |
|
759 //Close the first Socket object |
|
760 err = DestroyTcpSocket(sock); |
|
761 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
762 CleanupStack::Pop(); //sock |
|
763 |
|
764 |
|
765 RSocket sock2; |
|
766 err = OpenTcpSocket(sock2, ss); |
|
767 TESTEL(KErrNone == err, err); |
|
768 CleanupClosePushL(sock2); |
|
769 |
|
770 //Get the NotifyCount before the RSocket::...() API is called |
|
771 notifyCount1 = GetNotifyCount(); |
|
772 |
|
773 //Set the Test Notifier Response |
|
774 err = SetNotifierResponse(); |
|
775 TESTEL(KErrNone == err, err); |
|
776 |
|
777 //Call Connect() |
|
778 err = ConnectTcpSocket(sock2, iEchoServerAddr); |
|
779 TESTL(KErrNone == CheckResult(err)); |
|
780 |
|
781 //Get the NotifyCount after the RSocket::...() API is called |
|
782 notifyCount2 = GetNotifyCount(); |
|
783 |
|
784 //Check the Prompt Occurred as expected |
|
785 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
786 TEST(KErrNone == err); |
|
787 |
|
788 err = DestroyTcpSocket(sock2); |
|
789 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
790 CleanupStack::Pop(); //sock2 |
|
791 |
|
792 CloseSocketServer(ss); |
|
793 CleanupStack::Pop(); //ss |
|
794 |
|
795 return TestStepResult(); |
|
796 } // TE_RConnectionUPSTest3a |
|
797 |
|
798 |
|
799 |
|
800 TE_RConnectionUPSTest3b::~TE_RConnectionUPSTest3b() |
|
801 { |
|
802 } |
|
803 |
|
804 enum TVerdict TE_RConnectionUPSTest3b::doTestStepL(void) |
|
805 /** |
|
806 * Test prompting behaviour when calling: |
|
807 * Implicit RSocket::SendTo(), close RSocket, followed by |
|
808 * Implicit RSocket2::SendTo() |
|
809 * |
|
810 * This test should behave differently in NetworkLifetime Mode |
|
811 * when Notifier response is Session based, since decision is no |
|
812 * longer valid once first RSocket is closed i.e. once all client |
|
813 * associations with connections cease to exist |
|
814 */ |
|
815 { |
|
816 TInt err; |
|
817 |
|
818 //Delete entries in the DecisionDB |
|
819 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
820 |
|
821 RSocketServ ss; |
|
822 RSocket sock; |
|
823 |
|
824 err = OpenSocketServer(ss); |
|
825 TESTEL(KErrNone == err, err); |
|
826 CleanupClosePushL(ss); |
|
827 |
|
828 err = OpenUdpSocketL(sock, ss); |
|
829 TESTEL(KErrNone == err, err); |
|
830 CleanupClosePushL(sock); |
|
831 |
|
832 //Get the NotifyCount before the RSocket::...() API is called |
|
833 TInt notifyCount1 = GetNotifyCount(); |
|
834 |
|
835 //Set the Test Notifier Response |
|
836 err = SetNotifierResponse(); |
|
837 TESTEL(KErrNone == err, err); |
|
838 |
|
839 //Call SendTo() and RecvFrom() |
|
840 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
841 TESTL(KErrNone == CheckResult(err)); |
|
842 |
|
843 //Get the NotifyCount after the RSocket::...() API is called |
|
844 TInt notifyCount2 = GetNotifyCount(); |
|
845 |
|
846 //Check the Prompt Occurred as expected |
|
847 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
848 TEST(KErrNone == err); |
|
849 |
|
850 //Close the first Socket object |
|
851 DestroyUdpSocket(sock); |
|
852 CleanupStack::Pop(); //sock |
|
853 |
|
854 |
|
855 RSocket sock2; |
|
856 err = OpenUdpSocketL(sock2, ss); |
|
857 TESTEL(KErrNone == err, err); |
|
858 CleanupClosePushL(sock2); |
|
859 |
|
860 //Get the NotifyCount before the RSocket::...() API is called |
|
861 notifyCount1 = GetNotifyCount(); |
|
862 |
|
863 //Set the Test Notifier Response |
|
864 err = SetNotifierResponse(); |
|
865 TESTEL(KErrNone == err, err); |
|
866 |
|
867 //Call SendTo() and RecvFrom() |
|
868 err = TestUdpDataPathL(sock2, iDummyNifSendAddr); |
|
869 TESTL(KErrNone == CheckResult(err)); |
|
870 |
|
871 //Get the NotifyCount after the RSocket::...() API is called |
|
872 notifyCount2 = GetNotifyCount(); |
|
873 |
|
874 //Check the Prompt Occurred as expected |
|
875 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
876 TEST(KErrNone == err); |
|
877 |
|
878 DestroyUdpSocket(sock2); |
|
879 CleanupStack::Pop(); //sock2 |
|
880 |
|
881 CloseSocketServer(ss); |
|
882 CleanupStack::Pop(); //ss |
|
883 |
|
884 return TestStepResult(); |
|
885 } // TE_RConnectionUPSTest3b |
|
886 |
|
887 |
|
888 |
|
889 TE_RConnectionUPSTest3c::~TE_RConnectionUPSTest3c() |
|
890 { |
|
891 } |
|
892 |
|
893 enum TVerdict TE_RConnectionUPSTest3c::doTestStepL(void) |
|
894 /** |
|
895 * Test prompting behaviour when calling: |
|
896 * Implicit Synchronous RHostResolver::GetByName(), close RHostResolver, |
|
897 * followed by implicit Asynchronous RHostResolver2::GetByName() |
|
898 * |
|
899 * This test should behave differently in NetworkLifetime Mode |
|
900 * when Notifier response is Session based, since decision is no |
|
901 * longer valid once first RHostResolver is closed i.e. once all client |
|
902 * associations with connections cease to exist |
|
903 */ |
|
904 { |
|
905 TInt err; |
|
906 |
|
907 //Delete entries in the DecisionDB |
|
908 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
909 |
|
910 RSocketServ ss; |
|
911 RHostResolver hr; |
|
912 |
|
913 err = OpenSocketServer(ss); |
|
914 TESTEL(KErrNone == err, err); |
|
915 CleanupClosePushL(ss); |
|
916 |
|
917 err = OpenHostResolver(hr, ss); |
|
918 TESTEL(KErrNone == err, err); |
|
919 CleanupClosePushL(hr); |
|
920 |
|
921 //Get the NotifyCount before the RHostResolver::...() API is called |
|
922 TInt notifyCount1 = GetNotifyCount(); |
|
923 |
|
924 //Set the Test Notifier Response |
|
925 err = SetNotifierResponse(); |
|
926 TESTEL(KErrNone == err, err); |
|
927 |
|
928 //Call GetByName() |
|
929 err = MakeSynchronousNameRequest(hr, iTestName); |
|
930 TESTL(KErrNone == CheckResult(err)); |
|
931 |
|
932 //Get the NotifyCount after the RHostResolver::...() API is called |
|
933 TInt notifyCount2 = GetNotifyCount(); |
|
934 |
|
935 //Check the Prompt Occurred as expected |
|
936 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
937 TEST(KErrNone == err); |
|
938 |
|
939 //Close the first HostResolver object |
|
940 DestroyHostResolver(hr); |
|
941 CleanupStack::Pop(); //hr |
|
942 |
|
943 |
|
944 RHostResolver hr2; |
|
945 err = OpenHostResolver(hr2, ss); |
|
946 TESTEL(KErrNone == err, err); |
|
947 CleanupClosePushL(hr2); |
|
948 |
|
949 //Get the NotifyCount before the RHostResolver::...() API is called |
|
950 notifyCount1 = GetNotifyCount(); |
|
951 |
|
952 //Set the Test Notifier Response |
|
953 err = SetNotifierResponse(); |
|
954 TESTEL(KErrNone == err, err); |
|
955 |
|
956 //Call GetByName() |
|
957 err = MakeNameRequest(hr2, iTestName); |
|
958 TESTL(KErrNone == CheckResult(err)); |
|
959 |
|
960 //Get the NotifyCount after the RHostResolver::...() API is called |
|
961 notifyCount2 = GetNotifyCount(); |
|
962 |
|
963 //Check the Prompt Occurred as expected |
|
964 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
965 TEST(KErrNone == err); |
|
966 |
|
967 DestroyHostResolver(hr2); |
|
968 CleanupStack::Pop(); //hr2 |
|
969 |
|
970 CloseSocketServer(ss); |
|
971 CleanupStack::Pop(); //ss |
|
972 |
|
973 return TestStepResult(); |
|
974 } // TE_RConnectionUPSTest3c |
|
975 |
|
976 |
|
977 TE_RConnectionUPSTest3d::~TE_RConnectionUPSTest3d() |
|
978 { |
|
979 } |
|
980 |
|
981 enum TVerdict TE_RConnectionUPSTest3d::doTestStepL(void) |
|
982 /** |
|
983 * Test prompting behaviour when calling: |
|
984 * Implicit Synchronous RHostResolver::GetByAddress(), close RHostResolver, |
|
985 * followed by implicit Asynchronous RHostResolver2::GetByAddress() |
|
986 * |
|
987 * This test should behave differently in NetworkLifetime Mode |
|
988 * when Notifier response is Session based, since decision is no |
|
989 * longer valid once first RHostResolver is closed i.e. once all client |
|
990 * associations with connections cease to exist |
|
991 */ |
|
992 { |
|
993 TInt err; |
|
994 |
|
995 //Delete entries in the DecisionDB |
|
996 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
997 |
|
998 RSocketServ ss; |
|
999 RHostResolver hr; |
|
1000 |
|
1001 err = OpenSocketServer(ss); |
|
1002 TESTEL(KErrNone == err, err); |
|
1003 CleanupClosePushL(ss); |
|
1004 |
|
1005 err = OpenHostResolver(hr, ss); |
|
1006 TESTEL(KErrNone == err, err); |
|
1007 CleanupClosePushL(hr); |
|
1008 |
|
1009 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1010 TInt notifyCount1 = GetNotifyCount(); |
|
1011 |
|
1012 //Set the Test Notifier Response |
|
1013 err = SetNotifierResponse(); |
|
1014 TESTEL(KErrNone == err, err); |
|
1015 |
|
1016 //Call GetByAddress() |
|
1017 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
1018 TESTL(KErrNone == CheckResult(err)); |
|
1019 |
|
1020 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1021 TInt notifyCount2 = GetNotifyCount(); |
|
1022 |
|
1023 //Check the Prompt Occurred as expected |
|
1024 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1025 TEST(KErrNone == err); |
|
1026 |
|
1027 DestroyHostResolver(hr); |
|
1028 CleanupStack::Pop(); //hr |
|
1029 |
|
1030 |
|
1031 RHostResolver hr2; |
|
1032 err = OpenHostResolver(hr2, ss); |
|
1033 TESTEL(KErrNone == err, err); |
|
1034 CleanupClosePushL(hr2); |
|
1035 |
|
1036 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1037 notifyCount1 = GetNotifyCount(); |
|
1038 |
|
1039 //Set the Test Notifier Response |
|
1040 err = SetNotifierResponse(); |
|
1041 TESTEL(KErrNone == err, err); |
|
1042 |
|
1043 //Call GetByAddress() |
|
1044 err = MakeAddressRequest(hr2, iLookupAddress); |
|
1045 TESTL(KErrNone == CheckResult(err)); |
|
1046 |
|
1047 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1048 notifyCount2 = GetNotifyCount(); |
|
1049 |
|
1050 //Check the Prompt Occurred as expected |
|
1051 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1052 TEST(KErrNone == err); |
|
1053 |
|
1054 DestroyHostResolver(hr2); |
|
1055 CleanupStack::Pop(); //hr2 |
|
1056 |
|
1057 CloseSocketServer(ss); |
|
1058 CleanupStack::Pop(); //ss |
|
1059 |
|
1060 return TestStepResult(); |
|
1061 } // TE_RConnectionUPSTest3d |
|
1062 |
|
1063 |
|
1064 TE_RConnectionUPSTest4a::~TE_RConnectionUPSTest4a() |
|
1065 { |
|
1066 } |
|
1067 |
|
1068 enum TVerdict TE_RConnectionUPSTest4a::doTestStepL(void) |
|
1069 /** |
|
1070 * Test prompting behaviour when calling: |
|
1071 * Implicit RSocket::Connect(), followed by an Implicit |
|
1072 * RHostResolver::GetByName() |
|
1073 */ |
|
1074 { |
|
1075 TInt err; |
|
1076 |
|
1077 //Delete entries in the DecisionDB |
|
1078 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1079 |
|
1080 RSocketServ ss; |
|
1081 RSocket sock; |
|
1082 |
|
1083 err = OpenSocketServer(ss); |
|
1084 TESTEL(KErrNone == err, err); |
|
1085 CleanupClosePushL(ss); |
|
1086 |
|
1087 err = OpenTcpSocket(sock, ss); |
|
1088 TESTEL(KErrNone == err, err); |
|
1089 CleanupClosePushL(sock); |
|
1090 |
|
1091 //Get the NotifyCount before the RSocket::...() API is called |
|
1092 TInt notifyCount1 = GetNotifyCount(); |
|
1093 |
|
1094 //Set the Test Notifier Response |
|
1095 err = SetNotifierResponse(); |
|
1096 TESTEL(KErrNone == err, err); |
|
1097 |
|
1098 //Call Connect() |
|
1099 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
1100 TESTL(KErrNone == CheckResult(err)); |
|
1101 |
|
1102 //Get the NotifyCount after the RSocket::...() API is called |
|
1103 TInt notifyCount2 = GetNotifyCount(); |
|
1104 |
|
1105 //Check the Prompt Occurred as expected |
|
1106 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1107 TEST(KErrNone == err); |
|
1108 |
|
1109 |
|
1110 RHostResolver hr; |
|
1111 err = OpenHostResolver(hr, ss); |
|
1112 TESTEL(KErrNone == err, err); |
|
1113 CleanupClosePushL(hr); |
|
1114 |
|
1115 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1116 notifyCount1 = GetNotifyCount(); |
|
1117 |
|
1118 //Set the Test Notifier Response |
|
1119 err = SetNotifierResponse(); |
|
1120 TESTEL(KErrNone == err, err); |
|
1121 |
|
1122 //Call GetByName() |
|
1123 err = MakeSynchronousNameRequest(hr, iTestName); |
|
1124 TESTL(KErrNone == CheckResult(err)); |
|
1125 |
|
1126 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1127 notifyCount2 = GetNotifyCount(); |
|
1128 |
|
1129 //Check the Prompt Occurred as expected |
|
1130 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1131 TEST(KErrNone == err); |
|
1132 |
|
1133 DestroyHostResolver(hr); |
|
1134 CleanupStack::Pop(); //hr |
|
1135 |
|
1136 err = DestroyTcpSocket(sock); |
|
1137 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
1138 CleanupStack::Pop(); //sock |
|
1139 |
|
1140 CloseSocketServer(ss); |
|
1141 CleanupStack::Pop(); //ss |
|
1142 |
|
1143 return TestStepResult(); |
|
1144 } // TE_RConnectionUPSTest4a |
|
1145 |
|
1146 |
|
1147 TE_RConnectionUPSTest4c::~TE_RConnectionUPSTest4c() |
|
1148 { |
|
1149 } |
|
1150 |
|
1151 enum TVerdict TE_RConnectionUPSTest4c::doTestStepL(void) |
|
1152 /** |
|
1153 * Test prompting behaviour when calling: |
|
1154 * Implicit Synchronous RHostResolver::GetByName(), followed by an Implicit |
|
1155 * RHostResolver2::GetByAddress() |
|
1156 */ |
|
1157 { |
|
1158 TInt err; |
|
1159 |
|
1160 //Delete entries in the DecisionDB |
|
1161 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1162 |
|
1163 RSocketServ ss; |
|
1164 RHostResolver hr; |
|
1165 |
|
1166 err = OpenSocketServer(ss); |
|
1167 TESTEL(KErrNone == err, err); |
|
1168 CleanupClosePushL(ss); |
|
1169 |
|
1170 err = OpenHostResolver(hr, ss); |
|
1171 TESTEL(KErrNone == err, err); |
|
1172 CleanupClosePushL(hr); |
|
1173 |
|
1174 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1175 TInt notifyCount1 = GetNotifyCount(); |
|
1176 |
|
1177 //Set the Test Notifier Response |
|
1178 err = SetNotifierResponse(); |
|
1179 TESTEL(KErrNone == err, err); |
|
1180 |
|
1181 //Call GetByName() |
|
1182 err = MakeSynchronousNameRequest(hr, iTestName); |
|
1183 TESTL(KErrNone == CheckResult(err)); |
|
1184 |
|
1185 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1186 TInt notifyCount2 = GetNotifyCount(); |
|
1187 |
|
1188 //Check the Prompt Occurred as expected |
|
1189 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1190 TEST(KErrNone == err); |
|
1191 |
|
1192 |
|
1193 RHostResolver hr2; |
|
1194 err = OpenHostResolver(hr2, ss); |
|
1195 TESTEL(KErrNone == err, err); |
|
1196 CleanupClosePushL(hr2); |
|
1197 |
|
1198 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1199 notifyCount1 = GetNotifyCount(); |
|
1200 |
|
1201 //Set the Test Notifier Response |
|
1202 err = SetNotifierResponse(); |
|
1203 TESTEL(KErrNone == err, err); |
|
1204 |
|
1205 //Call GetByName() |
|
1206 err = MakeAddressRequest(hr2, iLookupAddress); |
|
1207 TESTL(KErrNone == CheckResult(err)); |
|
1208 |
|
1209 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1210 notifyCount2 = GetNotifyCount(); |
|
1211 |
|
1212 //Check the Prompt Occurred as expected |
|
1213 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1214 TEST(KErrNone == err); |
|
1215 |
|
1216 DestroyHostResolver(hr2); |
|
1217 CleanupStack::Pop(); //hr2 |
|
1218 |
|
1219 DestroyHostResolver(hr); |
|
1220 CleanupStack::Pop(); //hr |
|
1221 |
|
1222 CloseSocketServer(ss); |
|
1223 CleanupStack::Pop(); //ss |
|
1224 |
|
1225 return TestStepResult(); |
|
1226 } // TE_RConnectionUPSTest2c |
|
1227 |
|
1228 |
|
1229 |
|
1230 TE_RConnectionUPSTest5a::~TE_RConnectionUPSTest5a() |
|
1231 { |
|
1232 } |
|
1233 |
|
1234 enum TVerdict TE_RConnectionUPSTest5a::doTestStepL(void) |
|
1235 /** |
|
1236 * Test prompting behaviour when calling: |
|
1237 * Implicit RSocket::Connect(), followed by an Implicit |
|
1238 * RHostResolver::GetByAddress() |
|
1239 */ |
|
1240 |
|
1241 { |
|
1242 TInt err; |
|
1243 |
|
1244 //Delete entries in the DecisionDB |
|
1245 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1246 |
|
1247 RSocketServ ss; |
|
1248 RSocket sock; |
|
1249 |
|
1250 err = OpenSocketServer(ss); |
|
1251 TESTEL(KErrNone == err, err); |
|
1252 CleanupClosePushL(ss); |
|
1253 |
|
1254 err = OpenTcpSocket(sock, ss); |
|
1255 TESTEL(KErrNone == err, err); |
|
1256 CleanupClosePushL(sock); |
|
1257 |
|
1258 //Get the NotifyCount before the RSocket::...() API is called |
|
1259 TInt notifyCount1 = GetNotifyCount(); |
|
1260 |
|
1261 //Set the Test Notifier Response |
|
1262 err = SetNotifierResponse(); |
|
1263 TESTEL(KErrNone == err, err); |
|
1264 |
|
1265 //Call Connect() |
|
1266 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
1267 TESTL(KErrNone == CheckResult(err)); |
|
1268 |
|
1269 //Get the NotifyCount after the RSocket::...() API is called |
|
1270 TInt notifyCount2 = GetNotifyCount(); |
|
1271 |
|
1272 //Check the Prompt Occurred as expected |
|
1273 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1274 TEST(KErrNone == err); |
|
1275 |
|
1276 |
|
1277 RHostResolver hr; |
|
1278 err = OpenHostResolver(hr, ss); |
|
1279 TESTEL(KErrNone == err, err); |
|
1280 CleanupClosePushL(hr); |
|
1281 |
|
1282 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1283 notifyCount1 = GetNotifyCount(); |
|
1284 |
|
1285 //Set the Test Notifier Response |
|
1286 err = SetNotifierResponse(); |
|
1287 TESTEL(KErrNone == err, err); |
|
1288 |
|
1289 //Call GetByAddress() |
|
1290 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
1291 TESTL(KErrNone == CheckResult(err)); |
|
1292 |
|
1293 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1294 notifyCount2 = GetNotifyCount(); |
|
1295 |
|
1296 //Check the Prompt Occurred as expected |
|
1297 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1298 TEST(KErrNone == err); |
|
1299 |
|
1300 DestroyHostResolver(hr); |
|
1301 CleanupStack::Pop(); //hr |
|
1302 |
|
1303 err = DestroyTcpSocket(sock); |
|
1304 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
1305 CleanupStack::Pop(); //sock |
|
1306 |
|
1307 CloseSocketServer(ss); |
|
1308 CleanupStack::Pop(); //ss |
|
1309 |
|
1310 return TestStepResult(); |
|
1311 } // TE_RConnectionUPSTest5a |
|
1312 |
|
1313 |
|
1314 |
|
1315 TE_RConnectionUPSTest6a::~TE_RConnectionUPSTest6a() |
|
1316 { |
|
1317 } |
|
1318 |
|
1319 enum TVerdict TE_RConnectionUPSTest6a::doTestStepL(void) |
|
1320 /** |
|
1321 * Test prompting behaviour when calling: |
|
1322 * Implicit RSocket::Connect(), followed by RConnection::Start |
|
1323 */ |
|
1324 { |
|
1325 TInt err; |
|
1326 |
|
1327 //Delete entries in the DecisionDB |
|
1328 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1329 |
|
1330 RSocketServ ss; |
|
1331 RSocket sock; |
|
1332 |
|
1333 err = OpenSocketServer(ss); |
|
1334 TESTEL(KErrNone == err, err); |
|
1335 CleanupClosePushL(ss); |
|
1336 |
|
1337 err = OpenTcpSocket(sock, ss); |
|
1338 TESTEL(KErrNone == err, err); |
|
1339 CleanupClosePushL(sock); |
|
1340 |
|
1341 //Get the NotifyCount before the RSocket::...() API is called |
|
1342 TInt notifyCount1 = GetNotifyCount(); |
|
1343 |
|
1344 //Set the Test Notifier Response |
|
1345 err = SetNotifierResponse(); |
|
1346 TESTEL(KErrNone == err, err); |
|
1347 |
|
1348 //Call Connect() |
|
1349 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
1350 TESTL(KErrNone == CheckResult(err)); |
|
1351 |
|
1352 //Get the NotifyCount after the RSocket::...() API is called |
|
1353 TInt notifyCount2 = GetNotifyCount(); |
|
1354 |
|
1355 //Check the Prompt Occurred as expected |
|
1356 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1357 TEST(KErrNone == err); |
|
1358 |
|
1359 |
|
1360 RConnection conn; |
|
1361 |
|
1362 err = OpenConnection(conn, ss); |
|
1363 TESTEL(KErrNone == err, err); |
|
1364 CleanupClosePushL(conn); |
|
1365 |
|
1366 //Get the NotifyCount before the RConnection::...() API is called |
|
1367 notifyCount1 = GetNotifyCount(); |
|
1368 |
|
1369 //Set the Test Notifier Response |
|
1370 err = SetNotifierResponse(); |
|
1371 TESTEL(KErrNone == err, err); |
|
1372 |
|
1373 //Call RConnection::Start() |
|
1374 err = StartConnection(conn); |
|
1375 TESTL(KErrNone == CheckResult(err)); |
|
1376 |
|
1377 //Get the NotifyCount after the RConnection::...() API is called |
|
1378 notifyCount2 = GetNotifyCount(); |
|
1379 |
|
1380 //Check the Prompt Occurred as expected |
|
1381 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1382 TEST(KErrNone == err); |
|
1383 |
|
1384 err = DestroyTcpSocket(sock); |
|
1385 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
1386 CleanupStack::Pop(); |
|
1387 |
|
1388 CloseConnection(conn); |
|
1389 CleanupStack::Pop(); |
|
1390 |
|
1391 CloseSocketServer(ss); |
|
1392 CleanupStack::Pop(); |
|
1393 |
|
1394 return TestStepResult(); |
|
1395 } // TE_RConnectionUPSTest6a |
|
1396 |
|
1397 |
|
1398 |
|
1399 TE_RConnectionUPSTest6b::~TE_RConnectionUPSTest6b() |
|
1400 { |
|
1401 } |
|
1402 |
|
1403 enum TVerdict TE_RConnectionUPSTest6b::doTestStepL(void) |
|
1404 /** |
|
1405 * Test prompting behaviour when calling: |
|
1406 * Implicit RSocket::SendTo(), followed by RConnection::Start |
|
1407 */ |
|
1408 |
|
1409 { |
|
1410 TInt err; |
|
1411 |
|
1412 //Delete entries in the DecisionDB |
|
1413 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1414 |
|
1415 RSocketServ ss; |
|
1416 RSocket sock; |
|
1417 |
|
1418 err = OpenSocketServer(ss); |
|
1419 TESTEL(KErrNone == err, err); |
|
1420 CleanupClosePushL(ss); |
|
1421 |
|
1422 err = OpenUdpSocketL(sock, ss); |
|
1423 TESTEL(KErrNone == err, err); |
|
1424 CleanupClosePushL(sock); |
|
1425 |
|
1426 //Get the NotifyCount beforethe RSocket::...() API is called |
|
1427 TInt notifyCount1 = GetNotifyCount(); |
|
1428 |
|
1429 //Set the Test Notifier Response |
|
1430 err = SetNotifierResponse(); |
|
1431 TESTEL(KErrNone == err, err); |
|
1432 |
|
1433 //Call SendTo() and RecvFrom() |
|
1434 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
1435 TESTL(KErrNone == CheckResult(err)); |
|
1436 |
|
1437 //Get the NotifyCount after the RSocket::...() API is called |
|
1438 TInt notifyCount2 = GetNotifyCount(); |
|
1439 |
|
1440 //Check the Prompt Occurred as expected |
|
1441 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1442 TEST(KErrNone == err); |
|
1443 |
|
1444 |
|
1445 RConnection conn; |
|
1446 |
|
1447 err = OpenConnection(conn, ss); |
|
1448 TESTEL(KErrNone == err, err); |
|
1449 CleanupClosePushL(conn); |
|
1450 |
|
1451 //Get the NotifyCount before the RConnection::...() API is called |
|
1452 notifyCount1 = GetNotifyCount(); |
|
1453 |
|
1454 //Set the Test Notifier Response |
|
1455 err = SetNotifierResponse(); |
|
1456 TESTEL(KErrNone == err, err); |
|
1457 |
|
1458 //Call RConnection::Start() |
|
1459 err = StartConnection(conn); |
|
1460 TESTL(KErrNone == CheckResult(err)); |
|
1461 |
|
1462 //Get the NotifyCount after the RConnection::...() API is called |
|
1463 notifyCount2 = GetNotifyCount(); |
|
1464 |
|
1465 //Check the Prompt Occurred as expected |
|
1466 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1467 TEST(KErrNone == err); |
|
1468 |
|
1469 DestroyUdpSocket(sock); |
|
1470 CleanupStack::Pop(); |
|
1471 |
|
1472 CloseConnection(conn); |
|
1473 CleanupStack::Pop(); |
|
1474 |
|
1475 CloseSocketServer(ss); |
|
1476 CleanupStack::Pop(); |
|
1477 |
|
1478 return TestStepResult(); |
|
1479 } // TE_RConnectionUPSTest6b |
|
1480 |
|
1481 |
|
1482 |
|
1483 TE_RConnectionUPSTest6c::~TE_RConnectionUPSTest6c() |
|
1484 { |
|
1485 } |
|
1486 |
|
1487 enum TVerdict TE_RConnectionUPSTest6c::doTestStepL(void) |
|
1488 /** |
|
1489 * Test prompting behaviour when calling: |
|
1490 * Implicit Synchronous RHostResolver::GetByName(), followed by RConnection::Start |
|
1491 */ |
|
1492 |
|
1493 { |
|
1494 TInt err; |
|
1495 |
|
1496 //Delete entries in the DecisionDB |
|
1497 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1498 |
|
1499 RSocketServ ss; |
|
1500 RHostResolver hr; |
|
1501 |
|
1502 err = OpenSocketServer(ss); |
|
1503 TESTEL(KErrNone == err, err); |
|
1504 CleanupClosePushL(ss); |
|
1505 |
|
1506 err = OpenHostResolver(hr, ss); |
|
1507 TESTEL(KErrNone == err, err); |
|
1508 CleanupClosePushL(hr); |
|
1509 |
|
1510 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1511 TInt notifyCount1 = GetNotifyCount(); |
|
1512 |
|
1513 //Set the Test Notifier Response |
|
1514 err = SetNotifierResponse(); |
|
1515 TESTEL(KErrNone == err, err); |
|
1516 |
|
1517 //Call GetByName() |
|
1518 err = MakeSynchronousNameRequest(hr, iTestName); |
|
1519 TESTL(KErrNone == CheckResult(err)); |
|
1520 |
|
1521 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1522 TInt notifyCount2 = GetNotifyCount(); |
|
1523 |
|
1524 //Check the Prompt Occurred as expected |
|
1525 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1526 TEST(KErrNone == err); |
|
1527 |
|
1528 |
|
1529 RConnection conn; |
|
1530 |
|
1531 err = OpenConnection(conn, ss); |
|
1532 TESTEL(KErrNone == err, err); |
|
1533 CleanupClosePushL(conn); |
|
1534 |
|
1535 //Get the NotifyCount before the RConnection::...() API is called |
|
1536 notifyCount1 = GetNotifyCount(); |
|
1537 |
|
1538 //Set the Test Notifier Response |
|
1539 err = SetNotifierResponse(); |
|
1540 TESTEL(KErrNone == err, err); |
|
1541 |
|
1542 //Call RConnection::Start() |
|
1543 err = StartConnection(conn); |
|
1544 TESTL(KErrNone == CheckResult(err)); |
|
1545 |
|
1546 |
|
1547 //Get the NotifyCount after the RConnection::...() API is called |
|
1548 notifyCount2 = GetNotifyCount(); |
|
1549 |
|
1550 //Check the Prompt Occurred as expected |
|
1551 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1552 TEST(KErrNone == err); |
|
1553 |
|
1554 DestroyHostResolver(hr); |
|
1555 CleanupStack::Pop(); |
|
1556 |
|
1557 CloseConnection(conn); |
|
1558 CleanupStack::Pop(); |
|
1559 |
|
1560 CloseSocketServer(ss); |
|
1561 CleanupStack::Pop(); |
|
1562 |
|
1563 return TestStepResult(); |
|
1564 } // TE_RConnectionUPSTest6c |
|
1565 |
|
1566 |
|
1567 |
|
1568 TE_RConnectionUPSTest6d::~TE_RConnectionUPSTest6d() |
|
1569 { |
|
1570 } |
|
1571 |
|
1572 enum TVerdict TE_RConnectionUPSTest6d::doTestStepL(void) |
|
1573 /** |
|
1574 * Test prompting behaviour when calling: |
|
1575 * Implicit Synchronous RHostResolver::GetByAddress(), followed |
|
1576 * by RConnection::Start |
|
1577 */ |
|
1578 |
|
1579 { |
|
1580 TInt err; |
|
1581 |
|
1582 //Delete entries in the DecisionDB |
|
1583 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1584 |
|
1585 RSocketServ ss; |
|
1586 RHostResolver hr; |
|
1587 |
|
1588 err = OpenSocketServer(ss); |
|
1589 TESTEL(KErrNone == err, err); |
|
1590 CleanupClosePushL(ss); |
|
1591 |
|
1592 err = OpenHostResolver(hr, ss); |
|
1593 TESTEL(KErrNone == err, err); |
|
1594 CleanupClosePushL(hr); |
|
1595 |
|
1596 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1597 TInt notifyCount1 = GetNotifyCount(); |
|
1598 |
|
1599 //Set the Test Notifier Response |
|
1600 err = SetNotifierResponse(); |
|
1601 TESTEL(KErrNone == err, err); |
|
1602 |
|
1603 //Call GetByAddress() |
|
1604 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
1605 TESTL(KErrNone == CheckResult(err)); |
|
1606 |
|
1607 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1608 TInt notifyCount2 = GetNotifyCount(); |
|
1609 |
|
1610 //Check the Prompt Occurred as expected |
|
1611 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1612 TEST(KErrNone == err); |
|
1613 |
|
1614 |
|
1615 RConnection conn; |
|
1616 |
|
1617 err = OpenConnection(conn, ss); |
|
1618 TESTEL(KErrNone == err, err); |
|
1619 CleanupClosePushL(conn); |
|
1620 |
|
1621 //Get the NotifyCount before the RConnection::...() API is called |
|
1622 notifyCount1 = GetNotifyCount(); |
|
1623 |
|
1624 //Set the Test Notifier Response |
|
1625 err = SetNotifierResponse(); |
|
1626 TESTEL(KErrNone == err, err); |
|
1627 |
|
1628 //Call RConnection::Start() |
|
1629 err = StartConnection(conn); |
|
1630 TESTL(KErrNone == CheckResult(err)); |
|
1631 |
|
1632 //Get the NotifyCount after the RConnection::...() API is called |
|
1633 notifyCount2 = GetNotifyCount(); |
|
1634 |
|
1635 //Check the Prompt Occurred as expected |
|
1636 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1637 TEST(KErrNone == err); |
|
1638 |
|
1639 DestroyHostResolver(hr); |
|
1640 CleanupStack::Pop(); |
|
1641 |
|
1642 CloseConnection(conn); |
|
1643 CleanupStack::Pop(); |
|
1644 |
|
1645 CloseSocketServer(ss); |
|
1646 CleanupStack::Pop(); |
|
1647 |
|
1648 return TestStepResult(); |
|
1649 |
|
1650 } // TE_RConnectionUPSTest6d |
|
1651 |
|
1652 |
|
1653 TE_RConnectionUPSTest7a::~TE_RConnectionUPSTest7a() |
|
1654 { |
|
1655 } |
|
1656 |
|
1657 enum TVerdict TE_RConnectionUPSTest7a::doTestStepL(void) |
|
1658 { |
|
1659 /** |
|
1660 * Test prompting behaviour when calling: |
|
1661 * Implicit RSocket::Connect(), close RSocket, Delete UPS decision |
|
1662 * Database, followed by RSocket2::Connect() |
|
1663 * |
|
1664 * This test should behave differently when run in NetworkLifetime |
|
1665 * mode and decision from Notifier is Always/Never or Session based - |
|
1666 * Closing the initial RSocket clears the decision which gets stored |
|
1667 * in the NetUPS component, while deleting the UPS Decision DB should |
|
1668 * clear any persistent storage of any decision from the UPS DB |
|
1669 */ |
|
1670 |
|
1671 TInt err; |
|
1672 |
|
1673 //Delete entries in the DecisionDB |
|
1674 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1675 |
|
1676 RSocketServ ss; |
|
1677 RSocket sock; |
|
1678 |
|
1679 err = OpenSocketServer(ss); |
|
1680 TESTEL(KErrNone == err, err); |
|
1681 CleanupClosePushL(ss); |
|
1682 |
|
1683 err = OpenTcpSocket(sock, ss); |
|
1684 TESTEL(KErrNone == err, err); |
|
1685 CleanupClosePushL(sock); |
|
1686 |
|
1687 //Get the NotifyCount before the RSocket::...() API is called |
|
1688 TInt notifyCount1 = GetNotifyCount(); |
|
1689 |
|
1690 //Set the Test Notifier Response |
|
1691 err = SetNotifierResponse(); |
|
1692 TESTEL(KErrNone == err, err); |
|
1693 |
|
1694 //Call Connect() |
|
1695 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
1696 TESTL(KErrNone == CheckResult(err)); |
|
1697 |
|
1698 //Get the NotifyCount after the RSocket::...() API is called |
|
1699 TInt notifyCount2 = GetNotifyCount(); |
|
1700 |
|
1701 //Check the Prompt Occurred as expected |
|
1702 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1703 TEST(KErrNone == err); |
|
1704 |
|
1705 err = DestroyTcpSocket(sock); |
|
1706 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
1707 CleanupStack::Pop(); |
|
1708 |
|
1709 //Delete entries in the DecisionDB |
|
1710 err = DeleteUpsDB(); |
|
1711 |
|
1712 |
|
1713 RSocket sock2; |
|
1714 |
|
1715 err = OpenTcpSocket(sock2, ss); |
|
1716 TESTEL(KErrNone == err, err); |
|
1717 CleanupClosePushL(sock2); |
|
1718 |
|
1719 //Get the NotifyCount before the RSocket::...() API is called |
|
1720 notifyCount1 = GetNotifyCount(); |
|
1721 |
|
1722 //Set the Test Notifier Response |
|
1723 err = SetNotifierResponse(); |
|
1724 TESTEL(KErrNone == err, err); |
|
1725 |
|
1726 //Call Connect() |
|
1727 err = ConnectTcpSocket(sock2, iEchoServerAddr); |
|
1728 TESTL(KErrNone == CheckResult(err)); |
|
1729 |
|
1730 //Get the NotifyCount after the RSocket::...() API is called |
|
1731 notifyCount2 = GetNotifyCount(); |
|
1732 |
|
1733 //Check the Prompt Occurred as expected |
|
1734 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1735 TEST(KErrNone == err); |
|
1736 |
|
1737 err = DestroyTcpSocket(sock2); |
|
1738 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
1739 CleanupStack::Pop(); |
|
1740 |
|
1741 CloseSocketServer(ss); |
|
1742 CleanupStack::Pop(); |
|
1743 |
|
1744 return TestStepResult(); |
|
1745 } // TE_RConnectionUPSTest7a |
|
1746 |
|
1747 |
|
1748 |
|
1749 TE_RConnectionUPSTest7b::~TE_RConnectionUPSTest7b() |
|
1750 { |
|
1751 } |
|
1752 |
|
1753 enum TVerdict TE_RConnectionUPSTest7b::doTestStepL(void) |
|
1754 { |
|
1755 /** |
|
1756 * Test prompting behaviour when calling: |
|
1757 * Implicit RSocket::SendTo(), close RSocket, Delete UPS decision |
|
1758 * Database, followed by RSocket2::SendTo() |
|
1759 * |
|
1760 * This test should behave differently when run in NetworkLifetime |
|
1761 * mode and decision from Notifier is Always/Never or Session based - |
|
1762 * Closing the initial RSocket clears the decision which gets stored |
|
1763 * in the NetUPS component, while deleting the UPS Decision DB should |
|
1764 * clear any persistent storage of any decision from the UPS DB |
|
1765 */ |
|
1766 TInt err; |
|
1767 |
|
1768 //Delete entries in the DecisionDB |
|
1769 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1770 |
|
1771 RSocketServ ss; |
|
1772 RSocket sock; |
|
1773 |
|
1774 err = OpenSocketServer(ss); |
|
1775 TESTEL(KErrNone == err, err); |
|
1776 CleanupClosePushL(ss); |
|
1777 |
|
1778 err = OpenUdpSocketL(sock, ss); |
|
1779 TESTEL(KErrNone == err, err); |
|
1780 CleanupClosePushL(sock); |
|
1781 |
|
1782 //Get the NotifyCount before the RSocket::...() API is called |
|
1783 TInt notifyCount1 = GetNotifyCount(); |
|
1784 |
|
1785 //Set the Test Notifier Response |
|
1786 err = SetNotifierResponse(); |
|
1787 TESTEL(KErrNone == err, err); |
|
1788 |
|
1789 //Call SendTo() and RecvFrom() |
|
1790 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
1791 TESTL(KErrNone == CheckResult(err)); |
|
1792 |
|
1793 //Get the NotifyCount after the RSocket::...() API is called |
|
1794 TInt notifyCount2 = GetNotifyCount(); |
|
1795 |
|
1796 //Check the Prompt Occurred as expected |
|
1797 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1798 TEST(KErrNone == err); |
|
1799 |
|
1800 DestroyUdpSocket(sock); |
|
1801 CleanupStack::Pop(); |
|
1802 |
|
1803 //Delete entries in the DecisionDB |
|
1804 err = DeleteUpsDB(); |
|
1805 |
|
1806 |
|
1807 RSocket sock2; |
|
1808 |
|
1809 err = OpenUdpSocketL(sock2, ss); |
|
1810 TESTEL(KErrNone == err, err); |
|
1811 CleanupClosePushL(sock2); |
|
1812 |
|
1813 //Get the NotifyCount before the RSocket::...() API is called |
|
1814 notifyCount1 = GetNotifyCount(); |
|
1815 |
|
1816 //Set the Test Notifier Response |
|
1817 err = SetNotifierResponse(); |
|
1818 TESTEL(KErrNone == err, err); |
|
1819 |
|
1820 //Call SendTo() and RecvFrom() |
|
1821 err = TestUdpDataPathL(sock2, iDummyNifSendAddr); |
|
1822 TESTL(KErrNone == CheckResult(err)); |
|
1823 |
|
1824 //Get the NotifyCount after the RSocket::...() API is called |
|
1825 notifyCount2 = GetNotifyCount(); |
|
1826 |
|
1827 //Check the Prompt Occurred as expected |
|
1828 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1829 TEST(KErrNone == err); |
|
1830 |
|
1831 DestroyUdpSocket(sock2); |
|
1832 CleanupStack::Pop(); |
|
1833 |
|
1834 CloseSocketServer(ss); |
|
1835 CleanupStack::Pop(); |
|
1836 |
|
1837 return TestStepResult(); |
|
1838 } // TE_RConnectionUPSTest7b |
|
1839 |
|
1840 |
|
1841 |
|
1842 TE_RConnectionUPSTest7c::~TE_RConnectionUPSTest7c() |
|
1843 { |
|
1844 } |
|
1845 |
|
1846 enum TVerdict TE_RConnectionUPSTest7c::doTestStepL(void) |
|
1847 { |
|
1848 /** |
|
1849 * Test prompting behaviour when calling: |
|
1850 * Implicit RHostResolver::GetByName(), close RSocket, Delete UPS decision |
|
1851 * Database, followed by RHostResolver2::GetByName() |
|
1852 * |
|
1853 * This test should behave differently when run in NetworkLifetime |
|
1854 * mode and decision from Notifier is Always/Never or Session based - |
|
1855 * Closing the initial RHostResolver clears the decision which gets stored |
|
1856 * in the NetUPS component, while deleting the UPS Decision DB should |
|
1857 * clear any persistent storage of any decision from the UPS DB |
|
1858 */ |
|
1859 TInt err; |
|
1860 |
|
1861 //Delete entries in the DecisionDB |
|
1862 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1863 |
|
1864 RSocketServ ss; |
|
1865 RHostResolver hr; |
|
1866 |
|
1867 err = OpenSocketServer(ss); |
|
1868 TESTEL(KErrNone == err, err); |
|
1869 CleanupClosePushL(ss); |
|
1870 |
|
1871 err = OpenHostResolver(hr, ss); |
|
1872 TESTEL(KErrNone == err, err); |
|
1873 CleanupClosePushL(hr); |
|
1874 |
|
1875 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1876 TInt notifyCount1 = GetNotifyCount(); |
|
1877 |
|
1878 //Set the Test Notifier Response |
|
1879 err = SetNotifierResponse(); |
|
1880 TESTEL(KErrNone == err, err); |
|
1881 |
|
1882 //Call GetByName() |
|
1883 err = MakeSynchronousNameRequest(hr, iTestName); |
|
1884 TESTL(KErrNone == CheckResult(err)); |
|
1885 |
|
1886 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1887 TInt notifyCount2 = GetNotifyCount(); |
|
1888 |
|
1889 //Check the Prompt Occurred as expected |
|
1890 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1891 TEST(KErrNone == err); |
|
1892 |
|
1893 DestroyHostResolver(hr); |
|
1894 CleanupStack::Pop(); |
|
1895 |
|
1896 //Delete entries in the DecisionDB |
|
1897 err = DeleteUpsDB(); |
|
1898 |
|
1899 |
|
1900 RHostResolver hr2; |
|
1901 |
|
1902 err = OpenHostResolver(hr2, ss); |
|
1903 TESTEL(KErrNone == err, err); |
|
1904 CleanupClosePushL(hr2); |
|
1905 |
|
1906 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1907 notifyCount1 = GetNotifyCount(); |
|
1908 |
|
1909 //Set the Test Notifier Response |
|
1910 err = SetNotifierResponse(); |
|
1911 TESTEL(KErrNone == err, err); |
|
1912 |
|
1913 //Call GetByName() |
|
1914 err = MakeSynchronousNameRequest(hr2, iTestName); |
|
1915 TESTL(KErrNone == CheckResult(err)); |
|
1916 |
|
1917 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1918 notifyCount2 = GetNotifyCount(); |
|
1919 |
|
1920 //Check the Prompt Occurred as expected |
|
1921 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1922 TEST(KErrNone == err); |
|
1923 |
|
1924 DestroyHostResolver(hr2); |
|
1925 CleanupStack::Pop(); |
|
1926 |
|
1927 CloseSocketServer(ss); |
|
1928 CleanupStack::Pop(); |
|
1929 |
|
1930 return TestStepResult(); |
|
1931 } // TE_RConnectionUPSTest7c |
|
1932 |
|
1933 |
|
1934 |
|
1935 TE_RConnectionUPSTest7d::~TE_RConnectionUPSTest7d() |
|
1936 { |
|
1937 } |
|
1938 |
|
1939 enum TVerdict TE_RConnectionUPSTest7d::doTestStepL(void) |
|
1940 /** |
|
1941 * Test prompting behaviour when calling: |
|
1942 * Implicit RHostResolver::GetByAddress(), close RSocket, Delete UPS decision |
|
1943 * Database, followed by RHostResolver2::GetByAddress() |
|
1944 * |
|
1945 * This test should behave differently when run in NetworkLifetime |
|
1946 * mode and decision from Notifier is Always/Never or Session based - |
|
1947 * Closing the initial RHostResolver clears the decision which gets stored |
|
1948 * in the NetUPS component, while deleting the UPS Decision DB should |
|
1949 * clear any persistent storage of any decision from the UPS DB |
|
1950 */ |
|
1951 { |
|
1952 TInt err; |
|
1953 |
|
1954 //Delete entries in the DecisionDB |
|
1955 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
1956 |
|
1957 RSocketServ ss; |
|
1958 RHostResolver hr; |
|
1959 |
|
1960 err = OpenSocketServer(ss); |
|
1961 TESTEL(KErrNone == err, err); |
|
1962 CleanupClosePushL(ss); |
|
1963 |
|
1964 err = OpenHostResolver(hr, ss); |
|
1965 TESTEL(KErrNone == err, err); |
|
1966 CleanupClosePushL(hr); |
|
1967 |
|
1968 //Get the NotifyCount before the RHostResolver::...() API is called |
|
1969 TInt notifyCount1 = GetNotifyCount(); |
|
1970 |
|
1971 //Set the Test Notifier Response |
|
1972 err = SetNotifierResponse(); |
|
1973 TESTEL(KErrNone == err, err); |
|
1974 |
|
1975 //Call GetAddress() |
|
1976 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
1977 TESTL(KErrNone == CheckResult(err)); |
|
1978 |
|
1979 //Get the NotifyCount after the RHostResolver::...() API is called |
|
1980 TInt notifyCount2 = GetNotifyCount(); |
|
1981 |
|
1982 //Check the Prompt Occurred as expected |
|
1983 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
1984 TEST(KErrNone == err); |
|
1985 |
|
1986 DestroyHostResolver(hr); |
|
1987 CleanupStack::Pop(); |
|
1988 |
|
1989 //Delete entries in the DecisionDB |
|
1990 err = DeleteUpsDB(); |
|
1991 |
|
1992 |
|
1993 RHostResolver hr2; |
|
1994 |
|
1995 err = OpenHostResolver(hr2, ss); |
|
1996 TESTEL(KErrNone == err, err); |
|
1997 CleanupClosePushL(hr2); |
|
1998 |
|
1999 //Get the NotifyCount before the RHostResolver::...() API is called |
|
2000 notifyCount1 = GetNotifyCount(); |
|
2001 |
|
2002 //Set the Test Notifier Response |
|
2003 err = SetNotifierResponse(); |
|
2004 TESTEL(KErrNone == err, err); |
|
2005 |
|
2006 //Call GetAddress() |
|
2007 err = MakeSynchronousAddressRequest(hr2, iLookupAddress); |
|
2008 TESTL(KErrNone == CheckResult(err)); |
|
2009 |
|
2010 //Get the NotifyCount after the RHostResolver::...() API is called |
|
2011 notifyCount2 = GetNotifyCount(); |
|
2012 |
|
2013 //Check the Prompt Occurred as expected |
|
2014 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2015 TEST(KErrNone == err); |
|
2016 |
|
2017 DestroyHostResolver(hr2); |
|
2018 CleanupStack::Pop(); |
|
2019 |
|
2020 CloseSocketServer(ss); |
|
2021 CleanupStack::Pop(); |
|
2022 |
|
2023 return TestStepResult(); |
|
2024 } // TE_RConnectionUPSTest7d |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 /************************************* |
|
2031 * * |
|
2032 * Explicit API Call Tests * |
|
2033 * * |
|
2034 *************************************/ |
|
2035 |
|
2036 TE_RConnectionUPSTest10::~TE_RConnectionUPSTest10() |
|
2037 { |
|
2038 } |
|
2039 |
|
2040 enum TVerdict TE_RConnectionUPSTest10::doTestStepL(void) |
|
2041 /** |
|
2042 * Test prompting behaviour when calling: |
|
2043 * RConnection::Start() |
|
2044 */ |
|
2045 { |
|
2046 TInt err; |
|
2047 |
|
2048 //Delete entries in the DecisionDB |
|
2049 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2050 |
|
2051 RSocketServ ss; |
|
2052 RConnection conn; |
|
2053 |
|
2054 err = OpenSocketServer(ss); |
|
2055 TESTEL(KErrNone == err, err); |
|
2056 CleanupClosePushL(ss); |
|
2057 |
|
2058 err = OpenConnection(conn, ss); |
|
2059 TESTEL(KErrNone == err, err); |
|
2060 CleanupClosePushL(conn); |
|
2061 |
|
2062 //Get the NotifyCount before the RConnection::...() API is called |
|
2063 TInt notifyCount1 = GetNotifyCount(); |
|
2064 |
|
2065 //Set the Test Notifier Response |
|
2066 err = SetNotifierResponse(); |
|
2067 TESTEL(KErrNone == err, err); |
|
2068 |
|
2069 //Call RConnection::Start(); |
|
2070 err = StartConnection(conn); |
|
2071 TESTL(KErrNone == CheckResult(err)); |
|
2072 |
|
2073 //Get the NotifyCount after the RConnection::...() API is called |
|
2074 TInt notifyCount2 = GetNotifyCount(); |
|
2075 |
|
2076 //Check the Prompt Occurred as expected |
|
2077 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2078 TEST(KErrNone == err); |
|
2079 |
|
2080 CloseConnection(conn); |
|
2081 CleanupStack::Pop(); |
|
2082 |
|
2083 CloseSocketServer(ss); |
|
2084 CleanupStack::Pop(); |
|
2085 |
|
2086 return TestStepResult(); |
|
2087 } // TE_RConnectionUPSTest10 |
|
2088 |
|
2089 |
|
2090 |
|
2091 TE_RConnectionUPSTest11::~TE_RConnectionUPSTest11() |
|
2092 { |
|
2093 } |
|
2094 |
|
2095 enum TVerdict TE_RConnectionUPSTest11::doTestStepL(void) |
|
2096 /** |
|
2097 * Test prompting behaviour when calling: |
|
2098 * RConnection::Start() followed by an explicit RSocket::SendTo(); |
|
2099 */ |
|
2100 { |
|
2101 TInt err; |
|
2102 |
|
2103 //Delete entries in the DecisionDB |
|
2104 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2105 |
|
2106 RSocketServ ss; |
|
2107 RConnection conn; |
|
2108 |
|
2109 err = OpenSocketServer(ss); |
|
2110 TESTEL(KErrNone == err, err); |
|
2111 CleanupClosePushL(ss); |
|
2112 |
|
2113 err = OpenConnection(conn, ss); |
|
2114 TESTEL(KErrNone == err, err); |
|
2115 CleanupClosePushL(conn); |
|
2116 |
|
2117 //Get the NotifyCount before the RConnection::...() API is called |
|
2118 TInt notifyCount1 = GetNotifyCount(); |
|
2119 |
|
2120 //Set the Test Notifier Response |
|
2121 err = SetNotifierResponse(); |
|
2122 TESTEL(KErrNone == err, err); |
|
2123 |
|
2124 //Call RConnection::Start(); |
|
2125 err = StartConnection(conn); |
|
2126 TESTL(KErrNone == CheckResult(err)); |
|
2127 |
|
2128 //Get the NotifyCount after the RSocket::...() API is called |
|
2129 TInt notifyCount2 = GetNotifyCount(); |
|
2130 |
|
2131 //Check the Prompt Occurred as expected |
|
2132 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2133 TEST(KErrNone == err); |
|
2134 |
|
2135 |
|
2136 RSocket sock; |
|
2137 |
|
2138 err = OpenUdpSocketExplicitL(sock, ss, conn); |
|
2139 TESTEL(KErrNone == err, err); |
|
2140 CleanupClosePushL(sock); |
|
2141 |
|
2142 //Get the NotifyCount before the RSocket::...() API is called |
|
2143 notifyCount1 = GetNotifyCount(); |
|
2144 |
|
2145 //Set the Test Notifier Response |
|
2146 err = SetNotifierResponse(); |
|
2147 TESTEL(KErrNone == err, err); |
|
2148 |
|
2149 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
2150 TESTL(KErrNone == CheckResult(err)); |
|
2151 |
|
2152 //Get the NotifyCount after the RSocket::...() API is called |
|
2153 notifyCount2 = GetNotifyCount(); |
|
2154 |
|
2155 //Check the Prompt Occurred as expected |
|
2156 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2157 TEST(KErrNone == err); |
|
2158 |
|
2159 DestroyUdpSocket(sock); |
|
2160 CleanupStack::Pop(); |
|
2161 |
|
2162 CloseConnection(conn); |
|
2163 CleanupStack::Pop(); |
|
2164 |
|
2165 CloseSocketServer(ss); |
|
2166 CleanupStack::Pop(); |
|
2167 |
|
2168 return TestStepResult(); |
|
2169 } // TE_RConnectionUPSTest11 |
|
2170 |
|
2171 |
|
2172 |
|
2173 TE_RConnectionUPSTest12::~TE_RConnectionUPSTest12() |
|
2174 { |
|
2175 } |
|
2176 |
|
2177 enum TVerdict TE_RConnectionUPSTest12::doTestStepL(void) |
|
2178 /** |
|
2179 * Test prompting behaviour when calling: |
|
2180 * RConnection::Start() followed by an explicit RSocket::Connect(); |
|
2181 */ |
|
2182 { |
|
2183 TInt err; |
|
2184 |
|
2185 //Delete entries in the DecisionDB |
|
2186 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2187 |
|
2188 RSocketServ ss; |
|
2189 RConnection conn; |
|
2190 |
|
2191 err = OpenSocketServer(ss); |
|
2192 TESTEL(KErrNone == err, err); |
|
2193 CleanupClosePushL(ss); |
|
2194 |
|
2195 err = OpenConnection(conn, ss); |
|
2196 TESTEL(KErrNone == err, err); |
|
2197 CleanupClosePushL(conn); |
|
2198 |
|
2199 //Get the NotifyCount before the RConnection::...() API is called |
|
2200 TInt notifyCount1 = GetNotifyCount(); |
|
2201 |
|
2202 //Set the Test Notifier Response |
|
2203 err = SetNotifierResponse(); |
|
2204 TESTEL(KErrNone == err, err); |
|
2205 |
|
2206 //Call RConnection::Start() |
|
2207 err = StartConnection(conn); |
|
2208 TESTL(KErrNone == CheckResult(err)); |
|
2209 |
|
2210 //Get the NotifyCount after the RConnection::...() API is called |
|
2211 TInt notifyCount2 = GetNotifyCount(); |
|
2212 |
|
2213 //Check the Prompt Occurred as expected |
|
2214 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2215 TEST(KErrNone == err); |
|
2216 |
|
2217 |
|
2218 RSocket sock; |
|
2219 |
|
2220 err = OpenTcpSocketExplicit(sock, ss, conn); |
|
2221 TESTEL(KErrNone == err, err); |
|
2222 CleanupClosePushL(sock); |
|
2223 |
|
2224 //Get the NotifyCount before the RSocket::...() API is called |
|
2225 notifyCount1 = GetNotifyCount(); |
|
2226 |
|
2227 //Set the Test Notifier Response |
|
2228 err = SetNotifierResponse(); |
|
2229 TESTEL(KErrNone == err, err); |
|
2230 |
|
2231 //Call Connect() |
|
2232 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
2233 TESTL(KErrNone == CheckResult(err)); |
|
2234 |
|
2235 //Get the NotifyCount after the RSocket::...() API is called |
|
2236 notifyCount2 = GetNotifyCount(); |
|
2237 |
|
2238 //Check the Prompt Occurred as expected |
|
2239 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2240 TEST(KErrNone == err); |
|
2241 |
|
2242 err = DestroyTcpSocket(sock); |
|
2243 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
2244 CleanupStack::Pop(); |
|
2245 |
|
2246 CloseConnection(conn); |
|
2247 CleanupStack::Pop(); |
|
2248 |
|
2249 CloseSocketServer(ss); |
|
2250 CleanupStack::Pop(); |
|
2251 |
|
2252 return TestStepResult(); |
|
2253 } // TE_RConnectionUPSTest12 |
|
2254 |
|
2255 |
|
2256 |
|
2257 TE_RConnectionUPSTest13::~TE_RConnectionUPSTest13() |
|
2258 { |
|
2259 } |
|
2260 |
|
2261 enum TVerdict TE_RConnectionUPSTest13::doTestStepL(void) |
|
2262 /** |
|
2263 * Test prompting behaviour when calling: |
|
2264 * RConnection::Start() followed by an explicit RHostResolver::GetByName(); |
|
2265 */ |
|
2266 { |
|
2267 // Test203 TE_RConnectionNtRasTestSteps.cpp te_rconnectionhostresolvertests_Connection.script |
|
2268 TInt err; |
|
2269 |
|
2270 //Delete entries in the DecisionDB |
|
2271 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2272 |
|
2273 RSocketServ ss; |
|
2274 RConnection conn; |
|
2275 |
|
2276 err = OpenSocketServer(ss); |
|
2277 TESTEL(KErrNone == err, err); |
|
2278 CleanupClosePushL(ss); |
|
2279 |
|
2280 err = OpenConnection(conn, ss); |
|
2281 TESTEL(KErrNone == err, err); |
|
2282 CleanupClosePushL(conn); |
|
2283 |
|
2284 //Get the NotifyCount before the RConnection::...() API is called |
|
2285 TInt notifyCount1 = GetNotifyCount(); |
|
2286 |
|
2287 //Set the Test Notifier Response |
|
2288 err = SetNotifierResponse(); |
|
2289 TESTEL(KErrNone == err, err); |
|
2290 |
|
2291 //Call RConnection::Start() |
|
2292 err = StartConnection(conn); |
|
2293 TESTL(KErrNone == CheckResult(err)); |
|
2294 |
|
2295 //Get the NotifyCount after the RConnection::...() API is called |
|
2296 TInt notifyCount2 = GetNotifyCount(); |
|
2297 |
|
2298 //Check the Prompt Occurred as expected |
|
2299 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2300 TEST(KErrNone == err); |
|
2301 |
|
2302 |
|
2303 RHostResolver hr; |
|
2304 |
|
2305 err = OpenHostResolverExplicit(hr, ss, conn); |
|
2306 TESTEL(KErrNone == err, err); |
|
2307 CleanupClosePushL(hr); |
|
2308 |
|
2309 //Get the NotifyCount before the RHostResolver::...() API is called |
|
2310 notifyCount1 = GetNotifyCount(); |
|
2311 |
|
2312 //Set the Test Notifier Response |
|
2313 err = SetNotifierResponse(); |
|
2314 TESTEL(KErrNone == err, err); |
|
2315 |
|
2316 //Call GetByName() |
|
2317 err = MakeSynchronousNameRequest(hr, iTestName); |
|
2318 TESTL(KErrNone == CheckResult(err)); |
|
2319 |
|
2320 //Get the NotifyCount after the RHostResolver::...() API is called |
|
2321 notifyCount2 = GetNotifyCount(); |
|
2322 |
|
2323 //Check the Prompt Occurred as expected |
|
2324 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2325 TEST(KErrNone == err); |
|
2326 |
|
2327 DestroyHostResolver(hr); |
|
2328 CleanupStack::Pop(); |
|
2329 |
|
2330 CloseConnection(conn); |
|
2331 CleanupStack::Pop(); |
|
2332 |
|
2333 CloseSocketServer(ss); |
|
2334 CleanupStack::Pop(); |
|
2335 |
|
2336 |
|
2337 return TestStepResult(); |
|
2338 } // TE_RConnectionUPSTest13 |
|
2339 |
|
2340 |
|
2341 |
|
2342 TE_RConnectionUPSTest14::~TE_RConnectionUPSTest14() |
|
2343 { |
|
2344 } |
|
2345 |
|
2346 enum TVerdict TE_RConnectionUPSTest14::doTestStepL(void) |
|
2347 /** |
|
2348 * Test prompting behaviour when calling: |
|
2349 * RConnection::Start() followed by an explicit |
|
2350 * RHostResolver::GetByAddress(); |
|
2351 */ |
|
2352 { |
|
2353 TInt err; |
|
2354 |
|
2355 //Delete entries in the DecisionDB |
|
2356 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2357 |
|
2358 RSocketServ ss; |
|
2359 RConnection conn; |
|
2360 |
|
2361 err = OpenSocketServer(ss); |
|
2362 TESTEL(KErrNone == err, err); |
|
2363 CleanupClosePushL(ss); |
|
2364 |
|
2365 err = OpenConnection(conn, ss); |
|
2366 TESTEL(KErrNone == err, err); |
|
2367 CleanupClosePushL(conn); |
|
2368 |
|
2369 //Get the NotifyCount before the RConnection::...() API is called |
|
2370 TInt notifyCount1 = GetNotifyCount(); |
|
2371 |
|
2372 //Set the Test Notifier Response |
|
2373 err = SetNotifierResponse(); |
|
2374 TESTEL(KErrNone == err, err); |
|
2375 |
|
2376 //Call RConnection::Start() |
|
2377 err = StartConnection(conn); |
|
2378 TESTL(KErrNone == CheckResult(err)); |
|
2379 |
|
2380 //Get the NotifyCount after the RConnection::...() API is called |
|
2381 TInt notifyCount2 = GetNotifyCount(); |
|
2382 |
|
2383 //Check the Prompt Occurred as expected |
|
2384 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2385 TEST(KErrNone == err); |
|
2386 |
|
2387 |
|
2388 RHostResolver hr; |
|
2389 |
|
2390 err = OpenHostResolverExplicit(hr, ss, conn); |
|
2391 TESTEL(KErrNone == err, err); |
|
2392 CleanupClosePushL(hr); |
|
2393 |
|
2394 //Get the NotifyCount before the RHostResolver::...() API is called |
|
2395 notifyCount1 = GetNotifyCount(); |
|
2396 |
|
2397 //Set the Test Notifier Response |
|
2398 err = SetNotifierResponse(); |
|
2399 TESTEL(KErrNone == err, err); |
|
2400 |
|
2401 //Call GetByAddress() |
|
2402 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
2403 TESTL(KErrNone == CheckResult(err)); |
|
2404 |
|
2405 //Get the NotifyCount after the RHostResolver::...() API is called |
|
2406 notifyCount2 = GetNotifyCount(); |
|
2407 |
|
2408 //Check the Prompt Occurred as expected |
|
2409 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2410 TEST(KErrNone == err); |
|
2411 |
|
2412 DestroyHostResolver(hr); |
|
2413 CleanupStack::Pop(); |
|
2414 |
|
2415 CloseConnection(conn); |
|
2416 CleanupStack::Pop(); |
|
2417 |
|
2418 CloseSocketServer(ss); |
|
2419 CleanupStack::Pop(); |
|
2420 |
|
2421 return TestStepResult(); |
|
2422 } // TE_RConnectionUPSTest14 |
|
2423 |
|
2424 |
|
2425 |
|
2426 TE_RConnectionUPSTest15::~TE_RConnectionUPSTest15() |
|
2427 { |
|
2428 } |
|
2429 |
|
2430 enum TVerdict TE_RConnectionUPSTest15::doTestStepL(void) |
|
2431 /** |
|
2432 * Test prompting behaviour when calling: |
|
2433 * RConnection::Start() followed by an explicit RSocket::SendTo(), |
|
2434 * followed by an explicit RSocket2::SendTo() |
|
2435 */ |
|
2436 { |
|
2437 TInt err; |
|
2438 |
|
2439 //Delete entries in the DecisionDB |
|
2440 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2441 |
|
2442 RSocketServ ss; |
|
2443 RConnection conn; |
|
2444 |
|
2445 err = OpenSocketServer(ss); |
|
2446 TESTEL(KErrNone == err, err); |
|
2447 CleanupClosePushL(ss); |
|
2448 |
|
2449 err = OpenConnection(conn, ss); |
|
2450 TESTEL(KErrNone == err, err); |
|
2451 CleanupClosePushL(conn); |
|
2452 |
|
2453 //Get the NotifyCount before the RConnection::...() API is called |
|
2454 TInt notifyCount1 = GetNotifyCount(); |
|
2455 |
|
2456 //Set the Test Notifier Response |
|
2457 err = SetNotifierResponse(); |
|
2458 TESTEL(KErrNone == err, err); |
|
2459 |
|
2460 //Call RConnection::Start(); |
|
2461 err = StartConnection(conn); |
|
2462 TESTL(KErrNone == CheckResult(err)); |
|
2463 |
|
2464 //Get the NotifyCount after the RConnection::...() API is called |
|
2465 TInt notifyCount2 = GetNotifyCount(); |
|
2466 |
|
2467 //Check the Prompt Occurred as expected |
|
2468 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2469 TEST(KErrNone == err); |
|
2470 |
|
2471 |
|
2472 RSocket sock; |
|
2473 |
|
2474 err = OpenUdpSocketExplicitL(sock, ss, conn); |
|
2475 TESTEL(KErrNone == err, err); |
|
2476 CleanupClosePushL(sock); |
|
2477 |
|
2478 //Get the NotifyCount before the RSocket::...() API is called |
|
2479 notifyCount1 = GetNotifyCount(); |
|
2480 |
|
2481 //Set the Test Notifier Response |
|
2482 err = SetNotifierResponse(); |
|
2483 TESTEL(KErrNone == err, err); |
|
2484 |
|
2485 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
2486 TESTL(KErrNone == CheckResult(err)); |
|
2487 |
|
2488 //Get the NotifyCount after the RSocket::...() API is called |
|
2489 notifyCount2 = GetNotifyCount(); |
|
2490 |
|
2491 //Check the Prompt Occurred as expected |
|
2492 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2493 TEST(KErrNone == err); |
|
2494 |
|
2495 |
|
2496 RSocket sock2; |
|
2497 |
|
2498 err = OpenUdpSocketExplicitL(sock2, ss, conn); |
|
2499 TESTEL(KErrNone == err, err); |
|
2500 CleanupClosePushL(sock); |
|
2501 |
|
2502 //Get the NotifyCount before the RSocket::...() API is called |
|
2503 notifyCount1 = GetNotifyCount(); |
|
2504 |
|
2505 //Set the Test Notifier Response |
|
2506 err = SetNotifierResponse(); |
|
2507 TESTEL(KErrNone == err, err); |
|
2508 |
|
2509 err = TestUdpDataPathL(sock2, iDummyNifSendAddr); |
|
2510 TESTL(KErrNone == CheckResult(err)); |
|
2511 |
|
2512 //Get the NotifyCount after the RSocket::...() API is called |
|
2513 notifyCount2 = GetNotifyCount(); |
|
2514 |
|
2515 //Check the Prompt Occurred as expected |
|
2516 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2517 TEST(KErrNone == err); |
|
2518 |
|
2519 DestroyUdpSocket(sock2); |
|
2520 CleanupStack::Pop(); |
|
2521 |
|
2522 DestroyUdpSocket(sock); |
|
2523 CleanupStack::Pop(); |
|
2524 |
|
2525 CloseConnection(conn); |
|
2526 CleanupStack::Pop(); |
|
2527 |
|
2528 CloseSocketServer(ss); |
|
2529 CleanupStack::Pop(); |
|
2530 |
|
2531 return TestStepResult(); |
|
2532 } // TE_RConnectionUPSTest15 |
|
2533 |
|
2534 |
|
2535 |
|
2536 TE_RConnectionUPSTest16::~TE_RConnectionUPSTest16() |
|
2537 { |
|
2538 } |
|
2539 |
|
2540 enum TVerdict TE_RConnectionUPSTest16::doTestStepL(void) |
|
2541 /** |
|
2542 * Test prompting behaviour when calling: |
|
2543 * RConnection::Start() followed by RConnection2::Start(), |
|
2544 * followed by an explicit RSocket::SendTo() using RConnection2 |
|
2545 */ |
|
2546 { |
|
2547 TInt err; |
|
2548 |
|
2549 //Delete entries in the DecisionDB |
|
2550 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2551 |
|
2552 RSocketServ ss; |
|
2553 RConnection conn; |
|
2554 |
|
2555 err = OpenSocketServer(ss); |
|
2556 TESTEL(KErrNone == err, err); |
|
2557 CleanupClosePushL(ss); |
|
2558 |
|
2559 err = OpenConnection(conn, ss); |
|
2560 TESTEL(KErrNone == err, err); |
|
2561 CleanupClosePushL(conn); |
|
2562 |
|
2563 //Get the NotifyCount before the RConnection::...() API is called |
|
2564 TInt notifyCount1 = GetNotifyCount(); |
|
2565 |
|
2566 //Set the Test Notifier Response |
|
2567 err = SetNotifierResponse(); |
|
2568 TESTEL(KErrNone == err, err); |
|
2569 |
|
2570 //Call RConnection::Start(); |
|
2571 err = StartConnection(conn); |
|
2572 TESTL(KErrNone == CheckResult(err)); |
|
2573 |
|
2574 //Get the NotifyCount after the RSocket::...() API is called |
|
2575 TInt notifyCount2 = GetNotifyCount(); |
|
2576 |
|
2577 //Check the Prompt Occurred as expected |
|
2578 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2579 TEST(KErrNone == err); |
|
2580 |
|
2581 |
|
2582 RConnection conn2; |
|
2583 |
|
2584 err = OpenConnection(conn2, ss); |
|
2585 TESTEL(KErrNone == err, err); |
|
2586 CleanupClosePushL(conn2); |
|
2587 |
|
2588 //Get the NotifyCount before the RConnection::...() API is called |
|
2589 notifyCount1 = GetNotifyCount(); |
|
2590 |
|
2591 //Set the Test Notifier Response |
|
2592 err = SetNotifierResponse(); |
|
2593 TESTEL(KErrNone == err, err); |
|
2594 |
|
2595 //Call RConnection::Start(); |
|
2596 err = StartConnection(conn2); |
|
2597 TESTL(KErrNone == CheckResult(err)); |
|
2598 |
|
2599 //Get the NotifyCount after the RSocket::...() API is called |
|
2600 notifyCount2 = GetNotifyCount(); |
|
2601 |
|
2602 //Check the Prompt Occurred as expected |
|
2603 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2604 TEST(KErrNone == err); |
|
2605 |
|
2606 |
|
2607 RSocket sock; |
|
2608 |
|
2609 err = OpenUdpSocketExplicitL(sock, ss, conn2); |
|
2610 TESTEL(KErrNone == err, err); |
|
2611 CleanupClosePushL(sock); |
|
2612 |
|
2613 //Get the NotifyCount before the RSocket::...() API is called |
|
2614 notifyCount1 = GetNotifyCount(); |
|
2615 |
|
2616 //Set the Test Notifier Response |
|
2617 err = SetNotifierResponse(); |
|
2618 TESTEL(KErrNone == err, err); |
|
2619 |
|
2620 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
2621 TESTL(KErrNone == CheckResult(err)); |
|
2622 |
|
2623 //Get the NotifyCount after the RSocket::...() API is called |
|
2624 notifyCount2 = GetNotifyCount(); |
|
2625 |
|
2626 //Check the Prompt Occurred as expected |
|
2627 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2628 TEST(KErrNone == err); |
|
2629 |
|
2630 DestroyUdpSocket(sock); |
|
2631 CleanupStack::Pop(); |
|
2632 |
|
2633 CloseConnection(conn2); |
|
2634 CleanupStack::Pop(); |
|
2635 |
|
2636 CloseConnection(conn); |
|
2637 CleanupStack::Pop(); |
|
2638 |
|
2639 CloseSocketServer(ss); |
|
2640 CleanupStack::Pop(); |
|
2641 |
|
2642 return TestStepResult(); |
|
2643 } // TE_RConnectionUPSTest16 |
|
2644 |
|
2645 |
|
2646 |
|
2647 TE_RConnectionUPSTest17::~TE_RConnectionUPSTest17() |
|
2648 { |
|
2649 } |
|
2650 |
|
2651 |
|
2652 enum TVerdict TE_RConnectionUPSTest17::doTestStepL(void) |
|
2653 /** |
|
2654 * Test prompting behaviour when calling: |
|
2655 * RConnection::Start(), close RConnection, RConnection2::Start(), |
|
2656 * followed by an explicit RSocket::SendTo() on RConnection2 |
|
2657 * |
|
2658 * This test should behave differently in NetworkLifetime Mode |
|
2659 * when Notifier response is Session based, since decision is no |
|
2660 * longer valid once first RConnection is closed i.e. once all client |
|
2661 * associations with connections cease to exist |
|
2662 */ |
|
2663 { |
|
2664 TInt err; |
|
2665 |
|
2666 //Delete entries in the DecisionDB |
|
2667 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2668 |
|
2669 RSocketServ ss; |
|
2670 RConnection conn; |
|
2671 |
|
2672 err = OpenSocketServer(ss); |
|
2673 TESTEL(KErrNone == err, err); |
|
2674 CleanupClosePushL(ss); |
|
2675 |
|
2676 err = OpenConnection(conn, ss); |
|
2677 TESTEL(KErrNone == err, err); |
|
2678 CleanupClosePushL(conn); |
|
2679 |
|
2680 //Get the NotifyCount before the RConnection::...() API is called |
|
2681 TInt notifyCount1 = GetNotifyCount(); |
|
2682 |
|
2683 //Set the Test Notifier Response |
|
2684 err = SetNotifierResponse(); |
|
2685 TESTEL(KErrNone == err, err); |
|
2686 |
|
2687 //Call RConnection::Start(); |
|
2688 err = StartConnection(conn); |
|
2689 TESTL(KErrNone == CheckResult(err)); |
|
2690 |
|
2691 //Get the NotifyCount after the RSocket::...() API is called |
|
2692 TInt notifyCount2 = GetNotifyCount(); |
|
2693 |
|
2694 //Check the Prompt Occurred as expected |
|
2695 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2696 TEST(KErrNone == err); |
|
2697 |
|
2698 CloseConnection(conn); |
|
2699 CleanupStack::Pop(); |
|
2700 |
|
2701 |
|
2702 RConnection conn2; |
|
2703 |
|
2704 err = OpenConnection(conn2, ss); |
|
2705 TESTEL(KErrNone == err, err); |
|
2706 CleanupClosePushL(conn2); |
|
2707 |
|
2708 //Get the NotifyCount before the RConnection::...() API is called |
|
2709 notifyCount1 = GetNotifyCount(); |
|
2710 |
|
2711 //Set the Test Notifier Response |
|
2712 err = SetNotifierResponse(); |
|
2713 TESTEL(KErrNone == err, err); |
|
2714 |
|
2715 //Call RConnection::Start(); |
|
2716 err = StartConnection(conn2); |
|
2717 TESTL(KErrNone == CheckResult(err)); |
|
2718 |
|
2719 //Get the NotifyCount after the RSocket::...() API is called |
|
2720 notifyCount2 = GetNotifyCount(); |
|
2721 |
|
2722 //Check the Prompt Occurred as expected |
|
2723 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2724 TEST(KErrNone == err); |
|
2725 |
|
2726 |
|
2727 RSocket sock; |
|
2728 |
|
2729 err = OpenUdpSocketExplicitL(sock, ss, conn2); |
|
2730 TESTEL(KErrNone == err, err); |
|
2731 CleanupClosePushL(sock); |
|
2732 |
|
2733 //Get the NotifyCount before the RSocket::...() API is called |
|
2734 notifyCount1 = GetNotifyCount(); |
|
2735 |
|
2736 //Set the Test Notifier Response |
|
2737 err = SetNotifierResponse(); |
|
2738 TESTEL(KErrNone == err, err); |
|
2739 |
|
2740 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
2741 TESTL(KErrNone == CheckResult(err)); |
|
2742 |
|
2743 //Get the NotifyCount after the RSocket::...() API is called |
|
2744 notifyCount2 = GetNotifyCount(); |
|
2745 |
|
2746 //Check the Prompt Occurred as expected |
|
2747 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2748 TEST(KErrNone == err); |
|
2749 |
|
2750 DestroyUdpSocket(sock); |
|
2751 CleanupStack::Pop(); |
|
2752 |
|
2753 CloseConnection(conn2); |
|
2754 CleanupStack::Pop(); |
|
2755 |
|
2756 CloseSocketServer(ss); |
|
2757 CleanupStack::Pop(); |
|
2758 |
|
2759 return TestStepResult(); |
|
2760 } // TE_RConnectionUPSTest17 |
|
2761 |
|
2762 |
|
2763 TE_RConnectionUPSTest18::~TE_RConnectionUPSTest18() |
|
2764 { |
|
2765 } |
|
2766 |
|
2767 |
|
2768 enum TVerdict TE_RConnectionUPSTest18::doTestStepL(void) |
|
2769 /** |
|
2770 * Test prompting behaviour when calling: |
|
2771 * RConnection::Start(), close RConnection, Delete UPS Decision DB, |
|
2772 * Followed by an RConnection2::Start(), followed by an explicit |
|
2773 * |
|
2774 * This test should behave differently when run in NetworkLifetime |
|
2775 * mode and decision from Notifier is Always/Never or Session based - |
|
2776 * Closing the initial RConnection clears the decision which gets stored |
|
2777 * in the NetUPS component, while deleting the UPS Decision DB should |
|
2778 * clear any persistent storage of any decision from the UPS DB |
|
2779 */ |
|
2780 { |
|
2781 |
|
2782 TInt err; |
|
2783 |
|
2784 //Delete entries in the DecisionDB |
|
2785 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2786 |
|
2787 RSocketServ ss; |
|
2788 RConnection conn; |
|
2789 |
|
2790 err = OpenSocketServer(ss); |
|
2791 TESTEL(KErrNone == err, err); |
|
2792 CleanupClosePushL(ss); |
|
2793 |
|
2794 err = OpenConnection(conn, ss); |
|
2795 TESTEL(KErrNone == err, err); |
|
2796 CleanupClosePushL(conn); |
|
2797 |
|
2798 //Get the NotifyCount before the RConnection::...() API is called |
|
2799 TInt notifyCount1 = GetNotifyCount(); |
|
2800 |
|
2801 //Set the Test Notifier Response |
|
2802 err = SetNotifierResponse(); |
|
2803 TESTEL(KErrNone == err, err); |
|
2804 |
|
2805 //Call RConnection::Start(); |
|
2806 err = StartConnection(conn); |
|
2807 TESTL(KErrNone == CheckResult(err)); |
|
2808 |
|
2809 //Get the NotifyCount after the RConnection::...() API is called |
|
2810 TInt notifyCount2 = GetNotifyCount(); |
|
2811 |
|
2812 //Check the Prompt Occurred as expected |
|
2813 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2814 TEST(KErrNone == err); |
|
2815 |
|
2816 CloseConnection(conn); |
|
2817 CleanupStack::Pop(); |
|
2818 |
|
2819 DeleteUpsDB(); |
|
2820 |
|
2821 |
|
2822 RConnection conn2; |
|
2823 |
|
2824 err = OpenConnection(conn2, ss); |
|
2825 TESTEL(KErrNone == err, err); |
|
2826 CleanupClosePushL(conn2); |
|
2827 |
|
2828 //Get the NotifyCount before the RConnection::...() API is called |
|
2829 notifyCount1 = GetNotifyCount(); |
|
2830 |
|
2831 //Set the Test Notifier Response |
|
2832 err = SetNotifierResponse(); |
|
2833 TESTEL(KErrNone == err, err); |
|
2834 |
|
2835 //Call RConnection::Start(); |
|
2836 err = StartConnection(conn2); |
|
2837 TESTL(KErrNone == CheckResult(err)); |
|
2838 |
|
2839 //Get the NotifyCount after the RConnection::...() API is called |
|
2840 notifyCount2 = GetNotifyCount(); |
|
2841 |
|
2842 //Check the Prompt Occurred as expected |
|
2843 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2844 TEST(KErrNone == err); |
|
2845 |
|
2846 |
|
2847 RSocket sock; |
|
2848 |
|
2849 err = OpenUdpSocketExplicitL(sock, ss, conn2); |
|
2850 TESTEL(KErrNone == err, err); |
|
2851 CleanupClosePushL(sock); |
|
2852 |
|
2853 //Get the NotifyCount before the RSocket::...() API is called |
|
2854 notifyCount1 = GetNotifyCount(); |
|
2855 |
|
2856 //Set the Test Notifier Response |
|
2857 err = SetNotifierResponse(); |
|
2858 TESTEL(KErrNone == err, err); |
|
2859 |
|
2860 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
2861 TESTL(KErrNone == CheckResult(err)); |
|
2862 |
|
2863 //Get the NotifyCount after the RSocket::...() API is called |
|
2864 notifyCount2 = GetNotifyCount(); |
|
2865 |
|
2866 //Check the Prompt Occurred as expected |
|
2867 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2868 TEST(KErrNone == err); |
|
2869 |
|
2870 DestroyUdpSocket(sock); |
|
2871 CleanupStack::Pop(); |
|
2872 |
|
2873 CloseConnection(conn2); |
|
2874 CleanupStack::Pop(); |
|
2875 |
|
2876 CloseSocketServer(ss); |
|
2877 CleanupStack::Pop(); |
|
2878 |
|
2879 return TestStepResult(); |
|
2880 } // TE_RConnectionUPSTest18 |
|
2881 |
|
2882 |
|
2883 |
|
2884 TE_RConnectionUPSTest19::~TE_RConnectionUPSTest19() |
|
2885 { |
|
2886 } |
|
2887 |
|
2888 enum TVerdict TE_RConnectionUPSTest19::doTestStepL(void) |
|
2889 /** |
|
2890 * Test prompting behaviour when calling: |
|
2891 * RConnection::Start() followed by an implicit RSocket::SendTo(); |
|
2892 */ |
|
2893 { |
|
2894 TInt err; |
|
2895 |
|
2896 //Delete entries in the DecisionDB |
|
2897 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2898 |
|
2899 RSocketServ ss; |
|
2900 RConnection conn; |
|
2901 |
|
2902 err = OpenSocketServer(ss); |
|
2903 TESTEL(KErrNone == err, err); |
|
2904 CleanupClosePushL(ss); |
|
2905 |
|
2906 err = OpenConnection(conn, ss); |
|
2907 TESTEL(KErrNone == err, err); |
|
2908 CleanupClosePushL(conn); |
|
2909 |
|
2910 //Get the NotifyCount before the RConnection::...() API is called |
|
2911 TInt notifyCount1 = GetNotifyCount(); |
|
2912 |
|
2913 //Set the Test Notifier Response |
|
2914 err = SetNotifierResponse(); |
|
2915 TESTEL(KErrNone == err, err); |
|
2916 |
|
2917 //Call RConnection::Start() |
|
2918 err = StartConnection(conn); |
|
2919 TESTL(KErrNone == CheckResult(err)); |
|
2920 |
|
2921 //Get the NotifyCount after the RConnection::...() API is called |
|
2922 TInt notifyCount2 = GetNotifyCount(); |
|
2923 |
|
2924 //Check the Prompt Occurred as expected |
|
2925 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2926 TEST(KErrNone == err); |
|
2927 |
|
2928 |
|
2929 RSocket sock; |
|
2930 |
|
2931 err = OpenUdpSocketL(sock, ss); |
|
2932 TESTEL(KErrNone == err, err); |
|
2933 CleanupClosePushL(sock); |
|
2934 |
|
2935 //Get the NotifyCount beforethe RSocket::...() API is called |
|
2936 notifyCount1 = GetNotifyCount(); |
|
2937 |
|
2938 //Set the Test Notifier Response |
|
2939 err = SetNotifierResponse(); |
|
2940 TESTEL(KErrNone == err, err); |
|
2941 |
|
2942 //Call SendTo() and RecvFrom() |
|
2943 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
2944 TESTL(KErrNone == CheckResult(err)); |
|
2945 |
|
2946 //Get the NotifyCount after the RSocket::...() API is called |
|
2947 notifyCount2 = GetNotifyCount(); |
|
2948 |
|
2949 //Check the Prompt Occurred as expected |
|
2950 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
2951 TEST(KErrNone == err); |
|
2952 |
|
2953 DestroyUdpSocket(sock); |
|
2954 CleanupStack::Pop(); |
|
2955 |
|
2956 CloseConnection(conn); |
|
2957 CleanupStack::Pop(); |
|
2958 |
|
2959 CloseSocketServer(ss); |
|
2960 CleanupStack::Pop(); |
|
2961 |
|
2962 return TestStepResult(); |
|
2963 } // TE_RConnectionUPSTest19 |
|
2964 |
|
2965 |
|
2966 TE_RConnectionUPSTest20::~TE_RConnectionUPSTest20() |
|
2967 { |
|
2968 } |
|
2969 |
|
2970 |
|
2971 enum TVerdict TE_RConnectionUPSTest20::doTestStepL(void) |
|
2972 { |
|
2973 /** |
|
2974 * Test prompting behaviour when calling: |
|
2975 * RConnection::Start() followed by an implicit RSocket::Connect(); |
|
2976 */ |
|
2977 TInt err; |
|
2978 |
|
2979 //Delete entries in the DecisionDB |
|
2980 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
2981 |
|
2982 RSocketServ ss; |
|
2983 RConnection conn; |
|
2984 |
|
2985 err = OpenSocketServer(ss); |
|
2986 TESTEL(KErrNone == err, err); |
|
2987 CleanupClosePushL(ss); |
|
2988 |
|
2989 err = OpenConnection(conn, ss); |
|
2990 TESTEL(KErrNone == err, err); |
|
2991 CleanupClosePushL(conn); |
|
2992 |
|
2993 //Get the NotifyCount before the RConnection::...() API is called |
|
2994 TInt notifyCount1 = GetNotifyCount(); |
|
2995 |
|
2996 //Set the Test Notifier Response |
|
2997 err = SetNotifierResponse(); |
|
2998 TESTEL(KErrNone == err, err); |
|
2999 |
|
3000 //Call RConnection::Start() |
|
3001 err = StartConnection(conn); |
|
3002 TESTL(KErrNone == CheckResult(err)); |
|
3003 |
|
3004 //Get the NotifyCount after the RConnection::...() API is called |
|
3005 TInt notifyCount2 = GetNotifyCount(); |
|
3006 |
|
3007 //Check the Prompt Occurred as expected |
|
3008 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3009 TEST(KErrNone == err); |
|
3010 |
|
3011 |
|
3012 RSocket sock; |
|
3013 |
|
3014 err = OpenTcpSocket(sock, ss); |
|
3015 TESTEL(KErrNone == err, err); |
|
3016 CleanupClosePushL(sock); |
|
3017 |
|
3018 //Get the NotifyCount before the RSocket::...() API is called |
|
3019 notifyCount1 = GetNotifyCount(); |
|
3020 |
|
3021 //Set the Test Notifier Response |
|
3022 err = SetNotifierResponse(); |
|
3023 TESTEL(KErrNone == err, err); |
|
3024 |
|
3025 //Call Connect() |
|
3026 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
3027 TESTL(KErrNone == CheckResult(err)); |
|
3028 |
|
3029 //Get the NotifyCount after the RSocket::...() API is called |
|
3030 notifyCount2 = GetNotifyCount(); |
|
3031 |
|
3032 //Check the Prompt Occurred as expected |
|
3033 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3034 TEST(KErrNone == err); |
|
3035 |
|
3036 err = DestroyTcpSocket(sock); |
|
3037 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
3038 CleanupStack::Pop(); |
|
3039 |
|
3040 CloseConnection(conn); |
|
3041 CleanupStack::Pop(); |
|
3042 |
|
3043 CloseSocketServer(ss); |
|
3044 CleanupStack::Pop(); |
|
3045 |
|
3046 return TestStepResult(); |
|
3047 } // TE_RConnectionUPSTest20 |
|
3048 |
|
3049 |
|
3050 |
|
3051 TE_RConnectionUPSTest21::~TE_RConnectionUPSTest21() |
|
3052 { |
|
3053 } |
|
3054 |
|
3055 enum TVerdict TE_RConnectionUPSTest21::doTestStepL(void) |
|
3056 /** |
|
3057 * Test prompting behaviour when calling: |
|
3058 * RConnection::Start() followed by an implicit |
|
3059 * RHostResolver::GetByName() |
|
3060 */ |
|
3061 { |
|
3062 TInt err; |
|
3063 |
|
3064 //Delete entries in the DecisionDB |
|
3065 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3066 |
|
3067 RSocketServ ss; |
|
3068 RConnection conn; |
|
3069 |
|
3070 err = OpenSocketServer(ss); |
|
3071 TESTEL(KErrNone == err, err); |
|
3072 CleanupClosePushL(ss); |
|
3073 |
|
3074 err = OpenConnection(conn, ss); |
|
3075 TESTEL(KErrNone == err, err); |
|
3076 CleanupClosePushL(conn); |
|
3077 |
|
3078 //Get the NotifyCount before the RConnection::...() API is called |
|
3079 TInt notifyCount1 = GetNotifyCount(); |
|
3080 |
|
3081 //Set the Test Notifier Response |
|
3082 err = SetNotifierResponse(); |
|
3083 TESTEL(KErrNone == err, err); |
|
3084 |
|
3085 //Call RConnection::Start() |
|
3086 err = StartConnection(conn); |
|
3087 TESTL(KErrNone == CheckResult(err)); |
|
3088 |
|
3089 //Get the NotifyCount after the RConnection::...() API is called |
|
3090 TInt notifyCount2 = GetNotifyCount(); |
|
3091 |
|
3092 //Check the Prompt Occurred as expected |
|
3093 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3094 TEST(KErrNone == err); |
|
3095 |
|
3096 |
|
3097 RHostResolver hr; |
|
3098 |
|
3099 err = OpenHostResolver(hr, ss); |
|
3100 TESTEL(KErrNone == err, err); |
|
3101 CleanupClosePushL(hr); |
|
3102 |
|
3103 //Get the NotifyCount before the RHostResolver::...() API is called |
|
3104 notifyCount1 = GetNotifyCount(); |
|
3105 |
|
3106 //Set the Test Notifier Response |
|
3107 err = SetNotifierResponse(); |
|
3108 TESTEL(KErrNone == err, err); |
|
3109 |
|
3110 //Call GetByName() |
|
3111 err = MakeSynchronousNameRequest(hr, iTestName); |
|
3112 TESTL(KErrNone == CheckResult(err)); |
|
3113 |
|
3114 //Get the NotifyCount after the RHostResolver::...() API is called |
|
3115 notifyCount2 = GetNotifyCount(); |
|
3116 |
|
3117 //Check the Prompt Occurred as expected |
|
3118 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3119 TEST(KErrNone == err); |
|
3120 |
|
3121 DestroyHostResolver(hr); |
|
3122 CleanupStack::Pop(); |
|
3123 |
|
3124 CloseConnection(conn); |
|
3125 CleanupStack::Pop(); |
|
3126 |
|
3127 CloseSocketServer(ss); |
|
3128 CleanupStack::Pop(); |
|
3129 |
|
3130 return TestStepResult(); |
|
3131 } // TE_RConnectionUPSTest21 |
|
3132 |
|
3133 |
|
3134 |
|
3135 TE_RConnectionUPSTest22::~TE_RConnectionUPSTest22() |
|
3136 { |
|
3137 } |
|
3138 |
|
3139 enum TVerdict TE_RConnectionUPSTest22::doTestStepL(void) |
|
3140 /** |
|
3141 * Test prompting behaviour when calling: |
|
3142 * RConnection::Start() followed by an implicit |
|
3143 * RHostResolver::GetByAddress() |
|
3144 */ |
|
3145 { |
|
3146 TInt err; |
|
3147 |
|
3148 //Delete entries in the DecisionDB |
|
3149 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3150 |
|
3151 RSocketServ ss; |
|
3152 RConnection conn; |
|
3153 |
|
3154 err = OpenSocketServer(ss); |
|
3155 TESTEL(KErrNone == err, err); |
|
3156 CleanupClosePushL(ss); |
|
3157 |
|
3158 err = OpenConnection(conn, ss); |
|
3159 TESTEL(KErrNone == err, err); |
|
3160 CleanupClosePushL(conn); |
|
3161 |
|
3162 //Get the NotifyCount before the RConnection::...() API is called |
|
3163 TInt notifyCount1 = GetNotifyCount(); |
|
3164 |
|
3165 //Set the Test Notifier Response |
|
3166 err = SetNotifierResponse(); |
|
3167 TESTEL(KErrNone == err, err); |
|
3168 |
|
3169 //Call RConnection::Start() |
|
3170 err = StartConnection(conn); |
|
3171 TESTL(KErrNone == CheckResult(err)); |
|
3172 |
|
3173 //Get the NotifyCount after the RConnection::...() API is called |
|
3174 TInt notifyCount2 = GetNotifyCount(); |
|
3175 |
|
3176 //Check the Prompt Occurred as expected |
|
3177 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3178 TEST(KErrNone == err); |
|
3179 |
|
3180 |
|
3181 RHostResolver hr; |
|
3182 |
|
3183 err = OpenHostResolver(hr, ss); |
|
3184 TESTEL(KErrNone == err, err); |
|
3185 CleanupClosePushL(hr); |
|
3186 |
|
3187 //Get the NotifyCount before the RHostResolver::...() API is called |
|
3188 notifyCount1 = GetNotifyCount(); |
|
3189 |
|
3190 //Set the Test Notifier Response |
|
3191 err = SetNotifierResponse(); |
|
3192 TESTEL(KErrNone == err, err); |
|
3193 |
|
3194 //Call GetByAddress() |
|
3195 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
3196 TESTL(KErrNone == CheckResult(err)); |
|
3197 |
|
3198 //Get the NotifyCount after the RHostResolver::...() API is called |
|
3199 notifyCount2 = GetNotifyCount(); |
|
3200 |
|
3201 //Check the Prompt Occurred as expected |
|
3202 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3203 TEST(KErrNone == err); |
|
3204 |
|
3205 DestroyHostResolver(hr); |
|
3206 CleanupStack::Pop(); |
|
3207 |
|
3208 CloseConnection(conn); |
|
3209 CleanupStack::Pop(); |
|
3210 |
|
3211 CloseSocketServer(ss); |
|
3212 CleanupStack::Pop(); |
|
3213 |
|
3214 return TestStepResult(); |
|
3215 } // TE_RConnectionUPSTest22 |
|
3216 |
|
3217 |
|
3218 |
|
3219 TE_RConnectionUPSTest23::~TE_RConnectionUPSTest23() |
|
3220 { |
|
3221 } |
|
3222 |
|
3223 enum TVerdict TE_RConnectionUPSTest23::doTestStepL(void) |
|
3224 /** |
|
3225 * Test prompting behaviour when calling: |
|
3226 * RConnection::Start() followed by an implicit RSocket::SendTo(), |
|
3227 * followed by RConnection2::Start(), followed by |
|
3228 * RConnection3::Start() |
|
3229 */ |
|
3230 { |
|
3231 TInt err; |
|
3232 |
|
3233 //Delete entries in the DecisionDB |
|
3234 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3235 |
|
3236 RSocketServ ss; |
|
3237 RConnection conn; |
|
3238 |
|
3239 err = OpenSocketServer(ss); |
|
3240 TESTEL(KErrNone == err, err); |
|
3241 CleanupClosePushL(ss); |
|
3242 |
|
3243 err = OpenConnection(conn, ss); |
|
3244 TESTEL(KErrNone == err, err); |
|
3245 CleanupClosePushL(conn); |
|
3246 |
|
3247 //Get the NotifyCount before the RConnection::...() API is called |
|
3248 TInt notifyCount1 = GetNotifyCount(); |
|
3249 |
|
3250 //Set the Test Notifier Response |
|
3251 err = SetNotifierResponse(); |
|
3252 TESTEL(KErrNone == err, err); |
|
3253 |
|
3254 //Call RConnection::Start() |
|
3255 err = StartConnection(conn); |
|
3256 TESTL(KErrNone == CheckResult(err)); |
|
3257 |
|
3258 //Get the NotifyCount after the RConnection::...() API is called |
|
3259 TInt notifyCount2 = GetNotifyCount(); |
|
3260 |
|
3261 //Check the Prompt Occurred as expected |
|
3262 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3263 TEST(KErrNone == err); |
|
3264 |
|
3265 |
|
3266 RSocket sock; |
|
3267 |
|
3268 err = OpenUdpSocketL(sock, ss); |
|
3269 TESTEL(KErrNone == err, err); |
|
3270 CleanupClosePushL(sock); |
|
3271 |
|
3272 //Get the NotifyCount beforethe RSocket::...() API is called |
|
3273 notifyCount1 = GetNotifyCount(); |
|
3274 |
|
3275 //Set the Test Notifier Response |
|
3276 err = SetNotifierResponse(); |
|
3277 TESTEL(KErrNone == err, err); |
|
3278 |
|
3279 //Call SendTo() and RecvFrom() |
|
3280 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
3281 TESTL(KErrNone == CheckResult(err)); |
|
3282 |
|
3283 //Get the NotifyCount after the RSocket::...() API is called |
|
3284 notifyCount2 = GetNotifyCount(); |
|
3285 |
|
3286 //Check the Prompt Occurred as expected |
|
3287 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3288 TEST(KErrNone == err); |
|
3289 |
|
3290 |
|
3291 RConnection conn2; |
|
3292 |
|
3293 err = OpenConnection(conn2, ss); |
|
3294 TESTEL(KErrNone == err, err); |
|
3295 CleanupClosePushL(conn2); |
|
3296 |
|
3297 //Get the NotifyCount before the RConnection::...() API is called |
|
3298 notifyCount1 = GetNotifyCount(); |
|
3299 |
|
3300 //Set the Test Notifier Response |
|
3301 err = SetNotifierResponse(); |
|
3302 TESTEL(KErrNone == err, err); |
|
3303 |
|
3304 //Call RConnection::Start() |
|
3305 err = StartConnection(conn2); |
|
3306 TESTL(KErrNone == CheckResult(err)); |
|
3307 |
|
3308 //Get the NotifyCount after the RConnection::...() API is called |
|
3309 notifyCount2 = GetNotifyCount(); |
|
3310 |
|
3311 //Check the Prompt Occurred as expected |
|
3312 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3313 TEST(KErrNone == err); |
|
3314 |
|
3315 |
|
3316 RConnection conn3; |
|
3317 |
|
3318 err = OpenConnection(conn3, ss); |
|
3319 TESTEL(KErrNone == err, err); |
|
3320 CleanupClosePushL(conn3); |
|
3321 |
|
3322 //Get the NotifyCount before the RConnection::...() API is called |
|
3323 notifyCount1 = GetNotifyCount(); |
|
3324 |
|
3325 //Set the Test Notifier Response |
|
3326 err = SetNotifierResponse(); |
|
3327 TESTEL(KErrNone == err, err); |
|
3328 |
|
3329 //Call RConnection::Start() |
|
3330 err = StartConnection(conn3); |
|
3331 TESTL(KErrNone == CheckResult(err)); |
|
3332 |
|
3333 //Get the NotifyCount after the RConnection::...() API is called |
|
3334 notifyCount2 = GetNotifyCount(); |
|
3335 |
|
3336 //Check the Prompt Occurred as expected |
|
3337 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3338 TEST(KErrNone == err); |
|
3339 |
|
3340 CloseConnection(conn3); |
|
3341 CleanupStack::Pop(); |
|
3342 |
|
3343 CloseConnection(conn2); |
|
3344 CleanupStack::Pop(); |
|
3345 |
|
3346 DestroyUdpSocket(sock); |
|
3347 CleanupStack::Pop(); |
|
3348 |
|
3349 CloseConnection(conn); |
|
3350 CleanupStack::Pop(); |
|
3351 |
|
3352 CloseSocketServer(ss); |
|
3353 CleanupStack::Pop(); |
|
3354 |
|
3355 return TestStepResult(); |
|
3356 } // TE_RConnectionUPSTest23 |
|
3357 |
|
3358 |
|
3359 |
|
3360 TE_RConnectionUPSTest24::~TE_RConnectionUPSTest24() |
|
3361 { |
|
3362 } |
|
3363 |
|
3364 enum TVerdict TE_RConnectionUPSTest24::doTestStepL(void) |
|
3365 /** |
|
3366 * Test prompting behaviour when calling: |
|
3367 * RConnection::Start() followed by an implicit RSocket::SendTo(), |
|
3368 * followed by RConnection2::Start(). Close all RSockets and RConnections, |
|
3369 * followed by RConnection3::Start(). |
|
3370 */ |
|
3371 { |
|
3372 TInt err; |
|
3373 |
|
3374 //Delete entries in the DecisionDB |
|
3375 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3376 |
|
3377 RSocketServ ss; |
|
3378 RConnection conn; |
|
3379 RConnection conn1; |
|
3380 |
|
3381 err = OpenSocketServer(ss); |
|
3382 TESTEL(KErrNone == err, err); |
|
3383 CleanupClosePushL(ss); |
|
3384 |
|
3385 err = OpenConnection(conn, ss); |
|
3386 TESTEL(KErrNone == err, err); |
|
3387 CleanupClosePushL(conn); |
|
3388 |
|
3389 err = OpenConnection(conn1, ss); |
|
3390 TESTEL(KErrNone == err, err); |
|
3391 CleanupClosePushL(conn1); |
|
3392 |
|
3393 //Get the NotifyCount before the RConnection::...() API is called |
|
3394 TInt notifyCount1 = GetNotifyCount(); |
|
3395 |
|
3396 //Set the Test Notifier Response |
|
3397 err = SetNotifierResponse(); |
|
3398 TESTEL(KErrNone == err, err); |
|
3399 |
|
3400 // Start 2 connections simultaneously - simulate |
|
3401 // starting the connections from 2 different processes simultaneously. |
|
3402 |
|
3403 TRequestStatus status; |
|
3404 TRequestStatus status1; |
|
3405 conn.Start(status); |
|
3406 conn1.Start(status1); |
|
3407 //_PRINTF1(_L("Starting Connection")); |
|
3408 User::WaitForRequest(status); |
|
3409 User::WaitForRequest(status1); |
|
3410 TESTL(KErrNone==CheckResult(status.Int())); |
|
3411 TESTL(KErrNone==CheckResult(status1.Int())); |
|
3412 |
|
3413 CloseConnection(conn1); |
|
3414 CleanupStack::Pop(); |
|
3415 |
|
3416 //Get the NotifyCount after the RConnection::...() API is called |
|
3417 TInt notifyCount2 = GetNotifyCount(); |
|
3418 |
|
3419 //Check the Prompt Occurred as expected |
|
3420 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3421 TEST(KErrNone == err); |
|
3422 |
|
3423 |
|
3424 RSocket sock; |
|
3425 |
|
3426 err = OpenUdpSocketL(sock, ss); |
|
3427 TESTEL(KErrNone == err, err); |
|
3428 CleanupClosePushL(sock); |
|
3429 |
|
3430 //Get the NotifyCount beforethe RSocket::...() API is called |
|
3431 notifyCount1 = GetNotifyCount(); |
|
3432 |
|
3433 //Set the Test Notifier Response |
|
3434 err = SetNotifierResponse(); |
|
3435 TESTEL(KErrNone == err, err); |
|
3436 |
|
3437 //Call SendTo() and RecvFrom() |
|
3438 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
3439 TESTL(KErrNone == CheckResult(err)); |
|
3440 |
|
3441 //Get the NotifyCount after the RSocket::...() API is called |
|
3442 notifyCount2 = GetNotifyCount(); |
|
3443 |
|
3444 //Check the Prompt Occurred as expected |
|
3445 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3446 TEST(KErrNone == err); |
|
3447 |
|
3448 |
|
3449 RConnection conn2; |
|
3450 |
|
3451 err = OpenConnection(conn2, ss); |
|
3452 TESTEL(KErrNone == err, err); |
|
3453 CleanupClosePushL(conn2); |
|
3454 |
|
3455 //Get the NotifyCount before the RConnection::...() API is called |
|
3456 notifyCount1 = GetNotifyCount(); |
|
3457 |
|
3458 //Set the Test Notifier Response |
|
3459 err = SetNotifierResponse(); |
|
3460 TESTEL(KErrNone == err, err); |
|
3461 |
|
3462 //Call RConnection::Start() |
|
3463 err = StartConnection(conn2); |
|
3464 TESTL(KErrNone == CheckResult(err)); |
|
3465 |
|
3466 //Get the NotifyCount after the RConnection::...() API is called |
|
3467 notifyCount2 = GetNotifyCount(); |
|
3468 |
|
3469 //Check the Prompt Occurred as expected |
|
3470 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3471 TEST(KErrNone == err); |
|
3472 |
|
3473 CloseConnection(conn2); |
|
3474 CleanupStack::Pop(); |
|
3475 |
|
3476 DestroyUdpSocket(sock); |
|
3477 CleanupStack::Pop(); |
|
3478 |
|
3479 CloseConnection(conn); |
|
3480 CleanupStack::Pop(); |
|
3481 |
|
3482 RConnection conn3; |
|
3483 |
|
3484 err = OpenConnection(conn3, ss); |
|
3485 TESTEL(KErrNone == err, err); |
|
3486 CleanupClosePushL(conn3); |
|
3487 |
|
3488 //Get the NotifyCount before the RConnection::...() API is called |
|
3489 notifyCount1 = GetNotifyCount(); |
|
3490 |
|
3491 //Set the Test Notifier Response |
|
3492 err = SetNotifierResponse(); |
|
3493 TESTEL(KErrNone == err, err); |
|
3494 |
|
3495 //Call RConnection::Start() |
|
3496 err = StartConnection(conn3); |
|
3497 TESTL(KErrNone == CheckResult(err)); |
|
3498 |
|
3499 //Get the NotifyCount after the RConnection::...() API is called |
|
3500 notifyCount2 = GetNotifyCount(); |
|
3501 |
|
3502 //Check the Prompt Occurred as expected |
|
3503 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3504 TEST(KErrNone == err); |
|
3505 |
|
3506 CloseConnection(conn3); |
|
3507 CleanupStack::Pop(); |
|
3508 |
|
3509 CloseSocketServer(ss); |
|
3510 CleanupStack::Pop(); |
|
3511 |
|
3512 return TestStepResult(); |
|
3513 } // TE_RConnectionUPSTest24 |
|
3514 |
|
3515 |
|
3516 |
|
3517 TE_RConnectionUPSTest25::~TE_RConnectionUPSTest25() |
|
3518 { |
|
3519 } |
|
3520 |
|
3521 enum TVerdict TE_RConnectionUPSTest25::doTestStepL(void) |
|
3522 /** |
|
3523 * Test prompting behaviour when calling: |
|
3524 * RConnection::Start(), followed by RConnection2::Attach() |
|
3525 */ |
|
3526 { |
|
3527 TInt err; |
|
3528 |
|
3529 //Delete entries in the DecisionDB |
|
3530 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3531 |
|
3532 RSocketServ ss; |
|
3533 RConnection conn; |
|
3534 |
|
3535 err = OpenSocketServer(ss); |
|
3536 TESTEL(KErrNone == err, err); |
|
3537 CleanupClosePushL(ss); |
|
3538 |
|
3539 err = OpenConnection(conn, ss); |
|
3540 TESTEL(KErrNone == err, err); |
|
3541 CleanupClosePushL(conn); |
|
3542 |
|
3543 //Get the NotifyCount before the RConnection::...() API is called |
|
3544 TInt notifyCount1 = GetNotifyCount(); |
|
3545 |
|
3546 //Set the Test Notifier Response |
|
3547 err = SetNotifierResponse(); |
|
3548 TESTEL(KErrNone == err, err); |
|
3549 |
|
3550 //Call RConnection::Start() |
|
3551 err = StartConnection(conn); |
|
3552 TESTL(KErrNone == CheckResult(err)); |
|
3553 |
|
3554 //Get the NotifyCount after the RConnection::...() API is called |
|
3555 TInt notifyCount2 = GetNotifyCount(); |
|
3556 |
|
3557 //Check the Prompt Occurred as expected |
|
3558 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3559 TEST(KErrNone == err); |
|
3560 |
|
3561 |
|
3562 RConnection conn2; |
|
3563 |
|
3564 err = OpenConnection(conn2, ss); |
|
3565 TESTEL(KErrNone == err, err); |
|
3566 CleanupClosePushL(conn2); |
|
3567 |
|
3568 TUint numOfConnections; |
|
3569 TPckgBuf<TConnectionInfo> connInfo; |
|
3570 |
|
3571 // need to call Enumerate() before GetConnectionInfo() to set up array used there |
|
3572 err = EnumerateConnections(conn, numOfConnections); |
|
3573 TESTEL(KErrNone == err, err); |
|
3574 TESTEL(1 == numOfConnections, numOfConnections); |
|
3575 |
|
3576 err = conn.GetConnectionInfo(1, connInfo); |
|
3577 TESTEL(KErrNone == err, err); |
|
3578 |
|
3579 //Get the NotifyCount before the RConnection::...() API is called |
|
3580 notifyCount1 = GetNotifyCount(); |
|
3581 |
|
3582 //Set the Test Notifier Response |
|
3583 err = SetNotifierResponse(); |
|
3584 TESTEL(KErrNone == err, err); |
|
3585 |
|
3586 //Call RConnection::Attach() |
|
3587 err = AttachNormal(conn2, connInfo); |
|
3588 TESTL(KErrNone == CheckResult(err)); |
|
3589 |
|
3590 //Get the NotifyCount after the RConnection::...() API is called |
|
3591 notifyCount2 = GetNotifyCount(); |
|
3592 |
|
3593 //Check the Prompt Occurred as expected |
|
3594 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3595 TEST(KErrNone == err); |
|
3596 |
|
3597 CloseConnection(conn2); |
|
3598 CleanupStack::Pop(); |
|
3599 |
|
3600 CloseConnection(conn); |
|
3601 CleanupStack::Pop(); |
|
3602 |
|
3603 CloseSocketServer(ss); |
|
3604 CleanupStack::Pop(); |
|
3605 |
|
3606 return TestStepResult(); |
|
3607 } // TE_RConnectionUPSTest25 |
|
3608 |
|
3609 |
|
3610 |
|
3611 TE_RConnectionUPSTest26::~TE_RConnectionUPSTest26() |
|
3612 { |
|
3613 } |
|
3614 |
|
3615 enum TVerdict TE_RConnectionUPSTest26::doTestStepL(void) |
|
3616 /** |
|
3617 * Test prompting behaviour when calling: |
|
3618 * RConnection::Start(), close RConnection (the interface should still |
|
3619 * stay up) followed by RConnection2::Attach() |
|
3620 * |
|
3621 * This test should behave differently in NetworkLifetime Mode |
|
3622 * when Notifier response is Session based, since decision is no |
|
3623 * longer valid once first RConnection is closed i.e. once all client |
|
3624 * associations with connections cease to exist |
|
3625 */ |
|
3626 { |
|
3627 TInt err; |
|
3628 |
|
3629 //Delete entries in the DecisionDB |
|
3630 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3631 |
|
3632 RSocketServ ss; |
|
3633 RConnection conn; |
|
3634 |
|
3635 err = OpenSocketServer(ss); |
|
3636 TESTEL(KErrNone == err, err); |
|
3637 CleanupClosePushL(ss); |
|
3638 |
|
3639 err = OpenConnection(conn, ss); |
|
3640 TESTEL(KErrNone == err, err); |
|
3641 CleanupClosePushL(conn); |
|
3642 |
|
3643 //Get the NotifyCount before the RConnection::...() API is called |
|
3644 TInt notifyCount1 = GetNotifyCount(); |
|
3645 |
|
3646 //Set the Test Notifier Response |
|
3647 err = SetNotifierResponse(); |
|
3648 TESTEL(KErrNone == err, err); |
|
3649 |
|
3650 //Call RConnection::Start() |
|
3651 err = StartConnection(conn); |
|
3652 TESTL(KErrNone == CheckResult(err)); |
|
3653 |
|
3654 //Get the NotifyCount after the RConnection::...() API is called |
|
3655 TInt notifyCount2 = GetNotifyCount(); |
|
3656 |
|
3657 //Check the Prompt Occurred as expected |
|
3658 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3659 TEST(KErrNone == err); |
|
3660 |
|
3661 CloseConnection(conn); |
|
3662 CleanupStack::Pop(); |
|
3663 |
|
3664 RConnection conn2; |
|
3665 |
|
3666 err = OpenConnection(conn2, ss); |
|
3667 TESTEL(KErrNone == err, err); |
|
3668 CleanupClosePushL(conn2); |
|
3669 |
|
3670 TUint numOfConnections; |
|
3671 TPckgBuf<TConnectionInfo> connInfo; |
|
3672 |
|
3673 // need to call Enumerate() before GetConnectionInfo() to set up array used there |
|
3674 err = EnumerateConnections(conn2, numOfConnections); |
|
3675 TESTEL(KErrNone == err, err); |
|
3676 TESTEL(1 == numOfConnections, numOfConnections); |
|
3677 |
|
3678 err = conn2.GetConnectionInfo(1, connInfo); |
|
3679 TESTEL(KErrNone == err, err); |
|
3680 |
|
3681 //Get the NotifyCount before the RConnection::...() API is called |
|
3682 notifyCount1 = GetNotifyCount(); |
|
3683 |
|
3684 //Set the Test Notifier Response |
|
3685 err = SetNotifierResponse(); |
|
3686 TESTEL(KErrNone == err, err); |
|
3687 |
|
3688 //Call RConnection::Attach() |
|
3689 err = AttachNormal(conn2, connInfo); |
|
3690 TESTL(KErrNone == CheckResult(err)); |
|
3691 |
|
3692 //Get the NotifyCount after the RConnection::...() API is called |
|
3693 notifyCount2 = GetNotifyCount(); |
|
3694 |
|
3695 //Check the Prompt Occurred as expected |
|
3696 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3697 TEST(KErrNone == err); |
|
3698 |
|
3699 CloseConnection(conn2); |
|
3700 CleanupStack::Pop(); |
|
3701 |
|
3702 CloseSocketServer(ss); |
|
3703 CleanupStack::Pop(); |
|
3704 |
|
3705 return TestStepResult(); |
|
3706 |
|
3707 } // TE_RConnectionUPSTest26 |
|
3708 |
|
3709 |
|
3710 |
|
3711 |
|
3712 /************************************* |
|
3713 * * |
|
3714 * Test steps to be run in * |
|
3715 * Multi-Threaded / MultiProcess * |
|
3716 * Manner * |
|
3717 * * |
|
3718 *************************************/ |
|
3719 |
|
3720 enum TVerdict TE_RConnectionUPSPreMulti::doTestStepPreambleL() |
|
3721 /** |
|
3722 * Basic Preamble - Only get the UPS test config data and not the |
|
3723 * additional RConnection test config data |
|
3724 */ |
|
3725 { |
|
3726 TESTL(GetConfigData() == KErrNone); |
|
3727 return TestStepResult(); |
|
3728 } |
|
3729 |
|
3730 TE_RConnectionUPSPreMulti::~TE_RConnectionUPSPreMulti() |
|
3731 { |
|
3732 } |
|
3733 |
|
3734 enum TVerdict TE_RConnectionUPSPreMulti::doTestStepL(void) |
|
3735 /** |
|
3736 * Gets and stores the NotifyCount |
|
3737 * This test step is intended to be the first step to be run |
|
3738 * when performing multi-threaded / multi-process |
|
3739 * tests |
|
3740 */ |
|
3741 { |
|
3742 //Get the NotifyCount before the main test step is run |
|
3743 TInt notifyCount = GetNotifyCount(); |
|
3744 |
|
3745 INFO_PRINTF1(_L(" ")); |
|
3746 INFO_PRINTF2(_L("NotifyCount before executing MultiThreaded test steps = ( %d )"), notifyCount); |
|
3747 INFO_PRINTF1(_L(" ")); |
|
3748 |
|
3749 //Store the NotifyCount |
|
3750 SetStoredNotifyCount(notifyCount); |
|
3751 return EPass; |
|
3752 } |
|
3753 |
|
3754 |
|
3755 enum TVerdict TE_RConnectionUPSPostMulti::doTestStepPreambleL() |
|
3756 /** |
|
3757 * Basic Preamble - Only get the UPS test config data and not the |
|
3758 * additional RConnection test config data |
|
3759 */ |
|
3760 { |
|
3761 TESTL(GetConfigData() == KErrNone); |
|
3762 return TestStepResult(); |
|
3763 } |
|
3764 |
|
3765 TE_RConnectionUPSPostMulti::~TE_RConnectionUPSPostMulti() |
|
3766 { |
|
3767 } |
|
3768 |
|
3769 enum TVerdict TE_RConnectionUPSPostMulti::doTestStepL(void) |
|
3770 /** |
|
3771 * Retieves the stored NotifyCount from before the main test step was run |
|
3772 * and gets the NotifyCount from after the main test step was run and |
|
3773 * tests that the expected number of Prompts occurred |
|
3774 */ |
|
3775 { |
|
3776 |
|
3777 //Get the stored NotifyCount from before the main test step was run |
|
3778 TInt notifyCount1 = GetStoredNotifyCount(); |
|
3779 |
|
3780 //Get the NotifyCount from after the main test step being run |
|
3781 TInt notifyCount2 = GetNotifyCount(); |
|
3782 |
|
3783 INFO_PRINTF1(_L(" ")); |
|
3784 INFO_PRINTF2(_L("NotifyCount after executing MultiThreaded test steps = ( %d )"), notifyCount2); |
|
3785 |
|
3786 TInt err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
3787 TEST(KErrNone == err); |
|
3788 |
|
3789 return TestStepResult(); |
|
3790 } |
|
3791 |
|
3792 |
|
3793 TE_RConnectionUPSTest27a::~TE_RConnectionUPSTest27a() |
|
3794 { |
|
3795 } |
|
3796 |
|
3797 enum TVerdict TE_RConnectionUPSTest27a::doTestStepL(void) |
|
3798 /** |
|
3799 * Performs an Implicit RSocket::Connect() |
|
3800 * This test step is intended to be run in a Multi-Threaded / |
|
3801 * Multi-Process manner. |
|
3802 */ |
|
3803 { |
|
3804 DoTestStartDelay(); |
|
3805 |
|
3806 TInt err; |
|
3807 |
|
3808 //Delete entries in the DecisionDB |
|
3809 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3810 |
|
3811 RSocketServ ss; |
|
3812 RSocket sock; |
|
3813 |
|
3814 err = OpenSocketServer(ss); |
|
3815 TESTEL(KErrNone == err, err); |
|
3816 CleanupClosePushL(ss); |
|
3817 |
|
3818 err = OpenTcpSocket(sock, ss); |
|
3819 TESTEL(KErrNone == err, err); |
|
3820 CleanupClosePushL(sock); |
|
3821 |
|
3822 //Set the Test Notifier Response |
|
3823 err = SetNotifierResponse(); |
|
3824 TESTEL(KErrNone == err, err); |
|
3825 |
|
3826 //Call Connect() |
|
3827 err = ConnectTcpSocket(sock, iEchoServerAddr); |
|
3828 TESTL(KErrNone == CheckResult(err)); |
|
3829 |
|
3830 err = DestroyTcpSocket(sock); |
|
3831 TESTEL((KErrNone == err || KErrPermissionDenied == err), err); |
|
3832 CleanupStack::Pop(); |
|
3833 |
|
3834 CloseSocketServer(ss); |
|
3835 CleanupStack::Pop(); |
|
3836 |
|
3837 return TestStepResult(); |
|
3838 } // TE_RConnectionUPSTest27a |
|
3839 |
|
3840 |
|
3841 |
|
3842 TE_RConnectionUPSTest27b::~TE_RConnectionUPSTest27b() |
|
3843 { |
|
3844 } |
|
3845 |
|
3846 enum TVerdict TE_RConnectionUPSTest27b::doTestStepL(void) |
|
3847 /** |
|
3848 * Performs an Implicit RSocket::SendTo() |
|
3849 * This test step is intended to be run in a Multi-Threaded / |
|
3850 * Multi-Process manner. |
|
3851 */ |
|
3852 { |
|
3853 DoTestStartDelay(); |
|
3854 |
|
3855 TInt err; |
|
3856 |
|
3857 //Delete entries in the DecisionDB |
|
3858 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3859 |
|
3860 RSocketServ ss; |
|
3861 RSocket sock; |
|
3862 |
|
3863 err = OpenSocketServer(ss); |
|
3864 TESTEL(KErrNone == err, err); |
|
3865 CleanupClosePushL(ss); |
|
3866 |
|
3867 err = OpenUdpSocketL(sock, ss); |
|
3868 TESTEL(KErrNone == err, err); |
|
3869 CleanupClosePushL(sock); |
|
3870 |
|
3871 //Set the Test Notifier Response |
|
3872 err = SetNotifierResponse(); |
|
3873 TESTEL(KErrNone == err, err); |
|
3874 |
|
3875 //Call SendTo() and RecvFrom() |
|
3876 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
3877 TESTL(KErrNone == CheckResult(err)); |
|
3878 |
|
3879 DestroyUdpSocket(sock); |
|
3880 CleanupStack::Pop(); |
|
3881 |
|
3882 CloseSocketServer(ss); |
|
3883 CleanupStack::Pop(); |
|
3884 |
|
3885 return TestStepResult(); |
|
3886 } // TE_RConnectionUPSTest27b |
|
3887 |
|
3888 |
|
3889 |
|
3890 TE_RConnectionUPSTest27c::~TE_RConnectionUPSTest27c() |
|
3891 { |
|
3892 } |
|
3893 |
|
3894 enum TVerdict TE_RConnectionUPSTest27c::doTestStepL(void) |
|
3895 /** |
|
3896 * Performs an Implicit RHostResolver::GetByName() |
|
3897 * This test step is intended to be run in a Multi-Threaded / |
|
3898 * Multi-Process manner. |
|
3899 */ |
|
3900 { |
|
3901 DoTestStartDelay(); |
|
3902 |
|
3903 TInt err; |
|
3904 |
|
3905 //Delete entries in the DecisionDB |
|
3906 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3907 |
|
3908 RSocketServ ss; |
|
3909 RHostResolver hr; |
|
3910 |
|
3911 err = OpenSocketServer(ss); |
|
3912 TESTEL(KErrNone == err, err); |
|
3913 CleanupClosePushL(ss); |
|
3914 |
|
3915 err = OpenHostResolver(hr, ss); |
|
3916 TESTEL(KErrNone == err, err); |
|
3917 CleanupClosePushL(hr); |
|
3918 |
|
3919 //Set the Test Notifier Response |
|
3920 err = SetNotifierResponse(); |
|
3921 TESTEL(KErrNone == err, err); |
|
3922 |
|
3923 //Call GetByName() |
|
3924 err = MakeSynchronousNameRequest(hr, iTestName); |
|
3925 TESTL(KErrNone == CheckResult(err)); |
|
3926 |
|
3927 DestroyHostResolver(hr); |
|
3928 CleanupStack::Pop(); |
|
3929 |
|
3930 CloseSocketServer(ss); |
|
3931 CleanupStack::Pop(); |
|
3932 |
|
3933 return TestStepResult(); |
|
3934 } // TE_RConnectionUPSTest27c |
|
3935 |
|
3936 |
|
3937 |
|
3938 TE_RConnectionUPSTest27d::~TE_RConnectionUPSTest27d() |
|
3939 { |
|
3940 } |
|
3941 |
|
3942 enum TVerdict TE_RConnectionUPSTest27d::doTestStepL(void) |
|
3943 /** |
|
3944 * Performs an Implicit RHostResolver::GetByAddress() |
|
3945 * This test step is intended to be run in a Multi-Threaded / |
|
3946 * Multi-Process manner. |
|
3947 */ |
|
3948 { |
|
3949 DoTestStartDelay(); |
|
3950 |
|
3951 TInt err; |
|
3952 |
|
3953 //Delete entries in the DecisionDB |
|
3954 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
3955 |
|
3956 RSocketServ ss; |
|
3957 RHostResolver hr; |
|
3958 |
|
3959 err = OpenSocketServer(ss); |
|
3960 TESTEL(KErrNone == err, err); |
|
3961 CleanupClosePushL(ss); |
|
3962 |
|
3963 err = OpenHostResolver(hr, ss); |
|
3964 TESTEL(KErrNone == err, err); |
|
3965 CleanupClosePushL(hr); |
|
3966 |
|
3967 //Set the Test Notifier Response |
|
3968 err = SetNotifierResponse(); |
|
3969 TESTEL(KErrNone == err, err); |
|
3970 |
|
3971 //Call GetByAddress() |
|
3972 err = MakeSynchronousAddressRequest(hr, iLookupAddress); |
|
3973 TESTL(KErrNone == CheckResult(err)); |
|
3974 |
|
3975 DestroyHostResolver(hr); |
|
3976 CleanupStack::Pop(); |
|
3977 |
|
3978 CloseSocketServer(ss); |
|
3979 CleanupStack::Pop(); |
|
3980 |
|
3981 return TestStepResult(); |
|
3982 |
|
3983 } // TE_RConnectionUPSTest27d |
|
3984 |
|
3985 |
|
3986 |
|
3987 TE_RConnectionUPSTest28::~TE_RConnectionUPSTest28() |
|
3988 { |
|
3989 } |
|
3990 |
|
3991 enum TVerdict TE_RConnectionUPSTest28::doTestStepL(void) |
|
3992 /** |
|
3993 * Performs an RConnection::Start() |
|
3994 * This test step is intended to be run in a Multi-Threaded / |
|
3995 * Multi-Process manner. |
|
3996 */ |
|
3997 { |
|
3998 DoTestStartDelay(); |
|
3999 |
|
4000 TInt err; |
|
4001 |
|
4002 //Delete entries in the DecisionDB |
|
4003 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4004 |
|
4005 RSocketServ ss; |
|
4006 RConnection conn; |
|
4007 |
|
4008 err = OpenSocketServer(ss); |
|
4009 TESTEL(KErrNone == err, err); |
|
4010 CleanupClosePushL(ss); |
|
4011 |
|
4012 err = OpenConnection(conn, ss); |
|
4013 TESTEL(KErrNone == err, err); |
|
4014 CleanupClosePushL(conn); |
|
4015 |
|
4016 //Set the Test Notifier Response |
|
4017 err = SetNotifierResponse(); |
|
4018 TESTEL(KErrNone == err, err); |
|
4019 |
|
4020 //Call RConnection::Start(); |
|
4021 err = StartConnection(conn); |
|
4022 TESTL(KErrNone == CheckResult(err)); |
|
4023 |
|
4024 CloseConnection(conn); |
|
4025 CleanupStack::Pop(); |
|
4026 |
|
4027 CloseSocketServer(ss); |
|
4028 CleanupStack::Pop(); |
|
4029 |
|
4030 return TestStepResult(); |
|
4031 |
|
4032 } // TE_RConnectionUPSTest28 |
|
4033 |
|
4034 |
|
4035 TE_RConnectionUPSTest29::~TE_RConnectionUPSTest29() |
|
4036 { |
|
4037 } |
|
4038 |
|
4039 enum TVerdict TE_RConnectionUPSTest29::doTestStepL(void) |
|
4040 /** |
|
4041 * Test prompting behaviour when calling: |
|
4042 * Implicit RSocket::SendTo() specifying a local loopback |
|
4043 * address - 127.0.0.1 |
|
4044 * |
|
4045 * SendTo() to a local address should never result in prompting |
|
4046 */ |
|
4047 { |
|
4048 TInt err; |
|
4049 |
|
4050 //Delete entries in the DecisionDB |
|
4051 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4052 |
|
4053 RSocketServ ss; |
|
4054 RSocket sock; |
|
4055 |
|
4056 err = OpenSocketServer(ss); |
|
4057 TESTEL(KErrNone == err, err); |
|
4058 CleanupClosePushL(ss); |
|
4059 |
|
4060 err = OpenUdpSocketL(sock, ss); |
|
4061 TESTEL(KErrNone == err, err); |
|
4062 CleanupClosePushL(sock); |
|
4063 |
|
4064 //Get the NotifyCount beforethe RSocket::...() API is called |
|
4065 TInt notifyCount1 = GetNotifyCount(); |
|
4066 |
|
4067 //Set the Test Notifier Response |
|
4068 err = SetNotifierResponse(); |
|
4069 TESTEL(KErrNone == err, err); |
|
4070 |
|
4071 TInetAddr sendAddr(KInetAddrLoop, iEchoPortNum); |
|
4072 |
|
4073 //Call SendTo() and RecvFrom() |
|
4074 err = TestUdpDataPathL(sock, sendAddr); |
|
4075 TESTL(KErrNone == CheckResult(err)); |
|
4076 |
|
4077 //Get the NotifyCount after the RSocket::...() API is called |
|
4078 TInt notifyCount2 = GetNotifyCount(); |
|
4079 |
|
4080 //Check the Prompt Occurred as expected |
|
4081 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4082 TEST(KErrNone == err); |
|
4083 |
|
4084 DestroyUdpSocket(sock); |
|
4085 CleanupStack::Pop(); |
|
4086 |
|
4087 CloseSocketServer(ss); |
|
4088 CleanupStack::Pop(); |
|
4089 |
|
4090 return TestStepResult(); |
|
4091 } // TE_RConnectionUPSTest29 |
|
4092 |
|
4093 |
|
4094 |
|
4095 TE_RConnectionUPSTest30::~TE_RConnectionUPSTest30() |
|
4096 { |
|
4097 } |
|
4098 |
|
4099 enum TVerdict TE_RConnectionUPSTest30::doTestStepL(void) |
|
4100 /** |
|
4101 * Test prompting behaviour when calling: |
|
4102 * Implicit RSocket::SendTo() specifying a local loopback |
|
4103 * address - ::1 |
|
4104 * |
|
4105 * SendTo() to a local address should never result in prompting |
|
4106 */ |
|
4107 { |
|
4108 TInt err; |
|
4109 |
|
4110 //Delete entries in the DecisionDB |
|
4111 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4112 |
|
4113 RSocketServ ss; |
|
4114 RSocket sock; |
|
4115 |
|
4116 err = OpenSocketServer(ss); |
|
4117 TESTEL(KErrNone == err, err); |
|
4118 CleanupClosePushL(ss); |
|
4119 |
|
4120 err = OpenUdpSocketL(sock, ss); |
|
4121 TESTEL(KErrNone == err, err); |
|
4122 CleanupClosePushL(sock); |
|
4123 |
|
4124 //Get the NotifyCount beforethe RSocket::...() API is called |
|
4125 TInt notifyCount1 = GetNotifyCount(); |
|
4126 |
|
4127 //Set the Test Notifier Response |
|
4128 err = SetNotifierResponse(); |
|
4129 TESTEL(KErrNone == err, err); |
|
4130 |
|
4131 TInetAddr sendAddr(KInet6AddrLoop, iEchoPortNum); |
|
4132 |
|
4133 //Call SendTo() and RecvFrom() |
|
4134 err = TestUdpDataPathL(sock, sendAddr); |
|
4135 TESTL(KErrNone == CheckResult(err)); |
|
4136 |
|
4137 //Get the NotifyCount after the RSocket::...() API is called |
|
4138 TInt notifyCount2 = GetNotifyCount(); |
|
4139 |
|
4140 //Check the Prompt Occurred as expected |
|
4141 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4142 TEST(KErrNone == err); |
|
4143 |
|
4144 DestroyUdpSocket(sock); |
|
4145 CleanupStack::Pop(); |
|
4146 |
|
4147 CloseSocketServer(ss); |
|
4148 CleanupStack::Pop(); |
|
4149 |
|
4150 return TestStepResult(); |
|
4151 } // TE_RConnectionUPSTest30 |
|
4152 |
|
4153 |
|
4154 |
|
4155 TE_RConnectionUPSTest31::~TE_RConnectionUPSTest31() |
|
4156 { |
|
4157 } |
|
4158 |
|
4159 enum TVerdict TE_RConnectionUPSTest31::doTestStepL(void) |
|
4160 /** |
|
4161 * Test prompting behaviour when calling: |
|
4162 * Implicit RSocket::SendTo() specifying a local address of interface |
|
4163 * |
|
4164 * SendTo() to a local address should never result in prompting |
|
4165 */ |
|
4166 { |
|
4167 TInt err; |
|
4168 |
|
4169 //Delete entries in the DecisionDB |
|
4170 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4171 |
|
4172 RSocketServ ss; |
|
4173 RConnection conn; |
|
4174 |
|
4175 err = OpenSocketServer(ss); |
|
4176 TESTEL(KErrNone == err, err); |
|
4177 CleanupClosePushL(ss); |
|
4178 |
|
4179 err = OpenConnection(conn, ss); |
|
4180 TESTEL(KErrNone == err, err); |
|
4181 CleanupClosePushL(conn); |
|
4182 |
|
4183 //Get the NotifyCount before the RConnection::...() API is called |
|
4184 TInt notifyCount1 = GetNotifyCount(); |
|
4185 |
|
4186 //Set the Test Notifier Response |
|
4187 err = SetNotifierResponse(); |
|
4188 TESTEL(KErrNone == err, err); |
|
4189 |
|
4190 //Call RConnection::Start(); |
|
4191 err = StartConnection(conn); |
|
4192 TESTL(KErrNone == CheckResult(err)); |
|
4193 |
|
4194 //Get the NotifyCount after the RConnection::...() API is called |
|
4195 TInt notifyCount2 = GetNotifyCount(); |
|
4196 |
|
4197 //Check the Prompt Occurred as expected |
|
4198 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4199 TEST(KErrNone == err); |
|
4200 |
|
4201 CloseConnection(conn); |
|
4202 CleanupStack::Pop(); |
|
4203 |
|
4204 |
|
4205 RSocket sock; |
|
4206 |
|
4207 err = OpenUdpSocketL(sock, ss); |
|
4208 TESTEL(KErrNone == err, err); |
|
4209 CleanupClosePushL(sock); |
|
4210 |
|
4211 //Get the NotifyCount beforethe RSocket::...() API is called |
|
4212 notifyCount1 = GetNotifyCount(); |
|
4213 |
|
4214 //Set the Test Notifier Response |
|
4215 err = SetNotifierResponse(); |
|
4216 TESTEL(KErrNone == err, err); |
|
4217 |
|
4218 _LIT(KInterfaceName,"dummy"); |
|
4219 |
|
4220 //get local interface address |
|
4221 TUint32 localAddr = GetInterfaceAddress(sock, KInterfaceName()); |
|
4222 TInetAddr sendAddr(localAddr, iEchoPortNum); |
|
4223 |
|
4224 //Implicit SendTo()/RecvFrom() local loopback address |
|
4225 err = TestUdpDataPathL(sock, sendAddr); |
|
4226 TESTL(KErrNone == CheckResult(err)); |
|
4227 |
|
4228 //Get the NotifyCount after the RSocket::...() API is called |
|
4229 notifyCount2 = GetNotifyCount(); |
|
4230 |
|
4231 //Check the Prompt Occurred as expected |
|
4232 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4233 TEST(KErrNone == err); |
|
4234 |
|
4235 DestroyUdpSocket(sock); |
|
4236 CleanupStack::Pop(); |
|
4237 |
|
4238 CloseSocketServer(ss); |
|
4239 CleanupStack::Pop(); |
|
4240 |
|
4241 return TestStepResult(); |
|
4242 } // TE_RConnectionUPSTest31 |
|
4243 |
|
4244 |
|
4245 |
|
4246 TE_RConnectionUPSTest32::~TE_RConnectionUPSTest32() |
|
4247 { |
|
4248 } |
|
4249 |
|
4250 enum TVerdict TE_RConnectionUPSTest32::doTestStepL(void) |
|
4251 /** |
|
4252 * Test prompting behaviour when calling: |
|
4253 * Explicit RSocket::SendTo() specifying a local address of interface |
|
4254 */ |
|
4255 { |
|
4256 TInt err; |
|
4257 |
|
4258 //Delete entries in the DecisionDB |
|
4259 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4260 |
|
4261 RSocketServ ss; |
|
4262 RConnection conn; |
|
4263 |
|
4264 err = OpenSocketServer(ss); |
|
4265 TESTEL(KErrNone == err, err); |
|
4266 CleanupClosePushL(ss); |
|
4267 |
|
4268 err = OpenConnection(conn, ss); |
|
4269 TESTEL(KErrNone == err, err); |
|
4270 CleanupClosePushL(conn); |
|
4271 |
|
4272 //Get the NotifyCount before the RConnection::...() API is called |
|
4273 TInt notifyCount1 = GetNotifyCount(); |
|
4274 |
|
4275 //Set the Test Notifier Response |
|
4276 err = SetNotifierResponse(); |
|
4277 TESTEL(KErrNone == err, err); |
|
4278 |
|
4279 //Call RConnection::Start(); |
|
4280 err = StartConnection(conn); |
|
4281 TESTL(KErrNone == CheckResult(err)); |
|
4282 |
|
4283 //Get the NotifyCount after the RSocket::...() API is called |
|
4284 TInt notifyCount2 = GetNotifyCount(); |
|
4285 |
|
4286 //Check the Prompt Occurred as expected |
|
4287 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4288 TEST(KErrNone == err); |
|
4289 |
|
4290 |
|
4291 RSocket sock; |
|
4292 |
|
4293 err = OpenUdpSocketExplicitL(sock, ss, conn); |
|
4294 TESTEL(KErrNone == err, err); |
|
4295 CleanupClosePushL(sock); |
|
4296 |
|
4297 //Get the NotifyCount before the RSocket::...() API is called |
|
4298 notifyCount1 = GetNotifyCount(); |
|
4299 |
|
4300 //Set the Test Notifier Response |
|
4301 err = SetNotifierResponse(); |
|
4302 TESTEL(KErrNone == err, err); |
|
4303 |
|
4304 _LIT(KInterfaceName,"dummy"); |
|
4305 |
|
4306 //get local interface address |
|
4307 TUint32 localAddr = GetInterfaceAddress(sock, KInterfaceName()); |
|
4308 TInetAddr sendAddr(localAddr, iEchoPortNum); |
|
4309 |
|
4310 //Explicit SendTo()/RecvFrom() local loopback address |
|
4311 err = TestUdpDataPathL(sock, sendAddr); |
|
4312 TESTL(KErrNone == CheckResult(err)); |
|
4313 |
|
4314 //Get the NotifyCount after the RSocket::...() API is called |
|
4315 notifyCount2 = GetNotifyCount(); |
|
4316 |
|
4317 //Check the Prompt Occurred as expected |
|
4318 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4319 TEST(KErrNone == err); |
|
4320 |
|
4321 DestroyUdpSocket(sock); |
|
4322 CleanupStack::Pop(); |
|
4323 |
|
4324 CloseConnection(conn); |
|
4325 CleanupStack::Pop(); |
|
4326 |
|
4327 CloseSocketServer(ss); |
|
4328 CleanupStack::Pop(); |
|
4329 |
|
4330 return TestStepResult(); |
|
4331 } // TE_RConnectionUPSTest32 |
|
4332 |
|
4333 |
|
4334 |
|
4335 TE_RConnectionUPSTest33::~TE_RConnectionUPSTest33() |
|
4336 { |
|
4337 } |
|
4338 |
|
4339 enum TVerdict TE_RConnectionUPSTest33::doTestStepL(void) |
|
4340 /** |
|
4341 * Test prompting behaviour when calling: |
|
4342 * Implicit RSocket::SendTo() specifying an address |
|
4343 * that is scoped to the NetworkId of the interface |
|
4344 */ |
|
4345 { |
|
4346 TInt err; |
|
4347 |
|
4348 //Delete entries in the DecisionDB |
|
4349 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4350 |
|
4351 RSocketServ ss; |
|
4352 RSocket sock; |
|
4353 |
|
4354 err = OpenSocketServer(ss); |
|
4355 TESTEL(KErrNone == err, err); |
|
4356 CleanupClosePushL(ss); |
|
4357 |
|
4358 err = OpenUdpSocketL(sock, ss); |
|
4359 TESTEL(KErrNone == err, err); |
|
4360 CleanupClosePushL(sock); |
|
4361 |
|
4362 //Get the NotifyCount beforethe RSocket::...() API is called |
|
4363 TInt notifyCount1 = GetNotifyCount(); |
|
4364 |
|
4365 //Set the Test Notifier Response |
|
4366 err = SetNotifierResponse(); |
|
4367 TESTEL(KErrNone == err, err); |
|
4368 |
|
4369 //Explicitly set the NetworkID of the interface - Scoped Address |
|
4370 iDummyNifSendAddr.SetScope(KDummyNifNetworkId); |
|
4371 |
|
4372 //Call SendTo() and RecvFrom() |
|
4373 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
4374 TESTL(KErrNone == CheckResult(err)); |
|
4375 |
|
4376 //Get the NotifyCount after the RSocket::...() API is called |
|
4377 TInt notifyCount2 = GetNotifyCount(); |
|
4378 |
|
4379 //Check the Prompt Occurred as expected |
|
4380 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4381 TEST(KErrNone == err); |
|
4382 |
|
4383 DestroyUdpSocket(sock); |
|
4384 CleanupStack::Pop(); |
|
4385 |
|
4386 CloseSocketServer(ss); |
|
4387 CleanupStack::Pop(); |
|
4388 |
|
4389 return TestStepResult(); |
|
4390 } // TE_RConnectionUPSTest33 |
|
4391 |
|
4392 |
|
4393 TE_RConnectionUPSTest34::~TE_RConnectionUPSTest34() |
|
4394 { |
|
4395 } |
|
4396 |
|
4397 enum TVerdict TE_RConnectionUPSTest34::doTestStepL(void) |
|
4398 /** |
|
4399 * Test prompting behaviour when calling: |
|
4400 * Explicit RSocket::SendTo() specifying an address |
|
4401 * that is scoped to the NetworkId of the interface |
|
4402 */ |
|
4403 { |
|
4404 TInt err; |
|
4405 |
|
4406 //Delete entries in the DecisionDB |
|
4407 TESTL(KErrNone == CheckAndDeleteUpsDB()); |
|
4408 |
|
4409 RSocketServ ss; |
|
4410 RConnection conn; |
|
4411 |
|
4412 err = OpenSocketServer(ss); |
|
4413 TESTEL(KErrNone == err, err); |
|
4414 CleanupClosePushL(ss); |
|
4415 |
|
4416 err = OpenConnection(conn, ss); |
|
4417 TESTEL(KErrNone == err, err); |
|
4418 CleanupClosePushL(conn); |
|
4419 |
|
4420 //Get the NotifyCount before the RConnection::...() API is called |
|
4421 TInt notifyCount1 = GetNotifyCount(); |
|
4422 |
|
4423 //Set the Test Notifier Response |
|
4424 err = SetNotifierResponse(); |
|
4425 TESTEL(KErrNone == err, err); |
|
4426 |
|
4427 //Call RConnection::Start(); |
|
4428 err = StartConnection(conn); |
|
4429 TESTL(KErrNone == CheckResult(err)); |
|
4430 |
|
4431 //Get the NotifyCount after the RSocket::...() API is called |
|
4432 TInt notifyCount2 = GetNotifyCount(); |
|
4433 |
|
4434 //Check the Prompt Occurred as expected |
|
4435 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4436 TEST(KErrNone == err); |
|
4437 |
|
4438 |
|
4439 RSocket sock; |
|
4440 |
|
4441 err = OpenUdpSocketExplicitL(sock, ss, conn); |
|
4442 TESTEL(KErrNone == err, err); |
|
4443 CleanupClosePushL(sock); |
|
4444 |
|
4445 //Get the NotifyCount before the RSocket::...() API is called |
|
4446 notifyCount1 = GetNotifyCount(); |
|
4447 |
|
4448 //Set the Test Notifier Response |
|
4449 err = SetNotifierResponse(); |
|
4450 TESTEL(KErrNone == err, err); |
|
4451 |
|
4452 //Explicitly set the NetworkID of the interface - Scoped Address |
|
4453 iDummyNifSendAddr.SetScope(KDummyNifNetworkId); |
|
4454 |
|
4455 err = TestUdpDataPathL(sock, iDummyNifSendAddr); |
|
4456 TESTL(KErrNone == CheckResult(err)); |
|
4457 |
|
4458 //Get the NotifyCount after the RSocket::...() API is called |
|
4459 notifyCount2 = GetNotifyCount(); |
|
4460 |
|
4461 //Check the Prompt Occurred as expected |
|
4462 err = CheckNotifyCount(notifyCount1, notifyCount2); |
|
4463 TEST(KErrNone == err); |
|
4464 |
|
4465 DestroyUdpSocket(sock); |
|
4466 CleanupStack::Pop(); |
|
4467 |
|
4468 CloseConnection(conn); |
|
4469 CleanupStack::Pop(); |
|
4470 |
|
4471 CloseSocketServer(ss); |
|
4472 CleanupStack::Pop(); |
|
4473 |
|
4474 return TestStepResult(); |
|
4475 } // TE_RConnectionUPSTest34 |
|
4476 |
|
4477 TE_RConnectionUPSTest35::~TE_RConnectionUPSTest35() |
|
4478 { |
|
4479 } |
|
4480 |
|
4481 enum TVerdict TE_RConnectionUPSTest35::doTestStepL(void) |
|
4482 /** |
|
4483 */ |
|
4484 { |
|
4485 TInt err; |
|
4486 |
|
4487 RSocketServ ss; |
|
4488 RConnection conn; |
|
4489 |
|
4490 err = OpenSocketServer(ss); |
|
4491 TESTEL(KErrNone == err, err); |
|
4492 CleanupClosePushL(ss); |
|
4493 |
|
4494 RSocket sock; |
|
4495 err = sock.Open(ss, KDummyAddrFamily, KSockDatagram, KDummyOne); |
|
4496 INFO_PRINTF2(_L("Dummy socket open returned %d"), err); |
|
4497 User::LeaveIfError(err); |
|
4498 CleanupClosePushL(sock); |
|
4499 |
|
4500 err = sock.SetOpt(KDummyOptionIssueNoBearer, 0, 0); |
|
4501 INFO_PRINTF2(_L("SetOpt(KDummyOptionIssueNoBearer) returned %d"), err); |
|
4502 User::LeaveIfError(err); |
|
4503 |
|
4504 // Wait for the NoBearer() to take effect. Actually, we are just waiting to see if ESock Server |
|
4505 // crashes before attempting to open a second socket to check. |
|
4506 const TInt KMicrosecondsPerSecond = 1000000; |
|
4507 User::After(1 * KMicrosecondsPerSecond); |
|
4508 |
|
4509 RSocket sock2; |
|
4510 err = sock2.Open(ss, KDummyAddrFamily, KSockDatagram, KDummyOne); |
|
4511 if (err != KErrNone) |
|
4512 { |
|
4513 INFO_PRINTF2(_L("Error %d opening second dummy socket"), err); |
|
4514 } |
|
4515 User::LeaveIfError(err); |
|
4516 sock2.Close(); |
|
4517 |
|
4518 INFO_PRINTF1(_L("Dummy socket close")); |
|
4519 |
|
4520 CleanupStack::PopAndDestroy(); // sock |
|
4521 |
|
4522 CloseSocketServer(ss); |
|
4523 CleanupStack::Pop(); // ss |
|
4524 |
|
4525 return TestStepResult(); |
|
4526 } // TE_RConnectionUPSTest35 |
|
4527 |
|
4528 |