telephonyserverplugins/simtsy/test/Te_Sim/Te_SimPacketTest.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18 */
       
    19 
       
    20 #include "Te_SimPacketTest.h"
       
    21 
       
    22 CSimPacketsTest::CSimPacketsTest() 
       
    23 	{ 
       
    24 	SetTestStepName(_L("PacketTest"));
       
    25 	}
       
    26 
       
    27 TVerdict CSimPacketsTest::doTestStepL()
       
    28 	{
       
    29 	INFO_PRINTF1(_L("BeginPacketTest"));
       
    30 
       
    31  	CreateConfigFileL(_L("c:\\config3.txt"));
       
    32  	SetTestNumberL(9);
       
    33 
       
    34 	INFO_PRINTF1(_L("RPacketService Functionality"));
       
    35 
       
    36 	// test RPacketService::Open
       
    37 	TInt ret = iPhone.Open(iTelServer,KPhoneName); 
       
    38 	INFO_PRINTF2(_L("Result: %d"),ret); 
       
    39 	TESTL(ret == KErrNone); 
       
    40 	INFO_PRINTF1(_L("Opened phone object"));
       
    41 	//TESTL(iPacketService.Open(iPhone)==KErrNone);
       
    42 	ret = iPacketService.Open(iPhone);
       
    43 	INFO_PRINTF1(_L("Opened Packet object"));
       
    44 	CHECKPOINTL(ret,KErrNone,CHP_SRVS_CASE("E.1"));
       
    45 
       
    46 	RPacketService::TRegistrationStatus regStatus;
       
    47 	TRequestStatus stat0;
       
    48 	TRequestStatus reqStatus;
       
    49 
       
    50 	// test network RPacketService::GetNtwkRegStatus
       
    51 	INFO_PRINTF1(_L(""));
       
    52 	INFO_PRINTF1(_L("Testing Get Current Registration Status"));
       
    53 	iPacketService.GetNtwkRegStatus(stat0, regStatus);
       
    54 	User::WaitForRequest(stat0);
       
    55 	TESTL(stat0==KErrNone);
       
    56 	TESTL(regStatus==RPacketService::ENotRegisteredSearching);
       
    57 	INFO_PRINTF1(_L("GETNTWK:  Searching for network"));
       
    58 
       
    59 	// test RPacketService::NotifyChangeOfNtwkRegStatus
       
    60 	INFO_PRINTF1(_L("Testing Registration Status Change Notification"));
       
    61 	iPacketService.NotifyChangeOfNtwkRegStatus(stat0, regStatus);
       
    62 	User::WaitForRequest(stat0);
       
    63 	TESTL(stat0==KErrNone);
       
    64 	TESTL(regStatus==RPacketService::ENotRegisteredSearching);
       
    65 	INFO_PRINTF1(_L("NOTIFY NTWK: Registered on home network"));
       
    66 
       
    67 	// test RPacketService::NotifyChangeOfNtwkRegStatus
       
    68 	INFO_PRINTF1(_L("Testing Registration Status Change Notification"));
       
    69 	iPacketService.NotifyChangeOfNtwkRegStatus(stat0, regStatus);
       
    70 	User::WaitForRequest(stat0);
       
    71 	TESTL(stat0==KErrNone);
       
    72 	TESTL(regStatus==RPacketService::ERegisteredOnHomeNetwork);
       
    73 	INFO_PRINTF1(_L("NOTIFY NTWK: Roaming"));
       
    74 
       
    75 	// test RPacketService::GetStatus
       
    76 	RPacketService::TStatus packetStatus;
       
    77 	TRequestStatus notifyStatus;
       
    78 	TESTL(iPacketService.GetStatus(packetStatus)==KErrNone);
       
    79 	TESTL(packetStatus==RPacketService::EStatusUnattached);
       
    80 	INFO_PRINTF1(_L("GET: Packet status is EStatusUnattached"));
       
    81 
       
    82 	// test RPacketService::NotifyStatusChange
       
    83 	iPacketService.NotifyStatusChange(notifyStatus,packetStatus);
       
    84 	iPacketService.CancelAsyncRequest(EPacketNotifyStatusChange);
       
    85 	User::WaitForRequest(notifyStatus);
       
    86 	TESTL(notifyStatus.Int()==KErrCancel);
       
    87 	TESTL(packetStatus==RPacketService::EStatusUnattached);
       
    88 	INFO_PRINTF1(_L("NOTIFY CANCEL: Packet status is EStatusUnattached"));
       
    89 
       
    90     // put defaultConfigGPRS on heap to avoid chkstk problem in CCover build
       
    91 	RPacketContext::TContextConfigGPRS* defaultConfigGPRS = new(ELeave) RPacketContext::TContextConfigGPRS;
       
    92     CleanupStack::PushL(defaultConfigGPRS);
       
    93 	TPckg<RPacketContext::TContextConfigGPRS> defaultConfigPckgGPRS(*defaultConfigGPRS);
       
    94 
       
    95 	defaultConfigGPRS->iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
    96 	defaultConfigGPRS->iAnonymousAccessReqd = DPCKTTSY_ANONYMOUS_ACCESS1;
       
    97 	defaultConfigGPRS->iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
    98 	defaultConfigGPRS->iPdpCompression = DPCKTTSY_COMPRESSION1;
       
    99 	defaultConfigGPRS->iPdpType = DPCKTTSY_PDP_TYPE1;
       
   100 	defaultConfigGPRS->iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   101 	defaultConfigGPRS->iProtocolConfigOption.iAuthInfo.iProtocol = SIM_PACKET_CONTEXT_PROTOCOL1;
       
   102 	defaultConfigGPRS->iProtocolConfigOption.iAuthInfo.iUsername = SIM_PACKET_CONTEXT_USERNAME1;
       
   103 	defaultConfigGPRS->iProtocolConfigOption.iAuthInfo.iPassword = SIM_PACKET_CONTEXT_PASSWORD1;
       
   104 	defaultConfigGPRS->iProtocolConfigOption.iChallenge = SIM_PACKET_CONTEXT_CHALLENGE1;
       
   105 	defaultConfigGPRS->iProtocolConfigOption.iResponse = SIM_PACKET_CONTEXT_RESPONSE1;
       
   106 	defaultConfigGPRS->iProtocolConfigOption.iDnsAddresses.iPrimaryDns = SIM_PACKET_CONTEXT_PRIMARYSERVER1;
       
   107 	defaultConfigGPRS->iProtocolConfigOption.iDnsAddresses.iSecondaryDns = SIM_PACKET_CONTEXT_SECONDARYSERVER1;
       
   108 	defaultConfigGPRS->iProtocolConfigOption.iId = SIM_PACKET_CONTEXT_ID1;
       
   109 
       
   110 	TESTL(iPacketService.SetDefaultContextParams(defaultConfigPckgGPRS) == KErrNone);
       
   111 	INFO_PRINTF1(_L("SetDefault Params GPRS test Passed"));
       
   112 
       
   113 	// test RPacketService::GetDefaultContextParams
       
   114 	TESTL(iPacketService.GetDefaultContextParams(defaultConfigPckgGPRS) == KErrNone);
       
   115 	TESTL(defaultConfigGPRS->iAccessPointName==DPCKTTSY_ACCESS_POINT1);
       
   116 	TESTL(defaultConfigGPRS->iAnonymousAccessReqd==DPCKTTSY_ANONYMOUS_ACCESS1);
       
   117 	TESTL(defaultConfigGPRS->iPdpAddress==DPCKTTSY_PDP_ADDRESS1);
       
   118 	TESTL(defaultConfigGPRS->iPdpCompression==DPCKTTSY_COMPRESSION1);
       
   119 	TESTL(defaultConfigGPRS->iPdpType==DPCKTTSY_PDP_TYPE1);
       
   120 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iAuthInfo.iProtocol == SIM_PACKET_CONTEXT_PROTOCOL1);
       
   121 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iAuthInfo.iUsername == SIM_PACKET_CONTEXT_USERNAME1);
       
   122 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iAuthInfo.iPassword == SIM_PACKET_CONTEXT_PASSWORD1);
       
   123 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iChallenge == SIM_PACKET_CONTEXT_CHALLENGE1);
       
   124 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iResponse == SIM_PACKET_CONTEXT_RESPONSE1);
       
   125 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iDnsAddresses.iPrimaryDns == SIM_PACKET_CONTEXT_PRIMARYSERVER1);
       
   126 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iDnsAddresses.iSecondaryDns == SIM_PACKET_CONTEXT_SECONDARYSERVER1);
       
   127 	TESTL(defaultConfigGPRS->iProtocolConfigOption.iId == SIM_PACKET_CONTEXT_ID1);
       
   128 	INFO_PRINTF1(_L("GetDefault Params GPRS test Passed"));
       
   129 
       
   130 	// test config UMTS RPacketService::GetDefaultContextParams
       
   131 	RPacketContext::TContextConfigR99_R4 defaultConfigR99_R4;
       
   132 	TPckg<RPacketContext::TContextConfigR99_R4> defaultConfigPckgR99_R4(defaultConfigR99_R4);
       
   133 
       
   134 	defaultConfigR99_R4.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
       
   135 	defaultConfigR99_R4.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
       
   136 	defaultConfigR99_R4.iPdpType = DPCKTTSY_PDP_TYPE1;
       
   137 	defaultConfigR99_R4.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
       
   138 	defaultConfigR99_R4.iProtocolConfigOption.iAuthInfo.iProtocol = SIM_PACKET_CONTEXT_PROTOCOL2;
       
   139 	defaultConfigR99_R4.iProtocolConfigOption.iAuthInfo.iUsername = SIM_PACKET_CONTEXT_USERNAME2;
       
   140 	defaultConfigR99_R4.iProtocolConfigOption.iAuthInfo.iPassword = SIM_PACKET_CONTEXT_PASSWORD2;
       
   141 	defaultConfigR99_R4.iProtocolConfigOption.iChallenge = SIM_PACKET_CONTEXT_CHALLENGE2;
       
   142 	defaultConfigR99_R4.iProtocolConfigOption.iResponse = SIM_PACKET_CONTEXT_RESPONSE2;
       
   143 	defaultConfigR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns = SIM_PACKET_CONTEXT_PRIMARYSERVER2;
       
   144 	defaultConfigR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns = SIM_PACKET_CONTEXT_SECONDARYSERVER2;
       
   145 	defaultConfigR99_R4.iProtocolConfigOption.iId = SIM_PACKET_CONTEXT_ID2;
       
   146 
       
   147 	TESTL(iPacketService.SetDefaultContextParams(defaultConfigPckgR99_R4) == KErrNone);
       
   148 	INFO_PRINTF1(_L("SetDefault Params R99_R4 test Passed"));
       
   149 
       
   150 	// test RPacketService::GetDefaultContextParams
       
   151 	TESTL(iPacketService.GetDefaultContextParams(defaultConfigPckgR99_R4) == KErrNone);
       
   152 	TESTL(defaultConfigR99_R4.iAccessPointName==DPCKTTSY_ACCESS_POINT1);
       
   153 	TESTL(defaultConfigR99_R4.iPdpAddress==DPCKTTSY_PDP_ADDRESS1);
       
   154 	TESTL(defaultConfigR99_R4.iPdpType==DPCKTTSY_PDP_TYPE1);
       
   155 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iAuthInfo.iProtocol == SIM_PACKET_CONTEXT_PROTOCOL2);
       
   156 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iAuthInfo.iUsername == SIM_PACKET_CONTEXT_USERNAME2);
       
   157 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iAuthInfo.iPassword == SIM_PACKET_CONTEXT_PASSWORD2);
       
   158 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iChallenge == SIM_PACKET_CONTEXT_CHALLENGE2);
       
   159 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iResponse == SIM_PACKET_CONTEXT_RESPONSE2);
       
   160 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns == SIM_PACKET_CONTEXT_PRIMARYSERVER2);
       
   161 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns == SIM_PACKET_CONTEXT_SECONDARYSERVER2);
       
   162 	TESTL(defaultConfigR99_R4.iProtocolConfigOption.iId == SIM_PACKET_CONTEXT_ID2);
       
   163 
       
   164 	INFO_PRINTF1(_L("GetDefault Params Rel99 test Passed"));
       
   165 
       
   166 	//Test R5 RPacketService::SetDefaultContextParams
       
   167 	RPacketContext::TContextConfig_R5* defaultConfigR5 = new(ELeave) RPacketContext::TContextConfig_R5;
       
   168 	CleanupStack::PushL(defaultConfigR5);
       
   169 	TPckg<RPacketContext::TContextConfig_R5> defaultConfigPckgR5(*defaultConfigR5);
       
   170 
       
   171 	defaultConfigR5->iAccessPointName = R5_CONTEXT_GGSN;
       
   172 	defaultConfigR5->iPdpAddress = R5_CONTEXT_PDP_ADDRESS;
       
   173 	defaultConfigR5->iPdpType = R5_CONTEXT_PROTOCOL;
       
   174 	defaultConfigR5->iUseEdge = R5_CONTEXT_USE_EDGE;
       
   175 	defaultConfigR5->iProtocolConfigOption.iAuthInfo.iProtocol = R5_CONTEXT_AUTH_PROT;
       
   176 	defaultConfigR5->iProtocolConfigOption.iAuthInfo.iUsername = R5_CONTEXT_USERNAME;
       
   177 	defaultConfigR5->iProtocolConfigOption.iAuthInfo.iPassword = R5_CONTEXT_PASSWORD;
       
   178 	defaultConfigR5->iProtocolConfigOption.iChallenge = R5_CONTEXT_CHALLENGE;
       
   179 	defaultConfigR5->iProtocolConfigOption.iResponse = R5_CONTEXT_RESPONSE;
       
   180 	defaultConfigR5->iProtocolConfigOption.iDnsAddresses.iPrimaryDns = R5_CONTEXT_DNS1;
       
   181 	defaultConfigR5->iProtocolConfigOption.iDnsAddresses.iSecondaryDns = R5_CONTEXT_DNS2;
       
   182 	defaultConfigR5->iProtocolConfigOption.iId = R5_CONTEXT_ID;
       
   183 	defaultConfigR5->iPdpHeaderCompression = R5_CONTEXT_HEADER_COMPRESSION;
       
   184 	defaultConfigR5->iPdpDataCompression = R5_CONTEXT_DATA_COMPRESSION;
       
   185 
       
   186 	TBuf8<R5_CONTEXT_ADDITIONAL_PARAM_LEN> additionalParamData(R5_CONTEXT_ADDITIONAL_PARAM);	
       
   187 	additionalParamData.SetLength(R5_CONTEXT_ADDITIONAL_PARAM_LEN);
       
   188 
       
   189 	RPacketContext::TPcoId pcoId(R5_CONTEXT_PCO_ID);
       
   190 
       
   191 	RPacketContext::TMiscProtocolBuffer miscBuffer;
       
   192 	miscBuffer.Zero();
       
   193 	
       
   194 	TPtr8 pcoPtr(const_cast<TUint8*>(miscBuffer.Ptr()), 
       
   195 		RPacketContext::KMiscProtocolBufferLength);	
       
   196 
       
   197 	TPtr8 additionalParamDataPtr(const_cast<TUint8*>(additionalParamData.Ptr()),
       
   198 		additionalParamData.Length(), additionalParamData.Length());
       
   199 
       
   200 	// Attach TTlv  to the buffer
       
   201 	TTlvStruct<RPacketContext::TPcoId,RPacketContext::TPcoItemDataLength> theTLV(pcoPtr,0);	
       
   202 
       
   203 	theTLV.AppendItemL(pcoId,additionalParamDataPtr);
       
   204 
       
   205 	miscBuffer.SetLength(pcoPtr.Length());
       
   206 
       
   207 	defaultConfigR5->iProtocolConfigOption.iMiscBuffer = miscBuffer;
       
   208 	ret = iPacketService.SetDefaultContextParams(defaultConfigPckgR5);	
       
   209 
       
   210 	CHECKPOINTL(ret,KErrNone,CHP_IMS_CASE("P.1"));
       
   211 	INFO_PRINTF1(_L("SetDefault Params R5 test Passed"));
       
   212 	
       
   213 	CleanupStack::PopAndDestroy(defaultConfigR5);
       
   214 
       
   215 	//Test R5 RPacketService::GetDefaultContextParams
       
   216 	RPacketContext::TContextConfig_R5* defaultConfigR5_2 = new(ELeave) RPacketContext::TContextConfig_R5;
       
   217 	CleanupStack::PushL(defaultConfigR5_2);
       
   218 	TPckg<RPacketContext::TContextConfig_R5> defaultConfigPckgR5_2(*defaultConfigR5_2);
       
   219 
       
   220 	ret = iPacketService.GetDefaultContextParams(defaultConfigPckgR5_2);
       
   221 	CHECKPOINTL(ret,KErrNone,CHP_IMS_CASE("P.2"));
       
   222 
       
   223 	TESTL(defaultConfigR5_2->iAccessPointName == R5_CONTEXT_GGSN);
       
   224 	TESTL(defaultConfigR5_2->iPdpAddress == R5_CONTEXT_PDP_ADDRESS);
       
   225 	TESTL(defaultConfigR5_2->iPdpType == R5_CONTEXT_PROTOCOL);
       
   226 	TESTL(defaultConfigR5_2->iUseEdge == R5_CONTEXT_USE_EDGE);
       
   227 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iAuthInfo.iProtocol == R5_CONTEXT_AUTH_PROT);
       
   228 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iAuthInfo.iUsername == R5_CONTEXT_USERNAME);
       
   229 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iAuthInfo.iPassword == R5_CONTEXT_PASSWORD);
       
   230 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iChallenge == R5_CONTEXT_CHALLENGE);
       
   231 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iResponse == R5_CONTEXT_RESPONSE);
       
   232 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iDnsAddresses.iPrimaryDns == R5_CONTEXT_DNS1);
       
   233 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iDnsAddresses.iSecondaryDns == R5_CONTEXT_DNS2);
       
   234 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iId == R5_CONTEXT_ID);
       
   235 	TESTL(defaultConfigR5_2->iPdpHeaderCompression == R5_CONTEXT_HEADER_COMPRESSION);
       
   236 	TESTL(defaultConfigR5_2->iPdpDataCompression == R5_CONTEXT_DATA_COMPRESSION);
       
   237 	defaultConfigR5_2->iProtocolConfigOption.iMiscBuffer.SetLength(miscBuffer.Length());
       
   238 	TESTL(defaultConfigR5_2->iProtocolConfigOption.iMiscBuffer == miscBuffer);
       
   239 	INFO_PRINTF1(_L("GetDefault Params Rel5 test Passed"));
       
   240 
       
   241 	CleanupStack::PopAndDestroy(defaultConfigR5_2);
       
   242 
       
   243 	// test RPacketService::Attach
       
   244 	iPacketService.Attach(reqStatus);
       
   245 	iPacketService.CancelAsyncRequest(EPacketAttach);
       
   246 	User::WaitForRequest(reqStatus);
       
   247 	TESTL(reqStatus==KErrCancel);
       
   248 	INFO_PRINTF1(_L("Packet Attach Cancelled Successfully"));
       
   249 	CHECKPOINTL(ret,KErrNone,CHP_CNTXT_CASE("E.9"));
       
   250 
       
   251 	// test RPacketService::GetStatus
       
   252 	TESTL(iPacketService.GetStatus(packetStatus)==KErrNone);
       
   253 	TESTL(packetStatus==RPacketService::EStatusUnattached);
       
   254 	INFO_PRINTF1(_L("GET: Packet status is EStatusUnattached"));
       
   255 
       
   256 	// test RPacketService::NotifyStatusChange
       
   257 	iPacketService.NotifyStatusChange(notifyStatus,packetStatus);
       
   258 
       
   259 	// test RPacketService::Attach
       
   260 	iPacketService.Attach(reqStatus);
       
   261 	User::WaitForRequest(notifyStatus);
       
   262 	User::WaitForRequest(reqStatus);
       
   263 	TESTL(notifyStatus.Int()==KErrNone);
       
   264 	TESTL(reqStatus==KErrNone);
       
   265 	TESTL(packetStatus==RPacketService::EStatusAttached);
       
   266 	INFO_PRINTF1(_L("NOTIFY: Packet status is EStatusAttached"));
       
   267 	INFO_PRINTF1(_L("Packet Attached to network"));
       
   268 	CHECKPOINTL(ret,KErrNone,CHP_CNTXT_CASE("E.8"));
       
   269 
       
   270 	// test RPacketService::Detach
       
   271 	iPacketService.Detach(reqStatus);
       
   272 	iPacketService.CancelAsyncRequest(EPacketDetach);
       
   273 	User::WaitForRequest(reqStatus);
       
   274 	TESTL(reqStatus==KErrCancel);
       
   275 	CHECKPOINTL(ret,KErrNone,CHP_CNTXT_CASE("E.10"));
       
   276 	INFO_PRINTF1(_L("Packet Detach Cancelled Successfully"));
       
   277 
       
   278 	// test RPacketService::GetStatus
       
   279 	TESTL(iPacketService.GetStatus(packetStatus)==KErrNone);
       
   280 	TESTL(packetStatus==RPacketService::EStatusAttached);
       
   281 	INFO_PRINTF1(_L("GET: Packet status is EStatusAttached 2"));
       
   282 
       
   283 	// test RPacketService::NotifyStatusChange
       
   284 	iPacketService.NotifyStatusChange(notifyStatus,packetStatus);
       
   285 
       
   286 	// test RPacketService::Detach
       
   287 	iPacketService.Detach(reqStatus);
       
   288 	User::WaitForRequest(notifyStatus);
       
   289 	TESTL(notifyStatus.Int()==KErrNone);
       
   290 	TESTL(packetStatus==RPacketService::EStatusUnattached);
       
   291 	INFO_PRINTF1(_L("NOTIFY: Packet status is EStatusUnattached"));
       
   292 	User::WaitForRequest(reqStatus);
       
   293 	TESTL(reqStatus==KErrNone);
       
   294 	CHECKPOINTL(ret,KErrNone,CHP_CNTXT_CASE("E.11"));
       
   295 	INFO_PRINTF1(_L("Packet Detached from network"));
       
   296 
       
   297 	// test RPacketService::EnumerateContexts
       
   298 	TInt contextCount, maxAllowed;
       
   299 	iPacketService.EnumerateContexts(reqStatus,contextCount, maxAllowed);
       
   300 	User::WaitForRequest(reqStatus);
       
   301 	TESTL(reqStatus.Int()==KErrNone);
       
   302 	TESTL(contextCount==0);
       
   303 	TESTL(maxAllowed==11);
       
   304 	CHECKPOINTL(ret,KErrNone,CHP_CNTXT_CASE("E.4"));
       
   305 	INFO_PRINTF2(_L("Enumerate Context: %d"), contextCount);
       
   306 
       
   307 	// test RPacketService::GetContextInfo
       
   308 	TInt index = 0;
       
   309 	RPacketService::TContextInfo contextInfo;
       
   310 	iPacketService.GetContextInfo(reqStatus, index, contextInfo);
       
   311 	User::WaitForRequest(reqStatus);
       
   312 	TESTL(reqStatus.Int()==KErrArgument); // So far no context created
       
   313 	CHECKPOINTL(reqStatus.Int(),KErrArgument,CHP_CNTXT_CASE("E.5"));
       
   314 
       
   315 	// test RPacketService::GetMSClass
       
   316 	RPacketService::TMSClass msClass1, msClass2;
       
   317 	iPacketService.GetMSClass(reqStatus, msClass1,msClass2);
       
   318 	User::WaitForRequest(reqStatus);
       
   319 	TESTL(reqStatus.Int()==KErrNone);
       
   320 	TESTL(msClass1==RPacketService::EMSClassSuspensionRequired);
       
   321 	TESTL(msClass2==RPacketService::EMSClassSuspensionRequired);
       
   322 	INFO_PRINTF1(_L("GetMSClass successful"));
       
   323 
       
   324 	iPacketService.GetMSClass(reqStatus, msClass1, msClass2);
       
   325 	iPacketService.CancelAsyncRequest(EPacketGetMSClass);
       
   326 	User::WaitForRequest(reqStatus);
       
   327 	TESTL(reqStatus.Int()==KErrNone); //can't be cancelled in the simtsy so it GetMSClass should complete.
       
   328 	INFO_PRINTF1(_L("GetMSClass Cancel does not cancel"));
       
   329 
       
   330 	// test RPacketService::SetMSClass
       
   331 	msClass1 = RPacketService::EMSClassSuspensionRequired;
       
   332 
       
   333 	iPacketService.SetMSClass(reqStatus, RPacketService::EMSClassSuspensionRequired);
       
   334 	iPacketService.CancelAsyncRequest(EPacketSetMSClass);//no implementation-does nothing
       
   335 	User::WaitForRequest(reqStatus);
       
   336 	TESTL(reqStatus.Int()==KErrNone);
       
   337 	iPacketService.SetMSClass(reqStatus, RPacketService::EMSClassDualMode);
       
   338 	User::WaitForRequest(reqStatus);
       
   339 	TESTL(reqStatus.Int()==KErrNotSupported);
       
   340 	INFO_PRINTF1(_L("SetMSClass successful"));
       
   341 
       
   342 	iPacketService.SetMSClass(reqStatus, msClass1);
       
   343 	iPacketService.CancelAsyncRequest(EPacketSetMSClass);
       
   344 	User::WaitForRequest(reqStatus);
       
   345 	TESTL(reqStatus.Int()==KErrNone);
       
   346 	INFO_PRINTF1(_L("SetMSClass Cancel does not cancel"));
       
   347 
       
   348 	// test RPacketService::NotifyMSClassChange
       
   349 	iPacketService.NotifyMSClassChange(reqStatus, msClass1);
       
   350 	User::WaitForRequest(reqStatus);
       
   351 	TESTL(reqStatus.Int()==KErrNotSupported);
       
   352 	INFO_PRINTF1(_L("NotifyMSClass not supported successful"));
       
   353 
       
   354 	iPacketService.NotifyMSClassChange(reqStatus, msClass1);
       
   355 	iPacketService.CancelAsyncRequest(EPacketNotifyMSClassChange);
       
   356 	User::WaitForRequest(reqStatus);
       
   357 	TESTL(reqStatus.Int()==KErrNotSupported);
       
   358 	INFO_PRINTF1(_L("NotifyMSClass cancel not supported successful"));
       
   359 
       
   360 	// test RPacketService::GetStaticCaps
       
   361 	TUint caps;
       
   362 	TESTL(iPacketService.GetStaticCaps(caps, DPCKTTSY_PDP_TYPE1)==KErrNone);
       
   363 	TESTL(caps==SIM_PACKET_SERVICE_CAPS);
       
   364 	INFO_PRINTF1(_L("Get Static Caps test passed"));
       
   365 
       
   366 	// RPacketService::GetDynamicCaps is tested by te_simpacket
       
   367 
       
   368 	// test RPacketService::SetAttachMode
       
   369 	RPacketService::TAttachMode attachMode=RPacketService::EAttachWhenNeeded;
       
   370 	TESTL(iPacketService.SetAttachMode(attachMode)==KErrNone);
       
   371 
       
   372 	// test RPacketService::GetAttachMode
       
   373 	TESTL(iPacketService.GetAttachMode(attachMode)==KErrNone);
       
   374 	TESTL(attachMode==RPacketService::EAttachWhenNeeded);
       
   375 	
       
   376 	// test RPacketService::NotifyAttachModeChange
       
   377 	RPacketService::TAttachMode notifyAttachMode;
       
   378 	iPacketService.NotifyAttachModeChange(reqStatus, notifyAttachMode);
       
   379 	TESTL(iPacketService.SetAttachMode(attachMode)==KErrNone);
       
   380 	User::WaitForRequest(reqStatus);	
       
   381 	TESTL(reqStatus==KErrNone);
       
   382 	TESTL(notifyAttachMode==RPacketService::EAttachWhenNeeded);	
       
   383 	
       
   384 	// test RPacketService::NotifyAttachModeChange & Cancel
       
   385 	iPacketService.NotifyAttachModeChange(reqStatus, notifyAttachMode);
       
   386 	iPacketService.CancelAsyncRequest(EPacketNotifyAttachModeChange);
       
   387 	User::WaitForRequest(reqStatus);	
       
   388 	TESTL(reqStatus==KErrCancel);
       
   389 
       
   390     CleanupStack::PopAndDestroy(1);
       
   391 
       
   392 	iPacketService.Close();
       
   393 	iPhone.Close();
       
   394 	ASSERT(RThread().RequestCount()==0);
       
   395 
       
   396 	return TestStepResult();
       
   397 	}
       
   398