telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestpacketservice.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Test step definitions for the PacketService functional unit.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalTechnology
       
    20 */
       
    21 
       
    22 #include <etelpckt.h>
       
    23 #include <pcktcs.h>
       
    24 
       
    25 #include "cctsyintegrationtestpacketservice.h"
       
    26 
       
    27 #include "cetelsessionmgr.h"
       
    28 #include "tetelrequeststatus.h"
       
    29 #include "tsmsstoretsytesthelper.h"
       
    30 
       
    31 _LIT(KPrompt, "This test requires network simulation,Press a key if simualted network is ready");
       
    32 CCTSYIntegrationTestPacketServiceBase::CCTSYIntegrationTestPacketServiceBase(CEtelSessionMgr& aEtelSessionMgr)
       
    33 	: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iPacketServiceTestHelper(*this), iNetworkTestHelper(*this)
       
    34 /**
       
    35  * Constructor
       
    36  */
       
    37 	{
       
    38 	}
       
    39 
       
    40 CCTSYIntegrationTestPacketServiceBase::~CCTSYIntegrationTestPacketServiceBase()
       
    41 /*
       
    42  * Destructor
       
    43  */
       
    44 	{
       
    45 	}
       
    46 	
       
    47 /**
       
    48  * Ensures that the correct attach mode is set and leaves if not
       
    49  @param aPacketService RPacketService service
       
    50  @param aModeAttach give information about the desired mode. The function leaves if the required mode is not there.
       
    51  */
       
    52  void CCTSYIntegrationTestPacketServiceBase::EnsureAttachModeL( RPacketService &aPacketService, RPacketService::TAttachMode &aModeAttach)
       
    53  	{
       
    54 
       
    55  	// Get attach mode to check whether it is already RPacketService::EAttachWhenNeeded		
       
    56 	TExtEtelRequestStatus getAttachModeStatus (aPacketService,EPacketGetAttachMode);
       
    57 	CleanupStack::PushL(getAttachModeStatus);	
       
    58 	RPacketService::TAttachMode attachMode;
       
    59 	aPacketService.GetAttachMode(getAttachModeStatus, attachMode);
       
    60 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone, 
       
    61 					_L("PacketService::GetAttachMode timed out"));
       
    62 	CHECK_EQUALS_L(getAttachModeStatus.Int(), KErrNone, 
       
    63 					_L("PacketService::GetAttachMode returned an error"));
       
    64 
       
    65 	// If the attach mode is not RPacketService::EAttachWhenNeeded, then set it
       
    66 	TExtEtelRequestStatus setAttachModeStatus(aPacketService, EPacketSetAttachMode);
       
    67 	CleanupStack::PushL(setAttachModeStatus);	
       
    68 	if (attachMode != aModeAttach)	
       
    69 		{
       
    70 		// Set attach mode to RPacketService::EAttachWhenNeeded with RPacketService::SetAttachMode
       
    71 		aPacketService.SetAttachMode(setAttachModeStatus, aModeAttach);
       
    72 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,	
       
    73 						_L("PacketService::SetAttachMode timed out."));								
       
    74 		CHECK_EQUALS_L(setAttachModeStatus.Int(), KErrNone, 
       
    75 						_L("PacketService::SetAttachMode returned an error"));		
       
    76 		
       
    77 		// Check that it was set
       
    78 		aPacketService.GetAttachMode(getAttachModeStatus,attachMode);
       
    79 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
    80 						_L("PacketService::GetAttachMode timed out"));
       
    81 		CHECK_EQUALS_L(getAttachModeStatus.Int(), KErrNone, 
       
    82 						_L("PacketService::GetAttachMode returned an error"));			
       
    83 		}		
       
    84 	
       
    85 	CHECK_EQUALS_L(attachMode, aModeAttach, _L("PacketService::GetAttachMode did not return the desired attach mode"));
       
    86 	
       
    87 	// getAttachModeStatus
       
    88 	// setAttachModeStatus
       
    89 	CleanupStack::PopAndDestroy(2, &getAttachModeStatus);
       
    90  	}
       
    91  //*************************************************************************	
       
    92 
       
    93 
       
    94 
       
    95 CCTSYIntegrationTestPacketService0001::CCTSYIntegrationTestPacketService0001(CEtelSessionMgr& aEtelSessionMgr)
       
    96 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
    97 /**
       
    98  * Constructor.
       
    99  */
       
   100 	{
       
   101 	SetTestStepName(CCTSYIntegrationTestPacketService0001::GetTestStepName());
       
   102 	}
       
   103 
       
   104 CCTSYIntegrationTestPacketService0001::~CCTSYIntegrationTestPacketService0001()
       
   105 /**
       
   106  * Destructor.
       
   107  */
       
   108 	{
       
   109 	}
       
   110 
       
   111 TVerdict CCTSYIntegrationTestPacketService0001::doTestStepL()
       
   112 /**
       
   113  * @SYMTestCaseID BA-CTSY-INT-PKTS-0001
       
   114  * @SYMFssID BA/CTSY/PKTS-0001
       
   115  * @SYMTestCaseDesc Get static caps.
       
   116  * @SYMTestPriority High
       
   117  * @SYMTestActions 
       
   118  * @SYMTestExpectedResults Pass - Static caps returned.
       
   119  * @SYMTestType CIT
       
   120  * @SYMTestCaseDependencies live/automatic
       
   121  *
       
   122  * Reason for test: Get static caps for each protocol type.
       
   123  *
       
   124  * @return - TVerdict code
       
   125  */
       
   126 	{
       
   127 
       
   128 	//
       
   129 	// SET UP
       
   130 	//
       
   131 
       
   132 	
       
   133 
       
   134 	//
       
   135 	// SET UP END
       
   136 	//
       
   137 	
       
   138 	StartTest();
       
   139 	
       
   140 	//
       
   141 	// TEST START
       
   142 	//
       
   143 	
       
   144 	
       
   145 	// Get packet service 
       
   146 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, 
       
   147 																	  KMainPhone,
       
   148 																	  KMainPacketService);
       
   149 	
       
   150 	// Check static caps are 
       
   151 	// RPacketService::KCapsSuspendSupported |
       
   152 	// RPacketService::KCapsNetworkAvailabilitySupported | 
       
   153 	// RPacketService::KCapsSetDefaultContextSupported | RPacketService::KCapsChangeAttachModeSupported | 
       
   154 	// RPacketService::KCapsGetDataTransferredSupported | RPacketService::KCapsPreferredBearerSupported | 
       
   155 	// RPacketService::KCapsPdpDataCompSupported | RPacketService::KCapsPdpHeaderCompSupported | 
       
   156 	// RPacketService::KCapsNotifyMSClassSupported
       
   157 	TUint staticCaps = 0;
       
   158 	TUint expectedCaps = 	RPacketService::KCapsSuspendSupported |
       
   159 							RPacketService::KCapsNetworkAvailabilitySupported | 
       
   160 							RPacketService::KCapsSetDefaultContextSupported | 
       
   161 							RPacketService::KCapsChangeAttachModeSupported | 
       
   162 							RPacketService::KCapsGetDataTransferredSupported | 
       
   163 							RPacketService::KCapsPreferredBearerSupported | 
       
   164 							RPacketService::KCapsPdpDataCompSupported | 
       
   165 							RPacketService::KCapsPdpHeaderCompSupported | 
       
   166 							RPacketService::KCapsNotifyMSClassSupported;
       
   167 	ASSERT_EQUALS(packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4), KErrNone, _L("RPacketService::GetStaticCaps returned an error"));
       
   168 	ASSERT_BITS_SET(staticCaps, expectedCaps, KNoUnwantedBits,
       
   169 			_L("RPacketService::GetStaticCaps did not return correct static caps"));
       
   170 	
       
   171 	//
       
   172 	// TEST END
       
   173 	//
       
   174 
       
   175     StartCleanup();
       
   176 	
       
   177 	return TestStepResult();
       
   178 	}
       
   179 
       
   180 TPtrC CCTSYIntegrationTestPacketService0001::GetTestStepName()
       
   181 /**
       
   182  * @return The test step name.
       
   183  */
       
   184 	{
       
   185 	return _L("CCTSYIntegrationTestPacketService0001");
       
   186 	}
       
   187 
       
   188 
       
   189 
       
   190 CCTSYIntegrationTestPacketService0002::CCTSYIntegrationTestPacketService0002(CEtelSessionMgr& aEtelSessionMgr)
       
   191 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
   192 /**
       
   193  * Constructor.
       
   194  */
       
   195 	{
       
   196 	SetTestStepName(CCTSYIntegrationTestPacketService0002::GetTestStepName());
       
   197 	}
       
   198 
       
   199 CCTSYIntegrationTestPacketService0002::~CCTSYIntegrationTestPacketService0002()
       
   200 /**
       
   201  * Destructor.
       
   202  */
       
   203 	{
       
   204 	}
       
   205 
       
   206 TVerdict CCTSYIntegrationTestPacketService0002::doTestStepL()
       
   207 /**
       
   208  * @SYMTestCaseID BA-CTSY-INT-PKTS-0002
       
   209  * @SYMFssID BA/CTSY/PKTS-0002
       
   210  * @SYMTestCaseDesc Automatic attach to the packet service when attach mode changed to EAttachWhenPossible.
       
   211  * @SYMTestPriority High
       
   212  * @SYMTestActions RPacketService::NotifyAttachModeChange, RPacketService::GetNtwkRegStatus, RPacketService::GetStatus, RPacketService::GetAttachMode, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyStatusChange, RPacketService::GetStaticCaps
       
   213  * @SYMTestExpectedResults Pass - Phone automatically attached to packet service.
       
   214  * @SYMTestType CIT
       
   215  * @SYMTestCaseDependencies live/automatic
       
   216  *
       
   217  * Reason for test: Verify that packet service attaches automatically when attach mode is changed to EAttachWhenPossible.
       
   218  * Verify static caps, packet network registration status,  dynamic caps are correct. 
       
   219  *
       
   220  * @return - TVerdict code
       
   221  */
       
   222 	{
       
   223 
       
   224 	//
       
   225 	// SET UP
       
   226 	//
       
   227 
       
   228 	// Get packet service
       
   229 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
   230 																	  KMainPhone,
       
   231 																	  KMainPacketService);
       
   232 	// Get mobile phone
       
   233 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   234 	
       
   235 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
   236 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone,
       
   237 					_L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
   238 		
       
   239 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
   240 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
   241 	EnsureAttachModeL(packetService,attachMode);
       
   242 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
   243 	
       
   244 	// Ensure packet service status is EStatusUnattached
       
   245 	RPacketService::TStatus setUpStatus;
       
   246 	CHECK_EQUALS_L(packetService.GetStatus(setUpStatus), KErrNone, 
       
   247 					_L("PacketService::GetStatus returned an error"));
       
   248 	TExtEtelRequestStatus detachStatus(packetService, EPacketDetach);
       
   249 	CleanupStack::PushL(detachStatus);
       
   250 	if (setUpStatus != RPacketService::EStatusUnattached)
       
   251 		{
       
   252 		packetService.Detach(detachStatus);
       
   253 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone, 	
       
   254 						_L("PacketService::Detach timed out"));
       
   255 		CHECK_TRUE_L(detachStatus.Int()== KErrNone|| detachStatus.Int()== KErrAlreadyExists, 
       
   256 						_L("PacketService::Detach returned an error"));										
       
   257 		}
       
   258 	User::After(5*KOneSecond); // Time delay is needed to detach properly
       
   259 	//
       
   260 	// SET UP END
       
   261 	//
       
   262 	
       
   263 	StartTest();
       
   264 	
       
   265 	//
       
   266 	// TEST START
       
   267 	//
       
   268 	
       
   269 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached
       
   270 	RPacketService::TStatus serviceStatus; 
       
   271 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,
       
   272 					_L("PacketService::GetStatus returned with an error."));
       
   273 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
   274 					_L("RPacketService::GetStatus did not return RPacketService::EStatusUnattached."));
       
   275 		
       
   276 	// Check RPacketService::GetDynamicCaps returns caps in set of 
       
   277 	// RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
   278 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of 
       
   279 	// RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | 
       
   280 	// RPacketService::KCapsRxContextActivationReq
       
   281 	RPacketService::TDynamicCapsFlags dynCaps;
       
   282 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
   283 					_L("RPacketService::GetDynamicCaps returned with an error"));
       
   284 	RPacketService::TDynamicCapsFlags expectedCaps = 
       
   285 					RPacketService::KCapsManualAttach | 
       
   286 					RPacketService::KCapsRxCSCall;
       
   287 	RPacketService::TDynamicCapsFlags unwantedCaps = 
       
   288 					RPacketService::KCapsSMSTransfer | 
       
   289 					RPacketService::KCapsManualDetach | 
       
   290 					RPacketService::KCapsRxContextActivationReq;
       
   291 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,
       
   292 		_L("RPacketService::GetDynamicCaps did not return correct dynamic caps")); // NOTE: Use ASSERT_BITS_SET for wanted and unwanted bits, name the variables expectedCaps and unwantedCaps or similar
       
   293 
       
   294 	// Post notification for RPacketService::NotifyAttachModeChange   
       
   295 	TExtEtelRequestStatus notifyAttachModeChangeStatus(packetService, EPacketNotifyAttachModeChange); // NOTE: Name the request status object so that it is possible to identify which API it is for since they cannot be used for a different API
       
   296 	CleanupStack::PushL(notifyAttachModeChangeStatus); // NOTE: Always push EVERY TExtEtelRequestStatus and TCoreEtelRequestStatus onto the CleanupStack
       
   297 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
   298 	
       
   299 	// Post notification for RPacketService::NotifyStatusChange
       
   300 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
   301 	CleanupStack::PushL(notifyStatusStatus); 
       
   302 	RPacketService::TStatus packetServiceStatus;
       
   303 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
   304 	
       
   305 	// Post notification for RPacketService::NotifyDynamicCapsChange
       
   306 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
   307 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
   308 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
   309 		
       
   310 	// Set attach mode to RPacketService::EAttachWhenPossible with RPacketService::SetAttachMode
       
   311 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
   312 	CleanupStack::PushL(setAttachModeStatus); 
       
   313 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
   314 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone, 
       
   315 					_L("RPacketService::SetAttachMode timed-out")); 
       
   316 	ASSERT_EQUALS(setAttachModeStatus.Int(), KErrNone, 
       
   317 					_L("RPacketService::SetAttachMode returned with an error"));
       
   318 	User::After(10*KOneSecond); // This time delay is required to complete the implicit attach operation caused by EAttachWhenPossible attach mode
       
   319 	
       
   320 	// Check RPacketService::NotifyAttachModeChange completes with RPacketService::EAttachWhenPossible  
       
   321 	RPacketService::TAttachMode expectedAttachMode = RPacketService::EAttachWhenPossible;
       
   322 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService, 
       
   323 																		notifyAttachModeChangeStatus, 
       
   324 																		attachMode, 
       
   325 																		expectedAttachMode, 
       
   326 																		KErrNone);
       
   327 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
   328 	
       
   329 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenPossible
       
   330 	TExtEtelRequestStatus getAttachModeStatus(packetService, EPacketGetAttachMode);
       
   331 	CleanupStack::PushL(getAttachModeStatus);
       
   332 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
   333 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeShort), KErrNone,
       
   334 					_L("RPacketService::GetAttachMode timed-out"));
       
   335 	ASSERT_EQUALS(getAttachModeStatus.Int(), KErrNone, 
       
   336 					_L("RPacketService::GetAttachMode returned with an error"));
       
   337 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenPossible, 
       
   338 					_L("RPacketService::GetAttachMode did not return RPacketService::EAttachWhenPossible"));
       
   339 	
       
   340 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusAttached
       
   341 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
   342 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
   343 																	notifyStatusStatus,
       
   344 																	packetServiceStatus,
       
   345 																	expectedPacketServiceStatus,
       
   346 																	KErrNone);
       
   347 
       
   348 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer
       
   349 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
   350 	expectedCaps = 	RPacketService::KCapsRxCSCall | 
       
   351 					RPacketService::KCapsRxContextActivationReq | 
       
   352 					RPacketService::KCapsManualDetach | 
       
   353 					RPacketService::KCapsSMSTransfer;
       
   354 	unwantedCaps =  RPacketService::KCapsManualAttach;
       
   355 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
   356 																		 notifyDynamicCapsChangeStatus,
       
   357 																		 dynCaps, 
       
   358 																		 expectedCaps,
       
   359 																		 unwantedCaps,
       
   360 																		 KErrNone);
       
   361 
       
   362 	// Check RPacketService::GetStatus returns RPacketService::EStatusAttached
       
   363 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
   364 					_L("RPacketService::GetStatus returned with an error"));
       
   365 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
   366 					_L("RPacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
   367 
       
   368 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer.
       
   369 	// Check RPacketService::GetDynamicCaps completes with caps NOT in set of RPacketService::KCapsManualAttach
       
   370     ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone,
       
   371     				_L("RPacketService::GetDynamicCaps returned with an error"));
       
   372     expectedCaps = 	RPacketService::KCapsRxCSCall | 
       
   373     				RPacketService::KCapsRxContextActivationReq | 
       
   374     				RPacketService::KCapsManualDetach | 
       
   375     				RPacketService::KCapsSMSTransfer;
       
   376     unwantedCaps = 	RPacketService::KCapsManualAttach;
       
   377     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
   378     		_L("RPacketService::GetDynamicCaps did not return correct dynamic caps"));
       
   379 
       
   380 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork
       
   381     TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
   382     CleanupStack::PushL(regStatus);
       
   383     RPacketService::TRegistrationStatus registrationStatus;
       
   384     packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
   385 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium), KErrNone,
       
   386 					_L("RPacketService::GetNtwkRegStatus timed-out."));
       
   387 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
   388 					_L("RPacketService::GetNtwkRegStatus returned with an error"));
       
   389     ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
   390     				_L("RPacketService::GetNtwkRegStatus did not return RPacketService::ERegisteredOnHomeNetwork"));
       
   391 
       
   392     //
       
   393     // Test end
       
   394     //
       
   395     		
       
   396     StartCleanup();
       
   397 	
       
   398     // Pop:
       
   399 	// detachStatus
       
   400 	// notifyAttachModeChangeStatus
       
   401     // notifyStatusStatus
       
   402 	// notifyDynamicCapsChangeStatus
       
   403 	// setAttachModeStatus
       
   404 	// getAttachModeStatus
       
   405 	// regStatus
       
   406 	CleanupStack::PopAndDestroy(7, &detachStatus); 
       
   407 	
       
   408 	return TestStepResult();
       
   409 	}
       
   410 
       
   411 TPtrC CCTSYIntegrationTestPacketService0002::GetTestStepName()
       
   412 /**
       
   413  * @return The test step name.
       
   414  */
       
   415 	{
       
   416 	return _L("CCTSYIntegrationTestPacketService0002");
       
   417 	}
       
   418 
       
   419 
       
   420 
       
   421 CCTSYIntegrationTestPacketService0003::CCTSYIntegrationTestPacketService0003(CEtelSessionMgr& aEtelSessionMgr)
       
   422 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
   423 /**
       
   424  * Constructor.
       
   425  */
       
   426 	{
       
   427 	SetTestStepName(CCTSYIntegrationTestPacketService0003::GetTestStepName());
       
   428 	}
       
   429 
       
   430 CCTSYIntegrationTestPacketService0003::~CCTSYIntegrationTestPacketService0003()
       
   431 /**
       
   432  * Destructor.
       
   433  */
       
   434 	{
       
   435 	}
       
   436 
       
   437 TVerdict CCTSYIntegrationTestPacketService0003::doTestStepL()
       
   438 /**
       
   439  * @SYMTestCaseID BA-CTSY-INT-PKTS-0003
       
   440  * @SYMFssID BA/CTSY/PKTS-0003
       
   441  * @SYMTestCaseDesc Automatic attach to the packet service, when Context Activated and attach mode is EAttachWhenNeeded.
       
   442  * @SYMTestPriority High
       
   443  * @SYMTestActions RPacketService::GetNtwkRegStatus, RPacketService::GetStatus, RPacketService::GetAttachMode, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyStatusChange, RPacketService::NotifyContextAdded, RPacketService::EnumerateContexts, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus
       
   444  * @SYMTestExpectedResults Pass - Packet service is active.
       
   445  * @SYMTestType CIT
       
   446  * @SYMTestCaseDependencies live/automatic
       
   447  *
       
   448  * Reason for test: Verify that automatic attach occurs when a packet context is activated.
       
   449 
       
   450 Verify packet network registration status,  dynamic caps, number of active contexts, context status are correct.
       
   451  *
       
   452  * @return - TVerdict code
       
   453  */
       
   454 	{
       
   455 	
       
   456 	
       
   457 	// Attach to the packet service with attach mode set to EAttachWhenNeeded by Activating a context
       
   458 	//
       
   459 	// SET UP
       
   460 	//
       
   461 	
       
   462 	// Start with attach mode in RPacketService::EAttachWhenNeeded.
       
   463 	// Get packet service
       
   464 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
   465 																	  KMainPhone,
       
   466 																	  KMainPacketService);
       
   467 	
       
   468 	// Get mobile phone
       
   469 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   470 	
       
   471 	// Get packet context
       
   472 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
   473 																			 KMainPhone,
       
   474 																			 KMainPacketService,
       
   475 																			 KPrimaryPacketContext1); 
       
   476 	
       
   477 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL		
       
   478 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone,
       
   479 					_L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
   480 	
       
   481 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
   482 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
   483 	EnsureAttachModeL(packetService,attachMode);
       
   484 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
   485 	
       
   486 	// Ensure packet service status is EStatusUnattached
       
   487 	RPacketService::TStatus setUpStatus;
       
   488 	CHECK_EQUALS_L(packetService.GetStatus(setUpStatus), KErrNone, 
       
   489 					_L("PacketService::GetStatus returned an error"));
       
   490 	TExtEtelRequestStatus detachStatus(packetService, EPacketDetach);
       
   491 	CleanupStack::PushL(detachStatus);
       
   492 	if (setUpStatus != RPacketService::EStatusUnattached)
       
   493 		{
       
   494 		packetService.Detach(detachStatus);
       
   495 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone, 	
       
   496 						_L("PacketService::Detach timed out"));
       
   497 		CHECK_TRUE_L(detachStatus.Int()== KErrNone|| detachStatus.Int()== KErrAlreadyExists, 
       
   498 						_L("PacketService::Detach returned an error"));										
       
   499 		}
       
   500 	
       
   501 	//
       
   502 	// SET UP END
       
   503 	//
       
   504 	
       
   505 	StartTest();
       
   506 	
       
   507 	//
       
   508 	// TEST START
       
   509 	//
       
   510 
       
   511 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached
       
   512 	RPacketService::TStatus serviceStatus;
       
   513 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
   514 					_L("PacketService::GetStatus returned with an error."));
       
   515 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
   516 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached."));
       
   517 				
       
   518 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
   519 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
   520     RPacketService::TDynamicCapsFlags dynCaps = 0;		
       
   521 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
   522 					_L("PacketService::GetDynamicCaps returned an error"));
       
   523 	//$CTSYProblem - Caps returned is KCapsActive, caps not in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall 
       
   524 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsActivate;
       
   525 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsSMSTransfer | 
       
   526 													 RPacketService::KCapsManualDetach | 
       
   527 													 RPacketService::KCapsRxContextActivationReq;
       
   528 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,          
       
   529 					_L("PacketService::GetDynamicCaps Wrong dynamic caps"));
       
   530 
       
   531 	// Post notification for packet service status change
       
   532 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
   533 	CleanupStack::PushL(notifyStatusStatus); 
       
   534 	RPacketService::TStatus packetServiceStatus;
       
   535 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
   536 	
       
   537 	// Post notification for dynamic caps change
       
   538 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
   539 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
   540 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
   541 		
       
   542 	// Activate a new context
       
   543 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
   544 		
       
   545 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached->EStausActive
       
   546 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
   547 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
   548 																	notifyStatusStatus, 
       
   549 																	packetServiceStatus,
       
   550 																	expectedPacketServiceStatus,
       
   551 																	KErrNone);
       
   552 	// Post notification for packet service status change
       
   553 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
   554 	
       
   555 	// Check RPacketService::NotifyStatusChange completes with EStausActive
       
   556 	expectedPacketServiceStatus = RPacketService::EStatusActive;
       
   557 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
   558 																	notifyStatusStatus, 
       
   559 																	packetServiceStatus,
       
   560 																	expectedPacketServiceStatus,
       
   561 																	KErrNone);
       
   562 
       
   563 	//  Check RPacketService::NotifyDynamicCapsChange completes with caps in set of  KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer
       
   564 	//	Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
   565 	expectedCaps = RPacketService::KCapsRxCSCall | 
       
   566 				   RPacketService::KCapsRxContextActivationReq | 
       
   567 				   RPacketService::KCapsManualDetach | 
       
   568 				   RPacketService::KCapsSMSTransfer;
       
   569 	unwantedCaps = RPacketService::KCapsManualAttach;
       
   570 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
   571 																		 notifyDynamicCapsChangeStatus,
       
   572 																		 dynCaps,
       
   573 																		 expectedCaps,
       
   574 																		 unwantedCaps,
       
   575 																		 KErrNone);
       
   576 
       
   577 	// Check RPacketService::GetStatus returns RPacketService::EStatusActive
       
   578 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
   579 					_L("PacketService::GetStatus returned with an error."));
       
   580 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusActive, 
       
   581 					_L("PacketService::GetStatus did not return RPacketService::EStatusActive."));	
       
   582 	
       
   583 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork
       
   584 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
   585 	CleanupStack::PushL(regStatus);
       
   586 	RPacketService::TRegistrationStatus registrationStatus;
       
   587 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
   588 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
   589 					_L("PacketService::GetNtwkRegStatus timed out"));
       
   590 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
   591 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
   592 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
   593 	    			_L("PacketService::GetNtwkRegStatus Wrong registration status"));
       
   594 
       
   595 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer
       
   596 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
   597     ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
   598 					_L("PacketService::GetDynamicCaps returned an error"));
       
   599     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
   600 					_L("PacketService::GetDynamicCaps Wrong dynamic caps"));
       
   601     
       
   602 	// Check RPacketService::EnumerateContexts returns aCount, 1 and aMaxAllowed, 11 (KMmMaxNumberOfContexts in CTSY)	
       
   603 	TInt count = 0;
       
   604     TInt maxAllowed = 0;
       
   605 	TExtEtelRequestStatus enumContextStatus(packetService, EPacketEnumerateContexts);
       
   606     CleanupStack::PushL(enumContextStatus);
       
   607 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
   608 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
   609 					_L("PacketService::EnumerateContexts timed out"));
       
   610 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
   611 					_L("PacketService::EnumerateContexts returned an error"));
       
   612 	ASSERT_EQUALS(count, COUNT_ONE, 
       
   613 					_L("PacketService::EnumerateContexts, wrong count returned"));
       
   614 	ASSERT_EQUALS(maxAllowed, MAX_CONTEXTS, 
       
   615 				_L("PacketService::EnumerateContexts, wrong max count returned"));
       
   616 
       
   617 	// deactivate the context and detach from packet service
       
   618 	TExtEtelRequestStatus deactivateStatus(packetService, EPacketContextDeactivate);
       
   619 	CleanupStack::PushL(deactivateStatus);
       
   620 	packetContext.Deactivate(deactivateStatus);			
       
   621 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateStatus, ETimeMedium),KErrNone, 
       
   622 					_L("PacketContext::Deactivate timed out"));	
       
   623 	ASSERT_EQUALS(deactivateStatus.Int(), KErrNone, 
       
   624 					_L("PacketContext::Deactivate returned an error"));		
       
   625 	
       
   626 	//
       
   627     // Test end
       
   628     //
       
   629     		
       
   630     StartCleanup();
       
   631 		
       
   632     // Pop:
       
   633    	// detachStatus
       
   634 	// notifyStausStaus
       
   635 	// notifyDynamicCapsChangeStatus
       
   636 	// regStatus
       
   637 	// enumContextStatus
       
   638 	// deactivateStatus
       
   639 	CleanupStack::PopAndDestroy(6, &detachStatus); 
       
   640 	return TestStepResult();
       
   641 	}
       
   642 	
       
   643 TPtrC CCTSYIntegrationTestPacketService0003::GetTestStepName()
       
   644 /**
       
   645  * @return The test step name.
       
   646  */
       
   647 	{
       
   648 	return _L("CCTSYIntegrationTestPacketService0003");
       
   649 	}
       
   650 
       
   651 
       
   652 
       
   653 CCTSYIntegrationTestPacketService0004::CCTSYIntegrationTestPacketService0004(CEtelSessionMgr& aEtelSessionMgr)
       
   654 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
   655 /**
       
   656  * Constructor.
       
   657  */
       
   658 	{
       
   659 	SetTestStepName(CCTSYIntegrationTestPacketService0004::GetTestStepName());
       
   660 	}
       
   661 
       
   662 CCTSYIntegrationTestPacketService0004::~CCTSYIntegrationTestPacketService0004()
       
   663 /**
       
   664  * Destructor.
       
   665  */
       
   666 	{
       
   667 	}
       
   668 
       
   669 TVerdict CCTSYIntegrationTestPacketService0004::doTestStepL()
       
   670 /**
       
   671  * @SYMTestCaseID BA-CTSY-INT-PKTS-0004
       
   672  * @SYMFssID BA/CTSY/PKTS-0004
       
   673  * @SYMTestCaseDesc Automatic attach and detach to the packet service.
       
   674  * @SYMTestPriority High
       
   675  * @SYMTestActions RPacketService::NotifyAttachModeChange, RPacketService::GetNtwkRegStatus, RPacketService::GetStatus, RPacketService::GetAttachMode, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyStatusChange
       
   676  * @SYMTestExpectedResults Pass - Phone automatically attaches to then detaches from packet service.
       
   677  * @SYMTestType CIT
       
   678  * @SYMTestCaseDependencies live/automatic
       
   679  *
       
   680  * Reason for test: Verify that automatic attach occurs when attach mode is changed to RPacketService::EAttachWhenPossible and automatic detach occurs when attach mode is change to RPacketService::EAttachWhenNeeded. 
       
   681 
       
   682 Verify packet network registration status and dynamic caps are correct.
       
   683  *
       
   684  * @return - TVerdict code
       
   685  */
       
   686 	{
       
   687 
       
   688 	//
       
   689 	// SET UP
       
   690 	//
       
   691 
       
   692 	// Get packet service
       
   693 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
   694 																	  KMainPhone,
       
   695 																	  KMainPacketService);
       
   696 	
       
   697 	// Get mobile phone
       
   698 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   699 	
       
   700 	// Registered with the network
       
   701 	TInt ret = iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
   702 	CHECK_EQUALS_L(ret, KErrNone, 
       
   703 					_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
   704 	
       
   705 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
   706 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
   707 	EnsureAttachModeL(packetService,attachMode);
       
   708 	
       
   709 	//
       
   710 	// SET UP END
       
   711 	//
       
   712 
       
   713 	StartTest();
       
   714 
       
   715 	//
       
   716 	// TEST START
       
   717 	//
       
   718 
       
   719 	
       
   720 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached
       
   721 	RPacketService::TStatus serviceStatus;
       
   722 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,	
       
   723 					_L("PacketService::GetStatus returned with an error."));
       
   724 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
   725 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached."));
       
   726 				
       
   727 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
   728 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
   729 	RPacketService::TDynamicCapsFlags dynCaps;
       
   730 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
   731 					_L("PacketService::GetDynamicCaps returned an error"));
       
   732 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsManualAttach | 
       
   733 													 RPacketService::KCapsRxCSCall;
       
   734 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsSMSTransfer | 
       
   735 													 RPacketService::KCapsManualDetach | 
       
   736 													 RPacketService::KCapsRxContextActivationReq;
       
   737 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
   738 					_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
   739 	
       
   740 	// Post notification for attach mode change
       
   741 	TExtEtelRequestStatus notifyAttachModeChangeStatus(packetService, EPacketNotifyAttachModeChange);
       
   742 	CleanupStack::PushL(notifyAttachModeChangeStatus);
       
   743 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
   744 
       
   745 	// Post notification for packet service status change
       
   746 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
   747 	CleanupStack::PushL(notifyStatusStatus); 
       
   748 	RPacketService::TStatus packetServiceStatus;
       
   749 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
   750 	
       
   751 	// Post notification for dynamic caps change
       
   752 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
   753 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
   754 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
   755 		
       
   756 	// Set attach mode to RPacketService::EAttachWhenPossible with RPacketService::SetAttachMode
       
   757 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
   758 	CleanupStack::PushL(setAttachModeStatus);	
       
   759 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
   760 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone, 
       
   761 					_L("PacketService::SetAttachMode timed out"));
       
   762 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
   763 					_L("PacketService::SetAttachMode returned an error."));
       
   764 		
       
   765 	// Check RPacketService::NotifyAttachModeChange completes with RPacketService::EAttachWhenPossible
       
   766 	RPacketService::TAttachMode expectedAttachMode = RPacketService::EAttachWhenPossible;
       
   767 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
   768 																		notifyAttachModeChangeStatus,
       
   769 																		attachMode,
       
   770 																		expectedAttachMode,
       
   771 																		KErrNone);
       
   772 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
   773 	
       
   774 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenPossible
       
   775 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);
       
   776 	CleanupStack::PushL(getAttachModeStatus);	
       
   777 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
   778 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
   779 					_L("PacketService::GetAttachMode timed out"));
       
   780 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
   781 					_L("PacketService::GetAttachMode returned an error"));
       
   782 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenPossible, 
       
   783 					_L("PacketService::GetAttachMode Wrong attach mode"));
       
   784 
       
   785 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusAttached
       
   786 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
   787 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
   788 																	notifyStatusStatus,
       
   789 																	packetServiceStatus,
       
   790 																	expectedPacketServiceStatus,
       
   791 																	KErrNone);
       
   792 			
       
   793 	// Check RPacketService::NotifyDynamicCapsChange completes with KCapsActivate | KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer
       
   794 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
   795 	expectedCaps = 	RPacketService::KCapsRxCSCall | 
       
   796 					RPacketService::KCapsRxContextActivationReq | 
       
   797 					RPacketService::KCapsManualDetach | 
       
   798 					RPacketService::KCapsSMSTransfer;
       
   799 	unwantedCaps =  RPacketService::KCapsManualAttach;
       
   800 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
   801 																		 notifyDynamicCapsChangeStatus,
       
   802 																		 dynCaps,
       
   803 																		 expectedCaps,
       
   804 																		 unwantedCaps,
       
   805 																		 KErrNone);
       
   806 
       
   807 	// Check RPacketService::GetStatus returns RPacketService::EStatusAttached
       
   808 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,	
       
   809 					_L("PacketService::GetStatus returned an error"));
       
   810 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
   811 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
   812 	
       
   813 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsActivate | KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer.
       
   814 	// Check RPacketService::GetDynamicCaps completes with caps NOT in set of RPacketService::KCapsManualAttach
       
   815     ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
   816 					_L("PacketService::GetDynamicCaps returned an error"));
       
   817     expectedCaps = 	RPacketService::KCapsRxCSCall | 
       
   818     				RPacketService::KCapsRxContextActivationReq | 
       
   819     				RPacketService::KCapsManualDetach | 
       
   820     				RPacketService::KCapsSMSTransfer;
       
   821     unwantedCaps = 	RPacketService::KCapsManualAttach;
       
   822     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
   823 					_L("PacketService::GetDynamicCaps Wrong dynamic caps"));
       
   824     
       
   825 	// Check RPacketService::GetNtwkRegStatus returns ENotRegisteredOnHomeNetwork
       
   826 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
   827 	CleanupStack::PushL(regStatus);
       
   828 	RPacketService::TRegistrationStatus registrationStatus;
       
   829 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
   830 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
   831 					_L("PacketService::GetNtwkRegStatus timed out"));
       
   832 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
   833 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
   834 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork,
       
   835 					_L("PacketService::GetNtwkRegStatus did not return RPacketService::ERegisteredOnHomeNetwork registration status"));
       
   836 	// $CTSYProblem: After EStatusUnattached staus, ENotRegisteredButAvailable registration status of network was not achieved as expected.
       
   837 	// This problem occurs when once you register with the network then it remains registered even when we expect not registered.
       
   838 	
       
   839 	// Post notification for RPacketService::NotifyAttachModeChange 
       
   840 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
   841 
       
   842 	// Post notification for packet service status change
       
   843 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
   844 
       
   845 	// Post notification for dynamic caps change
       
   846 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
   847 	    		
       
   848 	// Set attach mode to RPacketService::EAttachWhenNeeded with RPacketService::SetAttachMode
       
   849 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
   850 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone,
       
   851 					_L("PacketService::SetAttachMode timed out."));
       
   852 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
   853 					_L("PacketService::SetAttachMode returned an error"));
       
   854 		
       
   855 	// Check RPacketService::NotifyAttachModeChange completes with RPacketService::EAttachWhenNeeded
       
   856 	expectedAttachMode = RPacketService::EAttachWhenNeeded;
       
   857 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
   858 																		notifyAttachModeChangeStatus,
       
   859 																		attachMode,
       
   860 																		expectedAttachMode,
       
   861 																		KErrNone);
       
   862 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
   863 	
       
   864 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded
       
   865 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
   866 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
   867 					_L("PacketService::GetAttachMode timed out"));
       
   868 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
   869 					_L("PacketService::GetAttachMode returned an error."));
       
   870 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
   871 					_L("PacketService::GetAttachMode did not return RPacketService::EAttachWhenNeeded"));
       
   872 	
       
   873 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusUnattached
       
   874 	expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
   875 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
   876 																	notifyStatusStatus,
       
   877 																	packetServiceStatus,
       
   878 																	expectedPacketServiceStatus,
       
   879 																	KErrNone);	
       
   880 			
       
   881 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
   882 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
   883 	expectedCaps = 	RPacketService::KCapsManualAttach | 
       
   884 					RPacketService::KCapsRxCSCall;
       
   885 	unwantedCaps =  RPacketService::KCapsSMSTransfer | 
       
   886 				    RPacketService::KCapsManualDetach | 
       
   887 				    RPacketService::KCapsRxContextActivationReq;
       
   888    	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
   889 																		 notifyDynamicCapsChangeStatus,
       
   890 																		 dynCaps,
       
   891 																		 expectedCaps,
       
   892 																		 unwantedCaps,
       
   893 																		 KErrNone);
       
   894 
       
   895 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached
       
   896 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,	
       
   897 					_L("PacketService::GetStatus returned an error"));
       
   898 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
   899 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));
       
   900 	
       
   901 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
   902 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
   903     ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
   904 					_L("PacketService::GetDynamicCaps returned an error"));	
       
   905     expectedCaps = 	RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall;
       
   906     unwantedCaps = 	RPacketService::KCapsSMSTransfer | 
       
   907     			    RPacketService::KCapsManualDetach | 
       
   908     			    RPacketService::KCapsRxContextActivationReq;
       
   909     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, _L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
   910     
       
   911     DEBUG_PRINTF1(_L("<font color=Orange>$CTSYProblem: After EStatusUnattached staus, ENotRegisteredButAvailable registration status of network was not achieved\n as expected. This problem occurs when once you register with the network then it remains registered even when we expect not registered.</font> "));
       
   912 	// Check RPacketService::GetNtwkRegStatus returns ENotRegisteredOnHomeNetwork
       
   913 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
   914 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeLong),KErrNone, 
       
   915 					_L("PacketService::GetNtwkRegStatus timed out"));
       
   916 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
   917 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
   918 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
   919 	    			_L("PacketService::GetNtwkRegStatus did not return RPacketService::ERegisteredOnHomeNetwork registration status"));
       
   920 	
       
   921 	//
       
   922 	// TEST END
       
   923 	//
       
   924 
       
   925 	StartCleanup();
       
   926 	
       
   927 	// Pop:
       
   928 	// notifyAttachModeChangeStatus
       
   929     // notifyStatusStatus, 
       
   930     // notifyDynamicCapsChangeStatus
       
   931 	// setAttachModeStatus
       
   932 	// getAttachModeStatus
       
   933 	// regStatus
       
   934 	CleanupStack::PopAndDestroy(6,&notifyAttachModeChangeStatus);
       
   935 	
       
   936 	return TestStepResult();
       
   937 	}
       
   938 
       
   939 TPtrC CCTSYIntegrationTestPacketService0004::GetTestStepName()
       
   940 /**
       
   941  * @return The test step name.
       
   942  */
       
   943 	{
       
   944 	return _L("CCTSYIntegrationTestPacketService0004");
       
   945 	}
       
   946 
       
   947 
       
   948 
       
   949 CCTSYIntegrationTestPacketService0005::CCTSYIntegrationTestPacketService0005(CEtelSessionMgr& aEtelSessionMgr)
       
   950 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
   951 /**
       
   952  * Constructor.
       
   953  */
       
   954 	{
       
   955 	SetTestStepName(CCTSYIntegrationTestPacketService0005::GetTestStepName());
       
   956 	}
       
   957 
       
   958 CCTSYIntegrationTestPacketService0005::~CCTSYIntegrationTestPacketService0005()
       
   959 /**
       
   960  * Destructor.
       
   961  */
       
   962 	{
       
   963 	}
       
   964 
       
   965 TVerdict CCTSYIntegrationTestPacketService0005::doTestStepL()
       
   966 /**
       
   967  * @SYMTestCaseID BA-CTSY-INT-PKTS-0005
       
   968  * @SYMFssID BA/CTSY/PKTS-0005
       
   969  * @SYMTestCaseDesc Attach to the packet service manually.
       
   970  * @SYMTestPriority High
       
   971  * @SYMTestActions RPacketService::GetNtwkRegStatus, RPacketService::GetStatus, RPacketService::GetAttachMode, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyStatusChange
       
   972  * @SYMTestExpectedResults Pass - Phone attached to packet service.
       
   973  * @SYMTestType CIT
       
   974  * @SYMTestCaseDependencies live/automatic
       
   975  *
       
   976  * Reason for test: Verify packet service can be manually attached and phone is registered on packet network when attach mode is EAttachWhenNeeded.
       
   977 
       
   978 Verify packet network registration status, attach mode, dynamic caps are correct.
       
   979  *
       
   980  * @return - TVerdict code
       
   981  */
       
   982 	{
       
   983 	
       
   984 	//
       
   985 	// SET UP
       
   986 	//
       
   987 
       
   988 	
       
   989 	// Get packet service
       
   990 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
   991 																	  KMainPhone,
       
   992 																	  KMainPacketService);
       
   993 	
       
   994 	// Get mobile phone
       
   995 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
   996 	
       
   997 	// Ensure attach mode is RPacketService::EAttachWhenNeeded	
       
   998 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
   999 	EnsureAttachModeL(packetService,attachMode);
       
  1000 	//
       
  1001 	// SET UP END
       
  1002 	//
       
  1003 	
       
  1004 	StartTest();
       
  1005 	
       
  1006 	//
       
  1007 	// TEST START
       
  1008 	//
       
  1009 
       
  1010 	// Post notification for packet service status change
       
  1011 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  1012 	CleanupStack::PushL(notifyStatusStatus); 
       
  1013 	RPacketService::TStatus packetServiceStatus;
       
  1014 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  1015 	
       
  1016 	// Post notification for dynamic caps change
       
  1017 	RPacketService::TDynamicCapsFlags dynCaps;
       
  1018 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  1019 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
  1020 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
  1021 
       
  1022 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1023 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);	
       
  1024 	CleanupStack::PushL(getAttachModeStatus);
       
  1025 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  1026 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone, 
       
  1027 					_L("PacketService::GetAttachMode timed out."));
       
  1028 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  1029 					_L("PacketService::GetAttachMode returned an error"));
       
  1030 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  1031 					_L("PacketService::GetAttachMode did not return RPacketService::EAttachWhenNeeded"));
       
  1032 	
       
  1033 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1034 	RPacketService::TStatus serviceStatus;
       
  1035 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,
       
  1036 					_L("PacketService::GetStatus returned with an error."));
       
  1037 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
  1038 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached."));
       
  1039 				
       
  1040 	// Check RPacketService::GetNtwkRegStatus returns RPacketService::ENotRegisteredButAvailable
       
  1041     TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  1042 	CleanupStack::PushL(regStatus);
       
  1043     RPacketService::TRegistrationStatus registrationStatus;
       
  1044     packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  1045 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeLong), KErrNone, 
       
  1046 					_L("PacketService::GetNtwkRegStatus timed out."));
       
  1047     ASSERT_EQUALS(regStatus.Int(),KErrNone, 
       
  1048 					_L("PacketService::GetNtwkRegStatus returned an error"));
       
  1049     ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
  1050     				_L("PacketService::GetNtwkRegStatus did not return RPacketService::ENotRegisteredButAvailable"));
       
  1051     DEBUG_PRINTF1(_L("<font color=Orange>$CTSYProblem: After EStatusUnattached staus, ENotRegisteredButAvailable registration status of network was not achieved\n as expected. This problem occurs when once you register with the network then it remains registered even when we expect not registered.</font> "));	
       
  1052     
       
  1053 	// Registered with the network
       
  1054 	TInt ret = iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone);
       
  1055 	ASSERT_EQUALS(ret, KErrNone, 
       
  1056 					_L("RMobilePhone::NotifyNetworkRegistrationStatusChange network registration failed"));
       
  1057 			
       
  1058 	// Check RPacketService::GetDynamicCaps returns caps RPacketService::KCapsManualAttach | KCapsRxCSCall.
       
  1059 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq;
       
  1060 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  1061 					_L("PacketService::GetDynamicCaps returned an error"));
       
  1062 	RPacketService::TDynamicCapsFlags expectedCaps = 
       
  1063 					RPacketService::KCapsManualAttach | 
       
  1064 					RPacketService::KCapsRxCSCall;
       
  1065 	RPacketService::TDynamicCapsFlags unwantedCaps = 
       
  1066 					RPacketService::KCapsSMSTransfer | 
       
  1067 					RPacketService::KCapsManualDetach | 
       
  1068 					RPacketService::KCapsRxContextActivationReq;
       
  1069 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  1070 				_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  1071 
       
  1072 	// Attach to packet network
       
  1073 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  1074 	CleanupStack::PushL(attachStatus);
       
  1075 	packetService.Attach(attachStatus);
       
  1076 	ASSERT_EQUALS(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone,
       
  1077 					_L("PacketService::Attach timed out."));
       
  1078 	ASSERT_EQUALS(attachStatus.Int(), KErrNone, 
       
  1079 					_L("PacketService::Attach returned an error"));
       
  1080  
       
  1081 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached.
       
  1082 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  1083 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  1084 																	notifyStatusStatus,
       
  1085 																	packetServiceStatus,
       
  1086 																	expectedPacketServiceStatus,
       
  1087 																	KErrNone);	
       
  1088 	
       
  1089 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsActivate | KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer.
       
  1090 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  1091 	expectedCaps = 	RPacketService::KCapsRxCSCall |
       
  1092 	 				RPacketService::KCapsRxContextActivationReq |
       
  1093 	 				RPacketService::KCapsManualDetach |
       
  1094 	 				RPacketService::KCapsSMSTransfer;
       
  1095 	unwantedCaps = RPacketService::KCapsManualAttach;
       
  1096    	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
  1097    																		 notifyDynamicCapsChangeStatus,
       
  1098    																		 dynCaps,
       
  1099    																		 expectedCaps,
       
  1100    																		 unwantedCaps,
       
  1101    																		 KErrNone);
       
  1102 					
       
  1103 	// Check RPacketService::GetStatus returns EStatusAttached.
       
  1104 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  1105 					_L("PacketService::GetStatus returned with an error."));
       
  1106 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  1107 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached."));
       
  1108 				
       
  1109 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork.
       
  1110     packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  1111 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium), KErrNone,
       
  1112 					_L("PacketService::GetNtwkRegStatus timed out."));
       
  1113     ASSERT_EQUALS(regStatus.Int(),KErrNone, 
       
  1114 					_L("PacketService::GetNtwkRegStatus returned an error"));
       
  1115     ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork,	
       
  1116 					_L("PacketService::GetNtwkRegStatus returned wrong registration status"));
       
  1117     			
       
  1118 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer.
       
  1119 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  1120     ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  1121 					_L("PacketService::GetDynamicCaps returned an error"));
       
  1122     expectedCaps = 	RPacketService::KCapsRxCSCall | 
       
  1123     				RPacketService::KCapsRxContextActivationReq | 
       
  1124     				RPacketService::KCapsManualDetach | 
       
  1125     				RPacketService::KCapsSMSTransfer;
       
  1126     unwantedCaps = 	RPacketService::KCapsManualAttach;
       
  1127     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  1128 				_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  1129  
       
  1130     //
       
  1131     // Test end
       
  1132     //
       
  1133     		
       
  1134     StartCleanup();
       
  1135 
       
  1136     // Pop:
       
  1137     // notifyStatusStatus
       
  1138     // notifyDynamicCapsChangeStatus
       
  1139     // getAttachModeStatus
       
  1140     // regStatus
       
  1141     // attachStatus
       
  1142     CleanupStack::PopAndDestroy(5, &notifyStatusStatus); 
       
  1143 	
       
  1144     return TestStepResult();
       
  1145 	}
       
  1146 
       
  1147 TPtrC CCTSYIntegrationTestPacketService0005::GetTestStepName()
       
  1148 /**
       
  1149  * @return The test step name.
       
  1150  */
       
  1151 	{
       
  1152 	return _L("CCTSYIntegrationTestPacketService0005");
       
  1153 	}
       
  1154 
       
  1155 
       
  1156 
       
  1157 CCTSYIntegrationTestPacketService0006::CCTSYIntegrationTestPacketService0006(CEtelSessionMgr& aEtelSessionMgr)
       
  1158 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1159 /**
       
  1160  * Constructor.
       
  1161  */
       
  1162 	{
       
  1163 	SetTestStepName(CCTSYIntegrationTestPacketService0006::GetTestStepName());
       
  1164 	}
       
  1165 
       
  1166 CCTSYIntegrationTestPacketService0006::~CCTSYIntegrationTestPacketService0006()
       
  1167 /**
       
  1168  * Destructor.
       
  1169  */
       
  1170 	{
       
  1171 	}
       
  1172 
       
  1173 TVerdict CCTSYIntegrationTestPacketService0006::doTestStepL()
       
  1174 /**
       
  1175  * @SYMTestCaseID BA-CTSY-INT-PKTS-0006
       
  1176  * @SYMFssID BA/CTSY/PKTS-0006
       
  1177  * @SYMTestCaseDesc Attach to and detach from the packet service manually (roaming).
       
  1178  * @SYMTestPriority High
       
  1179  * @SYMTestActions RPacketService::GetNtwkRegStatus, RPacketService::GetStatus, RPacketService::GetAttachMode, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyStatusChange, RPacketService::Detach
       
  1180  * @SYMTestExpectedResults Pass - Phone attached to packet service.
       
  1181  * @SYMTestType CIT
       
  1182  * @SYMTestCaseDependencies live/manual
       
  1183  *
       
  1184  * Reason for test: Verify packet service is attached to and detached from and phone is registered on packet network.
       
  1185 
       
  1186 Verify packet network registration status, attach mode, dynamic caps are correct.
       
  1187  *
       
  1188  * @return - TVerdict code
       
  1189  */
       
  1190 	{
       
  1191 
       
  1192 	//
       
  1193 	// SET UP
       
  1194 	//
       
  1195 
       
  1196 	
       
  1197 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  1198 
       
  1199 
       
  1200 	//
       
  1201 	// SET UP END
       
  1202 	//
       
  1203 	
       
  1204 	StartTest();
       
  1205 	
       
  1206 	//
       
  1207 	// TEST START
       
  1208 	//
       
  1209 	
       
  1210 	
       
  1211 	// Get packet service. 
       
  1212 
       
  1213 	// Check RPacketService::GetAttachMode returns PacketService::EAttachWhenNeeded.
       
  1214 
       
  1215 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1216 
       
  1217 	// Check RPacketService::GetNtwkRegStatus returns RPacketService::ERegisteredRoaming.
       
  1218 
       
  1219 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1220 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1221 
       
  1222 	// Attach to packet network 
       
  1223 
       
  1224 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusAttached.
       
  1225 
       
  1226 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsActivate | KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer.
       
  1227 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  1228 
       
  1229 	// Check RPacketService::GetStatus returns RPacketService::EStatusAttached.
       
  1230 
       
  1231 	// Check RPacketService::GetNtwkRegStatus returns RPacketService::ERegisteredRoaming.
       
  1232 
       
  1233 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsActivate | KCapsRxCSCall | KCapsRxContextActivationReq | KCapsManualDetach | KCapsSMSTransfer.
       
  1234 	// Check RPacketService::GetDynamicCaps completes with caps NOT in set of RPacketService::KCapsManualAttach
       
  1235 
       
  1236 	// Detach from packet network. 
       
  1237 
       
  1238 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusUnattached.
       
  1239 
       
  1240 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  1241 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1242 
       
  1243 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1244 
       
  1245 	// Check RPacketService::GetStatus returns EStatusUnattached.
       
  1246 
       
  1247 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredRoaming.
       
  1248 
       
  1249 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  1250 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1251 
       
  1252 	
       
  1253 	//
       
  1254 	// TEST END
       
  1255 	//
       
  1256 
       
  1257     StartCleanup();
       
  1258 	
       
  1259 	// Put any required test clean up here, then remove this comment
       
  1260 	
       
  1261 	return TestStepResult();
       
  1262 	}
       
  1263 
       
  1264 TPtrC CCTSYIntegrationTestPacketService0006::GetTestStepName()
       
  1265 /**
       
  1266  * @return The test step name.
       
  1267  */
       
  1268 	{
       
  1269 	return _L("CCTSYIntegrationTestPacketService0006");
       
  1270 	}
       
  1271 
       
  1272 
       
  1273 
       
  1274 CCTSYIntegrationTestPacketService0007::CCTSYIntegrationTestPacketService0007(CEtelSessionMgr& aEtelSessionMgr)
       
  1275 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1276 /**
       
  1277  * Constructor.
       
  1278  */
       
  1279 	{
       
  1280 	SetTestStepName(CCTSYIntegrationTestPacketService0007::GetTestStepName());
       
  1281 	}
       
  1282 
       
  1283 CCTSYIntegrationTestPacketService0007::~CCTSYIntegrationTestPacketService0007()
       
  1284 /**
       
  1285  * Destructor.
       
  1286  */
       
  1287 	{
       
  1288 	}
       
  1289 
       
  1290 TVerdict CCTSYIntegrationTestPacketService0007::doTestStepL()
       
  1291 /**
       
  1292  * @SYMTestCaseID BA-CTSY-INT-PKTS-0007
       
  1293  * @SYMFssID BA/CTSY/PKTS-0007
       
  1294  * @SYMTestCaseDesc Attach to packet service failure.
       
  1295  * @SYMTestPriority High
       
  1296  * @SYMTestActions RPacketService::GetStatus, RPacketService::GetDynamicCaps, RPacketService::SetAttachMode, RPacketService::GetAttachMode, RPacketService::GetNtwkRegStatus
       
  1297  * @SYMTestExpectedResults Pass - Attach fails with KErrPacketNetworkFailure
       
  1298  * @SYMTestType CIT
       
  1299  * @SYMTestCaseDependencies simulated/manual
       
  1300  *
       
  1301  * Reason for test: Verify attach attempt fails when attach rejected by network with unknown IMSI.
       
  1302 Verify packet network registration status, attach mode, dynamic caps are correctly showing detached state.
       
  1303  *
       
  1304  * @return - TVerdict code
       
  1305  */
       
  1306 	{
       
  1307 
       
  1308 	//
       
  1309 	// SET UP
       
  1310 	//
       
  1311 	
       
  1312 	ERR_PRINTF2(_L("<font color=Orange>$CTSYProblem: defect id = %d</font>"), 10087);
       
  1313 	User::Leave(KErrNone);	
       
  1314 
       
  1315 	// Ensure attach mode is RPacketService::EAttachWhenNeeded	
       
  1316 	// Get packet service
       
  1317 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
  1318 																	  KMainPhone,
       
  1319 																	  KMainPacketService);
       
  1320 		
       
  1321 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  1322 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  1323 	EnsureAttachModeL(packetService,attachMode);
       
  1324 	User::After(5*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  1325 
       
  1326 	//
       
  1327 	// SET UP END
       
  1328 	//
       
  1329 	
       
  1330 	StartTest();
       
  1331 	
       
  1332 	//
       
  1333 	// TEST START
       
  1334 	//
       
  1335 	
       
  1336 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1337 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);	
       
  1338 	CleanupStack::PushL(getAttachModeStatus);
       
  1339 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  1340 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeShort), KErrNone,
       
  1341 					_L("RPacketService::GetAttachMode timed-out"));
       
  1342 	ASSERT_EQUALS(getAttachModeStatus.Int(), KErrNone, 
       
  1343 					_L("RPacketService::GetAttachMode returned with an error"));
       
  1344 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  1345 					_L("RPacketService::GetAttachMode did not return RPacketService::EAttachWhenNeeded"));
       
  1346 	
       
  1347 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1348 	RPacketService::TStatus serviceStatus;
       
  1349 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  1350 					_L("PacketService::GetStatus returned with an error."));
       
  1351 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
  1352 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached."));
       
  1353 	
       
  1354 	// Check RPacketService::GetNtwkRegStatus returns one of ENotRegisteredButAvailable | ENotRegisteredNotSearching | ENotRegisteredSearching | ERegistrationDenied
       
  1355 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  1356 	CleanupStack::PushL(regStatus);
       
  1357 	RPacketService::TRegistrationStatus registrationStatus;
       
  1358 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  1359 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
  1360 					_L("PacketService::GetNtwkRegStatus timed out"));
       
  1361 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  1362 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
  1363 	ASSERT_TRUE((registrationStatus== RPacketService::ENotRegisteredButAvailable)|| (registrationStatus== RPacketService::ENotRegisteredNotSearching)
       
  1364 				|| (registrationStatus== RPacketService::ENotRegisteredSearching)|| (registrationStatus== RPacketService::ERegistrationDenied),
       
  1365 					_L("PacketService::GetNtwkRegStatus did not return ENotRegisteredButAvailable registration status"));
       
  1366 
       
  1367 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1368 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1369 	RPacketService::TDynamicCapsFlags dynCaps = 0;	
       
  1370 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  1371 					_L("PacketService::GetDynamicCaps returned an error"));
       
  1372 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsManualAttach | 
       
  1373 			    									 RPacketService::KCapsRxCSCall;
       
  1374 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsSMSTransfer |
       
  1375 													 RPacketService::KCapsManualDetach |
       
  1376 													 RPacketService::KCapsRxContextActivationReq;
       
  1377 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  1378 			_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  1379 
       
  1380 	// Check RPacketService::Attach returns KErrPacketNetworkFailure 
       
  1381 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  1382 	CleanupStack::PushL(attachStatus);
       
  1383 	packetService.Attach(attachStatus);
       
  1384 	ASSERT_EQUALS(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone,
       
  1385 					_L("PacketService::Attach timed out."));
       
  1386 //	ASSERT_EQUALS(attachStatus.Int(), RPacketService::KErrPacketNetworkFailure,
       
  1387 //					_L("PacketService::Attach did not return  KErrPacketNetworkFailure"));
       
  1388 
       
  1389 
       
  1390 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1391 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  1392 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeShort), KErrNone,
       
  1393 					_L("RPacketService::GetAttachMode timed-out"));
       
  1394 	ASSERT_EQUALS(getAttachModeStatus.Int(), KErrNone, 
       
  1395 					_L("RPacketService::GetAttachMode returned with an error"));
       
  1396 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  1397 					_L("RPacketService::GetAttachMode did not return RPacketService::EAttachWhenNeeded"));
       
  1398 	
       
  1399 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1400 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  1401 					_L("PacketService::GetStatus returned with an error."));
       
  1402 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
  1403 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached."));
       
  1404 
       
  1405 	// Check RPacketService::GetNtwkRegStatus returns one of ENotRegisteredButAvailable | ENotRegisteredNotSearching | ENotRegisteredSearching | ERegistrationDenied.
       
  1406 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  1407 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
  1408 					_L("PacketService::GetNtwkRegStatus timed out"));
       
  1409 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  1410 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
  1411 	ASSERT_TRUE((registrationStatus== RPacketService::ENotRegisteredButAvailable)|| (registrationStatus== RPacketService::ENotRegisteredNotSearching)
       
  1412 				|| (registrationStatus== RPacketService::ENotRegisteredSearching)|| (registrationStatus== RPacketService::ERegistrationDenied),
       
  1413 					_L("PacketService::GetNtwkRegStatus did not return ENotRegisteredButAvailable registration status"));
       
  1414 
       
  1415 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1416 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1417 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  1418 					_L("PacketService::GetDynamicCaps returned an error"));
       
  1419 	expectedCaps = RPacketService::KCapsManualAttach | 
       
  1420 				   RPacketService::KCapsRxCSCall;
       
  1421 	unwantedCaps = RPacketService::KCapsSMSTransfer |
       
  1422 	               RPacketService::KCapsManualDetach |
       
  1423 				   RPacketService::KCapsRxContextActivationReq;
       
  1424 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  1425 					_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  1426 
       
  1427 	//
       
  1428 	// TEST END
       
  1429 	//
       
  1430 
       
  1431     StartCleanup();
       
  1432 	
       
  1433 	// Pop:
       
  1434 	// getAttachModeStatus
       
  1435 	// regStatus
       
  1436 	// attachStatus
       
  1437 	CleanupStack::PopAndDestroy(3, &getAttachModeStatus);
       
  1438 		
       
  1439 	return TestStepResult();
       
  1440 	}
       
  1441 
       
  1442 TPtrC CCTSYIntegrationTestPacketService0007::GetTestStepName()
       
  1443 /**
       
  1444  * @return The test step name.
       
  1445  */
       
  1446 	{
       
  1447 	return _L("CCTSYIntegrationTestPacketService0007");
       
  1448 	}
       
  1449 
       
  1450 
       
  1451 
       
  1452 CCTSYIntegrationTestPacketService0008::CCTSYIntegrationTestPacketService0008(CEtelSessionMgr& aEtelSessionMgr)
       
  1453 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1454 /**
       
  1455  * Constructor.
       
  1456  */
       
  1457 	{
       
  1458 	SetTestStepName(CCTSYIntegrationTestPacketService0008::GetTestStepName());
       
  1459 	}
       
  1460 
       
  1461 CCTSYIntegrationTestPacketService0008::~CCTSYIntegrationTestPacketService0008()
       
  1462 /**
       
  1463  * Destructor.
       
  1464  */
       
  1465 	{
       
  1466 	}
       
  1467 
       
  1468 TVerdict CCTSYIntegrationTestPacketService0008::doTestStepL()
       
  1469 /**
       
  1470  * @SYMTestCaseID BA-CTSY-INT-PKTS-0008
       
  1471  * @SYMFssID BA/CTSY/PKTS-0008
       
  1472  * @SYMTestCaseDesc Attach to packet service failure.
       
  1473  * @SYMTestPriority High
       
  1474  * @SYMTestActions RPacketService::GetStatus, RPacketService::GetDynamicCaps, RPacketService::SetAttachMode, RPacketService::GetAttachMode, RPacketService::GetNtwkRegStatus
       
  1475  * @SYMTestExpectedResults Pass - Attach fails with KErrPacketNetworkFailure
       
  1476  * @SYMTestType CIT
       
  1477  * @SYMTestCaseDependencies simulated/manual
       
  1478  *
       
  1479  * Reason for test: Verify attach attempt fails and packet service is detached when packet network roaming not available in cell.
       
  1480  *
       
  1481  * @return - TVerdict code
       
  1482  */
       
  1483 	{
       
  1484 
       
  1485 	//
       
  1486 	// SET UP
       
  1487 	//
       
  1488 
       
  1489 	
       
  1490 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  1491 
       
  1492 
       
  1493 	//
       
  1494 	// SET UP END
       
  1495 	//
       
  1496 	
       
  1497 	StartTest();
       
  1498 	
       
  1499 	//
       
  1500 	// TEST START
       
  1501 	//
       
  1502 	
       
  1503 	
       
  1504 	// Get packet service. 
       
  1505 
       
  1506 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1507 
       
  1508 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1509 
       
  1510 	// Check RPacketService::GetNtwkRegStatus returns RPacketService::ENotRegisteredButAvailable.
       
  1511 
       
  1512 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1513 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1514 
       
  1515 	// Check RPacketService::Attach returns KErrPacketNetworkFailure 
       
  1516 
       
  1517 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1518 
       
  1519 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1520 
       
  1521 	// Check RPacketService::GetNtwkRegStatus returns RPacketService::ENotRegisteredButAvailable.
       
  1522 
       
  1523 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1524 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1525 
       
  1526 	
       
  1527 	//
       
  1528 	// TEST END
       
  1529 	//
       
  1530 
       
  1531     StartCleanup();
       
  1532 	
       
  1533 	// Put any required test clean up here, then remove this comment
       
  1534 	
       
  1535 	return TestStepResult();
       
  1536 	}
       
  1537 
       
  1538 TPtrC CCTSYIntegrationTestPacketService0008::GetTestStepName()
       
  1539 /**
       
  1540  * @return The test step name.
       
  1541  */
       
  1542 	{
       
  1543 	return _L("CCTSYIntegrationTestPacketService0008");
       
  1544 	}
       
  1545 
       
  1546 
       
  1547 
       
  1548 CCTSYIntegrationTestPacketService0009::CCTSYIntegrationTestPacketService0009(CEtelSessionMgr& aEtelSessionMgr)
       
  1549 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1550 /**
       
  1551  * Constructor.
       
  1552  */
       
  1553 	{
       
  1554 	SetTestStepName(CCTSYIntegrationTestPacketService0009::GetTestStepName());
       
  1555 	}
       
  1556 
       
  1557 CCTSYIntegrationTestPacketService0009::~CCTSYIntegrationTestPacketService0009()
       
  1558 /**
       
  1559  * Destructor.
       
  1560  */
       
  1561 	{
       
  1562 	}
       
  1563 
       
  1564 TVerdict CCTSYIntegrationTestPacketService0009::doTestStepL()
       
  1565 /**
       
  1566  * @SYMTestCaseID BA-CTSY-INT-PKTS-0009
       
  1567  * @SYMFssID BA/CTSY/PKTS-0009
       
  1568  * @SYMTestCaseDesc Attach to packet service failure.
       
  1569  * @SYMTestPriority High
       
  1570  * @SYMTestActions RPacketService::GetStatus, RPacketService::GetDynamicCaps, RPacketService::SetAttachMode, RPacketService::GetAttachMode, RPacketService::GetNtwkRegStatus
       
  1571  * @SYMTestExpectedResults Pass - Attach fails with KErrPacketNetworkFailure
       
  1572  * @SYMTestType CIT
       
  1573  * @SYMTestCaseDependencies simulated/manual
       
  1574  *
       
  1575  * Reason for test: Verify attach attempt fails and packet service is detached when attach rejected by network because packet services not allowed error returned.
       
  1576  *
       
  1577  * @return - TVerdict code
       
  1578  */
       
  1579 	{
       
  1580 
       
  1581 	//
       
  1582 	// SET UP
       
  1583 	//
       
  1584 
       
  1585 	
       
  1586 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  1587 
       
  1588 
       
  1589 	//
       
  1590 	// SET UP END
       
  1591 	//
       
  1592 	
       
  1593 	StartTest();
       
  1594 	
       
  1595 	//
       
  1596 	// TEST START
       
  1597 	//
       
  1598 	
       
  1599 	
       
  1600 	// Get packet service. 
       
  1601 
       
  1602 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1603 
       
  1604 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1605 
       
  1606 	// Check RPacketService::GetNtwkRegStatus returns one of RPacketService::ENotRegisteredButAvailable | RPacketService::ERegistrationDenied.
       
  1607 
       
  1608 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1609 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1610 
       
  1611 	// Check RPacketService::Attach returns KErrPacketNetworkFailure 
       
  1612 
       
  1613 	// Check RPacketService::GetAttachMode returns RPacketService::EAttachWhenNeeded.
       
  1614 
       
  1615 	// Check RPacketService::GetStatus returns RPacketService::EStatusUnattached.
       
  1616 
       
  1617 	// Check RPacketService::GetNtwkRegStatus returns RPacketService::ENotRegisteredButAvailable | RPacketService::ERegistrationDenied.
       
  1618 
       
  1619 	// Check RPacketService::GetDynamicCaps returns caps KCapsManualAttach | KCapsRxCSCall.
       
  1620 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  1621 
       
  1622 	
       
  1623 	//
       
  1624 	// TEST END
       
  1625 	//
       
  1626 
       
  1627     StartCleanup();
       
  1628 	
       
  1629 	// Put any required test clean up here, then remove this comment
       
  1630 	
       
  1631 	return TestStepResult();
       
  1632 	}
       
  1633 
       
  1634 TPtrC CCTSYIntegrationTestPacketService0009::GetTestStepName()
       
  1635 /**
       
  1636  * @return The test step name.
       
  1637  */
       
  1638 	{
       
  1639 	return _L("CCTSYIntegrationTestPacketService0009");
       
  1640 	}
       
  1641 
       
  1642 
       
  1643 
       
  1644 CCTSYIntegrationTestPacketService0010::CCTSYIntegrationTestPacketService0010(CEtelSessionMgr& aEtelSessionMgr)
       
  1645 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1646 /**
       
  1647  * Constructor.
       
  1648  */
       
  1649 	{
       
  1650 	SetTestStepName(CCTSYIntegrationTestPacketService0010::GetTestStepName());
       
  1651 	}
       
  1652 
       
  1653 CCTSYIntegrationTestPacketService0010::~CCTSYIntegrationTestPacketService0010()
       
  1654 /**
       
  1655  * Destructor.
       
  1656  */
       
  1657 	{
       
  1658 	}
       
  1659 
       
  1660 TVerdict CCTSYIntegrationTestPacketService0010::doTestStepL()
       
  1661 /**
       
  1662  * @SYMTestCaseID BA-CTSY-INT-PKTS-0010
       
  1663  * @SYMFssID BA/CTSY/PKTS-0010
       
  1664  * @SYMTestCaseDesc Attach to packet service when already attached.
       
  1665  * @SYMTestPriority High
       
  1666  * @SYMTestActions RPacketService::Attach, RPacketService::GetStatus, RPacketService::NotifyStatusChange
       
  1667  * @SYMTestExpectedResults Pass - Attach fails with KErrAlreadyExists
       
  1668  * @SYMTestType CIT
       
  1669  * @SYMTestCaseDependencies live/automatic
       
  1670  *
       
  1671  * Reason for test: Verify attempt to re-attach fails but device remains attached.
       
  1672  *
       
  1673  * @return - TVerdict code
       
  1674  */
       
  1675 	{
       
  1676 
       
  1677 	//
       
  1678 	// SET UP
       
  1679 	//
       
  1680 	
       
  1681 	// Get packet service
       
  1682 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
  1683 																	  KMainPhone,
       
  1684 																	  KMainPacketService);
       
  1685 		
       
  1686 	//
       
  1687 	// SET UP END
       
  1688 	//
       
  1689 	
       
  1690 	StartTest();
       
  1691 	
       
  1692 	//
       
  1693 	// TEST START
       
  1694 	//
       
  1695 	
       
  1696 	// Post notification for packet service status change
       
  1697 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  1698 	CleanupStack::PushL(notifyStatusStatus); 
       
  1699 	RPacketService::TStatus packetServiceStatus;
       
  1700 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  1701 
       
  1702 	// Set attach mode to RPacketService::EAttachWhenPossible
       
  1703 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  1704 	CleanupStack::PushL(setAttachModeStatus);
       
  1705 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  1706 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  1707 					_L("PacketService::SetAttachMode timed out"));
       
  1708 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  1709 					_L("PacketService::SetAttachMode returned an error."));								
       
  1710 
       
  1711 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusAttached
       
  1712 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  1713 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  1714 																	notifyStatusStatus,
       
  1715 																	packetServiceStatus,
       
  1716 																	expectedPacketServiceStatus,
       
  1717 																	KErrNone);
       
  1718 				
       
  1719 	// Post request RPacketService::NotifyStatusChange
       
  1720 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  1721 		
       
  1722 	// Attach to the packet service. 
       
  1723 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  1724 	CleanupStack::PushL(attachStatus);
       
  1725 	packetService.Attach(attachStatus);
       
  1726 	
       
  1727 	// Check KErrAlreadyExists returned
       
  1728 	ASSERT_EQUALS(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone,	
       
  1729 					_L("PacketService::Attach timed out."));	
       
  1730 	ASSERT_EQUALS(attachStatus.Int(), KErrAlreadyExists, 
       
  1731 					_L("PacketService::Attach returned wrong error code."));
       
  1732 			
       
  1733 	// Check RPacketService::GetStatus returns RPacketService::EStatusAttached
       
  1734 	RPacketService::TStatus serviceStatus;
       
  1735 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  1736 					_L("PacketService::GetStatus returned with an error."));
       
  1737 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  1738 					_L("PacketService::GetStatus did not retun RPacketService::EStatusAttached."));	
       
  1739 
       
  1740 	// Check RPacketService::NotifyStatusChange is still KRequestPending	
       
  1741 	ASSERT_EQUALS(notifyStatusStatus.Int(), KRequestPending,
       
  1742 					_L("PacketService::NotifyStatusChange has changed state unexpectedly."));	
       
  1743     //
       
  1744     // Test end
       
  1745     //
       
  1746     		
       
  1747     StartCleanup();
       
  1748 		
       
  1749     // Pop:
       
  1750     // notifyStatusStatus  
       
  1751     // setAttachModeStatus
       
  1752 	// attachStatus
       
  1753     CleanupStack::PopAndDestroy(3, &notifyStatusStatus); 
       
  1754 	
       
  1755 	return TestStepResult();
       
  1756 	}
       
  1757 
       
  1758 TPtrC CCTSYIntegrationTestPacketService0010::GetTestStepName()
       
  1759 /**
       
  1760  * @return The test step name.
       
  1761  */
       
  1762 	{
       
  1763 	return _L("CCTSYIntegrationTestPacketService0010");
       
  1764 	}
       
  1765 
       
  1766 
       
  1767 
       
  1768 CCTSYIntegrationTestPacketService0011::CCTSYIntegrationTestPacketService0011(CEtelSessionMgr& aEtelSessionMgr)
       
  1769 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1770 /**
       
  1771  * Constructor.
       
  1772  */
       
  1773 	{
       
  1774 	SetTestStepName(CCTSYIntegrationTestPacketService0011::GetTestStepName());
       
  1775 	}
       
  1776 
       
  1777 CCTSYIntegrationTestPacketService0011::~CCTSYIntegrationTestPacketService0011()
       
  1778 /**
       
  1779  * Destructor.
       
  1780  */
       
  1781 	{
       
  1782 	}
       
  1783 
       
  1784 TVerdict CCTSYIntegrationTestPacketService0011::doTestStepL()
       
  1785 /**
       
  1786  * @SYMTestCaseID BA-CTSY-INT-PKTS-0011
       
  1787  * @SYMFssID BA/CTSY/PKTS-0011
       
  1788  * @SYMTestCaseDesc Attach to packet service when active.
       
  1789  * @SYMTestPriority High
       
  1790  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::Attach, RPacketService::GetStatus, RPacketContext::GetStatus, RPacketService::EnumerateContexts
       
  1791  * @SYMTestExpectedResults Pass - Attach fails with KErrAlreadyExists
       
  1792  * @SYMTestType CIT
       
  1793  * @SYMTestCaseDependencies live/automatic
       
  1794  *
       
  1795  * Reason for test: Verify attach fails. Verify contexts not disrupted
       
  1796  *
       
  1797  * @return - TVerdict code
       
  1798  */
       
  1799 	{
       
  1800 
       
  1801 	//
       
  1802 	// SET UP
       
  1803 	//
       
  1804 	
       
  1805 	// Get packet service 
       
  1806 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
  1807 																	  KMainPhone,
       
  1808 																	  KMainPacketService);
       
  1809 	
       
  1810 	// Get Packet Context
       
  1811 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  1812 																			 KMainPhone,
       
  1813 																			 KMainPacketService,
       
  1814 																			 KPrimaryPacketContext1); 
       
  1815 	
       
  1816 	// Get mobile phone
       
  1817 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  1818 	
       
  1819 	//
       
  1820 	// SET UP END
       
  1821 	//
       
  1822 	
       
  1823 	StartTest();
       
  1824 	
       
  1825 	//
       
  1826 	// TEST START
       
  1827 	//
       
  1828 		
       
  1829 	// Post notification for packet service status change
       
  1830 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  1831 	CleanupStack::PushL(notifyStatusStatus); 
       
  1832 	RPacketService::TStatus packetServiceStatus;
       
  1833 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  1834 
       
  1835 	// Set attach mode to RPacketService::EAttachWhenPossible 
       
  1836 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  1837 	CleanupStack::PushL(setAttachModeStatus);
       
  1838 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  1839 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  1840 					_L("PacketService::SetAttachMode timed out"));
       
  1841 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  1842 					_L("PacketService::SetAttachMode returned an error."));
       
  1843 
       
  1844 	// Wait for 10 seconds. 
       
  1845 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  1846 	
       
  1847 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusAttached
       
  1848 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  1849 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  1850 																	notifyStatusStatus,
       
  1851 																	packetServiceStatus,
       
  1852 																	expectedPacketServiceStatus,
       
  1853 																	KErrNone);
       
  1854 			
       
  1855 	// Post notification for packet service status change
       
  1856 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  1857 	
       
  1858 	// Open a new context.
       
  1859 	// Set valid context config 
       
  1860 	// Activate context 
       
  1861 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  1862 	
       
  1863 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusActive
       
  1864 	expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  1865 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  1866 																	notifyStatusStatus,
       
  1867 																	packetServiceStatus,
       
  1868 																	expectedPacketServiceStatus,
       
  1869 																	KErrNone);
       
  1870 	
       
  1871 	// Check RPacketService::EnumerateContexts returns 1
       
  1872 	TInt count = 0;
       
  1873 	TInt maxAllowed = 0;
       
  1874     TExtEtelRequestStatus enumContextStatus(packetService, EPacketEnumerateContexts);
       
  1875     CleanupStack::PushL(enumContextStatus);
       
  1876 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
  1877 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
  1878 					_L("PacketService::EnumerateContexts timed out"));
       
  1879 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
  1880 					_L("PacketService::EnumerateContexts returned an error"));
       
  1881 	ASSERT_EQUALS(count, COUNT_ONE, 
       
  1882 					_L("PacketService::EnumerateContexts, wrong count returned"));
       
  1883 		
       
  1884 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1885 	RPacketContext::TContextStatus packetContextStatus;
       
  1886 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, 
       
  1887 					_L("RPacketContext::GetStatus returned with an error."));
       
  1888 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, 
       
  1889 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  1890 
       
  1891 	// Post request for RPacketService::NotifyStatusChange 
       
  1892 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  1893 
       
  1894 	// Attach to the packet service again.  
       
  1895 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  1896 	CleanupStack::PushL(attachStatus);
       
  1897 	packetService.Attach(attachStatus);
       
  1898 	
       
  1899 	// Check KErrAlredyExists returned
       
  1900 	ASSERT_EQUALS(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone,	
       
  1901 					_L("PacketService::Attach timed out."));	
       
  1902 	ASSERT_EQUALS(attachStatus.Int(), KErrAlreadyExists, 
       
  1903 					_L("PacketService::Attach returned wrong error code."));	
       
  1904 
       
  1905 	// Check RPacketService::GetStatus returns RPacketService::EStatusActive
       
  1906 	RPacketService::TStatus serviceStatus;
       
  1907 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  1908 					_L("PacketService::GetStatus returned with an error."));
       
  1909 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusActive, 
       
  1910 					_L("PacketService::GetStatus did not return RPacketService::EStatusActive."));	
       
  1911 
       
  1912 	// Check RPacketService::EnumerateContexts returns 1
       
  1913 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
  1914 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
  1915 					_L("PacketService::EnumerateContexts timed out"));
       
  1916 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
  1917 					_L("PacketService::EnumerateContexts returned an error"));
       
  1918 	ASSERT_EQUALS(count, COUNT_ONE, 
       
  1919 					_L("PacketService::EnumerateContexts returned wrong count"));
       
  1920 
       
  1921 	// Check RPacketContext::GetStatus returns EStatusActive
       
  1922 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, 
       
  1923 					_L("RPacketContext::GetStatus returned with an error."));
       
  1924 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActive, 
       
  1925 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  1926 
       
  1927 	// Check RPacketService::NotifyStatusChange is still KRequestPending
       
  1928 	ASSERT_EQUALS(notifyStatusStatus.Int(), KRequestPending,
       
  1929 					_L("PacketService::NotifyStatusChange did not return KRequestPending."));	
       
  1930 	
       
  1931 	//
       
  1932 	// TEST END
       
  1933 	//
       
  1934 
       
  1935     StartCleanup();
       
  1936 	
       
  1937     // deactivate the context and detach from packet service
       
  1938 	TExtEtelRequestStatus deactivateStatus(packetService, EPacketContextDeactivate);
       
  1939 	CleanupStack::PushL(deactivateStatus);
       
  1940 	packetContext.Deactivate(deactivateStatus);			
       
  1941 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateStatus, ETimeMedium), KErrNone, 
       
  1942 					_L("PacketContext::Deactivate timed out"));
       
  1943 	ASSERT_EQUALS(deactivateStatus.Int(), KErrNone, 
       
  1944 					_L("PacketContext::Deactivate returned an error"));
       
  1945     
       
  1946 	// Pop:
       
  1947 	// notifyStatusStatus
       
  1948 	// setAttachModeStatus
       
  1949 	// enumContextStatus
       
  1950 	// attachStatus
       
  1951 	// deactivateStatus
       
  1952 	CleanupStack::PopAndDestroy(5, &notifyStatusStatus);
       
  1953 	
       
  1954 	return TestStepResult();
       
  1955 	}
       
  1956 
       
  1957 TPtrC CCTSYIntegrationTestPacketService0011::GetTestStepName()
       
  1958 /**
       
  1959  * @return The test step name.
       
  1960  */
       
  1961 	{
       
  1962 	return _L("CCTSYIntegrationTestPacketService0011");
       
  1963 	}
       
  1964 
       
  1965 
       
  1966 
       
  1967 CCTSYIntegrationTestPacketService0012::CCTSYIntegrationTestPacketService0012(CEtelSessionMgr& aEtelSessionMgr)
       
  1968 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  1969 /**
       
  1970  * Constructor.
       
  1971  */
       
  1972 	{
       
  1973 	SetTestStepName(CCTSYIntegrationTestPacketService0012::GetTestStepName());
       
  1974 	}
       
  1975 
       
  1976 CCTSYIntegrationTestPacketService0012::~CCTSYIntegrationTestPacketService0012()
       
  1977 /**
       
  1978  * Destructor.
       
  1979  */
       
  1980 	{
       
  1981 	}
       
  1982 
       
  1983 TVerdict CCTSYIntegrationTestPacketService0012::doTestStepL()
       
  1984 /**
       
  1985  * @SYMTestCaseID BA-CTSY-INT-PKTS-0012
       
  1986  * @SYMFssID BA/CTSY/PKTS-0012
       
  1987  * @SYMTestCaseDesc Attach to packet service when suspended.
       
  1988  * @SYMTestPriority High
       
  1989  * @SYMTestActions RPacketContext::SetConfig, RPacketContext::Activate, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RCall::Dial, RPacketService::SetMSClass, RPacketService::GetMSClass, RPacketService::NotifyMSClassChange
       
  1990  * @SYMTestExpectedResults Pass - Attach fails with KErrAlreadyExists
       
  1991  * @SYMTestType CIT
       
  1992  * @SYMTestCaseDependencies live/automatic
       
  1993  *
       
  1994  * Reason for test: Verify attach fails.
       
  1995  *
       
  1996  * @return - TVerdict code
       
  1997  */
       
  1998 	{
       
  1999 
       
  2000 	//
       
  2001 	// SET UP
       
  2002 	//
       
  2003 	
       
  2004 	// Get packet service 
       
  2005 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, 
       
  2006 																	  KMainPhone,
       
  2007 																	  KMainPacketService);
       
  2008 	
       
  2009 	// Open a new context. 
       
  2010 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  2011 																			 KMainPhone,
       
  2012 																			 KMainPacketService,
       
  2013 																			 KPrimaryPacketContext1); 
       
  2014 	
       
  2015 	// Get mobile phone
       
  2016 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2017 	
       
  2018 	// Ensure RPacketService::GetStaticCaps returns in set of caps KCapsMSClassSupported 
       
  2019 	// For IPv4 type gateway (PdpType) we wish to receive static capabilities. 
       
  2020 	TUint staticCaps = 0;
       
  2021 	TUint expectedCaps = 	RPacketService::KCapsMSClassSupported;
       
  2022 	ASSERT_EQUALS(packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4), KErrNone,
       
  2023 					_L("RPacketService::GetStaticCaps returned an error"));
       
  2024 	ASSERT_BITS_SET(staticCaps, expectedCaps, KNoUnwantedBits,
       
  2025 					_L("RPacketService::GetStaticCaps did not return correct static caps"));
       
  2026 	
       
  2027 	//
       
  2028 	// SET UP END
       
  2029 	//
       
  2030 	
       
  2031 	StartTest();
       
  2032 	
       
  2033 	//
       
  2034 	// TEST START
       
  2035 	//
       
  2036 	
       
  2037 	// Get Voice line 1 
       
  2038 	RMobileLine& voiceLine = iEtelSessionMgr.GetLineL(KMainServer, KMainPhone, KVoiceLine);
       
  2039 
       
  2040 	// Get call 1 
       
  2041 	RMobileCall& call1 = iEtelSessionMgr.GetCallL(KMainServer, KMainPhone, KVoiceLine, KCall1);
       
  2042 	
       
  2043 	// Post notification for packet service status change
       
  2044 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  2045 	CleanupStack::PushL(notifyStatusStatus); 
       
  2046 	RPacketService::TStatus packetServiceStatus;
       
  2047 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  2048 
       
  2049 	// Set attach mode to RPacketService::EAttachWhenPossible 
       
  2050 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  2051 	CleanupStack::PushL(setAttachModeStatus);
       
  2052 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  2053 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  2054 					_L("PacketService::SetAttachMode timed out"));
       
  2055 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  2056 					_L("PacketService::SetAttachMode returned an error."));								
       
  2057 
       
  2058 	// Wait for 10 seconds. 
       
  2059 	User::After(10*KOneSecond);// This time delay is required to complete the implicit attach operation caused by EAttachWhenPossible attach mode
       
  2060 	
       
  2061 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusAttached
       
  2062 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  2063 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2064 																	notifyStatusStatus,
       
  2065 																	packetServiceStatus,
       
  2066 																	expectedPacketServiceStatus,
       
  2067 																	KErrNone);
       
  2068 
       
  2069 	// Set the MS class to EMSClassSuspensionRequired 
       
  2070 	RPacketService::TMSClass newClass=RPacketService::EMSClassSuspensionRequired;
       
  2071 	TExtEtelRequestStatus setMSClassStatus(packetService, EPacketSetMSClass);
       
  2072 	CleanupStack::PushL(setMSClassStatus);
       
  2073 	packetService.SetMSClass(setMSClassStatus,newClass);     
       
  2074 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone,
       
  2075 					_L("PacketService::SetMSClass timed out."));        
       
  2076 	ASSERT_EQUALS(setMSClassStatus.Int(), KErrNone, 
       
  2077 					_L("PacketService::SetMSClassStatus returned an error"));
       
  2078 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10050);
       
  2079 	CHECK_EQUALS_L(1, 2, _L("This test has been made to leave intentionally as CTSY currently does not\n support the SetMSClass operation so it is not possible to attach to packet network "));		
       
  2080 				
       
  2081 	// Check RPacketService::GetMSClass returns aCurrentClass, EMSClassSuspensionRequired and aMaxClass, EMSClassDualMode
       
  2082 	TExtEtelRequestStatus getMSClassStatus(packetService, EPacketGetMSClass);
       
  2083 	CleanupStack::PushL(getMSClassStatus);
       
  2084 	RPacketService::TMSClass msClass;
       
  2085 	RPacketService::TMSClass msMax;
       
  2086 	packetService.GetMSClass(getMSClassStatus, msClass, msMax);
       
  2087 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone, 
       
  2088 	            	_L("PacketService::GetMSClass timedout"));
       
  2089 	ASSERT_EQUALS(getMSClassStatus.Int(), KErrNone, 
       
  2090 	            	_L("packetService::GetMSClass returned an error"));     
       
  2091 	ASSERT_EQUALS(msClass, RPacketService::EMSClassSuspensionRequired, 
       
  2092 					_L("RPacketService::GetMSClass did not return EMSClassSuspensionRequired as aCurrentClass"));
       
  2093 	ASSERT_EQUALS(msMax, RPacketService::EMSClassDualMode, 
       
  2094 					_L("RPacketService::GetMSClass did not return EMSClassDualMode as aMaxClass"));
       
  2095 	
       
  2096 	// Post notification for packet service status change
       
  2097 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  2098 
       
  2099 	// Activate context 
       
  2100 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  2101 	
       
  2102 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusActive
       
  2103 	expectedPacketServiceStatus = RPacketService::EStatusActive;
       
  2104 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2105 																	notifyStatusStatus,
       
  2106 																	packetServiceStatus,
       
  2107 																	expectedPacketServiceStatus,
       
  2108 																	KErrNone);
       
  2109 	
       
  2110 	// Dial a number that answers 
       
  2111 	TPtrC number; 
       
  2112 	ASSERT_TRUE(GetStringFromConfig(KIniVoiceNumSection, KIniVoiceNumber1, number) != EFalse,			  
       
  2113 			_L("CTestStep::GetStringFromConfig did not complete as expected"));
       
  2114 	TCoreEtelRequestStatus<RCall> dialStatus(call1, &RCall::DialCancel);
       
  2115 	CleanupStack::PushL(dialStatus);
       
  2116 	call1.Dial(dialStatus, number); 
       
  2117 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dialStatus, ETimeMedium), KErrNone, 
       
  2118 					_L("RCall::Dial timed-out"));
       
  2119 	ASSERT_EQUALS(dialStatus.Int(), KErrNone,
       
  2120 					_L("RCall::Dial returned with an error"));
       
  2121 	
       
  2122 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusSuspended
       
  2123 	expectedPacketServiceStatus = RPacketService::EStatusSuspended;
       
  2124 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2125 																	notifyStatusStatus,
       
  2126 																	packetServiceStatus,
       
  2127 																	expectedPacketServiceStatus,
       
  2128 																	KErrNone);
       
  2129 	
       
  2130 	// Attach to the packet service again.  
       
  2131 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  2132 	CleanupStack::PushL(attachStatus);
       
  2133 	packetService.Attach(attachStatus);
       
  2134 	
       
  2135 	// Check KErrAlredyExists returned
       
  2136 	ASSERT_EQUALS(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone,	
       
  2137 					_L("PacketService::Attach timed out."));	
       
  2138 	ASSERT_EQUALS(attachStatus.Int(), KErrAlreadyExists, 
       
  2139 					_L("PacketService::Attach returned wrong error code."));	
       
  2140 
       
  2141 	//
       
  2142 	// TEST END
       
  2143 	//
       
  2144 
       
  2145     StartCleanup();
       
  2146 	
       
  2147 	// Pop:
       
  2148 	// notifyStatusStatus
       
  2149 	// setAttachModeStatus
       
  2150 	// setMSClassStatus
       
  2151 	// getMSClassStatus
       
  2152 	// dialStatus
       
  2153 	// attachStatus
       
  2154 	CleanupStack::PopAndDestroy(6, &notifyStatusStatus);
       
  2155 	
       
  2156 	return TestStepResult();
       
  2157 	}
       
  2158 
       
  2159 TPtrC CCTSYIntegrationTestPacketService0012::GetTestStepName()
       
  2160 /**
       
  2161  * @return The test step name.
       
  2162  */
       
  2163 	{
       
  2164 	return _L("CCTSYIntegrationTestPacketService0012");
       
  2165 	}
       
  2166 
       
  2167 
       
  2168 
       
  2169 CCTSYIntegrationTestPacketService0013::CCTSYIntegrationTestPacketService0013(CEtelSessionMgr& aEtelSessionMgr)
       
  2170 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  2171 /**
       
  2172  * Constructor.
       
  2173  */
       
  2174 	{
       
  2175 	SetTestStepName(CCTSYIntegrationTestPacketService0013::GetTestStepName());
       
  2176 	}
       
  2177 
       
  2178 CCTSYIntegrationTestPacketService0013::~CCTSYIntegrationTestPacketService0013()
       
  2179 /**
       
  2180  * Destructor.
       
  2181  */
       
  2182 	{
       
  2183 	}
       
  2184 
       
  2185 TVerdict CCTSYIntegrationTestPacketService0013::doTestStepL()
       
  2186 /**
       
  2187  * @SYMTestCaseID BA-CTSY-INT-PKTS-0013
       
  2188  * @SYMFssID BA/CTSY/PKTS-0013
       
  2189  * @SYMTestCaseDesc Detach from packet service when network initiated detach received when attached.
       
  2190  * @SYMTestPriority High
       
  2191  * @SYMTestActions RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyChangeOfNtwkRegStatus, RPacketService::GetNtwkRegStatus, RPacketService::NotifyReleaseModeChange, RPacketService::GetCurrentReleaseMode
       
  2192  * @SYMTestExpectedResults Pass - Phone detached from packet service.
       
  2193  * @SYMTestType CIT
       
  2194  * @SYMTestCaseDependencies simulated/manual
       
  2195  *
       
  2196  * Reason for test: Verify that automatic detach occurs when network request to detach received and there are no contexts active.
       
  2197 
       
  2198 Verify packet network registration status, release mode and dynamic caps are correct.
       
  2199  *
       
  2200  * @return - TVerdict code
       
  2201  */
       
  2202 	{
       
  2203 
       
  2204 	//
       
  2205 	// SET UP
       
  2206 	//
       
  2207 
       
  2208 	//
       
  2209 	
       
  2210 	// Get Packet Service
       
  2211 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer,
       
  2212 																	  KMainPhone,
       
  2213 																	  KMainPacketService);
       
  2214 
       
  2215 	// Get Packet Context
       
  2216 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  2217 																			 KMainPhone,
       
  2218 																			 KMainPacketService,
       
  2219 																			 KPrimaryPacketContext1); 
       
  2220 	
       
  2221 	// Get mobile phone
       
  2222 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2223 	
       
  2224 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone,
       
  2225 					_L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  2226 	
       
  2227 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  2228 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  2229 	EnsureAttachModeL(packetService,attachMode);
       
  2230 	User::After(10*KOneSecond); //This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  2231 	
       
  2232 	// Attach to packet service 
       
  2233 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  2234 	CleanupStack::PushL(attachStatus);
       
  2235 	packetService.Attach(attachStatus);
       
  2236 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone,
       
  2237 					_L("PacketService::Attach timed out."));
       
  2238 	
       
  2239 	if(attachStatus.Int() !=  KErrAlreadyExists)
       
  2240 		{
       
  2241 		CHECK_EQUALS_L(attachStatus.Int(), KErrNone, _L("PacketService::Attach returned an error"));
       
  2242 		}
       
  2243  
       
  2244 	// Ensure RPacketService::GetStatus returns EStatusAttached 
       
  2245 	RPacketService::TStatus currentStatus;
       
  2246 	CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2247 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusAttached, _L("SET UP should be attached at this point"));
       
  2248 
       
  2249 	//
       
  2250 	// SET UP END
       
  2251 	//
       
  2252 	
       
  2253 	StartTest();
       
  2254 	
       
  2255 	//
       
  2256 	// TEST START
       
  2257 	//
       
  2258 	
       
  2259 	// Post notification for packet service status change
       
  2260 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  2261 	CleanupStack::PushL(notifyStatusStatus); 
       
  2262 	RPacketService::TStatus packetServiceStatus;
       
  2263 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  2264 	
       
  2265 	// Post a notification for RPacketService::NotifyChangeOfNtwkRegStatus
       
  2266 	TExtEtelRequestStatus changeOfNtwkRegStatusSt(packetService, EPacketNotifyChangeOfNtwkRegStatus);
       
  2267 	CleanupStack::PushL(changeOfNtwkRegStatusSt); 
       
  2268 	RPacketService::TRegistrationStatus ntwkRegStatus;
       
  2269 	packetService.NotifyChangeOfNtwkRegStatus(changeOfNtwkRegStatusSt, ntwkRegStatus);
       
  2270 			
       
  2271 	// Post notification for dynamic caps change
       
  2272 	RPacketService::TDynamicCapsFlags dynCaps;
       
  2273 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  2274 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
  2275 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
  2276 
       
  2277 	// Simulate network initiated detach 
       
  2278 	DisplayUserInteractionPromptL(KPrompt); 
       
  2279 
       
  2280 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusUnattached.
       
  2281 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  2282 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2283 																	notifyStatusStatus,
       
  2284 																	packetServiceStatus,
       
  2285 																	expectedPacketServiceStatus,
       
  2286 																	KErrNone);
       
  2287 	
       
  2288 	// Check RPacketService::NotifyChangeOfNtwkRegStatus completes with RPacketService::ENotRegisteredButAvailable.
       
  2289 	RPacketService::TRegistrationStatus expectedRegistrationStatus= RPacketService::ENotRegisteredButAvailable;
       
  2290 	iPacketServiceTestHelper.WaitForPacketServiceNotifyChangeOfNtwkRegStatus(packetService,
       
  2291 																			 changeOfNtwkRegStatusSt,
       
  2292 																			 ntwkRegStatus,
       
  2293 																			 expectedRegistrationStatus,
       
  2294 																			 KErrNone);	
       
  2295 				
       
  2296 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  2297 	// Check RPacketService::NotifyDynamicCapsChange completes with cap NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  2298 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsManualAttach | 
       
  2299 													 RPacketService::KCapsRxCSCall;
       
  2300 	
       
  2301 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsSMSTransfer | 
       
  2302 													 RPacketService::KCapsManualDetach | 
       
  2303 													 RPacketService::KCapsRxContextActivationReq  ;
       
  2304    	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
  2305    																		 notifyDynamicCapsChangeStatus,
       
  2306    																		 dynCaps,
       
  2307    																		 expectedCaps,
       
  2308    																		 unwantedCaps,
       
  2309    																		 KErrNone);
       
  2310 
       
  2311 	// Check RPacketService::GetStatus returns EStatusUnattached.
       
  2312    	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2313 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus did not return EStatusUnattached "));
       
  2314 
       
  2315 	// Check RPacketService::GetNtwkRegStatus returns ENotRegisteredButAvailable.
       
  2316 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  2317 	CleanupStack::PushL(regStatus);
       
  2318 	RPacketService::TRegistrationStatus registrationStatus;
       
  2319 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  2320 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
  2321 					_L("PacketService::GetNtwkRegStatus timed out"));
       
  2322 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  2323 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
  2324 	ASSERT_EQUALS(registrationStatus, expectedRegistrationStatus,
       
  2325 					_L("PacketService::GetNtwkRegStatus did not return ENotRegisteredButAvailable registration status"));
       
  2326 
       
  2327 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  2328 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  2329 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  2330 					_L("PacketService::GetDynamicCaps returned an error"));
       
  2331 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  2332 					_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  2333 
       
  2334 	//
       
  2335 	// TEST END
       
  2336 	//
       
  2337 
       
  2338     StartCleanup();
       
  2339 	
       
  2340 	// Pop:
       
  2341 	// attachStatus
       
  2342 	// notifyStatusStatus
       
  2343 	// changeOfNtwkRegStatusSt
       
  2344 	// notifyDynamicCapsChangeStatus
       
  2345 	// regStatus
       
  2346 	CleanupStack::PopAndDestroy(5, &attachStatus);
       
  2347 	
       
  2348 	return TestStepResult();
       
  2349 	}
       
  2350 
       
  2351 TPtrC CCTSYIntegrationTestPacketService0013::GetTestStepName()
       
  2352 /**
       
  2353  * @return The test step name.
       
  2354  */
       
  2355 	{
       
  2356 	return _L("CCTSYIntegrationTestPacketService0013");
       
  2357 	}
       
  2358 
       
  2359 
       
  2360 
       
  2361 CCTSYIntegrationTestPacketService0014::CCTSYIntegrationTestPacketService0014(CEtelSessionMgr& aEtelSessionMgr)
       
  2362 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  2363 /**
       
  2364  * Constructor.
       
  2365  */
       
  2366 	{
       
  2367 	SetTestStepName(CCTSYIntegrationTestPacketService0014::GetTestStepName());
       
  2368 	}
       
  2369 
       
  2370 CCTSYIntegrationTestPacketService0014::~CCTSYIntegrationTestPacketService0014()
       
  2371 /**
       
  2372  * Destructor.
       
  2373  */
       
  2374 	{
       
  2375 	}
       
  2376 
       
  2377 TVerdict CCTSYIntegrationTestPacketService0014::doTestStepL()
       
  2378 /**
       
  2379  * @SYMTestCaseID BA-CTSY-INT-PKTS-0014
       
  2380  * @SYMFssID BA/CTSY/PKTS-0014
       
  2381  * @SYMTestCaseDesc Detach from packet service when network initiated detach received when active.
       
  2382  * @SYMTestPriority High
       
  2383  * @SYMTestActions RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetDynamicCaps, RPacketService::NotifyChangeOfNtwkRegStatus, RPacketService::GetNtwkRegStatus, RPacketService::EnumerateContexts, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::NotifyReleaseModeChange, RPacketService::GetCurrentReleaseMode
       
  2384  * @SYMTestExpectedResults Pass - Phone detached from packet service.
       
  2385  * @SYMTestType CIT
       
  2386  * @SYMTestCaseDependencies simulated/manual
       
  2387  *
       
  2388  * Reason for test: Verify that automatic detach occurs when network request to detach received and there are active contexts.
       
  2389 
       
  2390 Verify packet network registration status, number of contexts, context status, release mode and dynamic caps are correct.
       
  2391  *
       
  2392  * @return - TVerdict code
       
  2393  */
       
  2394 	{
       
  2395 
       
  2396 	//
       
  2397 	// SET UP
       
  2398 	//
       
  2399 	
       
  2400 	ERR_PRINTF2(_L("<font color=Orange>$CTSYProblem: defect id = %d</font>"), 10088);
       
  2401 	User::Leave(KErrNone);	
       
  2402 	
       
  2403 
       
  2404 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  2405 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  2406 	
       
  2407 	// Get Packet Context
       
  2408 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  2409 																			 KMainPhone,
       
  2410 																			 KMainPacketService,
       
  2411 																			 KPrimaryPacketContext1); 
       
  2412 	
       
  2413 	// Get mobile phone
       
  2414 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2415 	
       
  2416 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone,
       
  2417 					_L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  2418 	
       
  2419 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  2420 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  2421 	EnsureAttachModeL(packetService,attachMode);
       
  2422 	User::After(5*KOneSecond); //This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  2423 	
       
  2424 	// Attach to packet service 
       
  2425 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  2426 	CleanupStack::PushL(attachStatus);
       
  2427 	packetService.Attach(attachStatus);
       
  2428 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone, _L("PacketService::Attach timed out."));
       
  2429 	if(attachStatus.Int() != KErrAlreadyExists)
       
  2430 		{
       
  2431 		CHECK_EQUALS_L(attachStatus.Int(), KErrNone, _L("PacketService::Attach returned an error"));
       
  2432 		}
       
  2433  
       
  2434 	// Activate a context with a valid config 
       
  2435 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  2436    	
       
  2437 	// Ensure RPacketService::GetStatus returns EStatusActive 
       
  2438     RPacketService::TStatus currentStatus;
       
  2439     CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2440 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  2441 	
       
  2442 	//
       
  2443 	// SET UP END
       
  2444 	//
       
  2445 	
       
  2446 	StartTest();
       
  2447 	
       
  2448 	//
       
  2449 	// TEST START
       
  2450 	//
       
  2451 	
       
  2452 	
       
  2453 	// Post notification for packet service status change
       
  2454 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  2455 	CleanupStack::PushL(notifyStatusStatus); 
       
  2456 	RPacketService::TStatus packetServiceStatus;
       
  2457 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  2458 	
       
  2459 	// Post a notification for RPacketService::NotifyChangeOfNtwkRegStatus
       
  2460 	TExtEtelRequestStatus changeOfNtwkRegStatusSt(packetService, EPacketNotifyChangeOfNtwkRegStatus);
       
  2461 	CleanupStack::PushL(changeOfNtwkRegStatusSt); 
       
  2462 	RPacketService::TRegistrationStatus ntwkRegStatus;
       
  2463 	packetService.NotifyChangeOfNtwkRegStatus(changeOfNtwkRegStatusSt, ntwkRegStatus);
       
  2464 			
       
  2465 	// Post notification for dynamic caps change
       
  2466 	RPacketService::TDynamicCapsFlags dynCaps;
       
  2467 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  2468 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
  2469 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
  2470 
       
  2471 	// Simulate network initiated detach 
       
  2472 	DisplayUserInteractionPromptL(KPrompt); 
       
  2473 
       
  2474 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusUnattached.
       
  2475 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  2476 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2477 																	notifyStatusStatus,
       
  2478 																	packetServiceStatus,
       
  2479 																	expectedPacketServiceStatus,
       
  2480 																	KErrNone);
       
  2481 	
       
  2482 	// Check RPacketService::NotifyChangeOfNtwkRegStatus completes with RPacketService::ENotRegisteredButAvailable.
       
  2483 	RPacketService::TRegistrationStatus expectedRegistrationStatus= RPacketService::ENotRegisteredButAvailable;
       
  2484 	iPacketServiceTestHelper.WaitForPacketServiceNotifyChangeOfNtwkRegStatus(packetService,
       
  2485 																			 changeOfNtwkRegStatusSt,
       
  2486 																			 ntwkRegStatus,
       
  2487 																			 expectedRegistrationStatus,
       
  2488 																			 KErrNone);	
       
  2489 	
       
  2490 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  2491 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  2492 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsManualAttach | 
       
  2493 													 RPacketService::KCapsRxCSCall;
       
  2494 	
       
  2495 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsSMSTransfer | 
       
  2496 													 RPacketService::KCapsManualDetach | 
       
  2497 													 RPacketService::KCapsRxContextActivationReq  ;
       
  2498    	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
  2499    																		 notifyDynamicCapsChangeStatus,
       
  2500    																		 dynCaps,
       
  2501    																		 expectedCaps,
       
  2502    																		 unwantedCaps,
       
  2503    																		 KErrNone);
       
  2504 
       
  2505   	// Check RPacketService::GetStatus returns EStatusUnattached.
       
  2506    	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2507 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus did not return EStatusUnattached "));
       
  2508 
       
  2509 	// Check RPacketService::GetNtwkRegStatus returns ENotRegisteredButAvailable.
       
  2510 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  2511 	CleanupStack::PushL(regStatus);
       
  2512 	RPacketService::TRegistrationStatus registrationStatus;
       
  2513 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  2514 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
  2515 					_L("PacketService::GetNtwkRegStatus timed out"));
       
  2516 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  2517 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
  2518 	ASSERT_EQUALS(registrationStatus, expectedRegistrationStatus,
       
  2519 					_L("PacketService::GetNtwkRegStatus did not return ENotRegisteredButAvailable registration status"));
       
  2520 
       
  2521 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  2522 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq
       
  2523 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  2524 			_L("PacketService::GetDynamicCaps returned an error"));
       
  2525 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  2526 			_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  2527 
       
  2528    	//
       
  2529 	// TEST END
       
  2530 	//
       
  2531 
       
  2532     StartCleanup();
       
  2533 	
       
  2534 	// Pop:
       
  2535 	// attachStatus
       
  2536 	// notifyStatusStatus
       
  2537 	// changeOfNtwkRegStatusSt
       
  2538 	// notifyDynamicCapsChangeStatus
       
  2539 	// regStatus
       
  2540 	CleanupStack::PopAndDestroy(5, &attachStatus);
       
  2541 	
       
  2542 	
       
  2543 	return TestStepResult();
       
  2544 	}
       
  2545 
       
  2546 TPtrC CCTSYIntegrationTestPacketService0014::GetTestStepName()
       
  2547 /**
       
  2548  * @return The test step name.
       
  2549  */
       
  2550 	{
       
  2551 	return _L("CCTSYIntegrationTestPacketService0014");
       
  2552 	}
       
  2553 
       
  2554 
       
  2555 
       
  2556 CCTSYIntegrationTestPacketService0015::CCTSYIntegrationTestPacketService0015(CEtelSessionMgr& aEtelSessionMgr)
       
  2557 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  2558 /**
       
  2559  * Constructor.
       
  2560  */
       
  2561 	{
       
  2562 	SetTestStepName(CCTSYIntegrationTestPacketService0015::GetTestStepName());
       
  2563 	}
       
  2564 
       
  2565 CCTSYIntegrationTestPacketService0015::~CCTSYIntegrationTestPacketService0015()
       
  2566 /**
       
  2567  * Destructor.
       
  2568  */
       
  2569 	{
       
  2570 	}
       
  2571 
       
  2572 TVerdict CCTSYIntegrationTestPacketService0015::doTestStepL()
       
  2573 /**
       
  2574  * @SYMTestCaseID BA-CTSY-INT-PKTS-0015
       
  2575  * @SYMFssID BA/CTSY/PKTS-0015
       
  2576  * @SYMTestCaseDesc Detach from packet service when network initiated detach received when active.
       
  2577  * @SYMTestPriority High
       
  2578  * @SYMTestActions RPacketService::GetStatus, RPacketService::EnumerateNifs, RPacketService::EnumerateContextsInNif, RPacketService::GetContextNameInNif, RPacketService::GetNifInfo, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus
       
  2579  * @SYMTestExpectedResults Pass - Phone detached from packet service and contexts deactivated.
       
  2580  * @SYMTestType CIT
       
  2581  * @SYMTestCaseDependencies simulated/manual
       
  2582  *
       
  2583  * Reason for test: Verify NIF related info correct.
       
  2584  *
       
  2585  * @return - TVerdict code
       
  2586  */
       
  2587 	{
       
  2588 
       
  2589 	//
       
  2590 	// SET UP
       
  2591 	//
       
  2592 
       
  2593 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  2594 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  2595 
       
  2596 	// Post notification to get a ContextName
       
  2597 	TName contextName;
       
  2598 	TExtEtelRequestStatus notifyContextAddedStatus(packetService, EPacketNotifyContextAdded);
       
  2599 	CleanupStack::PushL(notifyContextAddedStatus);	
       
  2600 	packetService.NotifyContextAdded(notifyContextAddedStatus,contextName);
       
  2601 	
       
  2602 	// Get Packet Context
       
  2603 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  2604 																			 KMainPhone,
       
  2605 																			 KMainPacketService,
       
  2606 																			 KPrimaryPacketContext1); 
       
  2607 	
       
  2608 	// Wait to complete the NotifyContextAdded
       
  2609 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeShort), KErrNone,
       
  2610 					_L("PacketService;:NotifyContextAdded timed out"));
       
  2611 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(), KErrNone, 
       
  2612 					_L("PacketService::NotifyContextAdded returned an error"));
       
  2613 	
       
  2614 	// Get mobile phone
       
  2615 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2616 	
       
  2617 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  2618 	
       
  2619 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  2620 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  2621 	EnsureAttachModeL(packetService,attachMode);
       
  2622 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  2623 	
       
  2624 	// Attach to packet service 
       
  2625 	TExtEtelRequestStatus attachStatus(packetService, EPacketAttach);
       
  2626 	CleanupStack::PushL(attachStatus);
       
  2627 	packetService.Attach(attachStatus);
       
  2628 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(attachStatus, ETimeLong), KErrNone, _L("PacketService::Attach timed out."));
       
  2629 	CHECK_EQUALS_L(attachStatus.Int(), KErrNone, _L("PacketService::Attach returned an error"));
       
  2630  
       
  2631 	// Activate a context with a valid config 
       
  2632 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  2633    	
       
  2634 	// Ensure RPacketService::GetStatus returns EStatusActive
       
  2635     RPacketService::TStatus currentStatus;
       
  2636     CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2637 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  2638 	
       
  2639 	//
       
  2640 	// SET UP END
       
  2641 	//
       
  2642 	
       
  2643 	StartTest();
       
  2644 	
       
  2645 	//
       
  2646 	// TEST START
       
  2647 	//
       
  2648 	
       
  2649 	// Post notification for packet service status change
       
  2650 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  2651 	CleanupStack::PushL(notifyStatusStatus); 
       
  2652 	RPacketService::TStatus packetServiceStatus;
       
  2653 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  2654 	
       
  2655 	// Post notification for context's status change
       
  2656 	TExtEtelRequestStatus notifyContextStChStatus(packetContext, EPacketContextNotifyStatusChange);
       
  2657 	CleanupStack::PushL(notifyContextStChStatus);
       
  2658 	RPacketContext::TContextStatus packetContextStatus;
       
  2659 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus);
       
  2660 	
       
  2661 	// Simulate network initiated detach  
       
  2662 	DisplayUserInteractionPromptL(KPrompt); // 30 seconds
       
  2663 
       
  2664 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusUnattached.
       
  2665 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  2666 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2667 																	notifyStatusStatus,
       
  2668 																	packetServiceStatus,
       
  2669 																	expectedPacketServiceStatus,
       
  2670 																	KErrNone);
       
  2671 	
       
  2672 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  2673    	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2674 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus did not return EStatusUnattached "));
       
  2675 
       
  2676 	// Check RPacketContext::NotifyStatusChange completes with EStatusDeactivating -> EStatusInactive
       
  2677 	RPacketContext::TContextStatus expectedPacketContextStatus = RPacketContext::EStatusDeactivating;
       
  2678 	iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(packetContext,
       
  2679 																	notifyContextStChStatus,
       
  2680 																	packetContextStatus, 
       
  2681 																	expectedPacketContextStatus,
       
  2682 																	KErrNone);
       
  2683  
       
  2684 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusActivating, _L("Packet Context's status expected to be EStatusActivating but is not."));
       
  2685 	packetContext.NotifyStatusChange(notifyContextStChStatus, packetContextStatus); 
       
  2686 
       
  2687     expectedPacketContextStatus = RPacketContext::EStatusInactive;
       
  2688     iPacketServiceTestHelper.WaitForPacketContextNotifyStatusChange(packetContext,
       
  2689     																notifyContextStChStatus,
       
  2690     																packetContextStatus, 
       
  2691     																expectedPacketContextStatus,
       
  2692     																KErrNone);
       
  2693 
       
  2694 	// Check RPacketContext::GetStatus returns EStatusInactive
       
  2695     ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, _L("RPacketContext::GetStatus returned with an error."));
       
  2696     ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, _L("RPacketContext::GetStatus returns incorrect status."));
       
  2697   
       
  2698 	// Check RPacketService::EnumerateNifs returns 0
       
  2699 	TInt numNif=0;
       
  2700 	TExtEtelRequestStatus enumerateNifsSt(packetService,EPacketEnumerateNifs);
       
  2701 	CleanupStack::PushL(enumerateNifsSt);
       
  2702 	packetService.EnumerateNifs(enumerateNifsSt,numNif);
       
  2703 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsSt, ETimeMedium), KErrNone,
       
  2704 					_L("PacketService::EnumerateNifs timed out."));   
       
  2705 	ASSERT_EQUALS(enumerateNifsSt.Int(),KErrNone, 
       
  2706 					_L("RPacketService::EnumerateNifs returned an error"));
       
  2707 	ASSERT_EQUALS(numNif,0, 
       
  2708 					_L("RPacketService::EnumerateNifs did not return count as 0"));
       
  2709 	
       
  2710 	// Check RPacketService::EnumerateContextsInNif returns 0 when aExistingContextName, name of context activated in set up
       
  2711 	TInt numContexts=0;
       
  2712 	TExtEtelRequestStatus enumerateContextsInNifSt(packetService,EPacketEnumerateContextsInNif);
       
  2713 	CleanupStack::PushL(enumerateContextsInNifSt);
       
  2714 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt, contextName, numContexts);
       
  2715 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt, ETimeMedium), KErrNone,
       
  2716 					_L("PacketService::EnumerateContextsInNif timed out."));   
       
  2717 	ASSERT_EQUALS(enumerateContextsInNifSt.Int(), KErrNone, 
       
  2718 					_L("RPacketService::EnumerateContextsInNif returned an error"));
       
  2719 	ASSERT_EQUALS(numContexts, 0, 
       
  2720 					_L("RPacketService::EnumerateContextsInNif did not return count as 0"));
       
  2721 
       
  2722 	// Check RPacketService::GetContextNameInNif returns KErrArgument
       
  2723 	TName nameInNif;
       
  2724 	TExtEtelRequestStatus getContextNameInNifSt(packetService,EPacketGetContextNameInNif);
       
  2725 	CleanupStack::PushL(getContextNameInNifSt);
       
  2726 	packetService.GetContextNameInNif(getContextNameInNifSt, contextName, 0, nameInNif);
       
  2727 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifSt, ETimeMedium), KErrNone,
       
  2728 					_L("PacketService::GetContextNameInNif timed out."));   
       
  2729 	ASSERT_EQUALS(getContextNameInNifSt.Int(),KErrArgument, 
       
  2730 					_L("RPacketService::GetContextNameInNif did not return KErrArgument"));
       
  2731 	
       
  2732 	// Check RPacketService::GetNifInfo returns KErrArgument
       
  2733 	RPacketService::TNifInfoV2 nifInfo;
       
  2734 	TPckg<RPacketService::TNifInfoV2> nifInfoPk(nifInfo);
       
  2735 	TExtEtelRequestStatus getNifInfoSt(packetService,EPacketGetNifInfo);
       
  2736 	CleanupStack::PushL(getNifInfoSt);
       
  2737 	packetService.GetNifInfo(getNifInfoSt, 0, nifInfoPk);
       
  2738 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt, ETimeMedium), KErrNone,
       
  2739 					_L("PacketService::GetNifInfo timed out."));   
       
  2740 	ASSERT_EQUALS(getNifInfoSt.Int(),KErrArgument, 
       
  2741 					_L("RPacketService::GetNifInfo did not return KErrArgument"));
       
  2742 			
       
  2743 	//
       
  2744 	// TEST END
       
  2745 	//
       
  2746 
       
  2747     StartCleanup();
       
  2748 	
       
  2749 	// Pop:
       
  2750     // notifyContextAddedStatus
       
  2751     // attachStatus
       
  2752     // notifyStatusStatus
       
  2753     // notifyContextStChStatus
       
  2754     // enumerateNifsSt
       
  2755     // enumerateContextsInNifSt
       
  2756     // getContextNameInNifSt
       
  2757     // getNifInfoSt
       
  2758     CleanupStack::PopAndDestroy(8, &notifyContextAddedStatus);
       
  2759     
       
  2760 	
       
  2761 	return TestStepResult();
       
  2762 	}
       
  2763 
       
  2764 TPtrC CCTSYIntegrationTestPacketService0015::GetTestStepName()
       
  2765 /**
       
  2766  * @return The test step name.
       
  2767  */
       
  2768 	{
       
  2769 	return _L("CCTSYIntegrationTestPacketService0015");
       
  2770 	}
       
  2771 
       
  2772 
       
  2773 
       
  2774 CCTSYIntegrationTestPacketService0016::CCTSYIntegrationTestPacketService0016(CEtelSessionMgr& aEtelSessionMgr)
       
  2775 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  2776 /**
       
  2777  * Constructor.
       
  2778  */
       
  2779 	{
       
  2780 	SetTestStepName(CCTSYIntegrationTestPacketService0016::GetTestStepName());
       
  2781 	}
       
  2782 
       
  2783 CCTSYIntegrationTestPacketService0016::~CCTSYIntegrationTestPacketService0016()
       
  2784 /**
       
  2785  * Destructor.
       
  2786  */
       
  2787 	{
       
  2788 	}
       
  2789 
       
  2790 TVerdict CCTSYIntegrationTestPacketService0016::doTestStepL()
       
  2791 /**
       
  2792  * @SYMTestCaseID BA-CTSY-INT-PKTS-0016
       
  2793  * @SYMFssID BA/CTSY/PKTS-0016
       
  2794  * @SYMTestCaseDesc Detach from packet service manually when attached.
       
  2795  * @SYMTestPriority High
       
  2796  * @SYMTestActions RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetNtwkRegStatus, RPacketService::GetDynamicCaps
       
  2797  * @SYMTestExpectedResults Pass - Phone detached from packet service.
       
  2798  * @SYMTestType CIT
       
  2799  * @SYMTestCaseDependencies live/automatic
       
  2800  *
       
  2801  * Reason for test: Verify packet service detach succeeds when there are no contexts active.
       
  2802 
       
  2803 Verify packet network registration status and dynamic caps are correct.
       
  2804  *
       
  2805  * @return - TVerdict code
       
  2806  */
       
  2807 	{
       
  2808     
       
  2809 	//
       
  2810 	// SET UP
       
  2811 	//
       
  2812 
       
  2813 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  2814 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  2815 	
       
  2816 	// Get mobile phone
       
  2817 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  2818 	
       
  2819 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  2820 	
       
  2821 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  2822 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  2823 	EnsureAttachModeL(packetService,attachMode);
       
  2824 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  2825 	
       
  2826     // Attach to packet service
       
  2827     TExtEtelRequestStatus attachStatus (packetService,EPacketAttach);	
       
  2828     CleanupStack::PushL(attachStatus);
       
  2829     packetService.Attach(attachStatus);
       
  2830 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(attachStatus, ETimeVeryLong), KErrNone, 
       
  2831 					_L("PacketService::Attach timed out"));
       
  2832    	CHECK_EQUALS_L(attachStatus.Int(), KErrNone, 
       
  2833 					_L("PacketService::Attach returned an error"));
       
  2834    	
       
  2835 	// Ensure RPacketService::GetStatus returns EStatusAttached
       
  2836     RPacketService::TStatus currentStatus;
       
  2837 	CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2838 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusAttached, _L("SET UP should be attached at this point"));
       
  2839 	
       
  2840 	//
       
  2841 	// SET UP END
       
  2842 	//
       
  2843 
       
  2844 	StartTest();
       
  2845 
       
  2846 	//
       
  2847 	// TEST START
       
  2848 	//
       
  2849 
       
  2850 	// Post notification for packet service status change
       
  2851 	TExtEtelRequestStatus notifyStatusStatus (packetService,EPacketNotifyStatusChange);
       
  2852 	CleanupStack::PushL(notifyStatusStatus);
       
  2853 	RPacketService::TStatus packetServiceStatus;
       
  2854 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  2855 
       
  2856 	// Post notification for Dynamic Caps Change
       
  2857 	RPacketService::TDynamicCapsFlags dynCaps;
       
  2858 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  2859 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
  2860 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
  2861 	
       
  2862 	// Detach from packet service
       
  2863 	TExtEtelRequestStatus detachStatus(packetService,EPacketDetach);
       
  2864 	CleanupStack::PushL(detachStatus);
       
  2865 	packetService.Detach(detachStatus);
       
  2866 	ASSERT_EQUALS(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone,
       
  2867 					_L("PacketService::Detach timed out."));   
       
  2868 	ASSERT_EQUALS(detachStatus.Int(),KErrNone, 
       
  2869 					_L("RPacketService::Detach returned an error"));
       
  2870 
       
  2871 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  2872 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  2873 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus did not return EStatusUnattached"));
       
  2874 
       
  2875 	// Check RPacketService::NotifyStatusChange completes with RPacketService::EStatusUnattached.   
       
  2876 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  2877 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  2878 																	notifyStatusStatus,
       
  2879 																	currentStatus,
       
  2880 																	expectedPacketServiceStatus,
       
  2881 																	KErrNone);
       
  2882 	 
       
  2883     // Check RPacketService::NotifyDynamicCapsChange completes with caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  2884     // Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq     	
       
  2885 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsManualAttach | 
       
  2886 													 RPacketService::KCapsRxCSCall;
       
  2887 	
       
  2888 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsSMSTransfer | 
       
  2889 													 RPacketService::KCapsManualDetach | 
       
  2890 													 RPacketService::KCapsRxContextActivationReq  ;
       
  2891    	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService,
       
  2892    																		 notifyDynamicCapsChangeStatus,
       
  2893    																		 dynCaps,
       
  2894    																		 expectedCaps,
       
  2895    																		 unwantedCaps,
       
  2896    																		 KErrNone);
       
  2897 
       
  2898     // Check RPacketService::GetStatus returns EStatusUnattached.
       
  2899 	RPacketService::TStatus serviceStatus;
       
  2900 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  2901 				_L("PacketService::GetStatus returned an error"));
       
  2902 	ASSERT_EQUALS(serviceStatus, expectedPacketServiceStatus, 
       
  2903 				_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));
       
  2904        
       
  2905     // Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork.
       
  2906     TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  2907     CleanupStack::PushL(regStatus);
       
  2908     RPacketService::TRegistrationStatus registrationStatus;
       
  2909     packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  2910 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium), KErrNone,
       
  2911 					_L("PacketService::GetNtwkRegStatus timed out."));    
       
  2912     ASSERT_EQUALS(regStatus.Int(),KErrNone, 
       
  2913 					_L("RPacketService::GetNtwkRegStatus returned an error"));
       
  2914     ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
  2915 					_L("RPacketService::GetNtwkRegStatus did not return RPacketService::ERegisteredOnHomeNetwork"));
       
  2916       
       
  2917     // Check RPacketService::GetDynamicCaps returns caps in set of KCapsManualAttach | KCapsRxCSCall.
       
  2918     // Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach | RPacketService::KCapsRxContextActivationReq	
       
  2919     ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  2920 					_L("PacketService::GetDynamicCaps returned an error"));
       
  2921     expectedCaps = 	RPacketService::KCapsManualAttach | 
       
  2922         		    RPacketService::KCapsRxCSCall;
       
  2923     unwantedCaps =  RPacketService::KCapsSMSTransfer |
       
  2924     				RPacketService::KCapsManualDetach |
       
  2925     				RPacketService::KCapsRxContextActivationReq;
       
  2926     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps, 
       
  2927 				_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  2928  
       
  2929 	//
       
  2930 	// TEST END
       
  2931 	//
       
  2932 
       
  2933 	StartCleanup();
       
  2934     
       
  2935     // Pop:
       
  2936     // attachStatus
       
  2937     // notifyStatusStatus
       
  2938     // notifyDynamicCapsChangeStatus
       
  2939     // detachStatus
       
  2940     // regStatus
       
  2941     
       
  2942 	CleanupStack::PopAndDestroy(5, &attachStatus);
       
  2943 
       
  2944 	return TestStepResult();
       
  2945 	}
       
  2946 
       
  2947 TPtrC CCTSYIntegrationTestPacketService0016::GetTestStepName()
       
  2948 /**
       
  2949  * @return The test step name.
       
  2950  */
       
  2951 	{
       
  2952 	return _L("CCTSYIntegrationTestPacketService0016");
       
  2953 	}
       
  2954 
       
  2955 
       
  2956 
       
  2957 CCTSYIntegrationTestPacketService0017::CCTSYIntegrationTestPacketService0017(CEtelSessionMgr& aEtelSessionMgr)
       
  2958 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  2959 /**
       
  2960  * Constructor.
       
  2961  */
       
  2962 	{
       
  2963 	SetTestStepName(CCTSYIntegrationTestPacketService0017::GetTestStepName());
       
  2964 	}
       
  2965 
       
  2966 CCTSYIntegrationTestPacketService0017::~CCTSYIntegrationTestPacketService0017()
       
  2967 /**
       
  2968  * Destructor.
       
  2969  */
       
  2970 	{
       
  2971 	}
       
  2972 
       
  2973 TVerdict CCTSYIntegrationTestPacketService0017::doTestStepL()
       
  2974 /**
       
  2975  * @SYMTestCaseID BA-CTSY-INT-PKTS-0017
       
  2976  * @SYMFssID BA/CTSY/PKTS-0017
       
  2977  * @SYMTestCaseDesc Detach from packet service when active.
       
  2978  * @SYMTestPriority High
       
  2979  * @SYMTestActions RPacketService::GetDynamicCaps, RPacketService::GetStatus, RPacketService::EnumerateContexts, RPacketService::GetNtwkRegStatus, RPacketContext::GetStatus
       
  2980  * @SYMTestExpectedResults Pass - Packet service and contexts are still active.
       
  2981  * @SYMTestType CIT
       
  2982  * @SYMTestCaseDependencies live/automatic
       
  2983  *
       
  2984  * Reason for test: Verify packet service detach fails when there are contexts active.
       
  2985 
       
  2986 Verify packet network registration status,  number of contexts, context status,  and dynamic caps are correct.
       
  2987  *
       
  2988  * @return - TVerdict code
       
  2989  */
       
  2990 	{
       
  2991 
       
  2992 	//
       
  2993 	// SET UP
       
  2994 	//
       
  2995 
       
  2996 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  2997 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  2998 	
       
  2999 	// Get Packet Context
       
  3000 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  3001 																			 KMainPhone,
       
  3002 																			 KMainPacketService,
       
  3003 																			 KPrimaryPacketContext1); 
       
  3004 	
       
  3005 	// Get mobile phone
       
  3006 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3007 	
       
  3008 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3009 	
       
  3010 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  3011 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  3012 	EnsureAttachModeL(packetService,attachMode);
       
  3013 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  3014 	
       
  3015 	// Open a new context, set a valid config and activate it. 
       
  3016 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  3017    	
       
  3018 	// Ensure packet service status is EStatusActive
       
  3019     RPacketService::TStatus currentStatus;
       
  3020     CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3021 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3022 	
       
  3023 	//
       
  3024 	// SET UP END
       
  3025 	//
       
  3026 	
       
  3027 	StartTest();
       
  3028 	
       
  3029 	//
       
  3030 	// TEST START
       
  3031 	//
       
  3032 	
       
  3033 	// Detach from packet service. Check RPacketService::Detach returns KErrInUse 
       
  3034 	TExtEtelRequestStatus detachStatus(packetService,EPacketDetach);
       
  3035 	CleanupStack::PushL(detachStatus);
       
  3036 	packetService.Detach(detachStatus);
       
  3037 	ASSERT_EQUALS(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone,
       
  3038 					_L("PacketService::Detach timed out."));    
       
  3039 	ASSERT_EQUALS(detachStatus.Int(),KErrInUse, 
       
  3040 					_L("RPacketService::Detach did not return KErrInUse"));
       
  3041 
       
  3042 	// Check RPacketService::GetStatus returns RPacketService::EStatusActive
       
  3043 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, 
       
  3044 					_L("PacketService::GetStatus returned an error"));
       
  3045 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus did not return EStatusActive"));
       
  3046      
       
  3047 	// Check RPacketService::GetDynamicCaps returns caps in set of KCapsActivate | KCapsRxCSCall | KCapsRxContextActivationReq | KCapsSMSTransfer.
       
  3048 	// Check RPacketService::GetDynamicCaps completes with caps NOT in set of RPacketService::KCapsManualAttach | RPacketService::KCapsManualDetach
       
  3049 	RPacketService::TDynamicCapsFlags dynCaps;
       
  3050 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  3051 					_L("PacketService::GetDynamicCaps returned an error"));
       
  3052 	RPacketService::TDynamicCapsFlags expectedCaps =RPacketService::KCapsManualDetach | 
       
  3053         		    								RPacketService::KCapsRxCSCall |
       
  3054         		    								RPacketService::KCapsRxContextActivationReq |
       
  3055         		    								RPacketService::KCapsSMSTransfer;
       
  3056 	RPacketService::TDynamicCapsFlags unwantedCaps =RPacketService::KCapsManualAttach;
       
  3057     ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  3058     // $CTSYProblem: RPacketService::KCapsManualDetach was included in unwantedCaps list in the procedure
       
  3059     // whereas CTSY gets this capability in response to GetDynamicCaps. Procedure is correct but CTSY behaviour is different.
       
  3060    
       
  3061 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork
       
  3062 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  3063 	CleanupStack::PushL(regStatus);
       
  3064 	RPacketService::TRegistrationStatus registrationStatus;
       
  3065 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  3066 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium), KErrNone,
       
  3067 					_L("PacketService::GetNtwkRegStatus timed out."));    
       
  3068 	ASSERT_EQUALS(regStatus.Int(),KErrNone, 
       
  3069 					_L("RPacketService::GetNtwkRegStatus returned an error"));
       
  3070 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
  3071 					_L("RPacketService::GetNtwkRegStatus did not return RPacketService::ERegisteredOnHomeNetwork"));
       
  3072 				
       
  3073 	// Check RPacketService::EnumerateContexts returns aCount, 1 and aMaxAllowed, 11
       
  3074 	TInt count = 0;
       
  3075 	TInt maxAllowed = 0;
       
  3076 	TExtEtelRequestStatus enumContextStatus(packetService, EPacketEnumerateContexts);
       
  3077 	CleanupStack::PushL(enumContextStatus);
       
  3078 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
  3079 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
  3080 					_L("PacketService::EnumerateContexts timed out"));
       
  3081 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
  3082 					_L("PacketService::EnumerateContexts returned an error"));
       
  3083 	ASSERT_EQUALS(count, COUNT_ONE, 
       
  3084 					_L("PacketService::EnumerateContexts, wrong count returned"));
       
  3085 	ASSERT_EQUALS(maxAllowed, MAX_CONTEXTS, 
       
  3086 					_L("PacketService::EnumerateContexts, wrong max count returned"));
       
  3087 
       
  3088 	//
       
  3089 	// TEST END
       
  3090 	//
       
  3091 
       
  3092     StartCleanup();
       
  3093 	
       
  3094 	// Pop:
       
  3095 	// detachStatus
       
  3096 	// regStatus
       
  3097 	// enumContextStatus
       
  3098 	CleanupStack::PopAndDestroy(3, &detachStatus);	
       
  3099 	
       
  3100 	return TestStepResult();
       
  3101 	}
       
  3102 
       
  3103 TPtrC CCTSYIntegrationTestPacketService0017::GetTestStepName()
       
  3104 /**
       
  3105  * @return The test step name.
       
  3106  */
       
  3107 	{
       
  3108 	return _L("CCTSYIntegrationTestPacketService0017");
       
  3109 	}
       
  3110 
       
  3111 
       
  3112 
       
  3113 CCTSYIntegrationTestPacketService0018::CCTSYIntegrationTestPacketService0018(CEtelSessionMgr& aEtelSessionMgr)
       
  3114 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  3115 /**
       
  3116  * Constructor.
       
  3117  */
       
  3118 	{
       
  3119 	SetTestStepName(CCTSYIntegrationTestPacketService0018::GetTestStepName());
       
  3120 	}
       
  3121 
       
  3122 CCTSYIntegrationTestPacketService0018::~CCTSYIntegrationTestPacketService0018()
       
  3123 /**
       
  3124  * Destructor.
       
  3125  */
       
  3126 	{
       
  3127 	}
       
  3128 
       
  3129 TVerdict CCTSYIntegrationTestPacketService0018::doTestStepL()
       
  3130 /**
       
  3131  * @SYMTestCaseID BA-CTSY-INT-PKTS-0018
       
  3132  * @SYMFssID BA/CTSY/PKTS-0018
       
  3133  * @SYMTestCaseDesc Detach from packet service when active.
       
  3134  * @SYMTestPriority High
       
  3135  * @SYMTestActions RPacketService::EnumerateContextsInNif, RPacketService::EnumerateNifs, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif
       
  3136  * @SYMTestExpectedResults Pass - Packet service and contexts are still active and correct NIF related info is returned.
       
  3137  * @SYMTestType CIT
       
  3138  * @SYMTestCaseDependencies live/automatic
       
  3139  *
       
  3140  * Reason for test: Verify NIF related info correct.
       
  3141  *
       
  3142  * @return - TVerdict code
       
  3143  */
       
  3144 	{
       
  3145 
       
  3146 	//
       
  3147 	// SET UP
       
  3148 	//
       
  3149 	
       
  3150 	// Get Packet Service
       
  3151 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3152 
       
  3153 	// Post notification to get a ContextName
       
  3154 	TName contextName;
       
  3155 	TExtEtelRequestStatus notifyContextAddedStatus(packetService, EPacketNotifyContextAdded);
       
  3156 	CleanupStack::PushL(notifyContextAddedStatus);	
       
  3157 	packetService.NotifyContextAdded(notifyContextAddedStatus,contextName);
       
  3158 	
       
  3159 	// Get Packet Context
       
  3160 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  3161 																			 KMainPhone,
       
  3162 																			 KMainPacketService,
       
  3163 																			 KPrimaryPacketContext1); 
       
  3164 	
       
  3165 	// Wait to complete the NotifyContextAdded
       
  3166 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeShort), KErrNone,
       
  3167 					_L("PacketService;:NotifyContextAdded timed out"));
       
  3168 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(), KErrNone, 
       
  3169 					_L("PacketService::NotifyContextAdded returned an error"));
       
  3170 
       
  3171 	// Get mobile phone
       
  3172 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3173 	
       
  3174 	// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL
       
  3175 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3176 	
       
  3177 	// Ensure attach mode is RPacketService::EAttachWhenNeeded 
       
  3178 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  3179 	EnsureAttachModeL(packetService,attachMode);
       
  3180 	User::After(10*KOneSecond); //This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  3181 
       
  3182 	// Open a new context, set a valid config and activate it.
       
  3183 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  3184 	   	
       
  3185 	// Ensure packet service status is EStatusActive
       
  3186     RPacketService::TStatus currentStatus;
       
  3187     CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3188 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3189 	
       
  3190 	//
       
  3191 	// SET UP END
       
  3192 	//
       
  3193 	
       
  3194 	StartTest();
       
  3195 	
       
  3196 	//
       
  3197 	// TEST START
       
  3198 	//
       
  3199 	
       
  3200 	// Check RPacketService::Detach returns KErrInUse 
       
  3201 	TExtEtelRequestStatus detachStatus(packetService,EPacketDetach);
       
  3202 	CleanupStack::PushL(detachStatus);
       
  3203 	packetService.Detach(detachStatus);
       
  3204 	ASSERT_EQUALS(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone,
       
  3205 					_L("PacketService::Detach timed out."));   
       
  3206 	ASSERT_EQUALS(detachStatus.Int(), KErrInUse, 
       
  3207 					_L("RPacketService::Detach did not return an KErrInUse"));
       
  3208 	
       
  3209 	// Check RPacketContext::GetStatus returns EStatusActive
       
  3210 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, 
       
  3211 					_L("PacketService::GetStatus returned an error"));
       
  3212 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus did not return EStatusActive"));
       
  3213 
       
  3214 	// Check RPacketService::EnumerateNifs returns 1
       
  3215 	TInt numNif=0;
       
  3216 	TExtEtelRequestStatus enumerateNifsSt(packetService,EPacketEnumerateNifs);
       
  3217 	CleanupStack::PushL(enumerateNifsSt);
       
  3218 	packetService.EnumerateNifs(enumerateNifsSt,numNif);
       
  3219 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsSt, ETimeMedium), KErrNone,
       
  3220 					_L("PacketService::EnumerateNifs timed out."));   
       
  3221 	ASSERT_EQUALS(enumerateNifsSt.Int(),KErrNone, 
       
  3222 					_L("RPacketService::EnumerateNifs returned an error"));
       
  3223 	ASSERT_EQUALS(numNif,COUNT_ONE, 
       
  3224 					_L("RPacketService::EnumerateNifs did not return count as 1"));
       
  3225 	
       
  3226 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context activated in set up
       
  3227 	TInt numContexts=0;
       
  3228 	TExtEtelRequestStatus enumerateContextsInNifSt(packetService,EPacketEnumerateContextsInNif);
       
  3229 	CleanupStack::PushL(enumerateContextsInNifSt);
       
  3230 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt, contextName, numContexts);
       
  3231 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt, ETimeMedium), KErrNone,
       
  3232 					_L("PacketService::EnumerateContextsInNif timed out."));   
       
  3233 	ASSERT_EQUALS(enumerateContextsInNifSt.Int(),KErrNone, 
       
  3234 					_L("RPacketService::EnumerateContextsInNif returned an error"));
       
  3235 	ASSERT_EQUALS(numContexts,COUNT_ONE, 
       
  3236 					_L("RPacketService::EnumerateContextsInNif did not return count as 1"));
       
  3237 
       
  3238 	// Check RPacketService::GetContextNameInNif returns valid context name
       
  3239 	TName nameInNif;
       
  3240 	TExtEtelRequestStatus getContextNameInNifSt(packetService,EPacketGetContextNameInNif);
       
  3241 	CleanupStack::PushL(getContextNameInNifSt);
       
  3242 	packetService.GetContextNameInNif(getContextNameInNifSt, contextName, 0, nameInNif);
       
  3243 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifSt, ETimeMedium), KErrNone,
       
  3244 					_L("PacketService::GetContextNameInNif timed out."));   
       
  3245 	ASSERT_EQUALS(getContextNameInNifSt.Int(),KErrNone, 
       
  3246 					_L("RPacketService::GetContextNameInNif returned an error"));
       
  3247 	ASSERT_TRUE(nameInNif.Length()>0, 
       
  3248 					_L("RPacketService::GetContextNameInNif did not return a valid context name"));
       
  3249 	
       
  3250 	// Check RPacketService::GetNifInfo with aIndex=0 returns context name = name of context activated in set up, iNumberOfContexts, 1 iNifStatus, EStatusActive iPdpAddress, valid IP address iContextType, RPacketService::EInternalContext
       
  3251 	RPacketService::TNifInfoV2 nifInfo;
       
  3252 	TPckg<RPacketService::TNifInfoV2> nifInfoPk(nifInfo);
       
  3253 	TExtEtelRequestStatus getNifInfoSt(packetService,EPacketGetNifInfo);
       
  3254 	CleanupStack::PushL(getNifInfoSt);
       
  3255 	packetService.GetNifInfo(getNifInfoSt, 0, nifInfoPk);
       
  3256 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt, ETimeMedium), KErrNone,
       
  3257 					_L("PacketService::GetNifInfo timed out."));   
       
  3258 	ASSERT_EQUALS(getNifInfoSt.Int(),KErrNone, 
       
  3259 					_L("RPacketService::GetNifInfo returned an error"));
       
  3260 	ASSERT_EQUALS_DES16(nifInfo.iContextName, contextName, _L("RPacketService::GetNifInfo did not return the desired Context Name"));
       
  3261 	ASSERT_EQUALS(nifInfo.iNumberOfContexts , COUNT_ONE, _L("RPacketService::GetNifInfo did not return the number of contexts equal to one"));
       
  3262 	ASSERT_EQUALS(nifInfo.iNifStatus ,RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo did not return EStatusActive"));
       
  3263 	ASSERT_TRUE(nifInfo.iPdpAddress.Length()> 0, _L("RPacketService::GetNifInfo did not return valis pdp address"));
       
  3264 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo did not return EInternalContext context type"));
       
  3265 
       
  3266 	//
       
  3267 	// TEST END
       
  3268 	//
       
  3269 
       
  3270     StartCleanup();
       
  3271 
       
  3272     // Pop:
       
  3273     // notifyContextAddedStatus
       
  3274     // detachStatus
       
  3275     // enumerateNifsSt
       
  3276     // enumerateContextsInNifSt
       
  3277     // getContextNameInNifSt
       
  3278     // getNifInfoSt
       
  3279     CleanupStack::PopAndDestroy(6, &notifyContextAddedStatus);
       
  3280 	
       
  3281 	return TestStepResult();
       
  3282 	}
       
  3283 
       
  3284 TPtrC CCTSYIntegrationTestPacketService0018::GetTestStepName()
       
  3285 /**
       
  3286  * @return The test step name.
       
  3287  */
       
  3288 	{
       
  3289 	return _L("CCTSYIntegrationTestPacketService0018");
       
  3290 	}
       
  3291 
       
  3292 
       
  3293 
       
  3294 CCTSYIntegrationTestPacketService0019::CCTSYIntegrationTestPacketService0019(CEtelSessionMgr& aEtelSessionMgr)
       
  3295 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  3296 /**
       
  3297  * Constructor.
       
  3298  */
       
  3299 	{
       
  3300 	SetTestStepName(CCTSYIntegrationTestPacketService0019::GetTestStepName());
       
  3301 	}
       
  3302 
       
  3303 CCTSYIntegrationTestPacketService0019::~CCTSYIntegrationTestPacketService0019()
       
  3304 /**
       
  3305  * Destructor.
       
  3306  */
       
  3307 	{
       
  3308 	}
       
  3309 
       
  3310 TVerdict CCTSYIntegrationTestPacketService0019::doTestStepL()
       
  3311 /**
       
  3312  * @SYMTestCaseID BA-CTSY-INT-PKTS-0019
       
  3313  * @SYMFssID BA/CTSY/PKTS-0019
       
  3314  * @SYMTestCaseDesc Detach from packet service when last context is deactivated.
       
  3315  * @SYMTestPriority High
       
  3316  * @SYMTestActions RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::NotifyDynamicCapsChange, RPacketService::GetNtwkRegStatus, RPacketService::EnumerateContexts, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RPacketService::GetDynamicCaps
       
  3317  * @SYMTestExpectedResults Pass - Phone detached from packet service.
       
  3318  * @SYMTestType CIT
       
  3319  * @SYMTestCaseDependencies live/automatic
       
  3320  *
       
  3321  * Reason for test: Verify automatic detach from packet service succeeds when the last context is deactivated and attach mode is RPacketService::EAttachWhenNeeded
       
  3322 
       
  3323 Verify packet network registration status, number of contexts, context status and dynamic caps are correct.
       
  3324  *
       
  3325  * @return - TVerdict code
       
  3326  */
       
  3327 	{
       
  3328 
       
  3329 	//
       
  3330 	// SET UP
       
  3331 	//
       
  3332 
       
  3333 	// Get packet service
       
  3334 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3335 	
       
  3336 	// Get Packet Context
       
  3337 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  3338 																			 KMainPhone,
       
  3339 																			 KMainPacketService,
       
  3340 																			 KPrimaryPacketContext1); 
       
  3341 	// Get second packet context
       
  3342 	RPacketContext& packetContext2 = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  3343 									 										  KMainPhone,
       
  3344 									 										  KMainPacketService,
       
  3345 									 										  KPrimaryPacketContext2); 
       
  3346 	
       
  3347 	// Get Mobile Phone
       
  3348 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3349 	
       
  3350 	// Register with the home network
       
  3351 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3352 		
       
  3353 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  3354 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  3355 	EnsureAttachModeL(packetService,attachMode);
       
  3356 	User::After(5*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  3357 	
       
  3358 	// Activate two primary contexts with a valid config. 
       
  3359 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  3360 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext2 );
       
  3361 	
       
  3362 	// Ensure status of both context is EStatusActive 
       
  3363 	RPacketContext::TContextStatus packetContextStatus;
       
  3364 	CHECK_EQUALS_L(packetContext.GetStatus(packetContextStatus), KErrNone, 
       
  3365 					_L("RPacketContext::GetStatus returned with an error."));
       
  3366 	CHECK_EQUALS_L(packetContextStatus, RPacketContext::EStatusActive, 
       
  3367 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  3368 	
       
  3369 	// Staus of second packet context
       
  3370 	RPacketContext::TContextStatus packetContextStatus2;
       
  3371 	CHECK_EQUALS_L(packetContext2.GetStatus(packetContextStatus2), KErrNone, 
       
  3372 					_L("RPacketContext::GetStatus returned with an error."));
       
  3373 	CHECK_EQUALS_L(packetContextStatus2, RPacketContext::EStatusActive, 
       
  3374 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  3375 
       
  3376 	// Ensure RPacketService::GetStatus returns EStatusActive
       
  3377 	RPacketService::TStatus currentStatus;
       
  3378 	CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3379 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3380 
       
  3381 	//
       
  3382 	// SET UP END
       
  3383 	//
       
  3384 	
       
  3385 	StartTest();
       
  3386 	
       
  3387 	//
       
  3388 	// TEST START
       
  3389 	//
       
  3390 	
       
  3391 	
       
  3392 	// Check RPacketService::EnumerateContexts returns aCount, 2 aMaxAllowed, 11
       
  3393 	TInt count = 0;
       
  3394     TInt maxAllowed = 0;
       
  3395 	TExtEtelRequestStatus enumContextStatus(packetService, EPacketEnumerateContexts);
       
  3396     CleanupStack::PushL(enumContextStatus);
       
  3397 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
  3398 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
  3399 					_L("PacketService::EnumerateContexts timed out"));
       
  3400 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
  3401 					_L("PacketService::EnumerateContexts returned an error"));
       
  3402 	ASSERT_EQUALS(count, 2, 
       
  3403 					_L("PacketService::EnumerateContexts, wrong count returned"));
       
  3404 	ASSERT_EQUALS(maxAllowed, MAX_CONTEXTS, 
       
  3405 				_L("PacketService::EnumerateContexts, wrong max count returned"));
       
  3406 
       
  3407 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsRxCSCall
       
  3408 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  3409 	RPacketService::TDynamicCapsFlags dynCaps;
       
  3410 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  3411 					_L("PacketService::GetDynamicCaps returned an error"));
       
  3412 	RPacketService::TDynamicCapsFlags expectedCaps =RPacketService::KCapsSMSTransfer | 
       
  3413 	    		    								RPacketService::KCapsRxContextActivationReq |
       
  3414 	    		    								RPacketService::KCapsRxCSCall;
       
  3415 	RPacketService::TDynamicCapsFlags unwantedCaps =RPacketService::KCapsManualAttach;
       
  3416 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  3417 
       
  3418 	// Request notification RPacketService::NotifyStatusChange 
       
  3419 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  3420 	CleanupStack::PushL(notifyStatusStatus); 
       
  3421 	RPacketService::TStatus packetServiceStatus;
       
  3422 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  3423 
       
  3424 	// Request notification RPacketService::NotifyDynamicCapsChange 
       
  3425 	TExtEtelRequestStatus notifyDynamicCapsChangeStatus(packetService, EPacketNotifyDynamicCapsChange);
       
  3426 	CleanupStack::PushL(notifyDynamicCapsChangeStatus);
       
  3427 	packetService.NotifyDynamicCapsChange(notifyDynamicCapsChangeStatus, dynCaps);
       
  3428 		
       
  3429 	// Deactivate context 1. 
       
  3430 	TExtEtelRequestStatus deactivateStatus(packetService, EPacketContextDeactivate);
       
  3431 	CleanupStack::PushL(deactivateStatus);
       
  3432 	packetContext.Deactivate(deactivateStatus);			
       
  3433 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateStatus, ETimeMedium),	KErrNone, 
       
  3434 					_L("RPacketContext::Deactivate timed out"));	
       
  3435 	ASSERT_EQUALS(deactivateStatus.Int(), KErrNone, 
       
  3436 					_L("RPacketContext::Deactivate returned an error"));		
       
  3437 		
       
  3438 	// Check RPacketService::EnumerateContexts returns aCount, 2 aMaxAllowed, 11
       
  3439 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
  3440 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
  3441 					_L("PacketService::EnumerateContexts timed out"));
       
  3442 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
  3443 					_L("PacketService::EnumerateContexts returned an error"));
       
  3444 	ASSERT_EQUALS(count, 2, 
       
  3445 					_L("PacketService::EnumerateContexts, wrong count returned"));
       
  3446 	ASSERT_EQUALS(maxAllowed, MAX_CONTEXTS, 
       
  3447 					_L("PacketService::EnumerateContexts, wrong max count returned"));
       
  3448 
       
  3449 	// Check RPacketService::GetStatus returns EStatusActive
       
  3450 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3451 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3452 
       
  3453 	// Check RPacketContext::GetStatus for context 1 returns EStatusInactive
       
  3454 	ASSERT_EQUALS(packetContext.GetStatus(packetContextStatus), KErrNone, 
       
  3455 			_L("RPacketContext::GetStatus returned with an error."));
       
  3456 	ASSERT_EQUALS(packetContextStatus, RPacketContext::EStatusInactive, 
       
  3457 			_L("RPacketContext::GetStatus did not return RPacketContext::EStatusInactive."));
       
  3458 	
       
  3459 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsRxCSCall
       
  3460 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  3461 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  3462 					_L("PacketService::GetDynamicCaps returned an error"));
       
  3463 	expectedCaps =RPacketService::KCapsSMSTransfer | 
       
  3464 	    		  RPacketService::KCapsRxContextActivationReq |
       
  3465 	    		  RPacketService::KCapsRxCSCall;
       
  3466 	unwantedCaps =RPacketService::KCapsManualAttach;
       
  3467 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  3468 
       
  3469 	// Check RPacketService::NotifyStatusChange is still KRequestPending
       
  3470 	ASSERT_EQUALS(notifyStatusStatus.Int(), KRequestPending, 
       
  3471 					_L("RPacketContext::NotifyStatusChange did not return KRequestPending"));
       
  3472 	
       
  3473 	// Check RPacketService::NotifyDynamicCapsChange is still KRequestPending
       
  3474 	ASSERT_EQUALS(notifyDynamicCapsChangeStatus.Int(), KRequestPending, 
       
  3475 					_L("RPacketContext::NotifyStatusChange did not return KRequestPending"));	
       
  3476 
       
  3477 	// Deactivate context 2. 
       
  3478 	packetContext2.Deactivate(deactivateStatus);			
       
  3479 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateStatus, ETimeMedium),	KErrNone, 
       
  3480 					_L("RPacketContext::Deactivate timed out"));
       
  3481 	ASSERT_EQUALS(deactivateStatus.Int(), KErrNone, 
       
  3482 					_L("RPacketContext::Deactivate returned an error"));		
       
  3483 		
       
  3484 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  3485 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  3486 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  3487 																	notifyStatusStatus,
       
  3488 																	packetServiceStatus,
       
  3489 																	expectedPacketServiceStatus,
       
  3490 																	KErrNone);
       
  3491 
       
  3492 	// Check RPacketService::NotifyDynamicCapsChange completes with caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
  3493 	// Check RPacketService::NotifyDynamicCapsChange completes with caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach |  RPacketService::KCapsRxContextActivationReq
       
  3494 	expectedCaps = RPacketService::KCapsManualAttach |
       
  3495 				   RPacketService::KCapsRxCSCall;
       
  3496 	unwantedCaps = RPacketService::KCapsSMSTransfer |
       
  3497 				   RPacketService::KCapsManualDetach|
       
  3498 				   RPacketService::KCapsRxContextActivationReq ;
       
  3499 	iPacketServiceTestHelper.WaitForPacketServiceNotifyDynamicCapsChange(packetService, 
       
  3500 																		 notifyDynamicCapsChangeStatus,
       
  3501 																		 dynCaps,
       
  3502 																		 expectedCaps,
       
  3503 																		 unwantedCaps,
       
  3504 																		 KErrNone);
       
  3505 
       
  3506 	// Check RPacketContext::GetStatus for context 2 returns EStatusInactive
       
  3507 	ASSERT_EQUALS(packetContext2.GetStatus(packetContextStatus2), KErrNone, 
       
  3508 					_L("RPacketContext::GetStatus returned with an error."));
       
  3509 	ASSERT_EQUALS(packetContextStatus2, RPacketContext::EStatusInactive, 
       
  3510 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusInactive."));
       
  3511 
       
  3512 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsManualAttach | RPacketService::KCapsRxCSCall
       
  3513 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsManualDetach |  RPacketService::KCapsRxContextActivationReq
       
  3514 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  3515 					_L("PacketService::GetDynamicCaps returned an error"));
       
  3516 	expectedCaps = 	RPacketService::KCapsManualAttach |
       
  3517 					RPacketService::KCapsRxCSCall;
       
  3518 	unwantedCaps =  RPacketService::KCapsSMSTransfer |
       
  3519 				    RPacketService::KCapsManualDetach|
       
  3520 				    RPacketService::KCapsRxContextActivationReq ;
       
  3521 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,_L("PacketService::GetDynamicCaps returned wrong dynamic caps"));
       
  3522 
       
  3523 	// Check RPacketService::EnumerateContexts returns aCount, 2 aMaxAllowed, 11
       
  3524 	packetService.EnumerateContexts(enumContextStatus,count,maxAllowed);
       
  3525 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumContextStatus, ETimeMedium),KErrNone, 
       
  3526 					_L("PacketService::EnumerateContexts timed out"));
       
  3527 	ASSERT_EQUALS(enumContextStatus.Int(), KErrNone, 
       
  3528 					_L("PacketService::EnumerateContexts returned an error"));
       
  3529 	ASSERT_EQUALS(count, 2, 
       
  3530 					_L("PacketService::EnumerateContexts, wrong count returned"));
       
  3531 	ASSERT_EQUALS(maxAllowed, MAX_CONTEXTS, 
       
  3532 					_L("PacketService::EnumerateContexts, wrong max count returned"));
       
  3533 
       
  3534 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork
       
  3535 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  3536 	CleanupStack::PushL(regStatus);
       
  3537 	RPacketService::TRegistrationStatus registrationStatus;
       
  3538 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  3539 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium), KErrNone,
       
  3540 					_L("RPacketService::GetNtwkRegStatus timed-out."));
       
  3541 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  3542 					_L("RPacketService::GetNtwkRegStatus returned with an error"));
       
  3543 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
  3544 					_L("RPacketService::GetNtwkRegStatus did not return RPacketService::ERegisteredOnHomeNetwork"));
       
  3545 
       
  3546 	//
       
  3547 	// TEST END
       
  3548 	//
       
  3549 
       
  3550 	
       
  3551     StartCleanup();
       
  3552 	// Pop:
       
  3553 	// enumContextStatus
       
  3554 	// notifyStatusStatus
       
  3555 	// notifyDynamicCapsChangeStatus
       
  3556 	// deactivateStatus
       
  3557 	// regStatus
       
  3558 	CleanupStack::PopAndDestroy(5, &enumContextStatus);
       
  3559 	
       
  3560 	return TestStepResult();
       
  3561 	}
       
  3562 
       
  3563 TPtrC CCTSYIntegrationTestPacketService0019::GetTestStepName()
       
  3564 /**
       
  3565  * @return The test step name.
       
  3566  */
       
  3567 	{
       
  3568 	return _L("CCTSYIntegrationTestPacketService0019");
       
  3569 	}
       
  3570 
       
  3571 
       
  3572 
       
  3573 CCTSYIntegrationTestPacketService0020::CCTSYIntegrationTestPacketService0020(CEtelSessionMgr& aEtelSessionMgr)
       
  3574 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  3575 /**
       
  3576  * Constructor.
       
  3577  */
       
  3578 	{
       
  3579 	SetTestStepName(CCTSYIntegrationTestPacketService0020::GetTestStepName());
       
  3580 	}
       
  3581 
       
  3582 CCTSYIntegrationTestPacketService0020::~CCTSYIntegrationTestPacketService0020()
       
  3583 /**
       
  3584  * Destructor.
       
  3585  */
       
  3586 	{
       
  3587 	}
       
  3588 
       
  3589 TVerdict CCTSYIntegrationTestPacketService0020::doTestStepL()
       
  3590 /**
       
  3591  * @SYMTestCaseID BA-CTSY-INT-PKTS-0020
       
  3592  * @SYMFssID BA/CTSY/PKTS-0020
       
  3593  * @SYMTestCaseDesc Detach from packet service when last context is deactivated.
       
  3594  * @SYMTestPriority High
       
  3595  * @SYMTestActions RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::EnumerateContextsInNif, RPacketService::EnumerateNifs, RPacketService::GetNifInfo, RPacketService::GetContextNameInNif
       
  3596  * @SYMTestExpectedResults Pass - Phone detached and contexts deactivated.
       
  3597  * @SYMTestType CIT
       
  3598  * @SYMTestCaseDependencies live/automatic
       
  3599  *
       
  3600  * Reason for test: Verify automatic detach from packet service succeeds when the last context is deactivated and attach mode is RPacketService::EAttachWhenNeeded
       
  3601 
       
  3602 Verify NIF related info correct.
       
  3603  *
       
  3604  * @return - TVerdict code
       
  3605  */
       
  3606 	{
       
  3607 
       
  3608 	//
       
  3609 	// SET UP
       
  3610 	//
       
  3611 
       
  3612 	// Get packet service
       
  3613 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  3614 	
       
  3615 	// Post notification to get a ContextName
       
  3616 	TName contextName;
       
  3617 	TExtEtelRequestStatus notifyContextAddedStatus(packetService, EPacketNotifyContextAdded);
       
  3618 	CleanupStack::PushL(notifyContextAddedStatus);	
       
  3619 	packetService.NotifyContextAdded(notifyContextAddedStatus,contextName);
       
  3620 	
       
  3621 	// Open Primary context 1
       
  3622 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  3623 																			 KMainPhone,
       
  3624 																			 KMainPacketService,
       
  3625 																			 KPrimaryPacketContext1); 
       
  3626 	
       
  3627 	// Wait to complete the NotifyContextAdded
       
  3628 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus, ETimeShort), KErrNone,
       
  3629 					_L("PacketService;:NotifyContextAdded timed out"));
       
  3630 	CHECK_EQUALS_L(notifyContextAddedStatus.Int(), KErrNone, 
       
  3631 					_L("PacketService::NotifyContextAdded returned an error"));
       
  3632 	
       
  3633 	// Post notification to get a ContextName
       
  3634 	TName contextName2;
       
  3635 	TExtEtelRequestStatus notifyContextAddedStatus2(packetService, EPacketNotifyContextAdded);
       
  3636 	CleanupStack::PushL(notifyContextAddedStatus2);	
       
  3637 	packetService.NotifyContextAdded(notifyContextAddedStatus2,contextName2);
       
  3638 
       
  3639 	// Open primary context 2
       
  3640 	RPacketContext& packetContext2 = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  3641 									 										  KMainPhone,
       
  3642 									 										  KMainPacketService,
       
  3643 									 										  KPrimaryPacketContext2); 
       
  3644 	
       
  3645 	// Wait to complete the NotifyContextAdded
       
  3646 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(notifyContextAddedStatus2, ETimeShort), KErrNone,
       
  3647 					_L("PacketService;:NotifyContextAdded(second) timed out"));
       
  3648 	CHECK_EQUALS_L(notifyContextAddedStatus2.Int(), KErrNone, 
       
  3649 					_L("PacketService::NotifyContextAdded(second) returned an error"));
       
  3650 	
       
  3651 	// Get mobile phone
       
  3652 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  3653 	
       
  3654 	// Register with the home network
       
  3655 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  3656 		
       
  3657 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  3658 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  3659 	EnsureAttachModeL(packetService,attachMode);
       
  3660 	User::After(10*KOneSecond); // This time delay is required to complete the implicit detach operation caused by EAttachWhenNeeded attach mode
       
  3661 	
       
  3662 	// Activate two primary contexts with a valid config. 
       
  3663 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  3664 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext2 );
       
  3665 	
       
  3666 	// Ensure status of both context is EStatusActive 
       
  3667 	RPacketContext::TContextStatus packetContextStatus;
       
  3668 	CHECK_EQUALS_L(packetContext.GetStatus(packetContextStatus), KErrNone, 
       
  3669 					_L("RPacketContext::GetStatus returned with an error."));
       
  3670 	CHECK_EQUALS_L(packetContextStatus, RPacketContext::EStatusActive, 
       
  3671 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  3672 	
       
  3673 	// Staus of second packet context
       
  3674 	RPacketContext::TContextStatus packetContextStatus2;
       
  3675 	CHECK_EQUALS_L(packetContext2.GetStatus(packetContextStatus2), KErrNone, 
       
  3676 					_L("RPacketContext::GetStatus returned with an error."));
       
  3677 	CHECK_EQUALS_L(packetContextStatus2, RPacketContext::EStatusActive, 
       
  3678 					_L("RPacketContext::GetStatus did not return RPacketContext::EStatusActive."));
       
  3679 
       
  3680 	// Ensure RPacketService::GetStatus returns EStatusActive
       
  3681 	RPacketService::TStatus currentStatus;
       
  3682 	CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3683 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3684 
       
  3685 	
       
  3686 	//
       
  3687 	// SET UP END
       
  3688 	//
       
  3689 	
       
  3690 	StartTest();
       
  3691 	
       
  3692 	//
       
  3693 	// TEST START
       
  3694 	//
       
  3695 	
       
  3696 	
       
  3697 	// Check RPacketService::EnumerateNifs returns aCount, 2
       
  3698 	TInt numNif=0;
       
  3699 	TExtEtelRequestStatus enumerateNifsSt(packetService,EPacketEnumerateNifs);
       
  3700 	CleanupStack::PushL(enumerateNifsSt);
       
  3701 	packetService.EnumerateNifs(enumerateNifsSt,numNif);
       
  3702 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsSt, ETimeMedium), KErrNone,
       
  3703 					_L("PacketService::EnumerateNifs timed out."));   
       
  3704 	ASSERT_EQUALS(enumerateNifsSt.Int(),KErrNone, 
       
  3705 					_L("RPacketService::EnumerateNifs returned an error"));
       
  3706 	ASSERT_EQUALS(numNif ,2 , 
       
  3707 					_L("RPacketService::EnumerateNifs did not return count as 2"));
       
  3708 
       
  3709 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context 1
       
  3710 	TInt numContexts=0;
       
  3711 	TExtEtelRequestStatus enumerateContextsInNifSt(packetService,EPacketEnumerateContextsInNif);
       
  3712 	CleanupStack::PushL(enumerateContextsInNifSt);
       
  3713 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt, contextName, numContexts);
       
  3714 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt, ETimeMedium), KErrNone,
       
  3715 					_L("PacketService::EnumerateContextsInNif timed out."));   
       
  3716 	ASSERT_EQUALS(enumerateContextsInNifSt.Int(),KErrNone, 
       
  3717 					_L("RPacketService::EnumerateContextsInNif returned an error"));
       
  3718 	ASSERT_EQUALS(numContexts,COUNT_ONE, 
       
  3719 					_L("RPacketService::EnumerateContextsInNif did not return count as 1"));
       
  3720 
       
  3721 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context 2
       
  3722 	TExtEtelRequestStatus enumerateContextsInNifSt2(packetService,EPacketEnumerateContextsInNif);
       
  3723 	CleanupStack::PushL(enumerateContextsInNifSt2);
       
  3724 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt2, contextName2, numContexts);
       
  3725 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt2, ETimeMedium), KErrNone,
       
  3726 					_L("PacketService::EnumerateContextsInNif timed out."));   
       
  3727 	ASSERT_EQUALS(enumerateContextsInNifSt2.Int(),KErrNone, 
       
  3728 					_L("RPacketService::EnumerateContextsInNif returned an error"));
       
  3729 	ASSERT_EQUALS(numContexts, COUNT_ONE, 
       
  3730 					_L("RPacketService::EnumerateContextsInNif did not return count as 1"));
       
  3731 
       
  3732 	// Check RPacketService::GetContextNameInNif returns context 1 name when aExistingContextName=name of context 1 aIndex=0
       
  3733 	TName nameInNif;
       
  3734 	TExtEtelRequestStatus getContextNameInNifSt(packetService,EPacketGetContextNameInNif);
       
  3735 	CleanupStack::PushL(getContextNameInNifSt);
       
  3736 	packetService.GetContextNameInNif(getContextNameInNifSt, contextName, 0, nameInNif);
       
  3737 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifSt, ETimeMedium), KErrNone,
       
  3738 					_L("PacketService::GetContextNameInNif timed out."));   
       
  3739 	ASSERT_EQUALS(getContextNameInNifSt.Int(),KErrNone, 
       
  3740 					_L("RPacketService::GetContextNameInNif returned an error"));
       
  3741 	ASSERT_TRUE(nameInNif.Length()>0, 
       
  3742 					_L("RPacketService::GetContextNameInNif did not return a valid context name"));
       
  3743 
       
  3744 	// Check RPacketService::GetContextNameInNif returns context 1 name when aExistingContextName=name of context 2 aIndex=0
       
  3745 	TName nameInNif2;
       
  3746 	TExtEtelRequestStatus getContextNameInNifSt2(packetService,EPacketGetContextNameInNif);
       
  3747 	CleanupStack::PushL(getContextNameInNifSt2);
       
  3748 	packetService.GetContextNameInNif(getContextNameInNifSt2, contextName2, 0, nameInNif2);
       
  3749 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifSt2, ETimeMedium), KErrNone,
       
  3750 					_L("PacketService::GetContextNameInNif(second) timed out."));   
       
  3751 	ASSERT_EQUALS(getContextNameInNifSt2.Int(),KErrNone, 
       
  3752 					_L("RPacketService::GetContextNameInNif(second) returned an error"));
       
  3753 	ASSERT_TRUE(nameInNif2.Length()>0, 
       
  3754 					_L("RPacketService::GetContextNameInNif did not return a valid context name"));
       
  3755 
       
  3756 	// Check RPacketService::GetNifInfo with aIndex=0 returns context name = name of context 1, iNumberOfContexts, 1 iNifStatus, EStatusActive iPdpAddress, valid IP address iContextType, RPacketService::EInternalContext
       
  3757 	RPacketService::TNifInfoV2 nifInfo;
       
  3758 	TPckg<RPacketService::TNifInfoV2> nifInfoPk(nifInfo);
       
  3759 	TExtEtelRequestStatus getNifInfoSt(packetService,EPacketGetNifInfo);
       
  3760 	CleanupStack::PushL(getNifInfoSt);
       
  3761 	packetService.GetNifInfo(getNifInfoSt, 0, nifInfoPk);
       
  3762 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt, ETimeMedium), KErrNone,
       
  3763 					_L("PacketService::GetNifInfo timed out."));   
       
  3764 	ASSERT_EQUALS(getNifInfoSt.Int(),KErrNone, 
       
  3765 					_L("RPacketService::GetNifInfo returned an error"));
       
  3766 	ASSERT_EQUALS_DES16(nifInfo.iContextName, contextName, _L("RPacketService::GetNifInfo did not return the desired Context Name"));
       
  3767 	ASSERT_EQUALS(nifInfo.iNumberOfContexts , COUNT_ONE, _L("RPacketService::GetNifInfo did not return the number of contexts equal to one"));
       
  3768 	ASSERT_EQUALS(nifInfo.iNifStatus ,RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo did not return EStatusActive"));
       
  3769 	ASSERT_TRUE(nifInfo.iPdpAddress.Length()> 0, _L("RPacketService::GetNifInfo did not return valis pdp address"));
       
  3770 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo did not return EInternalContext context type"));
       
  3771 
       
  3772 	// Check RPacketService::GetNifInfo with aIndex=1 and context name = name of context 2 returns iNumberOfContexts, 1 iNifStatus, EStatusActive iPdpAddress, valid IP address iContextType, RPacketService::EInternalContext
       
  3773 	RPacketService::TNifInfoV2 nifInfo2;
       
  3774 	TPckg<RPacketService::TNifInfoV2> nifInfoPk2(nifInfo2);
       
  3775 	TExtEtelRequestStatus getNifInfoSt2(packetService,EPacketGetNifInfo);
       
  3776 	CleanupStack::PushL(getNifInfoSt2);
       
  3777 	packetService.GetNifInfo(getNifInfoSt2, 1, nifInfoPk2);
       
  3778 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt2, ETimeMedium), KErrNone,
       
  3779 					_L("PacketService::GetNifInfo(second) timed out."));   
       
  3780 	ASSERT_EQUALS(getNifInfoSt2.Int(),KErrNone, 
       
  3781 					_L("RPacketService::GetNifInfo(second) returned an error"));
       
  3782 	ASSERT_EQUALS_DES16(nifInfo2.iContextName, contextName2, _L("RPacketService::GetNifInfo(second) did not return the desired Context Name"));
       
  3783 	ASSERT_EQUALS(nifInfo2.iNumberOfContexts , COUNT_ONE, _L("RPacketService::GetNifInfo(second) did not return the number of contexts equal to one"));
       
  3784 	ASSERT_EQUALS(nifInfo2.iNifStatus ,RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo(second) did not return EStatusActive"));
       
  3785 	ASSERT_TRUE(nifInfo2.iPdpAddress.Length()> 0, _L("RPacketService::GetNifInfo(second) did not return valis pdp address"));
       
  3786 	ASSERT_EQUALS(nifInfo2.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo(second) did not return EInternalContext context type"));
       
  3787 
       
  3788 	// Deactivate context 1 
       
  3789 	TExtEtelRequestStatus deactivateStatus(packetService, EPacketContextDeactivate);
       
  3790 	CleanupStack::PushL(deactivateStatus);
       
  3791 	packetContext.Deactivate(deactivateStatus);			
       
  3792 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateStatus, ETimeMedium),	KErrNone, 
       
  3793 					_L("RPacketContext::Deactivate timed out"));
       
  3794 	ASSERT_EQUALS(deactivateStatus.Int(), KErrNone, 
       
  3795 					_L("RPacketContext::Deactivate returned an error"));		
       
  3796 	
       
  3797 	// Check RPacketService::GetStatus returns EStatusActive
       
  3798 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3799 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3800 
       
  3801 	// Check RPacketService::EnumerateNifs returns aCount, 2
       
  3802 	packetService.EnumerateNifs(enumerateNifsSt,numNif);
       
  3803 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsSt, ETimeMedium), KErrNone,
       
  3804 					_L("PacketService::EnumerateNifs timed out."));   
       
  3805 	ASSERT_EQUALS(enumerateNifsSt.Int(),KErrNone, 
       
  3806 					_L("RPacketService::EnumerateNifs returned an error"));
       
  3807 	ASSERT_EQUALS(numNif,2, 
       
  3808 					_L("RPacketService::EnumerateNifs did not return count as 2"));
       
  3809 
       
  3810 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context 1
       
  3811 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt, contextName, numContexts);
       
  3812 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt, ETimeMedium), KErrNone,
       
  3813 					_L("PacketService::EnumerateContextsInNif timed out."));   
       
  3814 	ASSERT_EQUALS(enumerateContextsInNifSt.Int(),KErrNone, 
       
  3815 					_L("RPacketService::EnumerateContextsInNif returned an error"));
       
  3816 	ASSERT_EQUALS(numContexts,1, 
       
  3817 					_L("RPacketService::EnumerateContextsInNif did not return count as 1"));
       
  3818 
       
  3819 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context 2
       
  3820 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt2, contextName2, numContexts);
       
  3821 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt2, ETimeMedium), KErrNone,
       
  3822 					_L("PacketService::EnumerateContextsInNif(second) timed out."));   
       
  3823 	ASSERT_EQUALS(enumerateContextsInNifSt2.Int(),KErrNone, 
       
  3824 					_L("RPacketService::EnumerateContextsInNif(second) returned an error"));
       
  3825 	ASSERT_EQUALS(numContexts,1, 
       
  3826 					_L("RPacketService::EnumerateContextsInNif(second) did not return count as 1"));
       
  3827 
       
  3828 	// Check RPacketService::GetContextNameInNif returns context 1 name when aExistingContextName=name of context 1 aIndex=0
       
  3829 	packetService.GetContextNameInNif(getContextNameInNifSt, contextName, 0, nameInNif);
       
  3830 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifSt, ETimeMedium), KErrNone,
       
  3831 					_L("PacketService::GetContextNameInNif timed out."));   
       
  3832 	ASSERT_EQUALS(getContextNameInNifSt.Int(),KErrNone, 
       
  3833 					_L("RPacketService::GetContextNameInNif returned an error"));
       
  3834 	ASSERT_TRUE(nameInNif.Length()>0, 
       
  3835 					_L("RPacketService::GetContextNameInNif did not return a valid context name"));
       
  3836 	
       
  3837 	// Check RPacketService::GetContextNameInNif returns context 2 name when aExistingContextName=name of context 2 aIndex=0
       
  3838 	packetService.GetContextNameInNif(getContextNameInNifSt2, contextName2, 0, nameInNif2);
       
  3839 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getContextNameInNifSt2, ETimeMedium), KErrNone,
       
  3840 					_L("PacketService::GetContextNameInNif(second) timed out."));   
       
  3841 	ASSERT_EQUALS(getContextNameInNifSt2.Int(),KErrNone, 
       
  3842 					_L("RPacketService::GetContextNameInNif(second) returned an error"));
       
  3843 	ASSERT_TRUE(nameInNif2.Length()>0, 
       
  3844 					_L("RPacketService::GetContextNameInNif did not return a valid context name"));
       
  3845 
       
  3846 	// Check RPacketService::GetNifInfo with aIndex=0 returns context name = name of context 1, iNumberOfContexts, 1 iNifStatus, EStatusInactive iPdpAddress, valid IP address iContextType, RPacketService::EInternalContext
       
  3847 	packetService.GetNifInfo(getNifInfoSt, 0, nifInfoPk);
       
  3848 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt, ETimeMedium), KErrNone,
       
  3849 					_L("PacketService::GetNifInfo timed out."));   
       
  3850 	ASSERT_EQUALS(getNifInfoSt.Int(),KErrNone, 
       
  3851 					_L("RPacketService::GetNifInfo returned an error"));
       
  3852 	ASSERT_EQUALS_DES16(nifInfo.iContextName, contextName, _L("RPacketService::GetNifInfo did not return the desired Context Name"));
       
  3853 	ASSERT_EQUALS(nifInfo.iNumberOfContexts , COUNT_ONE, _L("RPacketService::GetNifInfo did not return the number of contexts equal to one"));
       
  3854 	ASSERT_EQUALS(nifInfo.iNifStatus ,RPacketContext::EStatusInactive, _L("RPacketService::GetNifInfo did not return EStatusInactive"));
       
  3855 	ASSERT_TRUE(nifInfo.iPdpAddress.Length()> 0, _L("RPacketService::GetNifInfo did not return valis pdp address"));
       
  3856 	ASSERT_EQUALS(nifInfo.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo did not return EInternalContext context type"));
       
  3857 
       
  3858 	// Check RPacketService::GetNifInfo with aIndex=1 and context name = name of context 2 returns iNumberOfContexts, 1 iNifStatus, EStatusActive iPdpAddress, valid IP address iContextType, RPacketService::EInternalContext
       
  3859 	packetService.GetNifInfo(getNifInfoSt2, 1, nifInfoPk2);
       
  3860 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt2, ETimeMedium), KErrNone,
       
  3861 					_L("PacketService::GetNifInfo(second) timed out."));   
       
  3862 	ASSERT_EQUALS(getNifInfoSt2.Int(),KErrNone, 
       
  3863 					_L("RPacketService::GetNifInfo(second) returned an error"));
       
  3864 	ASSERT_EQUALS_DES16(nifInfo2.iContextName, contextName2, _L("RPacketService::GetNifInfo(second) did not return the desired Context Name"));
       
  3865 	ASSERT_EQUALS(nifInfo2.iNumberOfContexts , COUNT_ONE, _L("RPacketService::GetNifInfo(second) did not return the number of contexts equal to one"));
       
  3866 	ASSERT_EQUALS(nifInfo2.iNifStatus ,RPacketContext::EStatusActive, _L("RPacketService::GetNifInfo(second) did not return EStatusActive"));
       
  3867 	ASSERT_TRUE(nifInfo2.iPdpAddress.Length()> 0, _L("RPacketService::GetNifInfo(second) did not return valis pdp address"));
       
  3868 	ASSERT_EQUALS(nifInfo2.iContextType, RPacketService::EInternalContext, _L("RPacketService::GetNifInfo(second) did not return EInternalContext context type"));
       
  3869 
       
  3870 	// Post notification for packet service status change
       
  3871 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  3872 	CleanupStack::PushL(notifyStatusStatus); 
       
  3873 	RPacketService::TStatus packetServiceStatus;
       
  3874 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  3875 
       
  3876 	// Deactivate context 2 
       
  3877 	packetContext2.Deactivate(deactivateStatus);			
       
  3878 	ASSERT_EQUALS(WaitForRequestWithTimeOut(deactivateStatus, ETimeMedium),	KErrNone, 
       
  3879 					_L("RPacketContext::Deactivate timed out"));	
       
  3880 	ASSERT_EQUALS(deactivateStatus.Int(), KErrNone, 
       
  3881 					_L("RPacketContext::Deactivate returned an error"));		
       
  3882 	
       
  3883 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached -> EStatusInactive(it should be EStatusUnattached )
       
  3884 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  3885 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  3886 																	notifyStatusStatus,
       
  3887 																	packetServiceStatus,
       
  3888 																	expectedPacketServiceStatus,
       
  3889 																	KErrNone);
       
  3890 	
       
  3891 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  3892 	expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  3893 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  3894 																	notifyStatusStatus,
       
  3895 																	packetServiceStatus,
       
  3896 																	expectedPacketServiceStatus,
       
  3897 																	KErrNone);
       
  3898 
       
  3899 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  3900 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  3901 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  3902 
       
  3903 	// Check RPacketService::EnumerateNifs returns aCount, 2
       
  3904 	packetService.EnumerateNifs(enumerateNifsSt,numNif);
       
  3905 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateNifsSt, ETimeMedium), KErrNone,
       
  3906 					_L("PacketService::EnumerateNifs timed out."));   
       
  3907 	ASSERT_EQUALS(enumerateNifsSt.Int(),KErrNone, 
       
  3908 					_L("RPacketService::EnumerateNifs returned an error"));
       
  3909 	ASSERT_EQUALS(numNif,2, 
       
  3910 					_L("RPacketService::EnumerateNifs did not return count as 2"));
       
  3911 
       
  3912 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context 1
       
  3913 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt, contextName, numContexts);
       
  3914 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt, ETimeMedium), KErrNone,
       
  3915 					_L("PacketService::EnumerateContextsInNif timed out."));   
       
  3916 	ASSERT_EQUALS(enumerateContextsInNifSt.Int(),KErrNone, 
       
  3917 					_L("RPacketService::EnumerateContextsInNif returned an error"));
       
  3918 	ASSERT_EQUALS(numContexts,1, 
       
  3919 					_L("RPacketService::EnumerateContextsInNif did not return count as 1"));
       
  3920 	
       
  3921 	// Check RPacketService::EnumerateContextsInNif returns aCount, 1 when aExistingContextName, name of context 2
       
  3922 	packetService.EnumerateContextsInNif(enumerateContextsInNifSt2, contextName2, numContexts);
       
  3923 	ASSERT_EQUALS(WaitForRequestWithTimeOut(enumerateContextsInNifSt2, ETimeMedium), KErrNone,
       
  3924 					_L("PacketService::EnumerateContextsInNif(second) timed out."));   
       
  3925 	ASSERT_EQUALS(enumerateContextsInNifSt2.Int(),KErrNone, 
       
  3926 					_L("RPacketService::EnumerateContextsInNif(second) returned an error"));
       
  3927 	ASSERT_EQUALS(numContexts,1, 
       
  3928 					_L("RPacketService::EnumerateContextsInNif(second) did not return count as 1"));
       
  3929 
       
  3930 	// Check RPacketService::GetNifInfo with aIndex=0 returns context name = name of context 1, iNifStatus, EStatusInactive 
       
  3931 	packetService.GetNifInfo(getNifInfoSt, 0, nifInfoPk);
       
  3932 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt, ETimeMedium), KErrNone,
       
  3933 					_L("PacketService::GetNifInfo timed out."));   
       
  3934 	ASSERT_EQUALS(getNifInfoSt.Int(),KErrNone, 
       
  3935 					_L("RPacketService::GetNifInfo returned an error"));
       
  3936 	ASSERT_EQUALS_DES16(nifInfo.iContextName, contextName, _L("RPacketService::GetNifInfo did not return the desired Context Name"));
       
  3937 	ASSERT_EQUALS(nifInfo.iNifStatus ,RPacketContext::EStatusInactive, _L("RPacketService::GetNifInfo did not return EStatusInactive"));
       
  3938 	
       
  3939 	// Check RPacketService::GetNifInfo with aIndex=1 and context name = name of context 2 returns iNifStatus, EStatusInActive
       
  3940 	packetService.GetNifInfo(getNifInfoSt2, 1, nifInfoPk2);
       
  3941 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getNifInfoSt2, ETimeMedium), KErrNone,
       
  3942 					_L("PacketService::GetNifInfo(second) timed out."));   
       
  3943 	ASSERT_EQUALS(getNifInfoSt2.Int(),KErrNone, 
       
  3944 					_L("RPacketService::GetNifInfo(second) returned an error"));
       
  3945 	ASSERT_EQUALS_DES16(nifInfo2.iContextName, contextName2, _L("RPacketService::GetNifInfo(second) did not return the desired Context Name"));
       
  3946 	ASSERT_EQUALS(nifInfo2.iNifStatus ,RPacketContext::EStatusInactive, _L("RPacketService::GetNifInfo(second) did not return EStatusInactive"));
       
  3947 		
       
  3948 	//
       
  3949 	// TEST END
       
  3950 	//
       
  3951 
       
  3952     StartCleanup();
       
  3953 	
       
  3954 	// Pop:
       
  3955     // notifyContextAddedStatus
       
  3956     // notifyContextAddedStatus2
       
  3957     // enumerateNifsSt
       
  3958     // enumerateContextsInNifSt
       
  3959     // enumerateContextsInNifSt2
       
  3960     // getContextNameInNifSt
       
  3961     // getContextNameInNifSt2
       
  3962     // getNifInfoSt
       
  3963     // getNifInfoSt2
       
  3964     // deactivateStatus
       
  3965     // notifyStatusStatus
       
  3966 	CleanupStack::PopAndDestroy(11,&notifyContextAddedStatus);
       
  3967 	
       
  3968 	return TestStepResult();
       
  3969 	}
       
  3970 
       
  3971 TPtrC CCTSYIntegrationTestPacketService0020::GetTestStepName()
       
  3972 /**
       
  3973  * @return The test step name.
       
  3974  */
       
  3975 	{
       
  3976 	return _L("CCTSYIntegrationTestPacketService0020");
       
  3977 	}
       
  3978 
       
  3979 
       
  3980 
       
  3981 CCTSYIntegrationTestPacketService0021::CCTSYIntegrationTestPacketService0021(CEtelSessionMgr& aEtelSessionMgr)
       
  3982 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  3983 /**
       
  3984  * Constructor.
       
  3985  */
       
  3986 	{
       
  3987 	SetTestStepName(CCTSYIntegrationTestPacketService0021::GetTestStepName());
       
  3988 	}
       
  3989 
       
  3990 CCTSYIntegrationTestPacketService0021::~CCTSYIntegrationTestPacketService0021()
       
  3991 /**
       
  3992  * Destructor.
       
  3993  */
       
  3994 	{
       
  3995 	}
       
  3996 
       
  3997 TVerdict CCTSYIntegrationTestPacketService0021::doTestStepL()
       
  3998 /**
       
  3999  * @SYMTestCaseID BA-CTSY-INT-PKTS-0021
       
  4000  * @SYMFssID BA/CTSY/PKTS-0021
       
  4001  * @SYMTestCaseDesc Detach from packet service when already detached.
       
  4002  * @SYMTestPriority High
       
  4003  * @SYMTestActions RPacketService::GetStatus, RPacketService::SetAttachMode, RPacketService::GetAttachMode
       
  4004  * @SYMTestExpectedResults Pass - Detach fails.
       
  4005  * @SYMTestType CIT
       
  4006  * @SYMTestCaseDependencies live/automatic
       
  4007  *
       
  4008  * Reason for test: Verify detach fails.
       
  4009  *
       
  4010  * @return - TVerdict code
       
  4011  */
       
  4012 	{
       
  4013 
       
  4014 	//
       
  4015 	// SET UP
       
  4016 	//
       
  4017 
       
  4018 	
       
  4019 
       
  4020 	//
       
  4021 	// SET UP END
       
  4022 	//
       
  4023 	
       
  4024 	StartTest();
       
  4025 	
       
  4026 	//
       
  4027 	// TEST START
       
  4028 	//
       
  4029 		
       
  4030 	
       
  4031 	// Get packet service 
       
  4032 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4033 
       
  4034 	// Set attach mode to EAttachWhenNeeded 
       
  4035 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  4036 	CleanupStack::PushL(setAttachModeStatus);	
       
  4037 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  4038 	ASSERT_EQUALS (WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone, 
       
  4039 					_L("PacketService::SetAttachMode timed out."));								
       
  4040 	ASSERT_EQUALS(setAttachModeStatus.Int(), KErrNone, 
       
  4041 					_L("PacketService::SetAttachMode returned an error"));		
       
  4042 	
       
  4043 	// Check RPacketService::GetAttachMode returns EAttachWhenNeeded
       
  4044 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);	
       
  4045 	CleanupStack::PushL(getAttachModeStatus);
       
  4046 	RPacketService::TAttachMode attachMode;
       
  4047 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  4048 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  4049 					_L("PacketService;:GetAttachMode timed out"));
       
  4050 	ASSERT_EQUALS(getAttachModeStatus.Int(), KErrNone, 
       
  4051 					_L("PacketService::GetAttachMode returned an error"));
       
  4052 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  4053 					_L("PacketService::GetAttachMode did not return an EAttachWhenNeeded"));
       
  4054 
       
  4055 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  4056 	RPacketService::TStatus currentStatus;
       
  4057     ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  4058 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus  did not return EStatusUnattached"));
       
  4059 	
       
  4060 	// Check RPacketService::Detach returns KErrAlreadyExists
       
  4061 	TExtEtelRequestStatus detachStatus(packetService,EPacketDetach);
       
  4062 	CleanupStack::PushL(detachStatus);
       
  4063 	packetService.Detach(detachStatus);
       
  4064 	ASSERT_EQUALS(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone,
       
  4065 					_L("PacketService::Detach timed out."));    
       
  4066 	ASSERT_EQUALS(detachStatus.Int(),KErrAlreadyExists, 
       
  4067 					_L("RPacketService::Detach did not returned KErrAlreadyExists"));
       
  4068 
       
  4069 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  4070 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  4071 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusUnattached, _L("RPacketService::GetStatus did not return EStatusUnattached"));
       
  4072 
       
  4073 	//
       
  4074 	// TEST END
       
  4075 	//
       
  4076 
       
  4077     StartCleanup();
       
  4078 	
       
  4079 	// Pop:
       
  4080 	// setAttachModeStatus
       
  4081 	// getAttachModeStatus
       
  4082 	// detachStatus
       
  4083 	CleanupStack::PopAndDestroy(3,&setAttachModeStatus);
       
  4084 	
       
  4085 	
       
  4086 	return TestStepResult();
       
  4087 	}
       
  4088 
       
  4089 TPtrC CCTSYIntegrationTestPacketService0021::GetTestStepName()
       
  4090 /**
       
  4091  * @return The test step name.
       
  4092  */
       
  4093 	{
       
  4094 	return _L("CCTSYIntegrationTestPacketService0021");
       
  4095 	}
       
  4096 
       
  4097 
       
  4098 
       
  4099 CCTSYIntegrationTestPacketService0022::CCTSYIntegrationTestPacketService0022(CEtelSessionMgr& aEtelSessionMgr)
       
  4100 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  4101 /**
       
  4102  * Constructor.
       
  4103  */
       
  4104 	{
       
  4105 	SetTestStepName(CCTSYIntegrationTestPacketService0022::GetTestStepName());
       
  4106 	}
       
  4107 
       
  4108 CCTSYIntegrationTestPacketService0022::~CCTSYIntegrationTestPacketService0022()
       
  4109 /**
       
  4110  * Destructor.
       
  4111  */
       
  4112 	{
       
  4113 	}
       
  4114 
       
  4115 TVerdict CCTSYIntegrationTestPacketService0022::doTestStepL()
       
  4116 /**
       
  4117  * @SYMTestCaseID BA-CTSY-INT-PKTS-0022
       
  4118  * @SYMFssID BA/CTSY/PKTS-0022
       
  4119  * @SYMTestCaseDesc Automatic attach and detach when attach mode is changed.
       
  4120  * @SYMTestPriority High
       
  4121  * @SYMTestActions RPacketService::NotifyAttachModeChange, RPacketService::GetAttachMode, RPacketService::NotifyStatusChange, RPacketService::GetStatus
       
  4122  * @SYMTestExpectedResults Pass - Attach mode set successfully. Packet service automatically attaches and detaches depending on mode.
       
  4123  * @SYMTestType CIT
       
  4124  * @SYMTestCaseDependencies live/automatic
       
  4125  *
       
  4126  * Reason for test: Verify when attach mode is set to RPacketService::EAttachWhenNeeded, packet service detaches when there are no contexts active.
       
  4127  *
       
  4128  * @return - TVerdict code
       
  4129  */
       
  4130 	{
       
  4131 
       
  4132 	//
       
  4133 	// SET UP
       
  4134 	//
       
  4135 
       
  4136 	// Get packet service
       
  4137 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4138 
       
  4139 	// Ensure packet service status is EStatusUnattached
       
  4140 	RPacketService::TStatus setUpStatus;
       
  4141 	CHECK_EQUALS_L(packetService.GetStatus(setUpStatus), KErrNone, 
       
  4142 					_L("PacketService::GetStatus returned an error"));
       
  4143 	TExtEtelRequestStatus detachStatus(packetService, EPacketDetach);
       
  4144 	CleanupStack::PushL(detachStatus);
       
  4145 	TExtEtelRequestStatus serviceStatus(packetService, EPacketNotifyStatusChange);
       
  4146 	CleanupStack::PushL(serviceStatus);
       
  4147 	
       
  4148 	if (setUpStatus != RPacketService::EStatusUnattached)
       
  4149 		{
       
  4150 		packetService.NotifyStatusChange(serviceStatus, setUpStatus);
       
  4151 		User::After(2*KOneSecond); // With TRP, the notify isn't getting through before the detach req
       
  4152 		packetService.Detach(detachStatus);
       
  4153 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone, 	
       
  4154 						_L("PacketService::Detach timed out"));
       
  4155 		CHECK_TRUE_L(detachStatus.Int()== KErrNone|| KErrAlreadyExists, 
       
  4156 						_L("PacketService::Detach returned an error"));										
       
  4157 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(serviceStatus, ETimeMedium), KErrNone, 
       
  4158 						_L("PacketService::NotifyStatusChange timed out"));
       
  4159 		CHECK_EQUALS_L(serviceStatus.Int(), KErrNone, 
       
  4160 						_L("PacketService::NotifyStatusChange returned an error"));										
       
  4161 		}
       
  4162 		
       
  4163 	CHECK_EQUALS_L(setUpStatus, RPacketService::EStatusUnattached, _L("SET UP Packet service should be detached at this point"));
       
  4164 	
       
  4165 	// Ensure attach mode is RPacketService::EAttachWhenNeeded
       
  4166 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenNeeded; 
       
  4167 	EnsureAttachModeL(packetService,attachMode);
       
  4168 
       
  4169 	
       
  4170 	//
       
  4171 	// SET UP END
       
  4172 	//
       
  4173 
       
  4174 	StartTest();
       
  4175 
       
  4176 	//
       
  4177 	// TEST START
       
  4178 	//
       
  4179 
       
  4180 	// Post notification for packet service status change
       
  4181 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  4182 	CleanupStack::PushL(notifyStatusStatus); 
       
  4183 	RPacketService::TStatus packetServiceStatus;
       
  4184 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  4185 			
       
  4186 	// Set attach mode to EAttachWhenPossible
       
  4187 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);	
       
  4188 	CleanupStack::PushL(setAttachModeStatus);
       
  4189 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  4190 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone,
       
  4191 					_L("PacketService::SetAttachMode timed out."));
       
  4192 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
  4193 					_L("PacketService::SetAttachMode returned an error"));	
       
  4194 	
       
  4195 	// Check RPacketService::GetAttachMode returns EAttachWhenPossible
       
  4196 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);	
       
  4197 	CleanupStack::PushL(getAttachModeStatus);
       
  4198 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  4199 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  4200 					_L("PacketService::GetAttachMode timed out."));
       
  4201 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  4202 					_L("PacketService::GetAttachMode returned an error"));
       
  4203 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenPossible, 
       
  4204 					_L("PacketService::GetAttachMode did not return RPacketService::EAttachWhenPossible"));
       
  4205 
       
  4206 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  4207 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  4208 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  4209 																	notifyStatusStatus,
       
  4210 																	packetServiceStatus,
       
  4211 																	expectedPacketServiceStatus,
       
  4212 																	KErrNone);
       
  4213 			
       
  4214 	// Check RPacketService::GetStatus completes with EStatusAttached
       
  4215 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, 
       
  4216 					_L("PacketService::GetStatus returned an error"));
       
  4217 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusAttached, 
       
  4218 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
  4219 
       
  4220 	// Post notification for status change
       
  4221 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);	
       
  4222 				
       
  4223 	// Set attach mode to EAttachWhenNeeded
       
  4224 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  4225 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone,
       
  4226 					_L("PacketService::SetAttachMode Timed out"));
       
  4227 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
  4228 					_L("PacketService::SetAttachMode returned an error."));	
       
  4229 		
       
  4230 	// Check RPacketService::GetAttachMode returns EAttachWhenNeeded
       
  4231 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  4232 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  4233 					_L("PacketService::GetAttachMode Timed out"));
       
  4234 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  4235 					_L("PacketService::GetAttachMode returned an error."));
       
  4236 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  4237 					_L("PacketService::GetAttachMode did not return RPacketService::EAttachWhenNeeded"));
       
  4238 	
       
  4239 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  4240 	expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  4241 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  4242 																	notifyStatusStatus,
       
  4243 																	packetServiceStatus,
       
  4244 																	expectedPacketServiceStatus,
       
  4245 																	KErrNone);
       
  4246 				
       
  4247 	// Check RPacketService::GetStatus completes with EStatusUnattached
       
  4248 	ASSERT_EQUALS(packetService.GetStatus(packetServiceStatus), KErrNone, 
       
  4249 					_L("PacketService::GetStatus returned an error"));
       
  4250 	ASSERT_EQUALS(packetServiceStatus, RPacketService::EStatusUnattached, 
       
  4251 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));
       
  4252 
       
  4253 	// 
       
  4254 	// TEST END
       
  4255 	//
       
  4256 
       
  4257 	StartCleanup();    
       
  4258     
       
  4259     // Pop:
       
  4260     // detachStatus
       
  4261 	// serviceStatus
       
  4262  	// notifyStatusStatus
       
  4263 	// setAttachModeStatus 
       
  4264 	// getAttachModeStatus
       
  4265 	CleanupStack::PopAndDestroy(5, &detachStatus);
       
  4266 
       
  4267 	return TestStepResult();
       
  4268 	}
       
  4269 
       
  4270 TPtrC CCTSYIntegrationTestPacketService0022::GetTestStepName()
       
  4271 /**
       
  4272  * @return The test step name.
       
  4273  */
       
  4274 	{
       
  4275 	return _L("CCTSYIntegrationTestPacketService0022");
       
  4276 	}
       
  4277 
       
  4278 
       
  4279 
       
  4280 CCTSYIntegrationTestPacketService0023::CCTSYIntegrationTestPacketService0023(CEtelSessionMgr& aEtelSessionMgr)
       
  4281 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  4282 /**
       
  4283  * Constructor.
       
  4284  */
       
  4285 	{
       
  4286 	SetTestStepName(CCTSYIntegrationTestPacketService0023::GetTestStepName());
       
  4287 	}
       
  4288 
       
  4289 CCTSYIntegrationTestPacketService0023::~CCTSYIntegrationTestPacketService0023()
       
  4290 /**
       
  4291  * Destructor.
       
  4292  */
       
  4293 	{
       
  4294 	}
       
  4295 
       
  4296 TVerdict CCTSYIntegrationTestPacketService0023::doTestStepL()
       
  4297 /**
       
  4298  * @SYMTestCaseID BA-CTSY-INT-PKTS-0023
       
  4299  * @SYMFssID BA/CTSY/PKTS-0023
       
  4300  * @SYMTestCaseDesc Set attach mode to RPacketService::EAttachWhenNeeded when attached.
       
  4301  * @SYMTestPriority High
       
  4302  * @SYMTestActions RPacketService::NotifyAttachModeChange, RPacketService::GetAttachMode, RPacketService::GetNtwkRegStatus, RPacketService::GetDynamicCaps, RPacketService::GetStatus
       
  4303  * @SYMTestExpectedResults Pass - Attach mode set successfully.
       
  4304  * @SYMTestType CIT
       
  4305  * @SYMTestCaseDependencies live/automatic
       
  4306  *
       
  4307  * Reason for test: Verify attach mode is set correctly when there is at least one context active.
       
  4308  *
       
  4309  * @return - TVerdict code
       
  4310  */
       
  4311 	{
       
  4312 
       
  4313 	//
       
  4314 	// SET UP
       
  4315 	//
       
  4316 
       
  4317 	// Get Packet Service
       
  4318 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4319 
       
  4320 	// Get mobile phone
       
  4321 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
  4322 	
       
  4323 	// Register with the home network
       
  4324 	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
  4325 	
       
  4326 	// Ensure there is one context active. 
       
  4327 	RPacketContext& packetContext = iEtelSessionMgr.GetPrimaryPacketContextL(KMainServer,
       
  4328 																			 KMainPhone,
       
  4329 																			 KMainPacketService,
       
  4330 																			 KPrimaryPacketContext1); 
       
  4331 	// Activate primary Context
       
  4332 	iPacketServiceTestHelper.ActivatePrimaryPacketContextL(mobilePhone, packetContext );
       
  4333 	
       
  4334 	// Ensure RPacketService::GetStatus returns EStatusActive
       
  4335 	RPacketService::TStatus currentStatus;
       
  4336 	CHECK_EQUALS_L(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  4337 	CHECK_EQUALS_L(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  4338 	
       
  4339 	// Ensure RPacketService::GetAttachMode is EAttachWhenPossible 
       
  4340 	RPacketService::TAttachMode attachMode= RPacketService::EAttachWhenPossible; 
       
  4341 	EnsureAttachModeL(packetService,attachMode);
       
  4342 	
       
  4343 	//
       
  4344 	// SET UP END
       
  4345 	//
       
  4346 	
       
  4347 	StartTest();
       
  4348 	
       
  4349 	//
       
  4350 	// TEST START
       
  4351 	//
       
  4352 		
       
  4353 	
       
  4354 	// Check RPacketService::GetStatus returns EStatusActive
       
  4355 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  4356 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  4357 
       
  4358 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsRxCSCall
       
  4359 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  4360 	RPacketService::TDynamicCapsFlags dynCaps = 0;		
       
  4361 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  4362 					_L("PacketService::GetDynamicCaps returned an error"));
       
  4363 	RPacketService::TDynamicCapsFlags expectedCaps = RPacketService::KCapsSMSTransfer| 
       
  4364 													RPacketService::KCapsRxContextActivationReq |
       
  4365 													RPacketService::KCapsRxCSCall ;
       
  4366 	RPacketService::TDynamicCapsFlags unwantedCaps = RPacketService::KCapsManualAttach; 
       
  4367 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,          
       
  4368 					_L("PacketService::GetDynamicCaps Wrong dynamic caps"));
       
  4369 
       
  4370 	// RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork 
       
  4371 	TExtEtelRequestStatus regStatus(packetService, EPacketGetNtwkRegStatus);
       
  4372 	CleanupStack::PushL(regStatus);
       
  4373 	RPacketService::TRegistrationStatus registrationStatus;
       
  4374 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  4375 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
  4376 					_L("PacketService::GetNtwkRegStatus timed out"));
       
  4377 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  4378 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
  4379 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
  4380 	    			_L("PacketService::GetNtwkRegStatus Wrong registration status"));
       
  4381 
       
  4382 	// Post notification for attach mode change
       
  4383 	TExtEtelRequestStatus notifyAttachModeChangeStatus(packetService, EPacketNotifyAttachModeChange);
       
  4384 	CleanupStack::PushL(notifyAttachModeChangeStatus);
       
  4385 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
  4386 
       
  4387 	// Set attach mode to RPacketService::EAttachWhenNeeded
       
  4388 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  4389 	CleanupStack::PushL(setAttachModeStatus);	
       
  4390 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  4391 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone,
       
  4392 					_L("PacketService::SetAttachMode timed out."));
       
  4393 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
  4394 					_L("PacketService::SetAttachMode returned an error"));
       
  4395 		
       
  4396 	// Check RPacketService::NotifyAttachModeChange completes with RPacketService::EAttachWhenNeeded
       
  4397 	RPacketService::TAttachMode expectedAttachMode = RPacketService::EAttachWhenNeeded;
       
  4398 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
  4399 																		notifyAttachModeChangeStatus,
       
  4400 																		attachMode,
       
  4401 																		expectedAttachMode,
       
  4402 																		KErrNone);
       
  4403 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
  4404 	
       
  4405 	// Check RPacketService::GetAttachMode returns EAttachWhenNeeded 
       
  4406 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);	
       
  4407 	CleanupStack::PushL(getAttachModeStatus);
       
  4408 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  4409 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  4410 					_L("PacketService;:GetAttachMode timed out"));
       
  4411 	ASSERT_EQUALS(getAttachModeStatus.Int(), KErrNone, 
       
  4412 					_L("PacketService::GetAttachMode returned an error"));
       
  4413 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  4414 					_L("PacketService::GetAttachMode did not return EAttachWhenNeeded"));
       
  4415 		
       
  4416 	// Chek RPacketService::GetStatus returns EStatusActive
       
  4417 	ASSERT_EQUALS(packetService.GetStatus(currentStatus), KErrNone, _L("RPacketService::GetStatus returned an error"));
       
  4418 	ASSERT_EQUALS(currentStatus, RPacketService::EStatusActive, _L("RPacketService::GetStatus  did not return EStautusActive"));
       
  4419 
       
  4420 	// Check RPacketService::GetDynamicCaps returns caps in set of RPacketService::KCapsSMSTransfer | RPacketService::KCapsRxContextActivationReq | RPacketService::KCapsRxCSCall
       
  4421 	// Check RPacketService::GetDynamicCaps returns caps NOT in set of RPacketService::KCapsManualAttach
       
  4422 	ASSERT_EQUALS(packetService.GetDynamicCaps(dynCaps), KErrNone, 
       
  4423 					_L("PacketService::GetDynamicCaps returned an error"));
       
  4424 	expectedCaps = RPacketService::KCapsSMSTransfer| 
       
  4425 				   RPacketService::KCapsRxContextActivationReq |
       
  4426 				   RPacketService::KCapsRxCSCall ;
       
  4427 	unwantedCaps = RPacketService::KCapsManualAttach; 
       
  4428 	ASSERT_BITS_SET(dynCaps, expectedCaps, unwantedCaps,          
       
  4429 					_L("PacketService::GetDynamicCaps Wrong dynamic caps"));
       
  4430 
       
  4431 	// RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork 
       
  4432 	packetService.GetNtwkRegStatus(regStatus, registrationStatus);
       
  4433 	ASSERT_EQUALS(WaitForRequestWithTimeOut(regStatus, ETimeMedium),KErrNone, 
       
  4434 					_L("PacketService::GetNtwkRegStatus timed out"));
       
  4435 	ASSERT_EQUALS(regStatus.Int(), KErrNone, 
       
  4436 	    			_L("PacketService::GetNtwkRegStatus returned an error"));
       
  4437 	ASSERT_EQUALS(registrationStatus, RPacketService::ERegisteredOnHomeNetwork, 
       
  4438 	    			_L("PacketService::GetNtwkRegStatus Wrong registration status"));
       
  4439 
       
  4440 	//
       
  4441 	// TEST END
       
  4442 	//
       
  4443 
       
  4444     StartCleanup();
       
  4445 	
       
  4446 	// Pop:
       
  4447 	// regStatus
       
  4448 	// notifyAttachModeChangeStatus
       
  4449     // setAttachModeStatus
       
  4450     // getAttachModeStatus
       
  4451 	CleanupStack::PopAndDestroy(4, &regStatus);
       
  4452 	
       
  4453 	return TestStepResult();
       
  4454 	}
       
  4455 
       
  4456 TPtrC CCTSYIntegrationTestPacketService0023::GetTestStepName()
       
  4457 /**
       
  4458  * @return The test step name.
       
  4459  */
       
  4460 	{
       
  4461 	return _L("CCTSYIntegrationTestPacketService0023");
       
  4462 	}
       
  4463 
       
  4464 
       
  4465 
       
  4466 CCTSYIntegrationTestPacketService0024::CCTSYIntegrationTestPacketService0024(CEtelSessionMgr& aEtelSessionMgr)
       
  4467 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  4468 /**
       
  4469  * Constructor.
       
  4470  */
       
  4471 	{
       
  4472 	SetTestStepName(CCTSYIntegrationTestPacketService0024::GetTestStepName());
       
  4473 	}
       
  4474 
       
  4475 CCTSYIntegrationTestPacketService0024::~CCTSYIntegrationTestPacketService0024()
       
  4476 /**
       
  4477  * Destructor.
       
  4478  */
       
  4479 	{
       
  4480 	}
       
  4481 
       
  4482 TVerdict CCTSYIntegrationTestPacketService0024::doTestStepL()
       
  4483 /**
       
  4484  * @SYMTestCaseID BA-CTSY-INT-PKTS-0024
       
  4485  * @SYMFssID BA/CTSY/PKTS-0024
       
  4486  * @SYMTestCaseDesc Register with packet network fail when roaming.
       
  4487  * @SYMTestPriority High
       
  4488  * @SYMTestActions RPacketService::GetStatus, RPacketService::NotifyChangeOfNtwkRegStatus, RPacketService::GetNtwkRegStatus
       
  4489  * @SYMTestExpectedResults Pass - Phone not registered to packet network.
       
  4490  * @SYMTestType CIT
       
  4491  * @SYMTestCaseDependencies simulated/manual
       
  4492  *
       
  4493  * Reason for test: Verify packet service is detached and phone is not registered on packet network moving to from cell with packet network roaming to one without.
       
  4494  *
       
  4495  * @return - TVerdict code
       
  4496  */
       
  4497 	{
       
  4498 
       
  4499 	//
       
  4500 	// SET UP
       
  4501 	//
       
  4502 
       
  4503 	
       
  4504 
       
  4505 	//
       
  4506 	// SET UP END
       
  4507 	//
       
  4508 	
       
  4509 	StartTest();
       
  4510 	
       
  4511 	//
       
  4512 	// TEST START
       
  4513 	//
       
  4514 	
       
  4515 	
       
  4516 	// Simulate phone roaming in a 3G cell which supports packet network roaming. 
       
  4517 
       
  4518 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredRoaming
       
  4519 
       
  4520 	// Check RPacketService::GetStatus returns EStatusAttached
       
  4521 
       
  4522 	// Simulate phone moving into a new 3G cell which does not allow packet network roaming. 
       
  4523 
       
  4524 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  4525 
       
  4526 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  4527 
       
  4528 	// Check RPacketService::NotifyChangeOfNtwkRegStatus completes with one of ENotRegisteredNotSearching | ENotRegisteredSearching | ERegistrationDenied | ENotRegisteredAndNotAvailable
       
  4529 
       
  4530 	// Check RPacketService::GetNtwkRegStatus returns one of ENotRegisteredNotSearching | ENotRegisteredSearching | ERegistrationDenied | ENotRegisteredAndNotAvailable
       
  4531 
       
  4532 	
       
  4533 	//
       
  4534 	// TEST END
       
  4535 	//
       
  4536 
       
  4537     StartCleanup();
       
  4538 	
       
  4539 	// Put any required test clean up here, then remove this comment
       
  4540 	
       
  4541 	return TestStepResult();
       
  4542 	}
       
  4543 
       
  4544 TPtrC CCTSYIntegrationTestPacketService0024::GetTestStepName()
       
  4545 /**
       
  4546  * @return The test step name.
       
  4547  */
       
  4548 	{
       
  4549 	return _L("CCTSYIntegrationTestPacketService0024");
       
  4550 	}
       
  4551 
       
  4552 
       
  4553 
       
  4554 CCTSYIntegrationTestPacketService0025::CCTSYIntegrationTestPacketService0025(CEtelSessionMgr& aEtelSessionMgr)
       
  4555 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  4556 /**
       
  4557  * Constructor.
       
  4558  */
       
  4559 	{
       
  4560 	SetTestStepName(CCTSYIntegrationTestPacketService0025::GetTestStepName());
       
  4561 	}
       
  4562 
       
  4563 CCTSYIntegrationTestPacketService0025::~CCTSYIntegrationTestPacketService0025()
       
  4564 /**
       
  4565  * Destructor.
       
  4566  */
       
  4567 	{
       
  4568 	}
       
  4569 
       
  4570 TVerdict CCTSYIntegrationTestPacketService0025::doTestStepL()
       
  4571 /**
       
  4572  * @SYMTestCaseID BA-CTSY-INT-PKTS-0025
       
  4573  * @SYMFssID BA/CTSY/PKTS-0025
       
  4574  * @SYMTestCaseDesc Set preferred bearer to RPacketService::BearerPacketSwitched and RPacketService::EBearerCircuitSwitched when attach mode is RPacketService::EAttachWhenPossible in MS class C operation.
       
  4575  * @SYMTestPriority High
       
  4576  * @SYMTestActions RPacketService::NotifyMSClassChange, RPacketService::GetMSClass, RPacketService::SetAttachMode, RPacketService::NotifyAttachModeChange, RPacketService::GetAttachMode, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::SetPreferredBearer, RPacketService::GetPreferredBearer
       
  4577  * @SYMTestExpectedResults Pass - In class C operation, packet service status depends on preferred bearer.
       
  4578  * @SYMTestType CIT
       
  4579  * @SYMTestCaseDependencies live/automatic
       
  4580  *
       
  4581  * Reason for test: Verify when attach mode is RPacketService::EAttachWhenPossible and there are no contexts active, status of packet service depends on preferred bearer.
       
  4582  *
       
  4583  * @return - TVerdict code
       
  4584  */
       
  4585 	{
       
  4586 
       
  4587 	//
       
  4588 	// SET UP
       
  4589 	//
       
  4590 	// Note: please dont review this code as this test case is priority 4, so we are not dealing them any more
       
  4591 	// Get packet service
       
  4592 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4593 					
       
  4594 	// Ensure MS class is not RPacketService::EMSClassAlternateMode with RPacketService::GetMSClass		
       
  4595 	TExtEtelRequestStatus getMSClassStatus(packetService, EPacketGetMSClass);
       
  4596 	CleanupStack::PushL(getMSClassStatus);
       
  4597 	RPacketService::TMSClass msClass;
       
  4598 	RPacketService::TMSClass msMax;
       
  4599 	packetService.GetMSClass(getMSClassStatus,msClass, msMax);
       
  4600 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone, 
       
  4601 					_L("PacketService::GetMSClass timedout"));
       
  4602 	CHECK_EQUALS_L(getMSClassStatus.Int(), KErrNone, 
       
  4603 					_L("packetService::GetMSClass returned an error"));											
       
  4604 				
       
  4605 	TExtEtelRequestStatus setMSClassStatus(packetService, EPacketSetMSClass);
       
  4606 	CleanupStack::PushL(setMSClassStatus);	
       
  4607 	if (msClass == RPacketService::EMSClassAlternateMode)	
       
  4608 		{
       
  4609 		msClass = RPacketService::EMSClassDualMode;
       
  4610 		packetService.SetMSClass(setMSClassStatus,msClass);	
       
  4611 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone, 
       
  4612 						_L("PacketService::SetMSClass timed out"));
       
  4613 		CHECK_EQUALS_L(setMSClassStatus.Int(), KErrNone, 
       
  4614 						_L("PacketService::SetMSClass returned an error"));												
       
  4615 		User::After(ETimeMedium); // we need this to get consistent responses from the H2		
       
  4616 		packetService.GetMSClass(getMSClassStatus,msClass,msMax);	
       
  4617 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone, 
       
  4618 						_L("PacketService::GetMSClass timed out"));
       
  4619 		CHECK_EQUALS_L(getMSClassStatus.Int(), KErrNone, 
       
  4620 						_L("PacketService::GetMSClass returned an error"));												
       
  4621 		}
       
  4622 	
       
  4623 	CHECK_TRUE_L((msClass != RPacketService::EMSClassAlternateMode), 
       
  4624 			_L("RPacketService::EMSClassAlternateMode SET UP Wrong MS class"));
       
  4625 		
       
  4626 	//
       
  4627 	// SET UP END
       
  4628 	//
       
  4629 
       
  4630 	StartTest();
       
  4631 
       
  4632 	//
       
  4633 	// TEST START
       
  4634 	//
       
  4635 
       
  4636 	// Post Notification for MS Class Change
       
  4637 	TExtEtelRequestStatus notifyMSClassChangeStatus(packetService, EPacketNotifyMSClassChange);
       
  4638 	CleanupStack::PushL(notifyMSClassChangeStatus);
       
  4639 	RPacketService::TMSClass newClass;
       
  4640 	packetService.NotifyMSClassChange(notifyMSClassChangeStatus,newClass);
       
  4641 
       
  4642 	// Set MS class to RPacketService::EMSClassAlternateMode with RPacketService::SetMSClass
       
  4643 	msClass = RPacketService::EMSClassAlternateMode;
       
  4644 	packetService.SetMSClass(setMSClassStatus,msClass);		
       
  4645 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone,
       
  4646 		 			_L("PacketService::SetMSClass timed out."));			
       
  4647 	ASSERT_EQUALS(setMSClassStatus.Int(), KErrNone, 
       
  4648 					_L("PacketService::SetMSClassStatus returned an error"));
       
  4649 	
       
  4650 	// Check RPacketService::NotifyMSClassChange completes with RPacketService::EMSClassAlternateMode
       
  4651 	RPacketService::TMSClass expectedNewClass= RPacketService::EMSClassAlternateMode;
       
  4652 	iPacketServiceTestHelper.WaitForPacketServiceNotifyMSClassChange(packetService,
       
  4653 																	 notifyMSClassChangeStatus,
       
  4654 																	 newClass,
       
  4655 																	 expectedNewClass,
       
  4656 																	 KErrNone);
       
  4657 
       
  4658 	// Check RPacketService::GetMSClass returns RPacketService::EMSClassAlternateMode
       
  4659 	packetService.GetMSClass(getMSClassStatus,msClass, msMax);
       
  4660 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone,
       
  4661 					_L("PacketService::GetMSClass timedout"));
       
  4662 	ASSERT_EQUALS(getMSClassStatus.Int(), KErrNone, 
       
  4663 					_L("PacketService::GetMSClass returned and error"));
       
  4664 	ASSERT_EQUALS(newClass, RPacketService::EMSClassAlternateMode, 
       
  4665 					_L("PacketService::GetMSClass did not return RPacketService::EMSClassAlternateMode"));	
       
  4666 
       
  4667 	// Post notification for attach mode change
       
  4668 	TExtEtelRequestStatus notifyAttachModeChangeStatus(packetService, EPacketNotifyAttachModeChange);
       
  4669 	CleanupStack::PushL(notifyAttachModeChangeStatus);
       
  4670 	RPacketService::TAttachMode attachMode;
       
  4671 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
  4672 		
       
  4673 	// Set attach mode to EAttachWhenPossible with RPacketService::SetAttachMode.
       
  4674 	TExtEtelRequestStatus setAttachModeStatus(packetService,EPacketSetAttachMode);
       
  4675 	CleanupStack::PushL(setAttachModeStatus);
       
  4676 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  4677 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone,
       
  4678 					_L("PacketService::SetAttachMode timedout."));
       
  4679 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
  4680 					_L("PacketService::SetAttachMode returned an error"));
       
  4681 		
       
  4682 	// Check RPacketService::NotifyAttachModeChange completes with EAttachWhenPossible
       
  4683 	RPacketService::TAttachMode expectedAttachMode = RPacketService::EAttachWhenPossible;
       
  4684 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
  4685 																		notifyAttachModeChangeStatus,
       
  4686 																		attachMode,
       
  4687 																		expectedAttachMode,
       
  4688 																		KErrNone);
       
  4689 
       
  4690 	// Check RPacketService::GetAttachMode returns EAttachWhenPossible
       
  4691 	TExtEtelRequestStatus getAttachModeStatus(packetService, EPacketGetAttachMode);
       
  4692 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  4693 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  4694 					_L("PacketService::GetAttachMode timed out"));
       
  4695 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  4696 					_L("PacketService::GetAttachMode returned an error"));
       
  4697 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenPossible, 
       
  4698 					_L("PacketService::GetAttachMode did not return RPacketService::EAttachWhenPossible"));
       
  4699 
       
  4700 	// Check RPacketService::GetStatus returns EStatusAttached.
       
  4701 	RPacketService::TStatus serviceStatus;
       
  4702 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,
       
  4703 					_L("PacketService::GetStatus returned an error"));
       
  4704 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  4705 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
  4706 
       
  4707 	// Post notification for packet service status change
       
  4708 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  4709 	CleanupStack::PushL(notifyStatusStatus); 
       
  4710 	RPacketService::TStatus packetServiceStatus;
       
  4711 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  4712 
       
  4713 	// Set preferred bearer to EBearerCircuitSwitched.
       
  4714 	TExtEtelRequestStatus setBearerStatus(packetService, EPacketSetPrefBearer);
       
  4715 	
       
  4716 	RPacketService::TPreferredBearer bearer = RPacketService::EBearerCircuitSwitched;
       
  4717 	packetService.SetPreferredBearer(setBearerStatus,bearer);
       
  4718 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setBearerStatus, ETimeMedium), KErrNone,
       
  4719 					_L("PacketService::SetPreferredBearer timed out."));
       
  4720 	ASSERT_EQUALS(setBearerStatus.Int(), KErrNone, 
       
  4721 					_L("PacketService::SetPreferredBearer returned an error."));	
       
  4722 	
       
  4723 	// Check RPacketService::GetPreferredBearer returns EBearerCircuitSwitched
       
  4724 	TExtEtelRequestStatus getBearerStatus(packetService, EPacketGetPrefBearer);	
       
  4725 	RPacketService::TPreferredBearer newBearer;
       
  4726 	packetService.GetPreferredBearer(getBearerStatus,newBearer);
       
  4727 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getBearerStatus, ETimeMedium), KErrNone, 
       
  4728 					_L("PacketService::GetPreferredBearer timedout."));
       
  4729 	ASSERT_EQUALS(getBearerStatus.Int(), KErrNone, 
       
  4730 					_L("PacketService::GetPreferredBearer returned an error"));						 				
       
  4731 	ASSERT_EQUALS(newBearer, RPacketService::EBearerCircuitSwitched, 
       
  4732 					_L("PacketService::GetPreferredBearer did not return RPacketService::EBearerCircuitSwitched"));	
       
  4733 		
       
  4734 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  4735 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  4736 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  4737 																    notifyStatusStatus, 
       
  4738 																    serviceStatus, 
       
  4739 																    expectedPacketServiceStatus, 
       
  4740 																    KErrNone);	
       
  4741 			
       
  4742 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  4743 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone,	
       
  4744 					_L("PacketService::GetStatus returned an error"));
       
  4745 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  4746 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
  4747 
       
  4748 	// Post notification for packet service status change
       
  4749 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  4750 	
       
  4751 	// Set preferred bearer to EBearerPacketSwitched
       
  4752 	bearer = RPacketService::EBearerPacketSwitched;
       
  4753 	packetService.SetPreferredBearer(setBearerStatus,bearer);
       
  4754 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setBearerStatus, ETimeMedium), KErrNone,
       
  4755 					_L("PacketService::SetPreferredBearer timed out"));
       
  4756 	ASSERT_EQUALS(setBearerStatus.Int(), KErrNone, 
       
  4757 					_L("PacketService::SetPreferredBearer returned an error"));	
       
  4758 	
       
  4759 	// Check RPacketService::GetPreferredBearer returns EBearerPacketSwitched
       
  4760 	packetService.GetPreferredBearer(getBearerStatus,newBearer);
       
  4761 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getBearerStatus, ETimeMedium), KErrNone, 
       
  4762 					_L("PacketService::GetPreferredBearer timed out"));
       
  4763 	ASSERT_EQUALS(getBearerStatus.Int(), KErrNone, 
       
  4764 					_L("PacketService::GetPreferredBearer returned an error"));		 								
       
  4765 	ASSERT_EQUALS(newBearer, RPacketService::EBearerPacketSwitched, 
       
  4766 					_L("PacketService::GetPreferredBearer did not return RPacketService::EBearerPacketSwitched"));	
       
  4767 		
       
  4768 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  4769 	expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  4770 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  4771 																    notifyStatusStatus, 
       
  4772 																    serviceStatus, 
       
  4773 																    expectedPacketServiceStatus, 
       
  4774 																    KErrNone);
       
  4775 					
       
  4776 	// Check RPacketService::GetStatus returns EStatusAttached
       
  4777 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  4778 					_L("PacketService::GetStatus returned an error"));
       
  4779 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  4780 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
  4781 	
       
  4782 	// 
       
  4783 	// TEST END
       
  4784 	//
       
  4785 
       
  4786 	StartCleanup();
       
  4787     
       
  4788     // Pop:
       
  4789     // getMSClassStatus
       
  4790     // setMSClassStatus
       
  4791 	// notifyMSClassChangeStatus
       
  4792 	// notifyAttachModeChangeStatus
       
  4793 	// setAttachModeStatus
       
  4794 	// notifyStatusStatus    
       
  4795     
       
  4796 	CleanupStack::PopAndDestroy(6, &getMSClassStatus);
       
  4797 	return TestStepResult();
       
  4798 	}
       
  4799 
       
  4800 TPtrC CCTSYIntegrationTestPacketService0025::GetTestStepName()
       
  4801 /**
       
  4802  * @return The test step name.
       
  4803  */
       
  4804 	{
       
  4805 	return _L("CCTSYIntegrationTestPacketService0025");
       
  4806 	}
       
  4807 
       
  4808 
       
  4809 
       
  4810 CCTSYIntegrationTestPacketService0026::CCTSYIntegrationTestPacketService0026(CEtelSessionMgr& aEtelSessionMgr)
       
  4811 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  4812 /**
       
  4813  * Constructor.
       
  4814  */
       
  4815 	{
       
  4816 	SetTestStepName(CCTSYIntegrationTestPacketService0026::GetTestStepName());
       
  4817 	}
       
  4818 
       
  4819 CCTSYIntegrationTestPacketService0026::~CCTSYIntegrationTestPacketService0026()
       
  4820 /**
       
  4821  * Destructor.
       
  4822  */
       
  4823 	{
       
  4824 	}
       
  4825 
       
  4826 TVerdict CCTSYIntegrationTestPacketService0026::doTestStepL()
       
  4827 /**
       
  4828  * @SYMTestCaseID BA-CTSY-INT-PKTS-0026
       
  4829  * @SYMFssID BA/CTSY/PKTS-0026
       
  4830  * @SYMTestCaseDesc Set preferred bearer to RPacketService::BearerPacketSwitched and RPacketService::EBearerCircuitSwitched when attach mode is RPacketService::EAttachWhenNeeded in MS class C operation.
       
  4831  * @SYMTestPriority High
       
  4832  * @SYMTestActions RPacketService::SetMSClass, RPacketService::NotifyMSClassChange, RPacketService::GetMSClass, RPacketService::SetAttachMode, RPacketService::GetAttachMode, RPacketService::NotifyStatusChange, RPacketService::GetStatus, RPacketService::SetPreferredBearer, RPacketService::GetPreferredBearer
       
  4833  * @SYMTestExpectedResults Pass - In class C operation, packet service status depends on preferred bearer.
       
  4834  * @SYMTestType CIT
       
  4835  * @SYMTestCaseDependencies live/automatic
       
  4836  *
       
  4837  * Reason for test: Verify when attach mode is RPacketService::EAttachWhenNeeded and there are no contexts active, packet service is detached regardless of preferred bearer.
       
  4838  *
       
  4839  * @return - TVerdict code
       
  4840  */
       
  4841 	{
       
  4842    
       
  4843 	//
       
  4844 	// SET UP
       
  4845 	//
       
  4846 // Note: please dont review this code as this test case is priority 4, so we are not dealing them any more
       
  4847 	// Get packet service
       
  4848 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  4849 
       
  4850 	// Ensure packet service is EStatusUnattached with RPacketService::GetStatus
       
  4851 	TExtEtelRequestStatus serviceStatus(packetService, EPacketNotifyStatusChange);
       
  4852 	CleanupStack::PushL(serviceStatus);
       
  4853 	TExtEtelRequestStatus detachStatus(packetService, EPacketDetach);	
       
  4854 	CleanupStack::PushL(detachStatus);
       
  4855 	RPacketService::TStatus setUpStatus;
       
  4856 	CHECK_EQUALS_L(packetService.GetStatus(setUpStatus), KErrNone, 
       
  4857 					_L("PacketService::GetStatus returned an error"));
       
  4858 	if (setUpStatus != RPacketService::EStatusUnattached)
       
  4859 		{
       
  4860 		packetService.NotifyStatusChange(serviceStatus, setUpStatus);
       
  4861 		User::After(2*KOneSecond); // With TRP, the notify isn't getting through before the detach req
       
  4862 		packetService.Detach(detachStatus);
       
  4863 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(detachStatus, ETimeMedium), KErrNone,
       
  4864 						_L("PacketService::Detach timed out"));
       
  4865 		CHECK_EQUALS_L(detachStatus.Int(), KErrNone, 
       
  4866 						_L("PacketService::Detach returned an error"));										
       
  4867 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(serviceStatus, ETimeMedium), KErrNone, 
       
  4868 						_L("PacketService::NotifyStatusChange timed out"));
       
  4869 		CHECK_EQUALS_L(serviceStatus.Int(), KErrNone, 
       
  4870 						_L("PacketService::NotifyStatusChange returned an error"));
       
  4871 		}		
       
  4872 	CHECK_EQUALS_L(setUpStatus, RPacketService::EStatusUnattached, _L("SET UP Packet service should be detached"));
       
  4873 
       
  4874 	// Ensure MS class is not RPacketService::EMSClassAlternateMode with RPacketService::GetMSClass
       
  4875 	TExtEtelRequestStatus getMSClassStatus(packetService, EPacketGetMSClass);
       
  4876 	CleanupStack::PushL(getMSClassStatus);
       
  4877 	RPacketService::TMSClass msClass;
       
  4878 	RPacketService::TMSClass msMax;
       
  4879 	packetService.GetMSClass(getMSClassStatus,msClass, msMax);
       
  4880 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone,
       
  4881 					_L("PacketService::GetMSClass timed out"));
       
  4882 	CHECK_EQUALS_L(getMSClassStatus.Int(), KErrNone, 
       
  4883 					_L("PacketService::GetMSClass returned an error"));
       
  4884 	TExtEtelRequestStatus setMSClassStatus(packetService, EPacketSetMSClass);
       
  4885 	CleanupStack::PushL(setMSClassStatus);
       
  4886 	if (msClass == RPacketService::EMSClassAlternateMode)	
       
  4887 		{
       
  4888 		msClass = RPacketService::EMSClassDualMode;
       
  4889 		packetService.SetMSClass(setMSClassStatus,msClass);	
       
  4890 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone, 
       
  4891 						_L("PacketService::SetMSClass timed out"));		
       
  4892 		CHECK_EQUALS_L(setMSClassStatus.Int(), KErrNone, 
       
  4893 						_L("PacketService::SetMSClass returned an error"));
       
  4894 		User::After(ETimeMedium); // we need this to get consistent responses from the reference board
       
  4895 		packetService.GetMSClass(getMSClassStatus,msClass,msMax);	
       
  4896 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone,
       
  4897 						_L("PacketService::GetMSClass timed out"));					
       
  4898 		CHECK_EQUALS_L(getMSClassStatus.Int(), KErrNone, 
       
  4899 						_L("PacketService::GetMSClass returned an error"));
       
  4900 		}
       
  4901 	
       
  4902 	CHECK_TRUE_L((msClass != RPacketService::EMSClassAlternateMode), _L("SET UP Wrong MS class in set up"));		
       
  4903 		
       
  4904 	//
       
  4905 	// SET UP END
       
  4906 	//
       
  4907 
       
  4908 	StartTest();
       
  4909 
       
  4910 	//
       
  4911 	// TEST START
       
  4912 	//
       
  4913 
       
  4914 	// Set attach mode to EAttachWhenNeeded.
       
  4915 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  4916 	CleanupStack::PushL(setAttachModeStatus);
       
  4917 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  4918 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone, 
       
  4919 					_L("PacketService::SetAttachMode timed out."));
       
  4920 	ASSERT_EQUALS(setAttachModeStatus.Int(),KErrNone, 
       
  4921 					_L("PacketService::SetAttachMode returned an error"));	
       
  4922 	
       
  4923 	// Check RPacketService::GetAttachMode returns EAttachWhenNeeded
       
  4924 	TExtEtelRequestStatus getAttachModeStatus(packetService, EPacketGetAttachMode);
       
  4925 	CleanupStack::PushL(getAttachModeStatus);
       
  4926 	RPacketService::TAttachMode attachMode;
       
  4927 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  4928 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  4929 					_L("PacketService::GetAttachMode timed out."));
       
  4930 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  4931 					_L("PacketService::GetAttachMode returned an error"));
       
  4932 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  4933 					_L("PacketService::GetAttachMode did not return RPacketService::EAttachWhenNeeded"));
       
  4934 
       
  4935 	// Post Notification for MS Class Change
       
  4936 	TExtEtelRequestStatus notifyMSClassChangeStatus(packetService, EPacketNotifyMSClassChange);
       
  4937 	CleanupStack::PushL(notifyMSClassChangeStatus);
       
  4938 	RPacketService::TMSClass newClass;
       
  4939 	packetService.NotifyMSClassChange(notifyMSClassChangeStatus,newClass);
       
  4940 	
       
  4941 	// Set MS class to RPacketService::EMSClassAlternateMode with RPacketService::SetMSClass
       
  4942 	msClass = RPacketService::EMSClassAlternateMode;
       
  4943 	packetService.SetMSClass(setMSClassStatus,msClass);		
       
  4944 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone,
       
  4945 					_L("PacketService::SetMSClass timed out."));
       
  4946 	ASSERT_EQUALS(setMSClassStatus.Int(), KErrNone, 
       
  4947 					_L("PacketService::SetMSClass returned an error"));								
       
  4948 			
       
  4949 	// Check RPacketService::NotifyMSClassChange completes with RPacketService::EMSClassAlternateMode
       
  4950 	RPacketService::TMSClass expectedNewClass= RPacketService::EMSClassAlternateMode;
       
  4951 	iPacketServiceTestHelper.WaitForPacketServiceNotifyMSClassChange(packetService,
       
  4952 																	 notifyMSClassChangeStatus,
       
  4953 																	 newClass,
       
  4954 																	 expectedNewClass,
       
  4955 																	 KErrNone);
       
  4956 	
       
  4957 	// Check RPacketService::GetMSClass returns RPacketService::EMSClassAlternateMode
       
  4958 	packetService.GetMSClass(getMSClassStatus,msClass, msMax);
       
  4959 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone,
       
  4960 					_L("PacketService::GetMSClass timedout."));
       
  4961 	ASSERT_EQUALS(getMSClassStatus.Int(), KErrNone, 
       
  4962 					_L("PacketService::GetMSClass returned an error"));
       
  4963 	ASSERT_EQUALS(newClass, RPacketService::EMSClassAlternateMode, 
       
  4964 					_L("PacketService::GetMSClass did not return RPacketService::EMSClassAlternateMode"));	
       
  4965 			
       
  4966 	// Set preferred bearer to EBearerCircuitSwitched
       
  4967 	TExtEtelRequestStatus setBearerStatus(packetService, EPacketSetPrefBearer);
       
  4968 	RPacketService::TPreferredBearer bearer = RPacketService::EBearerCircuitSwitched;
       
  4969 	packetService.SetPreferredBearer(setBearerStatus,bearer);
       
  4970 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setBearerStatus, ETimeMedium), KErrNone,
       
  4971 					_L("PacketService::SetPreferredBearer timed out"));
       
  4972 	ASSERT_EQUALS(setBearerStatus.Int(), KErrNone, 
       
  4973 					_L("PacketService::SetPreferredBearer returned an error"));		
       
  4974 	
       
  4975 	// Check RPacketService::GetPreferredBearer returns EBearerCircuitSwitched
       
  4976 	TExtEtelRequestStatus getBearerStatus(packetService, EPacketGetPrefBearer);	
       
  4977 	RPacketService::TPreferredBearer newBearer;
       
  4978 	packetService.GetPreferredBearer(getBearerStatus,newBearer);
       
  4979 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getBearerStatus, ETimeMedium), KErrNone, 
       
  4980 				_L("PacketService::GetPreferredBearer timed out"))
       
  4981 	ASSERT_EQUALS(getBearerStatus.Int(),KErrNone, 
       
  4982 				_L("PacketService::GetPreferredBearer returned an error"));					 						
       
  4983 	ASSERT_EQUALS(newBearer, RPacketService::EBearerCircuitSwitched, 
       
  4984 					_L("PacketService::GetPreferredBearer did not return RPacketService::EBearerCircuitSwitched"));	
       
  4985 		
       
  4986 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  4987 	RPacketService::TStatus getStatus;
       
  4988 	ASSERT_EQUALS(packetService.GetStatus(getStatus), KErrNone, 
       
  4989 					_L("PacketService::GetStatus returned an error"));
       
  4990 	ASSERT_EQUALS(getStatus, RPacketService::EStatusUnattached, 
       
  4991 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));	
       
  4992 
       
  4993 	// Set preferred bearer to EBearerPacketSwitched
       
  4994 	bearer = RPacketService::EBearerPacketSwitched;
       
  4995 	packetService.SetPreferredBearer(setBearerStatus,bearer);
       
  4996 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setBearerStatus, ETimeMedium), KErrNone,
       
  4997 					_L("PacketService::SetPreferredBearer timedout"));
       
  4998 	ASSERT_EQUALS(setBearerStatus.Int(), KErrNone, 
       
  4999 					_L("PacketSercice::SetPreferredBearer returned and error"));
       
  5000 		
       
  5001 	// Check RPacketService::GetPreferredBearer returns EBearerPacketSwitched
       
  5002 	packetService.GetPreferredBearer(getBearerStatus,newBearer);
       
  5003 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getBearerStatus, ETimeMedium), KErrNone,
       
  5004 					_L("PacketService::GetPreferredBearer timed out."));
       
  5005 	ASSERT_EQUALS(getBearerStatus.Int(), KErrNone, 
       
  5006 					_L("PacketService::GetPreferredBearer returned an error"));	 									
       
  5007 	ASSERT_EQUALS(newBearer, RPacketService::EBearerPacketSwitched, 
       
  5008 					_L("PacketService::GetPreferredBearer did not return RPacketService::EBearerPacketSwitched"));
       
  5009 			
       
  5010 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  5011 	ASSERT_EQUALS(packetService.GetStatus(getStatus), KErrNone, 
       
  5012 					_L("PacketService::GetStatus returned an error"));
       
  5013 	ASSERT_EQUALS(getStatus, RPacketService::EStatusUnattached, 
       
  5014 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached "));
       
  5015 
       
  5016 	// 
       
  5017 	// TEST END
       
  5018 	//
       
  5019 
       
  5020 	StartCleanup();
       
  5021     
       
  5022     // Pop:
       
  5023     // serviceStatus
       
  5024     // detachStatus
       
  5025     // getMSClassStatus 
       
  5026     // setMSClassStatus   
       
  5027     // setAttachModeStatus
       
  5028     // setAttachModeStatus
       
  5029     // notifyMSClassChangeStatus
       
  5030 
       
  5031 	CleanupStack::PopAndDestroy(7, &serviceStatus);
       
  5032 
       
  5033 	return TestStepResult();
       
  5034 	}
       
  5035 
       
  5036 TPtrC CCTSYIntegrationTestPacketService0026::GetTestStepName()
       
  5037 /**
       
  5038  * @return The test step name.
       
  5039  */
       
  5040 	{
       
  5041 	return _L("CCTSYIntegrationTestPacketService0026");
       
  5042 	}
       
  5043 
       
  5044 
       
  5045 
       
  5046 CCTSYIntegrationTestPacketService0027::CCTSYIntegrationTestPacketService0027(CEtelSessionMgr& aEtelSessionMgr)
       
  5047 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  5048 /**
       
  5049  * Constructor.
       
  5050  */
       
  5051 	{
       
  5052 	SetTestStepName(CCTSYIntegrationTestPacketService0027::GetTestStepName());
       
  5053 	}
       
  5054 
       
  5055 CCTSYIntegrationTestPacketService0027::~CCTSYIntegrationTestPacketService0027()
       
  5056 /**
       
  5057  * Destructor.
       
  5058  */
       
  5059 	{
       
  5060 	}
       
  5061 
       
  5062 TVerdict CCTSYIntegrationTestPacketService0027::doTestStepL()
       
  5063 /**
       
  5064  * @SYMTestCaseID BA-CTSY-INT-PKTS-0027
       
  5065  * @SYMFssID BA/CTSY/PKTS-0027
       
  5066  * @SYMTestCaseDesc Set MS class to class A.
       
  5067  * @SYMTestPriority High
       
  5068  * @SYMTestActions RPacketService::NotifyMSClassChange, RPacketService::GetMSClass, RPacketContext::SetConfig, RPacketContext::Activate, RPacketContext::NotifyStatusChange, RPacketContext::GetStatus, RCall::Dial, RCall::HangUp, RCall::GetStatus, RCall::NotifyStatusChange, RPacketService::NotifyStatusChange, RPacketService::GetStatus
       
  5069  * @SYMTestExpectedResults Pass - Packet service remains active when CS call is made.
       
  5070  * @SYMTestType CIT
       
  5071  * @SYMTestCaseDependencies live/automatic
       
  5072  *
       
  5073  * Reason for test: Verify simultaneous GSM and packet operation possible.
       
  5074  *
       
  5075  * @return - TVerdict code
       
  5076  */
       
  5077 	{
       
  5078 
       
  5079 	//
       
  5080 	// SET UP
       
  5081 	//
       
  5082 
       
  5083 	
       
  5084 	// Ensure RPacketService::GetMSClass returns EMSClassDualMode 
       
  5085 
       
  5086 
       
  5087 	//
       
  5088 	// SET UP END
       
  5089 	//
       
  5090 	
       
  5091 	StartTest();
       
  5092 	
       
  5093 	//
       
  5094 	// TEST START
       
  5095 	//
       
  5096 	
       
  5097 	
       
  5098 	// Get the packet service.  
       
  5099 
       
  5100 	// Get a primary packet context 
       
  5101 
       
  5102 	// Set a valid config for the context with RPacketContext::SetConfig 
       
  5103 
       
  5104 	// Activate the primary context 
       
  5105 
       
  5106 	// Check RPacketContext::NotifyStatusChange completes with EStatusActivating -> EStatusActive
       
  5107 
       
  5108 	// Check RPacketContext::GetStatus returns RPacketContext::EStatusActive
       
  5109 
       
  5110 	// Check RPacketService::GetStatus returns RPacketService::EStatusActive
       
  5111 
       
  5112 	// Get voice line 1 
       
  5113 
       
  5114 	// Dial a number that answers 
       
  5115 
       
  5116 	// Check RCall::NotifyStatusChange completes with EStatusConnected
       
  5117 
       
  5118 	// Check RCall::GetStatus returns EStatusConnected
       
  5119 
       
  5120 	// Check RPacketService::GetStatus returns EStatusActive
       
  5121 
       
  5122 	// Check RPacketContext::GetStatus returns EStatusActive
       
  5123 
       
  5124 	// Hang up call. 
       
  5125 
       
  5126 	// Check RPacketService::GetStatus returns EStatusActive
       
  5127 
       
  5128 	// Check RPacketContext::GetStatus returns EStatusActive
       
  5129 
       
  5130 	
       
  5131 	//
       
  5132 	// TEST END
       
  5133 	//
       
  5134 
       
  5135     StartCleanup();
       
  5136 	
       
  5137 	// Put any required test clean up here, then remove this comment
       
  5138 	
       
  5139 	return TestStepResult();
       
  5140 	}
       
  5141 
       
  5142 TPtrC CCTSYIntegrationTestPacketService0027::GetTestStepName()
       
  5143 /**
       
  5144  * @return The test step name.
       
  5145  */
       
  5146 	{
       
  5147 	return _L("CCTSYIntegrationTestPacketService0027");
       
  5148 	}
       
  5149 
       
  5150 
       
  5151 
       
  5152 CCTSYIntegrationTestPacketService0028::CCTSYIntegrationTestPacketService0028(CEtelSessionMgr& aEtelSessionMgr)
       
  5153 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  5154 /**
       
  5155  * Constructor.
       
  5156  */
       
  5157 	{
       
  5158 	SetTestStepName(CCTSYIntegrationTestPacketService0028::GetTestStepName());
       
  5159 	}
       
  5160 
       
  5161 CCTSYIntegrationTestPacketService0028::~CCTSYIntegrationTestPacketService0028()
       
  5162 /**
       
  5163  * Destructor.
       
  5164  */
       
  5165 	{
       
  5166 	}
       
  5167 
       
  5168 TVerdict CCTSYIntegrationTestPacketService0028::doTestStepL()
       
  5169 /**
       
  5170  * @SYMTestCaseID BA-CTSY-INT-PKTS-0028
       
  5171  * @SYMFssID BA/CTSY/PKTS-0028
       
  5172  * @SYMTestCaseDesc Check preferred bearer has no effect in class A and B.
       
  5173  * @SYMTestPriority High
       
  5174  * @SYMTestActions RPacketService::GetPreferredBearer, RPacketService::SetMSClass, RPacketService::NotifyMSClassChange, RPacketService::GetMSClass, RPacketService::SetAttachMode, RPacketService::NotifyAttachModeChange, RPacketService::GetAttachMode, RPacketService::NotifyStatusChange, RPacketService::GetStatus
       
  5175  * @SYMTestExpectedResults Pass - Packet service status independent of preferred bearer.
       
  5176  * @SYMTestType CIT
       
  5177  * @SYMTestCaseDependencies live/automatic
       
  5178  *
       
  5179  * Reason for test: Verify that when preferred bearer is CS, automatic attach still occurs when MS is in class A or B operation.
       
  5180  *
       
  5181  * @return - TVerdict code
       
  5182  */
       
  5183 	{
       
  5184 
       
  5185 	//
       
  5186 	// SET UP
       
  5187 	//
       
  5188 	
       
  5189 	
       
  5190 	// Get packet service
       
  5191 	RPacketService& packetService = iEtelSessionMgr.GetPacketServiceL(KMainServer, KMainPhone, KMainPacketService);
       
  5192 	
       
  5193 	// Ensure RPacketService::GetMSClass returns EMSClassDualMode 
       
  5194 	TExtEtelRequestStatus getMSClassStatus(packetService, EPacketGetMSClass);
       
  5195 	CleanupStack::PushL(getMSClassStatus);
       
  5196 	RPacketService::TMSClass msClass;
       
  5197 	RPacketService::TMSClass msMax;
       
  5198 	packetService.GetMSClass(getMSClassStatus,msClass, msMax);
       
  5199 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone, 
       
  5200 					_L("PacketService::GetMSClass timedout"));
       
  5201 	CHECK_EQUALS_L(getMSClassStatus.Int(), KErrNone, 
       
  5202 					_L("packetService::GetMSClass returned an error"));											
       
  5203 				
       
  5204 	TExtEtelRequestStatus setMSClassStatus(packetService, EPacketSetMSClass);
       
  5205 	CleanupStack::PushL(setMSClassStatus);	
       
  5206 	if (msClass != RPacketService::EMSClassDualMode)	
       
  5207 		{
       
  5208 		msClass = RPacketService::EMSClassDualMode;
       
  5209 		packetService.SetMSClass(setMSClassStatus,msClass);	
       
  5210 		ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10050);
       
  5211 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone, 
       
  5212 						_L("PacketService::SetMSClass timed out"));
       
  5213 		CHECK_EQUALS_L(setMSClassStatus.Int(), KErrNone, 
       
  5214 						_L("PacketService::SetMSClass returned an error"));												
       
  5215 		packetService.GetMSClass(getMSClassStatus,msClass,msMax);	
       
  5216 		CHECK_EQUALS_L(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone, 
       
  5217 						_L("PacketService::GetMSClass timed out"));
       
  5218 		CHECK_EQUALS_L(getMSClassStatus.Int(), KErrNone, 
       
  5219 						_L("PacketService::GetMSClass returned an error"));												
       
  5220 		}
       
  5221 	
       
  5222 	CHECK_EQUALS_L(msClass, RPacketService::EMSClassDualMode, 
       
  5223 					_L("RPacketService::GetMSClass did not return RPacketService::EMSClassDualMode MS class"));
       
  5224 		
       
  5225 	// Set attach mode to EAttachWhenNeeded.
       
  5226 	TExtEtelRequestStatus setAttachModeStatus(packetService, EPacketSetAttachMode);
       
  5227 	CleanupStack::PushL(setAttachModeStatus);
       
  5228 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  5229 	CHECK_EQUALS_L(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeMedium), KErrNone, 
       
  5230 					_L("PacketService::SetAttachMode timed out."));
       
  5231 	CHECK_EQUALS_L(setAttachModeStatus.Int(),KErrNone, 
       
  5232 					_L("PacketService::SetAttachMode returned an error"));	
       
  5233 
       
  5234 	// Ensure RPacketService::GetStatus returns EStatusUnattached 
       
  5235 	RPacketService::TStatus serviceStatus;
       
  5236 	CHECK_EQUALS_L(packetService.GetStatus(serviceStatus), KErrNone, 
       
  5237 					_L("PacketService::GetStatus returned an error"));
       
  5238 	CHECK_EQUALS_L(serviceStatus, RPacketService::EStatusUnattached, 
       
  5239 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));
       
  5240    	
       
  5241 	//
       
  5242 	// SET UP END
       
  5243 	//
       
  5244 	
       
  5245 	StartTest();
       
  5246 	
       
  5247 	//
       
  5248 	// TEST START
       
  5249 	//
       
  5250 	
       
  5251 	
       
  5252 	// Set preferred bearer to EBearerCircuitSwitched.
       
  5253 	TExtEtelRequestStatus setBearerStatus(packetService, EPacketSetPrefBearer);
       
  5254 	CleanupStack::PushL(setBearerStatus);
       
  5255 	RPacketService::TPreferredBearer bearer = RPacketService::EBearerCircuitSwitched;
       
  5256 	packetService.SetPreferredBearer(setBearerStatus,bearer);
       
  5257 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setBearerStatus, ETimeMedium), KErrNone,
       
  5258 					_L("PacketService::SetPreferredBearer timed out."));
       
  5259 	ASSERT_EQUALS(setBearerStatus.Int(), KErrNone, 
       
  5260 					_L("PacketService::SetPreferredBearer returned an error."));	
       
  5261 	
       
  5262 	// Check RPacketService::GetPreferredBearer returns EBearerCircuitSwitched
       
  5263 	TExtEtelRequestStatus getBearerStatus(packetService, EPacketGetPrefBearer);	
       
  5264 	CleanupStack::PushL(getBearerStatus);
       
  5265 	RPacketService::TPreferredBearer newBearer;
       
  5266 	packetService.GetPreferredBearer(getBearerStatus,newBearer);
       
  5267 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getBearerStatus, ETimeMedium), KErrNone, 
       
  5268 					_L("PacketService::GetPreferredBearer timedout."));
       
  5269 	ASSERT_EQUALS(getBearerStatus.Int(), KErrNone, 
       
  5270 					_L("PacketService::GetPreferredBearer returned an error"));						 				
       
  5271 	ASSERT_EQUALS(newBearer, RPacketService::EBearerCircuitSwitched, 
       
  5272 					_L("PacketService::GetPreferredBearer did not return RPacketService::EBearerCircuitSwitched"));	
       
  5273 		
       
  5274 	// Post notification for attach mode change
       
  5275 	RPacketService::TAttachMode attachMode;
       
  5276 	TExtEtelRequestStatus notifyAttachModeChangeStatus(packetService, EPacketNotifyAttachModeChange);
       
  5277 	CleanupStack::PushL(notifyAttachModeChangeStatus);
       
  5278 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
  5279 	
       
  5280 	// Post notification for packet service status change
       
  5281 	TExtEtelRequestStatus notifyStatusStatus(packetService, EPacketNotifyStatusChange);
       
  5282 	CleanupStack::PushL(notifyStatusStatus); 
       
  5283 	RPacketService::TStatus packetServiceStatus;
       
  5284 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  5285 
       
  5286 	// Set attach mode to RPacketService::EAttachWhenPossible 
       
  5287 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  5288 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  5289 					_L("PacketService::SetAttachMode timed out"));
       
  5290 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  5291 					_L("PacketService::SetAttachMode returned an error."));								
       
  5292 	
       
  5293 	// Check RPacketService::NotifyAttachModeChange completes with EAttachWhenPossible
       
  5294 	RPacketService::TAttachMode expectedAttachMode = RPacketService::EAttachWhenPossible;
       
  5295 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
  5296 																		notifyAttachModeChangeStatus,
       
  5297 																		attachMode,
       
  5298 																		expectedAttachMode,
       
  5299 																		KErrNone);
       
  5300 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
  5301 
       
  5302 	// Check RPacketService::GetAttachMode returns EAttachWhenPossible
       
  5303 	TExtEtelRequestStatus getAttachModeStatus (packetService,EPacketGetAttachMode);
       
  5304 	CleanupStack::PushL(getAttachModeStatus);	
       
  5305 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  5306 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  5307 					_L("PacketService::GetAttachMode timed out"));
       
  5308 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  5309 					_L("PacketService::GetAttachMode returned an error"));
       
  5310 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenPossible, 
       
  5311 					_L("PacketService::GetAttachMode Wrong attach mode"));
       
  5312 
       
  5313 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  5314 	RPacketService::TStatus expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  5315 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  5316 																	notifyStatusStatus,
       
  5317 																	packetServiceStatus,
       
  5318 																	expectedPacketServiceStatus,
       
  5319 																	KErrNone);
       
  5320 	
       
  5321 	// Check RPacketService::GetStatus returns EStatusAttached
       
  5322 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  5323 					_L("PacketService::GetStatus returned an error"));
       
  5324 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  5325 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
  5326    	
       
  5327 	// Post notification for attach mode change
       
  5328 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
  5329 	
       
  5330 	// Post notification for packet service status change
       
  5331 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  5332 	
       
  5333 	
       
  5334 	// Set attach mode to RPacketService::EAttachWhenNeeded 
       
  5335 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  5336 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  5337 					_L("PacketService::SetAttachMode timed out"));
       
  5338 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  5339 					_L("PacketService::SetAttachMode returned an error."));								
       
  5340 	
       
  5341 	// Check RPacketService::NotifyAttachModeChange completes with EAttachWhenNeeded
       
  5342 	expectedAttachMode = RPacketService::EAttachWhenNeeded;
       
  5343 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
  5344 																		notifyAttachModeChangeStatus,
       
  5345 																		attachMode,
       
  5346 																		expectedAttachMode,
       
  5347 																		KErrNone);
       
  5348 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
  5349 	
       
  5350 	// Check RPacketService::GetAttachMode returns EAttachWhenNeeded
       
  5351 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  5352 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  5353 					_L("PacketService::GetAttachMode timed out"));
       
  5354 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  5355 					_L("PacketService::GetAttachMode returned an error"));
       
  5356 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  5357 					_L("PacketService::GetAttachMode Wrong attach mode"));
       
  5358 	
       
  5359 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  5360 	expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  5361 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  5362 																	notifyStatusStatus,
       
  5363 																	packetServiceStatus,
       
  5364 																	expectedPacketServiceStatus,
       
  5365 																	KErrNone);
       
  5366 				
       
  5367 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  5368 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  5369 					_L("PacketService::GetStatus returned an error"));
       
  5370 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
  5371 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));
       
  5372 	
       
  5373 	// Post Notification for MS Class Change
       
  5374 	TExtEtelRequestStatus notifyMSClassChangeStatus(packetService, EPacketNotifyMSClassChange);
       
  5375 	CleanupStack::PushL(notifyMSClassChangeStatus);
       
  5376 	RPacketService::TMSClass newClass;
       
  5377 	packetService.NotifyMSClassChange(notifyMSClassChangeStatus,newClass);
       
  5378 	
       
  5379 	// Set MS class to EMSClassSuspensionRequired 
       
  5380 	msClass = RPacketService::EMSClassSuspensionRequired;
       
  5381 	packetService.SetMSClass(setMSClassStatus,msClass);		
       
  5382 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setMSClassStatus, ETimeMedium), KErrNone,
       
  5383 		 			_L("PacketService::SetMSClass timed out."));			
       
  5384 	ASSERT_EQUALS(setMSClassStatus.Int(), KErrNone, 
       
  5385 					_L("PacketService::SetMSClassStatus returned an error"));
       
  5386 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10050);
       
  5387 	CHECK_EQUALS_L(1, 2, _L("This test has been made to leave intentially as it is not possible now to move forward in the test"));		
       
  5388 
       
  5389 				
       
  5390 	// Check RPacketService::NotifyMSClassChange completes with EMSClassSuspensionRequired
       
  5391 	RPacketService::TMSClass expectedNewClass= RPacketService::EMSClassSuspensionRequired;
       
  5392 	iPacketServiceTestHelper.WaitForPacketServiceNotifyMSClassChange(packetService,
       
  5393 																	 notifyMSClassChangeStatus,
       
  5394 																	 newClass,
       
  5395 																	 expectedNewClass,
       
  5396 																	 KErrNone);
       
  5397 	
       
  5398 	// Check RPacketService::GetMSClass returns EMSClassSuspensionRequired
       
  5399 	packetService.GetMSClass(getMSClassStatus,msClass, msMax);
       
  5400 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getMSClassStatus, ETimeMedium), KErrNone,
       
  5401 					_L("PacketService::GetMSClass timed out"));
       
  5402 	ASSERT_EQUALS(getMSClassStatus.Int(), KErrNone, 
       
  5403 					_L("PacketService::GetMSClass returned and error"));
       
  5404 	ASSERT_EQUALS(newClass, RPacketService::EMSClassSuspensionRequired, 
       
  5405 					_L("PacketService::GetMSClass did not return RPacketService::EMSClassSuspensionRequired"));	
       
  5406 	
       
  5407 	// Set preferred bearer to EBearerCircuitSwitched.
       
  5408 	bearer = RPacketService::EBearerCircuitSwitched;
       
  5409 	packetService.SetPreferredBearer(setBearerStatus,bearer);
       
  5410 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setBearerStatus, ETimeMedium), KErrNone,
       
  5411 					_L("PacketService::SetPreferredBearer timed out."));
       
  5412 	ASSERT_EQUALS(setBearerStatus.Int(), KErrNone, 
       
  5413 					_L("PacketService::SetPreferredBearer returned an error."));	
       
  5414 	
       
  5415 	// Check RPacketService::GetPreferredBearer returns EBearerCircuitSwitched
       
  5416 	packetService.GetPreferredBearer(getBearerStatus,newBearer);
       
  5417 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getBearerStatus, ETimeMedium), KErrNone, 
       
  5418 					_L("PacketService::GetPreferredBearer timedout."));
       
  5419 	ASSERT_EQUALS(getBearerStatus.Int(), KErrNone, 
       
  5420 					_L("PacketService::GetPreferredBearer returned an error"));						 				
       
  5421 	ASSERT_EQUALS(newBearer, RPacketService::EBearerCircuitSwitched, 
       
  5422 					_L("PacketService::GetPreferredBearer did not return RPacketService::EBearerCircuitSwitched"));	
       
  5423 		
       
  5424 	// Post notification for attach mode change
       
  5425 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
  5426 	
       
  5427 	// Post notification for packet service status change
       
  5428 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  5429 	
       
  5430 	// Set attach mode to RPacketService::EAttachWhenPossible 
       
  5431 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenPossible);
       
  5432 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  5433 					_L("PacketService::SetAttachMode timed out"));
       
  5434 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  5435 					_L("PacketService::SetAttachMode returned an error."));								
       
  5436 	
       
  5437 	// Check RPacketService::NotifyAttachModeChange completes with EAttachWhenPossible
       
  5438 	expectedAttachMode = RPacketService::EAttachWhenPossible;
       
  5439 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
  5440 																		notifyAttachModeChangeStatus,
       
  5441 																		attachMode,
       
  5442 																		expectedAttachMode,
       
  5443 																		KErrNone);
       
  5444 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
  5445 	
       
  5446 	// Check RPacketService::GetAttachMode returns EAttachWhenPossible
       
  5447 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  5448 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  5449 					_L("PacketService::GetAttachMode timed out"));
       
  5450 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  5451 					_L("PacketService::GetAttachMode returned an error"));
       
  5452 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenPossible, 
       
  5453 					_L("PacketService::GetAttachMode Wrong attach mode"));
       
  5454 	
       
  5455 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  5456 	expectedPacketServiceStatus = RPacketService::EStatusAttached;
       
  5457 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  5458 																	notifyStatusStatus,
       
  5459 																	packetServiceStatus,
       
  5460 																	expectedPacketServiceStatus,
       
  5461 																	KErrNone);
       
  5462 	
       
  5463 	// Check RPacketService::GetStatus returns EStatusAttached
       
  5464 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  5465 					_L("PacketService::GetStatus returned an error"));
       
  5466 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusAttached, 
       
  5467 					_L("PacketService::GetStatus did not return RPacketService::EStatusAttached"));
       
  5468 		
       
  5469 	// Post notification for attach mode change
       
  5470 	packetService.NotifyAttachModeChange(notifyAttachModeChangeStatus, attachMode);
       
  5471 	
       
  5472 	// Post notification for packet service status change
       
  5473 	packetService.NotifyStatusChange(notifyStatusStatus, packetServiceStatus);
       
  5474 	
       
  5475 	
       
  5476 	// Set attach mode to RPacketService::EAttachWhenNeeded 
       
  5477 	packetService.SetAttachMode(setAttachModeStatus, RPacketService::EAttachWhenNeeded);
       
  5478 	ASSERT_EQUALS(WaitForRequestWithTimeOut(setAttachModeStatus, ETimeLong), KErrNone,
       
  5479 					_L("PacketService::SetAttachMode timed out"));
       
  5480 	ASSERT_EQUALS (setAttachModeStatus.Int(),KErrNone, 
       
  5481 					_L("PacketService::SetAttachMode returned an error."));								
       
  5482 	
       
  5483 	// Check RPacketService::NotifyAttachModeChange completes with EAttachWhenNeeded
       
  5484 	expectedAttachMode = RPacketService::EAttachWhenNeeded;
       
  5485 	iPacketServiceTestHelper.WaitForPacketServiceNotifyAttachModeChange(packetService,
       
  5486 																		notifyAttachModeChangeStatus,
       
  5487 																		attachMode,
       
  5488 																		expectedAttachMode,
       
  5489 																		KErrNone);
       
  5490 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 10049);
       
  5491 	
       
  5492 	// Check RPacketService::GetAttachMode returns EAttachWhenNeeded
       
  5493 	packetService.GetAttachMode(getAttachModeStatus, attachMode);
       
  5494 	ASSERT_EQUALS(WaitForRequestWithTimeOut(getAttachModeStatus, ETimeMedium), KErrNone,
       
  5495 					_L("PacketService::GetAttachMode timed out"));
       
  5496 	ASSERT_EQUALS(getAttachModeStatus.Int(),KErrNone, 
       
  5497 					_L("PacketService::GetAttachMode returned an error"));
       
  5498 	ASSERT_EQUALS(attachMode, RPacketService::EAttachWhenNeeded, 
       
  5499 					_L("PacketService::GetAttachMode Wrong attach mode"));
       
  5500 	
       
  5501 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  5502 	expectedPacketServiceStatus = RPacketService::EStatusUnattached;
       
  5503 	iPacketServiceTestHelper.WaitForPacketServiceNotifyStatusChange(packetService, 
       
  5504 																	notifyStatusStatus,
       
  5505 																	packetServiceStatus,
       
  5506 																	expectedPacketServiceStatus,
       
  5507 																	KErrNone);
       
  5508 				
       
  5509 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  5510 	ASSERT_EQUALS(packetService.GetStatus(serviceStatus), KErrNone, 
       
  5511 					_L("PacketService::GetStatus returned an error"));
       
  5512 	ASSERT_EQUALS(serviceStatus, RPacketService::EStatusUnattached, 
       
  5513 					_L("PacketService::GetStatus did not return RPacketService::EStatusUnattached"));
       
  5514 	
       
  5515 	//
       
  5516 	// TEST END
       
  5517 	//
       
  5518 
       
  5519     StartCleanup();
       
  5520 	
       
  5521 	// Pop:
       
  5522 	// getMSClassStatus
       
  5523 	// setMSClassStatus
       
  5524 	// setAttachModeStatus
       
  5525 	// setBearerStatus
       
  5526 	// getBearerStatus
       
  5527 	// notifyAttachModeChangeStatus
       
  5528 	// notifyStatusStatus
       
  5529 	// getAttachModeStatus
       
  5530 	// notifyMSClassChangeStatus
       
  5531 	CleanupStack::PopAndDestroy(9, &getMSClassStatus);
       
  5532 	
       
  5533 	
       
  5534 	return TestStepResult();
       
  5535 	}
       
  5536 
       
  5537 TPtrC CCTSYIntegrationTestPacketService0028::GetTestStepName()
       
  5538 /**
       
  5539  * @return The test step name.
       
  5540  */
       
  5541 	{
       
  5542 	return _L("CCTSYIntegrationTestPacketService0028");
       
  5543 	}
       
  5544 
       
  5545 
       
  5546 
       
  5547 CCTSYIntegrationTestPacketService0029::CCTSYIntegrationTestPacketService0029(CEtelSessionMgr& aEtelSessionMgr)
       
  5548 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  5549 /**
       
  5550  * Constructor.
       
  5551  */
       
  5552 	{
       
  5553 	SetTestStepName(CCTSYIntegrationTestPacketService0029::GetTestStepName());
       
  5554 	}
       
  5555 
       
  5556 CCTSYIntegrationTestPacketService0029::~CCTSYIntegrationTestPacketService0029()
       
  5557 /**
       
  5558  * Destructor.
       
  5559  */
       
  5560 	{
       
  5561 	}
       
  5562 
       
  5563 TVerdict CCTSYIntegrationTestPacketService0029::doTestStepL()
       
  5564 /**
       
  5565  * @SYMTestCaseID BA-CTSY-INT-PKTS-0029
       
  5566  * @SYMFssID BA/CTSY/PKTS-0029
       
  5567  * @SYMTestCaseDesc Get release mode change notifications when attaching.
       
  5568  * @SYMTestPriority High
       
  5569  * @SYMTestActions RPacketService::NotifyReleaseModeChange, RPacketService::GetCurrentReleaseMode
       
  5570  * @SYMTestExpectedResults Pass - Release mode change notification completes.
       
  5571  * @SYMTestType CIT
       
  5572  * @SYMTestCaseDependencies live/manual
       
  5573  *
       
  5574  * Reason for test: Verify release mode change notification completes.
       
  5575  *
       
  5576  * @return - TVerdict code
       
  5577  */
       
  5578 	{
       
  5579 
       
  5580 	//
       
  5581 	// SET UP
       
  5582 	//
       
  5583 
       
  5584 	
       
  5585 	// Ensure phone is not registered on packet network 
       
  5586 
       
  5587 	// RPacketService::GetNtwkRegStatus returns one of ENotRegisteredNotSearching | ENotRegisteredSearching | ENotRegisteredButAvailable | EUnknown  
       
  5588 
       
  5589 
       
  5590 	//
       
  5591 	// SET UP END
       
  5592 	//
       
  5593 	
       
  5594 	StartTest();
       
  5595 	
       
  5596 	//
       
  5597 	// TEST START
       
  5598 	//
       
  5599 	
       
  5600 	
       
  5601 	// Get packet service 
       
  5602 
       
  5603 	// Check RPacketService::GetCurrentReleaseMode returns one of EReleaseModeUnregistered | EReleaseModeUnknown
       
  5604 
       
  5605 	// Attach 
       
  5606 
       
  5607 	// Check RPacketService::NotifyReleaseModeChange completes with one of EReleaseMode97_98 | EReleaseMode99 | EReleaseMode4
       
  5608 
       
  5609 	// Check RPacketService::GetCurrentReleaseMode returns one of EReleaseMode97_98 | EReleaseMode99 | EReleaseMode4
       
  5610 
       
  5611 	
       
  5612 	//
       
  5613 	// TEST END
       
  5614 	//
       
  5615 
       
  5616     StartCleanup();
       
  5617 	
       
  5618 	// Put any required test clean up here, then remove this comment
       
  5619 	
       
  5620 	return TestStepResult();
       
  5621 	}
       
  5622 
       
  5623 TPtrC CCTSYIntegrationTestPacketService0029::GetTestStepName()
       
  5624 /**
       
  5625  * @return The test step name.
       
  5626  */
       
  5627 	{
       
  5628 	return _L("CCTSYIntegrationTestPacketService0029");
       
  5629 	}
       
  5630 
       
  5631 
       
  5632 
       
  5633 CCTSYIntegrationTestPacketService0030::CCTSYIntegrationTestPacketService0030(CEtelSessionMgr& aEtelSessionMgr)
       
  5634 	: CCTSYIntegrationTestPacketServiceBase(aEtelSessionMgr)
       
  5635 /**
       
  5636  * Constructor.
       
  5637  */
       
  5638 	{
       
  5639 	SetTestStepName(CCTSYIntegrationTestPacketService0030::GetTestStepName());
       
  5640 	}
       
  5641 
       
  5642 CCTSYIntegrationTestPacketService0030::~CCTSYIntegrationTestPacketService0030()
       
  5643 /**
       
  5644  * Destructor.
       
  5645  */
       
  5646 	{
       
  5647 	}
       
  5648 
       
  5649 TVerdict CCTSYIntegrationTestPacketService0030::doTestStepL()
       
  5650 /**
       
  5651  * @SYMTestCaseID BA-CTSY-INT-PKTS-0030
       
  5652  * @SYMFssID BA/CTSY/PKTS-0030
       
  5653  * @SYMTestCaseDesc Get release mode and network registration status change notifications when moving between 2G and 3G cells when attached.
       
  5654  * @SYMTestPriority High
       
  5655  * @SYMTestActions RPacketService::NotifyReleaseModeChange, RPacketService::GetCurrentReleaseMode, RPacketService::GetStatus, RPacketService::NotifyChangeOfNtwkRegStatus, RPacketService::GetNtwkRegStatus
       
  5656  * @SYMTestExpectedResults Pass - Release mode changes.
       
  5657  * @SYMTestType CIT
       
  5658  * @SYMTestCaseDependencies simulated/manual
       
  5659  *
       
  5660  * Reason for test: Verify release mode change notification completes.
       
  5661  *
       
  5662  * @return - TVerdict code
       
  5663  */
       
  5664 	{
       
  5665 
       
  5666 	//
       
  5667 	// SET UP
       
  5668 	//
       
  5669 
       
  5670 	
       
  5671 	// Ensure attach mode is RPacketService::EAttachWhenPossible and RPacketService::GetStatus returns EStatusAttached 
       
  5672 
       
  5673 
       
  5674 	//
       
  5675 	// SET UP END
       
  5676 	//
       
  5677 	
       
  5678 	StartTest();
       
  5679 	
       
  5680 	//
       
  5681 	// TEST START
       
  5682 	//
       
  5683 	
       
  5684 	
       
  5685 	// Simulate a 3G cell supporting release mode 4. 
       
  5686 
       
  5687 	// Check RPacketService::GetCurrentReleaseMode returns EReleaseMode4
       
  5688 
       
  5689 	// Simulate moving to a 2G cell. 
       
  5690 
       
  5691 	// Check RPacketService::NotifyStatusChange completes with EStatusUnattached
       
  5692 
       
  5693 	// Check RPacketService::GetStatus returns EStatusUnattached
       
  5694 
       
  5695 	// Check RPacketService::NotifyReleaseModeChange completes with EReleaseModeUnregistered
       
  5696 
       
  5697 	// Check RPacketService::NotifyChangeOfNtwkRegStatus completes with one of  ENotRegisteredAndNotAvailable | ENotRegisteredSearching | ENotRegisteredNotSearching
       
  5698 
       
  5699 	// Check RPacketService::GetNtwkRegStatus returns one of ENotRegisteredAndNotAvailable | ENotRegisteredSearching | ENotRegisteredNotSearching
       
  5700 
       
  5701 	// Simulate moving into a 3G cell supporting release mode EReleaseMode97_98 
       
  5702 
       
  5703 	// Check RPacketService::NotifyReleaseModeChange completes with EReleaseMode97_98
       
  5704 
       
  5705 	// Check RPacketService::GetCurrentReleaseMode returns EReleaseMode97_98
       
  5706 
       
  5707 	// Check RPacketService::NotifyChangeOfNtwkRegStatus completes with ERegisteredOnHomeNetwork
       
  5708 
       
  5709 	// Check RPacketService::GetNtwkRegStatus returns ERegisteredOnHomeNetwork
       
  5710 
       
  5711 	// Check RPacketService::NotifyStatusChange completes with EStatusAttached
       
  5712 
       
  5713 	// Check RPacketService::GetStatus returns EStatusAttached
       
  5714 
       
  5715 	
       
  5716 	//
       
  5717 	// TEST END
       
  5718 	//
       
  5719 
       
  5720     StartCleanup();
       
  5721 	
       
  5722 	// Put any required test clean up here, then remove this comment
       
  5723 	
       
  5724 	return TestStepResult();
       
  5725 	}
       
  5726 
       
  5727 TPtrC CCTSYIntegrationTestPacketService0030::GetTestStepName()
       
  5728 /**
       
  5729  * @return The test step name.
       
  5730  */
       
  5731 	{
       
  5732 	return _L("CCTSYIntegrationTestPacketService0030");
       
  5733 	}
       
  5734 
       
  5735 
       
  5736