1 // Copyright (c) 2004-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 // Unit tests for SPUD FSM |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include <e32def.h> |
|
24 #include <testexecutelog.h> |
|
25 |
|
26 #include "SpudUnitTestStep.h" |
|
27 #include "meteldriverstrategy.h" |
|
28 #include "ceteldrivercontext.h" |
|
29 #include "CompareContextParameters.h" |
|
30 #include "DefaultContextParameters.h" |
|
31 |
|
32 using namespace EtelDriver; |
|
33 |
|
34 CSpudFsmUnitNormalOperation::~CSpudFsmUnitNormalOperation() |
|
35 { |
|
36 } |
|
37 |
|
38 // configure to use test step 1 from simtsy config file |
|
39 CSpudFsmUnitNormalOperation::CSpudFsmUnitNormalOperation() : CSpudFsmUnitTestStepBase(1) |
|
40 { |
|
41 // Call base class method to set up the human readable name for logging |
|
42 SetTestStepName(KSpudFsmUnitNormalOperation); |
|
43 } |
|
44 |
|
45 TVerdict CSpudFsmUnitNormalOperation::doTestStepL() |
|
46 /** |
|
47 Test normal operation |
|
48 This test step goes through all of the states in the SPUD FSM |
|
49 */ |
|
50 { |
|
51 INFO_PRINTF1(_L("Starting Spud Driver Test normal operation")); |
|
52 |
|
53 TRequestStatus status; |
|
54 RPacketService::TContextInfo contextInfo; |
|
55 |
|
56 RPacketQoS::TQoSR99_R4Negotiated qos; |
|
57 TQoSR99_R4NegotiatedPckg qosPckg(qos); |
|
58 RPacketQoS::TQoSR99_R4Negotiated expectedTestQoSR99_R4Negotiated; |
|
59 |
|
60 InitPhoneAndPacketServiceL(); |
|
61 |
|
62 // Start by creating all the Spud FSM objects. |
|
63 // They have to be created in the test's Active Scheduler Thread |
|
64 // (terminology from the test's design document). |
|
65 // |
|
66 FsmObjectCreate(KContextId0); |
|
67 WaitForFsmObjectCreateResponse(KContextId0); |
|
68 FsmObjectCreate(KContextId1); |
|
69 WaitForFsmObjectCreateResponse(KContextId1); |
|
70 FsmObjectCreate(KContextId2); |
|
71 WaitForFsmObjectCreateResponse(KContextId2); |
|
72 |
|
73 |
|
74 // Set up context config and QoS parameters |
|
75 |
|
76 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
77 DefaultContextConfigGPRS(contextConfigGPRS); |
|
78 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
79 iListener->iPdpFsmInterface->Set(KContextId1, contextConfigGPRS); |
|
80 iListener->iPdpFsmInterface->Set(KContextId2, contextConfigGPRS); |
|
81 |
|
82 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
83 RPacketQoS::TQoSR5Requested qosRequested; |
|
84 DefaultQoSR5Requested(qosRequested); |
|
85 #else |
|
86 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
87 DefaultQoSR99_R4Requested(qosRequested); |
|
88 #endif |
|
89 |
|
90 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
91 iListener->iPdpFsmInterface->Set(KContextId1, qosRequested); |
|
92 iListener->iPdpFsmInterface->Set(KContextId2, qosRequested); |
|
93 |
|
94 |
|
95 // |
|
96 // Test creating first primary context |
|
97 // This tests state transitions: |
|
98 // Initialised -> OpeningPhone -> CreatingPrimary -> SettingQoSPrimary -> ActivatingPrimary -> Open |
|
99 // |
|
100 INFO_PRINTF1(_L("Test creating first primary context")); |
|
101 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
102 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, 0); |
|
103 // Check that the context was created |
|
104 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
105 // Check that the QoS was created for the primary context |
|
106 RPacketQoS primaryPacketQos; |
|
107 TEST(primaryPacketQos.OpenExistingQoS(iPrimaryPacketContext, KFirstQosName) == KErrNone); |
|
108 |
|
109 // Check that the QoS parameters were set |
|
110 primaryPacketQos.GetProfileParameters(status, qosPckg); |
|
111 User::WaitForRequest(status); |
|
112 SecondQoSR99_R4Negotiated(expectedTestQoSR99_R4Negotiated); |
|
113 TEST(CompareUMTSQoSNeg(expectedTestQoSR99_R4Negotiated, qos)); |
|
114 |
|
115 // |
|
116 // Test creating second primary context - since the phone is already open, there is no transition to OpeningPhone state |
|
117 // This tests state transitions: |
|
118 // Initialised -> CreatingPrimary -> SettingQoSPrimary -> ActivatingPrimary -> Open |
|
119 // |
|
120 INFO_PRINTF1(_L("Test creating second primary context")); |
|
121 FsmInputRequest(KContextId1, SpudMan::ECreatePrimaryPDPContext, 0); |
|
122 WaitForFsmInputResponse(KContextId1, KPrimaryContextCreated, 0); |
|
123 RPacketContext secondPrimaryContext; |
|
124 // Test that the context was created |
|
125 TEST(secondPrimaryContext.OpenExistingContext(iPacketService, KSecondPrimaryContextName) == KErrNone); |
|
126 |
|
127 |
|
128 // |
|
129 // Test creating secondary context |
|
130 // This tests state transitions: |
|
131 // Initialised -> CreatingSecondary -> CreatedSecondary |
|
132 // |
|
133 INFO_PRINTF1(_L("Test creating secondary contexts")); |
|
134 FsmInputRequest(KContextId2, SpudMan::ECreateSecondaryPDPContext, 0); |
|
135 WaitForFsmInputResponse(KContextId2, KSecondaryContextCreated, 0); |
|
136 // Test that the context was created |
|
137 TEST(iSecondaryPacketContext.OpenExistingContext(iPacketService, KFirstSecondaryContextName) == KErrNone); |
|
138 |
|
139 |
|
140 // |
|
141 // Test setting QOS on secondary |
|
142 // This tests state transitions: |
|
143 // CreatedSecondary -> SettingQoS -> CreatedSecondary |
|
144 // |
|
145 INFO_PRINTF1(_L("Test setting QoS on secondary context")); |
|
146 FsmInputRequest(KContextId2, SpudMan::EContextQoSSet, 0); |
|
147 WaitForFsmInputResponse(KContextId2, KContextQoSSetEvent, 0); |
|
148 // Check that the QoS was created for the secondary |
|
149 RPacketQoS secondaryPacketQos; |
|
150 TEST(secondaryPacketQos.OpenExistingQoS(iSecondaryPacketContext, KFirstQosName) == KErrNone); |
|
151 |
|
152 // Check that the QoS parameters were set |
|
153 secondaryPacketQos.GetProfileParameters(status, qosPckg); |
|
154 User::WaitForRequest(status); |
|
155 SecondQoSR99_R4Negotiated(expectedTestQoSR99_R4Negotiated); |
|
156 TEST(CompareUMTSQoSNeg(expectedTestQoSR99_R4Negotiated, qos)); |
|
157 |
|
158 // |
|
159 // Test setting TFT on secondary |
|
160 // This tests state transitions: |
|
161 // CreatedSecondary -> SettingTFT -> CreatedSecondary |
|
162 // |
|
163 INFO_PRINTF1(_L("Test setting TFT on secondary context")); |
|
164 TTFTOperationCode tftOperationCode = KAddFilters; |
|
165 iListener->iPdpFsmInterface->Set(KContextId2, tftOperationCode); |
|
166 TTFTInfo tftInfo; |
|
167 DefaultTftInfo(tftInfo); |
|
168 iListener->iPdpFsmInterface->Set(KContextId2, tftInfo); |
|
169 FsmInputRequest(KContextId2, SpudMan::EContextTFTModify, 0); |
|
170 WaitForFsmInputResponse(KContextId2, KContextTFTModifiedEvent, 0); |
|
171 // check that TFT was set correctly |
|
172 TEST(CompareTFTInfo(tftInfo, iSecondaryPacketContext)); |
|
173 |
|
174 |
|
175 // |
|
176 // Test activating secondary |
|
177 // This tests state transitions: |
|
178 // CreatedSecondary -> ActivatingSecondary -> Open |
|
179 // |
|
180 INFO_PRINTF1(_L("Test activating secondary context")); |
|
181 FsmInputRequest(KContextId2, SpudMan::EContextActivate, 0); |
|
182 WaitForFsmInputResponse(KContextId2, KContextActivateEvent, 0); |
|
183 // Check that the context is active |
|
184 iPacketService.GetContextInfo(status, KContextId2, contextInfo); |
|
185 User::WaitForRequest(status); |
|
186 TEST(status == KErrNone && contextInfo.iStatus == RPacketContext::EStatusActive); |
|
187 |
|
188 |
|
189 INFO_PRINTF1(_L("Test Retrieving Negotiated QoSt")); |
|
190 FsmInputRequest(KContextId2, SpudMan::EGetNegQoS, 0); |
|
191 WaitForFsmInputResponse(KContextId2, KGetNegQoSEvent, 0); |
|
192 |
|
193 |
|
194 // |
|
195 // Test network suspending/resuming context |
|
196 // This tests state transitions: |
|
197 // Open -> Suspend -> Open |
|
198 // |
|
199 INFO_PRINTF1(_L("Test network suspend/resume context")); |
|
200 EtelRequest(EContextStatusChange, 0); |
|
201 WaitForFsmSuspendedNotification(KContextId0); |
|
202 |
|
203 EtelRequest(EContextStatusChange, 1); |
|
204 WaitForFsmResumedNotification(KContextId0); |
|
205 |
|
206 |
|
207 // |
|
208 // Test SpudMan suspending/resuming context |
|
209 // This tests state transitions: |
|
210 // Open -> Suspend -> Open |
|
211 // |
|
212 INFO_PRINTF1(_L("Test SpudMan suspend/resume context")); |
|
213 FsmInputRequest(KContextId0, SpudMan::ESuspend, 0); |
|
214 WaitForFsmSuspendedNotification(KContextId0); |
|
215 |
|
216 FsmInputRequest(KContextId0, SpudMan::EResume, 0); |
|
217 WaitForFsmResumedNotification(KContextId0); |
|
218 |
|
219 |
|
220 // |
|
221 // Test changing TFT |
|
222 // This tests state transitions: |
|
223 // Open -> ChangingTFT -> Open |
|
224 // |
|
225 INFO_PRINTF1(_L("Test changing TFT")); |
|
226 TTFTInfo secondTftInfo; |
|
227 SecondDefaultTftInfo(secondTftInfo); |
|
228 iListener->iPdpFsmInterface->Set(KContextId2, KAddFilters); |
|
229 iListener->iPdpFsmInterface->Set(KContextId2, secondTftInfo); |
|
230 // The second TFT should be added to the existing TFT |
|
231 FsmInputRequest(KContextId2, SpudMan::EContextTFTModify, 0); |
|
232 WaitForFsmInputResponse(KContextId2, KContextTFTModifiedEvent, 0); |
|
233 // check that TFT was changed |
|
234 TTFTInfo combinedTftInfo; |
|
235 CombinedDefaultTftInfo(combinedTftInfo); |
|
236 TEST(CompareTFTInfo(combinedTftInfo, iSecondaryPacketContext)); |
|
237 |
|
238 |
|
239 // |
|
240 // Test changing QOS |
|
241 // This tests state transitions: |
|
242 // Open -> ChangingQoS -> Open |
|
243 // |
|
244 INFO_PRINTF1(_L("Test changing QoS")); |
|
245 |
|
246 SecondQoSR99_R4Requested(qosRequested); |
|
247 |
|
248 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
249 FsmInputRequest(KContextId0, SpudMan::EContextQoSSet, 0); |
|
250 WaitForFsmInputResponse(KContextId0, KContextQoSSetEvent, 0); |
|
251 |
|
252 // check that QOS was changed |
|
253 DefaultQoSR99_R4Negotiated(expectedTestQoSR99_R4Negotiated); |
|
254 primaryPacketQos.GetProfileParameters(status, qosPckg); |
|
255 User::WaitForRequest(status); |
|
256 TEST(CompareUMTSQoSNeg(expectedTestQoSR99_R4Negotiated, qos)); |
|
257 |
|
258 // |
|
259 // Test modifying active |
|
260 // This tests state transitions: |
|
261 // Open -> ModifyingActive -> Open |
|
262 // |
|
263 INFO_PRINTF1(_L("Test modifying active context")); |
|
264 FsmInputRequest(KContextId0, SpudMan::EContextModifyActive, 0); |
|
265 WaitForFsmInputResponse(KContextId0, KContextModifyActiveEvent, 0); |
|
266 |
|
267 |
|
268 secondaryPacketQos.Close(); |
|
269 primaryPacketQos.Close(); |
|
270 iSecondaryPacketContext.Close(); |
|
271 secondPrimaryContext.Close(); |
|
272 iPrimaryPacketContext.Close(); |
|
273 |
|
274 |
|
275 // |
|
276 // Test deleting contexts |
|
277 // This tests state transitions: |
|
278 // Open -> Closing -> Initialised |
|
279 // |
|
280 INFO_PRINTF1(_L("Test deleting contexts")); |
|
281 for (TContextId deleteIndex = 0; deleteIndex < 3; deleteIndex++) |
|
282 { |
|
283 FsmInputRequest(deleteIndex, SpudMan::EContextDelete, 0); |
|
284 WaitForFsmInputResponse(deleteIndex, KContextDeleteEvent, 0); |
|
285 } |
|
286 // Check that the contexts were deleted |
|
287 for (TInt contextInfoIndex = 0; contextInfoIndex < 3; contextInfoIndex++) |
|
288 { |
|
289 iPacketService.GetContextInfo(status, contextInfoIndex, contextInfo); |
|
290 User::WaitForRequest(status); |
|
291 TEST(status == KErrNone && contextInfo.iStatus == RPacketContext::EStatusDeleted); |
|
292 } |
|
293 |
|
294 |
|
295 // |
|
296 // Test that we can still use a context that has been deleted |
|
297 // |
|
298 INFO_PRINTF1(_L("Test re-using deleted contexts")); |
|
299 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
300 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, 0); |
|
301 // Test that the context was created |
|
302 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KThirdPrimaryContextName) == KErrNone); |
|
303 |
|
304 // Clean-up |
|
305 iPrimaryPacketContext.Close(); |
|
306 FsmInputRequest(KContextId0, SpudMan::EContextDelete, 0); |
|
307 WaitForFsmInputResponse(KContextId0, KContextDeleteEvent, 0); |
|
308 |
|
309 DestroyPhoneAndPacketService(); |
|
310 |
|
311 return TestStepResult(); |
|
312 } |
|
313 |
|
314 CSpudFsmUnitCreatePrimaryError1::~CSpudFsmUnitCreatePrimaryError1() |
|
315 {} |
|
316 |
|
317 // configure to use test step 102 from simtsy config file |
|
318 CSpudFsmUnitCreatePrimaryError1::CSpudFsmUnitCreatePrimaryError1() : CSpudFsmUnitTestStepBase(102) |
|
319 { |
|
320 // Call base class method to set up the human readable name for logging |
|
321 SetTestStepName(KSpudFsmCreatePrimaryError1); |
|
322 } |
|
323 |
|
324 TVerdict CSpudFsmUnitCreatePrimaryError1::doTestStepL() |
|
325 /** |
|
326 Test errors creating primary context |
|
327 */ |
|
328 { |
|
329 INFO_PRINTF1(_L("Starting Spud Driver Unit test error creating primary context 1")); |
|
330 |
|
331 // Start by creating all the Spud FSM objects. |
|
332 // They have to be created in the test's Active Scheduler Thread |
|
333 // (terminology from the test's design document). |
|
334 // |
|
335 FsmObjectCreate(KContextId0); |
|
336 WaitForFsmObjectCreateResponse(KContextId0); |
|
337 |
|
338 // Set up context config and QoS parameters |
|
339 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
340 DefaultContextConfigGPRS(contextConfigGPRS); |
|
341 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
342 |
|
343 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
344 RPacketQoS::TQoSR5Requested qosRequested; |
|
345 DefaultQoSR5Requested(qosRequested); |
|
346 #else |
|
347 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
348 DefaultQoSR99_R4Requested(qosRequested); |
|
349 #endif |
|
350 |
|
351 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
352 |
|
353 // RPacketContext::SetConfig is configured to fail with error KErrGeneral |
|
354 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
355 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, KErrGeneral); |
|
356 |
|
357 InitPhoneAndPacketServiceL(); |
|
358 |
|
359 // The primary context should have been cleaned up after the failure |
|
360 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
361 WaitForGivenContextStatus(iPrimaryPacketContext, RPacketContext::EStatusDeleted); |
|
362 iPrimaryPacketContext.Close(); |
|
363 |
|
364 DestroyPhoneAndPacketService(); |
|
365 |
|
366 return TestStepResult(); |
|
367 } |
|
368 |
|
369 CSpudFsmUnitCreatePrimaryError2::~CSpudFsmUnitCreatePrimaryError2() |
|
370 {} |
|
371 |
|
372 // configure to use test step 103 from simtsy config file |
|
373 CSpudFsmUnitCreatePrimaryError2::CSpudFsmUnitCreatePrimaryError2() : CSpudFsmUnitTestStepBase(103) |
|
374 { |
|
375 // Call base class method to set up the human readable name for logging |
|
376 SetTestStepName(KSpudFsmCreatePrimaryError2); |
|
377 } |
|
378 |
|
379 TVerdict CSpudFsmUnitCreatePrimaryError2::doTestStepL() |
|
380 /** |
|
381 Test errors setting QOS on primary context |
|
382 */ |
|
383 { |
|
384 INFO_PRINTF1(_L("Starting Spud Driver Unit test error creating primary context 2")); |
|
385 |
|
386 // Start by creating all the Spud FSM objects. |
|
387 // They have to be created in the test's Active Scheduler Thread |
|
388 // (terminology from the test's design document). |
|
389 // |
|
390 FsmObjectCreate(KContextId0); |
|
391 WaitForFsmObjectCreateResponse(KContextId0); |
|
392 |
|
393 // Set up context config and QoS parameters |
|
394 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
395 DefaultContextConfigGPRS(contextConfigGPRS); |
|
396 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
397 |
|
398 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
399 RPacketQoS::TQoSR5Requested qosRequested; |
|
400 DefaultQoSR5Requested(qosRequested); |
|
401 #else |
|
402 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
403 DefaultQoSR99_R4Requested(qosRequested); |
|
404 #endif |
|
405 |
|
406 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
407 |
|
408 // RPacketQoS::SetProfileParameters is configured to fail |
|
409 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
410 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, KErrGeneral); |
|
411 |
|
412 InitPhoneAndPacketServiceL(); |
|
413 |
|
414 // The primary context should be cleaned up after the failure |
|
415 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
416 WaitForGivenContextStatus(iPrimaryPacketContext, RPacketContext::EStatusDeleted); |
|
417 iPrimaryPacketContext.Close(); |
|
418 |
|
419 DestroyPhoneAndPacketService(); |
|
420 |
|
421 return TestStepResult(); |
|
422 } |
|
423 |
|
424 CSpudFsmUnitCreatePrimaryError3::~CSpudFsmUnitCreatePrimaryError3() |
|
425 {} |
|
426 |
|
427 // configure to use test step 104 from simtsy config file |
|
428 CSpudFsmUnitCreatePrimaryError3::CSpudFsmUnitCreatePrimaryError3() : CSpudFsmUnitTestStepBase(104) |
|
429 { |
|
430 // Call base class method to set up the human readable name for logging |
|
431 SetTestStepName(KSpudFsmCreatePrimaryError3); |
|
432 } |
|
433 |
|
434 TVerdict CSpudFsmUnitCreatePrimaryError3::doTestStepL() |
|
435 /** |
|
436 Test errors activating primary context |
|
437 */ |
|
438 { |
|
439 INFO_PRINTF1(_L("Starting Spud Driver Unit test error creating primary context 3")); |
|
440 |
|
441 // Start by creating all the Spud FSM objects. |
|
442 // They have to be created in the test's Active Scheduler Thread |
|
443 // (terminology from the test's design document). |
|
444 // |
|
445 FsmObjectCreate(KContextId0); |
|
446 WaitForFsmObjectCreateResponse(KContextId0); |
|
447 |
|
448 // Set up context config and QoS parameters |
|
449 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
450 DefaultContextConfigGPRS(contextConfigGPRS); |
|
451 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
452 |
|
453 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
454 RPacketQoS::TQoSR5Requested qosRequested; |
|
455 DefaultQoSR5Requested(qosRequested); |
|
456 #else |
|
457 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
458 DefaultQoSR99_R4Requested(qosRequested); |
|
459 #endif |
|
460 |
|
461 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
462 |
|
463 // Activiating the context is configured to fail with KErrGeneral |
|
464 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
465 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, KErrGeneral); |
|
466 |
|
467 InitPhoneAndPacketServiceL(); |
|
468 |
|
469 // The primary context should have been cleaned up after the failure |
|
470 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
471 WaitForGivenContextStatus(iPrimaryPacketContext, RPacketContext::EStatusDeleted); |
|
472 iPrimaryPacketContext.Close(); |
|
473 |
|
474 DestroyPhoneAndPacketService(); |
|
475 |
|
476 return TestStepResult(); |
|
477 } |
|
478 |
|
479 CSpudFsmUnitSetQosAndTftError::~CSpudFsmUnitSetQosAndTftError() |
|
480 {} |
|
481 |
|
482 // configure to use test step 106 from simtsy config file |
|
483 CSpudFsmUnitSetQosAndTftError::CSpudFsmUnitSetQosAndTftError() : CSpudFsmUnitTestStepBase(106) |
|
484 { |
|
485 // Call base class method to set up the human readable name for logging |
|
486 SetTestStepName(KSpudFsmSetQosAndTftError); |
|
487 } |
|
488 |
|
489 TVerdict CSpudFsmUnitSetQosAndTftError::doTestStepL() |
|
490 /** |
|
491 Test errors setting QoS and setting TFT and activating secondary |
|
492 */ |
|
493 { |
|
494 INFO_PRINTF1(_L("Starting Spud Driver Unit test error creating QOS, setting TFT and activating")); |
|
495 |
|
496 // Start by creating all the Spud FSM objects. |
|
497 // They have to be created in the test's Active Scheduler Thread |
|
498 // (terminology from the test's design document). |
|
499 // |
|
500 FsmObjectCreate(KContextId0); |
|
501 WaitForFsmObjectCreateResponse(KContextId0); |
|
502 FsmObjectCreate(KContextId1); |
|
503 WaitForFsmObjectCreateResponse(KContextId1); |
|
504 |
|
505 // Set up context config and QoS parameters |
|
506 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
507 DefaultContextConfigGPRS(contextConfigGPRS); |
|
508 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
509 |
|
510 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
511 RPacketQoS::TQoSR5Requested qosRequested; |
|
512 DefaultQoSR5Requested(qosRequested); |
|
513 #else |
|
514 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
515 DefaultQoSR99_R4Requested(qosRequested); |
|
516 #endif |
|
517 |
|
518 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
519 |
|
520 // Test creating primary |
|
521 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
522 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, KErrNone); |
|
523 |
|
524 // Test creating secondary |
|
525 FsmInputRequest(KContextId1, SpudMan::ECreateSecondaryPDPContext, 0); |
|
526 WaitForFsmInputResponse(KContextId1, KSecondaryContextCreated, KErrNone); |
|
527 |
|
528 // RPacketQoS::SetProfileParameters is configured to fail for the secondary context |
|
529 iListener->iPdpFsmInterface->Set(KContextId1, qosRequested); |
|
530 FsmInputRequest(KContextId1, SpudMan::EContextQoSSet, 0); |
|
531 WaitForFsmInputResponse(KContextId1, KContextQoSSetEvent, KErrGeneral); |
|
532 |
|
533 // RPacketQoS::CreateNewTFT is configured to fail with KErrGeneral for the secondary context |
|
534 TTFTOperationCode tftOperationCode = KAddFilters; |
|
535 iListener->iPdpFsmInterface->Set(KContextId1, tftOperationCode); |
|
536 TTFTInfo tftInfo; |
|
537 DefaultTftInfo(tftInfo); |
|
538 iListener->iPdpFsmInterface->Set(KContextId1, tftInfo); |
|
539 FsmInputRequest(KContextId1, SpudMan::EContextTFTModify, 0); |
|
540 WaitForFsmInputResponse(KContextId1, KContextTFTModifiedEvent, KErrGeneral); |
|
541 |
|
542 // Activating the secondary context is configured to fail with KErrGeneral |
|
543 FsmInputRequest(KContextId1, SpudMan::EContextActivate, 0); |
|
544 WaitForFsmInputResponse(KContextId1, KContextActivateEvent, KErrGeneral); |
|
545 |
|
546 // Clean-up |
|
547 FsmInputRequest(KContextId0, SpudMan::EContextDelete, 0); |
|
548 WaitForFsmInputResponse(0, KContextDeleteEvent, 0); |
|
549 |
|
550 FsmInputRequest(KContextId1, SpudMan::EContextDelete, 0); |
|
551 WaitForFsmInputResponse(KContextId1, KContextDeleteEvent, 0); |
|
552 |
|
553 return TestStepResult(); |
|
554 } |
|
555 |
|
556 CSpudFsmUnitChangeQosAndTftError::~CSpudFsmUnitChangeQosAndTftError() |
|
557 {} |
|
558 |
|
559 // configure to use test step 107 from simtsy config file |
|
560 CSpudFsmUnitChangeQosAndTftError::CSpudFsmUnitChangeQosAndTftError() : CSpudFsmUnitTestStepBase(107) |
|
561 { |
|
562 // Call base class method to set up the human readable name for logging |
|
563 SetTestStepName(KSpudFsmChangeQosAndTftError); |
|
564 } |
|
565 |
|
566 TVerdict CSpudFsmUnitChangeQosAndTftError::doTestStepL() |
|
567 /** |
|
568 Test errors changing QoS and changing TFT for secondary |
|
569 */ |
|
570 { |
|
571 INFO_PRINTF1(_L("Starting Spud Driver Unit test error changing QOS and TFT")); |
|
572 |
|
573 // Start by creating all the Spud FSM objects. |
|
574 // They have to be created in the test's Active Scheduler Thread |
|
575 // (terminology from the test's design document). |
|
576 // |
|
577 FsmObjectCreate(KContextId0); |
|
578 WaitForFsmObjectCreateResponse(KContextId0); |
|
579 FsmObjectCreate(KContextId1); |
|
580 WaitForFsmObjectCreateResponse(KContextId1); |
|
581 |
|
582 // Set up context config and QoS parameters |
|
583 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
584 DefaultContextConfigGPRS(contextConfigGPRS); |
|
585 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
586 |
|
587 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
588 RPacketQoS::TQoSR5Requested qosRequested; |
|
589 DefaultQoSR5Requested(qosRequested); |
|
590 #else |
|
591 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
592 DefaultQoSR99_R4Requested(qosRequested); |
|
593 #endif |
|
594 |
|
595 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
596 |
|
597 // Test creating primary |
|
598 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
599 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, KErrNone); |
|
600 |
|
601 // Test creating and activating secondary |
|
602 FsmInputRequest(KContextId1, SpudMan::ECreateSecondaryPDPContext, 0); |
|
603 WaitForFsmInputResponse(KContextId1, KSecondaryContextCreated, KErrNone); |
|
604 FsmInputRequest(KContextId1, SpudMan::EContextActivate, 0); |
|
605 WaitForFsmInputResponse(KContextId1, KContextActivateEvent, KErrNone); |
|
606 |
|
607 FsmInputRequest(KContextId1, SpudMan::EGetNegQoS, 0); |
|
608 WaitForFsmInputResponse(KContextId1, KGetNegQoSEvent, KErrNone); |
|
609 |
|
610 |
|
611 |
|
612 // RPacketQoS::SetProfileParameters is configured to fail for the secondary context |
|
613 FsmInputRequest(KContextId1, SpudMan::EContextQoSSet, 0); |
|
614 WaitForFsmInputResponse(KContextId1, KContextQoSSetEvent, KErrGeneral); |
|
615 |
|
616 // RPacketQoS::CreateNewTFT is configured to fail with KErrGeneral for the secondary context |
|
617 TTFTOperationCode tftOperationCode = KAddFilters; |
|
618 iListener->iPdpFsmInterface->Set(KContextId1, tftOperationCode); |
|
619 TTFTInfo tftInfo; |
|
620 DefaultTftInfo(tftInfo); |
|
621 iListener->iPdpFsmInterface->Set(KContextId1, tftInfo); |
|
622 FsmInputRequest(KContextId1, SpudMan::EContextTFTModify, 0); |
|
623 WaitForFsmInputResponse(KContextId1, KContextTFTModifiedEvent, KErrGeneral); |
|
624 |
|
625 // Because the TFT and QoS have not changed, RPacketContext::ModifyActiveContext will fail |
|
626 FsmInputRequest(KContextId1, SpudMan::EContextModifyActive, 0); |
|
627 WaitForFsmInputResponse(KContextId1, KContextModifyActiveEvent, KErrNotReady); |
|
628 |
|
629 // Clean-up |
|
630 FsmInputRequest(KContextId0, SpudMan::EContextDelete, 0); |
|
631 WaitForFsmInputResponse(KContextId0, KContextDeleteEvent, 0); |
|
632 |
|
633 FsmInputRequest(KContextId1, SpudMan::EContextDelete, 0); |
|
634 WaitForFsmInputResponse(KContextId1, KContextDeleteEvent, 0); |
|
635 |
|
636 return TestStepResult(); |
|
637 } |
|
638 |
|
639 CSpudFsmUnitNotifications::~CSpudFsmUnitNotifications() |
|
640 {} |
|
641 |
|
642 // configure to use test step 1 from simtsy config file |
|
643 CSpudFsmUnitNotifications::CSpudFsmUnitNotifications() : CSpudFsmUnitTestStepBase(1) |
|
644 { |
|
645 // Call base class method to set up the human readable name for logging |
|
646 SetTestStepName(KSpudFsmTestNotifications); |
|
647 } |
|
648 |
|
649 TVerdict CSpudFsmUnitNotifications::doTestStepL() |
|
650 /** |
|
651 Test that notifications are passed from etel driver |
|
652 */ |
|
653 { |
|
654 INFO_PRINTF1(_L("Starting Spud Driver Unit test notifications")); |
|
655 |
|
656 // Start by creating all the Spud FSM objects. |
|
657 // They have to be created in the test's Active Scheduler Thread |
|
658 // (terminology from the test's design document). |
|
659 // |
|
660 FsmObjectCreate(KContextId0); |
|
661 WaitForFsmObjectCreateResponse(KContextId0); |
|
662 |
|
663 TRequestStatus status; |
|
664 |
|
665 // Set up context config and QoS parameters |
|
666 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
667 DefaultContextConfigGPRS(contextConfigGPRS); |
|
668 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
669 |
|
670 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
671 RPacketQoS::TQoSR5Requested qosRequested; |
|
672 DefaultQoSR5Requested(qosRequested); |
|
673 #else |
|
674 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
675 DefaultQoSR99_R4Requested(qosRequested); |
|
676 #endif |
|
677 |
|
678 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
679 |
|
680 // Test creating primary |
|
681 INFO_PRINTF1(_L("Create primary context")); |
|
682 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
683 WaitForFsmInputResponse(KContextId0, KPrimaryContextCreated, KErrNone); |
|
684 |
|
685 RPacketQoS::TQoSR99_R4Negotiated qosNegotiated; |
|
686 |
|
687 // |
|
688 // Test service status notification |
|
689 // |
|
690 // Creating/activating a primary context should change the network status |
|
691 INFO_PRINTF1(_L("Wait for service status change notification")); |
|
692 WaitForFsmServiceNotificationStatus(); |
|
693 |
|
694 |
|
695 InitPhoneAndPacketServiceL(); |
|
696 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
697 |
|
698 |
|
699 // |
|
700 // Test context config notifications |
|
701 // |
|
702 // Calling SetConfig to change the context config and trigger a context config notification |
|
703 INFO_PRINTF1(_L("Trigger context config change notification")); |
|
704 RPacketContext::TContextConfigGPRS contextConfig; |
|
705 DefaultContextConfigGPRS(contextConfig); |
|
706 TContextConfigGPRSPckg contextConfigPckg(contextConfig); |
|
707 iPrimaryPacketContext.SetConfig(status, contextConfigPckg); |
|
708 User::WaitForRequest(status); |
|
709 // Wait for the notification |
|
710 INFO_PRINTF1(_L("Wait for context config change notification")); |
|
711 WaitForFsmContextConfigNotification(KContextId0, contextConfig); |
|
712 |
|
713 |
|
714 // |
|
715 // Test QoS notifications |
|
716 // |
|
717 // Calling SetProfileParameters to change the QoS and trigger a QoS change notification |
|
718 INFO_PRINTF1(_L("Trigger QoS change notification")); |
|
719 RPacketQoS primaryPacketQos; |
|
720 TEST(primaryPacketQos.OpenExistingQoS(iPrimaryPacketContext, KFirstQosName) == KErrNone); |
|
721 |
|
722 RPacketQoS::TQoSR99_R4Requested qosChangeRequested; |
|
723 SecondQoSR99_R4Requested(qosChangeRequested); |
|
724 TQoSR99_R4RequestedPckg qosChangeRequestedPckg(qosChangeRequested); |
|
725 primaryPacketQos.SetProfileParameters(status, qosChangeRequestedPckg); |
|
726 User::WaitForRequest(status); |
|
727 // Wait for the notification |
|
728 INFO_PRINTF1(_L("Wait for QoS change notification")); |
|
729 DefaultQoSR99_R4Negotiated(qosNegotiated); |
|
730 WaitForFsmQosChangeNotification(KContextId0, qosNegotiated); |
|
731 |
|
732 // |
|
733 // Clean-up |
|
734 // |
|
735 primaryPacketQos.Close(); |
|
736 iPrimaryPacketContext.Close(); |
|
737 |
|
738 FsmInputRequest(KContextId0, SpudMan::EContextDelete, 0); |
|
739 WaitForFsmInputResponse(KContextId0, KContextDeleteEvent, 0); |
|
740 |
|
741 DestroyPhoneAndPacketService(); |
|
742 |
|
743 return TestStepResult(); |
|
744 } |
|
745 |
|
746 CSpudFsmUnitNetworkDelete::~CSpudFsmUnitNetworkDelete() |
|
747 {} |
|
748 |
|
749 // configure to use test step 108 from simtsy config file |
|
750 CSpudFsmUnitNetworkDelete::CSpudFsmUnitNetworkDelete() : CSpudFsmUnitTestStepBase(108) |
|
751 { |
|
752 // Call base class method to set up the human readable name for logging |
|
753 SetTestStepName(KSpudFsmNetworkDelete); |
|
754 } |
|
755 |
|
756 TVerdict CSpudFsmUnitNetworkDelete::doTestStepL() |
|
757 /** |
|
758 Test context delete from network |
|
759 */ |
|
760 { |
|
761 INFO_PRINTF1(_L("Starting Spud Driver Unit test delete context from network")); |
|
762 |
|
763 // Start by creating all the Spud FSM objects. |
|
764 // They have to be created in the test's Active Scheduler Thread |
|
765 // (terminology from the test's design document). |
|
766 // |
|
767 FsmObjectCreate(KContextId0); |
|
768 WaitForFsmObjectCreateResponse(KContextId0); |
|
769 FsmObjectCreate(KContextId1); |
|
770 WaitForFsmObjectCreateResponse(KContextId1); |
|
771 |
|
772 // Set up context config and QoS parameters |
|
773 RPacketContext::TContextConfigGPRS contextConfigGPRS; |
|
774 DefaultContextConfigGPRS(contextConfigGPRS); |
|
775 iListener->iPdpFsmInterface->Set(KContextId0, contextConfigGPRS); |
|
776 iListener->iPdpFsmInterface->Set(KContextId1, contextConfigGPRS); |
|
777 |
|
778 #ifdef SYMBIAN_NETWORKING_UMTSR5 |
|
779 RPacketQoS::TQoSR5Requested qosRequested; |
|
780 DefaultQoSR5Requested(qosRequested); |
|
781 #else |
|
782 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
783 DefaultQoSR99_R4Requested(qosRequested); |
|
784 #endif |
|
785 |
|
786 iListener->iPdpFsmInterface->Set(KContextId0, qosRequested); |
|
787 iListener->iPdpFsmInterface->Set(KContextId1, qosRequested); |
|
788 |
|
789 // |
|
790 // Test context delete while an operation is pending |
|
791 // |
|
792 INFO_PRINTF1(_L("Test network delete context with pending operation")); |
|
793 // Activating the primary context is configured to take a very long time |
|
794 FsmInputRequest(KContextId0, SpudMan::ECreatePrimaryPDPContext, 0); |
|
795 // The packet service status will become attached almost immediately, but the create |
|
796 // primary context won't finish until it is active (which will take a long time) |
|
797 WaitForFsmServiceNotificationStatus(); |
|
798 |
|
799 // This delete from the network will occur while the create primary is activating |
|
800 EtelRequest(EContextStatusChange, 0); |
|
801 WaitForFsmInputResponse(KContextId0, KContextDeleteEvent, KErrNotReady); |
|
802 |
|
803 |
|
804 // |
|
805 // Test context delete while an operation is not pending |
|
806 // |
|
807 INFO_PRINTF1(_L("Test network delete context from open state")); |
|
808 // Activating this context is configured to take a short period of time |
|
809 FsmInputRequest(KContextId1, SpudMan::ECreatePrimaryPDPContext, 0); |
|
810 WaitForFsmInputResponse(KContextId1, KPrimaryContextCreated, KErrNone); |
|
811 |
|
812 EtelRequest(EContextStatusChange, 1); |
|
813 WaitForFsmInputResponse(KContextId1, KContextDeleteEvent, KErrNotReady); |
|
814 |
|
815 // context should be deleted (and resources freed), so no need to delete here |
|
816 |
|
817 return TestStepResult(); |
|
818 } |
|