24
|
1 |
// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// This file implements all GPRS and Context test cases. The test cases are built
|
|
15 |
// for using against a Motorola GPRS and Ericsson T39/520 phones.
|
|
16 |
// All test cases that are in tgprsinter are also in this file.
|
|
17 |
//
|
|
18 |
//
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <e32test.h>
|
|
26 |
#include <c32comm.h>
|
|
27 |
#include "f32file.h"
|
|
28 |
#include <etel.h>
|
|
29 |
#include <es_sock.h>
|
|
30 |
#include <in_sock.h>
|
|
31 |
#include <etelqos.h>
|
|
32 |
#include <pcktcs.h>
|
|
33 |
#include "Te_Gprs.h"
|
|
34 |
|
|
35 |
|
|
36 |
CInitGlobals::CInitGlobals()
|
|
37 |
/** Each test step initialises it's own name
|
|
38 |
*/
|
|
39 |
{
|
|
40 |
// store the name of this test case
|
|
41 |
// this is the name that is used by the script file
|
|
42 |
SetTestStepName(_L("InitGlobals"));
|
|
43 |
}
|
|
44 |
|
|
45 |
enum TVerdict CInitGlobals::doTestStepL()
|
|
46 |
//LOCAL_C void InitGlobals()
|
|
47 |
/**
|
|
48 |
* Initialise global variables.
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
#ifdef __WINS__
|
|
52 |
User::After(5*KOneSecond); // allow emulator time to start up
|
|
53 |
#endif
|
|
54 |
|
|
55 |
const TPtrC phoneBrand = iTestConfigParam->FindAlphaVar(KTestCfgPhoneMake,KNullDesC);
|
|
56 |
if(phoneBrand != KTestCfgPhoneMotorola && phoneBrand != KTestCfgPhoneEricsson)
|
|
57 |
{
|
|
58 |
INFO_PRINTF1(_L("There is no phone specified in ini file or the phone is not supported"));
|
|
59 |
User::Panic(_L("There is no phone specified in ini file or the phone is not supported."), KErrNotSupported);
|
|
60 |
}
|
|
61 |
return TestStepResult();
|
|
62 |
}
|
|
63 |
|
|
64 |
CTestGprsDefaultContextParams::CTestGprsDefaultContextParams()
|
|
65 |
/** Each test step initialises it's own name
|
|
66 |
*/
|
|
67 |
{
|
|
68 |
// store the name of this test case
|
|
69 |
// this is the name that is used by the script file
|
|
70 |
SetTestStepName(_L("TestGprsDefaultContextParams"));
|
|
71 |
}
|
|
72 |
|
|
73 |
enum TVerdict CTestGprsDefaultContextParams::doTestStepL()
|
|
74 |
//LOCAL_C void GprsDefaultContextParamsTest()
|
|
75 |
/**
|
|
76 |
* This tests the default context params
|
|
77 |
*/
|
|
78 |
{
|
|
79 |
RPacketContext::TContextConfigGPRS setDefaultParams;
|
|
80 |
RPacketContext::TContextConfigGPRS getDefaultParams;
|
|
81 |
|
|
82 |
// Some default params to set, does not matter what it is.
|
|
83 |
_LIT8(KAccesspoint, "www.Symbian.com");
|
|
84 |
_LIT8(KPpdpaddress, "192.168.111.100");
|
|
85 |
|
|
86 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
87 |
CleanupClosePushL(iPacketService);
|
|
88 |
|
|
89 |
setDefaultParams.iPdpType = RPacketContext::EPdpTypeIPv4;
|
|
90 |
setDefaultParams.iAccessPointName = KAccesspoint;
|
|
91 |
setDefaultParams.iPdpAddress = KPpdpaddress;
|
|
92 |
setDefaultParams.iPdpCompression = 1;
|
|
93 |
|
|
94 |
TPckg<RPacketContext::TContextConfigGPRS> setcontextConfigPckg(setDefaultParams);
|
|
95 |
TPckg<RPacketContext::TContextConfigGPRS> getcontextConfigPckg(getDefaultParams);
|
|
96 |
TEST(iPacketService.SetDefaultContextParams(setcontextConfigPckg) == KErrNone);
|
|
97 |
TEST(iPacketService.GetDefaultContextParams(getcontextConfigPckg) == KErrNone);
|
|
98 |
TestConfigParams(setDefaultParams, getDefaultParams);
|
|
99 |
|
|
100 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
101 |
User::After(KFiveSeconds);
|
|
102 |
|
|
103 |
return TestStepResult();
|
|
104 |
}
|
|
105 |
|
|
106 |
|
|
107 |
CTestGprsUnSupported::CTestGprsUnSupported()
|
|
108 |
/** Each test step initialises it's own name
|
|
109 |
*/
|
|
110 |
{
|
|
111 |
// store the name of this test case
|
|
112 |
// this is the name that is used by the script file
|
|
113 |
SetTestStepName(_L("TestGprsUnSupported"));
|
|
114 |
}
|
|
115 |
|
|
116 |
enum TVerdict CTestGprsUnSupported::doTestStepL()
|
|
117 |
//LOCAL_C void GprsUnSupportedTest()
|
|
118 |
/**
|
|
119 |
* Tests all unsupported GPRS API calls to the TSY.
|
|
120 |
*/
|
|
121 |
{
|
|
122 |
TRequestStatus status;
|
|
123 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
124 |
CleanupClosePushL(iPacketService);
|
|
125 |
|
|
126 |
iPacketService.RejectActivationRequest(status);
|
|
127 |
|
|
128 |
User::WaitForRequest(status);
|
|
129 |
TEST(status.Int()== KErrNotSupported);
|
|
130 |
|
|
131 |
iPacketService.RejectActivationRequest(status);
|
|
132 |
iPacketService.CancelAsyncRequest(EPacketRejectActivationRequest);
|
|
133 |
User::WaitForRequest(status);
|
|
134 |
TEST(status.Int() == KErrNotSupported);
|
|
135 |
|
|
136 |
RPacketService::TMSClass msClass;
|
|
137 |
iPacketService.NotifyMSClassChange(status, msClass);
|
|
138 |
User::WaitForRequest(status);
|
|
139 |
TEST(status.Int() == KErrNotSupported);
|
|
140 |
|
|
141 |
RPacketService::TDynamicCapsFlags dynCaps;
|
|
142 |
TEST(iPacketService.GetDynamicCaps(dynCaps) == KErrNotSupported);
|
|
143 |
|
|
144 |
iPacketService.NotifyDynamicCapsChange(status, dynCaps);
|
|
145 |
User::WaitForRequest(status);
|
|
146 |
TEST(status.Int() == KErrNotSupported);
|
|
147 |
|
|
148 |
RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenPossible;
|
|
149 |
TEST(iPacketService.SetAttachMode(attachMode) == KErrNotSupported);
|
|
150 |
TEST(iPacketService.GetAttachMode(attachMode) == KErrNotSupported);
|
|
151 |
|
|
152 |
RPacketService::TRegistrationStatus registrationStatus = RPacketService::ERegisteredRoaming;
|
|
153 |
iPacketService.GetNtwkRegStatus(status, registrationStatus);
|
|
154 |
|
|
155 |
User::WaitForRequest(status);
|
|
156 |
TEST(status.Int() == KErrNone || status.Int() == KErrNotSupported);
|
|
157 |
|
|
158 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
159 |
User::After(KFiveSeconds);
|
|
160 |
|
|
161 |
return TestStepResult();
|
|
162 |
}
|
|
163 |
|
|
164 |
|
|
165 |
CTestGprsContextAttach::CTestGprsContextAttach()
|
|
166 |
/** Each test step initialises it's own name
|
|
167 |
*/
|
|
168 |
{
|
|
169 |
// store the name of this test case
|
|
170 |
// this is the name that is used by the script file
|
|
171 |
SetTestStepName(_L("TestGprsContextAttach"));
|
|
172 |
}
|
|
173 |
|
|
174 |
enum TVerdict CTestGprsContextAttach::doTestStepL()
|
|
175 |
/**
|
|
176 |
* This tests the context attach and detach
|
|
177 |
*/
|
|
178 |
{
|
|
179 |
TRequestStatus stat1;
|
|
180 |
TRequestStatus stat2;
|
|
181 |
TBuf<30> contextName;
|
|
182 |
RPacketContext::TContextStatus contextStatus;
|
|
183 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
184 |
CleanupClosePushL(iPacketService);
|
|
185 |
|
|
186 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
187 |
CleanupClosePushL(iPacketContext[0]);
|
|
188 |
|
|
189 |
iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
|
|
190 |
iPacketContext[0].CancelAsyncRequest(EPacketContextNotifyStatusChange);
|
|
191 |
User::WaitForRequest(stat1);
|
|
192 |
TEST(stat1.Int() == KErrCancel);
|
|
193 |
|
|
194 |
iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
|
|
195 |
|
|
196 |
iPacketContext[0].Activate(stat2);
|
|
197 |
User::WaitForRequest(stat2);
|
|
198 |
TEST_CHECKL(stat2.Int(), KErrNone,
|
|
199 |
_L("***Failed to activate context. Check that you are using correct SIM!***"));
|
|
200 |
|
|
201 |
User::WaitForRequest(stat1);
|
|
202 |
TEST(stat1.Int() == KErrNone);
|
|
203 |
TEST(contextStatus == RPacketContext::EStatusActivating);
|
|
204 |
iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
|
|
205 |
User::WaitForRequest(stat1);
|
|
206 |
TEST(stat1.Int() == KErrNone);
|
|
207 |
TEST(contextStatus == RPacketContext::EStatusActive);
|
|
208 |
|
|
209 |
iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
|
|
210 |
|
|
211 |
iPacketContext[0].Deactivate(stat2);
|
|
212 |
User::WaitForRequest(stat2);
|
|
213 |
TEST(stat2.Int() == KErrNone);
|
|
214 |
|
|
215 |
User::WaitForRequest(stat1);
|
|
216 |
TEST(stat1.Int() == KErrNone);
|
|
217 |
TEST(contextStatus == RPacketContext::EStatusDeactivating);
|
|
218 |
iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
|
|
219 |
User::WaitForRequest(stat1);
|
|
220 |
TEST(stat1.Int() == KErrNone);
|
|
221 |
TEST(contextStatus == RPacketContext::EStatusInactive);
|
|
222 |
|
|
223 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
224 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
225 |
User::After(KFiveSeconds);
|
|
226 |
|
|
227 |
return TestStepResult();
|
|
228 |
}
|
|
229 |
|
|
230 |
|
|
231 |
CTestGprsContextDelete::CTestGprsContextDelete()
|
|
232 |
/** Each test step initialises it's own name
|
|
233 |
*/
|
|
234 |
{
|
|
235 |
// store the name of this test case
|
|
236 |
// this is the name that is used by the script file
|
|
237 |
SetTestStepName(_L("TestGprsContextDelete"));
|
|
238 |
}
|
|
239 |
|
|
240 |
enum TVerdict CTestGprsContextDelete::doTestStepL()
|
|
241 |
//LOCAL_C void GprsContextDeleteTest()
|
|
242 |
/**
|
|
243 |
* This tests the context delete.
|
|
244 |
*/
|
|
245 |
{
|
|
246 |
TRequestStatus stat1;
|
|
247 |
TBuf<30> contextName;
|
|
248 |
RPacketContext::TContextStatus contextStatus;
|
|
249 |
|
|
250 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
251 |
CleanupClosePushL(iPacketService);
|
|
252 |
|
|
253 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
254 |
CleanupClosePushL(iPacketContext[0]);
|
|
255 |
|
|
256 |
iPacketContext[0].Delete(stat1);
|
|
257 |
User::WaitForRequest(stat1);
|
|
258 |
TEST(stat1.Int() == KErrNone);
|
|
259 |
|
|
260 |
iPacketContext[0].Activate(stat1);
|
|
261 |
User::WaitForRequest(stat1);
|
|
262 |
TEST(stat1.Int() == KErrAccessDenied);
|
|
263 |
|
|
264 |
TEST(iPacketContext[0].GetStatus(contextStatus) == KErrNone);
|
|
265 |
TEST(contextStatus == RPacketContext::EStatusDeleted);
|
|
266 |
|
|
267 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
268 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
269 |
User::After(KFiveSeconds);
|
|
270 |
|
|
271 |
return TestStepResult();
|
|
272 |
}
|
|
273 |
|
|
274 |
|
|
275 |
CTestGprsContextLoanComport::CTestGprsContextLoanComport()
|
|
276 |
/** Each test step initialises it's own name
|
|
277 |
*/
|
|
278 |
{
|
|
279 |
// store the name of this test case
|
|
280 |
// this is the name that is used by the script file
|
|
281 |
SetTestStepName(_L("TestGprsContextLoanComport"));
|
|
282 |
}
|
|
283 |
|
|
284 |
enum TVerdict CTestGprsContextLoanComport::doTestStepL()
|
|
285 |
//LOCAL_C void GprsContextLoanComport()
|
|
286 |
/**
|
|
287 |
* This tests the comport loan.
|
|
288 |
*/
|
|
289 |
{
|
|
290 |
TRequestStatus stat1;
|
|
291 |
TBuf<30> contextName;
|
|
292 |
RCall::TCommPort dataPort;
|
|
293 |
|
|
294 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
295 |
CleanupClosePushL(iPacketService);
|
|
296 |
|
|
297 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
298 |
CleanupClosePushL(iPacketContext[0]);
|
|
299 |
|
|
300 |
iPacketContext[0].RecoverCommPort(stat1);
|
|
301 |
User::WaitForRequest(stat1);
|
|
302 |
TEST(stat1.Int() == KErrEtelPortNotLoanedToClient);
|
|
303 |
|
|
304 |
iPacketContext[0].LoanCommPort(stat1, dataPort);
|
|
305 |
User::WaitForRequest(stat1);
|
|
306 |
TEST(stat1.Int() == KErrNotReady);
|
|
307 |
|
|
308 |
iPacketContext[0].Activate(stat1);
|
|
309 |
User::WaitForRequest(stat1);
|
|
310 |
TESTL(stat1.Int() == KErrNone);
|
|
311 |
|
|
312 |
iPacketContext[0].LoanCommPort(stat1, dataPort);
|
|
313 |
User::WaitForRequest(stat1);
|
|
314 |
TEST(stat1.Int() == KErrNone);
|
|
315 |
|
|
316 |
iPacketContext[0].Activate(stat1);
|
|
317 |
User::WaitForRequest(stat1);
|
|
318 |
TEST(stat1.Int() == KErrInUse);
|
|
319 |
|
|
320 |
iPacketContext[0].RecoverCommPort(stat1);
|
|
321 |
User::WaitForRequest(stat1);
|
|
322 |
TEST(stat1.Int() == KErrNone);
|
|
323 |
|
|
324 |
iPacketContext[0].Deactivate(stat1);
|
|
325 |
User::WaitForRequest(stat1);
|
|
326 |
TEST(stat1.Int() == KErrNone);
|
|
327 |
|
|
328 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
329 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
330 |
User::After(KFiveSeconds);
|
|
331 |
|
|
332 |
return TestStepResult();
|
|
333 |
}
|
|
334 |
|
|
335 |
|
|
336 |
CTestGprsContextUnSupported::CTestGprsContextUnSupported()
|
|
337 |
/** Each test step initialises it's own name
|
|
338 |
*/
|
|
339 |
{
|
|
340 |
// store the name of this test case
|
|
341 |
// this is the name that is used by the script file
|
|
342 |
SetTestStepName(_L("TestGprsContextUnSupported"));
|
|
343 |
}
|
|
344 |
|
|
345 |
enum TVerdict CTestGprsContextUnSupported::doTestStepL()
|
|
346 |
//LOCAL_C void GprsContextUnSupportedTest()
|
|
347 |
/**
|
|
348 |
* This tests all GPRS context API calls.
|
|
349 |
*/
|
|
350 |
{
|
|
351 |
TRequestStatus stat1;
|
|
352 |
TBuf<30> contextName;
|
|
353 |
TInt err = 0;
|
|
354 |
RPacketContext::TDataVolume volume;
|
|
355 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
356 |
CleanupClosePushL(iPacketService);
|
|
357 |
|
|
358 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
359 |
CleanupClosePushL(iPacketContext[0]);
|
|
360 |
|
|
361 |
TEST(iPacketContext[0].GetDataVolumeTransferred(volume) == KErrNotSupported);
|
|
362 |
iPacketContext[0].NotifyDataTransferred(stat1, volume);
|
|
363 |
User::WaitForRequest(stat1);
|
|
364 |
TEST(stat1.Int() == KErrNotSupported);
|
|
365 |
|
|
366 |
TEST(iPacketContext[0].GetLastErrorCause(err) == KErrNotSupported);
|
|
367 |
|
|
368 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
369 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
370 |
User::After(KFiveSeconds);
|
|
371 |
|
|
372 |
return TestStepResult();
|
|
373 |
}
|
|
374 |
|
|
375 |
CTestGprsAttach::CTestGprsAttach()
|
|
376 |
/** Each test step initialises it's own name
|
|
377 |
*/
|
|
378 |
{
|
|
379 |
// store the name of this test case
|
|
380 |
// this is the name that is used by the script file
|
|
381 |
SetTestStepName(_L("TestGprsAttach"));
|
|
382 |
}
|
|
383 |
|
|
384 |
enum TVerdict CTestGprsAttach::doTestStepL()
|
|
385 |
//LOCAL_C void GprsAttachTestL()
|
|
386 |
/**
|
|
387 |
* This tests the attach and detach.
|
|
388 |
*/
|
|
389 |
{
|
|
390 |
TRequestStatus stat1;
|
|
391 |
RPacketService::TStatus status;
|
|
392 |
|
|
393 |
User::LeaveIfError(iPacketService.Open(iPhone));
|
|
394 |
CleanupClosePushL(iPacketService);
|
|
395 |
|
|
396 |
iPacketService.Attach(stat1);
|
|
397 |
User::WaitForRequest(stat1);
|
|
398 |
TEST_CHECKL(stat1.Int(), KErrNone,
|
|
399 |
_L("***Failed to attach to packet service. Check that you are using correct SIM!***"));
|
|
400 |
|
|
401 |
iPacketService.GetStatus(status);
|
|
402 |
TEST_CHECKL(status,RPacketService::EStatusAttached,_L("Expected RPacketService::EStatusAttached"));
|
|
403 |
|
|
404 |
iPacketService.Detach(stat1);
|
|
405 |
User::WaitForRequest(stat1);
|
|
406 |
User::LeaveIfError(stat1.Int());
|
|
407 |
|
|
408 |
iPacketService.GetStatus(status);
|
|
409 |
TEST_CHECKL(status,RPacketService::EStatusUnattached,_L("Expected RPacketService::EStatusUnattached"));
|
|
410 |
|
|
411 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
412 |
User::After(KFiveSeconds);
|
|
413 |
|
|
414 |
return TestStepResult();
|
|
415 |
}
|
|
416 |
|
|
417 |
|
|
418 |
CTestGprsNotification::CTestGprsNotification()
|
|
419 |
/** Each test step initialises it's own name
|
|
420 |
*/
|
|
421 |
{
|
|
422 |
// store the name of this test case
|
|
423 |
// this is the name that is used by the script file
|
|
424 |
SetTestStepName(_L("TestGprsNotification"));
|
|
425 |
}
|
|
426 |
|
|
427 |
enum TVerdict CTestGprsNotification::doTestStepL()
|
|
428 |
//LOCAL_C void GprsNotificationTest()
|
|
429 |
/**
|
|
430 |
* Tests Notify Context added, Tests Notify status
|
|
431 |
*/
|
|
432 |
{
|
|
433 |
TRequestStatus stat1,stat2,stat3;
|
|
434 |
TBuf<20> context= _L("");
|
|
435 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
436 |
CleanupClosePushL(iPacketService);
|
|
437 |
|
|
438 |
TBuf<40> contextId;
|
|
439 |
|
|
440 |
iPacketService.NotifyContextAdded(stat1, contextId);
|
|
441 |
iPacketService.CancelAsyncRequest(EPacketNotifyContextAdded);
|
|
442 |
User::WaitForRequest(stat1);
|
|
443 |
TEST(stat1.Int()== KErrCancel);
|
|
444 |
iPacketService.NotifyContextAdded(stat1, contextId);
|
|
445 |
|
|
446 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, context) == KErrNone);
|
|
447 |
CleanupClosePushL(iPacketContext[0]);
|
|
448 |
|
|
449 |
User::WaitForRequest(stat1);
|
|
450 |
TEST(stat1.Int() == KErrNone);
|
|
451 |
|
|
452 |
RPacketService::TStatus gprsStatus;
|
|
453 |
iPacketService.NotifyStatusChange(stat2, gprsStatus);
|
|
454 |
iPacketService.CancelAsyncRequest(EPacketNotifyStatusChange);
|
|
455 |
User::WaitForRequest(stat2);
|
|
456 |
TEST(stat2.Int() == KErrCancel);
|
|
457 |
|
|
458 |
iPacketService.NotifyStatusChange(stat2, gprsStatus);
|
|
459 |
iPacketService.Attach(stat1);
|
|
460 |
User::WaitForRequest(stat1);
|
|
461 |
TEST_CHECKL(stat1.Int(), KErrNone,
|
|
462 |
_L("***Failed to attach to packet service. Check that you are using correct SIM!***"));
|
|
463 |
User::WaitForRequest(stat2);
|
|
464 |
TEST(stat2.Int() == KErrNone);
|
|
465 |
TEST(gprsStatus == RPacketService::EStatusAttached);
|
|
466 |
|
|
467 |
User::After(1000000); // Delay to allow phone to settle
|
|
468 |
|
|
469 |
iPacketService.NotifyStatusChange(stat3, gprsStatus);
|
|
470 |
iPacketService.Detach(stat1);
|
|
471 |
User::WaitForRequest(stat1);
|
|
472 |
TEST(stat1.Int() == KErrNone);
|
|
473 |
User::WaitForRequest(stat3);
|
|
474 |
TEST(stat3.Int() == KErrNone);
|
|
475 |
TEST(gprsStatus == RPacketService::EStatusUnattached);
|
|
476 |
|
|
477 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
478 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
479 |
User::After(KFiveSeconds);
|
|
480 |
|
|
481 |
return TestStepResult();
|
|
482 |
}
|
|
483 |
|
|
484 |
CTestGprsMsClass::CTestGprsMsClass()
|
|
485 |
/** Each test step initialises it's own name
|
|
486 |
*/
|
|
487 |
{
|
|
488 |
// store the name of this test case
|
|
489 |
// this is the name that is used by the script file
|
|
490 |
SetTestStepName(_L("TestGprsMsClass"));
|
|
491 |
}
|
|
492 |
|
|
493 |
enum TVerdict CTestGprsMsClass::doTestStepL()
|
|
494 |
//LOCAL_C void GprsMsClassTest()
|
|
495 |
/**
|
|
496 |
* This tests the MS Class.
|
|
497 |
*/
|
|
498 |
{
|
|
499 |
TRequestStatus stat1;
|
|
500 |
|
|
501 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
502 |
CleanupClosePushL(iPacketService);
|
|
503 |
|
|
504 |
RPacketService::TMSClass currentClass;
|
|
505 |
RPacketService::TMSClass maxClass;
|
|
506 |
iPacketService.GetMSClass(stat1, currentClass, maxClass);
|
|
507 |
User::WaitForRequest(stat1);
|
|
508 |
TEST(stat1.Int() == KErrNone);
|
|
509 |
|
|
510 |
const TPtrC phoneBrand = iTestConfigParam->FindAlphaVar(KTestCfgPhoneMake,KNullDesC);
|
|
511 |
if(phoneBrand == KTestCfgPhoneMotorola)
|
|
512 |
{
|
|
513 |
iPacketService.SetMSClass(stat1, currentClass);
|
|
514 |
User::WaitForRequest(stat1);
|
|
515 |
TEST(stat1.Int() == KErrNone);
|
|
516 |
TEST(currentClass == RPacketService::EMSClassSuspensionRequired);
|
|
517 |
TEST(maxClass == RPacketService::EMSClassSuspensionRequired);
|
|
518 |
}
|
|
519 |
|
|
520 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
521 |
User::After(KFiveSeconds);
|
|
522 |
|
|
523 |
return TestStepResult();
|
|
524 |
}
|
|
525 |
|
|
526 |
|
|
527 |
|
|
528 |
CTestGprsContextConfig::CTestGprsContextConfig()
|
|
529 |
/** Each test step initialises it's own name
|
|
530 |
*/
|
|
531 |
{
|
|
532 |
// store the name of this test case
|
|
533 |
// this is the name that is used by the script file
|
|
534 |
SetTestStepName(_L("TestGprsContextConfig"));
|
|
535 |
}
|
|
536 |
|
|
537 |
enum TVerdict CTestGprsContextConfig::doTestStepL()
|
|
538 |
//LOCAL_C void GprsContextConfigTest()
|
|
539 |
/**
|
|
540 |
* Test context config.
|
|
541 |
*/
|
|
542 |
{
|
|
543 |
TRequestStatus stat1;
|
|
544 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
545 |
CleanupClosePushL(iPacketService);
|
|
546 |
|
|
547 |
TBuf<30> contextName;
|
|
548 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
549 |
CleanupClosePushL(iPacketContext[0]);
|
|
550 |
TESTL(iPacketContext[1].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
551 |
CleanupClosePushL(iPacketContext[1]);
|
|
552 |
|
|
553 |
RPacketContext::TContextConfigGPRS Getparams;
|
|
554 |
RPacketContext::TContextConfigGPRS Setparams;
|
|
555 |
TPckg<RPacketContext::TContextConfigGPRS> GetcontextConfigPckg(Getparams);
|
|
556 |
iPacketContext[0].GetConfig(stat1, GetcontextConfigPckg);
|
|
557 |
User::WaitForRequest(stat1);
|
|
558 |
TEST(stat1.Int() == KErrNone);
|
|
559 |
Setparams = Getparams;
|
|
560 |
|
|
561 |
TPckg<RPacketContext::TContextConfigGPRS> SetcontextConfigPckg(Setparams);
|
|
562 |
iPacketContext[0].SetConfig(stat1, SetcontextConfigPckg);
|
|
563 |
User::WaitForRequest(stat1);
|
|
564 |
TEST(stat1.Int() == KErrNone);
|
|
565 |
iPacketContext[1].SetConfig(stat1, SetcontextConfigPckg);
|
|
566 |
User::WaitForRequest(stat1);
|
|
567 |
TEST(stat1.Int() == KErrNone);
|
|
568 |
iPacketContext[0].GetConfig(stat1, SetcontextConfigPckg);
|
|
569 |
User::WaitForRequest(stat1);
|
|
570 |
TEST(stat1.Int() == KErrNone);
|
|
571 |
TestConfigParams(Getparams, Setparams);
|
|
572 |
|
|
573 |
TRequestStatus stat;
|
|
574 |
iPacketContext[0].SetConfig(stat, SetcontextConfigPckg);
|
|
575 |
iPacketContext[0].CancelAsyncRequest(EPacketContextSetConfig);
|
|
576 |
User::WaitForRequest(stat);
|
|
577 |
TEST(stat.Int() == KErrCancel);
|
|
578 |
|
|
579 |
iPacketContext[0].GetConfig(stat, GetcontextConfigPckg);
|
|
580 |
iPacketContext[0].CancelAsyncRequest(EPacketContextGetConfig);
|
|
581 |
User::WaitForRequest(stat);
|
|
582 |
TEST(stat.Int() == KErrCancel);
|
|
583 |
|
|
584 |
Setparams.iPdpType = RPacketContext::TProtocolType(20); // Set out of range
|
|
585 |
TPckg<RPacketContext::TContextConfigGPRS> errorPackage(Setparams);
|
|
586 |
iPacketContext[0].SetConfig(stat1, errorPackage);
|
|
587 |
User::WaitForRequest(stat1);
|
|
588 |
TEST(stat1.Int() == KErrNotSupported);
|
|
589 |
|
|
590 |
CleanupStack::PopAndDestroy(&iPacketContext[1]);
|
|
591 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
592 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
593 |
User::After(KFiveSeconds);
|
|
594 |
|
|
595 |
return TestStepResult();
|
|
596 |
}
|
|
597 |
|
|
598 |
|
|
599 |
CTestGprsContextConfigNotifications::CTestGprsContextConfigNotifications()
|
|
600 |
/** Each test step initialises it's own name
|
|
601 |
*/
|
|
602 |
{
|
|
603 |
// store the name of this test case
|
|
604 |
// this is the name that is used by the script file
|
|
605 |
SetTestStepName(_L("TestGprsContextConfigNotifications"));
|
|
606 |
}
|
|
607 |
|
|
608 |
enum TVerdict CTestGprsContextConfigNotifications::doTestStepL()
|
|
609 |
//LOCAL_C void GprsContextConfigNotificationsTest()
|
|
610 |
/**
|
|
611 |
* Test context notifications.
|
|
612 |
*/
|
|
613 |
{
|
|
614 |
TRequestStatus stat1, stat2;
|
|
615 |
TBuf<30> contextName;
|
|
616 |
RPacketContext::TContextConfigGPRS params, notifyParams;
|
|
617 |
TPckg<RPacketContext::TContextConfigGPRS> contextConfigPckg(params);
|
|
618 |
TPckg<RPacketContext::TContextConfigGPRS> notifyContextConfigPckg(notifyParams);
|
|
619 |
|
|
620 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
621 |
CleanupClosePushL(iPacketService);
|
|
622 |
|
|
623 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
624 |
CleanupClosePushL(iPacketContext[0]);
|
|
625 |
TESTL(iPacketContext[1].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
626 |
CleanupClosePushL(iPacketContext[1]);
|
|
627 |
|
|
628 |
iPacketContext[0].NotifyConfigChanged(stat1, notifyContextConfigPckg);
|
|
629 |
iPacketContext[0].CancelAsyncRequest(EPacketContextNotifyConfigChanged);
|
|
630 |
User::WaitForRequest(stat1);
|
|
631 |
TEST(stat1.Int() == KErrCancel);
|
|
632 |
|
|
633 |
iPacketContext[0].GetConfig(stat1, contextConfigPckg);
|
|
634 |
User::WaitForRequest(stat1);
|
|
635 |
TEST(stat1.Int() == KErrNone);
|
|
636 |
iPacketContext[0].NotifyConfigChanged(stat1, notifyContextConfigPckg);
|
|
637 |
|
|
638 |
iPacketContext[0].SetConfig(stat2, contextConfigPckg);
|
|
639 |
User::WaitForRequest(stat2);
|
|
640 |
TEST(stat2.Int() == KErrNone);
|
|
641 |
|
|
642 |
User::WaitForRequest(stat1);
|
|
643 |
TEST(stat1.Int() == KErrNone);
|
|
644 |
TestConfigParams(params, notifyParams);
|
|
645 |
|
|
646 |
CleanupStack::PopAndDestroy(&iPacketContext[1]);
|
|
647 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
648 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
649 |
User::After(KFiveSeconds);
|
|
650 |
|
|
651 |
return TestStepResult();
|
|
652 |
}
|
|
653 |
|
|
654 |
|
|
655 |
CTestOpenGprsMaxContexts::CTestOpenGprsMaxContexts()
|
|
656 |
/** Each test step initialises it's own name
|
|
657 |
*/
|
|
658 |
{
|
|
659 |
// store the name of this test case
|
|
660 |
// this is the name that is used by the script file
|
|
661 |
SetTestStepName(_L("TestOpenGprsMaxContexts"));
|
|
662 |
}
|
|
663 |
|
|
664 |
enum TVerdict CTestOpenGprsMaxContexts::doTestStepL()
|
|
665 |
//LOCAL_C void OpenGprsMaxContextsTest()
|
|
666 |
/**
|
|
667 |
* Tests enumerate contexts, open new context, open existing context.
|
|
668 |
*/
|
|
669 |
{
|
|
670 |
TRequestStatus stat1;
|
|
671 |
TBuf<20> contextName = _L("");
|
|
672 |
|
|
673 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
674 |
CleanupClosePushL(iPacketService);
|
|
675 |
|
|
676 |
TInt countContexts;
|
|
677 |
TInt maxAllowedContexts;
|
|
678 |
iPacketService.EnumerateContexts(stat1, countContexts, maxAllowedContexts);
|
|
679 |
User::WaitForRequest(stat1);
|
|
680 |
TEST(countContexts == 0);
|
|
681 |
|
|
682 |
const TPtrC phoneBrand = iTestConfigParam->FindAlphaVar(KTestCfgPhoneMake,KNullDesC);
|
|
683 |
if(phoneBrand == KTestCfgPhoneMotorola)
|
|
684 |
TEST(maxAllowedContexts == 3);
|
|
685 |
else if(phoneBrand == KTestCfgPhoneEricsson)
|
|
686 |
TEST(maxAllowedContexts == 10);
|
|
687 |
|
|
688 |
TInt i = 0;
|
|
689 |
RPacketService::TContextInfo contextinfo;
|
|
690 |
|
|
691 |
for(i = 0; i < maxAllowedContexts;i++)
|
|
692 |
{
|
|
693 |
RPacketContext contextPacket;
|
|
694 |
TBuf<30> tmpContextName;
|
|
695 |
tmpContextName = _L("GPRS_CONTEXT");
|
|
696 |
tmpContextName.AppendNum(i+1);
|
|
697 |
TESTL(iPacketContext[i].OpenNewContext(iPacketService, contextName) == KErrNone);
|
|
698 |
iPacketService.GetContextInfo(stat1, i, contextinfo);
|
|
699 |
User::WaitForRequest(stat1);
|
|
700 |
TEST(contextinfo.iName == tmpContextName);
|
|
701 |
TEST(contextinfo.iStatus == RPacketContext::EStatusUnknown);
|
|
702 |
TESTL(contextPacket.OpenExistingContext(iPacketService, contextName) == KErrNone);
|
|
703 |
TEST(contextName == tmpContextName);
|
|
704 |
contextPacket.Close();
|
|
705 |
}
|
|
706 |
TESTL(iPacketContext[i+5].OpenNewContext(iPacketService, contextName) == KErrOverflow);
|
|
707 |
|
|
708 |
iPacketService.GetContextInfo(stat1, i+1, contextinfo);
|
|
709 |
User::WaitForRequest(stat1);
|
|
710 |
TEST(stat1.Int() == KErrArgument);
|
|
711 |
for(i = 0; i < maxAllowedContexts;i++)
|
|
712 |
{
|
|
713 |
iPacketContext[i].Close();
|
|
714 |
}
|
|
715 |
|
|
716 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
717 |
User::After(KFiveSeconds);
|
|
718 |
|
|
719 |
return TestStepResult();
|
|
720 |
}
|
|
721 |
|
|
722 |
|
|
723 |
|
|
724 |
CTestGprsCancel::CTestGprsCancel()
|
|
725 |
/** Each test step initialises it's own name
|
|
726 |
*/
|
|
727 |
{
|
|
728 |
// store the name of this test case
|
|
729 |
// this is the name that is used by the script file
|
|
730 |
SetTestStepName(_L("TestGprsCancel"));
|
|
731 |
}
|
|
732 |
|
|
733 |
enum TVerdict CTestGprsCancel::doTestStepL()
|
|
734 |
//LOCAL_C void GprsCancelTest()
|
|
735 |
/**
|
|
736 |
* This test will call all GPRS API calls
|
|
737 |
* that can be canceled with an outstanding request
|
|
738 |
* to the phone.
|
|
739 |
*/
|
|
740 |
{
|
|
741 |
TRequestStatus stat;
|
|
742 |
|
|
743 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
744 |
CleanupClosePushL(iPacketService);
|
|
745 |
|
|
746 |
iPacketService.Attach(stat);
|
|
747 |
iPacketService.CancelAsyncRequest(EPacketAttach);
|
|
748 |
User::WaitForRequest(stat);
|
|
749 |
TEST(stat.Int() == KErrCancel);
|
|
750 |
|
|
751 |
iPacketService.Detach(stat);
|
|
752 |
iPacketService.CancelAsyncRequest(EPacketDetach);
|
|
753 |
User::WaitForRequest(stat);
|
|
754 |
TEST(stat.Int() == KErrCancel);
|
|
755 |
|
|
756 |
RPacketService::TMSClass currentClass;
|
|
757 |
RPacketService::TMSClass maxClass;
|
|
758 |
|
|
759 |
iPacketService.GetMSClass(stat, currentClass, maxClass);
|
|
760 |
iPacketService.CancelAsyncRequest(EPacketGetMSClass);
|
|
761 |
User::WaitForRequest(stat);
|
|
762 |
TEST((stat.Int() == KErrCancel)||(stat.Int() == KErrNone));
|
|
763 |
|
|
764 |
currentClass = RPacketService::EMSClassSuspensionRequired;
|
|
765 |
iPacketService.SetMSClass(stat, currentClass);
|
|
766 |
iPacketService.CancelAsyncRequest(EPacketSetMSClass);
|
|
767 |
User::WaitForRequest(stat);
|
|
768 |
TEST(stat.Int() == KErrCancel);
|
|
769 |
|
|
770 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
771 |
User::After(KFiveSeconds);
|
|
772 |
|
|
773 |
return TestStepResult();
|
|
774 |
}
|
|
775 |
|
|
776 |
CTestGprsfaxCancel::CTestGprsfaxCancel()
|
|
777 |
/** Each test step initialises it's own name
|
|
778 |
*/
|
|
779 |
{
|
|
780 |
// store the name of this test case
|
|
781 |
// this is the name that is used by the script file
|
|
782 |
SetTestStepName(_L("TestGprsfaxCancel"));
|
|
783 |
}
|
|
784 |
|
|
785 |
enum TVerdict CTestGprsfaxCancel::doTestStepL()
|
|
786 |
//LOCAL_C void TestGprsfaxCancel()
|
|
787 |
/**
|
|
788 |
* This function tests the opening of 2 call objects
|
|
789 |
* and doing a hang-up on them while there is a
|
|
790 |
* GPRS object in the system.
|
|
791 |
*/
|
|
792 |
{
|
|
793 |
TBuf<100> Context;
|
|
794 |
TRequestStatus stat1, stat2;
|
|
795 |
Context = _L("");
|
|
796 |
_LIT(KFaxLineName,"Fax");
|
|
797 |
_LIT(KVoiceLineName,"Voice");
|
|
798 |
|
|
799 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
800 |
CleanupClosePushL(iPacketService);
|
|
801 |
|
|
802 |
RLine faxLine;
|
|
803 |
RCall call;
|
|
804 |
RCall call2;
|
|
805 |
RLine voiceLine;
|
|
806 |
TName callName;
|
|
807 |
|
|
808 |
faxLine.Open(iPhone ,KFaxLineName);
|
|
809 |
CleanupClosePushL(faxLine);
|
|
810 |
voiceLine.Open(iPhone ,KVoiceLineName);
|
|
811 |
CleanupClosePushL(voiceLine);
|
|
812 |
|
|
813 |
TESTL(iPhone.Initialise()==KErrNone);
|
|
814 |
faxLine.NotifyIncomingCall(stat1,callName);
|
|
815 |
faxLine.NotifyIncomingCallCancel();
|
|
816 |
voiceLine.NotifyIncomingCall(stat2,callName);
|
|
817 |
voiceLine.NotifyIncomingCallCancel();
|
|
818 |
User::WaitForRequest(stat1);
|
|
819 |
User::WaitForRequest(stat2);
|
|
820 |
|
|
821 |
TEST(call.OpenNewCall(voiceLine)==KErrNone);
|
|
822 |
CleanupClosePushL(call);
|
|
823 |
TEST(call.HangUp()==KErrNone);
|
|
824 |
|
|
825 |
TEST(call2.OpenNewCall(faxLine)==KErrNone);
|
|
826 |
CleanupClosePushL(call2);
|
|
827 |
TEST(call2.HangUp()==KErrNone);
|
|
828 |
|
|
829 |
CleanupStack::PopAndDestroy(&call2);
|
|
830 |
CleanupStack::PopAndDestroy(&call);
|
|
831 |
CleanupStack::PopAndDestroy(&voiceLine);
|
|
832 |
CleanupStack::PopAndDestroy(&faxLine);
|
|
833 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
834 |
User::After(KFiveSeconds);
|
|
835 |
|
|
836 |
return TestStepResult();
|
|
837 |
}
|
|
838 |
|
|
839 |
|
|
840 |
CTestOpenContextByName::CTestOpenContextByName()
|
|
841 |
/** Each test step initialises it's own name
|
|
842 |
*/
|
|
843 |
{
|
|
844 |
// store the name of this test case
|
|
845 |
// this is the name that is used by the script file
|
|
846 |
SetTestStepName(_L("TestOpenContextByName"));
|
|
847 |
}
|
|
848 |
|
|
849 |
enum TVerdict CTestOpenContextByName::doTestStepL()
|
|
850 |
//LOCAL_C void TestOpenContextByNameL()
|
|
851 |
/**
|
|
852 |
* This test should verify that defect SHY-54SNHT is fixed.
|
|
853 |
*/
|
|
854 |
{
|
|
855 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
856 |
CleanupClosePushL(iPacketService);
|
|
857 |
|
|
858 |
TBuf<30> contextName;
|
|
859 |
TESTL(iPacketContext[0].OpenNewContext(iPacketService,contextName) == KErrNone);
|
|
860 |
CleanupClosePushL(iPacketContext[0]);
|
|
861 |
TESTL(iPacketContext[1].OpenExistingContext(iPacketService,contextName) == KErrNone);
|
|
862 |
CleanupClosePushL(iPacketContext[1]);
|
|
863 |
|
|
864 |
CleanupStack::PopAndDestroy(&iPacketContext[1]);
|
|
865 |
CleanupStack::PopAndDestroy(&iPacketContext[0]);
|
|
866 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
867 |
User::After(KFiveSeconds);
|
|
868 |
|
|
869 |
return TestStepResult();
|
|
870 |
}
|
|
871 |
|
|
872 |
|
|
873 |
CTestNetworkRegStatus::CTestNetworkRegStatus()
|
|
874 |
/** Each test step initialises it's own name
|
|
875 |
*/
|
|
876 |
{
|
|
877 |
// store the name of this test case
|
|
878 |
// this is the name that is used by the script file
|
|
879 |
SetTestStepName(_L("TestNetworkRegStatus"));
|
|
880 |
}
|
|
881 |
|
|
882 |
enum TVerdict CTestNetworkRegStatus::doTestStepL()
|
|
883 |
//LOCAL_C void TestNetworkRegStatusL()
|
|
884 |
/**
|
|
885 |
* This test does a basic test on the Get Current Network
|
|
886 |
* Registration Status functionality.
|
|
887 |
*/
|
|
888 |
{
|
|
889 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
890 |
CleanupClosePushL(iPacketService);
|
|
891 |
|
|
892 |
RPacketService::TRegistrationStatus regStatus;
|
|
893 |
TRequestStatus status;
|
|
894 |
iPacketService.GetNtwkRegStatus(status,regStatus);
|
|
895 |
User::WaitForRequest(status);
|
|
896 |
if(status!=KErrNone && status!=KErrNotSupported) // Do not consider KErrNotSupported a failure
|
|
897 |
{
|
|
898 |
iPacketService.Close();
|
|
899 |
User::Leave(status.Int());
|
|
900 |
}
|
|
901 |
|
|
902 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
903 |
User::After(KFiveSeconds);
|
|
904 |
|
|
905 |
return TestStepResult();
|
|
906 |
}
|
|
907 |
|
|
908 |
|
|
909 |
CTestGetStaticCaps::CTestGetStaticCaps()
|
|
910 |
/** Each test step initialises it's own name
|
|
911 |
*/
|
|
912 |
{
|
|
913 |
// store the name of this test case
|
|
914 |
// this is the name that is used by the script file
|
|
915 |
SetTestStepName(_L("TestGetStaticCaps"));
|
|
916 |
}
|
|
917 |
|
|
918 |
enum TVerdict CTestGetStaticCaps::doTestStepL()
|
|
919 |
//LOCAL_C void TestGetStaticCapsL()
|
|
920 |
/**
|
|
921 |
* Simple test for RPacketService::GetStaticCaps
|
|
922 |
*/
|
|
923 |
{
|
|
924 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
925 |
CleanupClosePushL(iPacketService);
|
|
926 |
|
|
927 |
//
|
|
928 |
// Call RPacketService::GetStaticCaps with EPdpTypeIPv6
|
|
929 |
// We would expect this call to fail with KErrNotSupported
|
|
930 |
TUint caps(0); // Create and initialise caps
|
|
931 |
TInt ret=iPacketService.GetStaticCaps(caps,RPacketContext::EPdpTypeIPv6);
|
|
932 |
TEST_CHECKL(ret,KErrNotSupported,_L("Expected KErrNotSupported for GetStaticCaps with EPdpTypeIPv6"));
|
|
933 |
|
|
934 |
//
|
|
935 |
// Call RPacketService::GetStaticCaps
|
|
936 |
caps=0; // Intialise caps
|
|
937 |
TESTL(iPacketService.GetStaticCaps(caps, RPacketContext::EPdpTypeIPv4) == KErrNone);
|
|
938 |
|
|
939 |
//
|
|
940 |
// Validate caps returned by GetStaticCaps.
|
|
941 |
// (we know what the values should be as they specified in the MMTSY design document
|
|
942 |
// are harcoded in the MMTSY)
|
|
943 |
TEST_CHECKL(caps,RPacketService::KCapsSetDefaultContextSupported|RPacketService::KCapsMSClassSupported,_L("Unexpcted Static Caps"));
|
|
944 |
|
|
945 |
CleanupStack::PopAndDestroy(&iPacketService);
|
|
946 |
User::After(KFiveSeconds);
|
|
947 |
|
|
948 |
return TestStepResult();
|
|
949 |
}
|
|
950 |
|
|
951 |
|
|
952 |
CTestOpenExistingContext::CTestOpenExistingContext()
|
|
953 |
/** Each test step initialises it's own name
|
|
954 |
*/
|
|
955 |
{
|
|
956 |
// store the name of this test case
|
|
957 |
// this is the name that is used by the script file
|
|
958 |
SetTestStepName(_L("TestOpenExistingContext"));
|
|
959 |
}
|
|
960 |
|
|
961 |
enum TVerdict CTestOpenExistingContext::doTestStepL()
|
|
962 |
//LOCAL_C void TestOpenExistingContextL()
|
|
963 |
/**
|
|
964 |
* Simple test for RPacketService::OpenExistingContext.
|
|
965 |
* This test should verify the fix for defect SHY-54SNHT.
|
|
966 |
* If SHY-54SNHT has not been fixed an access violation will occur in Etel during the
|
|
967 |
* OPenExistingContext call.
|
|
968 |
*/
|
|
969 |
{
|
|
970 |
RPacketService packetService;
|
|
971 |
TESTL(packetService.Open(iPhone) == KErrNone);
|
|
972 |
CleanupClosePushL(packetService);
|
|
973 |
|
|
974 |
// Open context using an invalid context name (call should fail with KErrNotFound)
|
|
975 |
RPacketContext context;
|
|
976 |
_LIT(KUnknownContextName,"NonExistantContext");
|
|
977 |
TInt ret=context.OpenExistingContext(packetService,KUnknownContextName);
|
|
978 |
CHECKPOINT(ret,KErrNotFound,_L("RPacketContext::OpenExistingContext did not fail when it should have"));
|
|
979 |
|
|
980 |
CleanupStack::PopAndDestroy(&packetService);
|
|
981 |
User::After(KFiveSeconds);
|
|
982 |
|
|
983 |
return TestStepResult();
|
|
984 |
}
|
|
985 |
|
|
986 |
CTestGprsDownloadWebPage::CTestGprsDownloadWebPage()
|
|
987 |
/** Each test step initialises it's own name
|
|
988 |
*/
|
|
989 |
{
|
|
990 |
// store the name of this test case
|
|
991 |
// this is the name that is used by the script file
|
|
992 |
SetTestStepName(_L("TestGprsDownloadWebbPage"));
|
|
993 |
}
|
|
994 |
|
|
995 |
enum TVerdict CTestGprsDownloadWebPage::doTestStepL()
|
|
996 |
//LOCAL_C void GprsDownloadWebbPageTestL()
|
|
997 |
|
|
998 |
/**
|
|
999 |
* This test will open a socket and download a
|
|
1000 |
* page/file that is specified by KTestCfgHTTPServerIpAddress
|
|
1001 |
* and KTestCfgHTTPPageAddress
|
|
1002 |
*
|
|
1003 |
*/
|
|
1004 |
|
|
1005 |
{
|
|
1006 |
// Constants used for this test.
|
|
1007 |
const TInt KWebPort = 80;
|
|
1008 |
const TPtrC testAddr = iTestConfigParam->FindAlphaVar(KTestCfgHTTPServerIpAddress,KNullDesC);
|
|
1009 |
const TPtrC testPage = iTestConfigParam->FindAlphaVar(KTestCfgHTTPPageAddress,KNullDesC);
|
|
1010 |
|
|
1011 |
HBufC8* iWebPage = HBufC8::NewMaxL(4096);
|
|
1012 |
CleanupStack::PushL(iWebPage);
|
|
1013 |
|
|
1014 |
INFO_PRINTF1(_L("Send HTML request"));
|
|
1015 |
RSocket sock;
|
|
1016 |
INFO_PRINTF1(_L("Open tcpip socket"));
|
|
1017 |
TESTL(sock.Open(iSocketServer, KAfInet, KSockStream, KProtocolInetTcp) == KErrNone);
|
|
1018 |
CleanupClosePushL(sock);
|
|
1019 |
|
|
1020 |
TInetAddr addr(KWebPort);
|
|
1021 |
addr.Input(testAddr);
|
|
1022 |
TRequestStatus stat;
|
|
1023 |
|
|
1024 |
INFO_PRINTF1(_L("Connecting to socket"));
|
|
1025 |
sock.Connect(addr, stat);
|
|
1026 |
WaitWithTimeout(stat);
|
|
1027 |
TESTL(stat.Int() == KErrNone);
|
|
1028 |
|
|
1029 |
// List the route to the server.
|
|
1030 |
INFO_PRINTF1(_L("List the route to the server"));
|
|
1031 |
ListRoutes(sock);
|
|
1032 |
|
|
1033 |
TPtr8 des(iWebPage->Des());
|
|
1034 |
des.Copy(_L("GET"));
|
|
1035 |
des.Append(testPage);
|
|
1036 |
des.Append(_L(" \r\n\r\n"));
|
|
1037 |
|
|
1038 |
INFO_PRINTF1(_L("Writing data to socket"));
|
|
1039 |
sock.Write(*iWebPage, stat);
|
|
1040 |
WaitWithTimeout(stat);
|
|
1041 |
TESTL(stat.Int() == KErrNone);
|
|
1042 |
INFO_PRINTF1(_L("Sent request OK"));
|
|
1043 |
|
|
1044 |
TSockXfrLength HTTPHeaderLen;
|
|
1045 |
TInt rcount = 0;
|
|
1046 |
TTime startTime;
|
|
1047 |
startTime.UniversalTime();
|
|
1048 |
FOREVER
|
|
1049 |
{
|
|
1050 |
des.Zero();
|
|
1051 |
sock.RecvOneOrMore(des,0,stat,HTTPHeaderLen);
|
|
1052 |
User::WaitForRequest(stat);//, readStat);
|
|
1053 |
if(stat!=KErrNone)
|
|
1054 |
break;
|
|
1055 |
rcount += iWebPage->Length();
|
|
1056 |
// gTest.Console()->SetPos(0);
|
|
1057 |
INFO_PRINTF2(_L("\rRecved:%10d Bytes"), rcount);
|
|
1058 |
}
|
|
1059 |
|
|
1060 |
if(stat.Int() != KErrEof)
|
|
1061 |
User::Leave(KErrEof);
|
|
1062 |
|
|
1063 |
// Calculate the number of bytes per second.
|
|
1064 |
TTime stopTime;
|
|
1065 |
stopTime.UniversalTime();
|
|
1066 |
TTimeIntervalMicroSeconds totalTime = stopTime.MicroSecondsFrom(startTime);
|
|
1067 |
TInt64 byteRate(rcount);
|
|
1068 |
byteRate *= KOneSecond;
|
|
1069 |
byteRate /=totalTime.Int64();
|
|
1070 |
INFO_PRINTF1(_L(""));
|
|
1071 |
INFO_PRINTF2(_L("Rate: %d B/s"), I64INT(byteRate));
|
|
1072 |
INFO_PRINTF1(_L("Received HTML page OK"));
|
|
1073 |
|
|
1074 |
// Close the socket.
|
|
1075 |
CleanupStack::PopAndDestroy(&sock);
|
|
1076 |
// Stop the agent so that the we will be disconnected from the network.
|
|
1077 |
// gGenericAgent.Stop();
|
|
1078 |
iConnection.Stop();
|
|
1079 |
User::After(KFiveSeconds);
|
|
1080 |
|
|
1081 |
// Delete the webpage buffer.
|
|
1082 |
CleanupStack::PopAndDestroy(iWebPage);
|
|
1083 |
User::After(KFiveSeconds * 10);
|
|
1084 |
return TestStepResult();
|
|
1085 |
}
|
|
1086 |
|
|
1087 |
TInt CTestGprsDownloadWebPage::ListRoutes(RSocket& aSocket)
|
|
1088 |
/**
|
|
1089 |
* This function lists all the hops that the packet
|
|
1090 |
* needs to make to reach the port on the server.
|
|
1091 |
*/
|
|
1092 |
{
|
|
1093 |
|
|
1094 |
TPckgBuf<TSoInetRouteInfo> opt;
|
|
1095 |
TInt ret;
|
|
1096 |
ret = aSocket.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl);
|
|
1097 |
if (ret!=KErrNone)
|
|
1098 |
return ret;
|
|
1099 |
|
|
1100 |
while (ret==KErrNone)
|
|
1101 |
{
|
|
1102 |
ret = aSocket.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, opt);
|
|
1103 |
if (ret!=KErrNone)
|
|
1104 |
continue;
|
|
1105 |
TBuf<40> ia, ga, da, nm;
|
|
1106 |
opt().iDstAddr.Output(da);
|
|
1107 |
opt().iNetMask.Output(nm);
|
|
1108 |
opt().iGateway.Output(ga);
|
|
1109 |
opt().iIfAddr.Output(ia);
|
|
1110 |
INFO_PRINTF5(_L("Destination=%15S NetMask=%15S Gateway=%15S Interface=%15S"),
|
|
1111 |
&da, &nm, &ga, &ia);
|
|
1112 |
INFO_PRINTF4(_L("State=%d Metric=%d Type=%d"),
|
|
1113 |
opt().iState, opt().iMetric, opt().iType);
|
|
1114 |
}
|
|
1115 |
return ret==KErrEof ? KErrNone : ret;
|
|
1116 |
}
|
|
1117 |
|
|
1118 |
void CTestGprsDownloadWebPage::WaitWithTimeout(TRequestStatus& aStatus)
|
|
1119 |
/** Waits untill end or request or time out
|
|
1120 |
* @param request itself
|
|
1121 |
* @param number Of microseconds
|
|
1122 |
*/
|
|
1123 |
{
|
|
1124 |
TRequestStatus timerStatus;
|
|
1125 |
RTimer timer;
|
|
1126 |
timer.CreateLocal() ;
|
|
1127 |
|
|
1128 |
const TInt KOneSecondInMicroSeconds=1000000L;
|
|
1129 |
timer.After(timerStatus,240*KOneSecondInMicroSeconds); // x second timer
|
|
1130 |
|
|
1131 |
User::WaitForRequest(aStatus, timerStatus);
|
|
1132 |
|
|
1133 |
// Cancel timer if it did not complete
|
|
1134 |
if (timerStatus == KRequestPending)
|
|
1135 |
{
|
|
1136 |
timer.Cancel();
|
|
1137 |
User::WaitForRequest(timerStatus);
|
|
1138 |
}
|
|
1139 |
else
|
|
1140 |
{
|
|
1141 |
aStatus=-999; // Hopefully -999 reported in the test result log will make it obvious
|
|
1142 |
// that the request was cancelled due to it taking to long
|
|
1143 |
INFO_PRINTF1(_L("User::WaitForRequest cancelled as it did not complete within a reasonable time"));
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
timer.Close() ;
|
|
1147 |
}
|
|
1148 |
|
|
1149 |
/**
|
|
1150 |
Each test step initialises it's own name
|
|
1151 |
*/
|
|
1152 |
CTest2GprsConnection::CTest2GprsConnection()
|
|
1153 |
{
|
|
1154 |
// store the name of this test case
|
|
1155 |
// this is the name that is used by the script file
|
|
1156 |
SetTestStepName(_L("Test2GprsConnection"));
|
|
1157 |
}
|
|
1158 |
|
|
1159 |
/**
|
|
1160 |
* This test case will open 2 GPRS connection and will check wheteher
|
|
1161 |
* it is able to open 2 connection or not. This test case is needed
|
|
1162 |
* because the behavior of opening connection differs in Netcon if
|
|
1163 |
* Connection preference dialog was set.
|
|
1164 |
* If the connection preference was set:
|
|
1165 |
* Netcon will prompt the user to select the correct IAP.
|
|
1166 |
* Sends request to TSY to get MSClass and NetworkRegStatus.
|
|
1167 |
*
|
|
1168 |
* Note : In case of MM.TSY, the above scenario might create problem
|
|
1169 |
* due to loaning and recovering commport concept. After 1st
|
|
1170 |
* connection establishment, commport was loaned to transfer
|
|
1171 |
* the data so when MM.TSY receives MSClass and NetworkRegStatus
|
|
1172 |
* request it might declined that request which will cause 2nd
|
|
1173 |
* connection to fail.
|
|
1174 |
*
|
|
1175 |
* In case of other TSY this might not create problem due to different
|
|
1176 |
* commport implementation concept.
|
|
1177 |
*
|
|
1178 |
*/
|
|
1179 |
enum TVerdict CTest2GprsConnection::doTestStepL()
|
|
1180 |
{
|
|
1181 |
TInt err;
|
|
1182 |
RConnection conn1;
|
|
1183 |
TESTL(conn1.Open(iSocketServer)==KErrNone);
|
|
1184 |
CleanupClosePushL(conn1);
|
|
1185 |
TInt ret=conn1.Start();
|
|
1186 |
TESTL(ret==KErrNone);
|
|
1187 |
|
|
1188 |
RSocket sock1;
|
|
1189 |
err = sock1.Open(iSocketServer, KAfInet, KSockStream, KProtocolInetTcp, conn1);
|
|
1190 |
if (err!=KErrNone)
|
|
1191 |
{
|
|
1192 |
conn1.Stop();
|
|
1193 |
}
|
|
1194 |
TESTL(err==KErrNone);
|
|
1195 |
CleanupClosePushL(sock1);
|
|
1196 |
|
|
1197 |
_LIT(KAddr1,"64.233.161.147");
|
|
1198 |
const TInt KPort = 80;
|
|
1199 |
|
|
1200 |
TInetAddr destAddr1;
|
|
1201 |
destAddr1.Input(KAddr1);
|
|
1202 |
destAddr1.SetPort(KPort);
|
|
1203 |
|
|
1204 |
TRequestStatus status1;
|
|
1205 |
// Request the Socket to connect to the destination
|
|
1206 |
sock1.Connect(destAddr1, status1);
|
|
1207 |
User::WaitForRequest(status1);
|
|
1208 |
if (status1.Int()!=KErrNone)
|
|
1209 |
{
|
|
1210 |
conn1.Stop();
|
|
1211 |
}
|
|
1212 |
TESTL(status1.Int() == KErrNone);
|
|
1213 |
|
|
1214 |
RConnection conn2;
|
|
1215 |
err=conn2.Open(iSocketServer);
|
|
1216 |
if (err!=KErrNone)
|
|
1217 |
{
|
|
1218 |
conn1.Stop();
|
|
1219 |
}
|
|
1220 |
TESTL(err==KErrNone);
|
|
1221 |
CleanupClosePushL(conn2);
|
|
1222 |
err=conn2.Start();
|
|
1223 |
if (err!=KErrNone)
|
|
1224 |
{
|
|
1225 |
conn1.Stop();
|
|
1226 |
}
|
|
1227 |
TESTL(err==KErrNone);
|
|
1228 |
|
|
1229 |
RSocket sock2;
|
|
1230 |
err=sock2.Open(iSocketServer, KAfInet, KSockStream, KProtocolInetTcp, conn2);
|
|
1231 |
if (err!=KErrNone)
|
|
1232 |
{
|
|
1233 |
conn2.Stop();
|
|
1234 |
conn1.Stop();
|
|
1235 |
}
|
|
1236 |
TESTL(err==KErrNone);
|
|
1237 |
CleanupClosePushL(sock2);
|
|
1238 |
|
|
1239 |
_LIT(KAddr2,"68.142.226.53");
|
|
1240 |
|
|
1241 |
TInetAddr destAddr2;
|
|
1242 |
destAddr2.Input(KAddr2);
|
|
1243 |
destAddr2.SetPort(KPort);
|
|
1244 |
|
|
1245 |
// Request the Socket to connect to the destination
|
|
1246 |
sock2.Connect(destAddr2, status1);
|
|
1247 |
User::WaitForRequest(status1);
|
|
1248 |
if (status1.Int()!=KErrNone)
|
|
1249 |
{
|
|
1250 |
conn2.Stop();
|
|
1251 |
conn1.Stop();
|
|
1252 |
}
|
|
1253 |
TESTL(status1.Int() == KErrNone);
|
|
1254 |
|
|
1255 |
CleanupStack::PopAndDestroy(&sock2);
|
|
1256 |
conn2.Stop();
|
|
1257 |
User::After(KFiveSeconds);
|
|
1258 |
CleanupStack::PopAndDestroy(&conn2);
|
|
1259 |
CleanupStack::PopAndDestroy(&sock1);
|
|
1260 |
conn1.Stop();
|
|
1261 |
User::After(KFiveSeconds);
|
|
1262 |
CleanupStack::PopAndDestroy(&conn1);
|
|
1263 |
|
|
1264 |
return TestStepResult();
|
|
1265 |
}
|