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 TEL |
|
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 CSpudTelUnitNormalOperation::~CSpudTelUnitNormalOperation() |
|
35 {} |
|
36 |
|
37 // configure to use test step 1 from simtsy config file |
|
38 CSpudTelUnitNormalOperation::CSpudTelUnitNormalOperation() : CSpudTelUnitTestStepBase(1) |
|
39 { |
|
40 // Call base class method to set up the human readable name for logging |
|
41 SetTestStepName(KSpudTelUnitNormalOperation); |
|
42 } |
|
43 |
|
44 TVerdict CSpudTelUnitNormalOperation::doTestStepL() |
|
45 /** |
|
46 Test normal operation - test normal setqos (before and after context created) |
|
47 - test normal settft (before and after context created) |
|
48 - test normal create primary context |
|
49 - test normal create secondary context |
|
50 */ |
|
51 { |
|
52 INFO_PRINTF1(_L("Starting Spud Tel Test Normal Operation")); |
|
53 |
|
54 TRequestStatus status; |
|
55 RPacketService::TContextInfo contextInfo; |
|
56 |
|
57 InitPhoneAndPacketServiceL(); |
|
58 |
|
59 // |
|
60 // Test creating primary context |
|
61 // |
|
62 INFO_PRINTF1(_L("Test creating primary context")); |
|
63 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
64 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
65 |
|
66 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
67 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
68 |
|
69 // check that context was created - the simtsy creates the first primary context with name 'PRIMARY1' |
|
70 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
71 |
|
72 // check that context config for GPRS was set correctly |
|
73 RPacketContext::TContextConfigGPRS *contextConfig = new(ELeave) RPacketContext::TContextConfigGPRS; |
|
74 CleanupStack::PushL(contextConfig); |
|
75 TContextConfigGPRSPckg contextConfigPckg(*contextConfig); |
|
76 iPrimaryPacketContext.GetConfig(status, contextConfigPckg); |
|
77 User::WaitForRequest(status); |
|
78 RPacketContext::TContextConfigGPRS *defaultContextConfigGPRS = new(ELeave) RPacketContext::TContextConfigGPRS; |
|
79 CleanupStack::PushL(defaultContextConfigGPRS); |
|
80 DefaultContextConfigGPRS(*defaultContextConfigGPRS); |
|
81 TEST(CompareContextConfigGPRS(*defaultContextConfigGPRS, *contextConfig)); |
|
82 CleanupStack::PopAndDestroy(defaultContextConfigGPRS); |
|
83 CleanupStack::PopAndDestroy(contextConfig); |
|
84 |
|
85 |
|
86 // |
|
87 // Test creating secondary context |
|
88 // |
|
89 INFO_PRINTF1(_L("Test creating secondary context")); |
|
90 EtelDriverInputRequest( KContextId1, ECreate2ryPdpContext); |
|
91 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::E2ryPdpContextCreated); |
|
92 |
|
93 // check that context was created - the simtsy creates the first secondary context with name 'SECONDARY1' |
|
94 TEST(iSecondaryPacketContext.OpenExistingContext(iPacketService, KFirstSecondaryContextName) == KErrNone); |
|
95 |
|
96 |
|
97 // |
|
98 // Test setting and changing TFT |
|
99 // |
|
100 INFO_PRINTF1(_L("Test setting and changing TFT")); |
|
101 TTFTInfo *firstTftInfo = new(ELeave) TTFTInfo; |
|
102 CleanupStack::PushL(firstTftInfo); |
|
103 TTFTInfo *secondTftInfo = new(ELeave) TTFTInfo; |
|
104 CleanupStack::PushL(secondTftInfo); |
|
105 TTFTInfo *combinedTftInfo = new(ELeave) TTFTInfo; |
|
106 CleanupStack::PushL(combinedTftInfo); |
|
107 DefaultTftInfo(*firstTftInfo); |
|
108 SecondDefaultTftInfo(*secondTftInfo); |
|
109 CombinedDefaultTftInfo(*combinedTftInfo); |
|
110 |
|
111 // Test setting TFT |
|
112 iListener->iPdpFsmInterfaceTest->Set(KContextId0, KAddFilters); |
|
113 iListener->iPdpFsmInterfaceTest->Set(KContextId0, *firstTftInfo); |
|
114 EtelDriverInputRequest(KContextId0, ESetTft); |
|
115 WaitForEtelDriverInputResponse(KContextId0, PdpFsm::ETftSet); |
|
116 // check that TFT was set |
|
117 TTFTInfo expectedTftInfo; |
|
118 TEST(CompareTFTInfo(*firstTftInfo, iPrimaryPacketContext)); |
|
119 |
|
120 // Test re-setting TFT |
|
121 iListener->iPdpFsmInterfaceTest->Set(KContextId0, KAddFilters); |
|
122 iListener->iPdpFsmInterfaceTest->Set(KContextId0, *secondTftInfo); |
|
123 EtelDriverInputRequest(KContextId0, ESetTft); |
|
124 WaitForEtelDriverInputResponse(KContextId0, PdpFsm::ETftSet); |
|
125 // check that TFT was set |
|
126 TEST(CompareTFTInfo(*secondTftInfo, iPrimaryPacketContext)); |
|
127 |
|
128 // Test changing TFT (using KAddFilters) |
|
129 iListener->iPdpFsmInterfaceTest->Set(KContextId0, KAddFilters); |
|
130 iListener->iPdpFsmInterfaceTest->Set(KContextId0, *firstTftInfo); |
|
131 EtelDriverInputRequest(KContextId0, EChangeTft); |
|
132 WaitForEtelDriverInputResponse(KContextId0, PdpFsm::ETftChanged); |
|
133 // check that TFT was set |
|
134 TEST(CompareTFTInfo(*combinedTftInfo, iPrimaryPacketContext)); |
|
135 |
|
136 // Test setting TFT (using KRemoveFilters) |
|
137 iListener->iPdpFsmInterfaceTest->Set(KContextId0, KRemoveFilters); |
|
138 iListener->iPdpFsmInterfaceTest->Set(KContextId0, *firstTftInfo); |
|
139 EtelDriverInputRequest(KContextId0, EChangeTft); |
|
140 WaitForEtelDriverInputResponse(KContextId0, PdpFsm::ETftChanged); |
|
141 // check that TFT was set |
|
142 TEST(CompareTFTInfo(*secondTftInfo, iPrimaryPacketContext)); |
|
143 |
|
144 // Test setting TFT (using KDeleteTFT) |
|
145 iListener->iPdpFsmInterfaceTest->Set(KContextId0, KDeleteTFT); |
|
146 EtelDriverInputRequest(KContextId0, EChangeTft); |
|
147 WaitForEtelDriverInputResponse(KContextId0, PdpFsm::ETftChanged); |
|
148 // check that TFT was set |
|
149 TInt count; |
|
150 iPrimaryPacketContext.EnumeratePacketFilters(status, count); |
|
151 User::WaitForRequest(status); |
|
152 TEST(status == KErrNone); |
|
153 TEST(count == 0); |
|
154 CleanupStack::PopAndDestroy(combinedTftInfo); |
|
155 CleanupStack::PopAndDestroy(secondTftInfo); |
|
156 CleanupStack::PopAndDestroy(firstTftInfo); |
|
157 |
|
158 |
|
159 // |
|
160 // Test setting QOS |
|
161 // |
|
162 INFO_PRINTF1(_L("Test setting QOS")); |
|
163 EtelDriverInputRequest( KContextId1, ESetQoS); |
|
164 RPacketQoS::TQoSR99_R4Negotiated *defaultQoSR99_R4Negotiated = new(ELeave) RPacketQoS::TQoSR99_R4Negotiated; |
|
165 CleanupStack::PushL(defaultQoSR99_R4Negotiated); |
|
166 SecondQoSR99_R4Negotiated(*defaultQoSR99_R4Negotiated); |
|
167 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EQoSSet); |
|
168 RPacketQoS packetQos; |
|
169 // check that QOS was created - the simtsy creates the first QOS with name KFirstQosName |
|
170 TEST(packetQos.OpenExistingQoS(iSecondaryPacketContext, KFirstQosName) == KErrNone); |
|
171 // qos was created ok |
|
172 RPacketQoS::TQoSR99_R4Negotiated *qos = new(ELeave) RPacketQoS::TQoSR99_R4Negotiated; |
|
173 CleanupStack::PushL(qos); |
|
174 TQoSR99_R4NegotiatedPckg qosPckg(*qos); |
|
175 packetQos.GetProfileParameters(status, qosPckg); |
|
176 User::WaitForRequest(status); |
|
177 TEST(CompareUMTSQoSNeg(*defaultQoSR99_R4Negotiated, *qos)); |
|
178 CleanupStack::PopAndDestroy(qos); |
|
179 CleanupStack::PopAndDestroy(defaultQoSR99_R4Negotiated); |
|
180 packetQos.Close(); |
|
181 iSecondaryPacketContext.Close(); |
|
182 iPrimaryPacketContext.Close(); |
|
183 |
|
184 |
|
185 // |
|
186 // Test activating context |
|
187 // |
|
188 INFO_PRINTF1(_L("Test activating context")); |
|
189 EtelDriverInputRequest( KContextId1, EActivatePdp); |
|
190 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EPdpActivated); |
|
191 |
|
192 // test that context is set to activated |
|
193 TEST(CompareContextInfo(iPacketService, KFirstSecondaryContextName, RPacketContext::EStatusActive)); |
|
194 // make sure the data channel was set as well |
|
195 RPacketContext::TDataChannelV2 dataChannel; |
|
196 DefaultDataChannel(dataChannel); |
|
197 TEST(CompareDataChannel(iListener->iNotifyContextDataChannelData.iDataChannelV2, dataChannel)); |
|
198 |
|
199 |
|
200 // |
|
201 // Test modifying active context |
|
202 // |
|
203 INFO_PRINTF1(_L("Test modifying activate context")); |
|
204 EtelDriverInputRequest(KContextId1, EChangeTft); |
|
205 WaitForEtelDriverInputResponse(KContextId1, PdpFsm::ETftChanged); |
|
206 EtelDriverInputRequest( KContextId1, EModifyActive); |
|
207 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EPdpContextModified); |
|
208 |
|
209 |
|
210 // |
|
211 // Test deleting secondary context |
|
212 // |
|
213 INFO_PRINTF1(_L("Test deleting secondary context")); |
|
214 EtelDriverInputRequest( KContextId1, EContextDelete); |
|
215 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EContextDeleted); |
|
216 |
|
217 // make sure it is marked as deleted |
|
218 iPacketService.GetContextInfo(status, KContextId1, contextInfo); |
|
219 User::WaitForRequest(status); |
|
220 TEST(status == KErrNone && contextInfo.iStatus == RPacketContext::EStatusDeleted); |
|
221 |
|
222 |
|
223 // |
|
224 // Test deleting primary context |
|
225 // |
|
226 INFO_PRINTF1(_L("Test deleting primary context")); |
|
227 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
228 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
229 |
|
230 // make sure it is marked as deleted |
|
231 iPacketService.GetContextInfo(status, KContextId0, contextInfo); |
|
232 User::WaitForRequest(status); |
|
233 TEST(status == KErrNone && contextInfo.iStatus == RPacketContext::EStatusDeleted); |
|
234 |
|
235 DestroyPhoneAndPacketService(); |
|
236 |
|
237 return TestStepResult(); |
|
238 } |
|
239 |
|
240 CSpudTelUnitNotifications::~CSpudTelUnitNotifications() |
|
241 {} |
|
242 |
|
243 // configure to use test step 1 from simtsy config file |
|
244 CSpudTelUnitNotifications::CSpudTelUnitNotifications() : CSpudTelUnitTestStepBase(1) |
|
245 { |
|
246 // Call base class method to set up the human readable name for logging |
|
247 SetTestStepName(KSpudTelUnitNotifications); |
|
248 } |
|
249 |
|
250 TVerdict CSpudTelUnitNotifications::doTestStepL() |
|
251 /** |
|
252 Test notifications |
|
253 */ |
|
254 { |
|
255 INFO_PRINTF1(_L("Starting Spud Test Notifications")); |
|
256 |
|
257 TRequestStatus status; |
|
258 RPacketQoS packetQos; |
|
259 |
|
260 InitPhoneAndPacketServiceL(); |
|
261 |
|
262 // |
|
263 // setup test - create primary context and start notifications |
|
264 // |
|
265 INFO_PRINTF1(_L("setup test - create primary context and start notifications")); |
|
266 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
267 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
268 |
|
269 EtelDriverInputRequest( KContextId0, EActivatePdp); |
|
270 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPdpActivated); |
|
271 |
|
272 // check that context was created - the simtsy creates the first primary context with name 'PRIMARY1' |
|
273 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
274 |
|
275 // |
|
276 // Test service status notification |
|
277 // |
|
278 // the timing here may or may not allow us to recieve an 'activating' request |
|
279 WaitForGivenEtelContextStatusNotification(KContextId0, RPacketContext::EStatusActive); |
|
280 WaitForNextServiceNotificationStatus( RPacketService::EStatusActive); |
|
281 |
|
282 |
|
283 // |
|
284 // Test context config notification |
|
285 // |
|
286 INFO_PRINTF1(_L("Test context config notification")); |
|
287 RPacketContext::TContextConfigGPRS contextConfig; |
|
288 DefaultContextConfigGPRS(contextConfig); |
|
289 TContextConfigGPRSPckg contextConfigPckg(contextConfig); |
|
290 iPrimaryPacketContext.SetConfig(status, contextConfigPckg); |
|
291 User::WaitForRequest(status); |
|
292 |
|
293 WaitForNextContextConfigNotification(KContextId0, contextConfig); |
|
294 |
|
295 // check that QOS was created - the simtsy creates the first QOS with name KFirstQosName |
|
296 TEST(packetQos.OpenExistingQoS(iPrimaryPacketContext, KFirstQosName) == KErrNone); |
|
297 |
|
298 |
|
299 // |
|
300 // Test QOS notification |
|
301 // |
|
302 |
|
303 INFO_PRINTF1(_L("Test QOS notification")); |
|
304 RPacketQoS::TQoSR99_R4Requested qosRequested; |
|
305 DefaultQoSR99_R4Requested(qosRequested); |
|
306 RPacketQoS::TQoSR99_R4Negotiated qosNegotiated; |
|
307 SecondQoSR99_R4Negotiated(qosNegotiated); |
|
308 TQoSR99_R4RequestedPckg qosRequestedPckg(qosRequested); |
|
309 packetQos.SetProfileParameters(status, qosRequestedPckg); |
|
310 User::WaitForRequest(status); |
|
311 WaitForNextQosNotification(KContextId0, qosNegotiated); |
|
312 |
|
313 // clean up |
|
314 packetQos.Close(); |
|
315 iPrimaryPacketContext.Close(); |
|
316 |
|
317 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
318 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
319 WaitForNextServiceNotificationStatus(RPacketService::EStatusAttached); |
|
320 |
|
321 DestroyPhoneAndPacketService(); |
|
322 |
|
323 return TestStepResult(); |
|
324 } |
|
325 |
|
326 CSpudTelUnitCreatePrimaryError::~CSpudTelUnitCreatePrimaryError() |
|
327 { |
|
328 } |
|
329 |
|
330 // configure to use test step 3 from simtsy config file |
|
331 CSpudTelUnitCreatePrimaryError::CSpudTelUnitCreatePrimaryError() : CSpudTelUnitTestStepBase(3) |
|
332 { |
|
333 // Call base class method to set up the human readable name for logging |
|
334 SetTestStepName(KSpudTelUnitCreatePrimaryError); |
|
335 } |
|
336 |
|
337 TVerdict CSpudTelUnitCreatePrimaryError::doTestStepL() |
|
338 /** |
|
339 Errors with creating primary |
|
340 */ |
|
341 { |
|
342 INFO_PRINTF1(_L("Starting Spud Test Create Primary Context Error with SetConfig")); |
|
343 |
|
344 InitPhoneAndPacketServiceL(); |
|
345 |
|
346 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
347 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
348 |
|
349 // simtsy is configured to fail second RPacketContext::SetConfig |
|
350 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
351 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreatedFailed, KErrGeneral); |
|
352 |
|
353 // clean up |
|
354 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
355 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
356 |
|
357 DestroyPhoneAndPacketService(); |
|
358 |
|
359 return TestStepResult(); |
|
360 } |
|
361 |
|
362 CSpudTelUnitSetQosError::~CSpudTelUnitSetQosError() |
|
363 {} |
|
364 |
|
365 // configure to use test step 6 from simtsy config file |
|
366 CSpudTelUnitSetQosError::CSpudTelUnitSetQosError() : CSpudTelUnitTestStepBase(6) |
|
367 { |
|
368 // Call base class method to set up the human readable name for logging |
|
369 SetTestStepName(KSpudTelUnitSetQosError); |
|
370 } |
|
371 |
|
372 TVerdict CSpudTelUnitSetQosError::doTestStepL() |
|
373 /** |
|
374 Errors with setting QoS |
|
375 */ |
|
376 { |
|
377 INFO_PRINTF1(_L("Starting Spud Test Set QOS Error")); |
|
378 |
|
379 InitPhoneAndPacketServiceL(); |
|
380 |
|
381 // set test up |
|
382 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
383 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
384 |
|
385 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
386 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreatedFailed, KErrGeneral); |
|
387 |
|
388 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
389 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
390 |
|
391 DestroyPhoneAndPacketService(); |
|
392 |
|
393 return TestStepResult(); |
|
394 } |
|
395 |
|
396 CSpudTelUnitSetTftError::~CSpudTelUnitSetTftError() |
|
397 { |
|
398 } |
|
399 |
|
400 // configure to use test step 7 from simtsy config file |
|
401 CSpudTelUnitSetTftError::CSpudTelUnitSetTftError() : CSpudTelUnitTestStepBase(7) |
|
402 { |
|
403 // Call base class method to set up the human readable name for logging |
|
404 SetTestStepName(KSpudTelUnitSetTftError); |
|
405 } |
|
406 |
|
407 TVerdict CSpudTelUnitSetTftError::doTestStepL() |
|
408 /** |
|
409 Errors with setting TFT |
|
410 */ |
|
411 { |
|
412 INFO_PRINTF1(_L("Starting Spud Test Set TFT Error")); |
|
413 |
|
414 InitPhoneAndPacketServiceL(); |
|
415 |
|
416 // set test up |
|
417 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
418 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
419 |
|
420 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
421 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
422 |
|
423 // test error in RPacketQoS::CreateNewTFT |
|
424 EtelDriverInputRequest( KContextId0, ESetTft); |
|
425 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::ETftSetFailed, KErrGeneral); |
|
426 |
|
427 // test error in RPacketQoS::AddPacketFilter |
|
428 EtelDriverInputRequest( KContextId0, ESetTft); |
|
429 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::ETftSetFailed, KErrGeneral); |
|
430 |
|
431 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
432 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
433 |
|
434 DestroyPhoneAndPacketService(); |
|
435 |
|
436 return TestStepResult(); |
|
437 } |
|
438 |
|
439 CSpudTelUnitActivateError1::~CSpudTelUnitActivateError1() |
|
440 { |
|
441 } |
|
442 |
|
443 // configure to use test step 8 from simtsy config file |
|
444 CSpudTelUnitActivateError1::CSpudTelUnitActivateError1() : CSpudTelUnitTestStepBase(8) |
|
445 { |
|
446 // Call base class method to set up the human readable name for logging |
|
447 SetTestStepName(KSpudTelUnitActivateError1); |
|
448 } |
|
449 |
|
450 TVerdict CSpudTelUnitActivateError1::doTestStepL() |
|
451 /** |
|
452 * Errors with activating |
|
453 */ |
|
454 { |
|
455 INFO_PRINTF1(_L("Starting Spud Test Activate Error 1")); |
|
456 |
|
457 InitPhoneAndPacketServiceL(); |
|
458 |
|
459 // set test up |
|
460 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
461 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
462 |
|
463 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
464 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
465 |
|
466 // test error in RPacketContext::Activate |
|
467 EtelDriverInputRequest( KContextId0, EActivatePdp); |
|
468 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPdpActivatedFailed, KErrGeneral); |
|
469 |
|
470 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
471 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
472 |
|
473 DestroyPhoneAndPacketService(); |
|
474 |
|
475 return TestStepResult(); |
|
476 } |
|
477 |
|
478 CSpudTelUnitActivateError2::~CSpudTelUnitActivateError2() |
|
479 { |
|
480 } |
|
481 |
|
482 // configure to use test step 8 from simtsy config file |
|
483 CSpudTelUnitActivateError2::CSpudTelUnitActivateError2() : CSpudTelUnitTestStepBase(14) |
|
484 { |
|
485 // Call base class method to set up the human readable name for logging |
|
486 SetTestStepName(KSpudTelUnitActivateError2); |
|
487 } |
|
488 |
|
489 TVerdict CSpudTelUnitActivateError2::doTestStepL() |
|
490 /** |
|
491 * Errors with activating |
|
492 */ |
|
493 { |
|
494 INFO_PRINTF1(_L("Starting Spud Test Activate Error 2")); |
|
495 |
|
496 InitPhoneAndPacketServiceL(); |
|
497 |
|
498 // set test up |
|
499 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
500 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
501 |
|
502 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
503 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
504 |
|
505 // test error in RPacketContext::InitialiseContext |
|
506 EtelDriverInputRequest( KContextId0, EActivatePdp); |
|
507 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPdpActivatedFailed, KErrGeneral); |
|
508 |
|
509 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
510 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
511 |
|
512 DestroyPhoneAndPacketService(); |
|
513 |
|
514 return TestStepResult(); |
|
515 } |
|
516 |
|
517 CSpudTelUnitDeleteError1::~CSpudTelUnitDeleteError1() |
|
518 { |
|
519 } |
|
520 |
|
521 // configure to use test step 9 from simtsy config file |
|
522 CSpudTelUnitDeleteError1::CSpudTelUnitDeleteError1() : CSpudTelUnitTestStepBase(9) |
|
523 { |
|
524 // Call base class method to set up the human readable name for logging |
|
525 SetTestStepName(KSpudTelUnitDeleteError1); |
|
526 } |
|
527 |
|
528 TVerdict CSpudTelUnitDeleteError1::doTestStepL() |
|
529 /** |
|
530 Errors with deleting |
|
531 */ |
|
532 { |
|
533 INFO_PRINTF1(_L("Starting Spud Test Delete Error")); |
|
534 |
|
535 InitPhoneAndPacketServiceL(); |
|
536 |
|
537 // set test up phone, primary context, it's QoS parameters, and activate the context |
|
538 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
539 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
540 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
541 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
542 EtelDriverInputRequest( KContextId0, ESetQoS); |
|
543 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EQoSSet); |
|
544 EtelDriverInputRequest( KContextId0, EActivatePdp); |
|
545 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPdpActivated); |
|
546 |
|
547 // test error in RPacketContext::Deactivate |
|
548 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
549 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeletedFailed, KErrGeneral); |
|
550 |
|
551 DestroyPhoneAndPacketService(); |
|
552 |
|
553 return TestStepResult(); |
|
554 } |
|
555 |
|
556 CSpudTelUnitDeleteError2::~CSpudTelUnitDeleteError2() |
|
557 { |
|
558 } |
|
559 |
|
560 // configure to use test step 13 from simtsy config file |
|
561 CSpudTelUnitDeleteError2::CSpudTelUnitDeleteError2() : CSpudTelUnitTestStepBase(10) |
|
562 { |
|
563 // Call base class method to set up the human readable name for logging |
|
564 SetTestStepName(KSpudTelUnitDeleteError2); |
|
565 } |
|
566 |
|
567 TVerdict CSpudTelUnitDeleteError2::doTestStepL() |
|
568 /** |
|
569 Errors with deleting |
|
570 */ |
|
571 { |
|
572 INFO_PRINTF1(_L("Starting Spud Test Delete Error 2")); |
|
573 |
|
574 InitPhoneAndPacketServiceL(); |
|
575 |
|
576 // set test up |
|
577 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
578 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
579 |
|
580 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
581 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
582 EtelDriverInputRequest( KContextId0, EActivatePdp); |
|
583 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPdpActivated); |
|
584 |
|
585 // test error in RPacketContext::Delete |
|
586 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
587 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeletedFailed, KErrGeneral); |
|
588 |
|
589 DestroyPhoneAndPacketService(); |
|
590 |
|
591 return TestStepResult(); |
|
592 } |
|
593 |
|
594 CSpudTelUnitMultipleContexts::~CSpudTelUnitMultipleContexts() |
|
595 { |
|
596 } |
|
597 |
|
598 // configure to use test step 10 from simtsy config file |
|
599 CSpudTelUnitMultipleContexts::CSpudTelUnitMultipleContexts() : CSpudTelUnitTestStepBase(11) |
|
600 { |
|
601 // Call base class method to set up the human readable name for logging |
|
602 SetTestStepName(KSpudTelUnitMultipleContexts); |
|
603 } |
|
604 |
|
605 TVerdict CSpudTelUnitMultipleContexts::doTestStepL() |
|
606 /** |
|
607 Test multiple primary contexts with multiple secondary contexts |
|
608 */ |
|
609 { |
|
610 INFO_PRINTF1(_L("Starting Spud Test Multiple Contexts")); |
|
611 |
|
612 TRequestStatus status; |
|
613 |
|
614 InitPhoneAndPacketServiceL(); |
|
615 RPacketContext primaryPacketContext2, secondaryPacketContext2; |
|
616 |
|
617 EtelDriverInputRequest( KContextId0, EOpenPhone); |
|
618 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EPhoneOpened); |
|
619 |
|
620 // |
|
621 // Test creating multiple primary contexts |
|
622 // |
|
623 INFO_PRINTF1(_L("Test create first primary context")); |
|
624 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
625 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::E1ryPdpContextCreated); |
|
626 |
|
627 // check that context was created - the simtsy creates the first primary context with name 'PRIMARY1' |
|
628 TEST(iPrimaryPacketContext.OpenExistingContext(iPacketService, KFirstPrimaryContextName) == KErrNone); |
|
629 |
|
630 // check that context config for GPRS was set correctly |
|
631 RPacketContext::TContextConfigGPRS *contextConfig = new(ELeave) RPacketContext::TContextConfigGPRS; |
|
632 CleanupStack::PushL(contextConfig); |
|
633 TContextConfigGPRSPckg contextConfigPckg(*contextConfig); |
|
634 iPrimaryPacketContext.GetConfig(status, contextConfigPckg); |
|
635 User::WaitForRequest(status); |
|
636 RPacketContext::TContextConfigGPRS *defaultTestContextConfigGPRS = new(ELeave) RPacketContext::TContextConfigGPRS; |
|
637 CleanupStack::PushL(defaultTestContextConfigGPRS); |
|
638 DefaultContextConfigGPRS(*defaultTestContextConfigGPRS); |
|
639 TEST(CompareContextConfigGPRS(*defaultTestContextConfigGPRS, *contextConfig)); |
|
640 |
|
641 INFO_PRINTF1(_L("Test create second primary context")); |
|
642 EtelDriverInputRequest( KContextId1, ECreate1ryPdpContext); |
|
643 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::E1ryPdpContextCreated); |
|
644 |
|
645 // check that context was created - the simtsy creates the first primary context with name 'PRIMARY2' |
|
646 TEST(primaryPacketContext2.OpenExistingContext(iPacketService, KSecondPrimaryContextName) == KErrNone); |
|
647 |
|
648 // check that context config for GPRS was set correctly |
|
649 primaryPacketContext2.GetConfig(status, contextConfigPckg); |
|
650 User::WaitForRequest(status); |
|
651 TEST(CompareContextConfigGPRS(*defaultTestContextConfigGPRS, *contextConfig)); |
|
652 CleanupStack::PopAndDestroy(defaultTestContextConfigGPRS); |
|
653 CleanupStack::PopAndDestroy(contextConfig); |
|
654 |
|
655 |
|
656 // |
|
657 // Test creating secondary contexts on each primary context |
|
658 // |
|
659 INFO_PRINTF1(_L("Test create first secondary context")); |
|
660 EtelDriverInputRequest( KContextId2, ECreate2ryPdpContext); |
|
661 WaitForEtelDriverInputResponse( KContextId2, PdpFsm::E2ryPdpContextCreated); |
|
662 |
|
663 // check that context was created - the simtsy creates the first secondary context with name 'SECONDARY1' |
|
664 TEST(iSecondaryPacketContext.OpenExistingContext(iPacketService, KFirstSecondaryContextName) == KErrNone); |
|
665 |
|
666 INFO_PRINTF1(_L("Test create second secondary context")); |
|
667 EtelDriverInputRequest( KContextId3, ECreate2ryPdpContext); |
|
668 WaitForEtelDriverInputResponse( KContextId3, PdpFsm::E2ryPdpContextCreated); |
|
669 |
|
670 // check that context was created - the simtsy creates the first secondary context with name 'SECONDARY2' |
|
671 TEST(secondaryPacketContext2.OpenExistingContext(iPacketService, KSecondSecondaryContextName) == KErrNone); |
|
672 |
|
673 |
|
674 // |
|
675 // Test setting TFT (this time on secondary context) |
|
676 // |
|
677 INFO_PRINTF1(_L("Test setting TFT")); |
|
678 EtelDriverInputRequest( KContextId3, ESetTft); |
|
679 WaitForEtelDriverInputResponse( KContextId3, PdpFsm::ETftSet); |
|
680 |
|
681 // check that TFT was set |
|
682 TTFTInfo *expectedTftInfo = new(ELeave) TTFTInfo; |
|
683 CleanupStack::PushL(expectedTftInfo); |
|
684 DefaultTftInfo(*expectedTftInfo); |
|
685 TEST(CompareTFTInfo(*expectedTftInfo, secondaryPacketContext2)); |
|
686 CleanupStack::PopAndDestroy(expectedTftInfo); |
|
687 |
|
688 |
|
689 // |
|
690 // Test setting QOS (this time on primary context) |
|
691 // |
|
692 INFO_PRINTF1(_L("Test setting QOS")); |
|
693 EtelDriverInputRequest( KContextId1, ESetQoS); |
|
694 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EQoSSet); |
|
695 RPacketQoS packetQos; |
|
696 // check that QOS was created - the simtsy creates the first QOS with name KFirstQosName |
|
697 TEST(packetQos.OpenExistingQoS(primaryPacketContext2, KFirstQosName) == KErrNone); |
|
698 // qos was created ok |
|
699 RPacketQoS::TQoSR99_R4Negotiated *qos = new(ELeave) RPacketQoS::TQoSR99_R4Negotiated; |
|
700 CleanupStack::PushL(qos); |
|
701 TQoSR99_R4NegotiatedPckg qosPckg(*qos); |
|
702 packetQos.GetProfileParameters(status, qosPckg); |
|
703 User::WaitForRequest(status); |
|
704 RPacketQoS::TQoSR99_R4Negotiated *defaultTestTQoSR99_R4Negotiated = new(ELeave) RPacketQoS::TQoSR99_R4Negotiated; |
|
705 CleanupStack::PushL(defaultTestTQoSR99_R4Negotiated); |
|
706 SecondQoSR99_R4Negotiated(*defaultTestTQoSR99_R4Negotiated); |
|
707 TEST(CompareUMTSQoSNeg(*defaultTestTQoSR99_R4Negotiated, *qos)); |
|
708 packetQos.Close(); |
|
709 CleanupStack::PopAndDestroy(defaultTestTQoSR99_R4Negotiated); |
|
710 CleanupStack::PopAndDestroy(qos); |
|
711 primaryPacketContext2.Close(); |
|
712 secondaryPacketContext2.Close(); |
|
713 iPrimaryPacketContext.Close(); |
|
714 iSecondaryPacketContext.Close(); |
|
715 |
|
716 |
|
717 // |
|
718 // Test activating contexts |
|
719 // |
|
720 INFO_PRINTF1(_L("Test activating contexts")); |
|
721 EtelDriverInputRequest( KContextId1, EActivatePdp); |
|
722 // The service is now attached |
|
723 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EPdpActivated); |
|
724 |
|
725 // test that context is set to activated |
|
726 TEST(CompareContextInfo(iPacketService, KSecondPrimaryContextName, RPacketContext::EStatusActive)); |
|
727 RPacketContext::TDataChannelV2 dataChannel; |
|
728 DefaultDataChannel(dataChannel); |
|
729 TEST(CompareDataChannel(iListener->iNotifyContextDataChannelData.iDataChannelV2, dataChannel)); |
|
730 |
|
731 EtelDriverInputRequest( KContextId2, EActivatePdp); |
|
732 WaitForEtelDriverInputResponse( KContextId2, PdpFsm::EPdpActivated); |
|
733 |
|
734 // test that context is set to activated |
|
735 TEST(CompareContextInfo(iPacketService, KFirstSecondaryContextName, RPacketContext::EStatusActive)); |
|
736 |
|
737 |
|
738 // |
|
739 // Test deleting primary context before secondary contexts |
|
740 // |
|
741 INFO_PRINTF1(_L("Test deleting primary contexts before secondary contexts")); |
|
742 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
743 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
744 |
|
745 // make sure it is marked as deleted |
|
746 TEST(CompareContextInfo(iPacketService, KFirstPrimaryContextName, RPacketContext::EStatusDeleted)); |
|
747 |
|
748 EtelDriverInputRequest( KContextId1, EContextDelete); |
|
749 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EContextDeleted); |
|
750 |
|
751 // make sure it is marked as deleted |
|
752 TEST(CompareContextInfo(iPacketService, KSecondPrimaryContextName, RPacketContext::EStatusDeleted)); |
|
753 |
|
754 |
|
755 // |
|
756 // Test deleting secondary contexts |
|
757 // |
|
758 INFO_PRINTF1(_L("Test deleting secondary contexts")); |
|
759 EtelDriverInputRequest( KContextId2, EContextDelete); |
|
760 WaitForEtelDriverInputResponse( KContextId2, PdpFsm::EContextDeleted); |
|
761 |
|
762 // make sure it is marked as deleted |
|
763 TEST(CompareContextInfo(iPacketService, KFirstSecondaryContextName, RPacketContext::EStatusDeleted)); |
|
764 |
|
765 EtelDriverInputRequest( KContextId3, EContextDelete); |
|
766 WaitForEtelDriverInputResponse( KContextId3, PdpFsm::EContextDeleted); |
|
767 |
|
768 // make sure it is marked as deleted |
|
769 TEST(CompareContextInfo(iPacketService, KSecondSecondaryContextName, RPacketContext::EStatusDeleted)); |
|
770 |
|
771 DestroyPhoneAndPacketService(); |
|
772 |
|
773 return TestStepResult(); |
|
774 } |
|
775 |
|
776 CSpudTelUnitCancel::~CSpudTelUnitCancel() |
|
777 { |
|
778 } |
|
779 |
|
780 // configure to use test step 12 from simtsy config file |
|
781 CSpudTelUnitCancel::CSpudTelUnitCancel() : CSpudTelUnitTestStepBase(12) |
|
782 { |
|
783 // Call base class method to set up the human readable name for logging |
|
784 SetTestStepName(KSpudTelUnitCancel); |
|
785 } |
|
786 |
|
787 TVerdict CSpudTelUnitCancel::doTestStepL() |
|
788 /** |
|
789 Test cancelling operations |
|
790 */ |
|
791 { |
|
792 INFO_PRINTF1(_L("Starting Spud Test Cancel on Input Operations")); |
|
793 |
|
794 TRequestStatus timerStatus; |
|
795 RTimer timer; |
|
796 timer.CreateLocal(); |
|
797 |
|
798 InitPhoneAndPacketServiceL(); |
|
799 |
|
800 // |
|
801 // Test cancelling create primary request |
|
802 // |
|
803 INFO_PRINTF1(_L("Test cancelling create primary request")); |
|
804 EtelDriverInputRequest( KContextId0, ECreate1ryPdpContext); |
|
805 CancelPdpRequest(KContextId0); |
|
806 timer.After(timerStatus, 1500000); |
|
807 User::WaitForRequest(iListener->iEtelDriverInputResponseStatus, timerStatus); |
|
808 TEST(timerStatus == KErrNone && iListener->iEtelDriverInputResponseStatus == KRequestPending); |
|
809 |
|
810 |
|
811 // |
|
812 // Set up primary for upcoming tests |
|
813 // |
|
814 // |
|
815 INFO_PRINTF1(_L("Create primary")); |
|
816 EtelDriverInputRequest( KContextId1, ECreate1ryPdpContext); |
|
817 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::E1ryPdpContextCreated); |
|
818 |
|
819 // since creating secondary contains no asyncronous requests, the request cannot be cancelled |
|
820 //EtelDriverInputRequest( KContextId2, ECreate2ryPdpContext); |
|
821 //CancelPdpRequest(KContextId2); |
|
822 //timer.After(timerStatus, 1500000); |
|
823 //User::WaitForRequest(iListener->iEtelDriverInputResponseStatus, timerStatus); |
|
824 //TEST(iListener->iEtelDriverInputResponseStatus == KErrNone); |
|
825 |
|
826 |
|
827 // |
|
828 // Test cancelling set TFT |
|
829 // |
|
830 INFO_PRINTF1(_L("Test cancelling set TFT")); |
|
831 EtelDriverInputRequest( KContextId1, ESetTft); |
|
832 CancelPdpRequest(KContextId1); |
|
833 timer.After(timerStatus, 1500000); |
|
834 User::WaitForRequest(iListener->iEtelDriverInputResponseStatus, timerStatus); |
|
835 TEST(timerStatus == KErrNone && iListener->iEtelDriverInputResponseStatus == KRequestPending); |
|
836 |
|
837 |
|
838 // |
|
839 // Test cancelling set QOS |
|
840 // |
|
841 //INFO_PRINTF1(_L("Test cancelling set QOS")); |
|
842 //EtelDriverInputRequest( KContextId1, ESetQoS); |
|
843 //CancelPdpRequest(KContextId1); |
|
844 //timer.After(timerStatus, 1500000); |
|
845 //User::WaitForRequest(iListener->iEtelDriverInputResponseStatus, timerStatus); |
|
846 //TEST(timerStatus == KErrNone && iListener->iEtelDriverInputResponseStatus == KRequestPending); |
|
847 |
|
848 |
|
849 // |
|
850 // Test cancelling activate PDP |
|
851 // |
|
852 INFO_PRINTF1(_L("Test cancelling create secondary request")); |
|
853 EtelDriverInputRequest( KContextId1, EActivatePdp); |
|
854 CancelPdpRequest(KContextId1); |
|
855 timer.After(timerStatus, 1500000); |
|
856 User::WaitForRequest(iListener->iEtelDriverInputResponseStatus, timerStatus); |
|
857 TEST(timerStatus == KErrNone && iListener->iEtelDriverInputResponseStatus == KRequestPending); |
|
858 |
|
859 |
|
860 // |
|
861 // Test cancelling context delete |
|
862 // |
|
863 INFO_PRINTF1(_L("Test cancelling context delete")); |
|
864 EtelDriverInputRequest( KContextId1, EContextDelete); |
|
865 CancelPdpRequest(KContextId1); |
|
866 timer.After(timerStatus, 1500000); |
|
867 User::WaitForRequest(iListener->iEtelDriverInputResponseStatus, timerStatus); |
|
868 TEST(timerStatus == KErrNone && iListener->iEtelDriverInputResponseStatus == KRequestPending); |
|
869 |
|
870 // clean up |
|
871 EtelDriverInputRequest( KContextId0, EContextDelete); |
|
872 WaitForEtelDriverInputResponse( KContextId0, PdpFsm::EContextDeleted); |
|
873 EtelDriverInputRequest( KContextId1, EContextDelete); |
|
874 WaitForEtelDriverInputResponse( KContextId1, PdpFsm::EContextDeleted); |
|
875 |
|
876 DestroyPhoneAndPacketService(); |
|
877 |
|
878 timer.Close(); |
|
879 |
|
880 return TestStepResult(); |
|
881 } |
|