|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 #include "TE_RConnectionCompleteAPICoverage.h" |
|
18 #include <ss_std.h> |
|
19 #include <comms-infras/nifprvar.h> |
|
20 #include <nifman.h> |
|
21 #include <inet6err.h> |
|
22 |
|
23 /** Test 700 |
|
24 * |
|
25 */ |
|
26 |
|
27 /** |
|
28 @SYMTestCaseID TE_RConnection-700 |
|
29 @SYMTestCaseDesc Test Stop(TSubConnection& aSubConnectionUniqueId) for expected functionality |
|
30 */ |
|
31 enum TVerdict TE_RConnectionTest700::doTestStepL(void) |
|
32 { |
|
33 TInt err; |
|
34 |
|
35 RSocketServ ss; |
|
36 err = OpenSocketServer(ss); |
|
37 TESTEL(KErrNone == err, err); |
|
38 CleanupClosePushL(ss); |
|
39 |
|
40 //********** connection creation *********** |
|
41 |
|
42 RConnection conn; |
|
43 err = OpenConnection(conn, ss); |
|
44 TESTEL(KErrNone == err, err); |
|
45 CleanupClosePushL(conn); |
|
46 |
|
47 // start the dummynif (any interface using the compatibility layer will do) |
|
48 err = StartConnectionWithOverrides(conn, iDummyNifIap); |
|
49 TESTEL(KErrNone == err, err); |
|
50 |
|
51 |
|
52 TUint subconnectionCount; |
|
53 err = conn.EnumerateSubConnections(subconnectionCount); |
|
54 TESTEL(KErrNone == err, err); |
|
55 // there should only be two subconnection (representing the whole connection and representing the default subconnection) |
|
56 TESTEL(2 == subconnectionCount, subconnectionCount); |
|
57 |
|
58 // ensure that it *is* representing the complete connection |
|
59 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
60 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
61 TESTEL(KErrNone == err, err); |
|
62 TSubConnectionUniqueId uniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
63 TESTEL(uniqueId!= KNifEntireConnectionSubConnectionId, uniqueId); |
|
64 |
|
65 // do a normal stop - should fail |
|
66 // identical to: |
|
67 // err = conn.Stop(uniqueId, RConnection::EStopNormal); |
|
68 err = conn.Stop(uniqueId); |
|
69 // doesn't fail because CNifAgentRef throws away the fact that the compatibility layer doesn't support this |
|
70 TESTEL(KErrNone == err, err); |
|
71 |
|
72 //********** clean up *********** |
|
73 err = conn.Stop(); |
|
74 TESTEL(KErrNone == err, err); |
|
75 |
|
76 CloseConnection(conn); |
|
77 CleanupStack::Pop(&conn); |
|
78 |
|
79 CloseSocketServer(ss); |
|
80 CleanupStack::Pop(&ss); |
|
81 |
|
82 return TestStepResult(); |
|
83 } |
|
84 |
|
85 /** Test 701 |
|
86 * |
|
87 */ |
|
88 |
|
89 /** |
|
90 @SYMTestCaseID TE_RConnection-701 |
|
91 @SYMTestCaseDesc Test Stop(TSubConnection& aSubConnectionUniqueId) with invalid subconnection ID |
|
92 */ |
|
93 enum TVerdict TE_RConnectionTest701::doTestStepL(void) |
|
94 { |
|
95 TInt err; |
|
96 |
|
97 RSocketServ ss; |
|
98 err = OpenSocketServer(ss); |
|
99 TESTEL(KErrNone == err, err); |
|
100 CleanupClosePushL(ss); |
|
101 |
|
102 //********** connection creation *********** |
|
103 |
|
104 RConnection conn; |
|
105 err = OpenConnection(conn, ss); |
|
106 TESTEL(KErrNone == err, err); |
|
107 CleanupClosePushL(conn); |
|
108 |
|
109 // start the dummynif (any interface using the compatibility layer will do) |
|
110 err = StartConnectionWithOverrides(conn, iDummyNifIap); |
|
111 TESTEL(KErrNone == err, err); |
|
112 |
|
113 //********** find out about the subconnection and try to stop it *********** |
|
114 |
|
115 |
|
116 TUint subconnectionCount; |
|
117 err = conn.EnumerateSubConnections(subconnectionCount); |
|
118 TESTEL(KErrNone == err, err); |
|
119 // there should only be two subconnection (representing the whole connection and representing the default subconnection) |
|
120 TESTEL(2 == subconnectionCount, subconnectionCount); |
|
121 |
|
122 // ensure that it *is* representing the complete connection |
|
123 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
124 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
125 TESTEL(KErrNone == err, err); |
|
126 TSubConnectionUniqueId uniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
127 TESTEL(uniqueId!= KNifEntireConnectionSubConnectionId, uniqueId); |
|
128 |
|
129 // do a normal stop - should fail as subconnection Id + MaxNumberConnections doesn't exist |
|
130 err = conn.Stop(uniqueId + MaxConnectionsNumber); |
|
131 |
|
132 // make sure an err is reported |
|
133 TESTEL(KErrNotReady == err, err); |
|
134 |
|
135 //********** clean up *********** |
|
136 err = conn.Stop(); |
|
137 TESTEL(KErrNone == err, err); |
|
138 |
|
139 CloseConnection(conn); |
|
140 CleanupStack::Pop(&conn); |
|
141 |
|
142 CloseSocketServer(ss); |
|
143 CleanupStack::Pop(&ss); |
|
144 |
|
145 return TestStepResult(); |
|
146 } |
|
147 |
|
148 /** Test 702 |
|
149 * |
|
150 */ |
|
151 |
|
152 /** |
|
153 @SYMTestCaseID TE_RConnection-702 |
|
154 @SYMTestCaseDesc Stop a subconnection when the whole connection has already been stopped |
|
155 */ |
|
156 enum TVerdict TE_RConnectionTest702::doTestStepL(void) |
|
157 { |
|
158 TInt err; |
|
159 |
|
160 RSocketServ ss; |
|
161 err = OpenSocketServer(ss); |
|
162 TESTEL(KErrNone == err, err); |
|
163 CleanupClosePushL(ss); |
|
164 |
|
165 //********** connection creation *********** |
|
166 |
|
167 RConnection conn; |
|
168 err = OpenConnection(conn, ss); |
|
169 TESTEL(KErrNone == err, err); |
|
170 CleanupClosePushL(conn); |
|
171 |
|
172 // start the dummynif (any interface using the compatibility layer will do) |
|
173 err = StartConnectionWithOverrides(conn, iDummyNifIap); |
|
174 TESTEL(KErrNone == err, err); |
|
175 |
|
176 TUint subconnectionCount; |
|
177 err = conn.EnumerateSubConnections(subconnectionCount); |
|
178 TESTEL(KErrNone == err, err); |
|
179 // there should only be two subconnection (representing the whole connection and representing the default subconnection) |
|
180 TESTEL(2 == subconnectionCount, subconnectionCount); |
|
181 // ensure that it *is* representing the complete connection |
|
182 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
183 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
184 TESTEL(KErrNone == err, err); |
|
185 TSubConnectionUniqueId uniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
186 TESTEL(uniqueId!= KNifEntireConnectionSubConnectionId, uniqueId); |
|
187 |
|
188 //********** clean up *********** |
|
189 err = conn.Stop(); |
|
190 TESTEL(KErrNone == err, err); |
|
191 |
|
192 // do a normal stop - should fail as whole connection has been stopped already |
|
193 // and so subconnection doesn't exist anymore |
|
194 err = conn.Stop(uniqueId); |
|
195 |
|
196 // make sure an err is reported |
|
197 TESTEL(KErrNotReady == err, err); |
|
198 |
|
199 CloseConnection(conn); |
|
200 CleanupStack::Pop(&conn); |
|
201 |
|
202 CloseSocketServer(ss); |
|
203 CleanupStack::Pop(&ss); |
|
204 |
|
205 return TestStepResult(); |
|
206 } |
|
207 |
|
208 /** Test 703 |
|
209 * |
|
210 */ |
|
211 |
|
212 |
|
213 /** |
|
214 @SYMTestCaseID TE_RConnection-703 |
|
215 @SYMTestCaseDesc Test Progess() call on subconnections, should return KErrNone |
|
216 but actually do nothing on the server side as this call isn't supported |
|
217 as this is no longer supported |
|
218 */ |
|
219 enum TVerdict TE_RConnectionTest703::doTestStepL() |
|
220 { |
|
221 TInt err; |
|
222 RSocketServ ss; |
|
223 RConnection conn; |
|
224 |
|
225 err = OpenSocketServer(ss); |
|
226 TESTEL(KErrNone == err, err); |
|
227 CleanupClosePushL(ss); |
|
228 |
|
229 //********** connection creation *********** |
|
230 |
|
231 err = OpenConnection(conn, ss); |
|
232 TESTEL(KErrNone == err, err); |
|
233 CleanupClosePushL(conn); |
|
234 |
|
235 // start the test nif |
|
236 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
237 TESTEL(KErrNone == err, err); |
|
238 |
|
239 // should have a single interface |
|
240 TUint connectionCount; |
|
241 err = conn.EnumerateConnections(connectionCount); |
|
242 TESTEL(KErrNone == err, err); |
|
243 TESTEL(1 == connectionCount, connectionCount); |
|
244 |
|
245 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
246 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
247 TESTEL(KErrNone == err, err); |
|
248 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
249 |
|
250 // Get Progress Info |
|
251 TNifProgress tProg; |
|
252 conn.Progress(subConnectionUniqueId, tProg); |
|
253 TESTEL( tProg.iError == KErrNone, tProg.iError ); |
|
254 |
|
255 err = conn.Stop(); |
|
256 TESTEL( err == KErrNone, err ); |
|
257 |
|
258 CloseConnection(conn); |
|
259 CleanupStack::Pop(&conn); |
|
260 |
|
261 CloseSocketServer(ss); |
|
262 CleanupStack::Pop(&ss); |
|
263 |
|
264 return TestStepResult(); |
|
265 } |
|
266 |
|
267 /** Test 705 |
|
268 * |
|
269 */ |
|
270 |
|
271 |
|
272 /** |
|
273 @SYMTestCaseID TE_RConnection-705 |
|
274 @SYMTestCaseDesc negative test for non valid subconnectionid being passed to progress() |
|
275 */ |
|
276 enum TVerdict TE_RConnectionTest705::doTestStepL() |
|
277 { |
|
278 TInt err; |
|
279 RSocketServ ss; |
|
280 RConnection conn; |
|
281 |
|
282 err = OpenSocketServer(ss); |
|
283 TESTEL(KErrNone == err, err); |
|
284 CleanupClosePushL(ss); |
|
285 |
|
286 //********** connection creation *********** |
|
287 |
|
288 err = OpenConnection(conn, ss); |
|
289 TESTEL(KErrNone == err, err); |
|
290 CleanupClosePushL(conn); |
|
291 |
|
292 // start the test nif |
|
293 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
294 TESTEL(KErrNone == err, err); |
|
295 |
|
296 // should have a single interface |
|
297 TUint connectionCount; |
|
298 err = conn.EnumerateConnections(connectionCount); |
|
299 TESTEL(KErrNone == err, err); |
|
300 TESTEL(1 == connectionCount, connectionCount); |
|
301 |
|
302 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
303 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
304 TESTEL(KErrNone == err, err); |
|
305 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
306 |
|
307 // Get Progress Info |
|
308 TNifProgress tProg; |
|
309 err = conn.Progress(subConnectionUniqueId + MaxConnectionsNumber, tProg); |
|
310 TESTEL( err == KErrNotSupported, err); |
|
311 |
|
312 err = conn.Stop(); |
|
313 TESTEL( err == KErrNone, err ); |
|
314 |
|
315 CloseConnection(conn); |
|
316 CleanupStack::Pop(&conn); |
|
317 |
|
318 CloseSocketServer(ss); |
|
319 CleanupStack::Pop(&ss); |
|
320 |
|
321 return TestStepResult(); |
|
322 } |
|
323 |
|
324 /** Test 706 |
|
325 * |
|
326 */ |
|
327 /** |
|
328 @SYMTestCaseID TE_RConnection-706 |
|
329 @SYMTestCaseDesc Test ProgressNotification() on subconnection |
|
330 */ |
|
331 enum TVerdict TE_RConnectionTest706::doTestStepL() |
|
332 { |
|
333 TInt err; |
|
334 TRequestStatus tStatus; |
|
335 RSocketServ ss; |
|
336 RConnection conn; |
|
337 |
|
338 err = OpenSocketServer(ss); |
|
339 TESTEL(KErrNone == err, err); |
|
340 CleanupClosePushL(ss); |
|
341 |
|
342 //********** connection creation *********** |
|
343 |
|
344 err = OpenConnection(conn, ss); |
|
345 TESTEL(KErrNone == err, err); |
|
346 CleanupClosePushL(conn); |
|
347 |
|
348 // start the test nif |
|
349 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
350 TESTEL(KErrNone == err, err); |
|
351 |
|
352 // should have a single interface |
|
353 TUint connectionCount; |
|
354 err = conn.EnumerateConnections(connectionCount); |
|
355 TESTEL(KErrNone == err, err); |
|
356 TESTEL(1 == connectionCount, connectionCount); |
|
357 |
|
358 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
359 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
360 TESTEL(KErrNone == err, err); |
|
361 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
362 |
|
363 // Set up ProgressNotification() |
|
364 TNifProgressBuf tNifProgressBuf; |
|
365 |
|
366 conn.ProgressNotification(subConnectionUniqueId, tNifProgressBuf, tStatus); |
|
367 |
|
368 // Force change in state of subConn |
|
369 err = RequestSetStausL(conn, ss, subConnectionUniqueId); |
|
370 TESTEL(KErrNone == err, err); |
|
371 |
|
372 User::WaitForRequest( tStatus ); |
|
373 TInt theVal = tNifProgressBuf().iStage; |
|
374 TESTEL( tStatus.Int() == KErrNotSupported, tStatus.Int() ); |
|
375 |
|
376 err = conn.Stop(); |
|
377 TESTEL( err == KErrNone, err ); |
|
378 |
|
379 CloseConnection(conn); |
|
380 CleanupStack::Pop(&conn); |
|
381 |
|
382 CloseSocketServer(ss); |
|
383 CleanupStack::Pop(&ss); |
|
384 |
|
385 return TestStepResult(); |
|
386 } |
|
387 |
|
388 |
|
389 /** |
|
390 @SYMTestCaseID TE_RConnection-707 |
|
391 @SYMTestCaseDesc negative testing ProgressNotification should reset any values set in the |
|
392 TNifProgressBuff. a raised error value on tProg.iError shouldn't still exist after the progress call |
|
393 */ |
|
394 enum TVerdict TE_RConnectionTest707::doTestStepL() |
|
395 { |
|
396 TInt err; |
|
397 TRequestStatus tStatus; |
|
398 RSocketServ ss; |
|
399 RConnection conn; |
|
400 |
|
401 err = OpenSocketServer(ss); |
|
402 TESTEL(KErrNone == err, err); |
|
403 CleanupClosePushL(ss); |
|
404 |
|
405 //********** connection creation *********** |
|
406 |
|
407 err = OpenConnection(conn, ss); |
|
408 TESTEL(KErrNone == err, err); |
|
409 CleanupClosePushL(conn); |
|
410 |
|
411 |
|
412 // start the test nif |
|
413 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
414 TESTEL(KErrNone == err, err); |
|
415 |
|
416 // should have a single interface |
|
417 TUint connectionCount; |
|
418 err = conn.EnumerateConnections(connectionCount); |
|
419 TESTEL(KErrNone == err, err); |
|
420 TESTEL(1 == connectionCount, connectionCount); |
|
421 |
|
422 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
423 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
424 TESTEL(KErrNone == err, err); |
|
425 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
426 |
|
427 // try to Set up ProgressNotification() passing in a TNifProgressBuf with |
|
428 // some erronous values to progressnotification |
|
429 TNifProgressBuf tNifProgressBuf; |
|
430 tNifProgressBuf().iError = KErrGeneral; |
|
431 conn.ProgressNotification(subConnectionUniqueId, tNifProgressBuf, tStatus); |
|
432 |
|
433 // Force change in state of subConn |
|
434 err = RequestSetStausL(conn, ss, subConnectionUniqueId); |
|
435 TESTEL(KErrNone == err, err); |
|
436 |
|
437 User::WaitForRequest( tStatus ); |
|
438 TInt error = tNifProgressBuf().iError; |
|
439 TESTEL(tNifProgressBuf().iError != KErrCancel, tNifProgressBuf().iError); |
|
440 TESTEL( tStatus.Int() == KErrNotSupported, tStatus.Int() ); |
|
441 |
|
442 err = conn.Stop(); |
|
443 TESTEL( err == KErrNone, err ); |
|
444 |
|
445 CloseConnection(conn); |
|
446 CleanupStack::Pop(&conn); |
|
447 |
|
448 CloseSocketServer(ss); |
|
449 CleanupStack::Pop(&ss); |
|
450 |
|
451 return TestStepResult(); |
|
452 } |
|
453 |
|
454 /** Test 708 |
|
455 * |
|
456 */ |
|
457 |
|
458 /** |
|
459 @SYMTestCaseID TE_RConnection-708 |
|
460 @SYMTestCaseDesc Test ProgressNotification(TSubConnection& aSubConnectionUniqueId...) with invalid subconnection ID |
|
461 */ |
|
462 enum TVerdict TE_RConnectionTest708::doTestStepL() |
|
463 { |
|
464 TInt err; |
|
465 TRequestStatus tStatus; |
|
466 RSocketServ ss; |
|
467 RConnection conn; |
|
468 |
|
469 err = OpenSocketServer(ss); |
|
470 TESTEL(KErrNone == err, err); |
|
471 CleanupClosePushL(ss); |
|
472 |
|
473 //********** connection creation *********** |
|
474 |
|
475 err = OpenConnection(conn, ss); |
|
476 TESTEL(KErrNone == err, err); |
|
477 CleanupClosePushL(conn); |
|
478 |
|
479 |
|
480 // start the test nif |
|
481 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
482 TESTEL(KErrNone == err, err); |
|
483 |
|
484 // should have a single interface |
|
485 TUint connectionCount; |
|
486 err = conn.EnumerateConnections(connectionCount); |
|
487 TESTEL(KErrNone == err, err); |
|
488 TESTEL(1 == connectionCount, connectionCount); |
|
489 |
|
490 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
491 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
492 TESTEL(KErrNone == err, err); |
|
493 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
494 |
|
495 // try to Set up ProgressNotification() with invalid subconnectionid |
|
496 TNifProgressBuf tNifProgressBuf; |
|
497 conn.ProgressNotification(subConnectionUniqueId + MaxConnectionsNumber, tNifProgressBuf, tStatus); |
|
498 |
|
499 User::WaitForRequest( tStatus ); |
|
500 TESTEL( tStatus.Int() == KErrNotSupported, tStatus.Int() ); |
|
501 |
|
502 err = conn.Stop(); |
|
503 TESTEL( err == KErrNone, err ); |
|
504 |
|
505 CloseConnection(conn); |
|
506 CleanupStack::Pop(&conn); |
|
507 |
|
508 CloseSocketServer(ss); |
|
509 CleanupStack::Pop(&ss); |
|
510 |
|
511 return TestStepResult(); |
|
512 } |
|
513 |
|
514 /** Test 709 |
|
515 * |
|
516 */ |
|
517 /** |
|
518 @SYMTestCaseID TE_RConnection-709 |
|
519 @SYMTestCaseDesc Test CancelProgressNotification() |
|
520 */ |
|
521 enum TVerdict TE_RConnectionTest709::doTestStepL() |
|
522 { |
|
523 TInt err; |
|
524 TRequestStatus tStatus; |
|
525 RSocketServ ss; |
|
526 RConnection conn; |
|
527 |
|
528 err = OpenSocketServer(ss); |
|
529 TESTEL(KErrNone == err, err); |
|
530 CleanupClosePushL(ss); |
|
531 |
|
532 //********** connection creation *********** |
|
533 err = OpenConnection(conn, ss); |
|
534 TESTEL(KErrNone == err, err); |
|
535 CleanupClosePushL(conn); |
|
536 |
|
537 // start the test nif |
|
538 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
539 TESTEL(KErrNone == err, err); |
|
540 |
|
541 // should have a single interface |
|
542 TUint connectionCount; |
|
543 err = conn.EnumerateConnections(connectionCount); |
|
544 TESTEL(KErrNone == err, err); |
|
545 TESTEL(1 == connectionCount, connectionCount); |
|
546 |
|
547 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
548 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
549 TESTEL(KErrNone == err, err); |
|
550 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
551 |
|
552 // Test ProgressNotification() |
|
553 TNifProgressBuf tNifProgressBuf; |
|
554 conn.ProgressNotification(subConnectionUniqueId, tNifProgressBuf, tStatus, KStartingSelection ); |
|
555 |
|
556 // Force change in state of subConn |
|
557 err = RequestSetStausL(conn, ss, subConnectionUniqueId); |
|
558 TESTEL(KErrNone == err, err); |
|
559 |
|
560 conn.CancelProgressNotification(subConnectionUniqueId); |
|
561 |
|
562 User::WaitForRequest( tStatus ); |
|
563 TESTEL(KErrNotSupported == tStatus.Int(), tStatus.Int()); |
|
564 |
|
565 err = conn.Stop(); |
|
566 TESTEL( err == KErrNone, err ); |
|
567 |
|
568 CloseConnection(conn); |
|
569 CleanupStack::Pop(&conn); |
|
570 |
|
571 CloseSocketServer(ss); |
|
572 CleanupStack::Pop(&ss); |
|
573 |
|
574 return TestStepResult(); |
|
575 } |
|
576 |
|
577 /** Test 710 |
|
578 * |
|
579 */ |
|
580 |
|
581 /** |
|
582 @SYMTestCaseID TE_RConnection-710 |
|
583 @SYMTestCaseDesc Test CancelProgressNotification() with invalid subconnectionId |
|
584 shouldn't panic the system |
|
585 */ |
|
586 enum TVerdict TE_RConnectionTest710::doTestStepL() |
|
587 { |
|
588 TInt err; |
|
589 RSocketServ ss; |
|
590 RConnection conn; |
|
591 |
|
592 err = OpenSocketServer(ss); |
|
593 TESTEL(KErrNone == err, err); |
|
594 CleanupClosePushL(ss); |
|
595 |
|
596 //********** connection creation *********** |
|
597 err = OpenConnection(conn, ss); |
|
598 TESTEL(KErrNone == err, err); |
|
599 CleanupClosePushL(conn); |
|
600 |
|
601 // start the test nif |
|
602 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
603 TESTEL(KErrNone == err, err); |
|
604 |
|
605 // should have a single interface |
|
606 TUint connectionCount; |
|
607 err = conn.EnumerateConnections(connectionCount); |
|
608 TESTEL(KErrNone == err, err); |
|
609 TESTEL(1 == connectionCount, connectionCount); |
|
610 |
|
611 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
612 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
613 TESTEL(KErrNone == err, err); |
|
614 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
615 |
|
616 // try to cancel invalid subconnectionId |
|
617 // should be a recoverable operation |
|
618 conn.CancelProgressNotification(subConnectionUniqueId + MaxConnectionsNumber); |
|
619 |
|
620 err = conn.Stop(); |
|
621 TESTEL( err == KErrNone, err ); |
|
622 |
|
623 CloseConnection(conn); |
|
624 CleanupStack::Pop(&conn); |
|
625 |
|
626 CloseSocketServer(ss); |
|
627 CleanupStack::Pop(&ss); |
|
628 |
|
629 return TestStepResult(); |
|
630 } |
|
631 |
|
632 /** Test 711 |
|
633 * |
|
634 */ |
|
635 /** |
|
636 @SYMTestCaseID TE_RConnection-711 |
|
637 @SYMTestCaseDesc Negative testing of WaitForIncoming(RSubConnection&) passing in Null pointer |
|
638 */ |
|
639 enum TVerdict TE_RConnectionTest711::doTestStepL() |
|
640 { |
|
641 TInt err; |
|
642 RSocketServ ss; |
|
643 RConnection conn; |
|
644 |
|
645 err = OpenSocketServer(ss); |
|
646 TESTEL(KErrNone == err, err); |
|
647 CleanupClosePushL(ss); |
|
648 |
|
649 //********** connection creation *********** |
|
650 err = OpenConnection(conn, ss); |
|
651 TESTEL(KErrNone == err, err); |
|
652 CleanupClosePushL(conn); |
|
653 |
|
654 // start the test nif |
|
655 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
656 TESTEL(KErrNone == err, err); |
|
657 |
|
658 // uninstantiated RSubConn reference |
|
659 RSubConnection subConn; |
|
660 |
|
661 // pass in Null subconnection reference to WaitForIncoming |
|
662 err = conn.WaitForIncoming(subConn); |
|
663 TESTEL(KErrNotSupported == err, err); |
|
664 |
|
665 err = conn.Stop(); |
|
666 TESTEL( err == KErrNone, err ); |
|
667 |
|
668 // Some error was reported so we're safe |
|
669 CloseConnection(conn); |
|
670 CleanupStack::Pop(&conn); |
|
671 |
|
672 CloseSocketServer(ss); |
|
673 CleanupStack::Pop(&ss); |
|
674 |
|
675 return TestStepResult(); |
|
676 } |
|
677 |
|
678 /** Test 712 |
|
679 * |
|
680 */ |
|
681 |
|
682 |
|
683 /** |
|
684 @SYMTestCaseID TE_RConnection-712 |
|
685 @SYMTestCaseDesc ProgressNotification requesting notification on an specific |
|
686 aSelectedProgress stage instead of on any change in subconn status |
|
687 */ |
|
688 enum TVerdict TE_RConnectionTest712::doTestStepL() |
|
689 { |
|
690 TInt err; |
|
691 TRequestStatus tStatus; |
|
692 RSocketServ ss; |
|
693 RConnection conn; |
|
694 |
|
695 err = OpenSocketServer(ss); |
|
696 TESTEL(KErrNone == err, err); |
|
697 CleanupClosePushL(ss); |
|
698 |
|
699 //********** connection creation *********** |
|
700 |
|
701 err = OpenConnection(conn, ss); |
|
702 TESTEL(KErrNone == err, err); |
|
703 CleanupClosePushL(conn); |
|
704 |
|
705 // start the test nif |
|
706 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
707 TESTEL(KErrNone == err, err); |
|
708 |
|
709 // should have a single interface |
|
710 TUint connectionCount; |
|
711 err = conn.EnumerateConnections(connectionCount); |
|
712 TESTEL(KErrNone == err, err); |
|
713 TESTEL(1 == connectionCount, connectionCount); |
|
714 |
|
715 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
716 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
717 TESTEL(KErrNone == err, err); |
|
718 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
719 |
|
720 // Set up ProgressNotification() |
|
721 TNifProgressBuf tNifProgressBuf; |
|
722 conn.ProgressNotification(subConnectionUniqueId, tNifProgressBuf, tStatus, KFinishedSelection); |
|
723 |
|
724 // Force change in state of subConn |
|
725 err = RequestSetStausL(conn, ss, subConnectionUniqueId); |
|
726 TESTEL(KErrNone == err, err); |
|
727 |
|
728 User::WaitForRequest( tStatus ); |
|
729 TESTEL( tStatus.Int() == KErrNotSupported, tStatus.Int() ); |
|
730 |
|
731 err = conn.Stop(); |
|
732 TESTEL( err == KErrNone, err ); |
|
733 |
|
734 CloseConnection(conn); |
|
735 CleanupStack::Pop(&conn); |
|
736 |
|
737 CloseSocketServer(ss); |
|
738 CleanupStack::Pop(&ss); |
|
739 |
|
740 return TestStepResult(); |
|
741 } |
|
742 |
|
743 /** Test 713 |
|
744 * |
|
745 */ |
|
746 /** |
|
747 @SYMTestCaseID TE_RConnection-713 |
|
748 @SYMTestCaseDesc Negative testing of ProgressNotification requesting notification on an invalid |
|
749 aSelectedProgress stage |
|
750 */ |
|
751 enum TVerdict TE_RConnectionTest713::doTestStepL() |
|
752 { |
|
753 TInt err; |
|
754 TRequestStatus tStatus; |
|
755 RSocketServ ss; |
|
756 RConnection conn; |
|
757 |
|
758 err = OpenSocketServer(ss); |
|
759 TESTEL(KErrNone == err, err); |
|
760 CleanupClosePushL(ss); |
|
761 |
|
762 //********** connection creation *********** |
|
763 |
|
764 err = OpenConnection(conn, ss); |
|
765 TESTEL(KErrNone == err, err); |
|
766 CleanupClosePushL(conn); |
|
767 |
|
768 // start the test nif |
|
769 err = StartConnectionWithOverrides(conn, iTestNifIap); |
|
770 TESTEL(KErrNone == err, err); |
|
771 |
|
772 // should have a single interface |
|
773 TUint connectionCount; |
|
774 err = conn.EnumerateConnections(connectionCount); |
|
775 TESTEL(KErrNone == err, err); |
|
776 TESTEL(1 == connectionCount, connectionCount); |
|
777 |
|
778 TPckgBuf<TSubConnectionInfo> subconnectionInfo; |
|
779 err = conn.GetSubConnectionInfo(1, subconnectionInfo); |
|
780 TESTEL(KErrNone == err, err); |
|
781 TSubConnectionUniqueId subConnectionUniqueId = subconnectionInfo().iSubConnectionUniqueId; |
|
782 |
|
783 // Set up ProgressNotification() |
|
784 TNifProgressBuf tNifProgressBuf; |
|
785 conn.ProgressNotification(subConnectionUniqueId, tNifProgressBuf, tStatus, (TUint)-1000); |
|
786 |
|
787 // Force change in state of subConn |
|
788 err = RequestSetStausL(conn, ss, subConnectionUniqueId); |
|
789 TESTEL(KErrNone == err, err); |
|
790 |
|
791 User::WaitForRequest( tStatus ); |
|
792 TESTEL( tStatus.Int() != KErrNone, tStatus.Int() ); |
|
793 |
|
794 err = conn.Stop(); |
|
795 TESTEL( err == KErrNone, err ); |
|
796 |
|
797 CloseConnection(conn); |
|
798 CleanupStack::Pop(&conn); |
|
799 |
|
800 CloseSocketServer(ss); |
|
801 CleanupStack::Pop(&ss); |
|
802 |
|
803 return TestStepResult(); |
|
804 } |
|
805 |
|
806 |
|
807 |
|
808 |