|
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 @file Connections.TestSteps.cpp |
|
18 */ |
|
19 |
|
20 #include "SubConnections.TestSteps.h" |
|
21 #include "Connections.TestSteps.h" |
|
22 #include "SocketServer.TestSteps.h" |
|
23 #include "Sockets.TestSteps.h" |
|
24 #include <cdbcols.h> |
|
25 |
|
26 |
|
27 #ifdef _DEBUG |
|
28 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module |
|
29 // (if it could happen through user error then you should give it an explicit, documented, category + code) |
|
30 _LIT(KSpecAssert_ESockTestCnctnsT, "ESockTestCnctnsT"); |
|
31 #endif |
|
32 |
|
33 |
|
34 // Create Connection |
|
35 //------------------ |
|
36 |
|
37 CCreateRConnectionStep::CCreateRConnectionStep(CCEsockTestBase*& aEsockTest) |
|
38 : CTe_EsockStepBase(aEsockTest) |
|
39 { |
|
40 SetTestStepName(KCreateRConnectionStep); |
|
41 } |
|
42 |
|
43 TVerdict CCreateRConnectionStep::doTestStepPreambleL() |
|
44 { |
|
45 SetTestStepResult(EFail); |
|
46 |
|
47 if (iEsockTest==NULL) |
|
48 iEsockTest = new (ELeave) CCEsockTestBase; |
|
49 |
|
50 SetTestStepResult(EPass); |
|
51 return TestStepResult(); |
|
52 } |
|
53 |
|
54 TInt CCreateRConnectionStep::ConfigureFromIni() |
|
55 { |
|
56 iParams.Reset(); |
|
57 |
|
58 // Read in appropriate fields |
|
59 if((GetStringFromConfig(iSection, KTe_ConnectionName, iParams.iConnectionName) != 1) |
|
60 || (iParams.iConnectionName.Length() == 0)) |
|
61 { |
|
62 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
63 return KErrNotFound; |
|
64 } |
|
65 |
|
66 // All ok if we got this far |
|
67 return KErrNone; |
|
68 } |
|
69 |
|
70 TVerdict CCreateRConnectionStep::doSingleTestStep() |
|
71 { |
|
72 TInt error = iEsockTest->CreateConnection(iParams.iConnectionName); |
|
73 if (error!=KErrNone) |
|
74 { |
|
75 INFO_PRINTF2(_L("Could not create connection (%S)."),&iParams.iConnectionName); |
|
76 INFO_PRINTF2(_L("Error: %d."),error); |
|
77 SetTestStepResult(EFail); |
|
78 } |
|
79 return TestStepResult(); |
|
80 } |
|
81 |
|
82 |
|
83 // Open Connection |
|
84 //---------------- |
|
85 |
|
86 COpenRConnectionStep::COpenRConnectionStep(CCEsockTestBase*& aEsockTest) |
|
87 : CTe_EsockStepBase(aEsockTest) |
|
88 { |
|
89 SetTestStepName(KOpenRConnectionStep); |
|
90 } |
|
91 |
|
92 TInt COpenRConnectionStep::ConfigureFromIni() |
|
93 { |
|
94 iParams.Reset(); |
|
95 |
|
96 // Read in appropriate fields |
|
97 if((GetStringFromConfig(iSection, KTe_ConnectionName, iParams.iConnectionName) != 1) |
|
98 || (iParams.iConnectionName.Length() == 0)) |
|
99 { |
|
100 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
101 return KErrNotFound; |
|
102 } |
|
103 |
|
104 if (GetStringFromConfig(iSection, KTe_SocketServName, iParams.iSockServName) != 1) |
|
105 { |
|
106 INFO_PRINTF2(_L("%S: Socket server name missing."), &iParams.iConnectionName); |
|
107 return EFalse; |
|
108 } |
|
109 |
|
110 // Optional |
|
111 // Reads the protocol family to use |
|
112 if (GetIntFromConfig(iSection, KTe_ConnectionType, iParams.iConnectionType) != 1) |
|
113 { |
|
114 iParams.iConnectionType = -1; |
|
115 } |
|
116 |
|
117 // All ok if we got this far |
|
118 return KErrNone; |
|
119 } |
|
120 |
|
121 TVerdict COpenRConnectionStep::doSingleTestStep() |
|
122 { |
|
123 TInt error = iEsockTest->OpenConnection(iParams); |
|
124 if (error!=KErrNone) |
|
125 { |
|
126 INFO_PRINTF2(_L("Could not open connection (%S)."),&iParams.iConnectionName); |
|
127 INFO_PRINTF2(_L("Error: %d."),error); |
|
128 return EFail; |
|
129 } |
|
130 return EPass; |
|
131 } |
|
132 |
|
133 |
|
134 // Start Connection |
|
135 //----------------- |
|
136 |
|
137 CStartRConnectionStep::CStartRConnectionStep(CCEsockTestBase*& aEsockTest) |
|
138 : CTe_EsockStepBase(aEsockTest) |
|
139 { |
|
140 SetTestStepName(KStartRConnectionStep); |
|
141 } |
|
142 |
|
143 TInt CStartRConnectionStep::ConfigureFromIni() |
|
144 { |
|
145 iParams.Reset(); |
|
146 TPtrC temp; |
|
147 |
|
148 // Read in appropriate fields |
|
149 if((GetStringFromConfig(iSection, KTe_ConnectionName, iParams.iConnectionName) != 1) |
|
150 || (iParams.iConnectionName.Length() == 0)) |
|
151 { |
|
152 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
153 return KErrNotFound; |
|
154 } |
|
155 |
|
156 TPtrC16 bearerSet; |
|
157 TBool bearerPresent = ((GetStringFromConfig(iSection,KTe_BearerName,bearerSet)==1) |
|
158 && (bearerSet.Length()>0)); |
|
159 |
|
160 TBool IAPpresent = (GetIntFromConfig(iSection,KTe_IAPIndexName,iParams.iIAP)==1); |
|
161 TBool SNAPpresent = (GetIntFromConfig(iSection,KTe_SNAPIndexName,iParams.iSNAP)==1); |
|
162 TBool ConnPrefPresent = (GetIntFromConfig(iSection,KTe_ConnPrefListIndexName,iParams.iSNAP)==1); |
|
163 TBool DummyPresent = (GetIntFromConfig(iSection,KTe_DummyPrefIndexName,iParams.iDummy)==1); |
|
164 TBool AsynchPresent = (GetStringFromConfig(iSection,KTe_AsynchIndexName,temp)==1); |
|
165 |
|
166 iParams.iStartWithOldPreferences = IAPpresent; |
|
167 iParams.iStartWithSnapPreferences = SNAPpresent; |
|
168 iParams.iStartWithConPrefList = ConnPrefPresent; |
|
169 iParams.iStartWithDummy = DummyPresent; |
|
170 iParams.iAsynch = AsynchPresent; |
|
171 |
|
172 GetBoolFromConfig(iSection, KTe_AutoStartPrefName, iParams.iStartAuto); |
|
173 |
|
174 if (iParams.iStartWithOldPreferences && iParams.iStartWithSnapPreferences) |
|
175 { |
|
176 INFO_PRINTF2(_L("Connection preferences for (%S) have both snap and IAP."),&iParams.iConnectionName); |
|
177 return KErrNotFound; |
|
178 } |
|
179 |
|
180 //with preferences? |
|
181 if (iParams.iStartWithOldPreferences) |
|
182 { |
|
183 if(!bearerPresent) |
|
184 { |
|
185 iParams.iBearer = KCommDbBearerUnknown; |
|
186 } |
|
187 else |
|
188 { |
|
189 if (bearerSet.Compare(KTe_CommDbBearerCSD)==0) |
|
190 { iParams.iBearer = KCommDbBearerCSD; } |
|
191 else if (bearerSet.Compare(KTe_CommDbBearerWcdma)==0) |
|
192 { iParams.iBearer = KCommDbBearerWcdma; } |
|
193 else if (bearerSet.Compare(KTe_CommDbBearerLAN)==0) |
|
194 { iParams.iBearer = KCommDbBearerLAN; } |
|
195 else |
|
196 { |
|
197 INFO_PRINTF3(_L("%S: Bearer type (%S) not recognised."),&iParams.iConnectionName,&bearerSet); |
|
198 return KErrNotFound; |
|
199 } |
|
200 } |
|
201 } |
|
202 |
|
203 // What error are we expecting? |
|
204 if (!GetIntFromConfig(iSection, KExpectedError,iExpectedError)) |
|
205 { |
|
206 iExpectedError = KExpectedErrorNotUsed; |
|
207 } |
|
208 else |
|
209 { |
|
210 INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError); |
|
211 } |
|
212 |
|
213 // All ok if we got this far |
|
214 return KErrNone; |
|
215 } |
|
216 |
|
217 TVerdict CStartRConnectionStep::doSingleTestStep() |
|
218 { |
|
219 // Default to failing |
|
220 SetTestStepResult(EFail); |
|
221 |
|
222 TInt ret = iEsockTest->StartConnection(iParams); |
|
223 |
|
224 // Log any error found |
|
225 if(iExpectedError == KExpectedErrorNotUsed) |
|
226 { |
|
227 SetTestStepError(ret); |
|
228 |
|
229 if(ret == KErrNone) |
|
230 { |
|
231 SetTestStepResult(EPass); |
|
232 } |
|
233 else |
|
234 { |
|
235 INFO_PRINTF2(_L("Could not start connection (%S)."), &iParams.iConnectionName); |
|
236 INFO_PRINTF2(_L("Error: %d"), ret); |
|
237 } |
|
238 } |
|
239 else |
|
240 { |
|
241 // We are expecting a special kind of error |
|
242 INFO_PRINTF3(_L("Expected error used. expected:%d, observed:%d"), iExpectedError, ret); |
|
243 SetTestStepResult((ret == iExpectedError) ? EPass : EFail); |
|
244 SetTestStepError((ret == iExpectedError) ? KErrNone : ret); |
|
245 } |
|
246 |
|
247 return TestStepResult(); |
|
248 } |
|
249 |
|
250 |
|
251 // Stop Connection |
|
252 //---------------- |
|
253 |
|
254 CStopRConnectionStep::CStopRConnectionStep(CCEsockTestBase*& aEsockTest) |
|
255 : CTe_EsockStepBase(aEsockTest) |
|
256 { |
|
257 SetTestStepName(KStopRConnectionStep); |
|
258 } |
|
259 |
|
260 TInt CStopRConnectionStep::ConfigureFromIni() |
|
261 { |
|
262 iParams.Reset(); |
|
263 |
|
264 // Read in appropriate fields |
|
265 if((GetStringFromConfig(iSection, KTe_ConnectionName, iParams.iConnectionName) != 1) |
|
266 || (iParams.iConnectionName.Length() == 0)) |
|
267 { |
|
268 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
269 return KErrNotFound; |
|
270 } |
|
271 |
|
272 TPtrC shutdownType; |
|
273 if (GetStringFromConfig(iSection,KTe_ConnectionStopTypeName,shutdownType)!=1) |
|
274 { |
|
275 INFO_PRINTF2(_L("%S: Stop type missing."),&iParams.iConnectionName); |
|
276 return KErrNotFound; |
|
277 } |
|
278 |
|
279 if (shutdownType.Compare(KTe_ConnStopNormal)==0) |
|
280 { iParams.iConnStopType = RConnection::EStopNormal; } |
|
281 else if (shutdownType.Compare(KTe_ConnStopAuthoritative)==0) |
|
282 { iParams.iConnStopType = RConnection::EStopAuthoritative; } |
|
283 else |
|
284 { |
|
285 INFO_PRINTF3(_L("%S: Stop type (%S) not recognised."),&iParams.iConnectionName,&shutdownType); |
|
286 return KErrNotFound; |
|
287 } |
|
288 |
|
289 // All ok if we got this far |
|
290 return KErrNone; |
|
291 } |
|
292 |
|
293 TVerdict CStopRConnectionStep::doSingleTestStep() |
|
294 { |
|
295 TInt error = iEsockTest->StopConnection(iParams); |
|
296 if (error!=KErrNone) |
|
297 { |
|
298 INFO_PRINTF2(_L("Could not stop connection (%S)."),&iParams.iConnectionName); |
|
299 INFO_PRINTF2(_L("Error: %d."),error); |
|
300 return EFail; |
|
301 } |
|
302 return EPass; |
|
303 } |
|
304 |
|
305 |
|
306 // Close Connection |
|
307 //----------------- |
|
308 |
|
309 CCloseRConnectionStep::CCloseRConnectionStep(CCEsockTestBase*& aEsockTest) |
|
310 : CTe_EsockStepBase(aEsockTest) |
|
311 { |
|
312 SetTestStepName(KCloseRConnectionStep); |
|
313 } |
|
314 |
|
315 TInt CCloseRConnectionStep::ConfigureFromIni() |
|
316 { |
|
317 if((GetStringFromConfig(iSection, KTe_ConnectionName, iParams.iConnectionName) != 1) |
|
318 || (iParams.iConnectionName.Length() == 0)) |
|
319 { |
|
320 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
321 return KErrNotFound; |
|
322 } |
|
323 |
|
324 // All ok if we got this far |
|
325 return KErrNone; |
|
326 } |
|
327 |
|
328 TVerdict CCloseRConnectionStep::doSingleTestStep() |
|
329 { |
|
330 TInt error = iEsockTest->CloseConnection(iParams.iConnectionName); |
|
331 if (error!=KErrNone) |
|
332 { |
|
333 INFO_PRINTF2(_L("Could not close connection (%S)."),&iParams.iConnectionName); |
|
334 INFO_PRINTF2(_L("Error: %d."),error); |
|
335 return EFail; |
|
336 } |
|
337 return EPass; |
|
338 } |
|
339 |
|
340 |
|
341 |
|
342 // Wait for Incoming Connection |
|
343 //----------------------------- |
|
344 |
|
345 CWaitForIncomingConnectionStep::CWaitForIncomingConnectionStep(CCEsockTestBase*& aEsockTest) |
|
346 : CTe_EsockStepBase(aEsockTest) |
|
347 { |
|
348 SetTestStepName(KWaitForIncomingConnectionStep); |
|
349 } |
|
350 |
|
351 TInt CWaitForIncomingConnectionStep::ConfigureFromIni() |
|
352 { |
|
353 //clean parameters from previous runs |
|
354 iParams.Reset(); |
|
355 |
|
356 //try reading the next socket's name |
|
357 if (GetStringFromConfig(iSection,KTe_SubConnectionName,iParams.iSubConnectionName)!=1 |
|
358 || iParams.iSubConnectionName.Length()==0) |
|
359 return KErrNotFound; |
|
360 |
|
361 if (GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)!=1) |
|
362 { |
|
363 INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iConnectionName); |
|
364 return KErrNotFound; |
|
365 } |
|
366 |
|
367 //optional |
|
368 GetStringFromConfig(iSection,KTe_ConnectionStatus,subConnStatus); |
|
369 GetStringFromConfig(iSection,KTe_IncomingConnTimerSet,timerSet); |
|
370 |
|
371 return KErrNone; |
|
372 } |
|
373 |
|
374 TVerdict CWaitForIncomingConnectionStep::doSingleTestStep() |
|
375 { |
|
376 /* |
|
377 These scenarios are tested here |
|
378 1.Timer expires since there is no incoming connection. |
|
379 2.Cancel the waitforincoming connection. |
|
380 */ |
|
381 const int timerVal = 3000; |
|
382 TInt error; |
|
383 TInt errCancel; |
|
384 TRequestStatus reqStat; |
|
385 |
|
386 //Set the timer if subConnStatus is TimerOn |
|
387 if (timerSet.Compare(KTe_IncomingConnTimerStatus) == 0) |
|
388 { |
|
389 iTimer.CreateLocal(); |
|
390 iTimer.After(reqStat,timerVal); |
|
391 } |
|
392 |
|
393 TRequestStatus reqStat1; |
|
394 TInt error1 = iEsockTest->WaitforIncomingConnection(iParams,reqStat1); |
|
395 |
|
396 if (error1!=KErrNone) |
|
397 { |
|
398 INFO_PRINTF2(_L("Error in wait for incoming connection: %d."),error1); |
|
399 return EFail; |
|
400 } |
|
401 //check whether the cancel status is set or not. |
|
402 if ((subConnStatus.Compare(KTe_ConnCancelStatus)==0) && (reqStat1 != KErrNone)) |
|
403 { |
|
404 errCancel = iEsockTest->CancelIncomingConnection(iParams); |
|
405 if (errCancel != KErrNone) |
|
406 { |
|
407 INFO_PRINTF2(_L("Error in cancelling the incoming connection: %d."),errCancel); |
|
408 } |
|
409 } |
|
410 |
|
411 User::WaitForRequest(reqStat,reqStat1); |
|
412 |
|
413 error = reqStat.Int(); |
|
414 error1 = reqStat1.Int(); |
|
415 |
|
416 //check whether the timer is expired. |
|
417 if ((timerSet.Compare(KTe_IncomingConnTimerStatus)==0) && (error == KErrNone)) |
|
418 { |
|
419 INFO_PRINTF1(_L("Timer was called since there was no incoming connection")); |
|
420 iTimer.Close(); |
|
421 return EPass; |
|
422 } |
|
423 //check whether the KErrArgument is returned since the RSubConnection is already opened. |
|
424 else if ((subConnStatus.Compare(KTe_ConnOpenStatus)==0) && (error1 == KErrArgument)) |
|
425 { |
|
426 INFO_PRINTF1(_L("Returned KErrArgument since RsubCon was opened prior to Waitforincoming connection ")); |
|
427 return EPass; |
|
428 } |
|
429 //check whether KErrCancel is returned for cancelling incoming connection. |
|
430 else if ((subConnStatus.Compare(KTe_ConnCancelStatus)==0) && (error1 == KErrCancel)) |
|
431 { |
|
432 INFO_PRINTF1(_L("Successfully cancelled the incoming connection")); |
|
433 return EPass; |
|
434 } |
|
435 |
|
436 if (error1!=KErrNone) |
|
437 { |
|
438 INFO_PRINTF2(_L("Error in wait for incoming connection: %d."),error1); |
|
439 return EFail; |
|
440 } |
|
441 |
|
442 return EPass; |
|
443 } |
|
444 |
|
445 |
|
446 // Reject Incoming Connection |
|
447 //--------------------------- |
|
448 |
|
449 CRejectIncomingConnectionStep::CRejectIncomingConnectionStep(CCEsockTestBase*& aEsockTest) |
|
450 : CTe_EsockStepBase(aEsockTest) |
|
451 { |
|
452 SetTestStepName(KRejectIncomingConnectionStep); |
|
453 } |
|
454 |
|
455 TInt CRejectIncomingConnectionStep::ConfigureFromIni() |
|
456 { |
|
457 //clean parameters from previous runs |
|
458 iParams.Reset(); |
|
459 |
|
460 //try reading from ini file |
|
461 if (GetStringFromConfig(iSection, KTe_SubConnectionName, iParams.iSubConnectionName)!=1) |
|
462 { |
|
463 return KErrNotFound; |
|
464 } |
|
465 |
|
466 return KErrNone; |
|
467 } |
|
468 |
|
469 TVerdict CRejectIncomingConnectionStep::doSingleTestStep() |
|
470 { |
|
471 |
|
472 TInt error = iEsockTest->RejectIncomingConnection(iParams); |
|
473 if (error!=KErrNone) |
|
474 { |
|
475 INFO_PRINTF2(_L("Error in rejecting the incoming connection: %d."),error); |
|
476 return EFail; |
|
477 } |
|
478 return EPass; |
|
479 } |
|
480 |
|
481 |
|
482 // Accept Incoming Connection |
|
483 //--------------------------- |
|
484 |
|
485 CAcceptIncomingConnectionStep::CAcceptIncomingConnectionStep(CCEsockTestBase*& aEsockTest) |
|
486 : CTe_EsockStepBase(aEsockTest) |
|
487 { |
|
488 SetTestStepName(KAcceptIncomingConnectionStep); |
|
489 } |
|
490 |
|
491 TInt CAcceptIncomingConnectionStep::ConfigureFromIni() |
|
492 { |
|
493 iParams.Reset(); |
|
494 |
|
495 // Read in appropriate fields |
|
496 if((GetStringFromConfig(iSection, KTe_SubConnectionName, iParams.iSubConnectionName) != 1) |
|
497 || (iParams.iSubConnectionName.Length() == 0)) |
|
498 { |
|
499 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
500 return KErrNotFound; |
|
501 } |
|
502 |
|
503 // All ok if we got this far |
|
504 return KErrNone; |
|
505 } |
|
506 |
|
507 TVerdict CAcceptIncomingConnectionStep::doSingleTestStep() |
|
508 { |
|
509 |
|
510 TInt error = iEsockTest->AcceptIncomingConnection(iParams); |
|
511 if (error!=KErrNone) |
|
512 { |
|
513 INFO_PRINTF2(_L("Error in accepting the incoming connection: %d."),error); |
|
514 return EFail; |
|
515 } |
|
516 return EPass; |
|
517 } |
|
518 |
|
519 |
|
520 // Async Incoming Connection |
|
521 //-------------------------- |
|
522 |
|
523 CAsyncAcceptIncomingConnectionStep::CAsyncAcceptIncomingConnectionStep(CCEsockTestBase*& aEsockTest) |
|
524 : CTe_EsockStepBase(aEsockTest) |
|
525 { |
|
526 SetTestStepName(KAsyncAcceptIncomingConnectionStep); |
|
527 } |
|
528 |
|
529 TInt CAsyncAcceptIncomingConnectionStep::ConfigureFromIni() |
|
530 { |
|
531 //clean parameters from previous runs |
|
532 iParams.Reset(); |
|
533 |
|
534 //try reading the next socket's name |
|
535 if (GetStringFromConfig(iSection,KTe_SubConnectionName,iParams.iSubConnectionName)!=1 |
|
536 || iParams.iSubConnectionName.Length()==0) |
|
537 return KErrNotFound; |
|
538 |
|
539 if (GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)!=1) |
|
540 { |
|
541 INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iConnectionName); |
|
542 return KErrNotFound; |
|
543 } |
|
544 |
|
545 //optional |
|
546 GetStringFromConfig(iSection,KTe_ConnectionStatus,subConnStatus); |
|
547 GetStringFromConfig(iSection,KTe_IncomingConnTimerSet,timerSet); |
|
548 |
|
549 return KErrNone; |
|
550 } |
|
551 |
|
552 TVerdict CAsyncAcceptIncomingConnectionStep::doSingleTestStep() |
|
553 { |
|
554 /* |
|
555 These scenarios are tested here |
|
556 1.Timer expires since there is no incoming connection. |
|
557 2.Cancel the waitforincoming connection. |
|
558 */ |
|
559 const int timerVal = 30000; |
|
560 TInt error; |
|
561 TRequestStatus reqStat; |
|
562 |
|
563 //Set the timer if subConnStatus is TimerOn |
|
564 if (timerSet.Compare(KTe_IncomingConnTimerStatus) == 0) |
|
565 { |
|
566 TInt err = iTimer.CreateLocal(); |
|
567 __ASSERT_DEBUG(err == KErrNone, User::Panic(KSpecAssert_ESockTestCnctnsT, 1)); |
|
568 iTimer.After(reqStat,timerVal); |
|
569 } |
|
570 |
|
571 TRequestStatus reqStat1; |
|
572 TInt error1 = iEsockTest->AsyncAcceptIncomingConnection(iParams,reqStat1); |
|
573 |
|
574 if (error1!=KErrNone) |
|
575 { |
|
576 INFO_PRINTF2(_L("Error in wait for incoming connection: %d."),error1); |
|
577 return EFail; |
|
578 } |
|
579 |
|
580 User::WaitForRequest(reqStat,reqStat1); |
|
581 |
|
582 error = reqStat.Int(); |
|
583 error1 = reqStat1.Int(); |
|
584 |
|
585 //check whether the timer is expired. |
|
586 if ((timerSet.Compare(KTe_IncomingConnTimerStatus)==0) && (error == KErrNone)) |
|
587 { |
|
588 INFO_PRINTF1(_L("Timer was called since there was no incoming SubConnection")); |
|
589 iTimer.Close(); |
|
590 return EPass; |
|
591 } |
|
592 //check whether the KErrArgument is returned since the RSubConnection is already opened. |
|
593 else if ((subConnStatus.Compare(KTe_ConnOpenStatus)==0) && (error1 == KErrArgument)) |
|
594 { |
|
595 INFO_PRINTF1(_L("Returned KErrArgument since RsubCon was opened prior to Waitforincoming connection ")); |
|
596 iTimer.Close(); |
|
597 return EPass; |
|
598 } |
|
599 |
|
600 else if (error1!=KErrNone) |
|
601 { |
|
602 INFO_PRINTF2(_L("Error accepting subconnection: %d."),error1); |
|
603 iTimer.Close(); |
|
604 return EFail; |
|
605 } |
|
606 |
|
607 return EPass; |
|
608 } |
|
609 |
|
610 |
|
611 // Await connection start complete |
|
612 //--------------------- |
|
613 |
|
614 CAwaitRConnectionStartComplete::CAwaitRConnectionStartComplete(CCEsockTestBase*& aEsockTest) |
|
615 : CTe_EsockStepBase(aEsockTest) |
|
616 { |
|
617 SetTestStepName(KAwaitRConnectionStartComplete); |
|
618 } |
|
619 |
|
620 TInt CAwaitRConnectionStartComplete::ConfigureFromIni() |
|
621 { |
|
622 //clean parameters from previous runs |
|
623 iParams.Reset(); |
|
624 |
|
625 //try reading the connection's name |
|
626 if (!GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName) |
|
627 || iParams.iConnectionName.Length()==0) |
|
628 { |
|
629 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
630 return KErrNotFound; |
|
631 } |
|
632 |
|
633 if (!GetIntFromConfig(iSection,KExpectedError,iExpectedError)) |
|
634 { |
|
635 iExpectedError = KErrNone; |
|
636 } |
|
637 else |
|
638 { |
|
639 INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError); |
|
640 } |
|
641 return KErrNone; |
|
642 } |
|
643 |
|
644 TVerdict CAwaitRConnectionStartComplete::doSingleTestStep() |
|
645 { |
|
646 INFO_PRINTF2(_L("Awaiting Connection (%S) to start."),&iParams.iConnectionName); |
|
647 TInt error = iEsockTest->AwaitRequestStatus(iParams.iConnectionName); |
|
648 if ( error == iExpectedError) |
|
649 { |
|
650 INFO_PRINTF3(_L("Connection (%S) start completed as expected (%d)"),&iParams.iConnectionName, error); |
|
651 return EPass; |
|
652 } |
|
653 INFO_PRINTF4(_L("Connection (%S) start completed with (%d), which is different to expected (%d)"),&iParams.iConnectionName, error, iExpectedError); |
|
654 return EFail; |
|
655 } |
|
656 |
|
657 // Attach to connection |
|
658 //--------------------- |
|
659 |
|
660 CattachtorconnectionStep::CattachtorconnectionStep(CCEsockTestBase*& aEsockTest) |
|
661 : CTe_EsockStepBase(aEsockTest) |
|
662 { |
|
663 SetTestStepName(KattachtorconnectionStep); |
|
664 } |
|
665 |
|
666 TInt CattachtorconnectionStep::ConfigureFromIni() |
|
667 { |
|
668 //clean parameters from previous runs |
|
669 iParams.Reset(); |
|
670 |
|
671 //try reading the connection's name |
|
672 if (!GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName) |
|
673 || iParams.iConnectionName.Length()==0) |
|
674 { |
|
675 INFO_PRINTF1(_L("Couldn't find appropriate field in config file")); |
|
676 return KErrNotFound; |
|
677 } |
|
678 |
|
679 // Get the attach-type |
|
680 TPtrC attachType; |
|
681 if (!GetStringFromConfig(iSection,KTe_ConnectionAttachTypeName,attachType)) |
|
682 { |
|
683 INFO_PRINTF2(_L("%S: Attach type missing."),&iParams.iConnectionName); |
|
684 return KErrNotFound; |
|
685 } |
|
686 else if(attachType.Compare(KTe_ConnAttachTypeNormal) == KErrNone) |
|
687 { |
|
688 iParams.iConnAttachType = RConnection::EAttachTypeNormal; |
|
689 } |
|
690 else if(attachType.Compare(KTe_ConnAttachTypeMonitor) == KErrNone) |
|
691 { |
|
692 iParams.iConnAttachType = RConnection::EAttachTypeMonitor; |
|
693 } |
|
694 else |
|
695 { |
|
696 INFO_PRINTF3(_L("%S: Attach Type (%S) not recognised."),&iParams.iConnectionName,&attachType); |
|
697 return KErrNotFound; |
|
698 } |
|
699 |
|
700 if((GetStringFromConfig(iSection, KTe_AttachToConnectionName, iParams.iAttachToConnectionName) != 1) |
|
701 || (iParams.iAttachToConnectionName.Length() == 0)) |
|
702 { |
|
703 INFO_PRINTF2(_L("%S: Both IAP Id and NET Id are missing or zero. Attempting to attach to the first interface to be enumerated."), &iParams.iConnectionName); |
|
704 |
|
705 // Get IAP and NET Ids |
|
706 GetIntFromConfig(iSection,KTe_IAPIndexName,iParams.iIAP); |
|
707 GetIntFromConfig(iSection,KTe_NetworkIndexName,iParams.iNET); |
|
708 |
|
709 if(iParams.iIAP == 0 && iParams.iNET) |
|
710 { |
|
711 INFO_PRINTF2(_L("%S: Both IAP Id and NET Id are missing or zero. Attempting to attach to the first interface to be enumerated."), &iParams.iConnectionName); |
|
712 } |
|
713 } |
|
714 |
|
715 if (!GetIntFromConfig(iSection,KExpectedError,iExpectedError)) |
|
716 { |
|
717 iExpectedError = KErrNone; |
|
718 } |
|
719 else |
|
720 { |
|
721 INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError); |
|
722 } |
|
723 return KErrNone; |
|
724 } |
|
725 |
|
726 TVerdict CattachtorconnectionStep::doSingleTestStep() |
|
727 { |
|
728 TInt error = iEsockTest->AttachToConnection(iParams); |
|
729 if (error!=KErrNone) |
|
730 { |
|
731 INFO_PRINTF2(_L("Could not attach to connection (%S)."),&iParams.iConnectionName); |
|
732 INFO_PRINTF2(_L("Error: %d."),error); |
|
733 return EFail; |
|
734 } |
|
735 return EPass; |
|
736 } |
|
737 |
|
738 |
|
739 // Enumerate connections |
|
740 //---------------------- |
|
741 |
|
742 CEnumerateConnectionsStep::CEnumerateConnectionsStep(CCEsockTestBase*& aEsockTest) |
|
743 : CTe_EsockStepBase(aEsockTest) |
|
744 { |
|
745 SetTestStepName(KEnumerateConnectionsStep); |
|
746 } |
|
747 |
|
748 TInt CEnumerateConnectionsStep::ConfigureFromIni() |
|
749 { |
|
750 // Read in appropriate fields |
|
751 if((GetStringFromConfig(iSection, KTe_ConnectionName, iParams.iConnectionName) != 1) |
|
752 || (iParams.iConnectionName.Length() == 0)) |
|
753 { |
|
754 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KTe_ConnectionName); |
|
755 return KErrNotFound; |
|
756 } |
|
757 |
|
758 // Get the expected connection count to validate against |
|
759 TInt connCount; |
|
760 if(GetIntFromConfig(iSection, KExpectedConnectionCount, connCount) != 1) |
|
761 { |
|
762 INFO_PRINTF3(KErrString_MissingConfigFileField, &iSection, &KExpectedConnectionCount); |
|
763 return KErrNotFound; |
|
764 } |
|
765 else if(connCount < 0) |
|
766 { |
|
767 INFO_PRINTF3(KErrString_UnsignedConfigValueLessThanZero, &iSection, &KExpectedConnectionCount); |
|
768 return KErrArgument; |
|
769 } |
|
770 else |
|
771 { |
|
772 iParams.iExpectedConnCount = connCount; |
|
773 } |
|
774 |
|
775 // All ok if we got this far |
|
776 return KErrNone; |
|
777 } |
|
778 |
|
779 TVerdict CEnumerateConnectionsStep::doSingleTestStep() |
|
780 { |
|
781 TUint connectionCount; |
|
782 |
|
783 // Find the connection to apply the enumerate call to |
|
784 RConnection* connection = iEsockTest->FindConnection(iParams.iConnectionName); |
|
785 |
|
786 // Enumerate the current connection count |
|
787 if(connection) |
|
788 { |
|
789 // Fetch the connection count |
|
790 TInt err = connection->EnumerateConnections(connectionCount); |
|
791 |
|
792 if (err != KErrNone) |
|
793 { |
|
794 INFO_PRINTF2(_L("Error when enumerating connections (%d)."), &err); |
|
795 return EFail; |
|
796 } |
|
797 |
|
798 // Compare the connection count with that expected |
|
799 if (connectionCount == iParams.iExpectedConnCount) |
|
800 { |
|
801 INFO_PRINTF3(_L("Current connection count (%d) equal to that expected (%d)."), connectionCount, iParams.iExpectedConnCount); |
|
802 } |
|
803 else |
|
804 { |
|
805 INFO_PRINTF3(_L("Current connection count (%d) not equal to expected count. (%d)"), connectionCount, iParams.iExpectedConnCount); |
|
806 return EFail; |
|
807 } |
|
808 } |
|
809 else |
|
810 { |
|
811 INFO_PRINTF2(_L("Could not find connection (%S)."), &iParams.iConnectionName); |
|
812 return EFail; |
|
813 } |
|
814 |
|
815 // Test passed if we got this far |
|
816 return EPass; |
|
817 } |
|
818 |
|
819 |
|
820 |
|
821 CCreatePublishSubscribeVar::CCreatePublishSubscribeVar(CCEsockTestBase*& aEsockTest) |
|
822 : CTe_EsockStepBase(aEsockTest) |
|
823 { |
|
824 SetTestStepName(KCreatePublishSubscribeVar); |
|
825 } |
|
826 |
|
827 |
|
828 TInt CCreatePublishSubscribeVar::ConfigureFromIni() |
|
829 { |
|
830 //try reading the UID that im going to ignor name |
|
831 if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarUid,iUid)) |
|
832 { |
|
833 INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file")); |
|
834 return KErrNotFound; |
|
835 } |
|
836 |
|
837 if (!GetIntFromConfig(iSection,KTe_CreatePublishSubscribeVarValue,iValue)) |
|
838 { |
|
839 INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file")); |
|
840 return KErrNotFound; |
|
841 } |
|
842 |
|
843 return KErrNone; |
|
844 } |
|
845 |
|
846 TVerdict CCreatePublishSubscribeVar::doTestStepPreambleL() |
|
847 { |
|
848 return EPass; |
|
849 } |
|
850 |
|
851 TVerdict CCreatePublishSubscribeVar::doSingleTestStep() |
|
852 { |
|
853 RProperty property; |
|
854 TInt result = property.Define(TUid::Uid(iUid),0,RProperty::EInt); |
|
855 result = property.Attach(TUid::Uid(iUid), 0); |
|
856 if(result == KErrNone) |
|
857 { |
|
858 result = property.Set(iValue); |
|
859 if(result == KErrNone) |
|
860 return EPass; |
|
861 } |
|
862 return EFail; |
|
863 } |
|
864 |
|
865 //Check a publish subscribe var |
|
866 /** |
|
867 Class implementing CreateRConnectionStep |
|
868 |
|
869 @internalComponent |
|
870 */ |
|
871 CCheckPublishSubscribeVar::CCheckPublishSubscribeVar(CCEsockTestBase*& aEsockTest) |
|
872 : CTe_EsockStepBase(aEsockTest) |
|
873 { |
|
874 SetTestStepName(KCheckPublishSubscribeVar); |
|
875 } |
|
876 |
|
877 TInt CCheckPublishSubscribeVar::ConfigureFromIni() |
|
878 { |
|
879 //try reading the UID that im not going to use name |
|
880 if (!GetIntFromConfig(iSection,KTe_CheckPublishSubscribeVarUid,iUid)) |
|
881 { |
|
882 INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file")); |
|
883 return KErrNotFound; |
|
884 } |
|
885 |
|
886 if (!GetIntFromConfig(iSection,KTe_CheckPublishSubscribeVarValue,iValue)) |
|
887 { |
|
888 INFO_PRINTF1(_L("Couldn't find appropriate UID field in config file")); |
|
889 return KErrNotFound; |
|
890 } |
|
891 |
|
892 return KErrNone; |
|
893 } |
|
894 |
|
895 TVerdict CCheckPublishSubscribeVar::doTestStepPreambleL() |
|
896 { |
|
897 return EPass; |
|
898 } |
|
899 |
|
900 TVerdict CCheckPublishSubscribeVar::doSingleTestStep() |
|
901 { |
|
902 RProperty property; |
|
903 TInt result = property.Attach(TUid::Uid(iUid), 0); |
|
904 if(result == KErrNone) |
|
905 { |
|
906 TInt existingValue; |
|
907 result = property.Get(TUid::Uid(iUid), 0, existingValue); |
|
908 if(result == KErrNone && iValue == existingValue) |
|
909 return EPass; |
|
910 } |
|
911 return EFail; |
|
912 } |
|
913 |
|
914 // Progress notifications |
|
915 //----------------------- |
|
916 |
|
917 CRegisterProgressNotificationStep::CRegisterProgressNotificationStep(CCEsockTestBase*& aEsockTest) |
|
918 : CTe_EsockStepBase(aEsockTest) |
|
919 { |
|
920 SetTestStepName(KRegisterProgressNotificationStep); |
|
921 } |
|
922 |
|
923 TInt CRegisterProgressNotificationStep::ConfigureFromIni() |
|
924 { |
|
925 //clean parameters from previous runs |
|
926 iParams.Reset(); |
|
927 |
|
928 //try reading the next event container's name |
|
929 if (GetStringFromConfig(iSection,KTe_ConnEventsName,iParams.iEventName)!=1 |
|
930 || iParams.iEventName.Length()==0) |
|
931 return KErrNotFound; |
|
932 |
|
933 if (GetStringFromConfig(iSection,KTe_ConnectionName,iParams.iConnectionName)!=1) |
|
934 { |
|
935 INFO_PRINTF2(_L("%S: Connection name missing."),&iParams.iEventName); |
|
936 return KErrNotFound; |
|
937 } |
|
938 |
|
939 TPtrC eventName; |
|
940 |
|
941 if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1) |
|
942 { |
|
943 if (eventName.Compare(KTe_LinkLayerOpen)==0) |
|
944 { iParams.iEventMask = KLinkLayerOpen; } |
|
945 else if (eventName.Compare(KTe_LinkLayerClosed)==0) |
|
946 { iParams.iEventMask = KLinkLayerClosed; } |
|
947 else |
|
948 { |
|
949 INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName); |
|
950 return KErrNotFound; |
|
951 } |
|
952 } |
|
953 else |
|
954 { |
|
955 INFO_PRINTF1(_L("Event type missing.")); |
|
956 return KErrNotFound; |
|
957 } |
|
958 |
|
959 INFO_PRINTF3(_L("%S: Events to be registered: 0x%x"),&iParams.iEventName,iParams.iEventMask); |
|
960 return KErrNone; |
|
961 |
|
962 } |
|
963 |
|
964 TVerdict CRegisterProgressNotificationStep::doSingleTestStep() |
|
965 { |
|
966 TInt error = iEsockTest->RegisterForProgressNotificationEvent(iParams); |
|
967 if (error!=KErrNone) |
|
968 { |
|
969 INFO_PRINTF2(_L("Could not register for rsubconnection events (%S)."),&iParams.iEventName); |
|
970 INFO_PRINTF2(_L("Error: %d"),error); |
|
971 return EFail; |
|
972 } |
|
973 |
|
974 return EPass; |
|
975 } |
|
976 |
|
977 // Check for Progress notification |
|
978 //------------------------------- |
|
979 |
|
980 CCheckProgressNotificationStep::CCheckProgressNotificationStep(CCEsockTestBase*& aEsockTest) |
|
981 : CTe_EsockStepBase(aEsockTest) |
|
982 { |
|
983 SetTestStepName(KCheckProgressNotificationStep); |
|
984 } |
|
985 |
|
986 TInt CCheckProgressNotificationStep::ConfigureFromIni() |
|
987 { |
|
988 //clean parameters from previous runs |
|
989 iParams.Reset(); |
|
990 |
|
991 //try reading the next event container's name |
|
992 if (GetStringFromConfig(iSection,KTe_ConnEventsName,iParams.iEventName)!=1 |
|
993 || iParams.iEventName.Length()==0) |
|
994 return KErrNotFound; |
|
995 |
|
996 TPtrC eventName; |
|
997 |
|
998 if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1) |
|
999 { |
|
1000 if (eventName.Compare(KTe_LinkLayerOpen)==0) |
|
1001 { iParams.iEventMask = KLinkLayerOpen; } |
|
1002 else if (eventName.Compare(KTe_LinkLayerClosed)==0) |
|
1003 { iParams.iEventMask = KLinkLayerClosed; } |
|
1004 else |
|
1005 { |
|
1006 INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName); |
|
1007 return KErrNotFound; |
|
1008 } |
|
1009 } |
|
1010 else |
|
1011 { |
|
1012 INFO_PRINTF1(_L("Event type missing.")); |
|
1013 return KErrNotFound; |
|
1014 } |
|
1015 |
|
1016 if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError)) |
|
1017 { |
|
1018 iExpectedError = KExpectedErrorNotUsed; |
|
1019 } |
|
1020 |
|
1021 if (iExpectedError != KExpectedErrorNotUsed) |
|
1022 { |
|
1023 INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError); |
|
1024 } |
|
1025 |
|
1026 // All ok if we got this far |
|
1027 return KErrNone; |
|
1028 } |
|
1029 |
|
1030 |
|
1031 TVerdict CCheckProgressNotificationStep::doSingleTestStep() |
|
1032 { |
|
1033 TNifProgress* event = NULL; |
|
1034 TInt err = iEsockTest->ReceiveProgressNotificationEvent(event, iParams.iEventName); |
|
1035 |
|
1036 if (event == NULL || err != KErrNone) |
|
1037 { |
|
1038 INFO_PRINTF2(_L("%S: Did not receive any event!"),&iParams.iEventName); |
|
1039 INFO_PRINTF2(_L("The error code returned was %d."),err); |
|
1040 return EFail; |
|
1041 } |
|
1042 |
|
1043 TInt eventId = event->iStage; |
|
1044 |
|
1045 if (eventId == KLinkLayerOpen ) |
|
1046 { |
|
1047 INFO_PRINTF1(_L("Received event: KLinkLayerOpen")); |
|
1048 } |
|
1049 else if (eventId == KLinkLayerClosed ) |
|
1050 { |
|
1051 INFO_PRINTF1(_L("Received event: KLinkLayerClosed")); |
|
1052 } |
|
1053 else |
|
1054 { |
|
1055 INFO_PRINTF2(_L("Received event: Unknown (%d)"),eventId); |
|
1056 } |
|
1057 |
|
1058 if (eventId != iParams.iEventMask) |
|
1059 { |
|
1060 INFO_PRINTF2(_L("Did not receive an expected event with %S."),&iParams.iEventName); |
|
1061 return EFail; |
|
1062 } |
|
1063 |
|
1064 |
|
1065 if(iExpectedError != event->iError && iExpectedError < KExpectedErrorNotUsed) |
|
1066 { |
|
1067 INFO_PRINTF3(_L("Expected Error %d does not match returned Error %d"), iExpectedError, event->iError); |
|
1068 return EFail; |
|
1069 } |
|
1070 |
|
1071 else if (iExpectedError != KExpectedErrorNotUsed) |
|
1072 { |
|
1073 INFO_PRINTF3(_L("Expected Error %d matched returned Error %d"), iExpectedError, event->iError); |
|
1074 } |
|
1075 |
|
1076 return EPass; |
|
1077 } |
|
1078 |
|
1079 // Check for Progress notification (negative test) |
|
1080 //------------------------------- |
|
1081 |
|
1082 CCheckNegativeProgressNotificationStep::CCheckNegativeProgressNotificationStep(CCEsockTestBase*& aEsockTest) |
|
1083 : CTe_EsockStepBase(aEsockTest) |
|
1084 { |
|
1085 SetTestStepName(KCheckNegativeProgressNotificationStep); |
|
1086 } |
|
1087 |
|
1088 TInt CCheckNegativeProgressNotificationStep::ConfigureFromIni() |
|
1089 { |
|
1090 //clean parameters from previous runs |
|
1091 iParams.Reset(); |
|
1092 |
|
1093 //try reading the next event container's name |
|
1094 if (GetStringFromConfig(iSection,KTe_ConnEventsName,iParams.iEventName)!=1 |
|
1095 || iParams.iEventName.Length()==0) |
|
1096 return KErrNotFound; |
|
1097 |
|
1098 TPtrC eventName; |
|
1099 |
|
1100 if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1) |
|
1101 { |
|
1102 if (eventName.Compare(KTe_LinkLayerOpen)==0) |
|
1103 { iParams.iEventMask = KLinkLayerOpen; } |
|
1104 else if (eventName.Compare(KTe_LinkLayerClosed)==0) |
|
1105 { iParams.iEventMask = KLinkLayerClosed; } |
|
1106 else |
|
1107 { |
|
1108 INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName); |
|
1109 return KErrNotFound; |
|
1110 } |
|
1111 } |
|
1112 else |
|
1113 { |
|
1114 INFO_PRINTF1(_L("Event type missing.")); |
|
1115 return KErrNotFound; |
|
1116 } |
|
1117 |
|
1118 if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError)) |
|
1119 { |
|
1120 iExpectedError = KExpectedErrorNotUsed; |
|
1121 } |
|
1122 |
|
1123 // Get any timeout value and if we have one then we are not expecting any notification |
|
1124 if(!GetIntFromConfig(iSection, KTimeoutInMilliSeconds, iParams.iTimeoutMiliSecs)) |
|
1125 { |
|
1126 // Default to 5 second timeout |
|
1127 iParams.iTimeoutMiliSecs = 5000; |
|
1128 } |
|
1129 |
|
1130 if (iExpectedError != KExpectedErrorNotUsed) |
|
1131 { |
|
1132 INFO_PRINTF2(_L("Error to be expected: %d"),iExpectedError); |
|
1133 } |
|
1134 |
|
1135 // All ok if we got this far |
|
1136 return KErrNone; |
|
1137 } |
|
1138 |
|
1139 |
|
1140 TVerdict CCheckNegativeProgressNotificationStep::doSingleTestStep() |
|
1141 { |
|
1142 TNifProgress* event = NULL; |
|
1143 TInt err = iEsockTest->ReceiveProgressNotificationEvent(event, iParams.iEventName, iParams.iTimeoutMiliSecs); |
|
1144 |
|
1145 if (event == NULL || err == KErrNone) |
|
1146 { |
|
1147 INFO_PRINTF2(_L("%S: Did not receive any event."),&iParams.iEventName); |
|
1148 |
|
1149 return EPass; |
|
1150 } |
|
1151 else if (event == NULL || err != KErrNone) |
|
1152 { |
|
1153 INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName); |
|
1154 INFO_PRINTF2(_L("The error code returned was %d."),err); |
|
1155 return EFail; |
|
1156 } |
|
1157 |
|
1158 |
|
1159 TInt eventId = event->iStage; |
|
1160 |
|
1161 if (eventId == KLinkLayerOpen ) |
|
1162 { |
|
1163 INFO_PRINTF1(_L("Received event: KLinkLayerOpen")); |
|
1164 } |
|
1165 else if (eventId == KLinkLayerClosed ) |
|
1166 { |
|
1167 INFO_PRINTF1(_L("Received event: KLinkLayerClosed")); |
|
1168 } |
|
1169 else |
|
1170 { |
|
1171 INFO_PRINTF2(_L("Received event: Unknown (%d)"),eventId); |
|
1172 } |
|
1173 |
|
1174 if (eventId == iParams.iEventMask) |
|
1175 { |
|
1176 INFO_PRINTF2(_L("Received the banned event ( %S )."),&iParams.iEventName); |
|
1177 return EFail; |
|
1178 } |
|
1179 |
|
1180 |
|
1181 if(iExpectedError != event->iError && iExpectedError < KExpectedErrorNotUsed) |
|
1182 { |
|
1183 INFO_PRINTF3(_L("Expected Error %d does not match returned Error %d"), iExpectedError, event->iError); |
|
1184 return EFail; |
|
1185 } |
|
1186 |
|
1187 else if (iExpectedError != KExpectedErrorNotUsed) |
|
1188 { |
|
1189 INFO_PRINTF3(_L("Expected Error %d matched returned Error %d"), iExpectedError, event->iError); |
|
1190 } |
|
1191 |
|
1192 return EPass; |
|
1193 } |
|
1194 |
|
1195 |
|
1196 |