telephonyprotocols/psdagt/TS_PsdAgt/TestStepPsdAgt.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // TestStepEsoc.cpp
       
    15 // This contains CTestCase which is the base class for all the TestCase DLLs
       
    16 // 
       
    17 //
       
    18 
       
    19 // EPOC includes
       
    20 #include <e32base.h>
       
    21 
       
    22 // Test system includes
       
    23 #include "networking/log.h"
       
    24 #include "networking/teststep.h"
       
    25 #include "TestStepPsdAgt.h"
       
    26 #include "TestSuitePsdAgt.h"
       
    27 
       
    28 // RPacketContext
       
    29 #include <etelpckt.h> 
       
    30 
       
    31 // KConnectionOpen
       
    32 #include <connectprog.h>
       
    33 
       
    34 // Set CDMA or GPRS mode
       
    35 #include "DbUndo.h"
       
    36 
       
    37 // constructor
       
    38 CTestStepPsdAgt::CTestStepPsdAgt(const TPtrC &aName)
       
    39 	{
       
    40 	iTestStepName=aName;
       
    41 
       
    42 	// Always start with test stage zero
       
    43 	iStage=0;
       
    44 	}
       
    45 
       
    46 enum TVerdict CTestStepPsdAgt::doTestStepPreambleL( void )
       
    47 	{	
       
    48 	iActiveScheduler = new(ELeave) CActiveScheduler;
       
    49 	CActiveScheduler::Install(iActiveScheduler);
       
    50 	iDlgSvr = new(ELeave)CDialogServer();
       
    51 	return EPass;
       
    52 	}
       
    53 
       
    54 enum TVerdict CTestStepPsdAgt::doTestStepPostambleL( void )
       
    55 	{
       
    56 	if(iDlgSvr)
       
    57 		delete iDlgSvr;
       
    58 
       
    59 	if(iActiveScheduler)
       
    60 		delete iActiveScheduler;
       
    61 
       
    62 	return EPass;
       
    63 	}
       
    64 
       
    65 
       
    66 
       
    67 /***
       
    68 *   doTestStep is called by the framework to execute a test step
       
    69 *   It performs some initialisation steps common to all PSD.AGT tests
       
    70 *   before calling the doPsdAgtTestStepL() function overridden in
       
    71 *   the derived class
       
    72 ***/
       
    73 enum TVerdict CTestStepPsdAgt::doTestStepL(  )
       
    74 	{
       
    75 	TBool bResult;
       
    76 
       
    77 	TInt processHandleCountBefore;
       
    78 	TInt threadHandleCountBefore;
       
    79 	TInt reqsBefore;
       
    80 	
       
    81 	TInt processHandleCountAfter;
       
    82 	TInt threadHandleCountAfter;
       
    83 	TInt reqsAfter;
       
    84 
       
    85 	reqsBefore= RThread().RequestCount();
       
    86 	RThread().HandleCount(processHandleCountBefore, threadHandleCountBefore);
       
    87 
       
    88 	__UHEAP_MARK;
       
    89 
       
    90 	bResult = iDlgSvr->Open();
       
    91 	if (bResult == EFalse)
       
    92 		{
       
    93 		Log(_L("Cannot connect to Dialog Server"));
       
    94 		return EFail;
       
    95 		}
       
    96 
       
    97 	iDlgSvr->RequestDialogAppearanceNotification(this);
       
    98 	CleanupClosePushL(*iDlgSvr);
       
    99 
       
   100 	// Do the test
       
   101 	iResult = doPsdAgtTestStepL();
       
   102 	CleanupStack::PopAndDestroy(); // iDlgSvr->Close();
       
   103 
       
   104 	DelayL(1000000);
       
   105 	
       
   106 	__UHEAP_MARKEND;
       
   107 
       
   108 	reqsAfter= RThread().RequestCount();
       
   109 	RThread().HandleCount(processHandleCountAfter, threadHandleCountAfter);
       
   110 	
       
   111 
       
   112 	TESTL(reqsAfter == reqsBefore);
       
   113 	TESTL(threadHandleCountAfter == threadHandleCountBefore);
       
   114 	//TESTL(processHandleCountAfter == processHandleCountBefore);
       
   115 	
       
   116 	return iResult;
       
   117 	}
       
   118 
       
   119 
       
   120 
       
   121 /***
       
   122 *   Notification is called by PSDAGT when it needs to pass an event to NIFMAN
       
   123 *   The call is passed up to here by our CNifAgentRefN1
       
   124 *   
       
   125 ***/
       
   126 TInt CTestStepPsdAgt::Notification(TAgentToNifEventType aEvent, TAny* aInfo)
       
   127 	{
       
   128 	// This calls the appropriate handler function
       
   129 	if(aEvent == EAgentToNifEventTypeDisableConnection)
       
   130 		{
       
   131 		PsdAgtDisconnectRequest();	
       
   132 		}
       
   133 	else if(aEvent == EAgentToNifEventTypeGetDataTransfer)
       
   134 		{
       
   135 		// Unpack data volume structure here instead of doing it in several derived classes
       
   136 		TPckg<RPacketContext::TDataVolume>* dataPackage = (TPckg<RPacketContext::TDataVolume>*) aInfo;
       
   137 		RPacketContext::TDataVolume& data = (*dataPackage)();
       
   138 	
       
   139 		data.iOverflowCounterSent = 0;
       
   140 		data.iOverflowCounterReceived = 0;
       
   141 		PsdAgtGetDataVolumeRequest(data.iBytesSent, data.iBytesReceived);
       
   142 		}
       
   143 
       
   144 	return 0;	
       
   145 	}
       
   146 
       
   147 /***
       
   148 *   Called by Notification function when a EAgentToNifEventTypeGetDataTransfer
       
   149 *   event is received. Should override in derived classes when interested in 
       
   150 *   log data volume requests
       
   151 *
       
   152 ***/
       
   153 void CTestStepPsdAgt::PsdAgtGetDataVolumeRequest(TUint32 &aSent, TUint32 &aReceived)
       
   154 	{
       
   155 	aSent = 0;
       
   156 	aReceived=0;
       
   157 	}
       
   158 
       
   159 /***
       
   160 *   Called by Notification function when a EAgentToNifEventTypeDisableConnection
       
   161 *   event is received. Should override in derived classes when this request is 
       
   162 *   expected in the test scenario
       
   163 *
       
   164 ***/
       
   165 void CTestStepPsdAgt::PsdAgtDisconnectRequest()
       
   166 	{
       
   167 	// We're not expecting receive this unless the test case calls for it in 
       
   168 	// which case the derived class should override this function
       
   169 	Log(_L("Unexpected Disconnect Request from PSDAGT"));
       
   170 	TESTE(FALSE,KErrNone);
       
   171 	}
       
   172 
       
   173 
       
   174 /***
       
   175 *   DialogHasAppeared is called by the dummy dialog server
       
   176 *   to inform the test case that a dialog has been presented
       
   177 ***/
       
   178 void CTestStepPsdAgt::DialogHasAppeared()
       
   179 	{
       
   180 	// Should not get here in the default implementation of this function
       
   181 	Log(_L("Unexpected QoS change dialog box"));
       
   182 	TEST(FALSE);
       
   183 	}
       
   184 
       
   185 
       
   186 void CTestStepPsdAgt::AgentProgress(TInt , TInt )
       
   187 	{
       
   188 	// Normally don't care about AgentProgress messages, override when we do care
       
   189 
       
   190 	}
       
   191 
       
   192 
       
   193 
       
   194 // Allows other active objects to run while waiting for the specified time
       
   195 void CTestStepPsdAgt::DelayL(TInt aMicroseconds)
       
   196 	{
       
   197 	// Construct and start the timer
       
   198 	TCallBack callbackfn(CTestStepPsdAgt::TimerCallback, this);
       
   199 	CPeriodic *regularUpdater = CPeriodic::NewL(CActive::EPriorityStandard);
       
   200 	CleanupStack::PushL(regularUpdater);
       
   201 	regularUpdater->Start(aMicroseconds,aMicroseconds,callbackfn);
       
   202 
       
   203 	// Block until timer complete
       
   204 	CActiveScheduler::Start();
       
   205 
       
   206 	// Stop and delete the timer
       
   207 	regularUpdater->Cancel();
       
   208 	CleanupStack::PopAndDestroy();
       
   209 	}
       
   210 
       
   211 
       
   212 // The callback for the DelayL function
       
   213 TInt CTestStepPsdAgt::TimerCallback(TAny *)
       
   214 	{
       
   215 	// Unblock the TAgt::DelayL() function
       
   216 	CActiveScheduler::Stop();
       
   217 	return 0;
       
   218 	}
       
   219 
       
   220 void CTestStepPsdAgt::SetGPRSModeL(MAgtNotify &aAgtNotify)
       
   221 	{
       
   222 	aAgtNotify.SetMode(RTelServer::ENetworkModeGsm);
       
   223 
       
   224 	// Open database
       
   225 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   226 	CMDBSession* session = CMDBSession::NewL(KCDVersion1_2);
       
   227 #else
       
   228 	CMDBSession* session = CMDBSession::NewL(KCDVersion1_1);
       
   229 #endif
       
   230 	CleanupStack::PushL(session);
       
   231 	
       
   232 	// Open outgoing Connection Prefs table
       
   233 	CCDConnectionPrefsRecord* ptrConnectionPref = static_cast<CCDConnectionPrefsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdConnectionPrefsRecord));
       
   234 	CleanupStack::PushL(ptrConnectionPref);
       
   235 
       
   236 	ptrConnectionPref->iDirection = static_cast<TCommDbConnectionDirection>(ECommDbConnectionDirectionOutgoing);
       
   237 	ptrConnectionPref->FindL(*session);
       
   238 
       
   239 	// Change IAP to GPRS
       
   240 	ptrConnectionPref->iDefaultIAP = KGprsIAPIndex;
       
   241 	ptrConnectionPref->ModifyL(*session);
       
   242 	
       
   243 	// Cleanup
       
   244 	CleanupStack::PopAndDestroy(ptrConnectionPref);
       
   245 	CleanupStack::PopAndDestroy(session);
       
   246 	}
       
   247 
       
   248 
       
   249 
       
   250 /************************************************************************************
       
   251 *    NormalConnect is a utility function to connect and disconnect using an AGT
       
   252 *
       
   253 *    The preconditions for this function are assumed to be set so that 
       
   254 *    a connection attempt will be successful. Any error will be reported to
       
   255 *    the test framework as a failed test case
       
   256 *    
       
   257 *************************************************************************************/
       
   258 void CTestStepPsdAgt::NormalConnectL()
       
   259 	{
       
   260 	TInt err;
       
   261 	TInt stage;
       
   262 	CNifAgentRefN1 *agent;
       
   263 
       
   264 	// Construct a new Dummy Nifman Instance
       
   265 	Log(_L("Loading DUMMYNIF.DLL"));
       
   266 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   267 	CleanupStack::PushL(agent);
       
   268 
       
   269 	// Attempt connection
       
   270 	Log(_L("Connecting..."));
       
   271 	agent->Connect();
       
   272 	
       
   273 	// Check for an error code
       
   274 	agent->GetCompletionCode(err);
       
   275 	TESTEL(err==KErrNone,err);
       
   276 
       
   277 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   278 	agent->GetProgressStage(stage);
       
   279 	TESTEL(stage==KConnectionOpen,stage);
       
   280 
       
   281 	Log(_L("Connect Successful"));
       
   282 
       
   283 	DelayL(2000000);
       
   284 
       
   285 	// Disconnect
       
   286 	Log(_L("Disconnecting"));
       
   287 	agent->Disconnect();
       
   288 
       
   289 	// Check for an error code
       
   290 	agent->GetCompletionCode(err);
       
   291 	TESTEL(err==KErrNone,err);
       
   292 	Log(_L("Disconnect Successful"));
       
   293 
       
   294 	// Finished with Dummy Nifman so delete it
       
   295 	CleanupStack::PopAndDestroy(agent);
       
   296 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   297 	}
       
   298 
       
   299 /************************************************************************************
       
   300 *    ReConnect is a utility function to connect and disconnect using an AGT
       
   301 *
       
   302 *    The preconditions for this function are assumed to be set so that 
       
   303 *    a connection attempt will be successful. Any error will be reported to
       
   304 *    the test framework as a failed test case
       
   305 *    
       
   306 *************************************************************************************/
       
   307 void CTestStepPsdAgt::ReConnectL()
       
   308 	{
       
   309 	TInt err;
       
   310 	TInt stage;
       
   311 	CNifAgentRefN1 *agent;
       
   312 
       
   313 	// Construct a new Dummy Nifman Instance
       
   314 	Log(_L("Loading DUMMYNIF.DLL"));
       
   315 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   316 	CleanupStack::PushL(agent);
       
   317 
       
   318 	// Attempt connection
       
   319 	Log(_L("Connecting..."));
       
   320 	agent->Connect();
       
   321 	
       
   322 	// Check for an error code
       
   323 	agent->GetCompletionCode(err);
       
   324 	TESTEL(err==KErrNone,err);
       
   325 
       
   326 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   327 	agent->GetProgressStage(stage);
       
   328 	TESTEL(stage==KConnectionOpen,stage);
       
   329 
       
   330 	Log(_L("Connect Successful"));
       
   331 
       
   332 	DelayL(2000000);
       
   333 
       
   334 	// Attempt connection
       
   335 	Log(_L("Reconnecting..."));
       
   336 	agent->ReConnect();
       
   337 	
       
   338 	// Check for an error code
       
   339 	agent->GetCompletionCode(err);
       
   340 	TESTEL(err==KErrNone,err);
       
   341 
       
   342 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   343 	agent->GetProgressStage(stage);
       
   344 	TESTEL(stage==KConnectionOpen,stage);
       
   345 
       
   346 	Log(_L("Reconnect successful"));
       
   347 
       
   348 	DelayL(2000000);
       
   349 
       
   350 	// Disconnect
       
   351 	Log(_L("Disconnecting..."));
       
   352 	agent->Disconnect();
       
   353 
       
   354 	// Check for an error code
       
   355 	agent->GetCompletionCode(err);
       
   356 	TESTEL(err==KErrNone,err);
       
   357 
       
   358 	Log(_L("Disconnect successful"));
       
   359 
       
   360 	// Finished with Dummy Nifman so delete it
       
   361 	CleanupStack::PopAndDestroy(agent);
       
   362 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   363 
       
   364 	}
       
   365 
       
   366 /************************************************************************************
       
   367 *    NormalConnectOOM is a utility function to connect and disconnect using an AGT
       
   368 *	 for OOM test
       
   369 *
       
   370 *    The preconditions for this function are assumed to be set so that 
       
   371 *    a connection attempt will be successful. Any error will be reported to
       
   372 *    the test framework as a failed test case
       
   373 *    
       
   374 *************************************************************************************/
       
   375 void CTestStepPsdAgt::NormalConnectOOML()
       
   376 	{
       
   377 	TInt err;
       
   378 	TInt stage;
       
   379 	CNifAgentRefN1 *agent;
       
   380 
       
   381 	// Construct a new Dummy Nifman Instance
       
   382 	Log(_L("Loading DUMMYNIF.DLL"));
       
   383 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   384 	CleanupStack::PushL(agent);
       
   385 
       
   386 	// Attempt connection
       
   387 	Log(_L("Connecting..."));
       
   388 	agent->Connect();
       
   389 	
       
   390 	// Check for an error code
       
   391 	agent->GetCompletionCode(err);
       
   392 	
       
   393 	// we dont want to log info about the error during OOM test using TESTEL
       
   394 	if(err == KErrNoMemory)
       
   395 		User::Leave(KErrNoMemory);
       
   396 	
       
   397 	TESTEL(err==KErrNone,err);
       
   398 
       
   399 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   400 	agent->GetProgressStage(stage);
       
   401 	
       
   402 	TESTEL(stage==KConnectionOpen,stage);
       
   403 
       
   404 	Log(_L("Connect Successful"));
       
   405 
       
   406 	DelayL(2000000);
       
   407 
       
   408 	// Disconnect
       
   409 	Log(_L("Disconnecting"));
       
   410 	agent->Disconnect();
       
   411 
       
   412 	// Check for an error code
       
   413 	agent->GetCompletionCode(err);
       
   414 	
       
   415 		// we dont want to log info about the error during OOM test using TESTEL
       
   416 	if(err == KErrNoMemory)
       
   417 		User::Leave(KErrNoMemory);
       
   418 	
       
   419 	TESTEL(err==KErrNone,err);
       
   420 	Log(_L("Disconnect Successful"));
       
   421 
       
   422 	// Finished with Dummy Nifman so delete it
       
   423 	CleanupStack::PopAndDestroy(agent);
       
   424 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   425 	}
       
   426 
       
   427 /************************************************************************************
       
   428 *    ReConnectOOM is a utility function to connect and disconnect using an AGT
       
   429 *	 for OOM test
       
   430 *	
       
   431 *    The preconditions for this function are assumed to be set so that 
       
   432 *    a connection attempt will be successful. Any error will be reported to
       
   433 *    the test framework as a failed test case
       
   434 *    
       
   435 *************************************************************************************/
       
   436 void CTestStepPsdAgt::ReConnectOOML()
       
   437 	{
       
   438 	TInt err;
       
   439 	TInt stage;
       
   440 	CNifAgentRefN1 *agent;
       
   441 
       
   442 	// Construct a new Dummy Nifman Instance
       
   443 	Log(_L("Loading DUMMYNIF.DLL"));
       
   444 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   445 	CleanupStack::PushL(agent);
       
   446 
       
   447 	// Attempt connection
       
   448 	Log(_L("Connecting..."));
       
   449 	agent->Connect();
       
   450 	
       
   451 	// Check for an error code
       
   452 	agent->GetCompletionCode(err);
       
   453 	
       
   454 	// we dont want to log info about the error during OOM test using TESTEL
       
   455 	if(err == KErrNoMemory)
       
   456 		User::Leave(KErrNoMemory);
       
   457 	// report any other errors
       
   458 	TESTEL(err==KErrNone, err);
       
   459 
       
   460 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   461 	agent->GetProgressStage(stage);
       
   462 	TESTEL(stage==KConnectionOpen,stage);
       
   463 
       
   464 	Log(_L("Connect Successful"));
       
   465 
       
   466 	DelayL(2000000);
       
   467 
       
   468 	// Attempt connection
       
   469 	Log(_L("Reconnecting..."));
       
   470 	agent->ReConnect();
       
   471 	
       
   472 	// Check for an error code
       
   473 	agent->GetCompletionCode(err);
       
   474 	
       
   475 	// we dont want to log info about the error during OOM test using TESTEL
       
   476 	if(err == KErrNoMemory)
       
   477 		User::Leave(KErrNoMemory);
       
   478 	
       
   479 	// report any other errors
       
   480 	TESTEL(err==KErrNone, err);
       
   481 
       
   482 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   483 	agent->GetProgressStage(stage);
       
   484 	TESTEL(stage==KConnectionOpen,stage);
       
   485 
       
   486 	Log(_L("Reconnect successful"));
       
   487 
       
   488 	DelayL(2000000);
       
   489 
       
   490 	// Disconnect
       
   491 	Log(_L("Disconnecting..."));
       
   492 	agent->Disconnect();
       
   493 
       
   494 	// Check for an error code
       
   495 	agent->GetCompletionCode(err);
       
   496 	
       
   497 	// we dont want to log info about the error during OOM test using TESTEL
       
   498 	if(err == KErrNoMemory)
       
   499 		User::Leave(KErrNoMemory);
       
   500 	
       
   501 	// report any other errors
       
   502 	TESTEL(err==KErrNone ,err);
       
   503 
       
   504 	Log(_L("Disconnect successful"));
       
   505 
       
   506 	// Finished with Dummy Nifman so delete it
       
   507 	CleanupStack::PopAndDestroy(agent);
       
   508 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   509 
       
   510 	}
       
   511 
       
   512 
       
   513 /************************************************************************************
       
   514 *    ConnectExpectError is a utility function to connect and disconnect using an AGT
       
   515 *
       
   516 *    The preconditions for this function are assumed to be set so that 
       
   517 *    a connection attempt will fail with the error passed to the function and 
       
   518 *    at the stage passed to the function.  
       
   519 *    
       
   520 *************************************************************************************/
       
   521 void CTestStepPsdAgt::ConnectExpectErrorL(TInt aError, TInt aStage)
       
   522 	{
       
   523 	TInt err;
       
   524 	TInt stage;
       
   525 	CNifAgentRefN1 *agent;
       
   526 
       
   527 	// Construct a new Dummy Nifman Instance
       
   528 	Log(_L("Loading DUMMYNIF.DLL"));
       
   529 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   530 	CleanupStack::PushL(agent);
       
   531 
       
   532 	// Attempt connection
       
   533 	Log(_L("Connecting..."));
       
   534 	agent->Connect();
       
   535 	
       
   536 	// Check result codes
       
   537 	agent->GetCompletionCode(err);
       
   538 	TESTEL(err==aError,err);
       
   539 
       
   540 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   541 	agent->GetProgressStage(stage);
       
   542 	TESTEL(stage==aStage,stage);
       
   543 
       
   544 	Log(_L("Connect failed as expected"));
       
   545 
       
   546 	DelayL(3000000);
       
   547 	
       
   548 	// Disconnect
       
   549 	Log(_L("Disconnecting..."));
       
   550 	agent->Disconnect();
       
   551 
       
   552 	// Check result code
       
   553 	agent->GetCompletionCode(err);
       
   554 	TESTEL(err==KErrNone,err);
       
   555 	Log(_L("Disconnect successful"));
       
   556 
       
   557 	// Finished with Dummy Nifman so delete it
       
   558 	CleanupStack::PopAndDestroy(agent);
       
   559 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   560 	}
       
   561 
       
   562 /************************************************************************************
       
   563 *
       
   564 *  Trigger a QoS change from the dummy ETEL layer and wait for the dialog box to
       
   565 *  be presented. 
       
   566 *
       
   567 ************************************************************************************/
       
   568 void CTestStepPsdAgt::QoSChangeDisconnectL(MAgtNotify &aAgtNotify)
       
   569 	{
       
   570 	TInt err;
       
   571 	TInt stage;
       
   572 	CNifAgentRefN1 *agent;
       
   573 
       
   574 	// Construct a new Dummy Nifman Instance
       
   575 	Log(_L("Loading DUMMYNIF.DLL"));
       
   576 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   577 	CleanupStack::PushL(agent);
       
   578 
       
   579 	// Attempt connection
       
   580 	Log(_L("Connecting..."));
       
   581 	agent->Connect();
       
   582 	
       
   583 	// Check result codes
       
   584 	agent->GetCompletionCode(err);
       
   585 	TESTEL(err==KErrNone,err);
       
   586 
       
   587 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   588 	agent->GetProgressStage(stage);
       
   589 	TESTEL(stage==KConnectionOpen,stage);
       
   590 
       
   591 	Log(_L("Connect successful"));
       
   592 
       
   593 	iDlgSvr->SetQoSWarnResponse(ETrue);
       
   594 
       
   595 	DelayL(3000000);
       
   596 
       
   597 	// Tell the ETEL layer to send QOS change to PSDAGT
       
   598 	Log(_L("Notify PSDAGT of Context Config / QoS change"));
       
   599 	aAgtNotify.NotifyAgt(EReduce);
       
   600 
       
   601 	// Block until we receive dialog notification of status change
       
   602 	CActiveScheduler::Start();
       
   603 
       
   604 	DelayL(2000000);
       
   605 
       
   606 	// Disconnect
       
   607 	Log(_L("Disconnecting..."));
       
   608 	agent->Disconnect();
       
   609 
       
   610 	// Check result code
       
   611 	agent->GetCompletionCode(err);
       
   612 	TESTEL(err==KErrNone,err);
       
   613 
       
   614 	Log(_L("Disconnect successful"));
       
   615 
       
   616 	// Finished with Dummy Nifman so delete it
       
   617 	CleanupStack::PopAndDestroy(agent);
       
   618 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   619 	}
       
   620 
       
   621 
       
   622 /************************************************************************************
       
   623 *
       
   624 *  Trigger a QoS change from the dummy ETEL layer and wait for the dialog box to
       
   625 *  be presented. 
       
   626 *
       
   627 *  Once dialog is dismissed, revert QoS to it's previous value and make sure
       
   628 *  no extra dialog is displayed
       
   629 *
       
   630 ************************************************************************************/
       
   631 void CTestStepPsdAgt::QoSChangeNoDisconnectL(MAgtNotify & aAgtNotify)
       
   632 	{
       
   633 	TInt err;
       
   634 	TInt stage;
       
   635 	CNifAgentRefN1 *agent;
       
   636 
       
   637 	// Request a QoS change and do not disconnect when the dialog box is presented
       
   638 
       
   639 
       
   640 	// Construct a new Dummy Nifman Instance
       
   641 	Log(_L("Loading DUMMYNIF.DLL"));
       
   642 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   643 	CleanupStack::PushL(agent);
       
   644 
       
   645 	// Attempt connection
       
   646 	Log(_L("Connecting..."));
       
   647 	agent->Connect();
       
   648 	
       
   649 	// Check result codes
       
   650 	agent->GetCompletionCode(err);
       
   651 	TESTEL(err==KErrNone,err);
       
   652 
       
   653 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   654 	agent->GetProgressStage(stage);
       
   655 	TESTEL(stage==KConnectionOpen,stage);
       
   656 	
       
   657 	Log(_L("Connect Successful"));
       
   658 
       
   659 	DelayL(3000000);
       
   660 
       
   661 	// Tell PSDAGT not to disconnect when dialog is presented
       
   662 	iDlgSvr->SetQoSWarnResponse(EFalse);
       
   663 
       
   664 	// Tell the ETEL layer to send a QOS change to PSDAGT
       
   665 	Log(_L("Notify PSDAGT of Context Config / QoS change"));
       
   666 	aAgtNotify.NotifyAgt(EReduce);
       
   667 
       
   668 	// Block until we receive dialog notification of status change
       
   669 	CActiveScheduler::Start();
       
   670 
       
   671 	DelayL(2000000);
       
   672 
       
   673 	// Tell the ETEL layer to restore QOS and notify PSDAGT
       
   674 	Log(_L("Notify PSDAGT of restore Context Config / QoS change"));
       
   675 	aAgtNotify.NotifyAgt(ERestore);
       
   676 
       
   677 	// No dialog should be presented the second time, wait to make sure that no
       
   678 	// dialog appears
       
   679 	DelayL(3000000);
       
   680 
       
   681 	// Disconnect
       
   682 	Log(_L("Disconnecting..."));
       
   683 	agent->Disconnect();
       
   684 
       
   685 	// Check result code
       
   686 	agent->GetCompletionCode(err);
       
   687 	TESTEL(err==KErrNone,err);
       
   688 	
       
   689 	Log(_L("Disconnect Successful"));
       
   690 
       
   691 	// Finished with Dummy Nifman so delete it
       
   692 	CleanupStack::PopAndDestroy(agent);
       
   693 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   694 	}
       
   695 
       
   696 
       
   697 /************************************************************************************
       
   698 *
       
   699 *  Trigger a momentary QoS change from the dummy ETEL layer.
       
   700 *  
       
   701 *  The change should be within the timeout and no dialog box should be presented
       
   702 *
       
   703 ************************************************************************************/
       
   704 void CTestStepPsdAgt::QoSChangeWithinTimeoutL(MAgtNotify & aAgtNotify)
       
   705 	{
       
   706 	TInt err;
       
   707 	TInt stage;
       
   708 	CNifAgentRefN1 *agent;
       
   709 
       
   710 	// Request a QoS change and revert back to the original value before the 
       
   711 	// timeout expires
       
   712 
       
   713 	// Construct a new Dummy Nifman Instance
       
   714 	Log(_L("Loading DUMMYNIF.DLL"));
       
   715 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   716 	CleanupStack::PushL(agent);
       
   717 
       
   718 	// Attempt connection
       
   719 	Log(_L("Connecting..."));
       
   720 	agent->Connect();
       
   721 	
       
   722 	// Check result codes
       
   723 	agent->GetCompletionCode(err);
       
   724 	TESTEL(err==KErrNone,err);
       
   725 
       
   726 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   727 	agent->GetProgressStage(stage);
       
   728 	TESTEL(stage==KConnectionOpen,stage);
       
   729 
       
   730 	Log(_L("Connect Successful"));
       
   731 	DelayL(3000000);
       
   732 
       
   733 	// Tell PSDAGT not to disconnect if dialog is presented
       
   734 	iDlgSvr->SetQoSWarnResponse(EFalse);
       
   735 
       
   736 	// Tell the ETEL layer to send a QOS change to PSDAGT
       
   737 	Log(_L("Notify PSDAGT of Context Config / QoS change"));
       
   738 	aAgtNotify.NotifyAgt(EReduce);
       
   739 	// Wait for a short time < timeout expires
       
   740 	DelayL(5000);
       
   741 
       
   742 	// Tell the ETEL layer to restore QOS and notify PSDAGT
       
   743 	Log(_L("Notify PSDAGT of restore Context Config / QoS change"));
       
   744 	aAgtNotify.NotifyAgt(ERestore);
       
   745 
       
   746 	// Wait to make sure that no dialog appears
       
   747 	DelayL(3000000);
       
   748 
       
   749 	// Disconnect
       
   750 	Log(_L("Disconnecting..."));
       
   751 	agent->Disconnect();
       
   752 
       
   753 	// Check result code
       
   754 	agent->GetCompletionCode(err);
       
   755 	TESTEL(err==KErrNone,err);
       
   756 
       
   757 	Log(_L("Disconnect Successful"));
       
   758 
       
   759 	// Finished with Dummy Nifman so delete it
       
   760 	CleanupStack::PopAndDestroy(agent);
       
   761 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   762 	}
       
   763 
       
   764 /************************************************************************************
       
   765 *
       
   766 *  Connect, and block execution, ie. wait for an asyncronous request
       
   767 *
       
   768 *  The response function for the asyncronous callback should unblock
       
   769 *
       
   770 ************************************************************************************/
       
   771 void CTestStepPsdAgt::ConnectAndWaitForAsyncronousRequestL()
       
   772 	{
       
   773 	TInt err;
       
   774 	TInt stage;
       
   775 	CNifAgentRefN1 *agent;
       
   776 
       
   777 	// Construct a new Dummy Nifman Instance
       
   778 	Log(_L("Loading DUMMYNIF.DLL"));
       
   779 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   780 	CleanupStack::PushL(agent);
       
   781 
       
   782 	// Attempt connection
       
   783 	Log(_L("Connecting..."));
       
   784 	agent->Connect();
       
   785 	
       
   786 	// Check result codes
       
   787 	agent->GetCompletionCode(err);
       
   788 	TESTEL(err==KErrNone,err);
       
   789 
       
   790 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   791 	agent->GetProgressStage(stage);
       
   792 	TESTEL(stage==KConnectionOpen,stage);
       
   793 
       
   794 	Log(_L("Connect Successful"));
       
   795 	Log(_L("Wait for EAgentToNifEventTypeGetDataTransfer event"));
       
   796 
       
   797 	DelayL(2000000);
       
   798 
       
   799 	iStage++;   // increment stage so we know that we are connected
       
   800 
       
   801 	// Block until request arrives
       
   802 	CActiveScheduler::Start();
       
   803 
       
   804 	DelayL(2000000);
       
   805 
       
   806 	// Disconnect
       
   807 	Log(_L("Disconnecting..."));
       
   808 	agent->Disconnect();
       
   809 
       
   810 	// Check result code
       
   811 	agent->GetCompletionCode(err);
       
   812 	TESTEL(err==KErrNone,err);
       
   813 	Log(_L("Disconnect Successful"));
       
   814 
       
   815 	// Finished with Dummy Nifman so delete it
       
   816 	CleanupStack::PopAndDestroy(agent);
       
   817 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   818 	}
       
   819 
       
   820 
       
   821 /************************************************************************************
       
   822 *
       
   823 *  Connect, and wait for 80 seconds before disconnecting
       
   824 *
       
   825 *
       
   826 ************************************************************************************/
       
   827 void CTestStepPsdAgt::ConnectAndWaitForEightySecondsL()
       
   828 	{
       
   829 	TInt err;
       
   830 	TInt stage;
       
   831 	CNifAgentRefN1 *agent;
       
   832 
       
   833 	// Construct a new Dummy Nifman Instance
       
   834 	Log(_L("Loading DUMMYNIF.DLL"));
       
   835 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   836 	CleanupStack::PushL(agent);
       
   837 
       
   838 	// Attempt connection
       
   839 	Log(_L("Connecting..."));
       
   840 	agent->Connect();
       
   841 		
       
   842 	// Check result codes
       
   843 	agent->GetCompletionCode(err);
       
   844 	TESTEL(err==KErrNone,err);
       
   845 
       
   846 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   847 	agent->GetProgressStage(stage);
       
   848 	TESTEL(stage==KConnectionOpen, stage);
       
   849 	
       
   850 	Log(_L("Connect Successful"));
       
   851 	Log(_L("Waiting 80 seconds for log request to ETEL"));
       
   852 
       
   853 	// DelayL for the time it takes for one log event to occur
       
   854 	DelayL(80000000); // 80 secs
       
   855 
       
   856 	// Disconnect
       
   857 	Log(_L("Disconnecting..."));
       
   858 	agent->Disconnect();
       
   859 
       
   860 	// Check result code
       
   861 	agent->GetCompletionCode(err);
       
   862 	TESTEL(err==KErrNone,err);
       
   863 	Log(_L("Disconnect Successful"));
       
   864 
       
   865 	// Finished with Dummy Nifman so delete it
       
   866 	CleanupStack::PopAndDestroy(agent);
       
   867 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   868 	}
       
   869 
       
   870 /************************************************************************************
       
   871 *
       
   872 *  Connect, and wait for 20 seconds before disconnecting
       
   873 *
       
   874 *
       
   875 ************************************************************************************/
       
   876 void CTestStepPsdAgt::ConnectAndWaitForTwentySecondsL()
       
   877 	{
       
   878 	TInt err;
       
   879 	TInt stage;
       
   880 	CNifAgentRefN1 *agent;
       
   881 
       
   882 	// Construct a new Dummy Nifman Instance
       
   883 	Log(_L("Loading DUMMYNIF.DLL"));
       
   884 	agent = CNifAgentRefN1::NewL(this,EFalse);
       
   885 	CleanupStack::PushL(agent);
       
   886 
       
   887 	// Attempt connection
       
   888 	Log(_L("Connecting..."));
       
   889 	agent->Connect();
       
   890 		
       
   891 	// Check result codes
       
   892 	agent->GetCompletionCode(err);
       
   893 	TESTEL(err==KErrNone,err);
       
   894 
       
   895 	// Check ConnectComplete was reported at the correct stage in the state machine
       
   896 	agent->GetProgressStage(stage);
       
   897 	TESTEL(stage==KConnectionOpen, stage);
       
   898 	Log(_L("Connect Successful"));
       
   899 	Log(_L("Wait for 20 seconds for NotifyStatusChange"));
       
   900 
       
   901 	// DelayL for 20 seconds for the NotifyStatusChange in the PsdOpen state
       
   902 	DelayL(2000000); // 2 secs
       
   903 
       
   904 	iStage++;  // ie iStage = 1
       
   905 
       
   906 	DelayL(18000000); // 18 secs
       
   907 
       
   908 	// Disconnect
       
   909 	Log(_L("Disconnecting..."));
       
   910 	agent->Disconnect();
       
   911 
       
   912 	// Check result code
       
   913 	agent->GetCompletionCode(err);
       
   914 	TESTEL(err==KErrNone,err);
       
   915 	Log(_L("Disconnect Successful"));
       
   916 
       
   917 	// Finished with Dummy Nifman so delete it
       
   918 	CleanupStack::PopAndDestroy(agent);
       
   919 	Log(_L("DUMMYNIF.DLL Unloaded"));
       
   920 	}
       
   921