telephonyprotocols/umtsgprsscpr/Test/te_spud/src/SpudUnitTestStepBase.cpp
changeset 42 3adadc800673
equal deleted inserted replaced
31:8ab6687fb94c 42:3adadc800673
       
     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 	iListener = CInputRequestListener::NewL(iUseTestPdpFsmInterface);
       
    66 
       
    67 	// creating and start the thread that will run the active scheduler containing SPUD or SPUDTEL
       
    68 	TActiveSchedulerThreadParams params;
       
    69 	params.iListener = iListener;
       
    70 	params.iThreadId = RThread().Id();
       
    71 	_LIT(activeSchedulerThreadName, "ActiveSchedulerThread_");
       
    72 	TBuf<255> buf(activeSchedulerThreadName);
       
    73 	buf.AppendNum(iTestNumber);
       
    74 	TInt ret = iActiveSchedulerThread.Create(buf, ActiveSchedulerThread, KDefaultStackSize, NULL, &params);
       
    75 	TESTEL(ret == KErrNone, ret);
       
    76 	iActiveSchedulerThread.Resume();
       
    77 	
       
    78 	// wait for the thread to initialize before sending it any requests
       
    79 	User::WaitForRequest(iListener->iThreadInitialized);
       
    80 
       
    81 	return TestStepResult();
       
    82 	}
       
    83 	
       
    84 /**
       
    85  Cleans up anything allocated in the preamble
       
    86  */
       
    87 TVerdict CSpudUnitTestStepBase::doTestStepPostambleL()
       
    88 	{
       
    89 	// if we complete the listener's status with an error, the RunL will stop the 
       
    90 	// active scheduler and the thread will clean up any resources and exit
       
    91 	TRequestStatus *status = &iListener->iStatus;
       
    92 	iActiveSchedulerThread.RequestComplete(status, KErrCancel);
       
    93 
       
    94 	// wait until the thread has cleaned up then kill it
       
    95 	// if the iThreadDestructed is never completed, this is probably the result of the UHEAP_MARKEND macro failing
       
    96 	User::WaitForRequest(iListener->iThreadDestructed);
       
    97 	iActiveSchedulerThread.Kill(KErrNone);
       
    98 	iActiveSchedulerThread.Close();
       
    99 	
       
   100 	delete iListener;
       
   101 	iListener = NULL;
       
   102 
       
   103 	return EPass;
       
   104 	}
       
   105 	
       
   106 /**
       
   107  Initializes the packet service to query current parameters
       
   108 */
       
   109 void CSpudUnitTestStepBase::InitPhoneAndPacketServiceL()
       
   110 	{
       
   111 	TESTL(iTelServer.Connect() == KErrNone);
       
   112 	TESTL(iTelServer.LoadPhoneModule( _L("SIM") ) == KErrNone);
       
   113 	TESTL(iPhone.Open ( iTelServer, _L("SimulatorPhone") ) == KErrNone);
       
   114 	TESTL(iPacketService.Open(iPhone) == KErrNone);
       
   115 	}
       
   116 	
       
   117 void CSpudUnitTestStepBase::DestroyPhoneAndPacketService()
       
   118 	{
       
   119 	iPacketService.Close();
       
   120 	iPhone.Close();
       
   121 	iTelServer.Close();
       
   122 	}
       
   123 
       
   124 // Set up to not use Test PdpFsmInterface (and use the spud fsm's RPdpFsmInterface)
       
   125 CSpudFsmUnitTestStepBase::CSpudFsmUnitTestStepBase(TInt aTestNumber) : CSpudUnitTestStepBase(aTestNumber, EFalse)
       
   126 	{}
       
   127 	
       
   128 // Set up to use Test PdpFsmInterface
       
   129 CSpudTelUnitTestStepBase::CSpudTelUnitTestStepBase(TInt aTestNumber) : CSpudUnitTestStepBase(aTestNumber, ETrue)
       
   130 	{}
       
   131 
       
   132 /**
       
   133  Must be called after simtsy has been initialized.
       
   134  Instructs the simtsy to complete a given request/notification. The supported commands are given in TEtelRequestType.
       
   135  The parameter supplied in aNewValue instructs the simtsy what data from the config.txt to use in the completion of the request.
       
   136  The aNewValue is the index to the entry to be used to complete the request for the current test step section, ie if aNewValue
       
   137  is 0, iTestNumber is 3, and aEtelCommand is ENetworkQoSChange, the entry will complete any NotifyNetworkQoSChange calls
       
   138  with data from the first QosProfileReqR99 entry of section [test3] in the config.txt file
       
   139 */
       
   140 void CSpudUnitTestStepBase::EtelRequest(TEtelRequestType aEtelCommand, TInt aNewValue)
       
   141 	{
       
   142 	INFO_PRINTF3(_L("CSpudUnitTestStepBase::EtelRequest: aEtelCommand = %d, aNewValue = %d"), aEtelCommand, aNewValue);
       
   143 
       
   144 	TUint key(0);
       
   145 	
       
   146 	switch (aEtelCommand)
       
   147 		{
       
   148 	case ENetworkQoSChange:
       
   149 		key = KPSSimTsyNetworkQoSChange;
       
   150 		break;
       
   151 	case ENetworkChangeRegStatus:
       
   152 		key = KPSSimtsyPacketServiceNtwkRegStatusChange;
       
   153 		break;
       
   154 	case EContextStatusChange:
       
   155 		key = KPSSimtsyPacketContextStatusChange;
       
   156 		break;
       
   157 	default:
       
   158 		// log error
       
   159 		return;
       
   160 		}
       
   161 
       
   162   	// simtsy will listen for any changes to the property, and complete the corresponding request
       
   163 	TInt ret = RProperty::Set(KUidPSSimTsyCategory, key, aNewValue);
       
   164 	TEST(ret == KErrNone);
       
   165 	}
       
   166 
       
   167 /**
       
   168  Calling this will instruct the CTestRequestListener to call REtelDriverInput::CancelPdpNotifications on SPUDTEL
       
   169 */
       
   170 void CSpudTelUnitTestStepBase::CancelPdpRequest(TContextId aPdpId)
       
   171 	{
       
   172 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::EtelDriverCancelPdpRequest: aPdpId = %d"), aPdpId);
       
   173 	// wait until iListener to finish with the iControlData member so that 2 requests
       
   174 	// immediately after one another will still work
       
   175 	User::WaitForRequest(iListener->iReadyForInputRequest);
       
   176 	iListener->iReadyForInputRequest = KRequestPending;
       
   177 
       
   178 	// set the parameters to pass to REtelDriverInput::Input
       
   179 	iListener->iEtelDriverCancelRequestPdpId = aPdpId;
       
   180 
       
   181 	// complete iListener's status, causing its RunL to call CancelPdp on SPUDTEL
       
   182 	TRequestStatus *status = &iListener->iStatus;
       
   183 	iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EEtelDriverCancelPdpRequest);
       
   184 	}
       
   185 
       
   186 /**
       
   187  Calling this will instruct the CTestRequestListener to call REtelDriverInput::Input on SPUDTEL
       
   188 */
       
   189 void CSpudTelUnitTestStepBase::EtelDriverInputRequest(TContextId aPdpId, TEtelInput aOperation)
       
   190 	{
       
   191 	INFO_PRINTF3(_L("CSpudUnitTestStepBase::EtelDriverInputRequest: aPdpId = %d, aOperation = %d"), aPdpId, aOperation);
       
   192 	// wait until iListener to finish with the iControlData member so that 2 requests
       
   193 	// immediately after one another will still work
       
   194 	User::WaitForRequest(iListener->iReadyForInputRequest);
       
   195 	iListener->iReadyForInputRequest = KRequestPending;
       
   196 
       
   197 	// set the parameters to pass to REtelDriverInput::Input
       
   198 	iListener->iEtelDriverInputRequestData.iPdpId = aPdpId;
       
   199 	iListener->iEtelDriverInputRequestData.iOperation = aOperation;
       
   200 
       
   201 	// complete iListener's status, causing its RunL to call Input on SPUDTEL
       
   202 	TRequestStatus *status = &iListener->iStatus;
       
   203 	iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EEtelDriverInputRequest);
       
   204 	}
       
   205 
       
   206 /**
       
   207  Wait for RPdpFsmInterface::Input to be called with a non-notification event
       
   208 */
       
   209 void CSpudTelUnitTestStepBase::WaitForEtelDriverInputResponse(TContextId aPdpId, PdpFsm::TEtelSignal aSignal, TInt aError)
       
   210 	{
       
   211 	INFO_PRINTF3(_L("CSpudUnitTestStepBase::WaitForEtelDriverInputResponse: aPdpId = %d, aSignal = %d"), aPdpId, aSignal);
       
   212 	
       
   213 	// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverInputResponseStatus request
       
   214 	User::WaitForRequest(iListener->iEtelDriverInputResponseStatus);
       
   215 	
       
   216 	// make sure the parameters are as expected
       
   217 	TEST(iListener->iEtelDriverInputResponseStatus == aError);
       
   218 	TEST(iListener->iEtelDriverInputResponseData.iPdpId == aPdpId);
       
   219 	TEST(iListener->iEtelDriverInputResponseData.iSignal == aSignal);
       
   220 	
       
   221 	iListener->iEtelDriverInputResponseStatus = KRequestPending;
       
   222 	}
       
   223 	
       
   224 /**
       
   225  Wait for RPdpFsmInterface::Input to be called with aOperation EConfigGPRSChangeNetwork
       
   226 */
       
   227 void CSpudTelUnitTestStepBase::WaitForNextContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfigGPRS)
       
   228 	{
       
   229 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: aPdpId = %d"), aPdpId);
       
   230 	
       
   231 	// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverConfigGPRSNotificationStatus request
       
   232 	User::WaitForRequest(iListener->iEtelDriverConfigGPRSNotificationStatus);
       
   233 	
       
   234 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextContextConfigNotification: iListener->iNotifyContextConfigData.iPdpId = %d"), iListener->iNotifyContextConfigData.iPdpId);
       
   235 	// make sure the parameters are as expected
       
   236 	TEST(iListener->iEtelDriverConfigGPRSNotificationStatus == KErrNone);
       
   237 	TEST(iListener->iNotifyContextConfigData.iPdpId == aPdpId);
       
   238 	TEST(CompareContextConfigGPRS(iListener->iNotifyContextConfigData.iContextConfigGPRS, aContextConfigGPRS));
       
   239 	
       
   240 	iListener->iEtelDriverConfigGPRSNotificationStatus = KRequestPending;
       
   241 	}
       
   242 
       
   243 /**
       
   244  Wait for RPdpFsmInterface::Input to be called with aOperation EContextStatusChangeNetwork
       
   245 */
       
   246 void CSpudTelUnitTestStepBase::WaitForGivenEtelContextStatusNotification(TContextId aPdpId, RPacketContext::TContextStatus aContextStatus)
       
   247 	{
       
   248 	INFO_PRINTF3(_L("CSpudUnitTestStepBase::WaitForGivenContextStatusNotification: aPdpId = %d, aContextStatus = %d"), aPdpId, aContextStatus);
       
   249 	
       
   250 	do
       
   251 		{
       
   252 	// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverContextStatusNotificationStatus request
       
   253 		User::WaitForRequest(iListener->iEtelDriverContextStatusNotificationStatus);
       
   254 		
       
   255 		INFO_PRINTF3(_L("CSpudUnitTestStepBase::WaitForGivenContextStatusNotification: iPdpId = %d, iContextStatus = %d"), iListener->iNotifyContextConfigData.iPdpId, iListener->iNotifyContextStatusData.iContextStatus);
       
   256 		} while (iListener->iNotifyContextStatusData.iPdpId != aPdpId || iListener->iNotifyContextStatusData.iContextStatus != aContextStatus);
       
   257 	
       
   258 	// make sure the parameters are as expected
       
   259 	TEST(iListener->iEtelDriverContextStatusNotificationStatus == KErrNone);
       
   260 	TEST(iListener->iNotifyContextStatusData.iPdpId == aPdpId);
       
   261 	TEST(iListener->iNotifyContextStatusData.iContextStatus == aContextStatus);
       
   262 	
       
   263 	iListener->iEtelDriverContextStatusNotificationStatus = KRequestPending;
       
   264 	}
       
   265 
       
   266 /**
       
   267  Wait for RPdpFsmInterface::Input to be called with aOperation EQoSProfileChangeNetwork
       
   268 */
       
   269 void CSpudTelUnitTestStepBase::WaitForNextQosNotification(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQoSR99_R4Negotiated)
       
   270 	{
       
   271 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextQosNotification: aPdpId = %d"), aPdpId);
       
   272 	
       
   273 	// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverQosNotificationStatus request
       
   274 	User::WaitForRequest(iListener->iEtelDriverQosNotificationStatus);
       
   275 	
       
   276 	// make sure the parameters are as expected
       
   277 	TEST(iListener->iEtelDriverQosNotificationStatus == KErrNone);
       
   278 	TEST(iListener->iNotifyQosNegotiatedData.iPdpId == aPdpId);
       
   279 	TEST(CompareUMTSQoSNeg(iListener->iNotifyQosNegotiatedData.iNegotiated.NegotiatedQoSR99_R4(), aQoSR99_R4Negotiated));
       
   280 	iListener->iEtelDriverQosNotificationStatus = KRequestPending;
       
   281 	}
       
   282 
       
   283 
       
   284 /**
       
   285  Wait for RPdpFsmInterface::Input to be called with aOperation EServiceStatusChangeNetwork
       
   286 */
       
   287 void CSpudTelUnitTestStepBase::WaitForNextServiceNotificationStatus(RPacketService::TStatus aServiceStatus)
       
   288 	{
       
   289 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextServiceNotificationStatus: aServiceStatus = %d"), aServiceStatus);
       
   290 	
       
   291 	// the implementation of RPdpFsmInterface::Input that is called by the Etel driver will complete the iEtelDriverServiceNotificationStatus request
       
   292 	User::WaitForRequest(iListener->iEtelDriverServiceNotificationStatus);
       
   293 	
       
   294 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForNextServiceNotificationStatus: aServiceStatus = %d"), aServiceStatus);
       
   295 	// make sure the parameters are as expected
       
   296 	TEST(iListener->iEtelDriverServiceNotificationStatus == KErrNone);
       
   297 	TEST(iListener->iPacketServiceStatus == aServiceStatus);
       
   298 	
       
   299 	iListener->iEtelDriverServiceNotificationStatus = KRequestPending;
       
   300 	}
       
   301 
       
   302 /**
       
   303  Calling this will instruct the CTestRequestListener to call REtelDriverInput::Input on SPUDTEL
       
   304 */
       
   305 void CSpudFsmUnitTestStepBase::FsmInputRequest(TContextId aPdpId, TInt aOperation, TInt aParam)
       
   306 	{
       
   307 	INFO_PRINTF4(_L("CSpudUnitTestStepBase::FsmInputRequest: aPdpId = %d, aOperation = %d, aParam = %d"), aPdpId, aOperation, aParam);
       
   308 
       
   309 	// wait until iListener to finish with the iControlData member so that 2 requests
       
   310 	// immediately after one another will still work
       
   311 	User::WaitForRequest(iListener->iReadyForInputRequest);
       
   312 	iListener->iReadyForInputRequest = KRequestPending;
       
   313 
       
   314 	// set the parameters to pass to REtelDriverInput::Input
       
   315 	iListener->iFsmInputRequestData.iPdpId = aPdpId;
       
   316 	iListener->iFsmInputRequestData.iOperation = aOperation;
       
   317 	iListener->iFsmInputRequestData.iParam = aParam;
       
   318 
       
   319 	// complete iListener's status, causing its RunL to call Input on SPUDTEL
       
   320 	TRequestStatus *status = &iListener->iStatus;
       
   321 	iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EFsmInputRequest);
       
   322 	}
       
   323 
       
   324 /**
       
   325  Wait for MSpudManInterface::Input to be called with a non-notification event
       
   326 */
       
   327 void CSpudFsmUnitTestStepBase::WaitForFsmInputResponse(TInt aPdpId, TInt aEvent, TInt aParam)
       
   328 	{
       
   329 	INFO_PRINTF4(_L("CSpudUnitTestStepBase::WaitForFsmInputResponse: aPdpId = %d, aOperation = %d, aParam = %d"), aPdpId, aEvent, aParam);
       
   330 	
       
   331 	// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmInputResponseStatus request
       
   332 	User::WaitForRequest(iListener->iFsmInputResponseStatus);
       
   333 	
       
   334 	// make sure the parameters are as expected
       
   335 	TEST(iListener->iFsmInputResponseStatus == KErrNone);
       
   336 	TEST(iListener->iFsmInputResponseData.iPdpId == aPdpId);
       
   337 	TEST(iListener->iFsmInputResponseData.iEvent == aEvent);
       
   338 	TEST(iListener->iFsmInputResponseData.iParam == aParam);
       
   339 	
       
   340 	iListener->iFsmInputResponseStatus = KRequestPending;
       
   341 	}
       
   342 
       
   343 
       
   344 void CSpudFsmUnitTestStepBase::FsmObjectCreate(TContextId aPdpId)
       
   345     {
       
   346 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::FsmObjectCreate(aPdpId = %d)"), aPdpId);
       
   347 
       
   348 	// wait until iListener to finish with the iControlData member so that 2 requests
       
   349 	// immediately after one another will still work
       
   350 	//
       
   351 	User::WaitForRequest(iListener->iReadyForInputRequest);
       
   352 	iListener->iReadyForInputRequest = KRequestPending;
       
   353 
       
   354 	// Set the parameters to pass to CPdpFsmFactory
       
   355 	//
       
   356 	iListener->iFsmInputRequestData.iPdpId = aPdpId;
       
   357 
       
   358 	// complete iListener's status, causing its RunL to call Input on SPUDTEL
       
   359 	TRequestStatus *status = &iListener->iStatus;
       
   360 	iActiveSchedulerThread.RequestComplete(status, CInputRequestListener::EFsmObjectCreate);
       
   361     }
       
   362     
       
   363     
       
   364 void CSpudFsmUnitTestStepBase::WaitForFsmObjectCreateResponse(TInt aPdpId)
       
   365     {
       
   366 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForEFsmObjectCreateRespons(aPdpId = %d)"), aPdpId);
       
   367 	
       
   368 	// The Test listener will complete the iFsmObjectCreateResponse request.
       
   369 	//
       
   370 	User::WaitForRequest(iListener->iFsmObjectCreateResponse);
       
   371 	
       
   372 
       
   373 	// Make sure the parameters are as expected
       
   374 	
       
   375 	TEST(iListener->iFsmObjectCreateResponse == KErrNone);
       
   376 
       
   377 
       
   378 	TEST(iListener->iFsmInputResponseData.iPdpId == aPdpId);
       
   379 
       
   380 	iListener->iFsmObjectCreateResponse = KRequestPending;
       
   381 	
       
   382     }
       
   383 
       
   384 
       
   385 /**
       
   386  Wait for MSpudManInterface::Input to be called with aOperation KContextBlockedEvent
       
   387 */
       
   388 void CSpudFsmUnitTestStepBase::WaitForFsmSuspendedNotification(TContextId aPdpId)
       
   389 	{
       
   390 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmSuspendedNotification: aPdpId = %d"), aPdpId);
       
   391 	
       
   392 	// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextSuspendedStatus request
       
   393 	User::WaitForRequest(iListener->iFsmContextSuspendedStatus);
       
   394 	
       
   395 	// make sure the parameters are as expected
       
   396 	TEST(iListener->iFsmContextSuspendedStatus == KErrNone);
       
   397 	TEST(iListener->iContextBlockedEventPdpId == aPdpId);
       
   398 	
       
   399 	iListener->iFsmContextSuspendedStatus = KRequestPending;
       
   400 	}
       
   401 
       
   402 /**
       
   403  Wait for MSpudManInterface::Input to be called with aOperation KContextUnblockedEvent
       
   404 */
       
   405 void CSpudFsmUnitTestStepBase::WaitForFsmResumedNotification(TContextId aPdpId)
       
   406 	{
       
   407 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForEtelDriverInputResponse: aPdpId = %d"), aPdpId);
       
   408 	
       
   409 	// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextResumedStatus request
       
   410 	User::WaitForRequest(iListener->iFsmContextResumedStatus);
       
   411 	
       
   412 	// make sure the parameters are as expected
       
   413 	TEST(iListener->iFsmContextResumedStatus == KErrNone);
       
   414 	TEST(iListener->iContextUnblockedEventPdpId == aPdpId);
       
   415 	
       
   416 	iListener->iFsmContextResumedStatus = KRequestPending;
       
   417 	}
       
   418 	
       
   419 /**
       
   420  Wait for MSpudManInterface::Input to be called with aOperation KNetworkStatusEvent
       
   421 */
       
   422 void CSpudFsmUnitTestStepBase::WaitForFsmServiceNotificationStatus()
       
   423 	{
       
   424 	INFO_PRINTF1(_L("CSpudUnitTestStepBase::WaitForGivenFsmServiceNotificationStatus"));
       
   425 	
       
   426 	// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmNetworkStatusStatus request
       
   427 	User::WaitForRequest(iListener->iFsmNetworkStatusStatus);
       
   428 	
       
   429 	// make sure the parameters are as expected
       
   430 	TEST(iListener->iFsmNetworkStatusStatus == KErrNone);
       
   431 	// already checked iPdpId and iStatus from exiting condition of do while loop
       
   432 	
       
   433 	iListener->iFsmNetworkStatusStatus = KRequestPending;
       
   434 	}
       
   435 
       
   436 /**
       
   437  Wait for MSpudManInterface::Input to be called with aOperation KContextParametersChangeEvent
       
   438 */
       
   439 void CSpudFsmUnitTestStepBase::WaitForFsmContextConfigNotification(TContextId aPdpId, const RPacketContext::TContextConfigGPRS& aContextConfig)
       
   440 	{
       
   441 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmContextConfigNotification: aPdpId = %d"), aPdpId);
       
   442 	
       
   443 	// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextParameterChangeStatus request
       
   444 	User::WaitForRequest(iListener->iFsmContextParameterChangeStatus);
       
   445 	
       
   446 	// make sure the parameters are as expected
       
   447 	TEST(iListener->iFsmContextParameterChangeStatus == KErrNone);
       
   448 	TEST(iListener->iContextParametersEventData.iPdpId == aPdpId);
       
   449 	TEST(CompareContextConfigGPRS(aContextConfig, iListener->iContextParametersEventData.iContextConfig));
       
   450 	
       
   451 	iListener->iFsmContextParameterChangeStatus = KRequestPending;
       
   452 	}
       
   453 	
       
   454 /**
       
   455  Wait for MSpudManInterface::Input to be called with aOperation KContextParametersChangeEvent
       
   456 */
       
   457 void CSpudFsmUnitTestStepBase::WaitForFsmQosChangeNotification(TContextId aPdpId, const RPacketQoS::TQoSR99_R4Negotiated& aQosParams)
       
   458 	{
       
   459 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForFsmQosChangeNotification: aPdpId = %d"), aPdpId);
       
   460 	
       
   461 	// the implementation of MSpudManInterface::Input that is called by the Etel driver will complete the iFsmContextParameterChangeStatus request
       
   462 	User::WaitForRequest(iListener->iFsmContextParameterChangeStatus);
       
   463 	
       
   464 	// make sure the parameters are as expected
       
   465 	TEST(iListener->iFsmContextParameterChangeStatus == KErrNone);
       
   466 	TEST(iListener->iContextParametersEventData.iPdpId == aPdpId);
       
   467 	TEST(CompareUMTSQoSNeg(aQosParams, iListener->iContextParametersEventData.iNegotiated.NegotiatedQoSR99_R4()));
       
   468 	
       
   469 	iListener->iFsmContextParameterChangeStatus = KRequestPending;
       
   470 	}
       
   471 
       
   472 
       
   473 /**
       
   474  Wait for context aPacketContext to have the given status
       
   475 */
       
   476 void CSpudFsmUnitTestStepBase::WaitForGivenContextStatus(RPacketContext& aPacketContext, RPacketContext::TContextStatus aStatus)
       
   477 	{
       
   478 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForGivenContextStatus: aStatus = %d"), aStatus);
       
   479 	
       
   480  	TRequestStatus status;
       
   481 	RPacketContext::TContextStatus contextStatus = RPacketContext::EStatusUnknown;
       
   482 	RPacketContext::TContextStatus contextStatus1 = RPacketContext::EStatusUnknown;
       
   483 
       
   484 	aPacketContext.NotifyStatusChange(status, contextStatus);
       
   485 	aPacketContext.GetStatus(contextStatus1);
       
   486 	INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForGivenContextStatus: contextStatus1 = %d"), contextStatus1);
       
   487 	if (contextStatus1 != RPacketContext::EStatusDeleted)
       
   488 		{
       
   489 		while (contextStatus != aStatus)
       
   490 			{
       
   491 			User::WaitForRequest(status);
       
   492 			INFO_PRINTF2(_L("CSpudUnitTestStepBase::WaitForGivenContextStatus: contextStatus = %d"), contextStatus);
       
   493 			TEST(status == KErrNone);
       
   494 			}
       
   495 		}
       
   496 	}