telephonyserverplugins/simtsy/test/Te_SimPacket/Te_SimPacket.cpp
changeset 0 3553901f7fa8
child 3 962e6306d9d2
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This program is designed the test of the .
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "Te_SimPacket.h"
       
    23 
       
    24 //******************************************************************************
       
    25 // Context Configuration
       
    26 //******************************************************************************
       
    27 #define SIMTSY_PDP_TYPE1				RPacketContext::EPdpTypePPP
       
    28 #define SIMTSY_ACCESS_POINT1			_L8("ACME INTERNET PROVIDERS LTD")
       
    29 #define SIMTSY_PDP_ADDRESS1			_L8("i-MODE GATEWAY")
       
    30 #define SIMTSY_COMPRESSION1			RPacketContext::KPdpDataCompression
       
    31 #define SIMTSY_ANONYMOUS_ACCESS1		RPacketContext::ENotRequired
       
    32 #define SIMTSY_EGPRS_REQUIRED			TRUE		
       
    33 
       
    34 #define SIMTSY_PDP_TYPE2				RPacketContext::EPdpTypeIPv6
       
    35 #define SIMTSY_ACCESS_POINT2			_L8("SYMBIAN EMPLOYEE INTRANET")
       
    36 #define SIMTSY_PDP_ADDRESS2			_L8("A WAP PORTAL")
       
    37 #define SIMTSY_COMPRESSION2			RPacketContext::KPdpHeaderCompression
       
    38 #define SIMTSY_ANONYMOUS_ACCESS2		RPacketContext::ERequired
       
    39 
       
    40 #define SIMTSY_CSY					_L("LOOPBACK.CSY")
       
    41 #define SIMTSY_PORT					_L("LOOPBACK::0")
       
    42 
       
    43 #define SIM_PACKET_SERVICE_CAPS (RPacketService::KCapsSuspendSupported | \
       
    44 				RPacketService::KCapsMSClassSupported |\
       
    45 				RPacketService::KCapsCDMA2000HighSpeedDataSupported |\
       
    46 				RPacketService::KCapsNetworkAvailabilitySupported | \
       
    47 				RPacketService::KCapsProtocolPPPSupported)
       
    48 
       
    49 #define SIM_PACKET_SERVICE_OPTION	RPacketContext::KHighSpeedCDMA2000Data
       
    50 #define SIM_PACKET_PROTOCOL			RPacketContext::EPdpTypePPP
       
    51 #define SIM_DEFAULT_PARAM			RPacketContext::KHighSpeedCDMA2000Data
       
    52 
       
    53 // CHAP authentication
       
    54 #define SIM_PACKET_CONTEXT_PROTOCOL1 RPacketContext::EProtocolCHAP
       
    55 #define SIM_PACKET_CONTEXT_USERNAME1 _L8("USER1")
       
    56 #define SIM_PACKET_CONTEXT_PASSWORD1 _L8("PASSWORD1")
       
    57 #define SIM_PACKET_CONTEXT_CHALLENGE1 _L8("CHALLENGE1")
       
    58 #define SIM_PACKET_CONTEXT_RESPONSE1 _L8("RESPONSE1")
       
    59 #define SIM_PACKET_CONTEXT_PRIMARYSERVER1 _L8("PRIMARYSERVER1")
       
    60 #define SIM_PACKET_CONTEXT_SECONDARYSERVER1 _L8("SECONDARYSERVER1")
       
    61 #define SIM_PACKET_CONTEXT_ID1 1
       
    62 
       
    63 // PAP authentication 
       
    64 #define SIM_PACKET_CONTEXT_PROTOCOL2 RPacketContext::EProtocolPAP
       
    65 #define SIM_PACKET_CONTEXT_USERNAME2 _L("USER2")
       
    66 #define SIM_PACKET_CONTEXT_PASSWORD2 _L("PASSWORD2")
       
    67 #define SIM_PACKET_CONTEXT_CHALLENGE2 _L("NULL")
       
    68 #define SIM_PACKET_CONTEXT_RESPONSE2 _L("NULL")
       
    69 #define SIM_PACKET_CONTEXT_PRIMARYSERVER2 _L("PRIMARYSERVER2")
       
    70 #define SIM_PACKET_CONTEXT_SECONDARYSERVER2 _L("SECONDARYSERVER2")
       
    71 #define SIM_PACKET_CONTEXT_ID2 2
       
    72 
       
    73 //MBMS information
       
    74 #define SIM_PACKET_MBMS_TESTNUMBER	0
       
    75 #define SIM_PACKET_MBMS_SESSIONID	2
       
    76 #define SIM_PACKET_MBMS_SERVICEID	1155
       
    77 #define SIM_PACKET_MBMS_MNCID		1122
       
    78 #define SIM_PACKET_MBMS_MCCID      	1234
       
    79 
       
    80 //******************************************************************************
       
    81 
       
    82 static TInt NTRasThreadFunction(TAny* /*aThreadData*/)
       
    83 /**
       
    84 * Does 'durty' work to  start NT RAS session
       
    85 * @note It sets
       
    86 *	iRate = EBps38400;
       
    87 *	iDataBits = EData8;
       
    88 *	iStopBits = EStop1 ;
       
    89 *	iParity = EParityNone;
       
    90 * be sure that your NT comport has the same settings.
       
    91 */
       
    92 	{
       
    93 	_LIT(KCsyName,"LOOPBACK.CSY");
       
    94 	_LIT(KPortName,"LOOPBACK::1");
       
    95 	
       
    96 	_LIT8(KServerText,"SERVER");
       
    97 
       
    98 	CTrapCleanup* cleanup;
       
    99 	if ((cleanup=CTrapCleanup::New())==NULL)
       
   100 		return KErrGeneral;
       
   101 
       
   102 	RCommServ commServ;
       
   103 	TInt r=commServ.Connect();
       
   104 	r=commServ.LoadCommModule(KCsyName);
       
   105 	if( KErrNone == r)
       
   106 		{
       
   107 		RComm comm;
       
   108 		r=comm.Open(commServ,KPortName,ECommShared);
       
   109 		if( KErrNone == r)
       
   110 			{
       
   111 			TBuf8<6> readBuf;  
       
   112 			TRequestStatus stat0;
       
   113 			comm.Read(stat0,readBuf);
       
   114 			User::WaitForRequest(stat0) ;
       
   115 
       
   116 			comm.Write(stat0,KServerText);
       
   117 			User::WaitForRequest(stat0) ;
       
   118 			}
       
   119 		comm.Close() ;
       
   120 		}
       
   121 	commServ.Close() ;
       
   122 	delete cleanup;
       
   123 	return r;
       
   124 	}
       
   125 
       
   126 TInt StartNTRasSimulation()
       
   127 /**
       
   128 * Starts virual, because of lookback serial driver,
       
   129 * NT RAS session
       
   130 */
       
   131 	{
       
   132 	const TInt KStackSize=0x8000;
       
   133 	const TInt KHeapSize=0x8000;
       
   134 	const TInt KMaxHeapSize=0x80000;
       
   135 	TInt res = KErrNone ;
       
   136 	_LIT(KNtRasName,"NTRasEmulation");
       
   137 
       
   138 	RThread t;
       
   139 	res=t.Create(KNtRasName,NTRasThreadFunction,
       
   140 					KStackSize,KHeapSize,KMaxHeapSize,NULL);
       
   141 	t.Resume();
       
   142 	t.Close();
       
   143 
       
   144 	return res;
       
   145 	}
       
   146 
       
   147 //------------------------------------------------------------------
       
   148 //			** TEST SimPacket STEPS ***
       
   149 
       
   150 //------------------------------------------------------------------
       
   151 
       
   152 CGprsDefaultContextParamsTest::CGprsDefaultContextParamsTest()
       
   153 /** Each test step initialises it's own name
       
   154 */
       
   155 	{
       
   156 	// store the name of this test case
       
   157 	// this is the name that is used by the script file
       
   158 	SetTestStepName(_L("GprsDefaultContextParamsTest"));
       
   159 	}
       
   160 //------------------------------------------------------------------
       
   161 
       
   162 TVerdict CGprsDefaultContextParamsTest::doTestStepL( void )
       
   163 /**
       
   164  * This tests the default context params
       
   165  */
       
   166     {
       
   167 	SetSimtsyTestNumberL(0);
       
   168 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   169 	TESTL(iPhone.Initialise()==KErrNone);
       
   170 
       
   171 	// Some default params to set, does not matter what it is.
       
   172 	//  The default params used are defined at the beginning of this file
       
   173 
       
   174 	TESTL(iPacketService.Open(iPhone) == KErrNone);
       
   175 
       
   176     RPacketContext::TContextConfigGPRS     setDefaultParams;
       
   177 	TPckg<RPacketContext::TContextConfigGPRS>    setcontextConfigPckg(setDefaultParams);
       
   178 
       
   179 	setDefaultParams.iPdpType = SIMTSY_PDP_TYPE1;
       
   180     setDefaultParams.iAccessPointName = SIMTSY_ACCESS_POINT1;
       
   181     setDefaultParams.iPdpAddress = SIMTSY_PDP_ADDRESS1;
       
   182     setDefaultParams.iPdpCompression = SIMTSY_COMPRESSION1;
       
   183 	setDefaultParams.iAnonymousAccessReqd = SIMTSY_ANONYMOUS_ACCESS1;
       
   184 	setDefaultParams.iUseEdge = SIMTSY_EGPRS_REQUIRED;
       
   185 	setDefaultParams.iProtocolConfigOption.iAuthInfo.iProtocol = SIM_PACKET_CONTEXT_PROTOCOL1;
       
   186 	setDefaultParams.iProtocolConfigOption.iAuthInfo.iUsername = SIM_PACKET_CONTEXT_USERNAME1;
       
   187 	setDefaultParams.iProtocolConfigOption.iAuthInfo.iPassword = SIM_PACKET_CONTEXT_PASSWORD1;
       
   188 	setDefaultParams.iProtocolConfigOption.iChallenge = SIM_PACKET_CONTEXT_CHALLENGE1;
       
   189 	setDefaultParams.iProtocolConfigOption.iResponse = SIM_PACKET_CONTEXT_RESPONSE1;
       
   190 	setDefaultParams.iProtocolConfigOption.iDnsAddresses.iPrimaryDns = SIM_PACKET_CONTEXT_PRIMARYSERVER1;
       
   191 	setDefaultParams.iProtocolConfigOption.iDnsAddresses.iSecondaryDns = SIM_PACKET_CONTEXT_SECONDARYSERVER1;
       
   192 	setDefaultParams.iProtocolConfigOption.iId = SIM_PACKET_CONTEXT_ID1;
       
   193     
       
   194     TESTL(iPacketService.SetDefaultContextParams(setcontextConfigPckg) == KErrNone);
       
   195 
       
   196 	RPacketContext::TContextConfigGPRS     getDefaultParams;
       
   197 	TPckg<RPacketContext::TContextConfigGPRS>    getcontextConfigPckg(getDefaultParams);
       
   198 
       
   199     TESTL(iPacketService.GetDefaultContextParams(getcontextConfigPckg) == KErrNone);
       
   200     TestConfigParamsL(setDefaultParams, getDefaultParams);
       
   201 
       
   202     iPacketService.Close();
       
   203 	iPhone.Close();
       
   204 	User::After(100000L);
       
   205 	return TestStepResult();
       
   206 	}
       
   207 //------------------------------------------------------------------
       
   208 
       
   209 CQoSTest::CQoSTest()
       
   210 /** Each test step initialises it's own name
       
   211 */
       
   212 	{
       
   213 	// store the name of this test case
       
   214 	// this is the name that is used by the script file
       
   215 	SetTestStepName(_L("QoSTest"));
       
   216 	}
       
   217 //------------------------------------------------------------------
       
   218 
       
   219 TVerdict CQoSTest::doTestStepL( void )
       
   220 /**
       
   221  * This tests the static GPRS caps.
       
   222  */
       
   223     {
       
   224 	SetSimtsyTestNumberL(0);
       
   225     TBuf<30>                            contextName;
       
   226 	TBuf<30>                            profileName;
       
   227 	TRequestStatus						stat1;
       
   228 	TRequestStatus						stat2;
       
   229 	RPacketQoS							qoS;
       
   230 	RPacketQoS::TQoSCapsGPRS			staticQoSCaps;
       
   231 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   232 	TESTL(iPhone.Initialise()==KErrNone);
       
   233 
       
   234     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   235 	TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   236 	qoS.OpenNewQoS(iPacketContext[0], profileName);
       
   237 
       
   238 	TPckg<RPacketQoS::TQoSCapsGPRS> staticQoSCapsPkg(staticQoSCaps);
       
   239 	qoS.GetProfileCapabilities(stat1, staticQoSCapsPkg);
       
   240 	User::WaitForRequest(stat1);
       
   241 	TESTL(stat1.Int() == KErrNone);
       
   242 	TESTL(staticQoSCaps.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
       
   243 
       
   244 	TESTL(staticQoSCaps.iPrecedence		== RPacketQoS::EPriorityMediumPrecedence);
       
   245 	TESTL(staticQoSCaps.iDelay			== RPacketQoS::EDelayClass2 );
       
   246 	TESTL(staticQoSCaps.iReliability	== RPacketQoS::EReliabilityClass2);
       
   247 	TESTL(staticQoSCaps.iPeak			== RPacketQoS::EPeakThroughput64000);
       
   248 	TESTL(staticQoSCaps.iMean			== RPacketQoS::EMeanThroughput100);
       
   249 
       
   250 	RPacketQoS::TQoSGPRSNegotiated		negotiatedQoS;
       
   251 	RPacketQoS::TQoSGPRSRequested		SetQoS;
       
   252 	RPacketQoS::TQoSGPRSNegotiated      comparenegotiatedQoS;
       
   253 	RPacketQoS::TQoSGPRSRequested		notifyQoS;
       
   254 	// Setting to Best effort.
       
   255 	comparenegotiatedQoS.iPrecedence		= RPacketQoS::EPriorityMediumPrecedence;
       
   256 	comparenegotiatedQoS.iDelay				= RPacketQoS::EDelayClass2;
       
   257 	comparenegotiatedQoS.iReliability		= RPacketQoS::EReliabilityClass2;
       
   258 	comparenegotiatedQoS.iPeakThroughput	= RPacketQoS::EPeakThroughput64000;
       
   259 	comparenegotiatedQoS.iMeanThroughput	= RPacketQoS::EMeanThroughput100;
       
   260 	TPckg<RPacketQoS::TQoSGPRSNegotiated>		negotiatedQoSPkg(negotiatedQoS);
       
   261 	qoS.GetProfileParameters(stat1, negotiatedQoSPkg);
       
   262 	User::WaitForRequest(stat1);
       
   263 	TESTL(stat1.Int() == KErrNone);
       
   264 	TestConfigParamsL(negotiatedQoS, comparenegotiatedQoS);
       
   265 
       
   266 	// Set to anything just to test that it can be done..
       
   267 	SetQoS.iReqPrecedence		= RPacketQoS::EPriorityMediumPrecedence;
       
   268 	SetQoS.iMinPrecedence		= RPacketQoS::EPriorityLowPrecedence;
       
   269 	SetQoS.iReqDelay			= RPacketQoS::EDelayClass2;
       
   270 	SetQoS.iMinDelay			= RPacketQoS::EDelayClass1;
       
   271 	SetQoS.iReqReliability		= RPacketQoS::EReliabilityClass2;
       
   272 	SetQoS.iMinReliability		= RPacketQoS::EReliabilityClass1;
       
   273 	SetQoS.iReqPeakThroughput	= RPacketQoS::EPeakThroughput64000;
       
   274 	SetQoS.iMinPeakThroughput	= RPacketQoS::EPeakThroughput16000;
       
   275 	SetQoS.iReqMeanThroughput	= RPacketQoS::EMeanThroughput2000;
       
   276 	SetQoS.iMinMeanThroughput	= RPacketQoS::EMeanThroughput200;
       
   277 
       
   278 
       
   279 	TPckg<RPacketQoS::TQoSGPRSRequested>		SetQoSPkg(SetQoS);
       
   280 	TPckg<RPacketQoS::TQoSGPRSRequested>		notifyQoSPkg(notifyQoS);
       
   281 	qoS.NotifyProfileChanged(stat2, notifyQoSPkg);
       
   282 	qoS.SetProfileParameters(stat1, SetQoSPkg);
       
   283 	User::WaitForRequest(stat2);
       
   284 	User::WaitForRequest(stat1);
       
   285 	TESTL(stat2.Int() == KErrNone);
       
   286 	TESTL(stat1.Int() == KErrNone);
       
   287 
       
   288 	qoS.Close();
       
   289 	iPacketContext[0].Close();
       
   290     iPacketService.Close();
       
   291 	iPhone.Close();
       
   292 	return TestStepResult();
       
   293 	}
       
   294 //------------------------------------------------------------------
       
   295 
       
   296 CGprsUnSupportedTest::CGprsUnSupportedTest()
       
   297 /** Each test step initialises it's own name
       
   298 */
       
   299 	{
       
   300 	// store the name of this test case
       
   301 	// this is the name that is used by the script file
       
   302 	SetTestStepName(_L("GprsUnSupportedTest"));
       
   303 	}
       
   304 //------------------------------------------------------------------
       
   305 
       
   306 TVerdict CGprsUnSupportedTest::doTestStepL( void )
       
   307 /**
       
   308  * Tests all unsupported GPRS API calls to the TSY.
       
   309  */
       
   310     {
       
   311 	SetSimtsyTestNumberL(0);
       
   312     TRequestStatus stat1;
       
   313 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   314 	TESTL(iPhone.Initialise()==KErrNone);
       
   315 
       
   316     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   317     iPacketService.RejectActivationRequest(stat1);
       
   318 	User::WaitForRequest(stat1);
       
   319 	TESTL(stat1.Int()== KErrNotSupported);
       
   320 
       
   321     iPacketService.RejectActivationRequest(stat1);
       
   322     iPacketService.CancelAsyncRequest(EPacketRejectActivationRequest);
       
   323     User::WaitForRequest(stat1);
       
   324     TESTL(stat1.Int() == KErrNotSupported);
       
   325 
       
   326     RPacketService::TMSClass msClass;
       
   327     iPacketService.NotifyMSClassChange(stat1, msClass);
       
   328     User::WaitForRequest(stat1);
       
   329     TESTL(stat1.Int() == KErrNotSupported);
       
   330 
       
   331     RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenPossible;
       
   332     TESTL(iPacketService.SetAttachMode(attachMode) == KErrNotSupported);
       
   333     TESTL(iPacketService.GetAttachMode(attachMode) == KErrNone);
       
   334     RPacketService::TRegistrationStatus registrationStatus = RPacketService::ERegisteredRoaming;
       
   335     iPacketService.GetNtwkRegStatus(stat1, registrationStatus);
       
   336   User::WaitForRequest(stat1);
       
   337 	TESTL(stat1.Int() == KErrNone);
       
   338 /*	//This test should not be here as this method is supported 
       
   339     iPacketService.NotifyChangeOfNtwkRegStatus(stat1, registrationStatus);
       
   340     User::WaitForRequest(stat1);
       
   341     TESTL(stat1.Int() == KErrNotSupported);
       
   342 */
       
   343     iPacketService.Close();
       
   344 	iPhone.Close();
       
   345 	return TestStepResult();
       
   346 	}
       
   347 
       
   348 /** Each test step initialises its own name
       
   349 */
       
   350 CTestDynamicCaps::CTestDynamicCaps()
       
   351 	{
       
   352 	// store the name of this test case
       
   353 	// this is the name that is used by the script file
       
   354 	SetTestStepName(_L("TestDynamicCaps"));
       
   355 	}
       
   356 
       
   357 /**
       
   358  *  Tests the dynamic capabilities APIs: RPacketService::GetDynamicCaps and RPacketService::NotifyDynamicCapsChange
       
   359  *  @return Test step verdict.
       
   360  */
       
   361 TVerdict CTestDynamicCaps::doTestStepL()
       
   362     {
       
   363     SetSimtsyTestNumberL(0);
       
   364 
       
   365     // Initialise and open the packet service...
       
   366     TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   367     TESTL(iPhone.Initialise()==KErrNone);
       
   368     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   369 
       
   370     //
       
   371     // test GetDynamicCaps
       
   372     //
       
   373     RPacketService::TDynamicCapsFlags dynCapsFlags;
       
   374     TEST(iPacketService.GetDynamicCaps(dynCapsFlags) == KErrNone);
       
   375     TEST(dynCapsFlags == RPacketService::KCapsEGPRS);
       
   376     
       
   377     //
       
   378     // test NotifyDynamicCapsChange
       
   379     //
       
   380     TRequestStatus requestStatus;
       
   381     dynCapsFlags = 0;
       
   382     iPacketService.NotifyDynamicCapsChange(requestStatus, dynCapsFlags);
       
   383     User::WaitForRequest(requestStatus);
       
   384     TEST(requestStatus == KErrNone); 
       
   385     TEST(dynCapsFlags == RPacketService::KCapsHSDPA);
       
   386 
       
   387     //
       
   388     // test cancellation of NotifyDynamicCapsChange
       
   389     //
       
   390     iPacketService.NotifyDynamicCapsChange(requestStatus, dynCapsFlags);
       
   391     iPacketService.CancelAsyncRequest(EPacketNotifyDynamicCapsChange);
       
   392     User::WaitForRequest(requestStatus);
       
   393     TEST(requestStatus == KErrCancel);
       
   394     
       
   395     iPacketService.Close();
       
   396     iPhone.Close();
       
   397     return TestStepResult();
       
   398     }
       
   399 
       
   400 //------------------------------------------------------------------
       
   401 
       
   402 CGprsContextAttachTest::CGprsContextAttachTest()
       
   403 /** Each test step initialises it's own name
       
   404 */
       
   405 	{
       
   406 	// store the name of this test case
       
   407 	// this is the name that is used by the script file
       
   408 	SetTestStepName(_L("GprsContextAttachTest"));
       
   409 	}
       
   410 //------------------------------------------------------------------
       
   411 
       
   412 TVerdict CGprsContextAttachTest::doTestStepL( void )
       
   413 /**
       
   414  * This tests the context attach and detach
       
   415  */
       
   416     {
       
   417 	SetSimtsyTestNumberL(0);
       
   418     TRequestStatus                      stat1;
       
   419     TRequestStatus						stat2;
       
   420 	TBuf<50>                            contextName;
       
   421     RPacketContext::TContextStatus        contextStatus;
       
   422 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   423 	TESTL(iPhone.Initialise()==KErrNone);
       
   424     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   425 	StartNTRasSimulation() ;
       
   426 
       
   427     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   428 
       
   429     iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
       
   430     iPacketContext[0].CancelAsyncRequest(EPacketContextNotifyStatusChange);
       
   431     User::WaitForRequest(stat1);
       
   432 	TESTL(stat1.Int() == KErrCancel);
       
   433 
       
   434     iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
       
   435 	iPacketContext[0].Activate(stat2);
       
   436 
       
   437 	User::WaitForRequest(stat1);
       
   438     TESTL(stat1.Int() == KErrNone);
       
   439     TESTL(contextStatus == RPacketContext::EStatusActivating);
       
   440 
       
   441     iPacketContext[0].NotifyStatusChange(stat1, contextStatus);	
       
   442 	User::WaitForRequest(stat2);
       
   443 	TESTL(stat2.Int()== KErrNone);
       
   444 
       
   445     User::WaitForRequest(stat1);
       
   446     TESTL(stat1.Int() == KErrNone);
       
   447     TESTL(contextStatus == RPacketContext::EStatusActive);
       
   448 
       
   449     iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
       
   450 	
       
   451 	// need a few seconds between activating and deactivating - allow NTRAS server to respond
       
   452 	User::After(100000L);
       
   453 	iPacketContext[0].Deactivate(stat2);
       
   454 	User::WaitForRequest(stat1);
       
   455     TESTL(stat1.Int() == KErrNone);
       
   456     TESTL(contextStatus == RPacketContext::EStatusDeactivating);
       
   457 	
       
   458 	iPacketContext[0].NotifyStatusChange(stat1, contextStatus);
       
   459 	User::WaitForRequest(stat2);
       
   460 	TESTL(stat2.Int() == KErrNone);
       
   461 
       
   462     User::WaitForRequest(stat1);
       
   463     TESTL(stat1.Int() == KErrNone);
       
   464     TESTL(contextStatus == RPacketContext::EStatusInactive);
       
   465 
       
   466     iPacketContext[0].Close();
       
   467     iPacketService.Close();
       
   468 	iPhone.Close();
       
   469 	return TestStepResult();
       
   470 	}
       
   471 //------------------------------------------------------------------
       
   472 
       
   473 CGprsContextDeleteTest::CGprsContextDeleteTest()
       
   474 /** Each test step initialises it's own name
       
   475 */
       
   476 	{
       
   477 	// store the name of this test case
       
   478 	// this is the name that is used by the script file
       
   479 	SetTestStepName(_L("GprsContextDeleteTest"));
       
   480 	}
       
   481 //------------------------------------------------------------------
       
   482 
       
   483 TVerdict CGprsContextDeleteTest::doTestStepL( void )
       
   484 /**
       
   485  *  This tests the context delete.
       
   486  */
       
   487     {
       
   488 	SetSimtsyTestNumberL(0);
       
   489     TRequestStatus						stat1;
       
   490 	TBuf<30>                            contextName;
       
   491     RPacketContext::TContextStatus		contextStatus;
       
   492 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   493 	TESTL(iPhone.Initialise()==KErrNone);
       
   494 
       
   495     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   496     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   497 
       
   498 	iPacketContext[0].Delete(stat1);
       
   499 	User::WaitForRequest(stat1);
       
   500 	TESTL(stat1.Int() == KErrNone);
       
   501 
       
   502 	iPacketContext[0].Activate(stat1);
       
   503 	User::WaitForRequest(stat1);
       
   504 
       
   505 	TESTL(stat1.Int() == KErrNotReady);
       
   506     TESTL(iPacketContext[0].GetStatus(contextStatus) == KErrNone);
       
   507 	TESTL(contextStatus == RPacketContext::EStatusDeleted);
       
   508 
       
   509     iPacketContext[0].Close();
       
   510     iPacketService.Close();
       
   511 	iPhone.Close();
       
   512 	return TestStepResult();
       
   513 	}
       
   514 //------------------------------------------------------------------
       
   515 
       
   516 CGprsContextLoanComport::CGprsContextLoanComport()
       
   517 /** Each test step initialises it's own name
       
   518 */
       
   519 	{
       
   520 	// store the name of this test case
       
   521 	// this is the name that is used by the script file
       
   522 	SetTestStepName(_L("GprsContextLoanComport"));
       
   523 	}
       
   524 //------------------------------------------------------------------
       
   525 
       
   526 TVerdict CGprsContextLoanComport::doTestStepL( void )
       
   527 /**
       
   528  * This tests the comport loan.
       
   529  */
       
   530     {
       
   531 	SetSimtsyTestNumberL(0);
       
   532 	TRequestStatus						stat1;
       
   533     TBuf<30>                            contextName;
       
   534 	RCall::TCommPort dataPort;
       
   535 	StartNTRasSimulation() ;
       
   536 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   537 	TESTL(iPhone.Initialise()==KErrNone);
       
   538 
       
   539     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   540     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   541 
       
   542     iPacketContext[0].RecoverCommPort(stat1);
       
   543 	User::WaitForRequest(stat1);
       
   544 	TESTL(stat1.Int() == KErrEtelPortNotLoanedToClient);
       
   545 
       
   546 	//!!!!
       
   547     iPacketContext[0].LoanCommPort(stat1, dataPort);
       
   548 	User::WaitForRequest(stat1);
       
   549 	TESTL(stat1.Int() == KErrEtelCallNotActive);
       
   550 
       
   551     iPacketContext[0].Activate(stat1);
       
   552 	User::WaitForRequest(stat1);
       
   553 	TESTL(stat1.Int() == KErrNone);
       
   554 
       
   555     iPacketContext[0].LoanCommPort(stat1, dataPort);
       
   556 	User::WaitForRequest(stat1);
       
   557 	TESTL(stat1.Int() == KErrNone);
       
   558 
       
   559     iPacketContext[0].Activate(stat1);
       
   560 	User::WaitForRequest(stat1);
       
   561 	TESTL(stat1.Int() == KErrEtelCallAlreadyActive);
       
   562 
       
   563     iPacketContext[0].RecoverCommPort(stat1);
       
   564 	User::WaitForRequest(stat1);
       
   565 	TESTL(stat1.Int() == KErrNone);
       
   566 
       
   567     iPacketContext[0].Deactivate(stat1);
       
   568 	User::WaitForRequest(stat1);
       
   569 	TESTL(stat1.Int() == KErrNone);
       
   570 
       
   571     iPacketContext[0].Close();
       
   572     iPacketService.Close();
       
   573 	iPhone.Close();
       
   574 	return TestStepResult();
       
   575 	}
       
   576 //------------------------------------------------------------------
       
   577 
       
   578 CGprsContextUnSupportedTest::CGprsContextUnSupportedTest()
       
   579 /** Each test step initialises it's own name
       
   580 */
       
   581 	{
       
   582 	// store the name of this test case
       
   583 	// this is the name that is used by the script file
       
   584 	SetTestStepName(_L("GprsContextUnSupportedTest"));
       
   585 	}
       
   586 //------------------------------------------------------------------
       
   587 
       
   588 TVerdict CGprsContextUnSupportedTest::doTestStepL( void )
       
   589 /**
       
   590  *  This tests all GPRS context API calls.
       
   591  */
       
   592     {
       
   593 	SetSimtsyTestNumberL(0);
       
   594     TRequestStatus            stat1;
       
   595     TBuf<30>                  contextName;
       
   596     TInt                      err = 0;
       
   597 	RPacketContext::TDataVolume volume;
       
   598 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   599 	TESTL(iPhone.Initialise()==KErrNone);
       
   600 
       
   601 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   602     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   603 
       
   604     TESTL(iPacketContext[0].GetDataVolumeTransferred(volume) == KErrNotSupported);
       
   605     iPacketContext[0].NotifyDataTransferred(stat1, volume);
       
   606     User::WaitForRequest(stat1);
       
   607     TESTL(stat1.Int() == KErrNotSupported);
       
   608 
       
   609     TESTL(iPacketContext[0].GetLastErrorCause(err) == KErrNotSupported);
       
   610 
       
   611     iPacketContext[0].Close();
       
   612     iPacketService.Close();
       
   613 	iPhone.Close();
       
   614 	return TestStepResult();
       
   615 	}
       
   616 //------------------------------------------------------------------
       
   617 
       
   618 CGprsCancelTest::CGprsCancelTest()
       
   619 /** Each test step initialises it's own name
       
   620 */
       
   621 	{
       
   622 	// store the name of this test case
       
   623 	// this is the name that is used by the script file
       
   624 	SetTestStepName(_L("GprsCancelTest"));
       
   625 	}
       
   626 //------------------------------------------------------------------
       
   627 
       
   628 TVerdict CGprsCancelTest::doTestStepL( void )
       
   629 /**
       
   630  * This test will call all GPRS API calls
       
   631  * that can be canceled with an outstanding request
       
   632  * to the phone.
       
   633  */
       
   634 	{
       
   635 	SetSimtsyTestNumberL(0);
       
   636 	TRequestStatus	stat;
       
   637 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   638 	TESTL(iPhone.Initialise()==KErrNone);
       
   639 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   640 
       
   641 	iPacketService.Attach(stat);
       
   642 	iPacketService.CancelAsyncRequest(EPacketAttach);
       
   643 	User::WaitForRequest(stat);
       
   644 	TESTL((stat.Int() == KErrCancel) || (stat.Int() == KErrNone));
       
   645 
       
   646 	iPacketService.Detach(stat);
       
   647 	iPacketService.CancelAsyncRequest(EPacketDetach);
       
   648 	User::WaitForRequest(stat);
       
   649 	TESTL((stat.Int() == KErrCancel)||(stat.Int() == KErrNone));
       
   650 
       
   651 	RPacketService::TMSClass currentClass;
       
   652 	RPacketService::TMSClass maxClass;
       
   653 
       
   654 	iPacketService.GetMSClass(stat, currentClass, maxClass);
       
   655 	iPacketService.CancelAsyncRequest(EPacketGetMSClass);
       
   656 	User::WaitForRequest(stat);
       
   657 	TESTL((stat.Int() == KErrCancel)||(stat.Int() == KErrNone));
       
   658 
       
   659 	currentClass = RPacketService::EMSClassSuspensionRequired;
       
   660 	iPacketService.SetMSClass(stat, currentClass);
       
   661 	iPacketService.CancelAsyncRequest(EPacketSetMSClass);
       
   662 	User::WaitForRequest(stat);
       
   663 	TESTL((stat.Int() == KErrCancel)||(stat.Int() == KErrNone));
       
   664 
       
   665 	iPacketService.Close();
       
   666 	iPhone.Close();
       
   667 	return TestStepResult();
       
   668 	}
       
   669 //------------------------------------------------------------------
       
   670 
       
   671 CGprsAttachTest::CGprsAttachTest()
       
   672 /** Each test step initialises it's own name
       
   673 */
       
   674 	{
       
   675 	// store the name of this test case
       
   676 	// this is the name that is used by the script file
       
   677 	SetTestStepName(_L("GprsAttachTest"));
       
   678 	}
       
   679 //------------------------------------------------------------------
       
   680 
       
   681 TVerdict CGprsAttachTest::doTestStepL( void )
       
   682 /**
       
   683  *  This tests the attach and detach.
       
   684  */
       
   685     {
       
   686 	SetSimtsyTestNumberL(0);
       
   687 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   688 	TESTL(iPhone.Initialise()==KErrNone);
       
   689     TRequestStatus stat1;
       
   690     RPacketService::TStatus status;
       
   691     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   692     iPacketService.Attach(stat1);
       
   693     User::WaitForRequest(stat1);
       
   694     TESTL(stat1.Int() == KErrNone);
       
   695     iPacketService.GetStatus(status);
       
   696     TESTL(status == RPacketService::EStatusAttached);
       
   697     iPacketService.Detach(stat1);
       
   698     User::WaitForRequest(stat1);
       
   699     TESTL(stat1.Int() == KErrNone);
       
   700     iPacketService.GetStatus(status);
       
   701     TESTL(status == RPacketService::EStatusUnattached);
       
   702     iPacketService.Close();
       
   703 	iPhone.Close();
       
   704 	return TestStepResult();
       
   705 	}
       
   706 //------------------------------------------------------------------
       
   707 
       
   708 CGprsNotificationTest::CGprsNotificationTest()
       
   709 /** Each test step initialises it's own name
       
   710 */
       
   711 	{
       
   712 	// store the name of this test case
       
   713 	// this is the name that is used by the script file
       
   714 	SetTestStepName(_L("GprsNotificationTest"));
       
   715 	}
       
   716 //------------------------------------------------------------------
       
   717 
       
   718 TVerdict CGprsNotificationTest::doTestStepL( void )
       
   719 /**
       
   720  * Tests Notify Context added, Tests Notify status
       
   721  */
       
   722     {
       
   723 	SetSimtsyTestNumberL(1);
       
   724     TRequestStatus stat1,stat2,stat3;
       
   725     TBuf<20> context= _L("");
       
   726 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   727 	TESTL(iPhone.Initialise()==KErrNone);
       
   728 
       
   729     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   730     TBuf<40> contextId;
       
   731 
       
   732     iPacketService.NotifyContextAdded(stat1, contextId);
       
   733     iPacketService.CancelAsyncRequest(EPacketNotifyContextAdded);
       
   734 	User::WaitForRequest(stat1);
       
   735     TESTL(stat1.Int()== KErrCancel);
       
   736     iPacketService.NotifyContextAdded(stat1, contextId);
       
   737 
       
   738     TESTL(iPacketContext[0].OpenNewContext(iPacketService, context) == KErrNone);
       
   739     User::WaitForRequest(stat1);
       
   740     TESTL(stat1.Int() == KErrNone);
       
   741 
       
   742     RPacketService::TStatus gprsStatus;
       
   743     iPacketService.NotifyStatusChange(stat2, gprsStatus);
       
   744     iPacketService.CancelAsyncRequest(EPacketNotifyStatusChange);
       
   745     User::WaitForRequest(stat2);
       
   746     TESTL(stat2.Int() == KErrCancel);
       
   747 
       
   748     iPacketService.NotifyStatusChange(stat2, gprsStatus);
       
   749     iPacketService.Attach(stat1);
       
   750 	User::WaitForRequest(stat1);
       
   751 	TESTL(stat1.Int() == KErrNone);
       
   752     User::WaitForRequest(stat2);
       
   753     TESTL(stat2.Int() == KErrNone);
       
   754     TESTL(gprsStatus == RPacketService::EStatusAttached);
       
   755 
       
   756     iPacketService.NotifyStatusChange(stat3, gprsStatus);
       
   757     iPacketService.Detach(stat1);
       
   758 	User::WaitForRequest(stat1);
       
   759 	TESTL(stat1.Int() == KErrNone);
       
   760     User::WaitForRequest(stat3);
       
   761     TESTL(stat3.Int() == KErrNone);
       
   762     TESTL(gprsStatus == RPacketService::EStatusUnattached);
       
   763 
       
   764     iPacketContext[0].Close();
       
   765     iPacketService.Close();
       
   766 	iPhone.Close();
       
   767 	return TestStepResult();
       
   768 	}
       
   769 //------------------------------------------------------------------
       
   770 
       
   771 CGprsMsClassTest::CGprsMsClassTest()
       
   772 /** Each test step initialises it's own name
       
   773 */
       
   774 	{
       
   775 	// store the name of this test case
       
   776 	// this is the name that is used by the script file
       
   777 	SetTestStepName(_L("GprsMsClassTest"));
       
   778 	}
       
   779 //------------------------------------------------------------------
       
   780 
       
   781 TVerdict CGprsMsClassTest::doTestStepL( void )
       
   782 /**
       
   783  * This tests the MS Class.
       
   784  */
       
   785     {
       
   786 	SetSimtsyTestNumberL(0);
       
   787     TRequestStatus stat1;
       
   788 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   789 	TESTL(iPhone.Initialise()==KErrNone);
       
   790     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   791 
       
   792     RPacketService::TMSClass     currentClass;
       
   793     RPacketService::TMSClass     maxClass;
       
   794     iPacketService.GetMSClass(stat1, currentClass, maxClass);
       
   795 	User::WaitForRequest(stat1);
       
   796 	TESTL(stat1.Int() == KErrNone);
       
   797 
       
   798 	iPacketService.SetMSClass(stat1, currentClass);
       
   799 	User::WaitForRequest(stat1);
       
   800 	TESTL(stat1.Int() == KErrNone);
       
   801 	TESTL(currentClass	== RPacketService::EMSClassSuspensionRequired);
       
   802 	TESTL(maxClass		== RPacketService::EMSClassSuspensionRequired);
       
   803 
       
   804     iPacketService.Close();
       
   805 	iPhone.Close();
       
   806 	return TestStepResult();
       
   807 	}
       
   808 //------------------------------------------------------------------
       
   809 
       
   810 CGprsContextConfigTest::CGprsContextConfigTest()
       
   811 /** Each test step initialises it's own name
       
   812 */
       
   813 	{
       
   814 	// store the name of this test case
       
   815 	// this is the name that is used by the script file
       
   816 	SetTestStepName(_L("GprsContextConfigTest"));
       
   817 	}
       
   818 //------------------------------------------------------------------
       
   819 
       
   820 TVerdict CGprsContextConfigTest::doTestStepL( void )
       
   821 /**
       
   822  * Test context config.
       
   823  */
       
   824     {
       
   825 	SetSimtsyTestNumberL(0);
       
   826     TRequestStatus stat1;
       
   827 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   828 	TESTL(iPhone.Initialise()==KErrNone);
       
   829 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   830     TBuf<30> contextName;
       
   831     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   832     TESTL(iPacketContext[1].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   833 
       
   834     RPacketContext::TContextConfigGPRS     Getparams;
       
   835     RPacketContext::TContextConfigGPRS     Setparams;
       
   836 	Setparams.iPdpType = SIMTSY_PDP_TYPE2;
       
   837     Setparams.iAccessPointName = SIMTSY_ACCESS_POINT2;
       
   838     Setparams.iPdpAddress = SIMTSY_PDP_ADDRESS2;
       
   839     Setparams.iPdpCompression = SIMTSY_COMPRESSION2;
       
   840 	Setparams.iAnonymousAccessReqd = SIMTSY_ANONYMOUS_ACCESS2;
       
   841 	Setparams.iUseEdge = SIMTSY_EGPRS_REQUIRED;
       
   842 
       
   843     TPckg<RPacketContext::TContextConfigGPRS>    GetcontextConfigPckg(Getparams);
       
   844     iPacketContext[0].GetConfig(stat1, GetcontextConfigPckg);
       
   845 	User::WaitForRequest(stat1);
       
   846 	TESTL(stat1.Int() == KErrNone);
       
   847     Setparams = Getparams;
       
   848 
       
   849     TPckg<RPacketContext::TContextConfigGPRS>    SetcontextConfigPckg(Setparams);
       
   850     iPacketContext[0].SetConfig(stat1, SetcontextConfigPckg);
       
   851 	User::WaitForRequest(stat1);
       
   852 	TESTL(stat1.Int() == KErrNone);
       
   853     iPacketContext[1].SetConfig(stat1, SetcontextConfigPckg);
       
   854 	User::WaitForRequest(stat1);
       
   855 	TESTL(stat1.Int() == KErrNone);
       
   856     iPacketContext[0].GetConfig(stat1, SetcontextConfigPckg);
       
   857 	User::WaitForRequest(stat1);
       
   858 	TESTL(stat1.Int() == KErrNone);
       
   859 	TRequestStatus stat;
       
   860 	iPacketContext[0].SetConfig(stat, SetcontextConfigPckg);
       
   861 	iPacketContext[0].CancelAsyncRequest(EPacketContextSetConfig);
       
   862 	User::WaitForRequest(stat);
       
   863 	TESTL(stat.Int() == KErrCancel || stat.Int() == KErrNone);
       
   864 	//!!!!
       
   865 	iPacketContext[0].GetConfig(stat, GetcontextConfigPckg);
       
   866 	iPacketContext[0].CancelAsyncRequest(EPacketContextGetConfig);
       
   867 	User::WaitForRequest(stat);
       
   868 	TESTL(stat.Int() == KErrCancel || stat.Int() == KErrNone);
       
   869 
       
   870 
       
   871 	Setparams.iPdpType = RPacketContext::TProtocolType(20); // Set out of range
       
   872 	TPckg<RPacketContext::TContextConfigGPRS>    errorPackage(Setparams);
       
   873 	iPacketContext[0].SetConfig(stat1, errorPackage);
       
   874 	User::WaitForRequest(stat1);
       
   875 	TESTL(stat1.Int() == KErrCorrupt);
       
   876 
       
   877 
       
   878     iPacketContext[0].Close();
       
   879     iPacketContext[1].Close();
       
   880     iPacketService.Close();
       
   881 	iPhone.Close();
       
   882 	return TestStepResult();
       
   883 	}
       
   884 //------------------------------------------------------------------
       
   885 
       
   886 CGprsContextConfigNotificationsTest::CGprsContextConfigNotificationsTest()
       
   887 /** Each test step initialises it's own name
       
   888 */
       
   889 	{
       
   890 	// store the name of this test case
       
   891 	// this is the name that is used by the script file
       
   892 	SetTestStepName(_L("GprsContextConfigNotificationsTest"));
       
   893 	}
       
   894 //------------------------------------------------------------------
       
   895 
       
   896 TVerdict CGprsContextConfigNotificationsTest::doTestStepL( void )
       
   897 /**
       
   898  * Test context notifications.
       
   899  */
       
   900     {
       
   901 	SetSimtsyTestNumberL(0);
       
   902     TRequestStatus                      stat1, stat2;
       
   903     TBuf<30>                            contextName;
       
   904     RPacketContext::TContextConfigGPRS   params, notifyParams;
       
   905     TPckg<RPacketContext::TContextConfigGPRS>  contextConfigPckg(params);
       
   906     TPckg<RPacketContext::TContextConfigGPRS>  notifyContextConfigPckg(notifyParams);
       
   907 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   908 	TESTL(iPhone.Initialise()==KErrNone);
       
   909 
       
   910     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   911     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   912     TESTL(iPacketContext[1].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   913     iPacketContext[0].NotifyConfigChanged(stat1, notifyContextConfigPckg);
       
   914     iPacketContext[0].CancelAsyncRequest(EPacketContextNotifyConfigChanged);
       
   915     User::WaitForRequest(stat1);
       
   916     TESTL(stat1.Int() == KErrCancel);
       
   917 
       
   918     iPacketContext[0].GetConfig(stat1, contextConfigPckg);
       
   919 	User::WaitForRequest(stat1);
       
   920 	TESTL(stat1.Int() == KErrNone);
       
   921     iPacketContext[0].NotifyConfigChanged(stat1, notifyContextConfigPckg);
       
   922 
       
   923 	iPacketContext[0].SetConfig(stat2, contextConfigPckg);
       
   924 	User::WaitForRequest(stat2);
       
   925 	TESTL(stat2.Int() == KErrNone);
       
   926 
       
   927     User::WaitForRequest(stat1);
       
   928     TESTL(stat1.Int() == KErrNone);
       
   929     TestConfigParamsL(params, notifyParams);
       
   930 
       
   931     iPacketContext[0].Close();
       
   932     iPacketContext[1].Close();
       
   933     iPacketService.Close();
       
   934 	iPhone.Close();
       
   935 	User::After(1000000);	// to allow the next text to be able to see the contexts as closed
       
   936 	return TestStepResult();
       
   937 	}
       
   938 //------------------------------------------------------------------
       
   939 
       
   940 COpenGprsMaxContextsTest::COpenGprsMaxContextsTest()
       
   941 /** Each test step initialises it's own name
       
   942 */
       
   943 	{
       
   944 	// store the name of this test case
       
   945 	// this is the name that is used by the script file
       
   946 	SetTestStepName(_L("OpenGprsMaxContextsTest"));
       
   947 	}
       
   948 //------------------------------------------------------------------
       
   949 
       
   950 TVerdict COpenGprsMaxContextsTest::doTestStepL( void )
       
   951 /**
       
   952  *  Tests enumerate contexts, open new context, open existing context.
       
   953  */
       
   954     {
       
   955 	SetSimtsyTestNumberL(0);
       
   956     TRequestStatus	stat1;
       
   957 	TBuf<20> contextName = _L("");
       
   958 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
   959 	TESTL(iPhone.Initialise()==KErrNone);
       
   960 
       
   961     TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
   962     TInt countContexts;
       
   963     TInt maxAllowedContexts;
       
   964 	//!!!
       
   965     iPacketService.EnumerateContexts(stat1, countContexts, maxAllowedContexts);
       
   966 	User::WaitForRequest(stat1);
       
   967     TESTL(countContexts == 0);	
       
   968 
       
   969 	TESTL(maxAllowedContexts == 11);
       
   970 
       
   971     TInt i = 0;
       
   972     RPacketService::TContextInfo contextinfo;
       
   973 
       
   974     for(i = 0; i < maxAllowedContexts;i++)
       
   975         {
       
   976         RPacketContext contextPacket;
       
   977         TBuf<30> tmpContextName;
       
   978         tmpContextName = _L("PRIMARY");
       
   979         tmpContextName.AppendNum(i+1);
       
   980         TESTL(iPacketContext[i].OpenNewContext(iPacketService, contextName) == KErrNone);
       
   981         iPacketService.GetContextInfo(stat1, i, contextinfo);
       
   982 		User::WaitForRequest(stat1);
       
   983         TESTL(contextinfo.iName == tmpContextName);
       
   984         TESTL(contextinfo.iStatus == RPacketContext::EStatusInactive);
       
   985         TESTL(contextPacket.OpenExistingContext(iPacketService, contextName) == KErrNone);
       
   986         TESTL(contextName == tmpContextName);
       
   987         contextPacket.Close();
       
   988 		iPhone.Close();
       
   989         }
       
   990 
       
   991 	iPacketService.GetContextInfo(stat1, i+1, contextinfo);
       
   992 	User::WaitForRequest(stat1);
       
   993 	TESTL(stat1.Int() == KErrArgument);
       
   994     for(i = 0; i < maxAllowedContexts;i++)
       
   995         {
       
   996         iPacketContext[i].Close();
       
   997         }
       
   998     iPacketService.Close();
       
   999     iPhone.Close();
       
  1000 	return TestStepResult();
       
  1001 	}
       
  1002 
       
  1003 //------------------------------------------------------------------
       
  1004 
       
  1005 CGprsContextConfigArbitraryAddressTest::CGprsContextConfigArbitraryAddressTest()
       
  1006 /** Each test step initialises it's own name
       
  1007 */
       
  1008 	{
       
  1009 	// store the name of this test case
       
  1010 	// this is the name that is used by the script file
       
  1011 	SetTestStepName(_L("GprsContextConfigArbitraryAddressTest"));
       
  1012 	}
       
  1013 //------------------------------------------------------------------
       
  1014 
       
  1015 TVerdict CGprsContextConfigArbitraryAddressTest::doTestStepL()
       
  1016 /**
       
  1017  * Test context config.
       
  1018  */
       
  1019     {
       
  1020 	SetSimtsyTestNumberL(0);
       
  1021     TRequestStatus stat1;
       
  1022     RPacketContext::TContextConfigGPRS     getParams;
       
  1023     RPacketContext::TContextConfigGPRS     setParams;
       
  1024     
       
  1025     // Loading configuration from File
       
  1026 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1027 	TESTL(iPhone.Initialise()==KErrNone);
       
  1028 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1029     TBuf<30> contextName;
       
  1030     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
  1031 
       
  1032     // Getting the Actual Configuration
       
  1033     TPckg<RPacketContext::TContextConfigGPRS>    getContextConfigPckg(getParams);
       
  1034     iPacketContext[0].GetConfig(stat1, getContextConfigPckg);
       
  1035 	User::WaitForRequest(stat1);
       
  1036 	TESTL(stat1.Int() == KErrNone);
       
  1037     setParams = getParams;
       
  1038     
       
  1039     // Hacking the PdpAddress with an Arbitrary String (doesn't need to be a proper IP)
       
  1040     setParams.iPdpAddress = _L8("ARBITRARY ADDRESS");
       
  1041 
       
  1042     // Setting the New Configuration checking that it is accepted (no "KErrCorrupt")
       
  1043     TPckg<RPacketContext::TContextConfigGPRS>    setContextConfigPckg(setParams);
       
  1044     iPacketContext[0].SetConfig(stat1, setContextConfigPckg);
       
  1045 	User::WaitForRequest(stat1);
       
  1046 	TESTL(stat1.Int() != KErrCorrupt && stat1.Int() == KErrNone);
       
  1047 	
       
  1048 	// Getting the Configuration
       
  1049     iPacketContext[0].GetConfig(stat1, setContextConfigPckg);
       
  1050 	User::WaitForRequest(stat1);
       
  1051 	TESTL(stat1.Int() == KErrNone);
       
  1052 	
       
  1053 	// Checking the Configuration was correctly changed by Sim.tsy
       
  1054 	TESTL(setParams.iPdpAddress.Compare(getParams.iPdpAddress) == 0);
       
  1055 	
       
  1056     iPacketContext[0].Close();
       
  1057     iPacketService.Close();
       
  1058 	iPhone.Close();
       
  1059 	return TestStepResult();
       
  1060 	}
       
  1061 
       
  1062 //------------------------------------------------------------------
       
  1063 
       
  1064 CMbmsOpenNewContextTest::CMbmsOpenNewContextTest()
       
  1065 /** Each test step initialises it's own name
       
  1066  */
       
  1067 	{
       
  1068 	// store the name of this test case
       
  1069 	// this is the name that is used by the script file
       
  1070 	SetTestStepName(_L("EtelPcktMbmsCap1"));
       
  1071 	}
       
  1072 //------------------------------------------------------------------
       
  1073 
       
  1074 TVerdict CMbmsOpenNewContextTest::doTestStepL( void )
       
  1075 /**
       
  1076  *  Tests creation of new MBMS context activation using
       
  1077  * OpenNewContext of RPacketMbmsContext
       
  1078  */
       
  1079 	{
       
  1080 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1081 	TRequestStatus	reqStatus;
       
  1082 	TBuf<20> contextName = _L("");
       
  1083 	
       
  1084 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1085 	TESTL(iPhone.Initialise()==KErrNone);
       
  1086 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1087 	
       
  1088 	TInt ret= iPacketMbmsContext.OpenNewContext(iPacketService, contextName);
       
  1089 	TEST(ret == KErrNone); //OpenNewContext will not use any capabilities.
       
  1090 
       
  1091 	iPacketMbmsContext.Close();
       
  1092 	iPacketService.Close();
       
  1093 	iPhone.Close();
       
  1094 
       
  1095 	return TestStepResult();
       
  1096 	}
       
  1097 
       
  1098 
       
  1099 //-------------------------------------------------------------------------
       
  1100 
       
  1101 CMbmsUpdateSessionTest::CMbmsUpdateSessionTest()
       
  1102 /** Each test step initialises it's own name
       
  1103  */
       
  1104 	{
       
  1105 	// store the name of this test case
       
  1106 	// this is the name that is used by the script file
       
  1107 	SetTestStepName(_L("EtelPcktMbmsCap2"));
       
  1108 	}
       
  1109 //------------------------------------------------------------------
       
  1110 
       
  1111 TVerdict CMbmsUpdateSessionTest::doTestStepL( void )
       
  1112 /**
       
  1113  * Tests creation of new MBMS context activation and
       
  1114  * tests the update session functionality of the MBMS context using the
       
  1115  * API MbmsUpdateSessionTest of RPacketMbmsContext 
       
  1116  */
       
  1117 	{
       
  1118 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1119 	TRequestStatus	reqStatus;
       
  1120 	TBuf<20> contextName = _L("");
       
  1121 
       
  1122 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1123 	TESTL(iPhone.Initialise()==KErrNone);
       
  1124 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1125 
       
  1126 	TInt ret= iPacketMbmsContext.OpenNewContext(iPacketService, contextName);
       
  1127 	TESTL(ret == KErrNone);
       
  1128 
       
  1129 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig;
       
  1130 	TPckg<RPacketMbmsContext::TContextConfigMbmsV1> contextConfigPckg(contextConfig);
       
  1131 
       
  1132 	//Get configuration for the MBMS
       
  1133 	iPacketMbmsContext.GetConfig(reqStatus, contextConfigPckg);
       
  1134 	User::WaitForRequest(reqStatus);
       
  1135 
       
  1136 	RPacketContext::TContextStatus contextStatus;
       
  1137 	TRequestStatus notifyStatusRequest;
       
  1138 	iPacketMbmsContext.NotifyStatusChange(notifyStatusRequest, contextStatus);	
       
  1139 
       
  1140 	// Activate the MBMS context
       
  1141 	iPacketMbmsContext.Activate(reqStatus);
       
  1142 	User::WaitForRequest(reqStatus);
       
  1143 
       
  1144 	User::WaitForRequest(notifyStatusRequest);//completes NotifyStatusChange with state “ctivating”
       
  1145 
       
  1146 	/** Session is added to the activated services table */
       
  1147 	TMbmsAction aAction=EAddEntries;
       
  1148 	TUint sessionid=SIM_PACKET_MBMS_SESSIONID;
       
  1149 	TRequestStatus updateSessionRequest;
       
  1150 	iPacketMbmsContext.UpdateMbmsSessionList(updateSessionRequest,reinterpret_cast<TMbmsAction &>(aAction), sessionid);
       
  1151 
       
  1152 	/** the state of the session added changes from inactive to activated */
       
  1153 	User::WaitForRequest(updateSessionRequest);//completes UpdateSession
       
  1154 	TESTL(updateSessionRequest.Int() == KErrPermissionDenied);
       
  1155 	
       
  1156 	iPacketMbmsContext.Close();
       
  1157 	iPacketService.Close();
       
  1158 	iPhone.Close();
       
  1159 
       
  1160 	return TestStepResult();
       
  1161 	}
       
  1162 
       
  1163 //-------------------------------------------------------------------------
       
  1164 CGetMbmsNetworkServiceStatus::CGetMbmsNetworkServiceStatus()
       
  1165 /** Each test step initialises it's own name
       
  1166  */
       
  1167 	{
       
  1168 	// store the name of this test case
       
  1169 	// this is the name that is used by the script file
       
  1170 	SetTestStepName(_L("EtelPcktMbmsCap3"));
       
  1171 	}
       
  1172 //------------------------------------------------------------------
       
  1173 
       
  1174 TVerdict CGetMbmsNetworkServiceStatus::doTestStepL( void )
       
  1175 /**
       
  1176  * Tests the functionality of GetMbmsNetworkServiceStatus of RPacketService.
       
  1177  * 
       
  1178  */
       
  1179 	{
       
  1180 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1181 	TRequestStatus	reqStatus;
       
  1182 	TBuf<20> contextName = _L("");
       
  1183 
       
  1184 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1185 	TESTL(iPhone.Initialise()==KErrNone);
       
  1186 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1187 
       
  1188 	TMbmsNetworkServiceStatus tMbmsNetworkServiceStatus;
       
  1189 	TBool attemptAttached = ETrue;
       
  1190 
       
  1191 	iPacketService.GetMbmsNetworkServiceStatus(reqStatus, attemptAttached, tMbmsNetworkServiceStatus);
       
  1192 	User::WaitForRequest(reqStatus);
       
  1193 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1194 
       
  1195 	iPacketService.Close();
       
  1196 	iPhone.Close();
       
  1197 
       
  1198 	return TestStepResult();
       
  1199 	}
       
  1200 
       
  1201 //-------------------------------------------------------------------------
       
  1202 
       
  1203 CNotifyMbmsNetworkServiceStatusChange::CNotifyMbmsNetworkServiceStatusChange()
       
  1204 /** Each test step initialises it's own name
       
  1205  */
       
  1206 	{
       
  1207 	// store the name of this test case
       
  1208 	// this is the name that is used by the script file
       
  1209 	SetTestStepName(_L("EtelPcktMbmsCap4"));
       
  1210 	}
       
  1211 //------------------------------------------------------------------
       
  1212 
       
  1213 TVerdict CNotifyMbmsNetworkServiceStatusChange::doTestStepL( void )
       
  1214 /**
       
  1215  * Tests the functionality of NotifyMbmsNetworkServiceStatusChange of RPacketService.
       
  1216  * 
       
  1217  */
       
  1218 	{
       
  1219 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1220 	TRequestStatus	reqStatus;
       
  1221 	TBuf<20> contextName = _L("");
       
  1222 
       
  1223 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1224 	TESTL(iPhone.Initialise()==KErrNone);
       
  1225 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1226 
       
  1227 	TMbmsNetworkServiceStatus tMbmsNetworkServiceStatus;
       
  1228 
       
  1229 	//To get notified when the network service status changes 
       
  1230 	iPacketService.NotifyMbmsNetworkServiceStatusChange(reqStatus, tMbmsNetworkServiceStatus);
       
  1231 	User::WaitForRequest(reqStatus);
       
  1232 
       
  1233 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1234 
       
  1235 	iPacketService.Close();
       
  1236 	iPhone.Close();
       
  1237 
       
  1238 	return TestStepResult();
       
  1239 	}
       
  1240 
       
  1241 //-------------------------------------------------------------------------
       
  1242 
       
  1243 CNotifyMbmsServiceAvailabilityChange::CNotifyMbmsServiceAvailabilityChange()
       
  1244 /** Each test step initialises it's own name
       
  1245  */
       
  1246 	{
       
  1247 	// store the name of this test case
       
  1248 	// this is the name that is used by the script file
       
  1249 	SetTestStepName(_L("EtelPcktMbmsCap5"));
       
  1250 	}
       
  1251 //------------------------------------------------------------------
       
  1252 
       
  1253 TVerdict CNotifyMbmsServiceAvailabilityChange::doTestStepL( void )
       
  1254 /**
       
  1255  * Tests Notification of the Service Availability List using the 
       
  1256  * API NotifyMbmsServiceAvailabilityListChange of RPacketService.
       
  1257  */
       
  1258 	{
       
  1259 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1260 	TRequestStatus	reqStatus;
       
  1261 	TBuf<20> contextName = _L("");
       
  1262 
       
  1263 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1264 	TESTL(iPhone.Initialise()==KErrNone);
       
  1265 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1266 
       
  1267 	CPcktMbmsMonitoredServiceList* mbmslist =  CPcktMbmsMonitoredServiceList::NewL();
       
  1268 	CleanupStack::PushL(mbmslist);
       
  1269 
       
  1270 	//Update the Mbms service availability List
       
  1271 	TMbmsAction aAction=EAddEntries;
       
  1272 	iPacketService.UpdateMbmsMonitorServiceListL(reqStatus, reinterpret_cast<TMbmsAction &>(aAction), mbmslist);
       
  1273 	User::WaitForRequest(reqStatus);
       
  1274 
       
  1275 	//Notify the change in the mbms service parameter list
       
  1276 	iPacketService.NotifyMbmsServiceAvailabilityChange (reqStatus);
       
  1277 	User::WaitForRequest(reqStatus);
       
  1278 	TESTL(reqStatus.Int() == KErrNone);
       
  1279 
       
  1280 	CleanupStack::PopAndDestroy();	//mbmslist
       
  1281 	iPacketService.Close();
       
  1282 	iPhone.Close();
       
  1283 
       
  1284 	return TestStepResult();
       
  1285 	}
       
  1286 
       
  1287 
       
  1288 //-------------------------------------------------------------------------
       
  1289 
       
  1290 CUpdateMbmsMonitorServiceList::CUpdateMbmsMonitorServiceList()
       
  1291 /** Each test step initialises it's own name
       
  1292  */
       
  1293 	{
       
  1294 	// store the name of this test case
       
  1295 	// this is the name that is used by the script file
       
  1296 	SetTestStepName(_L("EtelPcktMbmsCap6"));
       
  1297 	}
       
  1298 //------------------------------------------------------------------
       
  1299 
       
  1300 TVerdict CUpdateMbmsMonitorServiceList::doTestStepL( void )
       
  1301 /**
       
  1302  *  Tests updation of the Service Monitoring List using the 
       
  1303  * 	API UpdateMbmsMonitorServiceListL of RPacketService.
       
  1304  */
       
  1305 	{
       
  1306 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1307 	TRequestStatus	reqStatus;
       
  1308 	TBuf<20> contextName = _L("");
       
  1309 
       
  1310 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1311 	TESTL(iPhone.Initialise()==KErrNone);
       
  1312 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1313 
       
  1314 	CPcktMbmsMonitoredServiceList* mbmsList =  CPcktMbmsMonitoredServiceList::NewL();
       
  1315 	CleanupStack::PushL(mbmsList);
       
  1316 
       
  1317 	/* ADD SERVICE */
       
  1318 
       
  1319 	RPacketService::TMbmsServiceAvailabilityV1 mbmsServAvail; 
       
  1320 	TMbmsAction action=EAddEntries;
       
  1321 	TInt ab1=0,s1=1,a1=0;
       
  1322 	TInt ab2=1,s2=2,a2=0;
       
  1323 
       
  1324 	mbmsServAvail.iTmgi.SetServiceId(SIM_PACKET_MBMS_SERVICEID);
       
  1325 	mbmsServAvail.iTmgi.SetMCC(SIM_PACKET_MBMS_MCCID);
       
  1326 	mbmsServAvail.iTmgi.SetMNC(SIM_PACKET_MBMS_MNCID);
       
  1327 	mbmsServAvail.iMbmsServiceMode = reinterpret_cast<TMbmsServiceMode&>(s1);
       
  1328 	mbmsServAvail.iMbmsAvailabilityStatus = reinterpret_cast<TMbmsAvailabilityStatus&>(a1);
       
  1329 	mbmsServAvail.iMbmsAccessBearer = reinterpret_cast<TMbmsScope&>(ab1);
       
  1330 	mbmsList->AddEntryL(mbmsServAvail);
       
  1331 
       
  1332 	mbmsServAvail.iTmgi.SetServiceId(SIM_PACKET_MBMS_SERVICEID);
       
  1333 	mbmsServAvail.iTmgi.SetMCC(SIM_PACKET_MBMS_MCCID);
       
  1334 	mbmsServAvail.iTmgi.SetMNC(SIM_PACKET_MBMS_MNCID);
       
  1335 	mbmsServAvail.iMbmsServiceMode = reinterpret_cast<TMbmsServiceMode&>(s2);
       
  1336 	mbmsServAvail.iMbmsAvailabilityStatus = reinterpret_cast<TMbmsAvailabilityStatus&>(a2);
       
  1337 	mbmsServAvail.iMbmsAccessBearer = reinterpret_cast<TMbmsScope&>(ab2);
       
  1338 	mbmsList->AddEntryL(mbmsServAvail);	
       
  1339 
       
  1340 	iPacketService.UpdateMbmsMonitorServiceListL(reqStatus,action,mbmsList);
       
  1341 	User::WaitForRequest(reqStatus);
       
  1342 	CleanupStack::PopAndDestroy();
       
  1343 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1344 
       
  1345 	/* REMOVE SPECIFIC SERVICE */
       
  1346 	mbmsList= CPcktMbmsMonitoredServiceList::NewL();
       
  1347 	CleanupStack::PushL(mbmsList);
       
  1348 	action=ERemoveEntries;
       
  1349 	mbmsServAvail.iTmgi.SetServiceId(2345); 
       
  1350 	mbmsServAvail.iTmgi.SetMCC(2345);
       
  1351 	mbmsServAvail.iTmgi.SetMNC(2345);
       
  1352 	mbmsServAvail.iMbmsServiceMode = reinterpret_cast<TMbmsServiceMode&>(s2);
       
  1353 	mbmsServAvail.iMbmsAvailabilityStatus = reinterpret_cast<TMbmsAvailabilityStatus&>(a2);
       
  1354 	mbmsServAvail.iMbmsAccessBearer = reinterpret_cast<TMbmsScope&>(ab2);
       
  1355 	mbmsList->AddEntryL(mbmsServAvail);
       
  1356 
       
  1357 	iPacketService.UpdateMbmsMonitorServiceListL(reqStatus,action,mbmsList);
       
  1358 	User::WaitForRequest(reqStatus);
       
  1359 	CleanupStack::PopAndDestroy();
       
  1360 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1361 
       
  1362 	/* REMOVE_ALL */
       
  1363 	action=ERemoveAllEntries;
       
  1364 	iPacketService.UpdateMbmsMonitorServiceListL(reqStatus,action);
       
  1365 	User::WaitForRequest(reqStatus);
       
  1366 	
       
  1367 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1368 
       
  1369 	iPacketService.Close();
       
  1370 	iPhone.Close();
       
  1371 
       
  1372 	return TestStepResult();
       
  1373 	}
       
  1374 
       
  1375 //-------------------------------------------------------------------------
       
  1376 
       
  1377 CEnumerateMbmsActiveServiceList::CEnumerateMbmsActiveServiceList()
       
  1378 /** Each test step initialises it's own name
       
  1379  */
       
  1380 	{
       
  1381 	// store the name of this test case
       
  1382 	// this is the name that is used by the script file
       
  1383 	SetTestStepName(_L("EtelPcktMbmsCap7"));
       
  1384 	}
       
  1385 //------------------------------------------------------------------
       
  1386 
       
  1387 TVerdict CEnumerateMbmsActiveServiceList::doTestStepL( void )
       
  1388 /**
       
  1389  * Tests the functionality of EnumerateMbmsActiveServiceList of RPacketService.
       
  1390  * 
       
  1391  */
       
  1392 	{
       
  1393 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1394 	TRequestStatus	reqStatus;
       
  1395 	TBuf<20> contextName = _L("");
       
  1396 
       
  1397 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1398 	TESTL(iPhone.Initialise()==KErrNone);
       
  1399 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1400 
       
  1401 	TInt currActiveServices, maxActiveServices;
       
  1402 	iPacketService.EnumerateMbmsActiveServiceList(reqStatus,currActiveServices, maxActiveServices);
       
  1403 	User::WaitForRequest(reqStatus);
       
  1404 
       
  1405 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1406 
       
  1407 	iPacketService.Close();
       
  1408 	iPhone.Close();
       
  1409 
       
  1410 	return TestStepResult();
       
  1411 	}
       
  1412 
       
  1413 
       
  1414 //-------------------------------------------------------------------------
       
  1415 
       
  1416 CEnumerateMbmsMonitorServiceList::CEnumerateMbmsMonitorServiceList()
       
  1417 /** Each test step initialises it's own name
       
  1418  */
       
  1419 	{
       
  1420 	// store the name of this test case
       
  1421 	// this is the name that is used by the script file
       
  1422 	SetTestStepName(_L("EtelPcktMbmsCap8"));
       
  1423 	}
       
  1424 //------------------------------------------------------------------
       
  1425 
       
  1426 TVerdict CEnumerateMbmsMonitorServiceList::doTestStepL( void )
       
  1427 /**
       
  1428  * Tests the functionality of EnumerateMbmsActiveServiceList of RPacketService.
       
  1429  * 
       
  1430  */
       
  1431 	{
       
  1432 	SetSimtsyTestNumberL(SIM_PACKET_MBMS_TESTNUMBER);
       
  1433 	TRequestStatus	reqStatus;
       
  1434 	TBuf<20> contextName = _L("");
       
  1435 
       
  1436 	TESTL(iPhone.Open(iTelServer, KPhoneName)==KErrNone);
       
  1437 	TESTL(iPhone.Initialise()==KErrNone);
       
  1438 	TESTL(iPacketService.Open(iPhone ) == KErrNone);
       
  1439 
       
  1440 	TInt currActiveServices, maxActiveServices;
       
  1441 	iPacketService.EnumerateMbmsActiveServiceList(reqStatus,currActiveServices, maxActiveServices);
       
  1442 	User::WaitForRequest(reqStatus);
       
  1443 
       
  1444 	TESTL(reqStatus.Int() == KErrPermissionDenied);
       
  1445 
       
  1446 	iPacketService.Close();
       
  1447 	iPhone.Close();
       
  1448 
       
  1449 	return TestStepResult();
       
  1450 	}
       
  1451 
       
  1452 
       
  1453 /**
       
  1454  *  Tests closing one of two handles that both have notifications on them.
       
  1455  *  This can cause ETel to close multiple requests during the same cancel
       
  1456  *  request, which in turn can panic ETel if the iterator gets corrupted.
       
  1457  * 
       
  1458  *  @return Test step verdict.
       
  1459  */
       
  1460 TVerdict CTestMultipleCompletionWithClosingContext::doTestStepL()
       
  1461     {
       
  1462     //
       
  1463     // Initialise and open the packet service...
       
  1464     //
       
  1465 	SetSimtsyTestNumberL(2);
       
  1466 	
       
  1467 	TESTL(iPhone.Open(iTelServer, KPhoneName) == KErrNone);
       
  1468 	TESTL(iPhone.Initialise() == KErrNone);
       
  1469     TESTL(iPacketService.Open(iPhone) == KErrNone);
       
  1470 	StartNTRasSimulation();
       
  1471 	
       
  1472 	//
       
  1473 	// Open the first context...
       
  1474 	//
       
  1475     TRequestStatus  activateContext1Status;
       
  1476 	TBuf<50>        contextName;
       
  1477 	
       
  1478     TESTL(iPacketContext[0].OpenNewContext(iPacketService, contextName) == KErrNone);
       
  1479 	iPacketContext[0].Activate(activateContext1Status);
       
  1480 	User::WaitForRequest(activateContext1Status);
       
  1481     
       
  1482 	//
       
  1483 	// Open the second context...
       
  1484 	//
       
  1485     TRequestStatus  activateContext2Status;
       
  1486 
       
  1487     TESTL(iPacketContext[1].OpenNewContext(iPacketService, contextName) == KErrNone);
       
  1488 	iPacketContext[1].Activate(activateContext2Status);
       
  1489 	User::WaitForRequest(activateContext2Status);
       
  1490 
       
  1491 	//
       
  1492 	// Open another handle to the second context by name...
       
  1493 	//
       
  1494     TESTL(iPacketContext[2].OpenExistingContext(iPacketService, _L("PRIMARY2")) == KErrNone);
       
  1495 
       
  1496     //
       
  1497     // Post notifications on both handles for the second context...
       
  1498     //
       
  1499     TRequestStatus  notifyContext1Status, notifyContext2Status;
       
  1500 	RPacketContext::TContextStatus  contextStatus1, contextStatus2;
       
  1501 
       
  1502 	iPacketContext[1].NotifyStatusChange(notifyContext1Status, contextStatus1);	
       
  1503     iPacketContext[2].NotifyStatusChange(notifyContext2Status, contextStatus2);
       
  1504 
       
  1505     //
       
  1506     // Delete second context using the first handle...
       
  1507     //
       
  1508     TRequestStatus   deleteContext2Status;
       
  1509 
       
  1510     iPacketContext[1].Delete(deleteContext2Status);
       
  1511     User::WaitForRequest(deleteContext2Status);
       
  1512 
       
  1513     //
       
  1514     // The notifications will have triggered and a request will have
       
  1515     // been reposted to the TSY.
       
  1516     //
       
  1517     User::WaitForRequest(notifyContext1Status);
       
  1518     User::WaitForRequest(notifyContext2Status);
       
  1519 
       
  1520     //
       
  1521     // Deactivate the fist context...
       
  1522     //
       
  1523     TRequestStatus   deactivateContext1Status;
       
  1524     
       
  1525     iPacketContext[0].Deactivate(deactivateContext1Status);
       
  1526     User::WaitForRequest(deactivateContext1Status);
       
  1527     
       
  1528     //
       
  1529     // Close the contexts. Note this is closing iPacketContext[1] before
       
  1530     // iPacketContext[2]! This forces the notification from the first handle
       
  1531     // to move to the second handle, but there it errors as the context is
       
  1532     // closed. This would cause ETel server to panic with KERN-EXEC:3.
       
  1533     //
       
  1534 	iPacketContext[1].Close();
       
  1535     iPacketContext[2].Close();
       
  1536     iPacketContext[0].Close();
       
  1537     iPacketService.Close();
       
  1538 	iPhone.Close();
       
  1539 
       
  1540 	//
       
  1541 	// Now check that ETel is still up...
       
  1542 	//
       
  1543 	TEST(iPhone.Open(iTelServer, KPhoneName) == KErrNone);
       
  1544 	iPhone.Close();
       
  1545 
       
  1546 	return TestStepResult();
       
  1547 	} //  CTestMultipleCompletionWithClosingContext::doTestStepL