44
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalComponent
|
|
19 |
*/
|
|
20 |
|
|
21 |
#include "WapFullySpecCLPushSteps.h"
|
|
22 |
#include "WapStackSuiteDefs.h"
|
|
23 |
#include <simtsy.h>
|
|
24 |
#include <wapmsgerr.h>
|
|
25 |
#include <ecom/ecom.h>
|
|
26 |
|
|
27 |
|
|
28 |
CFullySpecCLPushBase::CFullySpecCLPushBase()
|
|
29 |
/**
|
|
30 |
* Constructor
|
|
31 |
*/
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
CFullySpecCLPushBase::~CFullySpecCLPushBase()
|
|
36 |
/**
|
|
37 |
* Destructor
|
|
38 |
*/
|
|
39 |
{
|
|
40 |
if(iImp)
|
|
41 |
{
|
|
42 |
UnloadInterface();
|
|
43 |
}
|
|
44 |
}
|
|
45 |
|
|
46 |
CWapFullySpecCLPushService* CFullySpecCLPushBase::LoadInterface()
|
|
47 |
{
|
|
48 |
TInt trapValue;
|
|
49 |
CWapFullySpecCLPushService* implementation = NULL;
|
|
50 |
// UID {0x101FBB3A} - SWS implementation
|
|
51 |
TUid KInterfaceUid = {0x101FBB3A};
|
|
52 |
INFO_PRINTF2(_L("Calling new NewL(0x%08X) method"), KInterfaceUid);
|
|
53 |
TRAP(trapValue, implementation = CWapFullySpecCLPushService::NewL(KInterfaceUid));
|
|
54 |
if(!trapValue)
|
|
55 |
{
|
|
56 |
INFO_PRINTF2(_L("Interface is loaded: implementation.addr = 0x%08x"), implementation);
|
|
57 |
return implementation;
|
|
58 |
}
|
|
59 |
else return NULL;
|
|
60 |
}
|
|
61 |
|
|
62 |
void CFullySpecCLPushBase::UnloadInterface()
|
|
63 |
{
|
|
64 |
INFO_PRINTF2(_L("Interface at implementation.addr = 0x%08x is deleted"), iImp);
|
|
65 |
delete iImp;
|
|
66 |
iImp = NULL;
|
|
67 |
REComSession::FinalClose();
|
|
68 |
}
|
|
69 |
|
|
70 |
CFullySpecCLPushStep_1::CFullySpecCLPushStep_1()
|
|
71 |
/**
|
|
72 |
* Constructor
|
|
73 |
*/
|
|
74 |
{
|
|
75 |
}
|
|
76 |
|
|
77 |
CFullySpecCLPushStep_1::~CFullySpecCLPushStep_1()
|
|
78 |
/**
|
|
79 |
* Destructor
|
|
80 |
*/
|
|
81 |
{
|
|
82 |
}
|
|
83 |
|
|
84 |
|
|
85 |
TVerdict CFullySpecCLPushStep_1::doTestStepL()
|
|
86 |
/**
|
|
87 |
* @return - TVerdict code
|
|
88 |
* Override of base class pure virtual
|
|
89 |
* Our implementation only gets called if the base class doTestStepPreambleL() did
|
|
90 |
* not leave. That being the case, the current test result value will be EPass.
|
|
91 |
*/
|
|
92 |
{
|
|
93 |
//
|
|
94 |
// CWapFullySpecCLPushService
|
|
95 |
//
|
|
96 |
INFO_PRINTF1(_L("CreateImplementation - CWapFullySpecCLPushService"));
|
|
97 |
INFO_PRINTF1(_L("Calling old NewL() method"));
|
|
98 |
|
|
99 |
TInt trapValue;
|
|
100 |
|
|
101 |
SetTestStepResult(EFail);
|
|
102 |
TRAP(trapValue, iImp = CWapFullySpecCLPushService::NewL());
|
|
103 |
if(!trapValue)
|
|
104 |
{
|
|
105 |
// interface is loaded
|
|
106 |
INFO_PRINTF2(_L("Interface is loaded: implementation.addr = 0x%08x"), iImp);
|
|
107 |
UnloadInterface();
|
|
108 |
iImp = LoadInterface();
|
|
109 |
if(iImp)
|
|
110 |
{
|
|
111 |
INFO_PRINTF1(_L("CreateImplementation - OK"));
|
|
112 |
SetTestStepResult(EPass);
|
|
113 |
UnloadInterface();
|
|
114 |
}
|
|
115 |
}
|
|
116 |
return TestStepResult();
|
|
117 |
}
|
|
118 |
|
|
119 |
CFullySpecCLPushStep_2::CFullySpecCLPushStep_2()
|
|
120 |
/**
|
|
121 |
* Constructor
|
|
122 |
*/
|
|
123 |
{
|
|
124 |
}
|
|
125 |
|
|
126 |
CFullySpecCLPushStep_2::~CFullySpecCLPushStep_2()
|
|
127 |
/**
|
|
128 |
* Destructor
|
|
129 |
*/
|
|
130 |
{
|
|
131 |
}
|
|
132 |
|
|
133 |
TVerdict CFullySpecCLPushStep_2::doTestStepL()
|
|
134 |
/**
|
|
135 |
* Test Connect methoths
|
|
136 |
* @return - TVerdict code
|
|
137 |
*
|
|
138 |
*/
|
|
139 |
{
|
|
140 |
INFO_PRINTF1(_L("FULLYSPEC-PUSH: Testing Connect"));
|
|
141 |
if(TestStepResult() == EPass )
|
|
142 |
{
|
|
143 |
SetTestStepResult(EFail);
|
|
144 |
iImp = LoadInterface();
|
|
145 |
if(iImp)
|
|
146 |
{
|
|
147 |
TInt bearer;
|
|
148 |
TInt error = KErrNone;
|
|
149 |
TBool secure= EFalse;
|
|
150 |
TBool reconnect = EFalse;
|
|
151 |
SetLastError(KErrNone);
|
|
152 |
|
|
153 |
if(GetIntFromConfig(ConfigSection(),KWapBearer, bearer)) iBearer = (Wap::TBearer)bearer;
|
|
154 |
if(GetIntFromConfig(ConfigSection(), KWapExError, error)) SetExpectedError(error);
|
|
155 |
if(GetBoolFromConfig(ConfigSection(), KWapSecure, secure)) iSecure = secure;
|
|
156 |
if(GetBoolFromConfig(ConfigSection(),_L("Reconnect"), reconnect)) iReconnect = reconnect;
|
|
157 |
|
|
158 |
if(UseSimTsy())
|
|
159 |
{
|
|
160 |
GetIntFromConfig(ConfigSection(), KWapSIMTSYState, iSimTsyState);
|
|
161 |
User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, iSimTsyState));
|
|
162 |
}
|
|
163 |
User::LeaveIfError(RProperty::Set(KUidSystemCategory, KUidPhonePwr.iUid, ESAPhoneOn));
|
|
164 |
|
|
165 |
SetState(EConnect);
|
|
166 |
iControl->ReStart();
|
|
167 |
ShowConnectionInfo();
|
|
168 |
|
|
169 |
StartScheduler();
|
|
170 |
UnloadInterface();
|
|
171 |
}
|
|
172 |
}
|
|
173 |
return TestStepResult();
|
|
174 |
}
|
|
175 |
|
|
176 |
TInt CFullySpecCLPushStep_2::CallStateMachine()
|
|
177 |
{
|
|
178 |
TInt err = KErrNone;
|
|
179 |
INFO_PRINTF2(_L("CallStateMachine: step [%d]"), State());
|
|
180 |
switch(iState)
|
|
181 |
{
|
|
182 |
case EConnect:
|
|
183 |
INFO_PRINTF1(_L("EConnect"));
|
|
184 |
err = iImp->Connect(iRemoteHost, iRemotePort, iBearer, iSecure);
|
|
185 |
INFO_PRINTF2(_L("Connection completed with code = %d"), err);
|
|
186 |
if( err == KErrNone)
|
|
187 |
{
|
|
188 |
if(iReconnect)
|
|
189 |
{
|
|
190 |
INFO_PRINTF1(_L("Reconnection"));
|
|
191 |
iControl->ReStart();
|
|
192 |
break;
|
|
193 |
}
|
|
194 |
}
|
|
195 |
SetState(EFinish);
|
|
196 |
SetLastError(err);
|
|
197 |
iControl->ReStart();
|
|
198 |
break;
|
|
199 |
|
|
200 |
case EFinish:
|
|
201 |
INFO_PRINTF1(_L("EFinish"));
|
|
202 |
if(GetLastError() == GetExpectedError()) SetTestStepResult(EPass);
|
|
203 |
else SetTestStepResult(EFail);
|
|
204 |
SetState(EIdle);
|
|
205 |
StopScheduler();
|
|
206 |
break;
|
|
207 |
|
|
208 |
case EIdle:
|
|
209 |
default:
|
|
210 |
INFO_PRINTF2(_L("Error: EIdle or unknown state %d"), State());
|
|
211 |
SetTestStepResult(EFail);
|
|
212 |
StopScheduler();
|
|
213 |
break;
|
|
214 |
}
|
|
215 |
return (0);
|
|
216 |
}
|
|
217 |
|
|
218 |
CFullySpecCLPushStep_3::CFullySpecCLPushStep_3()
|
|
219 |
/**
|
|
220 |
* Constructor
|
|
221 |
*/
|
|
222 |
{
|
|
223 |
}
|
|
224 |
|
|
225 |
CFullySpecCLPushStep_3::~CFullySpecCLPushStep_3()
|
|
226 |
/**
|
|
227 |
* Destructor
|
|
228 |
*/
|
|
229 |
{
|
|
230 |
}
|
|
231 |
|
|
232 |
TVerdict CFullySpecCLPushStep_3::doTestStepL()
|
|
233 |
/**
|
|
234 |
* Test Connect methoths
|
|
235 |
* @return - TVerdict code
|
|
236 |
*
|
|
237 |
*/
|
|
238 |
{
|
|
239 |
INFO_PRINTF1(_L("FullySpecWSPPush. Requests without connection"));
|
|
240 |
// check preamble result
|
|
241 |
TVerdict verdict = TestStepResult();
|
|
242 |
if (verdict==EPass)
|
|
243 |
{
|
|
244 |
TInt err, ret;
|
|
245 |
iImp = LoadInterface();
|
|
246 |
if (!iImp)
|
|
247 |
{
|
|
248 |
ERR_PRINTF1(_L("Unable to load FullySpecWSPPush Interface"));
|
|
249 |
verdict = EFail;
|
|
250 |
}
|
|
251 |
else
|
|
252 |
{
|
|
253 |
GetIntFromConfig(ConfigSection(),KWapExError,(TInt&)iExError);
|
|
254 |
ShowConnectionInfo();
|
|
255 |
TRequestStatus reqStatus;
|
|
256 |
iImp->AwaitPush(iRecvHeadersBuf, iRecvBodyBuf, iTransactionIdPckg, reqStatus);
|
|
257 |
TRAP(ret, TEST_CHECKL(reqStatus.Int(), iExError, _L("AwaitPush Fails not as expected")))
|
|
258 |
if (ret)
|
|
259 |
verdict = EFail;
|
|
260 |
else
|
|
261 |
{
|
|
262 |
Wap::TPort port;
|
|
263 |
err=iImp->GetLocalPort(port);
|
|
264 |
TRAP(ret, TEST_CHECKL(err, iExError, _L("GetLocalPort Fails not as expected")))
|
|
265 |
if (ret)
|
|
266 |
verdict = EFail;
|
|
267 |
else
|
|
268 |
{
|
|
269 |
HBufC8* localHost;
|
|
270 |
err=iImp->GetLocalAddress(localHost);
|
|
271 |
TRAP(ret, TEST_CHECKL(err, iExError, _L("GetLocalAddress Fails not as expected")))
|
|
272 |
if (ret)
|
|
273 |
verdict = EFail;
|
|
274 |
}
|
|
275 |
}
|
|
276 |
UnloadInterface();
|
|
277 |
}
|
|
278 |
}
|
|
279 |
if (verdict==EPass)
|
|
280 |
{
|
|
281 |
INFO_PRINTF1(_L("FullySpecCLPush. Requests Fail as expected"));
|
|
282 |
}
|
|
283 |
SetTestStepResult(verdict);
|
|
284 |
return TestStepResult();
|
|
285 |
}
|
|
286 |
|
|
287 |
TInt CFullySpecCLPushStep_3::CallStateMachine()
|
|
288 |
{
|
|
289 |
return (0);
|
|
290 |
}
|
|
291 |
|
|
292 |
CFullySpecCLPushStep_4::CFullySpecCLPushStep_4()
|
|
293 |
/**
|
|
294 |
* Constructor
|
|
295 |
*/
|
|
296 |
{
|
|
297 |
}
|
|
298 |
|
|
299 |
CFullySpecCLPushStep_4::~CFullySpecCLPushStep_4()
|
|
300 |
/**
|
|
301 |
* Destructor
|
|
302 |
*/
|
|
303 |
{
|
|
304 |
}
|
|
305 |
|
|
306 |
TVerdict CFullySpecCLPushStep_4::doTestStepL()
|
|
307 |
/**
|
|
308 |
* Test Connect methoths
|
|
309 |
* @return - TVerdict code
|
|
310 |
*
|
|
311 |
*/
|
|
312 |
{
|
|
313 |
INFO_PRINTF1(_L("FULLYSPEC-CLPUSH: Connect-AwaitPush"));
|
|
314 |
if(TestStepResult() == EPass )
|
|
315 |
{
|
|
316 |
SetTestStepResult(EFail);
|
|
317 |
iImp = LoadInterface();
|
|
318 |
if(iImp)
|
|
319 |
{
|
|
320 |
SetLastError(KErrNone);
|
|
321 |
|
|
322 |
TInt bearer, port;
|
|
323 |
TInt error = KErrNone;
|
|
324 |
TPtrC16 remote_host;
|
|
325 |
|
|
326 |
if(GetIntFromConfig(ConfigSection(),KWapBearer, bearer))
|
|
327 |
{
|
|
328 |
iBearer = static_cast<Wap::TBearer>(bearer);
|
|
329 |
}
|
|
330 |
if(GetStringFromConfig(ConfigSection(), KWapRemoteHost, remote_host))
|
|
331 |
{
|
|
332 |
iRemoteHost.Copy(remote_host);
|
|
333 |
}
|
|
334 |
if(GetIntFromConfig(ConfigSection(),KWapLocalPort, port))
|
|
335 |
{
|
|
336 |
iLocalPort = static_cast<Wap::TPort>(port);
|
|
337 |
}
|
|
338 |
if(GetIntFromConfig(ConfigSection(),KWapRemotePort, port))
|
|
339 |
{
|
|
340 |
iRemotePort = static_cast<Wap::TPort>(port);
|
|
341 |
}
|
|
342 |
if(GetIntFromConfig(ConfigSection(),KWapExError, error))
|
|
343 |
{
|
|
344 |
SetExpectedError(error);
|
|
345 |
}
|
|
346 |
GetBoolFromConfig(ConfigSection(), KMiddleCancel, iMiddleCancel);
|
|
347 |
GetBoolFromConfig(ConfigSection(), KMultiReadCancel, iMultiReadCancel);
|
|
348 |
TInt headerLength, bufLength;
|
|
349 |
if(GetIntFromConfig(ConfigSection(),KWapWSPRecvHeaderLength, headerLength))
|
|
350 |
{
|
|
351 |
iHeaderRecvBufLength=static_cast<TUint16>(headerLength);
|
|
352 |
}
|
|
353 |
if(GetIntFromConfig(ConfigSection(),KWapWSPRecvBodyLength, bufLength))
|
|
354 |
{
|
|
355 |
iBodyRecvBufLength=static_cast<TUint16>(bufLength);
|
|
356 |
}
|
|
357 |
|
|
358 |
iRecvHeaders = HBufC8::NewL(iHeaderRecvBufLength);
|
|
359 |
iRecvBody = HBufC8::NewL(iBodyRecvBufLength);
|
|
360 |
|
|
361 |
User::LeaveIfError(RProperty::Set(KUidSystemCategory, KUidPhonePwr.iUid, ESAPhoneOn));
|
|
362 |
|
|
363 |
if(UseSimTsy())
|
|
364 |
{
|
|
365 |
GetIntFromConfig(ConfigSection(), KWapSIMTSYState, iSimTsyState);
|
|
366 |
User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, iSimTsyState));
|
|
367 |
}
|
|
368 |
|
|
369 |
|
|
370 |
SetState(EConnect);
|
|
371 |
iControl->ReStart();
|
|
372 |
ShowConnectionInfo();
|
|
373 |
// Start state machine
|
|
374 |
StartScheduler();
|
|
375 |
delete iRecvBody;
|
|
376 |
iRecvBody=NULL;
|
|
377 |
delete iRecvHeaders;
|
|
378 |
iRecvHeaders=NULL;
|
|
379 |
UnloadInterface();
|
|
380 |
}
|
|
381 |
|
|
382 |
}
|
|
383 |
return TestStepResult();
|
|
384 |
}
|
|
385 |
|
|
386 |
TInt CFullySpecCLPushStep_4::CallStateMachine()
|
|
387 |
{
|
|
388 |
TVerdict verdict = EFail;
|
|
389 |
TInt err = KErrNone;
|
|
390 |
TInt activate = 0;
|
|
391 |
|
|
392 |
INFO_PRINTF2(_L("CallStateMachine: state [%d]"), State());
|
|
393 |
switch(iState)
|
|
394 |
{
|
|
395 |
case EConnect:
|
|
396 |
INFO_PRINTF1(_L("EConnect"));
|
|
397 |
err = iImp->Connect(iRemoteHost, iRemotePort, iBearer, EFalse);
|
|
398 |
INFO_PRINTF2(_L("Connection completed with code = %d"), err);
|
|
399 |
if( err == KErrNone)
|
|
400 |
{
|
|
401 |
TRAP(err, WaitForInitializeL());
|
|
402 |
iRecvHeadersBuf.Set(iRecvHeaders->Des());
|
|
403 |
iRecvBodyBuf.Set(iRecvBody->Des());
|
|
404 |
iImp->AwaitPush(iRecvHeadersBuf, iRecvBodyBuf, iTransactionIdPckg, *iStatus);
|
|
405 |
INFO_PRINTF1(_L("Start AwaitingPush....."));
|
|
406 |
activate = 1;
|
|
407 |
if (!iMiddleCancel)
|
|
408 |
{
|
|
409 |
SetState(EAwaitPush);
|
|
410 |
}
|
|
411 |
else
|
|
412 |
{
|
|
413 |
INFO_PRINTF1(_L("Cancel AwaitPush"));
|
|
414 |
iImp->CancelAwaitPush();
|
|
415 |
SetState(EFinish);
|
|
416 |
}
|
|
417 |
}
|
|
418 |
else
|
|
419 |
{
|
|
420 |
SetState(EFinish);
|
|
421 |
iControl->ReStart();
|
|
422 |
}
|
|
423 |
SetLastError(err);
|
|
424 |
break;
|
|
425 |
|
|
426 |
case EAwaitPush:
|
|
427 |
INFO_PRINTF1(_L("EAwaitPush"));
|
|
428 |
if(iStatus->Int() != KErrNone && iStatus->Int()!=Wap::EMoreData)
|
|
429 |
// AwaitPush failed
|
|
430 |
{
|
|
431 |
INFO_PRINTF1(_L("AwaitPush failed"));
|
|
432 |
SetLastError(iStatus->Int());
|
|
433 |
SetState(EFinish);
|
|
434 |
iControl->ReStart();
|
|
435 |
}
|
|
436 |
else
|
|
437 |
{
|
|
438 |
iMaxWspHeaderRecvBuffer.Append(iRecvHeadersBuf);
|
|
439 |
iMaxWspDataRecvBuffer.Append(iRecvBodyBuf);
|
|
440 |
if (iStatus->Int()==Wap::EMoreData)
|
|
441 |
{
|
|
442 |
iImp->AwaitPush(iRecvHeadersBuf, iRecvBodyBuf, iTransactionIdPckg, *iStatus);
|
|
443 |
activate = 1;
|
|
444 |
if (!iMultiReadCancel)
|
|
445 |
{
|
|
446 |
SetState(EAwaitPush);
|
|
447 |
}
|
|
448 |
else
|
|
449 |
{
|
|
450 |
INFO_PRINTF1(_L("Cancel Receive in EMutipleReceive state"));
|
|
451 |
iImp->CancelAwaitPush();
|
|
452 |
SetState(EFinish);
|
|
453 |
}
|
|
454 |
|
|
455 |
}
|
|
456 |
else
|
|
457 |
{
|
|
458 |
SetLastError(iStatus->Int());
|
|
459 |
iControl->ReStart();
|
|
460 |
SetState(EFinish);
|
|
461 |
}
|
|
462 |
}
|
|
463 |
break;
|
|
464 |
|
|
465 |
case EFinish:
|
|
466 |
INFO_PRINTF1(_L("EFinish"));
|
|
467 |
if(iStatus->Int() != KErrNone)
|
|
468 |
{
|
|
469 |
SetLastError(iStatus->Int());
|
|
470 |
}
|
|
471 |
verdict = (GetLastError() == GetExpectedError())?EPass:EFail;
|
|
472 |
if (verdict==EPass && !iMiddleCancel && !iMultiReadCancel)
|
|
473 |
{
|
|
474 |
iImp->CancelAwaitPush();
|
|
475 |
INFO_PRINTF1(_L("Headers"));
|
|
476 |
DumpBuf(iMaxWspHeaderRecvBuffer);
|
|
477 |
INFO_PRINTF1(_L("Body"));
|
|
478 |
DumpBuf(iMaxWspDataRecvBuffer);
|
|
479 |
if (verdict==EPass)
|
|
480 |
{
|
|
481 |
Wap::TPort port;
|
|
482 |
iImp->GetLocalPort(port);
|
|
483 |
verdict = (port == iLocalPort)?EPass:EFail;
|
|
484 |
}
|
|
485 |
if (verdict==EPass)
|
|
486 |
{
|
|
487 |
//This test can not perform.
|
|
488 |
HBufC8* buf;
|
|
489 |
iImp->GetLocalAddress(buf);
|
|
490 |
delete buf;
|
|
491 |
}
|
|
492 |
}
|
|
493 |
SetTestStepResult(verdict);
|
|
494 |
SetState(EIdle);
|
|
495 |
StopScheduler();
|
|
496 |
break;
|
|
497 |
|
|
498 |
case EIdle:
|
|
499 |
default:
|
|
500 |
INFO_PRINTF2(_L("Error: EIdle or unknown state %d"), State());
|
|
501 |
SetTestStepResult(verdict);
|
|
502 |
StopScheduler();
|
|
503 |
break;
|
|
504 |
}
|
|
505 |
return (activate);
|
|
506 |
}
|
|
507 |
|
|
508 |
CFullySpecCLPushStep_5::CFullySpecCLPushStep_5()
|
|
509 |
/**
|
|
510 |
* Constructor
|
|
511 |
*/
|
|
512 |
{
|
|
513 |
}
|
|
514 |
|
|
515 |
CFullySpecCLPushStep_5::~CFullySpecCLPushStep_5()
|
|
516 |
/**
|
|
517 |
* Destructor
|
|
518 |
*/
|
|
519 |
{
|
|
520 |
}
|
|
521 |
|
|
522 |
TVerdict CFullySpecCLPushStep_5::doTestStepL()
|
|
523 |
/**
|
|
524 |
* Test Cancel await push
|
|
525 |
* @return - TVerdict code
|
|
526 |
*
|
|
527 |
*/
|
|
528 |
{
|
|
529 |
INFO_PRINTF1(_L("FullySpecified-PUSH: Testing Cancel"));
|
|
530 |
if(TestStepResult() == EPass )
|
|
531 |
{
|
|
532 |
SetTestStepResult(EFail);
|
|
533 |
iImp = LoadInterface();
|
|
534 |
if(iImp)
|
|
535 |
{
|
|
536 |
TInt bearer;
|
|
537 |
TInt error = KErrNone;
|
|
538 |
TBool secure= EFalse;
|
|
539 |
TBool reconnect = EFalse;
|
|
540 |
SetLastError(KErrNone);
|
|
541 |
|
|
542 |
if(GetIntFromConfig(ConfigSection(),KWapBearer, bearer)) iBearer = (Wap::TBearer)bearer;
|
|
543 |
if(GetIntFromConfig(ConfigSection(), KWapExError, error)) SetExpectedError(error);
|
|
544 |
if(GetBoolFromConfig(ConfigSection(), KWapSecure, secure)) iSecure = secure;
|
|
545 |
if(GetBoolFromConfig(ConfigSection(),_L("Reconnect"), reconnect)) iReconnect = reconnect;
|
|
546 |
|
|
547 |
ShowConnectionInfo();
|
|
548 |
error = iImp->Connect(iRemoteHost, iRemotePort, iBearer, iSecure);
|
|
549 |
INFO_PRINTF2(_L("Connection completed with code = %d"), error);
|
|
550 |
if( error == KErrNone)
|
|
551 |
{
|
|
552 |
TBuf8<100> header, body;
|
|
553 |
TPckgBuf<TUint8> pushIdPckg;
|
|
554 |
TRequestStatus reqStatus;
|
|
555 |
iImp->AwaitPush(header, body, pushIdPckg, reqStatus);
|
|
556 |
SetState(EAwaitPush);
|
|
557 |
StartScheduler();
|
|
558 |
iControl->ReStart();
|
|
559 |
if(reqStatus==KErrCancel)
|
|
560 |
{
|
|
561 |
SetTestStepResult(EPass);
|
|
562 |
}
|
|
563 |
}
|
|
564 |
|
|
565 |
}
|
|
566 |
}
|
|
567 |
return TestStepResult();
|
|
568 |
}
|
|
569 |
|
|
570 |
TInt CFullySpecCLPushStep_5::CallStateMachine()
|
|
571 |
{
|
|
572 |
INFO_PRINTF2(_L("CallStateMachine: state [%d]"), State());
|
|
573 |
switch(iState)
|
|
574 |
{
|
|
575 |
case EAwaitPush:
|
|
576 |
INFO_PRINTF1(_L("EAwaitPush"));
|
|
577 |
iImp->CancelAwaitPush();
|
|
578 |
SetState(EFinish);
|
|
579 |
iControl->ReStart();
|
|
580 |
break;
|
|
581 |
case EFinish:
|
|
582 |
INFO_PRINTF1(_L("EFinish"));
|
|
583 |
SetState(EIdle);
|
|
584 |
StopScheduler();
|
|
585 |
break;
|
|
586 |
case EIdle:
|
|
587 |
default:
|
|
588 |
INFO_PRINTF2(_L("Error: EIdle or unknown state %d"), State());
|
|
589 |
SetTestStepResult(EFail);
|
|
590 |
StopScheduler();
|
|
591 |
break;
|
|
592 |
}
|
|
593 |
return (0);
|
|
594 |
}
|
|
595 |
|
|
596 |
CFullySpecCLPushStep_6::CFullySpecCLPushStep_6()
|
|
597 |
{
|
|
598 |
}
|
|
599 |
CFullySpecCLPushStep_6::~CFullySpecCLPushStep_6()
|
|
600 |
{
|
|
601 |
}
|
|
602 |
TVerdict CFullySpecCLPushStep_6::doTestStepL()
|
|
603 |
{
|
|
604 |
//Not in use
|
|
605 |
return TestStepResult();
|
|
606 |
}
|
|
607 |
|
|
608 |
TInt CFullySpecCLPushStep_6::CallStateMachine()
|
|
609 |
{
|
|
610 |
return (0);
|
|
611 |
}
|
|
612 |
|
|
613 |
CFullySpecCLPushStep_7::CFullySpecCLPushStep_7()
|
|
614 |
{
|
|
615 |
}
|
|
616 |
CFullySpecCLPushStep_7::~CFullySpecCLPushStep_7()
|
|
617 |
{
|
|
618 |
}
|
|
619 |
TVerdict CFullySpecCLPushStep_7::doTestStepL()
|
|
620 |
{
|
|
621 |
INFO_PRINTF1(_L("FULLYSPEC-CLPUSH: Connect-AwaitPush-AwaitPush"));
|
|
622 |
if(TestStepResult() == EPass )
|
|
623 |
{
|
|
624 |
SetTestStepResult(EFail);
|
|
625 |
iImp = LoadInterface();
|
|
626 |
if(iImp)
|
|
627 |
{
|
|
628 |
SetLastError(KErrNone);
|
|
629 |
|
|
630 |
TInt bearer;
|
|
631 |
TInt error = KErrNone;
|
|
632 |
|
|
633 |
if(GetIntFromConfig(ConfigSection(),KWapBearer, bearer))
|
|
634 |
{
|
|
635 |
iBearer = static_cast<Wap::TBearer>(bearer);
|
|
636 |
}
|
|
637 |
if(GetIntFromConfig(ConfigSection(),KWapExError, error))
|
|
638 |
{
|
|
639 |
SetExpectedError(error);
|
|
640 |
}
|
|
641 |
TInt headerLength, bufLength;
|
|
642 |
if(GetIntFromConfig(ConfigSection(),KWapWSPRecvHeaderLength, headerLength))
|
|
643 |
{
|
|
644 |
iHeaderRecvBufLength=static_cast<TUint16>(headerLength);
|
|
645 |
}
|
|
646 |
if(GetIntFromConfig(ConfigSection(),KWapWSPRecvBodyLength, bufLength))
|
|
647 |
{
|
|
648 |
iBodyRecvBufLength=static_cast<TUint16>(bufLength);
|
|
649 |
}
|
|
650 |
iRecvHeaders = HBufC8::NewL(iHeaderRecvBufLength);
|
|
651 |
iRecvBody = HBufC8::NewL(iBodyRecvBufLength);
|
|
652 |
SetState(EConnect);
|
|
653 |
iControl->ReStart();
|
|
654 |
ShowConnectionInfo();
|
|
655 |
// Start state machine
|
|
656 |
StartScheduler();
|
|
657 |
delete iRecvBody;
|
|
658 |
iRecvBody=NULL;
|
|
659 |
delete iRecvHeaders;
|
|
660 |
iRecvHeaders=NULL;
|
|
661 |
UnloadInterface();
|
|
662 |
}
|
|
663 |
}
|
|
664 |
return TestStepResult();
|
|
665 |
}
|
|
666 |
|
|
667 |
TInt CFullySpecCLPushStep_7::CallStateMachine()
|
|
668 |
{
|
|
669 |
TVerdict verdict = EFail;
|
|
670 |
TInt err = KErrNone;
|
|
671 |
TInt activate = 0;
|
|
672 |
|
|
673 |
INFO_PRINTF2(_L("CallStateMachine: state [%d]"), State());
|
|
674 |
switch(iState)
|
|
675 |
{
|
|
676 |
case EConnect:
|
|
677 |
INFO_PRINTF1(_L("EConnect"));
|
|
678 |
err = iImp->Connect(iRemoteHost, iRemotePort, iBearer, EFalse);
|
|
679 |
INFO_PRINTF2(_L("Connection completed with code = %d"), err);
|
|
680 |
if( err == KErrNone)
|
|
681 |
{
|
|
682 |
// WaitForInitializeL();
|
|
683 |
TRequestStatus reqStatus;
|
|
684 |
iRecvHeadersBuf.Set(iRecvHeaders->Des());
|
|
685 |
iRecvBodyBuf.Set(iRecvBody->Des());
|
|
686 |
iImp->AwaitPush(iRecvHeadersBuf, iRecvBodyBuf, iTransactionIdPckg, reqStatus);
|
|
687 |
iImp->AwaitPush(iRecvHeadersBuf, iRecvBodyBuf, iTransactionIdPckg, *iStatus);
|
|
688 |
INFO_PRINTF1(_L("AwaitPush"));
|
|
689 |
activate = 1;
|
|
690 |
}
|
|
691 |
else
|
|
692 |
{
|
|
693 |
iControl->ReStart();
|
|
694 |
}
|
|
695 |
SetLastError(err);
|
|
696 |
SetState(EFinish);
|
|
697 |
break;
|
|
698 |
|
|
699 |
case EFinish:
|
|
700 |
|
|
701 |
INFO_PRINTF1(_L("EFinish"));
|
|
702 |
iImp->CancelAwaitPush();
|
|
703 |
if(iStatus->Int() != KErrNone)
|
|
704 |
{
|
|
705 |
SetLastError(iStatus->Int());
|
|
706 |
}
|
|
707 |
verdict = (GetLastError() == GetExpectedError())?EPass:EFail;
|
|
708 |
SetTestStepResult(verdict);
|
|
709 |
SetState(EIdle);
|
|
710 |
StopScheduler();
|
|
711 |
break;
|
|
712 |
|
|
713 |
case EIdle:
|
|
714 |
default:
|
|
715 |
INFO_PRINTF2(_L("Error: EIdle or unknown state %d"), State());
|
|
716 |
SetTestStepResult(verdict);
|
|
717 |
StopScheduler();
|
|
718 |
|
|
719 |
break;
|
|
720 |
}
|
|
721 |
return (activate);
|
|
722 |
}
|
|
723 |
|
|
724 |
CFullySpecCLPushStep_8::CFullySpecCLPushStep_8()
|
|
725 |
{
|
|
726 |
}
|
|
727 |
CFullySpecCLPushStep_8::~CFullySpecCLPushStep_8()
|
|
728 |
{
|
|
729 |
}
|
|
730 |
TVerdict CFullySpecCLPushStep_8::doTestStepL()
|
|
731 |
/**
|
|
732 |
* @return - TVerdict code
|
|
733 |
* Wrong parameter values for FullySpecified CL Push API:
|
|
734 |
* - Wrong TUid on construction
|
|
735 |
* - Connect to wrong bearer (already implemented in test 2)
|
|
736 |
*/
|
|
737 |
{
|
|
738 |
INFO_PRINTF1(_L("CreateImplementation with wrong Uid- CWapFullySpecCLPushService"));
|
|
739 |
if(TestStepResult() == EPass )
|
|
740 |
{
|
|
741 |
TInt error;
|
|
742 |
if(GetIntFromConfig(ConfigSection(),KWapExError2, error))
|
|
743 |
{
|
|
744 |
iExError2=error;
|
|
745 |
}
|
|
746 |
TInt trapValue;
|
|
747 |
TUid invalidInterfaceUid = {0x00000000};
|
|
748 |
INFO_PRINTF2(_L("Calling new NewL(0x%08X) method"), invalidInterfaceUid);
|
|
749 |
TRAP(trapValue, iImp = CWapFullySpecCLPushService::NewL(invalidInterfaceUid));
|
|
750 |
TVerdict verdict = (trapValue == iExError2)?EPass:EFail;
|
|
751 |
if (verdict==EPass)
|
|
752 |
{
|
|
753 |
INFO_PRINTF2(_L("CreateImplementation with wrong Uid- Failed as expected with error %d"),trapValue);
|
|
754 |
}
|
|
755 |
SetTestStepResult(verdict);
|
|
756 |
}
|
|
757 |
return TestStepResult();
|
|
758 |
}
|
|
759 |
|
|
760 |
TInt CFullySpecCLPushStep_8::CallStateMachine()
|
|
761 |
{
|
|
762 |
return (0);
|
|
763 |
}
|
|
764 |
|
|
765 |
CFullySpecCLPushStep_9::CFullySpecCLPushStep_9() {}
|
|
766 |
CFullySpecCLPushStep_9::~CFullySpecCLPushStep_9() {}
|
|
767 |
TVerdict CFullySpecCLPushStep_9::doTestStepL()
|
|
768 |
{
|
|
769 |
return TestStepResult();
|
|
770 |
}
|
|
771 |
|
|
772 |
TInt CFullySpecCLPushStep_9::CallStateMachine()
|
|
773 |
{
|
|
774 |
return (0);
|
|
775 |
}
|
|
776 |
|