24
|
1 |
// Copyright (c) 2001-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 |
// EtelPacketTest.cpp
|
|
15 |
// This contains EtelPacket TestCase Test 1.1 (RPacketService functionality testing)
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
// Symbian OS includes
|
|
20 |
#include <e32base.h>
|
|
21 |
|
|
22 |
#include <etelpckt.h>
|
|
23 |
#include <pcktcs.h>
|
|
24 |
|
|
25 |
#include "Te_EtelPacketTestStepBase.h"
|
|
26 |
|
|
27 |
#include "testdef.h"
|
|
28 |
|
|
29 |
#include "Te_EtelPacketTest1_1.h"
|
|
30 |
#include "Te_etelpckt_defs.h"
|
|
31 |
|
|
32 |
// constructor
|
|
33 |
CEtelPacketTest1_1::CEtelPacketTest1_1()
|
|
34 |
{
|
|
35 |
// store the name of this test case
|
|
36 |
SetTestStepName(_L("Service"));
|
|
37 |
}
|
|
38 |
|
|
39 |
// destructor
|
|
40 |
CEtelPacketTest1_1::~CEtelPacketTest1_1()
|
|
41 |
{
|
|
42 |
}
|
|
43 |
|
|
44 |
// do Test step 1.1
|
|
45 |
enum TVerdict CEtelPacketTest1_1::doTestStepL( void )
|
|
46 |
{
|
|
47 |
RPhone phone;
|
|
48 |
TInt ret=phone.Open(iTelServer,DPCKTTSY_PHONE_NAME);
|
|
49 |
CHECKPOINT_EX(ret==KErrNone,CHP_OPEN_PHONE);
|
|
50 |
RPacketService gprs;
|
|
51 |
ret=gprs.Open(phone);
|
|
52 |
CHECKPOINT(ret,KErrNone,CHP_SRVS_CASE("A.1"));
|
|
53 |
|
|
54 |
TRequestStatus reqStatus;
|
|
55 |
|
|
56 |
TBuf16<20> contextId;
|
|
57 |
|
|
58 |
gprs.NotifyContextAdded(reqStatus, contextId);
|
|
59 |
User::WaitForRequest(reqStatus);
|
|
60 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.21"));
|
|
61 |
CHECKPOINT_COMP_STR(contextId,DPCKTTSY_CONTEXT_ID,CHP_SRVS_CASE("A.21"));
|
|
62 |
|
|
63 |
gprs.NotifyContextAdded(reqStatus, contextId);
|
|
64 |
gprs.CancelAsyncRequest(EPacketNotifyContextAdded);
|
|
65 |
User::WaitForRequest(reqStatus);
|
|
66 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.21"));
|
|
67 |
// Attach
|
|
68 |
gprs.Attach(reqStatus);
|
|
69 |
User::WaitForRequest(reqStatus);
|
|
70 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.2"));
|
|
71 |
|
|
72 |
gprs.Attach(reqStatus);
|
|
73 |
gprs.CancelAsyncRequest(EPacketAttach);
|
|
74 |
User::WaitForRequest(reqStatus);
|
|
75 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.2"));
|
|
76 |
//Detach
|
|
77 |
gprs.Detach(reqStatus);
|
|
78 |
User::WaitForRequest(reqStatus);
|
|
79 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.3"));
|
|
80 |
|
|
81 |
gprs.Detach(reqStatus);
|
|
82 |
gprs.CancelAsyncRequest(EPacketDetach);
|
|
83 |
User::WaitForRequest(reqStatus);
|
|
84 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.3"));
|
|
85 |
//Gprs status
|
|
86 |
RPacketService::TStatus gprsStatus;
|
|
87 |
CHECKPOINT(gprs.GetStatus(gprsStatus),KErrNone,CHP_SRVS_CASE("A.6"));
|
|
88 |
CHECKPOINT(gprsStatus,DPCKTTSY_PACKET_STATUS1,CHP_SRVS_CASE("A.6"));
|
|
89 |
|
|
90 |
gprs.NotifyStatusChange(reqStatus,gprsStatus);
|
|
91 |
User::WaitForRequest(reqStatus);
|
|
92 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.7"));
|
|
93 |
CHECKPOINT(gprsStatus,DPCKTTSY_PACKET_STATUS2,CHP_SRVS_CASE("A.7"));
|
|
94 |
|
|
95 |
gprs.NotifyStatusChange(reqStatus,gprsStatus);
|
|
96 |
gprs.CancelAsyncRequest(EPacketNotifyStatusChange);
|
|
97 |
User::WaitForRequest(reqStatus);
|
|
98 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.7"));
|
|
99 |
//Context Activation
|
|
100 |
RPacketContext::TContextConfigGPRS contextNotify;
|
|
101 |
TPckg<RPacketContext::TContextConfigGPRS> contextNotifyPckg(contextNotify);
|
|
102 |
|
|
103 |
gprs.NotifyContextActivationRequested(reqStatus, contextNotifyPckg);
|
|
104 |
User::WaitForRequest(reqStatus);
|
|
105 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.8"));
|
|
106 |
CHECKPOINT(contextNotify.iPdpType,DPCKTTSY_PDP_TYPE1,CHP_SRVS_CASE("A.8"));
|
|
107 |
CHECKPOINT_COMP_STR(contextNotify.iPdpAddress,DPCKTTSY_PDP_ADDRESS1,CHP_SRVS_CASE("A.8"));
|
|
108 |
CHECKPOINT_COMP_STR(contextNotify.iAccessPointName,DPCKTTSY_ACCESS_POINT1,CHP_SRVS_CASE("A.8"));
|
|
109 |
CHECKPOINT(contextNotify.iUseEdge,DPCKTTSY_EGPRS_REQUIRED,CHP_SRVS_CASE("A.8"));
|
|
110 |
CHECKPOINT_COMP_STR(contextNotify.iProtocolConfigOption.iAuthInfo.iUsername,DPCKTTSY_USER_NAME1,CHP_SRVS_CASE("A.8"));
|
|
111 |
CHECKPOINT_COMP_STR(contextNotify.iProtocolConfigOption.iAuthInfo.iPassword,DPCKTTSY_PASSWORD1,CHP_SRVS_CASE("A.8"));
|
|
112 |
CHECKPOINT(contextNotify.iProtocolConfigOption.iAuthInfo.iProtocol,DPCKTTSY_PROTOCOL_TYPE1_0,CHP_SRVS_CASE("A.8"));
|
|
113 |
CHECKPOINT(contextNotify.iNWIContext,DPCKTTSY_NWICONTEXT_TRUE,CHP_SRVS_CASE("A.8"));
|
|
114 |
|
|
115 |
gprs.NotifyContextActivationRequested(reqStatus, contextNotifyPckg);
|
|
116 |
gprs.CancelAsyncRequest(EPacketNotifyContextActivationRequested);
|
|
117 |
User::WaitForRequest(reqStatus);
|
|
118 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.8"));
|
|
119 |
|
|
120 |
//reject
|
|
121 |
gprs.RejectActivationRequest(reqStatus);
|
|
122 |
User::WaitForRequest(reqStatus);
|
|
123 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.9"));
|
|
124 |
|
|
125 |
gprs.RejectActivationRequest(reqStatus);
|
|
126 |
gprs.CancelAsyncRequest(EPacketRejectActivationRequest);
|
|
127 |
User::WaitForRequest(reqStatus);
|
|
128 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.9"));
|
|
129 |
//Enumerate Contexts
|
|
130 |
TInt contextCount, maxAllowed;
|
|
131 |
gprs.EnumerateContexts(reqStatus,contextCount, maxAllowed);
|
|
132 |
User::WaitForRequest(reqStatus);
|
|
133 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.10"));
|
|
134 |
CHECKPOINT(contextCount,DPCKTTSY_NUMBER_OF_CONTEXTS,CHP_SRVS_CASE("A.10"));
|
|
135 |
CHECKPOINT(maxAllowed,DPCKTTSY_MAX_NUMBER_OF_CONTEXTS,CHP_SRVS_CASE("A.10"));
|
|
136 |
//Context Info
|
|
137 |
TInt index = 0;
|
|
138 |
RPacketService::TContextInfo contextInfo;
|
|
139 |
gprs.GetContextInfo(reqStatus, index, contextInfo);
|
|
140 |
User::WaitForRequest(reqStatus);
|
|
141 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.11"));
|
|
142 |
CHECKPOINT_COMP_STR(contextInfo.iName,DPCKTTSY_CONTEXT_INFO_NAME0,CHP_SRVS_CASE("A.11"));
|
|
143 |
CHECKPOINT(contextInfo.iStatus,DPCKTTSY_CONTEXT_INFO_STATUS0,CHP_SRVS_CASE("A.11"));
|
|
144 |
|
|
145 |
gprs.GetContextInfo(reqStatus, index, contextInfo);
|
|
146 |
gprs.CancelAsyncRequest(EPacketGetContextInfo);
|
|
147 |
User::WaitForRequest(reqStatus);
|
|
148 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.11"));
|
|
149 |
|
|
150 |
index++;
|
|
151 |
// Registration Status
|
|
152 |
RPacketService::TRegistrationStatus registrStatus;
|
|
153 |
gprs.GetNtwkRegStatus(reqStatus,registrStatus);
|
|
154 |
User::WaitForRequest(reqStatus);
|
|
155 |
CHECKPOINT(registrStatus,DPCKTTSY_REGISTRATION_STATUS1,CHP_SRVS_CASE("A.22"));
|
|
156 |
|
|
157 |
gprs.GetNtwkRegStatus(reqStatus,registrStatus);
|
|
158 |
gprs.CancelAsyncRequest(EPacketGetNtwkRegStatus);
|
|
159 |
User::WaitForRequest(reqStatus);
|
|
160 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.22"));
|
|
161 |
//reg status notification
|
|
162 |
gprs.NotifyChangeOfNtwkRegStatus(reqStatus, registrStatus);
|
|
163 |
User::WaitForRequest(reqStatus);
|
|
164 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.12"));
|
|
165 |
CHECKPOINT(registrStatus,DPCKTTSY_REGISTRATION_STATUS2,CHP_SRVS_CASE("A.12"));
|
|
166 |
|
|
167 |
gprs.NotifyChangeOfNtwkRegStatus(reqStatus, registrStatus);
|
|
168 |
gprs.CancelAsyncRequest(EPacketNotifyChangeOfNtwkRegStatus);
|
|
169 |
User::WaitForRequest(reqStatus);
|
|
170 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.12"));
|
|
171 |
// MS Class
|
|
172 |
RPacketService::TMSClass msClass1, msClass2;
|
|
173 |
|
|
174 |
gprs.GetMSClass(reqStatus, msClass1, msClass2);
|
|
175 |
User::WaitForRequest(reqStatus);
|
|
176 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.13"));
|
|
177 |
CHECKPOINT(msClass1,DPCKTTSY_CURRENT_MS_CLASS,CHP_SRVS_CASE("A.13"));
|
|
178 |
CHECKPOINT(msClass2,DPCKTTSY_MAX_MS_CLASS,CHP_SRVS_CASE("A.13"));
|
|
179 |
|
|
180 |
gprs.GetMSClass(reqStatus, msClass1, msClass2);
|
|
181 |
gprs.CancelAsyncRequest(EPacketGetMSClass);
|
|
182 |
User::WaitForRequest(reqStatus);
|
|
183 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.13"));
|
|
184 |
// set ms class
|
|
185 |
msClass1 = DPCKTTSY_SET_MS_CLASS;
|
|
186 |
gprs.SetMSClass(reqStatus, msClass1);
|
|
187 |
User::WaitForRequest(reqStatus);
|
|
188 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.14"));
|
|
189 |
|
|
190 |
gprs.SetMSClass(reqStatus, msClass1);
|
|
191 |
gprs.CancelAsyncRequest(EPacketSetMSClass);
|
|
192 |
User::WaitForRequest(reqStatus);
|
|
193 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.14"));
|
|
194 |
|
|
195 |
//ms class change ntf
|
|
196 |
gprs.NotifyMSClassChange(reqStatus, msClass1);
|
|
197 |
User::WaitForRequest(reqStatus);
|
|
198 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.15"));
|
|
199 |
CHECKPOINT(msClass1,DPCKTTSY_NEW_MS_CLASS,CHP_SRVS_CASE("A.15"));
|
|
200 |
|
|
201 |
gprs.NotifyMSClassChange(reqStatus, msClass1);
|
|
202 |
gprs.CancelAsyncRequest(EPacketNotifyMSClassChange);
|
|
203 |
User::WaitForRequest(reqStatus);
|
|
204 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.15"));
|
|
205 |
// Static Caps
|
|
206 |
TUint caps;
|
|
207 |
|
|
208 |
CHECKPOINT(gprs.GetStaticCaps(caps, DPCKTTSY_PDP_TYPE1),KErrNone,CHP_SRVS_CASE("A.16"));
|
|
209 |
CHECKPOINT(caps,DPCKTTSY_MISC_CAPS,CHP_SRVS_CASE("A.16"));
|
|
210 |
// Dynamic Caps
|
|
211 |
RPacketService::TDynamicCapsFlags dynamicCaps;
|
|
212 |
|
|
213 |
CHECKPOINT(gprs.GetDynamicCaps(dynamicCaps),KErrNone,CHP_SRVS_CASE("A.17"));
|
|
214 |
CHECKPOINT(dynamicCaps,DPCKTTSY_DYNAMIC_CAPS1,CHP_SRVS_CASE("A.17"));
|
|
215 |
//dynamic caps chamge notification
|
|
216 |
gprs.NotifyDynamicCapsChange(reqStatus, dynamicCaps);
|
|
217 |
User::WaitForRequest(reqStatus);
|
|
218 |
CHECKPOINT(reqStatus.Int(),KErrNone,CHP_SRVS_CASE("A.18"));
|
|
219 |
CHECKPOINT(dynamicCaps,DPCKTTSY_DYNAMIC_CAPS2,CHP_SRVS_CASE("A.18"));
|
|
220 |
|
|
221 |
gprs.NotifyDynamicCapsChange(reqStatus, dynamicCaps);
|
|
222 |
gprs.CancelAsyncRequest(EPacketNotifyDynamicCapsChange);
|
|
223 |
User::WaitForRequest(reqStatus);
|
|
224 |
CHECKPOINT(reqStatus.Int(),KErrCancel,CHP_SRVS_CASE("A.18"));
|
|
225 |
|
|
226 |
// Attach Mode
|
|
227 |
RPacketService::TAttachMode attachMode=DPCKTTSY_ATTACH_MODE1;
|
|
228 |
CHECKPOINT(gprs.SetAttachMode(attachMode),KErrNone,CHP_SRVS_CASE("A.4"));
|
|
229 |
|
|
230 |
CHECKPOINT(gprs.GetAttachMode(attachMode),KErrNone,CHP_SRVS_CASE("A.5"));
|
|
231 |
CHECKPOINT(attachMode,DPCKTTSY_ATTACH_MODE2,CHP_SRVS_CASE("A.5"));
|
|
232 |
|
|
233 |
ExtendedTest1( phone, gprs, reqStatus);
|
|
234 |
|
|
235 |
return TestStepResult();
|
|
236 |
}
|
|
237 |
|
|
238 |
|
|
239 |
// moved here to prevent stack overflow
|
|
240 |
enum TVerdict CEtelPacketTest1_1::ExtendedTest1(RPhone& phone, RPacketService& gprs, TRequestStatus& reqStatus)
|
|
241 |
{
|
|
242 |
|
|
243 |
// Default Context Params
|
|
244 |
RPacketContext::TContextConfigGPRS contextConfig;
|
|
245 |
TPckg<RPacketContext::TContextConfigGPRS> contextConfigPckg(contextConfig);
|
|
246 |
|
|
247 |
contextConfig.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
|
|
248 |
contextConfig.iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS1;
|
|
249 |
contextConfig.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
|
|
250 |
contextConfig.iPdpCompression = DPCKTTSY_COMPRESSION1;
|
|
251 |
contextConfig.iPdpType = DPCKTTSY_PDP_TYPE1;
|
|
252 |
contextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
|
|
253 |
contextConfig.iProtocolConfigOption.iAuthInfo.iUsername = DPCKTTSY_USER_NAME1;
|
|
254 |
contextConfig.iProtocolConfigOption.iAuthInfo.iPassword = DPCKTTSY_PASSWORD1;
|
|
255 |
contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
|
|
256 |
contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol = DPCKTTSY_PROTOCOL_TYPE1_0;
|
|
257 |
contextConfig.iNWIContext = DPCKTTSY_NWICONTEXT_TRUE;
|
|
258 |
CHECKPOINT(gprs.SetDefaultContextParams(contextConfigPckg),KErrNone,CHP_SRVS_CASE("A.19"));
|
|
259 |
|
|
260 |
CHECKPOINT(gprs.GetDefaultContextParams(contextConfigPckg),KErrNone,CHP_SRVS_CASE("A.20"));
|
|
261 |
CHECKPOINT_COMP_STR(contextConfig.iAccessPointName,DPCKTTSY_ACCESS_POINT2,CHP_SRVS_CASE("A.20"));
|
|
262 |
CHECKPOINT(contextConfig.iAnonymousAccessReqd,DPCKTTSY_ANONYMOUS_ACCESS2,CHP_SRVS_CASE("A.20"));
|
|
263 |
CHECKPOINT_COMP_STR(contextConfig.iPdpAddress,DPCKTTSY_PDP_ADDRESS2,CHP_SRVS_CASE("A.20"));
|
|
264 |
CHECKPOINT(contextConfig.iPdpCompression,DPCKTTSY_COMPRESSION2,CHP_SRVS_CASE("A.20"));
|
|
265 |
CHECKPOINT(contextConfig.iPdpType,DPCKTTSY_PDP_TYPE2,CHP_SRVS_CASE("A.20"));
|
|
266 |
CHECKPOINT(contextConfig.iUseEdge,DPCKTTSY_EGPRS_NOTREQUIRED,CHP_SRVS_CASE("A.20"));
|
|
267 |
CHECKPOINT_COMP_STR(contextConfig.iProtocolConfigOption.iAuthInfo.iUsername,DPCKTTSY_USER_NAME1,CHP_SRVS_CASE("A.20"));
|
|
268 |
CHECKPOINT_COMP_STR(contextConfig.iProtocolConfigOption.iAuthInfo.iPassword,DPCKTTSY_PASSWORD1,CHP_SRVS_CASE("A.20"));
|
|
269 |
CHECKPOINT(contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol,DPCKTTSY_PROTOCOL_TYPE1_0,CHP_SRVS_CASE("A.20"));
|
|
270 |
|
|
271 |
// JoeF : 16-Nov-01 : Added the following tests below. These test new API methods recently added to the RPacketService class.
|
|
272 |
// Get Preferred Bearer
|
|
273 |
RPacketService::TPreferredBearer myBearer;
|
|
274 |
TInt ret=gprs.GetPreferredBearer(myBearer);
|
|
275 |
CHECKPOINT(ret, KErrNone, CHP_SRVS_CASE("A.23"));
|
|
276 |
CHECKPOINT_COMP_STR(myBearer, DPCKTTSY_PREFERRED_BEARER1, CHP_SRVS_CASE("A.23"));
|
|
277 |
|
|
278 |
//async Get Preferred Bearer
|
|
279 |
RPacketService::TPreferredBearer myAsyncBearer;
|
|
280 |
gprs.GetPreferredBearer(reqStatus, myAsyncBearer);
|
|
281 |
User::WaitForRequest(reqStatus);
|
|
282 |
CHECKPOINT_COMP_STR(myAsyncBearer, DPCKTTSY_PREFERRED_BEARER2, CHP_SRVS_CASE("A.23A"));
|
|
283 |
|
|
284 |
//async Get Preferred Bearer & Cancel
|
|
285 |
gprs.GetPreferredBearer(reqStatus, myAsyncBearer);
|
|
286 |
gprs.CancelAsyncRequest(EPacketGetPrefBearer);
|
|
287 |
User::WaitForRequest(reqStatus);
|
|
288 |
CHECKPOINT(reqStatus.Int(), KErrCancel, CHP_SRVS_CASE("A.23A"));
|
|
289 |
|
|
290 |
// Set Preferred Bearer
|
|
291 |
gprs.SetPreferredBearer(reqStatus, myBearer);
|
|
292 |
User::WaitForRequest(reqStatus);
|
|
293 |
CHECKPOINT(reqStatus.Int(), KErrNone, CHP_SRVS_CASE("A.24"));
|
|
294 |
|
|
295 |
gprs.SetPreferredBearer(reqStatus, myBearer);
|
|
296 |
gprs.CancelAsyncRequest(EPacketSetPrefBearer);
|
|
297 |
User::WaitForRequest(reqStatus);
|
|
298 |
CHECKPOINT(reqStatus.Int(), KErrCancel, CHP_SRVS_CASE("A.23"));
|
|
299 |
|
|
300 |
// End of RPacketService tests.
|
|
301 |
gprs.Close();
|
|
302 |
phone.Close();
|
|
303 |
|
|
304 |
return TestStepResult();
|
|
305 |
}
|
|
306 |
|