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