24
|
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 |
// Test framework for SPUD TEL and SPUD FSM unit tests
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include <e32property.h>
|
|
24 |
#include <c32comm.h>
|
|
25 |
#include <e32def.h>
|
|
26 |
#include <e32std.h>
|
|
27 |
|
|
28 |
#include <in_iface.h>
|
|
29 |
#include <simtsy.h>
|
|
30 |
|
|
31 |
#include "SpudUnitTestStep.h"
|
|
32 |
#include "InputRequestListener.h"
|
|
33 |
|
|
34 |
using namespace EtelDriver;
|
|
35 |
|
|
36 |
CSpudUnitTestStepBase::CSpudUnitTestStepBase(TInt aTestNumber, TBool aUseTestPdpFsmInterface) : iTestNumber(aTestNumber), iUseTestPdpFsmInterface(aUseTestPdpFsmInterface)
|
|
37 |
{}
|
|
38 |
|
|
39 |
/**
|
|
40 |
Sets the section for the simtsy to use in its c:\config.txt file.
|
|
41 |
The section that will be used is testX, where X is the parameter
|
|
42 |
aTestNumber.
|
|
43 |
|
|
44 |
@param aTestNumber Simtsy configuration section number, which will be
|
|
45 |
set to ensure simtsy loads the correct parameters on
|
|
46 |
when it is loaded.
|
|
47 |
@leave The function leaves if the Sim.TSY test number property is not
|
|
48 |
defined; e.g. make sure StartC32 has been called.
|
|
49 |
*/
|
|
50 |
void CSpudUnitTestStepBase::SetSimTsyTestNumberL(TInt aTestNumber)
|
|
51 |
{
|
|
52 |
User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, aTestNumber));
|
|
53 |
}
|
|
54 |
|
|
55 |
/**
|
|
56 |
Initializes the test framework, including creating the thread that will run the active
|
|
57 |
scheduler containing the components under test (SPUD or SPUDTEL)
|
|
58 |
*/
|
|
59 |
TVerdict CSpudUnitTestStepBase::doTestStepPreambleL()
|
|
60 |
{
|
|
61 |
SetSimTsyTestNumberL(iTestNumber);
|
|
62 |
|
|
63 |
// create CTestRequestListener, to be used to contain parameters to be passed
|
|
64 |
// between the two threads
|
|
65 |
switch (iTestNumber)
|
|
66 |
{
|
|
67 |
case KSimTsyTestNumberR5OrR99R4:
|
|
68 |
#ifdef SYMBIAN_NETWORKING_UMTSR5
|
|
69 |
iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, TPacketDataConfigBase::KConfigRel5);
|
|
70 |
#else
|
|
71 |
iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, TPacketDataConfigBase::KConfigRel99Rel4);
|
|
72 |
#endif
|
|
73 |
break;
|
|
74 |
default:
|
|
75 |
iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface, TPacketDataConfigBase::KConfigGPRS);
|
|
76 |
break;
|
|
77 |
}
|
|
78 |
|
|
79 |
// creating and start the thread that will run the active scheduler containing SPUD or SPUDTEL
|
|
80 |
TActiveSchedulerThreadParams params;
|
|
81 |
params.iListener = iListener;
|
|
82 |
params.iThreadId = RThread().Id();
|
|
83 |
_LIT(activeSchedulerThreadName, "ActiveSchedulerThread_");
|
|
84 |
TBuf<255> buf(activeSchedulerThreadName);
|
|
85 |
buf.AppendNum(iTestNumber);
|
|
86 |
TInt ret = iActiveSchedulerThread.Create(buf, ActiveSchedulerThread, KDefaultStackSize, NULL, ¶ms);
|
|
87 |
TESTEL(ret == KErrNone, ret);
|
|
88 |
iActiveSchedulerThread.Resume();
|
|
89 |
|
|
90 |
// wait for the thread to initialize before sending it any requests
|
|
91 |
User::WaitForRequest(iListener->iThreadInitialized);
|
|
92 |
|
|
93 |
return TestStepResult();
|
|
94 |
}
|
|
95 |
|
|
96 |
/**
|
|
97 |
Cleans up anything allocated in the preamble
|
|
98 |
*/
|
|
99 |
TVerdict CSpudUnitTestStepBase::doTestStepPostambleL()
|
|
100 |
{
|
|
101 |
// if we complete the listener's status with an error, the RunL will stop the
|
|
102 |
// active scheduler and the thread will clean up any resources and exit
|
|
103 |
TRequestStatus *status = &iListener->iStatus;
|
|
104 |
iActiveSchedulerThread.RequestComplete(status, KErrCancel);
|
|
105 |
|
|
106 |
// wait until the thread has cleaned up then kill it
|
|
107 |
// if the iThreadDestructed is never completed, this is probably the result of the UHEAP_MARKEND macro failing
|
|
108 |
User::WaitForRequest(iListener->iThreadDestructed);
|
|
109 |
iActiveSchedulerThread.Kill(KErrNone);
|
|
110 |
iActiveSchedulerThread.Close();
|
|
111 |
|
|
112 |
delete iListener;
|
|
113 |
iListener = NULL;
|
|
114 |
|
|
115 |
return EPass;
|
|
116 |
}
|
|
117 |
|
|
118 |
/**
|
|
119 |
Initializes the packet service to query current parameters
|
|
120 |
*/
|
|
121 |
void CSpudUnitTestStepBase::InitPhoneAndPacketServiceL()
|
|
122 |
{
|
|
123 |
TESTL(iTelServer.Connect() == KErrNone);
|
|
124 |
TESTL(iTelServer.LoadPhoneModule( _L("SIM") ) == KErrNone);
|
|
125 |
TESTL(iPhone.Open ( iTelServer, _L("SimulatorPhone") ) == KErrNone);
|
|
126 |
TESTL(iPacketService.Open(iPhone) == KErrNone);
|
|
127 |
}
|
|
128 |
|
|
129 |
void CSpudUnitTestStepBase::DestroyPhoneAndPacketService()
|
|
130 |
{
|
|
131 |
iPacketService.Close();
|
|
132 |
iPhone.Close();
|
|
133 |
iTelServer.Close();
|
|
134 |
}
|
|
135 |
|
|
136 |
// Set up to not use Test PdpFsmInterface (and use the spud fsm's RPdpFsmInterface)
|
|
137 |
CSpudFsmUnitTestStepBase::CSpudFsmUnitTestStepBase(TInt aTestNumber) : CSpudUnitTestStepBase(aTestNumber, EFalse)
|
|
138 |
{}
|
|
139 |
|
|
140 |
// Set up to use Test PdpFsmInterface
|
|
141 |
CSpudTelUnitTestStepBase::CSpudTelUnitTestStepBase(TInt aTestNumber) : CSpudUnitTestStepBase(aTestNumber, ETrue)
|
|
142 |
{}
|
|
143 |
|
|
144 |
/**
|
|
145 |
Must be called after simtsy has been initialized.
|
|
146 |
Instructs the simtsy to complete a given request/notification. The supported commands are given in TEtelRequestType.
|
|
147 |
The parameter supplied in aNewValue instructs the simtsy what data from the config.txt to use in the completion of the request.
|
|
148 |
The aNewValue is the index to the entry to be used to complete the request for the current test step section, ie if aNewValue
|
|
149 |
is 0, iTestNumber is 3, and aEtelCommand is ENetworkQoSChange, the entry will complete any NotifyNetworkQoSChange calls
|
|
150 |
with data from the first QosProfileReqR99 entry of section [test3] in the config.txt file
|
|
151 |
*/
|
|
152 |
void CSpudUnitTestStepBase::EtelRequest(TEtelRequestType aEtelCommand, TInt aNewValue)
|
|
153 |
{
|
|
154 |
INFO_PRINTF3(_L("CSpudUnitTestStepBase::EtelRequest: aEtelCommand = %d, aNewValue = %d"), aEtelCommand, aNewValue);
|
|
155 |
|
|
156 |
TUint key(0);
|
|
157 |
|
|
158 |
switch (aEtelCommand)
|
|
159 |
{
|
|
160 |
case ENetworkQoSChange:
|
|
161 |
key = KPSSimTsyNetworkQoSChange;
|
|
162 |
break;
|
|
163 |
case ENetworkChangeRegStatus:
|
|
164 |
key = KPSSimtsyPacketServiceNtwkRegStatusChange;
|
|
165 |
break;
|
|
166 |
case EContextStatusChange:
|
|
167 |
key = KPSSimtsyPacketContextStatusChange;
|
|
168 |
break;
|
|
169 |
default:
|
|
170 |
// log error
|
|
171 |
return;
|
|
172 |
}
|
|
173 |
|
|
174 |
// simtsy will listen for any changes to the property, and complete the corresponding request
|
|
175 |
TInt ret = RProperty::Set(KUidPSSimTsyCategory, key, aNewValue);
|
|
176 |
TEST(ret == KErrNone);
|
|
177 |
}
|
|
178 |
|
|
179 |
/**
|
|
180 |
Calling this will instruct the CTestRequestListener to call REtelDriverInput::CancelPdpNotifications on SPUDTEL
|
|
181 |
*/
|
|
182 |
void CSpudTelUnitTestStepBase::CancelPdpRequest(TContextId aPdpId)
|
|
183 |
{
|
|
184 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::EtelDriverCancelPdpRequest: aPdpId = %d"), aPdpId);
|
|
185 |
// wait until iListener to finish with the iControlData member so that 2 requests
|
|
186 |
// immediately after one another will still work
|
|
187 |
User::WaitForRequest(iListener->iReadyForInputRequest);
|
|
188 |
iListener->iReadyForInputRequest = KRequestPending;
|
|
189 |
|
|
190 |
// set the parameters to pass to REtelDriverInput::Input
|
|
191 |
iListener->iEtelDriverCancelRequestPdpId = aPdpId;
|
|
192 |
|
|
193 |
// complete iListener's status, causing its RunL to call CancelPdp on SPUDTEL
|
|
194 |
TRequestStatus *status = &iListener->iStatus;
|
|
195 |
iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EEtelDriverCancelPdpRequest);
|
|
196 |
}
|
|
197 |
|
|
198 |
/**
|
|
199 |
Calling this will instruct the CTestRequestListener to call REtelDriverInput::Input on SPUDTEL
|
|
200 |
*/
|
|
201 |
void CSpudTelUnitTestStepBase::EtelDriverInputRequest(TContextId aPdpId, TEtelInput aOperation)
|
|
202 |
{
|
|
203 |
INFO_PRINTF3(_L("CSpudUnitTestStepBase::EtelDriverInputRequest: aPdpId = %d, aOperation = %d"), aPdpId, aOperation);
|
|
204 |
// wait until iListener to finish with the iControlData member so that 2 requests
|
|
205 |
// immediately after one another will still work
|
|
206 |
User::WaitForRequest(iListener->iReadyForInputRequest);
|
|
207 |
iListener->iReadyForInputRequest = KRequestPending;
|
|
208 |
|
|
209 |
// set the parameters to pass to REtelDriverInput::Input
|
|
210 |
iListener->iEtelDriverInputRequestData.iPdpId = aPdpId;
|
|
211 |
iListener->iEtelDriverInputRequestData.iOperation = aOperation;
|
|
212 |
|
|
213 |
// complete iListener's status, causing its RunL to call Input on SPUDTEL
|
|
214 |
TRequestStatus *status = &iListener->iStatus;
|
|
215 |
iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EEtelDriverInputRequest);
|
|
216 |
}
|
|
217 |
|
|
218 |
/**
|
|
219 |
Wait for RPdpFsmInterface::Input to be called with a non-notification event
|
|
220 |
*/
|
|
221 |
void CSpudTelUnitTestStepBase::WaitForEtelDriverInputResponse(TContextId aPdpId, PdpFsm::TEtelSignal aSignal, TInt aError)
|
|
222 |
{
|
|
223 |
INFO_PRINTF3(_L("CSpudUnitTestStepBase::WaitForEtelDriverInputResponse: aPdpId = %d, aSignal = %d"), aPdpId, aSignal);
|
|
224 |
|
|
225 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverInputResponseStatus request
|
|
226 |
User::WaitForRequest(iListener->iEtelDriverInputResponseStatus);
|
|
227 |
|
|
228 |
// make sure the parameters are as expected
|
|
229 |
TEST(iListener->iEtelDriverInputResponseStatus == aError);
|
|
230 |
TEST(iListener->iEtelDriverInputResponseData.iPdpId == aPdpId);
|
|
231 |
TEST(iListener->iEtelDriverInputResponseData.iSignal == aSignal);
|
|
232 |
|
|
233 |
iListener->iEtelDriverInputResponseStatus = KRequestPending;
|
|
234 |
}
|
|
235 |
|
|
236 |
/**
|
|
237 |
Wait for RPdpFsmInterface::Input to be called with aOperation EConfigGPRSChangeNetwork
|
|
238 |
*/
|
|
239 |
void CSpudTelUnitTestStepBase::WaitForNextContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfigGPRS)
|
|
240 |
{
|
|
241 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: aPdpId = %d"), aPdpId);
|
|
242 |
|
|
243 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverConfigGPRSNotificationStatus request
|
|
244 |
User::WaitForRequest(iListener->iEtelDriverConfigGPRSNotificationStatus);
|
|
245 |
|
|
246 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: iListener->iNotifyContextConfigData.iPdpId = %d"), iListener->iNotifyContextConfigData.iPdpId);
|
|
247 |
// make sure the parameters are as expected
|
|
248 |
TEST(iListener->iEtelDriverConfigGPRSNotificationStatus == KErrNone);
|
|
249 |
TEST(iListener->iNotifyContextConfigData.iPdpId == aPdpId);
|
|
250 |
TEST(CompareContextConfigGPRS(iListener->iNotifyContextConfigData.iContextConfigGPRS, aContextConfigGPRS));
|
|
251 |
|
|
252 |
iListener->iEtelDriverConfigGPRSNotificationStatus = KRequestPending;
|
|
253 |
}
|
|
254 |
|
|
255 |
/**
|
|
256 |
Wait for RPdpFsmInterface::Input to be called with aOperation EConfigGPRSChangeNetwork
|
|
257 |
RPacketContext::TContextConfig_R5 overload
|
|
258 |
*/
|
|
259 |
void CSpudTelUnitTestStepBase::WaitForNextContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfig_R5& aContextConfigR5)
|
|
260 |
{
|
|
261 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: aPdpId = %d"), aPdpId);
|
|
262 |
|
|
263 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverConfigGPRSNotificationStatus request
|
|
264 |
User::WaitForRequest(iListener->iEtelDriverConfigGPRSNotificationStatus);
|
|
265 |
|
|
266 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: iListener->iNotifyContextConfigData.iPdpId = %d"), iListener->iNotifyContextConfigData.iPdpId);
|
|
267 |
// make sure the parameters are as expected
|
|
268 |
TEST(iListener->iEtelDriverConfigGPRSNotificationStatus == KErrNone);
|
|
269 |
TEST(iListener->iNotifyContextConfigData.iPdpId == aPdpId);
|
|
270 |
TEST(CompareContextConfigR5(iListener->iNotifyContextConfigData.iContextConfig_R5, aContextConfigR5));
|
|
271 |
|
|
272 |
iListener->iEtelDriverConfigGPRSNotificationStatus = KRequestPending;
|
|
273 |
}
|
|
274 |
|
|
275 |
/**
|
|
276 |
Wait for RPdpFsmInterface::Input to be called with aOperation EConfigGPRSChangeNetwork
|
|
277 |
RPacketContext::TContextConfigR99_R4 overload
|
|
278 |
*/
|
|
279 |
void CSpudTelUnitTestStepBase::WaitForNextContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigR99_R4& aContextConfigR99R4)
|
|
280 |
{
|
|
281 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: aPdpId = %d"), aPdpId);
|
|
282 |
|
|
283 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverConfigGPRSNotificationStatus request
|
|
284 |
User::WaitForRequest(iListener->iEtelDriverConfigGPRSNotificationStatus);
|
|
285 |
|
|
286 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: iListener->iNotifyContextConfigData.iPdpId = %d"), iListener->iNotifyContextConfigData.iPdpId);
|
|
287 |
// make sure the parameters are as expected
|
|
288 |
TEST(iListener->iEtelDriverConfigGPRSNotificationStatus == KErrNone);
|
|
289 |
TEST(iListener->iNotifyContextConfigData.iPdpId == aPdpId);
|
|
290 |
TEST(CompareContextConfigR99R4(iListener->iNotifyContextConfigData.iContextConfigR99_R4, aContextConfigR99R4));
|
|
291 |
|
|
292 |
iListener->iEtelDriverConfigGPRSNotificationStatus = KRequestPending;
|
|
293 |
}
|
|
294 |
|
|
295 |
|
|
296 |
/**
|
|
297 |
Wait for RPdpFsmInterface::Input to be called with aOperation EContextStatusChangeNetwork
|
|
298 |
*/
|
|
299 |
void CSpudTelUnitTestStepBase::WaitForGivenEtelContextStatusNotification(TContextId aPdpId, RPacketContext::TContextStatus aContextStatus)
|
|
300 |
{
|
|
301 |
INFO_PRINTF3(_L("CSpudUnitTestStepBase::WaitForGivenContextStatusNotification: aPdpId = %d, aContextStatus = %d"), aPdpId, aContextStatus);
|
|
302 |
|
|
303 |
do
|
|
304 |
{
|
|
305 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverContextStatusNotificationStatus request
|
|
306 |
User::WaitForRequest(iListener->iEtelDriverContextStatusNotificationStatus);
|
|
307 |
|
|
308 |
INFO_PRINTF3(_L("CSpudUnitTestStepBase::WaitForGivenContextStatusNotification: iPdpId = %d, iContextStatus = %d"), iListener->iNotifyContextConfigData.iPdpId, iListener->iNotifyContextStatusData.iContextStatus);
|
|
309 |
} while (iListener->iNotifyContextStatusData.iPdpId != aPdpId || iListener->iNotifyContextStatusData.iContextStatus != aContextStatus);
|
|
310 |
|
|
311 |
// make sure the parameters are as expected
|
|
312 |
TEST(iListener->iEtelDriverContextStatusNotificationStatus == KErrNone);
|
|
313 |
TEST(iListener->iNotifyContextStatusData.iPdpId == aPdpId);
|
|
314 |
TEST(iListener->iNotifyContextStatusData.iContextStatus == aContextStatus);
|
|
315 |
|
|
316 |
iListener->iEtelDriverContextStatusNotificationStatus = KRequestPending;
|
|
317 |
}
|
|
318 |
|
|
319 |
/**
|
|
320 |
Wait for RPdpFsmInterface::Input to be called with aOperation EQoSProfileChangeNetwork
|
|
321 |
*/
|
|
322 |
void CSpudTelUnitTestStepBase::WaitForNextQosNotification(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQoSR99_R4Negotiated)
|
|
323 |
{
|
|
324 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextQosNotification: aPdpId = %d"), aPdpId);
|
|
325 |
|
|
326 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverQosNotificationStatus request
|
|
327 |
User::WaitForRequest(iListener->iEtelDriverQosNotificationStatus);
|
|
328 |
|
|
329 |
// make sure the parameters are as expected
|
|
330 |
TEST(iListener->iEtelDriverQosNotificationStatus == KErrNone);
|
|
331 |
TEST(iListener->iNotifyQosNegotiatedData.iPdpId == aPdpId);
|
|
332 |
TEST(CompareUMTSQoSNeg(iListener->iNotifyQosNegotiatedData.iNegotiated.NegotiatedQoSR99_R4(), aQoSR99_R4Negotiated));
|
|
333 |
iListener->iEtelDriverQosNotificationStatus = KRequestPending;
|
|
334 |
}
|
|
335 |
|
|
336 |
|
|
337 |
/**
|
|
338 |
Wait for RPdpFsmInterface::Input to be called with aOperation EServiceStatusChangeNetwork
|
|
339 |
*/
|
|
340 |
void CSpudTelUnitTestStepBase::WaitForNextServiceNotificationStatus(RPacketService::TStatus aServiceStatus)
|
|
341 |
{
|
|
342 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextServiceNotificationStatus: aServiceStatus = %d"), aServiceStatus);
|
|
343 |
|
|
344 |
// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverServiceNotificationStatus request
|
|
345 |
User::WaitForRequest(iListener->iEtelDriverServiceNotificationStatus);
|
|
346 |
|
|
347 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextServiceNotificationStatus: aServiceStatus = %d"), aServiceStatus);
|
|
348 |
// make sure the parameters are as expected
|
|
349 |
TEST(iListener->iEtelDriverServiceNotificationStatus == KErrNone);
|
|
350 |
TEST(iListener->iPacketServiceStatus == aServiceStatus);
|
|
351 |
|
|
352 |
iListener->iEtelDriverServiceNotificationStatus = KRequestPending;
|
|
353 |
}
|
|
354 |
|
|
355 |
/**
|
|
356 |
Calling this will instruct the CTestRequestListener to call REtelDriverInput::Input on SPUDTEL
|
|
357 |
*/
|
|
358 |
void CSpudFsmUnitTestStepBase::FsmInputRequest(TContextId aPdpId, TInt aOperation, TInt aParam)
|
|
359 |
{
|
|
360 |
INFO_PRINTF4(_L("CSpudUnitTestStepBase::FsmInputRequest: aPdpId = %d, aOperation = %d, aParam = %d"), aPdpId, aOperation, aParam);
|
|
361 |
|
|
362 |
// wait until iListener to finish with the iControlData member so that 2 requests
|
|
363 |
// immediately after one another will still work
|
|
364 |
User::WaitForRequest(iListener->iReadyForInputRequest);
|
|
365 |
iListener->iReadyForInputRequest = KRequestPending;
|
|
366 |
|
|
367 |
// set the parameters to pass to REtelDriverInput::Input
|
|
368 |
iListener->iFsmInputRequestData.iPdpId = aPdpId;
|
|
369 |
iListener->iFsmInputRequestData.iOperation = aOperation;
|
|
370 |
iListener->iFsmInputRequestData.iParam = aParam;
|
|
371 |
|
|
372 |
// complete iListener's status, causing its RunL to call Input on SPUDTEL
|
|
373 |
TRequestStatus *status = &iListener->iStatus;
|
|
374 |
iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EFsmInputRequest);
|
|
375 |
}
|
|
376 |
|
|
377 |
/**
|
|
378 |
Wait for MSpudManInterface::Input to be called with a non-notification event
|
|
379 |
*/
|
|
380 |
void CSpudFsmUnitTestStepBase::WaitForFsmInputResponse(TInt aPdpId, TInt aEvent, TInt aParam)
|
|
381 |
{
|
|
382 |
INFO_PRINTF4(_L("CSpudUnitTestStepBase::WaitForFsmInputResponse: aPdpId = %d, aOperation = %d, aParam = %d"), aPdpId, aEvent, aParam);
|
|
383 |
|
|
384 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmInputResponseStatus request
|
|
385 |
User::WaitForRequest(iListener->iFsmInputResponseStatus);
|
|
386 |
|
|
387 |
// make sure the parameters are as expected
|
|
388 |
TEST(iListener->iFsmInputResponseStatus == KErrNone);
|
|
389 |
TEST(iListener->iFsmInputResponseData.iPdpId == aPdpId);
|
|
390 |
TEST(iListener->iFsmInputResponseData.iEvent == aEvent);
|
|
391 |
TEST(iListener->iFsmInputResponseData.iParam == aParam);
|
|
392 |
|
|
393 |
iListener->iFsmInputResponseStatus = KRequestPending;
|
|
394 |
}
|
|
395 |
|
|
396 |
|
|
397 |
TContextId CSpudFsmUnitTestStepBase::FsmObjectCreate()
|
|
398 |
{
|
|
399 |
INFO_PRINTF1(_L("CSpudUnitTestStepBase::FsmObjectCreate()"));
|
|
400 |
|
|
401 |
// wait until iListener to finish with the iControlData member so that 2 requests
|
|
402 |
// immediately after one another will still work
|
|
403 |
//
|
|
404 |
User::WaitForRequest(iListener->iReadyForInputRequest);
|
|
405 |
iListener->iReadyForInputRequest = KRequestPending;
|
|
406 |
|
|
407 |
// Set the parameters to pass to CPdpFsmFactory
|
|
408 |
//
|
|
409 |
iListener->iFsmInputRequestData.iPdpId = 0;
|
|
410 |
|
|
411 |
// complete iListener's status, causing its RunL to call Input on SPUDTEL
|
|
412 |
TRequestStatus *status = &iListener->iStatus;
|
|
413 |
iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EFsmObjectCreate);
|
|
414 |
|
|
415 |
return iListener->iFsmInputRequestData.iPdpId;
|
|
416 |
}
|
|
417 |
|
|
418 |
|
|
419 |
TInt CSpudFsmUnitTestStepBase::WaitForFsmObjectCreateResponse(TInt aPdpId)
|
|
420 |
{
|
|
421 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForEFsmObjectCreateRespons(aPdpId = %d)"), aPdpId);
|
|
422 |
|
|
423 |
// The Test listener will complete the iFsmObjectCreateResponse request.
|
|
424 |
//
|
|
425 |
User::WaitForRequest(iListener->iFsmObjectCreateResponse);
|
|
426 |
|
|
427 |
|
|
428 |
// Make sure the parameters are as expected
|
|
429 |
|
|
430 |
TEST(iListener->iFsmObjectCreateResponse == KErrNone);
|
|
431 |
|
|
432 |
|
|
433 |
iListener->iFsmObjectCreateResponse = KRequestPending;
|
|
434 |
return iListener->iFsmInputResponseData.iPdpId;
|
|
435 |
}
|
|
436 |
|
|
437 |
|
|
438 |
/**
|
|
439 |
Wait for MSpudManInterface::Input to be called with aOperation KContextBlockedEvent
|
|
440 |
*/
|
|
441 |
void CSpudFsmUnitTestStepBase::WaitForFsmSuspendedNotification(TContextId aPdpId)
|
|
442 |
{
|
|
443 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmSuspendedNotification: aPdpId = %d"), aPdpId);
|
|
444 |
|
|
445 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextSuspendedStatus request
|
|
446 |
User::WaitForRequest(iListener->iFsmContextSuspendedStatus);
|
|
447 |
|
|
448 |
// make sure the parameters are as expected
|
|
449 |
TEST(iListener->iFsmContextSuspendedStatus == KErrNone);
|
|
450 |
TEST(iListener->iContextBlockedEventPdpId == aPdpId);
|
|
451 |
|
|
452 |
iListener->iFsmContextSuspendedStatus = KRequestPending;
|
|
453 |
}
|
|
454 |
|
|
455 |
/**
|
|
456 |
Wait for MSpudManInterface::Input to be called with aOperation KContextUnblockedEvent
|
|
457 |
*/
|
|
458 |
void CSpudFsmUnitTestStepBase::WaitForFsmResumedNotification(TContextId aPdpId)
|
|
459 |
{
|
|
460 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForEtelDriverInputResponse: aPdpId = %d"), aPdpId);
|
|
461 |
|
|
462 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextResumedStatus request
|
|
463 |
User::WaitForRequest(iListener->iFsmContextResumedStatus);
|
|
464 |
|
|
465 |
// make sure the parameters are as expected
|
|
466 |
TEST(iListener->iFsmContextResumedStatus == KErrNone);
|
|
467 |
TEST(iListener->iContextUnblockedEventPdpId == aPdpId);
|
|
468 |
|
|
469 |
iListener->iFsmContextResumedStatus = KRequestPending;
|
|
470 |
}
|
|
471 |
|
|
472 |
/**
|
|
473 |
Wait for MSpudManInterface::Input to be called with aOperation KNetworkStatusEvent
|
|
474 |
*/
|
|
475 |
void CSpudFsmUnitTestStepBase::WaitForFsmServiceNotificationStatus()
|
|
476 |
{
|
|
477 |
INFO_PRINTF1(_L("CSpudUnitTestStepBase::WaitForGivenFsmServiceNotificationStatus"));
|
|
478 |
|
|
479 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmNetworkStatusStatus request
|
|
480 |
User::WaitForRequest(iListener->iFsmNetworkStatusStatus);
|
|
481 |
|
|
482 |
// make sure the parameters are as expected
|
|
483 |
TEST(iListener->iFsmNetworkStatusStatus == KErrNone);
|
|
484 |
// already checked iPdpId and iStatus from exiting condition of do while loop
|
|
485 |
|
|
486 |
iListener->iFsmNetworkStatusStatus = KRequestPending;
|
|
487 |
}
|
|
488 |
|
|
489 |
/**
|
|
490 |
Wait for MSpudManInterface::Input to be called with aOperation KContextParametersChangeEvent
|
|
491 |
*/
|
|
492 |
void CSpudFsmUnitTestStepBase::WaitForFsmContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfig)
|
|
493 |
{
|
|
494 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmContextConfigNotification: aPdpId = %d"), aPdpId);
|
|
495 |
|
|
496 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextParameterChangeStatus request
|
|
497 |
User::WaitForRequest(iListener->iFsmContextParameterChangeStatus);
|
|
498 |
|
|
499 |
// make sure the parameters are as expected
|
|
500 |
TEST(iListener->iFsmContextParameterChangeStatus == KErrNone);
|
|
501 |
TEST(iListener->iContextParametersEventData.iPdpId == aPdpId);
|
|
502 |
TEST(CompareContextConfigGPRS(aContextConfig, iListener->iContextParametersEventData.iContextConfig));
|
|
503 |
|
|
504 |
iListener->iFsmContextParameterChangeStatus = KRequestPending;
|
|
505 |
}
|
|
506 |
|
|
507 |
/**
|
|
508 |
Wait for MSpudManInterface::Input to be called with aOperation KContextParametersChangeEvent
|
|
509 |
RPacketContext::TContextConfig_R5 overload
|
|
510 |
*/
|
|
511 |
void CSpudFsmUnitTestStepBase::WaitForFsmContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfig_R5& aContextConfig)
|
|
512 |
{
|
|
513 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmContextConfigNotification: aPdpId = %d"), aPdpId);
|
|
514 |
|
|
515 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextParameterChangeStatus request
|
|
516 |
User::WaitForRequest(iListener->iFsmContextParameterChangeStatus);
|
|
517 |
|
|
518 |
// make sure the parameters are as expected
|
|
519 |
TEST(iListener->iFsmContextParameterChangeStatus == KErrNone);
|
|
520 |
TEST(iListener->iContextParametersEventData.iPdpId == aPdpId);
|
|
521 |
TEST(CompareContextConfigR5(aContextConfig, iListener->iContextParametersEventData.iContextConfig_R5));
|
|
522 |
|
|
523 |
iListener->iFsmContextParameterChangeStatus = KRequestPending;
|
|
524 |
}
|
|
525 |
|
|
526 |
/**
|
|
527 |
Wait for MSpudManInterface::Input to be called with aOperation KContextParametersChangeEvent
|
|
528 |
RPacketContext::TContextConfigR99_R4 overload
|
|
529 |
*/
|
|
530 |
void CSpudFsmUnitTestStepBase::WaitForFsmContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigR99_R4& aContextConfig)
|
|
531 |
{
|
|
532 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmContextConfigNotification: aPdpId = %d"), aPdpId);
|
|
533 |
|
|
534 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextParameterChangeStatus request
|
|
535 |
User::WaitForRequest(iListener->iFsmContextParameterChangeStatus);
|
|
536 |
|
|
537 |
// make sure the parameters are as expected
|
|
538 |
TEST(iListener->iFsmContextParameterChangeStatus == KErrNone);
|
|
539 |
TEST(iListener->iContextParametersEventData.iPdpId == aPdpId);
|
|
540 |
TEST(CompareContextConfigR99R4(aContextConfig, iListener->iContextParametersEventData.iContextConfigR99_R4));
|
|
541 |
|
|
542 |
iListener->iFsmContextParameterChangeStatus = KRequestPending;
|
|
543 |
}
|
|
544 |
|
|
545 |
|
|
546 |
/**
|
|
547 |
Wait for MSpudManInterface::Input to be called with aOperation KContextParametersChangeEvent
|
|
548 |
*/
|
|
549 |
void CSpudFsmUnitTestStepBase::WaitForFsmQosChangeNotification(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQosParams)
|
|
550 |
{
|
|
551 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmQosChangeNotification: aPdpId = %d"), aPdpId);
|
|
552 |
|
|
553 |
// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextParameterChangeStatus request
|
|
554 |
User::WaitForRequest(iListener->iFsmContextParameterChangeStatus);
|
|
555 |
|
|
556 |
// make sure the parameters are as expected
|
|
557 |
TEST(iListener->iFsmContextParameterChangeStatus == KErrNone);
|
|
558 |
TEST(iListener->iContextParametersEventData.iPdpId == aPdpId);
|
|
559 |
TEST(CompareUMTSQoSNeg(aQosParams, iListener->iContextParametersEventData.iNegotiated.NegotiatedQoSR99_R4()));
|
|
560 |
|
|
561 |
iListener->iFsmContextParameterChangeStatus = KRequestPending;
|
|
562 |
}
|
|
563 |
|
|
564 |
|
|
565 |
/**
|
|
566 |
Wait for context aPacketContext to have the given status
|
|
567 |
*/
|
|
568 |
void CSpudFsmUnitTestStepBase::WaitForGivenContextStatus(RPacketContext& aPacketContext, RPacketContext::TContextStatus aStatus)
|
|
569 |
{
|
|
570 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForGivenContextStatus: aStatus = %d"), aStatus);
|
|
571 |
|
|
572 |
TRequestStatus status;
|
|
573 |
RPacketContext::TContextStatus contextStatus = RPacketContext::EStatusUnknown;
|
|
574 |
RPacketContext::TContextStatus contextStatus1 = RPacketContext::EStatusUnknown;
|
|
575 |
|
|
576 |
aPacketContext.NotifyStatusChange(status, contextStatus);
|
|
577 |
TEST(aPacketContext.GetStatus(contextStatus1) == KErrNone);
|
|
578 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForGivenContextStatus: contextStatus1 = %d"), contextStatus1);
|
|
579 |
if (contextStatus1 != RPacketContext::EStatusDeleted)
|
|
580 |
{
|
|
581 |
while (contextStatus != aStatus)
|
|
582 |
{
|
|
583 |
User::WaitForRequest(status);
|
|
584 |
INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForGivenContextStatus: contextStatus = %d"), contextStatus);
|
|
585 |
TEST(status == KErrNone);
|
|
586 |
}
|
|
587 |
}
|
|
588 |
}
|