telephonyserverplugins/common_tsy/test/component/src/cctsypacketcontextfu.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
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 // The TEFUnit test suite for PacketContext in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsypacketcontextfu.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include "tmockltsydata.h"
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 
       
    31 #include <pcktcs.h>
       
    32 #include "CMmCommonStaticUtility.h"
       
    33 #include <ctsy/serviceapi/mmtsy_defaults.h>
       
    34 
       
    35 
       
    36 
       
    37 CTestSuite* CCTsyPacketContextFU::CreateSuiteL(const TDesC& aName)
       
    38 	{
       
    39 	SUB_SUITE;
       
    40 
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyStatusChange0001L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyStatusChange0002L);
       
    43 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyStatusChange0003L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyStatusChange0004L);
       
    45 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyStatusChange0005L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDeactivate0001L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDeactivate0002L);
       
    48 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDeactivate0003L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDeactivate0004L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDeactivate0005L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDnsInfo0001L);
       
    52 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDnsInfo0002L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDnsInfo0003L);
       
    54 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDnsInfo0004L);
       
    55 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDnsInfo0005L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestLoanCommPort0001L);
       
    57 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestLoanCommPort0002L);
       
    58 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestLoanCommPort0003L);
       
    59 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestLoanCommPort0004L);
       
    60 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestLoanCommPort0005L);
       
    61 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetProfileName0001L);
       
    62 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetProfileName0002L);
       
    63 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetProfileName0003L);
       
    64 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetProfileName0004L);
       
    65 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetProfileName0005L);
       
    66 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestRecoverCommPort0001L);
       
    67 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestRecoverCommPort0002L);
       
    68 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestRecoverCommPort0003L);
       
    69 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestRecoverCommPort0004L);
       
    70 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestRecoverCommPort0005L);
       
    71 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetLastErrorCause0001L);
       
    72 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetLastErrorCause0002L);
       
    73 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetLastErrorCause0003L);
       
    74 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetLastErrorCause0004L);
       
    75 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetLastErrorCause0005L);
       
    76 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestInitialiseContext0001L);
       
    77 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestInitialiseContext0002L);
       
    78 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestInitialiseContext0003L);
       
    79 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestInitialiseContext0004L);
       
    80 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestInitialiseContext0005L);
       
    81 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionSpeed0001L);
       
    82 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionSpeed0002L);
       
    83 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionSpeed0003L);
       
    84 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionSpeed0004L);
       
    85 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionSpeed0005L);
       
    86 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestModifyActiveContext0001L);
       
    87 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestModifyActiveContext0002L);
       
    88 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestModifyActiveContext0003L);
       
    89 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestModifyActiveContext0004L);
       
    90 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestModifyActiveContext0005L);
       
    91 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0001L);
       
    92 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0001bL);
       
    93 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0001cL);
       
    94 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0002L);
       
    95 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0003L);
       
    96 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0004L);
       
    97 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConfigChanged0005L);
       
    98 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyDataTransferred0001L);
       
    99 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyDataTransferred0002L);
       
   100 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyDataTransferred0003L);
       
   101 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyDataTransferred0004L);
       
   102 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyDataTransferred0005L);
       
   103 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestEnumeratePacketFilters0001L);
       
   104 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestEnumeratePacketFilters0002L);
       
   105 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestEnumeratePacketFilters0003L);
       
   106 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestEnumeratePacketFilters0004L);
       
   107 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestEnumeratePacketFilters0005L);
       
   108 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDataVolumeTransferred0001L);
       
   109 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDataVolumeTransferred0002L);
       
   110 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDataVolumeTransferred0003L);
       
   111 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDataVolumeTransferred0004L);
       
   112 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetDataVolumeTransferred0005L);
       
   113 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionSpeedChange0001L);
       
   114 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionSpeedChange0002L);
       
   115 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionSpeedChange0003L);
       
   116 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionSpeedChange0004L);
       
   117 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionSpeedChange0005L);
       
   118 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDelete0001L);
       
   119 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDelete0002L);
       
   120 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDelete0003L);
       
   121 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDelete0004L);
       
   122 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestDelete0005L);
       
   123 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestActivate0001L);
       
   124 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestActivate0001bL);
       
   125 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestActivate0002L);
       
   126 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestActivate0003L);
       
   127 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestActivate0004L);
       
   128 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestActivate0005L);
       
   129 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConfig0001L);
       
   130 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConfig0002L);
       
   131 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConfig0003L);
       
   132 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConfig0004L);
       
   133 //	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConfig0005L);
       
   134 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetStatus0001L);
       
   135     //ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetStatus0002L);
       
   136     //ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetStatus0003L);
       
   137     //ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetStatus0004L);
       
   138     //ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetStatus0005L);
       
   139     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestSetConfig0001L);
       
   140     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestSetConfig0002L);
       
   141     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestSetConfig0003L);
       
   142     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestSetConfig0004L);
       
   143     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestSetConfig0005L);    
       
   144 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   145     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionInfo0001L);
       
   146     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionInfo0002L);
       
   147     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestGetConnectionInfo0004L);
       
   148     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionInfoChange0001L);
       
   149     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionInfoChange0002L);
       
   150     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestNotifyConnectionInfoChange0004L);
       
   151 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
   152     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewSecondaryContext0001L);
       
   153     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewSecondaryContext0001bL);
       
   154     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewSecondaryContext0003L);   
       
   155     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewSecondaryContext0003bL);
       
   156     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewSecondaryContext0003cL);
       
   157     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewContext0001L);
       
   158     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenNewContext0003L);    
       
   159     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenExistingContext0001L);    
       
   160     ADD_TEST_STEP_ISO_CPP(CCTsyPacketContextFU, TestOpenExistingContext0003L);   
       
   161 
       
   162 	END_SUITE;
       
   163 	}
       
   164 
       
   165 
       
   166 //
       
   167 // Actual test cases
       
   168 //
       
   169 
       
   170 
       
   171 /**
       
   172 @SYMTestCaseID BA-CTSY-PKTC-PCNSC-0001
       
   173 @SYMComponent  telephony_ctsy
       
   174 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyStatusChange
       
   175 @SYMTestPriority High
       
   176 @SYMTestActions Invokes RPacketContext::NotifyStatusChange
       
   177 @SYMTestExpectedResults Pass
       
   178 @SYMTestType CT
       
   179 */
       
   180 void CCTsyPacketContextFU::TestNotifyStatusChange0001L()
       
   181 	{
       
   182 
       
   183 	OpenEtelServerL(EUseExtendedError);
       
   184 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   185 	OpenPhoneL();
       
   186 
       
   187 	RBuf8 data;
       
   188 	CleanupClosePushL(data);
       
   189 	
       
   190 	RPacketService packetService;
       
   191 	OpenPacketServiceL(packetService);
       
   192 	CleanupClosePushL(packetService);
       
   193 	
       
   194 	// Open new context
       
   195 	TInfoName contextId;	
       
   196 	RPacketContext packetContext;
       
   197 	packetContext.OpenNewContext(packetService, contextId);
       
   198 	CleanupClosePushL(packetContext);
       
   199 	
       
   200 	TRequestStatus mockLtsyStatus;
       
   201 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   202 	
       
   203 	// data for NotifyStatusChange
       
   204 	TRequestStatus	requestStatus;
       
   205 	RPacketContext::TContextStatus  contextStatus; 
       
   206 
       
   207  	//-------------------------------------------------------------------------
       
   208 	// TEST C: Successful completion request of
       
   209 	// RPacketContext::NotifyStatusChange when result is not cached.
       
   210  	//------------------------------------------------------------------------- 	
       
   211  	//data for ComleteL    
       
   212  	TContextMisc  completeMisc;
       
   213     completeMisc.iStatus = RPacketContext::EStatusInactive;
       
   214  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData(contextId, completeMisc);
       
   215 	ltsyData.SerialiseL(data);	
       
   216 	//send request
       
   217 	packetContext.NotifyStatusChange(requestStatus, contextStatus);	
       
   218 	//send completion
       
   219 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data);
       
   220 	// wait for completion
       
   221 	User::WaitForRequest(mockLtsyStatus);
       
   222 	
       
   223 	// wait for NotifyStatusChange
       
   224 	User::WaitForRequest(requestStatus);
       
   225 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   226 	ASSERT_EQUALS(completeMisc.iStatus, contextStatus);	
       
   227 	AssertMockLtsyStatusL();
       
   228 	
       
   229 	//-------------------------------------------------------------------------
       
   230 	// Test when rejection cause is used
       
   231  	//------------------------------------------------------------------------- 	
       
   232  	//data for ComleteL     
       
   233  	_LIT(KSomeCause, "1");
       
   234  	completeMisc.iRejectionCause.Copy(KSomeCause);
       
   235     completeMisc.iStatus = RPacketContext::EStatusActive;//EStatusInactive;
       
   236  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData2(contextId, completeMisc);
       
   237 	data.Close();
       
   238 	ltsyData2.SerialiseL(data);	
       
   239 	//send request
       
   240 	packetContext.NotifyStatusChange(requestStatus, contextStatus);
       
   241 	
       
   242 	//send completion
       
   243 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   244 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrGeneral, data);
       
   245 	// wait for completion
       
   246 	User::WaitForRequest(mockLtsyStatus);
       
   247 	
       
   248 	// wait for NotifyStatusChange
       
   249 	User::WaitForRequest(requestStatus);
       
   250 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   251 	ASSERT_EQUALS(completeMisc.iStatus, contextStatus);
       
   252 	AssertMockLtsyStatusL();
       
   253  
       
   254  	//-------------------------------------------------------------------------
       
   255 	// TEST E: Unsolicited completion of RPacketContext::NotifyStatusChange
       
   256 	// from LTSY.
       
   257  	//-------------------------------------------------------------------------
       
   258  	//data for ComleteL    
       
   259     completeMisc.iStatus = RPacketContext::EStatusInactive;//EStatusActive;
       
   260  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData1(contextId, completeMisc);
       
   261 	data.Close();
       
   262 	ltsyData1.SerialiseL(data);	
       
   263 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
   264 	//send completion
       
   265 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data);
       
   266 	// wait for completion
       
   267 	User::WaitForRequest(mockLtsyStatus);
       
   268 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   269 	
       
   270 	AssertMockLtsyStatusL();
       
   271 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
   272 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   273 	
       
   274 	}
       
   275 
       
   276 
       
   277 /**
       
   278 @SYMTestCaseID BA-CTSY-PKTC-PCNSC-0002
       
   279 @SYMComponent  telephony_ctsy
       
   280 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::NotifyStatusChange
       
   281 @SYMTestPriority High
       
   282 @SYMTestActions Invokes cancelling of RPacketContext::NotifyStatusChange
       
   283 @SYMTestExpectedResults Pass
       
   284 @SYMTestType CT
       
   285 */
       
   286 void CCTsyPacketContextFU::TestNotifyStatusChange0002L()
       
   287 	{
       
   288 
       
   289 // This test should test cancellation of NotifyStatusChange
       
   290 // If this API does not have a cancel, the test step should be completely removed.
       
   291 
       
   292 	OpenEtelServerL(EUseExtendedError);
       
   293 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   294 	OpenPhoneL();
       
   295 
       
   296 	RBuf8 data;
       
   297 	CleanupClosePushL(data);
       
   298 	
       
   299 	RPacketService packetService;
       
   300 	OpenPacketServiceL(packetService);
       
   301 	CleanupClosePushL(packetService);
       
   302 	
       
   303 	// Open new context
       
   304 	TInfoName contextId;	
       
   305 	RPacketContext packetContext;
       
   306 	packetContext.OpenNewContext(packetService, contextId);
       
   307 	CleanupClosePushL(packetContext);
       
   308 	
       
   309 	TRequestStatus mockLtsyStatus;
       
   310 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   311 	
       
   312 	// data for NotifyStatusChange
       
   313 	TRequestStatus	requestStatus;
       
   314 	RPacketContext::TContextStatus  contextStatus; 
       
   315 
       
   316  	//-------------------------------------------------------------------------
       
   317 	// Test cancelling of RPacketContext::NotifyStatusChange
       
   318  	//------------------------------------------------------------------------- 	
       
   319 	//data for ComleteL    
       
   320  	TContextMisc  completeMisc;
       
   321     completeMisc.iStatus = RPacketContext::EStatusInactive;
       
   322  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData(contextId, completeMisc);
       
   323 	ltsyData.SerialiseL(data);	
       
   324 	//send request
       
   325 	packetContext.NotifyStatusChange(requestStatus, contextStatus);	
       
   326 	// send canceling...
       
   327 	packetContext.CancelAsyncRequest(EPacketContextNotifyStatusChange);
       
   328 	
       
   329 	//send completion
       
   330 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data);
       
   331 	// wait for completion
       
   332 	User::WaitForRequest(mockLtsyStatus);
       
   333 	
       
   334 	// wait for NotifyStatusChange
       
   335 	User::WaitForRequest(requestStatus);
       
   336 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
   337 	
       
   338 	// Wait for completion of iMockLTSY.NotifyTerminated
       
   339 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
   340 	CleanupStack::PopAndDestroy(2); // data, this
       
   341 	
       
   342 	}
       
   343 
       
   344 
       
   345 /**
       
   346 @SYMTestCaseID BA-CTSY-PKTC-PCNSC-0004
       
   347 @SYMComponent  telephony_ctsy
       
   348 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::NotifyStatusChange
       
   349 @SYMTestPriority High
       
   350 @SYMTestActions Invokes multiple client requests to RPacketContext::NotifyStatusChange
       
   351 @SYMTestExpectedResults Pass
       
   352 @SYMTestType CT
       
   353 */
       
   354 void CCTsyPacketContextFU::TestNotifyStatusChange0004L()
       
   355 	{
       
   356 					
       
   357 	OpenEtelServerL(EUseExtendedError);
       
   358 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   359 	OpenPhoneL();
       
   360 
       
   361 	RBuf8 data;
       
   362 	CleanupClosePushL(data);
       
   363 	
       
   364 	RBuf8 data2;
       
   365 	CleanupClosePushL(data2);
       
   366 
       
   367 	// Open second client
       
   368 	RTelServer telServer2;
       
   369 	TInt ret = telServer2.Connect();
       
   370 	ASSERT_EQUALS(KErrNone, ret);
       
   371 	CleanupClosePushL(telServer2);
       
   372 
       
   373 	RMobilePhone phone2;
       
   374 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
   375 	ASSERT_EQUALS(KErrNone, ret);
       
   376 	CleanupClosePushL(phone2);
       
   377 	
       
   378 	RPacketService packetService;
       
   379 	OpenPacketServiceL(packetService);
       
   380 	CleanupClosePushL(packetService);
       
   381 
       
   382 	RPacketService packetService2;                
       
   383 	ret = packetService2.Open(phone2);
       
   384 	ASSERT_EQUALS(KErrNone, ret);
       
   385 	CleanupClosePushL(packetService2);
       
   386 	
       
   387 	// Open first context
       
   388 	TInfoName contextId;	
       
   389 	RPacketContext packetContext;
       
   390 	packetContext.OpenNewContext(packetService, contextId);
       
   391 	CleanupClosePushL(packetContext);
       
   392 	
       
   393 	// Open second context
       
   394 	TInfoName contextId2;	
       
   395 	RPacketContext packetContext2;
       
   396 	packetContext2.OpenNewContext(packetService2, contextId2);
       
   397 	CleanupClosePushL(packetContext2);
       
   398 	
       
   399 	TRequestStatus mockLtsyStatus;
       
   400 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   401 	
       
   402 
       
   403 	//-------------------------------------------------------------------------
       
   404 	// Test A: Test multiple clients requesting RPacketContext::NotifyStatusChange
       
   405  	//-------------------------------------------------------------------------
       
   406 
       
   407 	// If this API is flow controlled by Etel or if this API is
       
   408 	// synchronous, remove this test completely.
       
   409 
       
   410 	// To write this test:
       
   411 	// If this API has parameters which have different versions, then each
       
   412 	// client in this test should use a different version of parameter.
       
   413 	// Otherwise, they should use the same version.
       
   414 	// All versions of parameters should be used. i.e. If there are three
       
   415 	// versions of a parameter, there should be three clients, one using
       
   416 	// each one. If the parameter does not have different versions, use
       
   417 	// two clients each using the same version.
       
   418 	
       
   419 	//data for ComleteL  for first context
       
   420  	TContextMisc  completeMisc;
       
   421     completeMisc.iStatus = RPacketContext::EStatusInactive;
       
   422  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData(contextId, completeMisc);
       
   423 	ltsyData.SerialiseL(data);	
       
   424 	
       
   425 	//data for ComleteL  for second context
       
   426  	TContextMisc  completeMisc2;
       
   427     completeMisc2.iStatus = RPacketContext::EStatusSuspended;
       
   428  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData2(contextId2, completeMisc2);
       
   429 	ltsyData2.SerialiseL(data2);	
       
   430 		
       
   431 	// initialize data for first context's NotifyStatusChange 
       
   432 	TRequestStatus	requestStatus; 
       
   433 	RPacketContext::TContextStatus  contextStatus = RPacketContext::EStatusDeleted; 
       
   434 	
       
   435 	// initialize data for second context's NotifyStatusChange 
       
   436 	TRequestStatus	requestStatus2;
       
   437 	RPacketContext::TContextStatus  contextStatus2 = RPacketContext::EStatusDeleted; 	
       
   438 		
       
   439 	//send first request
       
   440 	packetContext.NotifyStatusChange(requestStatus, contextStatus);	
       
   441 	
       
   442 	//send second request
       
   443 	packetContext2.NotifyStatusChange(requestStatus2, contextStatus2);	
       
   444 	
       
   445 	//send completion for first comtext
       
   446 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data);	
       
   447 	// wait for completion
       
   448 	User::WaitForRequest(mockLtsyStatus);
       
   449 		
       
   450 	// wait for first context NotifyStatusChange
       
   451 	User::WaitForRequest(requestStatus);
       
   452 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   453 	ASSERT_EQUALS(completeMisc.iStatus, contextStatus);	
       
   454 	// check that contextStatus2 ((of the second context)) isn't changed
       
   455 	ASSERT_EQUALS(RPacketContext::EStatusDeleted, contextStatus2);	
       
   456 	
       
   457 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   458 	//send completion for second comtext
       
   459 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data2);	
       
   460 	// wait for completion
       
   461 	User::WaitForRequest(mockLtsyStatus);
       
   462 		
       
   463 	// wait for second context NotifyStatusChange
       
   464 	User::WaitForRequest(requestStatus2);
       
   465 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   466 	ASSERT_EQUALS(completeMisc2.iStatus, contextStatus2);	
       
   467 	// check that contextStatus (of the first context) isn't changed
       
   468 	ASSERT_EQUALS(completeMisc.iStatus, contextStatus);
       
   469 	
       
   470 	AssertMockLtsyStatusL();
       
   471 	
       
   472 	// Done !
       
   473 	CleanupStack::PopAndDestroy(4);// packetContext2, packetContext, packetService2, packetService
       
   474 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, data, data2, this
       
   475 
       
   476 	}
       
   477 
       
   478 
       
   479 
       
   480 /**
       
   481 @SYMTestCaseID BA-CTSY-PKTC-PCD-0001
       
   482 @SYMComponent  telephony_ctsy
       
   483 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Deactivate
       
   484 @SYMTestPriority High
       
   485 @SYMTestActions Invokes RPacketContext::Deactivate
       
   486 @SYMTestExpectedResults Pass
       
   487 @SYMTestType CT
       
   488 */
       
   489 void CCTsyPacketContextFU::TestDeactivate0001L()
       
   490 	{
       
   491 	
       
   492 	OpenEtelServerL(EUseExtendedError);
       
   493 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   494 	OpenPhoneL();
       
   495 
       
   496 	RBuf8 data;
       
   497 	CleanupClosePushL(data);	
       
   498 	
       
   499 	RPacketService packetService;
       
   500 	OpenPacketServiceL(packetService);
       
   501 	CleanupClosePushL(packetService);
       
   502 	
       
   503 	// Open new context
       
   504 	TInfoName contextId;	
       
   505 	RPacketContext packetContext;		
       
   506 	packetContext.OpenNewContext(packetService, contextId);
       
   507 	CleanupClosePushL(packetContext);
       
   508 	
       
   509  	//-------------------------------------------------------------------------
       
   510 	// TEST A: failure to dispatch request to LTSY
       
   511  	//------------------------------------------------------------------------- 	
       
   512  	TMockLtsyData1 <TInfoName > ltsyData(contextId);
       
   513 	ltsyData.SerialiseL(data);
       
   514  	iMockLTSY.ExpectL(EPacketContextDeactivate, data, KErrNotFound);		
       
   515  	
       
   516  	TRequestStatus requestStatus;
       
   517 	packetContext.Deactivate(requestStatus);
       
   518 	User::WaitForRequest(requestStatus);
       
   519 	AssertMockLtsyStatusL();
       
   520 	ASSERT_EQUALS(KErrNotFound, requestStatus.Int());
       
   521 
       
   522 	//-------------------------------------------------------------------------
       
   523 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   524  	//-------------------------------------------------------------------------  	
       
   525     iMockLTSY.ExpectL(EPacketContextDeactivate, data);
       
   526 	iMockLTSY.CompleteL(EPacketContextDeactivate, KErrGeneral, data);
       
   527 	
       
   528 	packetContext.Deactivate(requestStatus);
       
   529 	User::WaitForRequest(requestStatus);
       
   530 	AssertMockLtsyStatusL();
       
   531 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
   532 
       
   533  	//-------------------------------------------------------------------------
       
   534 	// TEST C: Successful completion request of
       
   535 	// RPacketContext::Deactivate when result is not cached.
       
   536  	//-------------------------------------------------------------------------	
       
   537 	iMockLTSY.ExpectL(EPacketContextDeactivate, data);
       
   538 	iMockLTSY.CompleteL(EPacketContextDeactivate, KErrNone, data);
       
   539 	
       
   540 	packetContext.Deactivate(requestStatus);
       
   541 	User::WaitForRequest(requestStatus);
       
   542 	AssertMockLtsyStatusL();
       
   543 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   544 
       
   545   	//-------------------------------------------------------------------------
       
   546 	// TEST E: Unsolicited completion of RPacketContext::Deactivate
       
   547 	// from LTSY.
       
   548  	//-------------------------------------------------------------------------
       
   549 	TRequestStatus mockLtsyStatus;
       
   550 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
   551 	iMockLTSY.CompleteL(EPacketContextDeactivate, KErrNone, data);
       
   552 	User::WaitForRequest(mockLtsyStatus);
       
   553 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   554 
       
   555 	AssertMockLtsyStatusL();
       
   556 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
   557 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   558 }
       
   559 
       
   560 
       
   561 /**
       
   562 @SYMTestCaseID BA-CTSY-PKTC-PCD-0002
       
   563 @SYMComponent  telephony_ctsy
       
   564 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::Deactivate
       
   565 @SYMTestPriority High
       
   566 @SYMTestActions Invokes cancelling of RPacketContext::Deactivate
       
   567 @SYMTestExpectedResults Pass
       
   568 @SYMTestType CT
       
   569 */
       
   570 void CCTsyPacketContextFU::TestDeactivate0002L()
       
   571 	{
       
   572 
       
   573 // This test should test cancellation of Deactivate
       
   574 // If this API does not have a cancel, the test step should be completely removed.
       
   575 
       
   576 	OpenEtelServerL(EUseExtendedError);
       
   577 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   578 	OpenPhoneL();	
       
   579 	
       
   580 	RPacketService packetService;
       
   581 	OpenPacketServiceL(packetService);
       
   582 	CleanupClosePushL(packetService);
       
   583 	
       
   584 	// Open new context
       
   585 	TInfoName contextId;	
       
   586 	RPacketContext packetContext;
       
   587 	packetContext.OpenNewContext(packetService, contextId);
       
   588 	CleanupClosePushL(packetContext);
       
   589 	
       
   590 	RBuf8 data;
       
   591 	CleanupClosePushL(data);
       
   592 
       
   593  	//-------------------------------------------------------------------------
       
   594 	// Test cancelling of RPacketContext::Deactivate
       
   595  	//-------------------------------------------------------------------------
       
   596  	TRequestStatus	requestStatus;
       
   597  	TMockLtsyData1 <TInfoName > ltsyData(contextId);
       
   598 	ltsyData.SerialiseL(data);
       
   599 	
       
   600 	iMockLTSY.ExpectL(EPacketContextDeactivate, data);
       
   601 	iMockLTSY.CompleteL(EPacketContextDeactivate, KErrNone, data, 10);
       
   602 	
       
   603 	packetContext.Deactivate(requestStatus);
       
   604 	packetContext.CancelAsyncRequest(EPacketContextDeactivate);
       
   605 	User::WaitForRequest(requestStatus);
       
   606 	
       
   607 	// CTSY has started a request and it is not possible to then cancel 
       
   608     // this request. The best thing for the TSY to do in this case is to
       
   609     // proceed as though the Cancel never happened.    
       
   610 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   611 	
       
   612 	AssertMockLtsyStatusL();
       
   613 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
   614 	CleanupStack::PopAndDestroy(2); // data, this	
       
   615 	}
       
   616 
       
   617 
       
   618 
       
   619 /**
       
   620 @SYMTestCaseID BA-CTSY-PKTC-PCD-0004
       
   621 @SYMComponent  telephony_ctsy
       
   622 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::Deactivate
       
   623 @SYMTestPriority High
       
   624 @SYMTestActions Invokes multiple client requests to RPacketContext::Deactivate
       
   625 @SYMTestExpectedResults Pass
       
   626 @SYMTestType CT
       
   627 */
       
   628 void CCTsyPacketContextFU::TestDeactivate0004L()
       
   629 	{
       
   630 					
       
   631 	OpenEtelServerL(EUseExtendedError);
       
   632 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   633 	OpenPhoneL();
       
   634 
       
   635 	RBuf8 data;
       
   636 	CleanupClosePushL(data);
       
   637 	
       
   638 	RBuf8 data2;
       
   639 	CleanupClosePushL(data2);
       
   640 
       
   641 	// Open second client
       
   642 	RTelServer telServer2;
       
   643 	TInt ret = telServer2.Connect();
       
   644 	ASSERT_EQUALS(KErrNone, ret);
       
   645 	CleanupClosePushL(telServer2);
       
   646 
       
   647 	RMobilePhone phone2;
       
   648 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
   649 	ASSERT_EQUALS(KErrNone, ret);
       
   650 	CleanupClosePushL(phone2);
       
   651 	
       
   652 	RPacketService packetService;
       
   653 	OpenPacketServiceL(packetService);
       
   654 	CleanupClosePushL(packetService);
       
   655 
       
   656 	RPacketService packetService2;                
       
   657 	ret = packetService2.Open(phone2);
       
   658 	ASSERT_EQUALS(KErrNone, ret);
       
   659 	CleanupClosePushL(packetService2);
       
   660 	
       
   661 	// Open first context
       
   662 	TInfoName contextId;	
       
   663 	RPacketContext packetContext;
       
   664 	packetContext.OpenNewContext(packetService, contextId);
       
   665 	CleanupClosePushL(packetContext);
       
   666 	
       
   667 	// Open second context
       
   668 	TInfoName contextId2;	
       
   669 	RPacketContext packetContext2;
       
   670 	packetContext2.OpenNewContext(packetService2, contextId2);
       
   671 	CleanupClosePushL(packetContext2);
       
   672 	
       
   673 	TRequestStatus mockLtsyStatus;
       
   674 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   675 
       
   676 	//-------------------------------------------------------------------------
       
   677 	// Test A: Test multiple clients requesting RPacketContext::Deactivate
       
   678  	//-------------------------------------------------------------------------
       
   679 	
       
   680 	TRequestStatus	requestStatus;
       
   681  	TMockLtsyData1 <TInfoName > ltsyData(contextId);
       
   682 	ltsyData.SerialiseL(data);
       
   683 	
       
   684 	// data for second context
       
   685 	TRequestStatus	requestStatus2;
       
   686  	TMockLtsyData1 <TInfoName > ltsyData2(contextId2);
       
   687 	ltsyData2.SerialiseL(data2);
       
   688 	
       
   689 	iMockLTSY.ExpectL(EPacketContextDeactivate, data);
       
   690 	iMockLTSY.CompleteL(EPacketContextDeactivate, KErrNone, data, 10);
       
   691 	
       
   692 	iMockLTSY.ExpectL(EPacketContextDeactivate, data2);
       
   693 	iMockLTSY.CompleteL(EPacketContextDeactivate, KErrNone, data2, 10);
       
   694 	
       
   695 	packetContext.Deactivate(requestStatus);
       
   696 	packetContext2.Deactivate(requestStatus2);
       
   697 	
       
   698 	User::WaitForRequest(requestStatus);
       
   699 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   700 	User::WaitForRequest(requestStatus2);
       
   701 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   702 
       
   703 	CleanupStack::PopAndDestroy(4); // packetContext, packetService, packetContext2, packetService2
       
   704 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, data, data2, this
       
   705 
       
   706 	}
       
   707 
       
   708 
       
   709 /**
       
   710 @SYMTestCaseID BA-CTSY-PKTC-PCD-0005
       
   711 @SYMComponent  telephony_ctsy
       
   712 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Deactivate with timeout
       
   713 @SYMTestPriority High
       
   714 @SYMTestActions Invokes RPacketContext::Deactivate and tests for timeout
       
   715 @SYMTestExpectedResults Pass
       
   716 @SYMTestType CT
       
   717 */
       
   718 void CCTsyPacketContextFU::TestDeactivate0005L()
       
   719 	{
       
   720 
       
   721 	OpenEtelServerL(EUseExtendedError);
       
   722 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   723 	OpenPhoneL();
       
   724 
       
   725 	RBuf8 data;
       
   726 	CleanupClosePushL(data);
       
   727 	
       
   728 	RPacketService packetService;
       
   729 	OpenPacketServiceL(packetService);
       
   730 	CleanupClosePushL(packetService);
       
   731 	
       
   732 	// Open new context
       
   733 	TInfoName contextId;	
       
   734 	RPacketContext packetContext;
       
   735 	packetContext.OpenNewContext(packetService, contextId);
       
   736 	CleanupClosePushL(packetContext);
       
   737 
       
   738 	//-------------------------------------------------------------------------
       
   739 	// Test A: Test timeout of RPacketContext::Deactivate
       
   740  	//-------------------------------------------------------------------------
       
   741 	TRequestStatus	requestStatus;
       
   742 	TMockLtsyData1 <TInfoName > ltsyData(contextId);
       
   743 	ltsyData.SerialiseL(data);
       
   744 
       
   745 	iMockLTSY.ExpectL(EPacketContextDeactivate, data);	
       
   746 	packetContext.Deactivate(requestStatus);
       
   747 	
       
   748 	User::WaitForRequest(requestStatus);
       
   749 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
   750 	
       
   751 	AssertMockLtsyStatusL();
       
   752 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
   753 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   754 
       
   755 	}
       
   756 
       
   757 
       
   758 /**
       
   759 @SYMTestCaseID BA-CTSY-PKTC-PCGDI-0001
       
   760 @SYMComponent  telephony_ctsy
       
   761 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetDnsInfo
       
   762 @SYMTestPriority High
       
   763 @SYMTestActions Invokes RPacketContext::GetDnsInfo
       
   764 @SYMTestExpectedResults Pass
       
   765 @SYMTestType CT
       
   766 */
       
   767 void CCTsyPacketContextFU::TestGetDnsInfo0001L()
       
   768 	{
       
   769 
       
   770 	OpenEtelServerL(EUseExtendedError);
       
   771 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   772 	OpenPhoneL();
       
   773 
       
   774 	RPacketService packetService;
       
   775 	OpenPacketServiceL(packetService);
       
   776 	CleanupClosePushL(packetService);
       
   777 	
       
   778 	// Open new context
       
   779 	TInfoName contextId;	
       
   780 	RPacketContext packetContext;
       
   781 	packetContext.OpenNewContext(packetService, contextId);
       
   782 	CleanupClosePushL(packetContext);
       
   783 
       
   784 	 //------------------------------------------------------------------------
       
   785 	// TEST D: RPacketContext::GetDnsInfo again, this time CTSY
       
   786 	// will get result from the cache.
       
   787  	//-------------------------------------------------------------------------
       
   788 	TRequestStatus	requestStatus;
       
   789 	RPacketContext::TDnsInfoV2  dnsInfo;
       
   790 	
       
   791 	// init dnsInfo with same data, in order to check that it will be changed
       
   792 	_LIT(Kdummy, "Something");
       
   793 	dnsInfo.iPrimaryDns.Copy(Kdummy);
       
   794 	dnsInfo.iSecondaryDns.Copy(Kdummy);	
       
   795 	TPckg<RPacketContext::TDnsInfoV2> pckgDnsInfo(dnsInfo);	
       
   796 	
       
   797 	// call API itself
       
   798 	packetContext.GetDnsInfo(requestStatus, pckgDnsInfo);
       
   799 	
       
   800 	User::WaitForRequest(requestStatus);
       
   801 	AssertMockLtsyStatusL();
       
   802 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   803 	TBuf8<50> null50;
       
   804 	ASSERT_EQUALS(null50, dnsInfo.iPrimaryDns);
       
   805 	ASSERT_EQUALS(null50, dnsInfo.iSecondaryDns);
       
   806 		
       
   807 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this	
       
   808 	}
       
   809 
       
   810 /**
       
   811 @SYMTestCaseID BA-CTSY-PKTC-PCGDI-0003
       
   812 @SYMComponent  telephony_ctsy
       
   813 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetDnsInfo with bad parameter data
       
   814 @SYMTestPriority High
       
   815 @SYMTestActions Invokes RPacketContext::GetDnsInfo with bad parameter data
       
   816 @SYMTestExpectedResults Pass
       
   817 @SYMTestType CT
       
   818 */
       
   819 void CCTsyPacketContextFU::TestGetDnsInfo0003L()
       
   820 	{
       
   821 	OpenEtelServerL(EUseExtendedError);
       
   822 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   823 	OpenPhoneL();
       
   824 	
       
   825 	RPacketService packetService;
       
   826 	OpenPacketServiceL(packetService);
       
   827 	CleanupClosePushL(packetService);
       
   828 	
       
   829 	// Open new context
       
   830 	TInfoName contextId;	
       
   831 	RPacketContext packetContext;
       
   832 	packetContext.OpenNewContext(packetService, contextId);
       
   833 	CleanupClosePushL(packetContext);
       
   834 
       
   835 	//-------------------------------------------------------------------------
       
   836 	// Test A: Test passing wrong version of parameters to
       
   837 	// RPacketContext::GetDnsInfo
       
   838  	//-------------------------------------------------------------------------
       
   839 	TRequestStatus	requestStatus;
       
   840 	TInt  wrongDnsInfo;
       
   841 	TPckg<TInt> pckgDnsInfo(wrongDnsInfo);	
       
   842 	
       
   843 	packetContext.GetDnsInfo(requestStatus, pckgDnsInfo);
       
   844 	User::WaitForRequest(requestStatus);
       
   845 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
   846 	
       
   847 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this
       
   848 	}
       
   849 
       
   850 
       
   851 /**
       
   852 @SYMTestCaseID BA-CTSY-PKTC-PCLCP-0001
       
   853 @SYMComponent  telephony_ctsy
       
   854 @SYMTestCaseDesc Test support in CTSY for RPacketContext::LoanCommPort
       
   855 @SYMTestPriority High
       
   856 @SYMTestActions Invokes RPacketContext::LoanCommPort
       
   857 @SYMTestExpectedResults Pass
       
   858 @SYMTestType CT
       
   859 */
       
   860 void CCTsyPacketContextFU::TestLoanCommPort0001L()
       
   861 	{
       
   862 	OpenEtelServerL(EUseExtendedError);
       
   863 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   864 	OpenPhoneL();
       
   865 
       
   866 	RPacketService packetService;
       
   867 	OpenPacketServiceL(packetService);
       
   868 	CleanupClosePushL(packetService);
       
   869 	
       
   870 	// Open new context
       
   871 	TInfoName contextId;	
       
   872 	RPacketContext packetContext;
       
   873 	packetContext.OpenNewContext(packetService, contextId);
       
   874 	CleanupClosePushL(packetContext);
       
   875 	
       
   876 	//-------------------------------------------------------------------------
       
   877 	// Test that this function isn't supported
       
   878  	//-------------------------------------------------------------------------
       
   879 	TRequestStatus	 requestStatus;
       
   880 	RCall::TCommPort dataPort;
       
   881 	packetContext.LoanCommPort(requestStatus, dataPort);
       
   882 	
       
   883 	User::WaitForRequest(requestStatus);
       
   884 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
   885 
       
   886 	AssertMockLtsyStatusL();
       
   887 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this
       
   888 	}
       
   889 
       
   890 
       
   891 /**
       
   892 @SYMTestCaseID BA-CTSY-PKTC-PCGPN-0001
       
   893 @SYMComponent  telephony_ctsy
       
   894 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetProfileName
       
   895 @SYMTestPriority High
       
   896 @SYMTestActions Invokes RPacketContext::GetProfileName
       
   897 @SYMTestExpectedResults Pass
       
   898 @SYMTestType CT
       
   899 */
       
   900 void CCTsyPacketContextFU::TestGetProfileName0001L()
       
   901 	{
       
   902 	OpenEtelServerL(EUseExtendedError);
       
   903 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   904 	OpenPhoneL();
       
   905 	
       
   906 	RPacketService packetService;
       
   907 	OpenPacketServiceL(packetService);
       
   908 	CleanupClosePushL(packetService);
       
   909 	
       
   910 	// Open new context
       
   911 	TInfoName contextId;	
       
   912 	RPacketContext packetContext;
       
   913 	packetContext.OpenNewContext(packetService, contextId);
       
   914 	CleanupClosePushL(packetContext);	
       
   915 	
       
   916 	//-------------------------------------------------------------------------
       
   917 	//  check that no profile has been defined
       
   918  	//-------------------------------------------------------------------------
       
   919 	TName qosProfile;
       
   920 	TName null;
       
   921 	TInt status = packetContext.GetProfileName(qosProfile);
       
   922 	ASSERT_EQUALS(KErrNone, status);
       
   923 	// check that no profile has been defined
       
   924 	ASSERT_EQUALS(null, qosProfile);
       
   925 	
       
   926 	//-------------------------------------------------------------------------
       
   927 	// Get Name of existing QoS
       
   928  	//-------------------------------------------------------------------------
       
   929 	// create New QoS
       
   930 	RPacketQoS packetQoS;
       
   931 	TName qosName;
       
   932 	packetQoS.OpenNewQoS(packetContext, qosName);
       
   933 	CleanupClosePushL(packetQoS);
       
   934 	
       
   935 	status = packetContext.GetProfileName(qosProfile);
       
   936 	ASSERT_EQUALS(KErrNone, status);
       
   937 	ASSERT_EQUALS(qosName, qosProfile);
       
   938 	
       
   939 	AssertMockLtsyStatusL();
       
   940 	CleanupStack::PopAndDestroy(4, this); //packetQoS, packetService, packetContext, this	
       
   941 	}
       
   942 
       
   943 
       
   944 /**
       
   945 @SYMTestCaseID BA-CTSY-PKTC-PCRCP-0001
       
   946 @SYMComponent  telephony_ctsy
       
   947 @SYMTestCaseDesc Test support in CTSY for RPacketContext::RecoverCommPort
       
   948 @SYMTestPriority High
       
   949 @SYMTestActions Invokes RPacketContext::RecoverCommPort
       
   950 @SYMTestExpectedResults Pass
       
   951 @SYMTestType CT
       
   952 */
       
   953 void CCTsyPacketContextFU::TestRecoverCommPort0001L()
       
   954 	{
       
   955 
       
   956 	OpenEtelServerL(EUseExtendedError);
       
   957 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   958 	OpenPhoneL();
       
   959 
       
   960 	RPacketService packetService;
       
   961 	OpenPacketServiceL(packetService);
       
   962 	CleanupClosePushL(packetService);
       
   963 	
       
   964 	// Open new context
       
   965 	TInfoName contextId;	
       
   966 	RPacketContext packetContext;
       
   967 	packetContext.OpenNewContext(packetService, contextId);
       
   968 	CleanupClosePushL(packetContext);	
       
   969 	
       
   970 	//-------------------------------------------------------------------------
       
   971 	// Test that this function isn't supported
       
   972  	//-------------------------------------------------------------------------
       
   973 	TRequestStatus	 requestStatus;
       
   974 	packetContext.RecoverCommPort(requestStatus);
       
   975 	
       
   976 	User::WaitForRequest(requestStatus);
       
   977 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
   978 
       
   979 	AssertMockLtsyStatusL();
       
   980 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this
       
   981 	
       
   982 	}
       
   983 
       
   984 
       
   985 
       
   986 /**
       
   987 @SYMTestCaseID BA-CTSY-PKTC-PCGLEC-0001
       
   988 @SYMComponent  telephony_ctsy
       
   989 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetLastErrorCause
       
   990 @SYMTestPriority High
       
   991 @SYMTestActions Invokes RPacketContext::GetLastErrorCause
       
   992 @SYMTestExpectedResults Pass
       
   993 @SYMTestType CT
       
   994 */
       
   995 void CCTsyPacketContextFU::TestGetLastErrorCause0001L()
       
   996 	{
       
   997 
       
   998 	OpenEtelServerL(EUseExtendedError);
       
   999 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1000 	OpenPhoneL();
       
  1001 
       
  1002 	RPacketService packetService;
       
  1003 	OpenPacketServiceL(packetService);
       
  1004 	CleanupClosePushL(packetService);
       
  1005 	
       
  1006 	// Open new context
       
  1007 	TInfoName contextId;	
       
  1008 	RPacketContext packetContext;
       
  1009 	packetContext.OpenNewContext(packetService, contextId);
       
  1010 	CleanupClosePushL(packetContext);	
       
  1011 	
       
  1012 	RBuf8 data;
       
  1013 	CleanupClosePushL(data);
       
  1014 	
       
  1015 	
       
  1016 	//-------------------------------------------------------------------------
       
  1017 	// Check that there is no error on begin
       
  1018  	//-------------------------------------------------------------------------
       
  1019 	TInt error;
       
  1020 	TInt status = packetContext.GetLastErrorCause(error);
       
  1021 	ASSERT_EQUALS(KErrNone, status);
       
  1022 	ASSERT_EQUALS(KErrNone, error);
       
  1023 
       
  1024 	
       
  1025  	//-------------------------------------------------------------------------
       
  1026 	// Emulate some error
       
  1027  	//-------------------------------------------------------------------------
       
  1028  		
       
  1029 	// -------Set context in to Activating state -------------------------------
       
  1030 	TContextMisc  completeMisc;
       
  1031     completeMisc.iStatus = RPacketContext::EStatusActivating;    
       
  1032  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData1(contextId, completeMisc);
       
  1033 	ltsyData1.SerialiseL(data);	
       
  1034 	
       
  1035 	TRequestStatus mockLtsyStatus;
       
  1036 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1037 	//send completion
       
  1038 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrNone, data);
       
  1039 	// wait for completion
       
  1040 	User::WaitForRequest(mockLtsyStatus);
       
  1041 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  1042 	
       
  1043 	// ------- Emulate an error  -------------------------------
       
  1044     completeMisc.iStatus = RPacketContext::EStatusActive;    
       
  1045  	TMockLtsyData2 <TInfoName, TContextMisc> ltsyData(contextId, completeMisc);
       
  1046 	data.Close();
       
  1047 	ltsyData.SerialiseL(data);		
       
  1048 
       
  1049 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1050 	//send completion
       
  1051 	iMockLTSY.CompleteL(EPacketContextNotifyStatusChange, KErrGeneral, data);
       
  1052 	// wait for completion
       
  1053 	User::WaitForRequest(mockLtsyStatus);
       
  1054 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  1055 	
       
  1056 	// Get the error
       
  1057 	status = packetContext.GetLastErrorCause(error);
       
  1058 	ASSERT_EQUALS(KErrNone, status);
       
  1059 	ASSERT_EQUALS(KErrGeneral, error);
       
  1060 	
       
  1061 	AssertMockLtsyStatusL();
       
  1062 	CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data, this
       
  1063 		
       
  1064 	}
       
  1065 
       
  1066 
       
  1067 /**
       
  1068 @SYMTestCaseID BA-CTSY-PKTC-PCIC-0001
       
  1069 @SYMComponent  telephony_ctsy
       
  1070 @SYMTestCaseDesc Test support in CTSY for RPacketContext::InitialiseContext
       
  1071 @SYMTestPriority High
       
  1072 @SYMTestActions Invokes RPacketContext::InitialiseContext
       
  1073 @SYMTestExpectedResults Pass
       
  1074 @SYMTestType CT
       
  1075 */
       
  1076 void CCTsyPacketContextFU::TestInitialiseContext0001L()
       
  1077 	{
       
  1078 
       
  1079 	OpenEtelServerL(EUseExtendedError);
       
  1080 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1081 	OpenPhoneL();
       
  1082 
       
  1083 	RPacketService packetService;
       
  1084 	OpenPacketServiceL(packetService);
       
  1085 	CleanupClosePushL(packetService);
       
  1086 	
       
  1087 	// Open new context
       
  1088 	TInfoName contextId;	
       
  1089 	RPacketContext packetContext;
       
  1090 	packetContext.OpenNewContext(packetService, contextId);
       
  1091 	CleanupClosePushL(packetContext);	
       
  1092 
       
  1093 	RBuf8 data;
       
  1094 	CleanupClosePushL(data);
       
  1095 	
       
  1096 	RBuf8 expectData;
       
  1097 	CleanupClosePushL(expectData);
       
  1098 		
       
  1099  	//-------------------------------------------------------------------------
       
  1100 	// TEST A: failure to dispatch request to LTSY
       
  1101  	//-------------------------------------------------------------------------
       
  1102  	TInfoName hostCidName;
       
  1103     TMockLtsyData2< TInfoName, TInfoName > ltsyExpect(contextId, hostCidName);
       
  1104 	ltsyExpect.SerialiseL(expectData);
       
  1105  	
       
  1106  	// data for initialisation of the context 
       
  1107 	TRequestStatus requestStatus;
       
  1108 	RPacketContext::TDataChannelV2 dataCh;
       
  1109 	TPckg<RPacketContext::TDataChannelV2> pckgInit(dataCh);
       
  1110 	
       
  1111 	iMockLTSY.ExpectL(EPacketContextInitialiseContext,expectData, KErrNotSupported);
       
  1112 	//initialisation of the context
       
  1113 	packetContext.InitialiseContext(requestStatus, pckgInit);
       
  1114 	User::WaitForRequest(requestStatus);
       
  1115 	AssertMockLtsyStatusL();
       
  1116 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  1117 
       
  1118 	//-------------------------------------------------------------------------
       
  1119 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  1120  	//-------------------------------------------------------------------------	
       
  1121 	iMockLTSY.ExpectL(EPacketContextInitialiseContext, expectData);
       
  1122 	TMockLtsyData1< TInfoName > ltsyData(contextId);
       
  1123 	data.Close();
       
  1124 	ltsyData.SerialiseL(data);	
       
  1125 	iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrGeneral, data);
       
  1126 	
       
  1127 	//initialisation of the context
       
  1128 	packetContext.InitialiseContext(requestStatus, pckgInit);
       
  1129 	User::WaitForRequest(requestStatus);
       
  1130 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  1131 	AssertMockLtsyStatusL();
       
  1132 
       
  1133  	//-------------------------------------------------------------------------
       
  1134 	// TEST C: Successful completion request of
       
  1135 	// RPacketContext::InitialiseContext when result is not cached.
       
  1136  	//-------------------------------------------------------------------------
       
  1137 	
       
  1138 	iMockLTSY.ExpectL(EPacketContextInitialiseContext, expectData);
       
  1139 	iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrNone, data);
       
  1140 	
       
  1141 	//initialisation of the context
       
  1142 	packetContext.InitialiseContext(requestStatus, pckgInit);
       
  1143 	User::WaitForRequest(requestStatus);
       
  1144 	AssertMockLtsyStatusL();
       
  1145 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1146 	
       
  1147 	RPacketContext::TDataChannelV2 retDataCh = pckgInit();
       
  1148     ASSERT_FALSE(retDataCh.iChannelId.Compare(contextId));
       
  1149   	//-------------------------------------------------------------------------
       
  1150 	// TEST E: Unsolicited completion of RPacketContext::InitialiseContext
       
  1151 	// from LTSY.
       
  1152  	//-------------------------------------------------------------------------
       
  1153 	TRequestStatus mockLtsyStatus;
       
  1154 	
       
  1155 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1156 	iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrNone, data);
       
  1157 	User::WaitForRequest(mockLtsyStatus);
       
  1158 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1159 	
       
  1160 	AssertMockLtsyStatusL();
       
  1161 	CleanupStack::PopAndDestroy(5, this); // expectData, data, this, packetService, packetContext	
       
  1162 	}
       
  1163 
       
  1164 
       
  1165 /**
       
  1166 @SYMTestCaseID BA-CTSY-PKTC-PCIC-0002
       
  1167 @SYMComponent  telephony_ctsy
       
  1168 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::InitialiseContext
       
  1169 @SYMTestPriority High
       
  1170 @SYMTestActions Invokes cancelling of RPacketContext::InitialiseContext
       
  1171 @SYMTestExpectedResults Pass
       
  1172 @SYMTestType CT
       
  1173 */
       
  1174 void CCTsyPacketContextFU::TestInitialiseContext0002L()
       
  1175 	{
       
  1176 	OpenEtelServerL(EUseExtendedError);
       
  1177 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1178 	OpenPhoneL();
       
  1179 	
       
  1180 	RPacketService packetService;
       
  1181 	OpenPacketServiceL(packetService);
       
  1182 	CleanupClosePushL(packetService);
       
  1183 	
       
  1184 	// Open new context
       
  1185 	TInfoName contextId;	
       
  1186 	RPacketContext packetContext;
       
  1187 	packetContext.OpenNewContext(packetService, contextId);
       
  1188 	CleanupClosePushL(packetContext);	
       
  1189 
       
  1190 	TRequestStatus mockLtsyStatus;
       
  1191 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1192 
       
  1193 	RBuf8 data;
       
  1194 	CleanupClosePushL(data);
       
  1195 	
       
  1196 	RBuf8 expectData;
       
  1197 	CleanupClosePushL(expectData);
       
  1198 
       
  1199  	//-------------------------------------------------------------------------
       
  1200 	// Test cancelling of RPacketContext::InitialiseContext
       
  1201  	//-------------------------------------------------------------------------
       
  1202  	TInfoName hostCidName;
       
  1203     TMockLtsyData2< TInfoName, TInfoName > ltsyExpect(contextId, hostCidName);
       
  1204 	ltsyExpect.SerialiseL(expectData);
       
  1205  	
       
  1206  	// data for initialisation of the context 
       
  1207 	TRequestStatus requestStatus;
       
  1208 	RPacketContext::TDataChannelV2 dataCh;
       
  1209 	TPckg<RPacketContext::TDataChannelV2> pckgInit(dataCh);
       
  1210 	
       
  1211 	TMockLtsyData1< TInfoName > ltsyData(contextId);
       
  1212 	ltsyData.SerialiseL(data);
       
  1213 	
       
  1214 	iMockLTSY.ExpectL(EPacketContextInitialiseContext, expectData);	
       
  1215 	iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrNone, data, 10);
       
  1216 	
       
  1217 	//initialisation of the context
       
  1218 	packetContext.InitialiseContext(requestStatus, pckgInit);	
       
  1219 	//cancel reguest
       
  1220 	packetContext.CancelAsyncRequest(EPacketContextInitialiseContext);
       
  1221 	
       
  1222 	User::WaitForRequest(requestStatus);	
       
  1223 	// CTSY has started a request and it is not possible to then cancel 
       
  1224     // this request. The best thing for the TSY to do in this case is to
       
  1225     // proceed as though the Cancel never happened.  
       
  1226 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	 	
       
  1227 
       
  1228 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  1229 	User::WaitForRequest(mockLtsyStatus);
       
  1230 	AssertMockLtsyStatusL();
       
  1231 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
  1232 	CleanupStack::PopAndDestroy(3); // expectData, data, this
       
  1233 	
       
  1234 	}
       
  1235 
       
  1236 
       
  1237 /**
       
  1238 @SYMTestCaseID BA-CTSY-PKTC-PCIC-0003
       
  1239 @SYMComponent  telephony_ctsy
       
  1240 @SYMTestCaseDesc Test support in CTSY for RPacketContext::InitialiseContext with bad parameter data
       
  1241 @SYMTestPriority High
       
  1242 @SYMTestActions Invokes RPacketContext::InitialiseContext with bad parameter data
       
  1243 @SYMTestExpectedResults Pass
       
  1244 @SYMTestType CT
       
  1245 */
       
  1246 void CCTsyPacketContextFU::TestInitialiseContext0003L()
       
  1247 	{
       
  1248 	OpenEtelServerL(EUseExtendedError);
       
  1249 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1250 	OpenPhoneL();
       
  1251 	
       
  1252 	RPacketService packetService;
       
  1253 	OpenPacketServiceL(packetService);
       
  1254 	CleanupClosePushL(packetService);
       
  1255 	
       
  1256 	// Open new context
       
  1257 	TInfoName contextId;	
       
  1258 	RPacketContext packetContext;
       
  1259 	packetContext.OpenNewContext(packetService, contextId);
       
  1260 	CleanupClosePushL(packetContext);
       
  1261 
       
  1262 	//-------------------------------------------------------------------------
       
  1263 	// Test A: Test passing wrong version of parameters to
       
  1264 	// RPacketContext::InitialiseContext
       
  1265  	//-------------------------------------------------------------------------
       
  1266 
       
  1267 	// data for initialisation of the context 
       
  1268 	TRequestStatus requestStatus;
       
  1269 	RCall::TCommPort dataCh; // old version of parameter
       
  1270 	TPckg<RCall::TCommPort> pckgInit(dataCh);
       
  1271 	
       
  1272 	//initialisation of the context
       
  1273 	packetContext.InitialiseContext(requestStatus, pckgInit);	
       
  1274 	User::WaitForRequest(requestStatus);	
       
  1275 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  1276 	AssertMockLtsyStatusL();	 	
       
  1277 
       
  1278 	CleanupStack::PopAndDestroy(3, this); 
       
  1279 	}
       
  1280 
       
  1281 
       
  1282 /**
       
  1283 @SYMTestCaseID BA-CTSY-PKTC-PCIC-0004
       
  1284 @SYMComponent  telephony_ctsy
       
  1285 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::InitialiseContext
       
  1286 @SYMTestPriority High
       
  1287 @SYMTestActions Invokes multiple client requests to RPacketContext::InitialiseContext
       
  1288 @SYMTestExpectedResults Pass
       
  1289 @SYMTestType CT
       
  1290 */
       
  1291 void CCTsyPacketContextFU::TestInitialiseContext0004L()
       
  1292 	{
       
  1293 					
       
  1294 	OpenEtelServerL(EUseExtendedError);
       
  1295 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1296 	OpenPhoneL();
       
  1297 
       
  1298 	RBuf8 data;
       
  1299 	CleanupClosePushL(data);
       
  1300 	
       
  1301 	RBuf8 data2;
       
  1302 	CleanupClosePushL(data2);
       
  1303 	
       
  1304 	RBuf8 expectData;
       
  1305 	CleanupClosePushL(expectData);
       
  1306 	
       
  1307 	RBuf8 expectData2;
       
  1308 	CleanupClosePushL(expectData2);
       
  1309 
       
  1310 	RPacketService packetService;
       
  1311 	OpenPacketServiceL(packetService);
       
  1312 	CleanupClosePushL(packetService);
       
  1313 	
       
  1314 	// Open new context
       
  1315 	TInfoName contextId;	
       
  1316 	RPacketContext packetContext;
       
  1317 	packetContext.OpenNewContext(packetService, contextId);
       
  1318 	CleanupClosePushL(packetContext);
       
  1319 	
       
  1320 	// Open second context
       
  1321 	TInfoName contextId2;	
       
  1322 	RPacketContext packetContext2;
       
  1323 	packetContext2.OpenNewContext(packetService, contextId2);
       
  1324 	CleanupClosePushL(packetContext2);
       
  1325 
       
  1326 	//-------------------------------------------------------------------------
       
  1327 	// Test A: Test multiple clients requesting RPacketContext::InitialiseContext
       
  1328  	//-------------------------------------------------------------------------
       
  1329 
       
  1330 	// If this API is flow controlled by Etel or if this API is
       
  1331 	// synchronous, remove this test completely.
       
  1332 
       
  1333 	// To write this test:
       
  1334 	// If this API has parameters which have different versions, then each
       
  1335 	// client in this test should use a different version of parameter.
       
  1336 	// Otherwise, they should use the same version.
       
  1337 	// All versions of parameters should be used. i.e. If there are three
       
  1338 	// versions of a parameter, there should be three clients, one using
       
  1339 	// each one. If the parameter does not have different versions, use
       
  1340 	// two clients each using the same version.
       
  1341 	
       
  1342 	// for the first request
       
  1343 	TInfoName hostCidName;
       
  1344     TMockLtsyData2< TInfoName, TInfoName > ltsyExpect(contextId, hostCidName);
       
  1345 	ltsyExpect.SerialiseL(expectData);
       
  1346 	
       
  1347 	TRequestStatus requestStatus;
       
  1348 	RPacketContext::TDataChannelV2 dataCh;
       
  1349 	TPckg<RPacketContext::TDataChannelV2> pckgInit(dataCh);	
       
  1350 	TMockLtsyData1< TInfoName > ltsyData(contextId);
       
  1351 	ltsyData.SerialiseL(data);
       
  1352 	
       
  1353 	// for the second request
       
  1354     TMockLtsyData2< TInfoName, TInfoName > ltsyExpect2(contextId2, hostCidName);
       
  1355 	ltsyExpect2.SerialiseL(expectData2);
       
  1356 	
       
  1357 	TRequestStatus requestStatus2;
       
  1358 	RPacketContext::TDataChannelV2 dataCh2;
       
  1359 	TPckg<RPacketContext::TDataChannelV2> pckgInit2(dataCh2);	
       
  1360 	TMockLtsyData1< TInfoName > ltsyData2(contextId2);
       
  1361 	ltsyData2.SerialiseL(data2);
       
  1362 	
       
  1363 	iMockLTSY.ExpectL(EPacketContextInitialiseContext, expectData);	
       
  1364 	iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrNone, data);
       
  1365 	
       
  1366 	iMockLTSY.ExpectL(EPacketContextInitialiseContext, expectData2);	
       
  1367 	iMockLTSY.CompleteL(EPacketContextInitialiseContext, KErrNone, data2);
       
  1368 	
       
  1369 	//first request
       
  1370 	packetContext.InitialiseContext(requestStatus, pckgInit);
       
  1371 	
       
  1372 	//second request
       
  1373 	packetContext2.InitialiseContext(requestStatus2, pckgInit2);	
       
  1374 		
       
  1375 	// wait for the first answer
       
  1376 	User::WaitForRequest(requestStatus);		
       
  1377 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1378 	
       
  1379 	RPacketContext::TDataChannelV2 retDataChannel = pckgInit();
       
  1380     ASSERT_FALSE(retDataChannel.iChannelId.Compare(contextId));
       
  1381          
       
  1382     // wait for the second answer
       
  1383 	User::WaitForRequest(requestStatus2);		
       
  1384 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());	
       
  1385 	
       
  1386     retDataChannel = pckgInit2();
       
  1387     ASSERT_FALSE(retDataChannel.iChannelId.Compare(contextId2));
       
  1388         	
       
  1389     AssertMockLtsyStatusL();	 	
       
  1390 	CleanupStack::PopAndDestroy(8, this); //packetContext2, packetContext, packetService, expectData, expectData2, data, data2, this
       
  1391 
       
  1392 	}
       
  1393 
       
  1394 
       
  1395 /**
       
  1396 @SYMTestCaseID BA-CTSY-PKTC-PCIC-0005
       
  1397 @SYMComponent  telephony_ctsy
       
  1398 @SYMTestCaseDesc Test support in CTSY for RPacketContext::InitialiseContext with timeout
       
  1399 @SYMTestPriority High
       
  1400 @SYMTestActions Invokes RPacketContext::InitialiseContext and tests for timeout
       
  1401 @SYMTestExpectedResults Pass
       
  1402 @SYMTestType CT
       
  1403 */
       
  1404 void CCTsyPacketContextFU::TestInitialiseContext0005L()
       
  1405 	{
       
  1406 
       
  1407 	OpenEtelServerL(EUseExtendedError);
       
  1408 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1409 	OpenPhoneL();
       
  1410 	
       
  1411 	RPacketService packetService;
       
  1412 	OpenPacketServiceL(packetService);
       
  1413 	CleanupClosePushL(packetService);
       
  1414 	
       
  1415 	// Open new context
       
  1416 	TInfoName contextId;	
       
  1417 	RPacketContext packetContext;
       
  1418 	packetContext.OpenNewContext(packetService, contextId);
       
  1419 	CleanupClosePushL(packetContext);
       
  1420 	
       
  1421 	RBuf8 expectData;
       
  1422 	CleanupClosePushL(expectData);
       
  1423 
       
  1424 	//-------------------------------------------------------------------------
       
  1425 	// Test A: Test timeout of RPacketContext::InitialiseContext
       
  1426  	//-------------------------------------------------------------------------
       
  1427 	TRequestStatus requestStatus;
       
  1428 	RPacketContext::TDataChannelV2 dataCh;
       
  1429 	TPckg<RPacketContext::TDataChannelV2> pckgInit(dataCh);	
       
  1430 	
       
  1431 	TInfoName hostCidName;
       
  1432     TMockLtsyData2< TInfoName, TInfoName > ltsyExpect(contextId, hostCidName);
       
  1433 	ltsyExpect.SerialiseL(expectData);
       
  1434 
       
  1435 	iMockLTSY.ExpectL(EPacketContextInitialiseContext, expectData);
       
  1436 		
       
  1437 	packetContext.InitialiseContext(requestStatus, pckgInit);
       
  1438 	
       
  1439 	User::WaitForRequest(requestStatus);		
       
  1440 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  1441 
       
  1442 	// Done !
       
  1443 	AssertMockLtsyStatusL();
       
  1444 	CleanupStack::PopAndDestroy(4, this); //packetService, packetContext, expectData, this
       
  1445 	}
       
  1446 
       
  1447 
       
  1448 /**
       
  1449 @SYMTestCaseID BA-CTSY-PKTC-PCGCS-0001
       
  1450 @SYMComponent  telephony_ctsy
       
  1451 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetConnectionSpeed
       
  1452 @SYMTestPriority High
       
  1453 @SYMTestActions Invokes RPacketContext::GetConnectionSpeed
       
  1454 @SYMTestExpectedResults Pass
       
  1455 @SYMTestType CT
       
  1456 */
       
  1457 void CCTsyPacketContextFU::TestGetConnectionSpeed0001L()
       
  1458 	{
       
  1459 	OpenEtelServerL(EUseExtendedError);
       
  1460 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1461 	OpenPhoneL();
       
  1462 	
       
  1463 	RBuf8 data;
       
  1464 	CleanupClosePushL(data);
       
  1465 	
       
  1466 	RPacketService packetService;
       
  1467 	OpenPacketServiceL(packetService);
       
  1468 	CleanupClosePushL(packetService);
       
  1469 	
       
  1470 	// Open new context
       
  1471 	TInfoName contextId;	
       
  1472 	RPacketContext packetContext;
       
  1473 	packetContext.OpenNewContext(packetService, contextId);
       
  1474 	CleanupClosePushL(packetContext);
       
  1475 	
       
  1476  	//-------------------------------------------------------------------------
       
  1477 	// TEST D: RPacketContext::ModifyActiveContext again, this time CTSY
       
  1478 	// will get result from the cache.
       
  1479  	//-------------------------------------------------------------------------
       
  1480 	TRequestStatus requestStatus;
       
  1481 	TUint rate;
       
  1482 	TUint null = 0;
       
  1483 	packetContext.GetConnectionSpeed(requestStatus, rate);
       
  1484 	User::WaitForRequest(requestStatus);		
       
  1485 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1486 	ASSERT_EQUALS(null, rate);
       
  1487 	AssertMockLtsyStatusL();
       
  1488 	
       
  1489 	//-------------------------------------------------------------------------
       
  1490 	// Now change the Connection Speed
       
  1491 	// and check that GetConnectionSpeed return appropriate value
       
  1492  	//-------------------------------------------------------------------------
       
  1493 	TRequestStatus mockLtsyStatus;	
       
  1494 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1495 	
       
  1496 	TInt connectionSpeed = 9600;	
       
  1497 	TMockLtsyData2< TInfoName, TInt > ltsyData(contextId, connectionSpeed);
       
  1498 	ltsyData.SerialiseL(data);
       
  1499 	
       
  1500 	// change the Connection Speed
       
  1501 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionSpeedChange, KErrNone, data);
       
  1502 	User::WaitForRequest(mockLtsyStatus);
       
  1503 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1504 	
       
  1505 	// get changed  Connection Speed
       
  1506 	packetContext.GetConnectionSpeed(requestStatus, rate);
       
  1507 	User::WaitForRequest(requestStatus);		
       
  1508 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1509 	ASSERT_EQUALS((TUint)connectionSpeed, rate);
       
  1510 	
       
  1511  	AssertMockLtsyStatusL();
       
  1512 	CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data, this	
       
  1513 	}
       
  1514 
       
  1515 
       
  1516 
       
  1517 /**
       
  1518 Cleanup CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>*
       
  1519 */
       
  1520 void CCTsyPacketContextFU::CleanupArrayPtrFlat(TAny* aSelf)
       
  1521 	{
       
  1522 	if(aSelf)
       
  1523 		{
       
  1524 		CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* array (NULL);
       
  1525 		array = static_cast<CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>*>(aSelf);
       
  1526 		array->ResetAndDestroy();
       
  1527 		delete array;
       
  1528 		}	
       
  1529 	}
       
  1530 
       
  1531 
       
  1532 
       
  1533 /**
       
  1534 @SYMTestCaseID BA-CTSY-PKTC-PCMAC-0001
       
  1535 @SYMComponent  telephony_ctsy
       
  1536 @SYMTestCaseDesc Test support in CTSY for RPacketContext::ModifyActiveContext
       
  1537 @SYMTestPriority High
       
  1538 @SYMTestActions Invokes RPacketContext::ModifyActiveContext
       
  1539 @SYMTestExpectedResults Pass
       
  1540 @SYMTestType CT
       
  1541 */
       
  1542 void CCTsyPacketContextFU::TestModifyActiveContext0001L()
       
  1543 	{
       
  1544 
       
  1545 	OpenEtelServerL(EUseExtendedError);
       
  1546 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1547 	OpenPhoneL();
       
  1548 
       
  1549 	RBuf8 data;
       
  1550 	CleanupClosePushL(data);
       
  1551 	
       
  1552 	RBuf8 expectData;
       
  1553 	CleanupClosePushL(expectData);
       
  1554 	
       
  1555 	RBuf8 expectDataSPP;
       
  1556 	CleanupClosePushL(expectDataSPP);
       
  1557 	
       
  1558 	RPacketService packetService;
       
  1559 	OpenPacketServiceL(packetService);
       
  1560 	CleanupClosePushL(packetService);
       
  1561 	
       
  1562 	// Open new context
       
  1563 	TInfoName contextId;	
       
  1564 	RPacketContext packetContext;
       
  1565 	packetContext.OpenNewContext(packetService, contextId);
       
  1566 	CleanupClosePushL(packetContext);
       
  1567 	
       
  1568 	// initialisation of the context 
       
  1569 	TInt err = InitContextL(packetContext, contextId);
       
  1570 	ASSERT_EQUALS(KErrNone, err);
       
  1571 		
       
  1572  	//-------------------------------------------------------------------------
       
  1573 	// TEST: call ModifyActiveContext when context wasn't active
       
  1574  	//-------------------------------------------------------------------------	
       
  1575 	TRequestStatus requestStatus;	
       
  1576 	packetContext.ModifyActiveContext(requestStatus);
       
  1577 	User::WaitForRequest(requestStatus);		
       
  1578 	AssertMockLtsyStatusL();
       
  1579 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  1580 	
       
  1581  	
       
  1582  	// Set context in Active state
       
  1583  	err = SetContextActiveL(contextId);
       
  1584  	ASSERT_EQUALS(KErrNone, err);	
       
  1585  	
       
  1586 	//-------------------------------------------------------------------------
       
  1587 	// TEST: call ModifyActiveContext when context is active, but with no QoS object created
       
  1588  	//------------------------------------------------------------------------- 	
       
  1589 	packetContext.ModifyActiveContext(requestStatus);
       
  1590 	User::WaitForRequest(requestStatus);		
       
  1591 	AssertMockLtsyStatusL();
       
  1592 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());	
       
  1593 	
       
  1594 	// ------ create New QoS -------------------------------------------------
       
  1595 	RPacketQoS packetQoS;
       
  1596 	TName qosName;
       
  1597 	packetQoS.OpenNewQoS(packetContext, qosName);
       
  1598 	CleanupClosePushL(packetQoS);	
       
  1599 	//-------------------------------------------------------------------------
       
  1600 	// TEST: call ModifyActiveContext when context is active, and QoS object is created, but 
       
  1601 	// with no ProfileParameters
       
  1602  	//------------------------------------------------------------------------- 
       
  1603  	packetContext.ModifyActiveContext(requestStatus);
       
  1604 	User::WaitForRequest(requestStatus);		
       
  1605 	AssertMockLtsyStatusL();
       
  1606 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());	
       
  1607  	
       
  1608  	
       
  1609 	// ------ SetProfileParameters --------------------------------------------
       
  1610 	RPacketQoS::TQoSGPRSRequested gprsRequested;	
       
  1611 	TPckg<RPacketQoS::TQoSGPRSRequested> pckg(gprsRequested);
       
  1612 	
       
  1613 	// prepare data for expectDataSPP ... 
       
  1614 	// ... context status
       
  1615 	RPacketContext::TContextStatus contextStatus = RPacketContext::EStatusActive;
       
  1616 	// ... get  contextConfig
       
  1617 	RPacketContext::TContextConfigGPRS contextConfig;
       
  1618 	TPckg< RPacketContext::TContextConfigGPRS > contextConfigPckg( contextConfig );	
       
  1619 	packetContext.GetConfig(requestStatus, contextConfigPckg);
       
  1620 	User::WaitForRequest(requestStatus);	
       
  1621 	
       
  1622 	// data for SetProfileParameters's ExpectL
       
  1623 	TInfoName primaryContextName;	
       
  1624 	TContextParams	contextParams;
       
  1625 	contextParams.iContextName = contextId;
       
  1626 	contextParams.iContextType = contextConfig.iNWIContext;
       
  1627 	contextParams.iPdpType = contextConfig.iPdpType;
       
  1628 	contextParams.iPrimaryContextName = primaryContextName;
       
  1629 	contextParams.iContextStatus = contextStatus;		
       
  1630 	TMockLtsyData2<TContextParams, RPacketQoS::TQoSGPRSRequested> 
       
  1631 	                    expExpect(contextParams, gprsRequested);
       
  1632     expExpect.SerialiseL(expectDataSPP);
       
  1633 	
       
  1634 	iMockLTSY.ExpectL(EPacketQoSSetProfileParams, expectDataSPP);
       
  1635 	packetQoS.SetProfileParameters(requestStatus, pckg);
       
  1636 	User::WaitForRequest(requestStatus);		
       
  1637 	AssertMockLtsyStatusL();
       
  1638 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1639 	
       
  1640 	//-------------------------------------------------------------------------
       
  1641 	// TEST A: failure to dispatch request to LTSY
       
  1642  	//-------------------------------------------------------------------------
       
  1643  	// data for ExpectL
       
  1644  	RPacketQoS::TQoSGPRSRequested* qosProfile97 = &gprsRequested;
       
  1645     	
       
  1646  	TContextConfiguration expectConfig;
       
  1647  	expectConfig.iContextName = contextId;
       
  1648     expectConfig.iQosParams97 = qosProfile97;
       
  1649     expectConfig.iQosParams99 = NULL;
       
  1650 	expectConfig.iQosParamsR5 = NULL;
       
  1651     expectConfig.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  1652  	
       
  1653 	CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* mediaAuthorizationArray(NULL);
       
  1654  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  1655  																			ltsyExpect(expectConfig, mediaAuthorizationArray);
       
  1656 	ltsyExpect.SerialiseL(expectData);	 	
       
  1657  	//ExpectL
       
  1658  	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData, KErrNotSupported);
       
  1659  	
       
  1660  	packetContext.ModifyActiveContext(requestStatus);
       
  1661 	User::WaitForRequest(requestStatus);		
       
  1662 	AssertMockLtsyStatusL();
       
  1663 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  1664 
       
  1665 	//-------------------------------------------------------------------------
       
  1666 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  1667  	//-------------------------------------------------------------------------
       
  1668  	TBuf8<1> rejectionCode(1);
       
  1669  	TMockLtsyData2 < TInfoName, TBuf8<1> > ltsyData2(contextId, rejectionCode);
       
  1670 	ltsyData2.SerialiseL(data);
       
  1671  	
       
  1672 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  1673 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrGeneral, data);
       
  1674  	packetContext.ModifyActiveContext(requestStatus);
       
  1675 	User::WaitForRequest(requestStatus);		
       
  1676 	AssertMockLtsyStatusL();
       
  1677 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  1678 
       
  1679  	//-------------------------------------------------------------------------
       
  1680 	// TEST C: Successful completion request of
       
  1681 	// RPacketContext::ModifyActiveContext when result is not cached.
       
  1682  	//-------------------------------------------------------------------------
       
  1683 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  1684 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data);
       
  1685  	packetContext.ModifyActiveContext(requestStatus);
       
  1686 	User::WaitForRequest(requestStatus);		
       
  1687 	AssertMockLtsyStatusL();
       
  1688 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1689 	
       
  1690 	//-------------------------------------------------------------------------
       
  1691 	// TEST Successful completion request of
       
  1692 	// RPacketContext::ModifyActiveContext with some filter added
       
  1693  	//-------------------------------------------------------------------------	
       
  1694 	// Open new secondary context
       
  1695 	TInfoName contextIdSecondary;	
       
  1696 	RPacketContext packetContextSecondary;
       
  1697 	err = packetContextSecondary.OpenNewSecondaryContext(packetService, contextId, contextIdSecondary);
       
  1698  	ASSERT_EQUALS(KErrNone, err);	
       
  1699 	CleanupClosePushL(packetContextSecondary);
       
  1700 	
       
  1701     // setting environement (add media authorization to CTSY)
       
  1702 	mediaAuthorizationArray = new(ELeave) CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>(1);
       
  1703 	CleanupStack::PushL(TCleanupItem(CleanupArrayPtrFlat,mediaAuthorizationArray));
       
  1704 
       
  1705     RPacketContext::CTFTMediaAuthorizationV3* media  = RPacketContext::CTFTMediaAuthorizationV3::NewL(); 
       
  1706     CleanupStack::PushL(media);
       
  1707     media->iAuthorizationToken = _L8("testtok");
       
  1708     RPacketContext::CTFTMediaAuthorizationV3::TFlowIdentifier fid;
       
  1709 	fid.iIPFlowNumber = 2;
       
  1710 	fid.iMediaComponentNumber = 3;
       
  1711 	media->iFlowIds.Append(fid);
       
  1712 	fid.iIPFlowNumber = 4;
       
  1713 	fid.iMediaComponentNumber = 5;
       
  1714 	media->iFlowIds.Append(fid);
       
  1715 	mediaAuthorizationArray->AppendL(media);
       
  1716 	CleanupStack::Pop(); //media
       
  1717  	
       
  1718  	// update contextConfig
       
  1719  	packetContext.GetConfig(requestStatus, contextConfigPckg);	
       
  1720 	User::WaitForRequest(requestStatus);
       
  1721 	
       
  1722 	TMockLtsyContextData2<TInfoName, RPacketContext::CTFTMediaAuthorizationV3* > 
       
  1723 		expAddData(contextConfig, 0, contextIdSecondary, media);
       
  1724 	data.Close();
       
  1725 	expAddData.SerialiseL(data);
       
  1726     iMockLTSY.ExpectL(EPacketAddMediaAuthorization, data);
       
  1727 
       
  1728  	TMockLtsyData1<TInfoName > contexName(contextIdSecondary);
       
  1729 	data.Close();
       
  1730     contexName.SerialiseL(data);
       
  1731     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  1732 
       
  1733  	packetContextSecondary.AddMediaAuthorizationL(requestStatus, *media);	
       
  1734 	User::WaitForRequest(requestStatus);
       
  1735 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1736 	AssertMockLtsyStatusL();
       
  1737 
       
  1738 	// set context Active
       
  1739 	SetContextActiveL(contextIdSecondary);
       
  1740 	AssertMockLtsyStatusL();
       
  1741 	
       
  1742 	RPacketQoS packetQoSSecondary;
       
  1743 	RPacketQoS::TQoSGPRSRequested secondaryRequested;
       
  1744 	err = CreateQoSAndSetProfileParamLC(packetQoSSecondary, packetContextSecondary,
       
  1745 											 contextIdSecondary, secondaryRequested, contextId);// contextId -- is name of "primary" context
       
  1746 	ASSERT_EQUALS(KErrNone, err);
       
  1747 	AssertMockLtsyStatusL();
       
  1748 	
       
  1749 	// Add filter
       
  1750 	RPacketContext::TPacketFilterV2 filter;
       
  1751 	filter.iId = 1;
       
  1752 	RPacketContext::TPacketFilterV2Pckg filterPckg (filter);
       
  1753 	err = AddContextPacketFilterL(packetContextSecondary, contextIdSecondary,filter, ETrue);// ETrue means that this request doesn't reache LTSY
       
  1754 	ASSERT_EQUALS(KErrNone, err);
       
  1755 	AssertMockLtsyStatusL();		
       
  1756 	
       
  1757 	// data for ExpectL    	
       
  1758 	expectConfig.iContextName = contextIdSecondary;
       
  1759 	expectConfig.iQosParams97 = &secondaryRequested;
       
  1760 	expectConfig.iQosParams99 = NULL;
       
  1761 	expectConfig.iQosParamsR5 = NULL;
       
  1762 	expectConfig.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  1763  	
       
  1764  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  1765 	                                                     ltsyExpect2(expectConfig, mediaAuthorizationArray);
       
  1766 	expectData.Close();
       
  1767 	ltsyExpect2.SerialiseL(expectData); 
       
  1768 	
       
  1769 	// data for CompleteL
       
  1770 	TMockLtsyData2 < TInfoName, TBuf8<1> > ltsyData3(contextIdSecondary, rejectionCode);
       
  1771 	data.Close();
       
  1772 	ltsyData3.SerialiseL(data);
       
  1773 	
       
  1774 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  1775 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data);
       
  1776  	packetContextSecondary.ModifyActiveContext(requestStatus);
       
  1777 	User::WaitForRequest(requestStatus);	
       
  1778 	AssertMockLtsyStatusL();
       
  1779 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1780 	
       
  1781 	
       
  1782 	//-------------------------------------------------------------------------
       
  1783 	// TEST Successful completion request of
       
  1784 	// RPacketContext::ModifyActiveContext with some filter removed
       
  1785  	//-------------------------------------------------------------------------	
       
  1786 	TInt filterId = 1;
       
  1787 	packetContextSecondary.RemovePacketFilter(requestStatus, filterId);
       
  1788 	User::WaitForRequest(requestStatus);
       
  1789 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  1790 	AssertMockLtsyStatusL();		
       
  1791 	
       
  1792 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  1793 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data);
       
  1794  	packetContextSecondary.ModifyActiveContext(requestStatus);
       
  1795 	User::WaitForRequest(requestStatus);	
       
  1796 	AssertMockLtsyStatusL();
       
  1797 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1798 	
       
  1799 
       
  1800   	//-------------------------------------------------------------------------
       
  1801 	// TEST E: Unsolicited completion of RPacketContext::ModifyActiveContext
       
  1802 	// from LTSY.
       
  1803  	//-------------------------------------------------------------------------	
       
  1804  	TRequestStatus mockLtsyStatus;
       
  1805  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  1806 	//send completion
       
  1807 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data);
       
  1808 	// wait for completion
       
  1809 	User::WaitForRequest(mockLtsyStatus);
       
  1810 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1811 
       
  1812 
       
  1813 	AssertMockLtsyStatusL();
       
  1814 	CleanupStack::PopAndDestroy(4);	// packetQoSSecondary, mediaAuthorizationArray, packetContextSecondary, packetQoS
       
  1815 	CleanupStack::PopAndDestroy(6, this); //packetContext, packetService, expectDataSPP, expectData, data, this
       
  1816 	
       
  1817 	}
       
  1818 
       
  1819 
       
  1820 /**
       
  1821 @SYMTestCaseID BA-CTSY-PKTC-PCMAC-0002
       
  1822 @SYMComponent  telephony_ctsy
       
  1823 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::ModifyActiveContext
       
  1824 @SYMTestPriority High
       
  1825 @SYMTestActions Invokes cancelling of RPacketContext::ModifyActiveContext
       
  1826 @SYMTestExpectedResults Pass
       
  1827 @SYMTestType CT
       
  1828 */
       
  1829 void CCTsyPacketContextFU::TestModifyActiveContext0002L()
       
  1830 	{
       
  1831 	OpenEtelServerL(EUseExtendedError);
       
  1832 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1833 	OpenPhoneL();
       
  1834 
       
  1835 	RBuf8 data;
       
  1836 	CleanupClosePushL(data);
       
  1837 	
       
  1838 	RBuf8 expectData;
       
  1839 	CleanupClosePushL(expectData);
       
  1840 	
       
  1841 	RPacketService packetService;
       
  1842 	OpenPacketServiceL(packetService);
       
  1843 	CleanupClosePushL(packetService);
       
  1844 	
       
  1845 	// Open new context
       
  1846 	TInfoName contextId;	
       
  1847 	RPacketContext packetContext;
       
  1848 	packetContext.OpenNewContext(packetService, contextId);
       
  1849 	CleanupClosePushL(packetContext);
       
  1850 	
       
  1851 	// initialisation of the context 
       
  1852 	TInt status = InitContextL(packetContext, contextId);
       
  1853 	ASSERT_EQUALS(KErrNone, status);
       
  1854 		
       
  1855  	// Set context in Active state
       
  1856  	status = SetContextActiveL(contextId);
       
  1857  	ASSERT_EQUALS(KErrNone, status);
       
  1858  	
       
  1859  	//SetProfileParameters
       
  1860  	RPacketQoS::TQoSGPRSRequested gprsRequested;
       
  1861  	RPacketQoS packetQoS;
       
  1862  	status = CreateQoSAndSetProfileParamLC(packetQoS, packetContext ,contextId, gprsRequested);
       
  1863 	ASSERT_EQUALS(KErrNone, status);
       
  1864 
       
  1865  	//-------------------------------------------------------------------------
       
  1866 	// Test cancelling of RPacketContext::ModifyActiveContext
       
  1867  	//-------------------------------------------------------------------------
       
  1868  	// data for ExpectL
       
  1869  	RPacketQoS::TQoSGPRSRequested* qosProfile97 = &gprsRequested;
       
  1870     	
       
  1871 	CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* expectArray = NULL;
       
  1872  	TContextConfiguration expectConfig;
       
  1873  	expectConfig.iContextName = contextId;
       
  1874     expectConfig.iQosParams97 = qosProfile97;
       
  1875     expectConfig.iQosParams99 = NULL;
       
  1876 	expectConfig.iQosParamsR5 = NULL;
       
  1877     expectConfig.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  1878  	
       
  1879  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  1880  																			ltsyExpect(expectConfig, expectArray);
       
  1881 	ltsyExpect.SerialiseL(expectData);	 
       
  1882  	
       
  1883  	TRequestStatus requestStatus;
       
  1884  	
       
  1885  	// data for CompleteL
       
  1886 	TBuf8<1> rejectionCode(1);
       
  1887  	TMockLtsyData2 < TInfoName, TBuf8<1> > ltsyData2(contextId, rejectionCode);
       
  1888 	ltsyData2.SerialiseL(data);
       
  1889  	
       
  1890 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  1891 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data, 10);
       
  1892  	packetContext.ModifyActiveContext(requestStatus);
       
  1893  	 	
       
  1894  	// cancel request
       
  1895  	packetContext.CancelAsyncRequest(EPacketContextModifyActiveContext); 	
       
  1896 	User::WaitForRequest(requestStatus);		
       
  1897 	AssertMockLtsyStatusL();
       
  1898 	// TSY has started a request and it is not possible to then cancel 
       
  1899     // this request. The best thing for the TSY to do in this case is to
       
  1900     // proceed as though the Cancel never happened.		
       
  1901 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1902 	
       
  1903 	CleanupStack::PopAndDestroy();//packetQoS
       
  1904 	CleanupStack::PopAndDestroy(5, this); // packetService, packetContext,  expectData, data,  this
       
  1905 	}
       
  1906 
       
  1907 
       
  1908 /**
       
  1909 @SYMTestCaseID BA-CTSY-PKTC-PCMAC-0004
       
  1910 @SYMComponent  telephony_ctsy
       
  1911 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::ModifyActiveContext
       
  1912 @SYMTestPriority High
       
  1913 @SYMTestActions Invokes multiple client requests to RPacketContext::ModifyActiveContext
       
  1914 @SYMTestExpectedResults Pass
       
  1915 @SYMTestType CT
       
  1916 */
       
  1917 void CCTsyPacketContextFU::TestModifyActiveContext0004L()
       
  1918 	{
       
  1919 					
       
  1920 	OpenEtelServerL(EUseExtendedError);
       
  1921 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1922 	OpenPhoneL();
       
  1923 
       
  1924 	RBuf8 data;
       
  1925 	CleanupClosePushL(data);
       
  1926 	
       
  1927 	RBuf8 expectData;
       
  1928 	CleanupClosePushL(expectData);
       
  1929 	
       
  1930 	RBuf8 expectData2;
       
  1931 	CleanupClosePushL(expectData2);
       
  1932 	
       
  1933 	RBuf8 expectData3;
       
  1934 	CleanupClosePushL(expectData3);
       
  1935 	
       
  1936 	// Open second client
       
  1937 	RTelServer telServer2;
       
  1938 	TInt ret = telServer2.Connect();
       
  1939 	ASSERT_EQUALS(KErrNone, ret);
       
  1940 	CleanupClosePushL(telServer2);
       
  1941 
       
  1942 	RMobilePhone phone2;
       
  1943 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  1944 	ASSERT_EQUALS(KErrNone, ret);
       
  1945 	CleanupClosePushL(phone2);
       
  1946 
       
  1947 	RPacketService packetService;
       
  1948 	OpenPacketServiceL(packetService);
       
  1949 	CleanupClosePushL(packetService);
       
  1950 	
       
  1951 	// Open first context
       
  1952 	TInfoName contextId;	
       
  1953 	RPacketContext packetContext;
       
  1954 	packetContext.OpenNewContext(packetService, contextId);
       
  1955 	CleanupClosePushL(packetContext);
       
  1956 	
       
  1957 	// Open second context
       
  1958 	TInfoName contextId2;	
       
  1959 	RPacketContext packetContext2;
       
  1960 	packetContext2.OpenNewContext(packetService, contextId2);
       
  1961 	CleanupClosePushL(packetContext2);
       
  1962 	
       
  1963 	// Open third context
       
  1964 	TInfoName contextId3;	
       
  1965 	RPacketContext packetContext3;
       
  1966 	packetContext3.OpenNewContext(packetService, contextId3);
       
  1967 	CleanupClosePushL(packetContext3);
       
  1968 
       
  1969 	// initialisation of the first context 
       
  1970 	TInt status = InitContextL(packetContext, contextId);
       
  1971 	ASSERT_EQUALS(KErrNone, status);
       
  1972 		
       
  1973  	// Set first context in Active state
       
  1974  	status = SetContextActiveL(contextId);
       
  1975  	ASSERT_EQUALS(KErrNone, status);
       
  1976  	
       
  1977  	//SetProfileParameters first context's
       
  1978  	RPacketQoS::TQoSGPRSRequested gprsRequested;
       
  1979  	RPacketQoS packetQoS;
       
  1980  	status = CreateQoSAndSetProfileParamLC(packetQoS, packetContext,contextId, gprsRequested);
       
  1981 	ASSERT_EQUALS(KErrNone, status);
       
  1982 	
       
  1983 	
       
  1984 	// initialisation of the second context 
       
  1985 	status = InitContextL(packetContext2, contextId2);
       
  1986 	ASSERT_EQUALS(KErrNone, status);
       
  1987 		
       
  1988  	// Set second context in Active state
       
  1989  	status = SetContextActiveL(contextId2);
       
  1990  	ASSERT_EQUALS(KErrNone, status);
       
  1991  	
       
  1992  	//SetProfileParameters second context's
       
  1993  	RPacketQoS::TQoSR99_R4Requested rel99Requested;
       
  1994  	RPacketQoS packetQoS2;
       
  1995  	status = CreateQoSAndSetProfileParamLC(packetQoS2, packetContext2, contextId2, rel99Requested);
       
  1996 	ASSERT_EQUALS(KErrNone, status);
       
  1997 	
       
  1998 	
       
  1999 	// initialisation of the third context 
       
  2000 	status = InitContextL(packetContext3, contextId3);
       
  2001 	ASSERT_EQUALS(KErrNone, status);
       
  2002 		
       
  2003  	// Set third context in Active state
       
  2004  	status = SetContextActiveL(contextId3);
       
  2005  	ASSERT_EQUALS(KErrNone, status);
       
  2006  	
       
  2007  	//SetProfileParameters third context's
       
  2008  	RPacketQoS::TQoSR5Requested r5Requested;	
       
  2009 	RPacketQoS packetQoS3;
       
  2010  	status = CreateQoSAndSetProfileParamLC(packetQoS3, packetContext3, contextId3, r5Requested);
       
  2011 	ASSERT_EQUALS(KErrNone, status);
       
  2012 		
       
  2013  	//-------------------------------------------------------------------------
       
  2014 	// Test A: Test multiple clients requesting RPacketContext::ModifyActiveContext
       
  2015  	//------------------------------------------------------------------------- 	
       
  2016 	TBuf8<1> rejectionCode(1);
       
  2017 	// data for the first ExpectL     	
       
  2018 	CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* expectArray = NULL;
       
  2019  	TContextConfiguration expectConfig;
       
  2020  	expectConfig.iContextName = contextId;
       
  2021     expectConfig.iQosParams97 = &gprsRequested;
       
  2022     expectConfig.iQosParams99 = NULL;
       
  2023 	expectConfig.iQosParamsR5 = NULL;
       
  2024     expectConfig.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  2025  	
       
  2026  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  2027  																			ltsyExpect(expectConfig, expectArray);
       
  2028 	ltsyExpect.SerialiseL(expectData);	 
       
  2029 	
       
  2030 	// data for the second ExpectL 
       
  2031   	TContextConfiguration expectConfig2;
       
  2032  	expectConfig2.iContextName = contextId2;
       
  2033     expectConfig2.iQosParams97 = NULL;
       
  2034     expectConfig2.iQosParams99 = &rel99Requested;
       
  2035 	expectConfig2.iQosParamsR5 = NULL;
       
  2036     expectConfig2.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  2037  	
       
  2038  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  2039  																			ltsyExpect2(expectConfig2, expectArray);
       
  2040 	ltsyExpect2.SerialiseL(expectData2);	 
       
  2041 	
       
  2042 	// data for the third ExpectL 
       
  2043   	TContextConfiguration expectConfig3;
       
  2044  	expectConfig3.iContextName = contextId3;
       
  2045     expectConfig3.iQosParams97 = NULL;
       
  2046     expectConfig3.iQosParams99 = NULL;
       
  2047 	expectConfig3.iQosParamsR5 = &r5Requested;
       
  2048     expectConfig3.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  2049  	
       
  2050  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  2051  																			ltsyExpect3(expectConfig3, expectArray);
       
  2052 	ltsyExpect3.SerialiseL(expectData3);	 
       
  2053 	
       
  2054   
       
  2055     // prepare and send first request
       
  2056 	TMockLtsyData2 < TInfoName, TBuf8<1> > dataForComplete(contextId, rejectionCode);
       
  2057 	dataForComplete.SerialiseL(data);	 	
       
  2058 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  2059 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data, 10);  	
       
  2060  	TRequestStatus requestStatus; 	
       
  2061  	packetContext.ModifyActiveContext(requestStatus);
       
  2062  
       
  2063 	// prepare and send first request 
       
  2064  	TMockLtsyData2 < TInfoName, TBuf8<1> > dataForComplete2(contextId2, rejectionCode);
       
  2065 	data.Close();
       
  2066 	dataForComplete2.SerialiseL(data);
       
  2067 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData2);
       
  2068 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data, 10); 	
       
  2069  	TRequestStatus requestStatus2;
       
  2070  	packetContext2.ModifyActiveContext(requestStatus2); 	
       
  2071  	
       
  2072  	// prepare and send third request 
       
  2073  	TMockLtsyData2 < TInfoName, TBuf8<1> > dataForComplete3(contextId3, rejectionCode);
       
  2074 	data.Close();
       
  2075 	dataForComplete3.SerialiseL(data);
       
  2076 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData3);
       
  2077 	iMockLTSY.CompleteL(EPacketContextModifyActiveContext, KErrNone, data, 10); 	
       
  2078  	TRequestStatus requestStatus3;
       
  2079  	packetContext3.ModifyActiveContext(requestStatus3);  	
       
  2080  	
       
  2081  	// wait for first answer
       
  2082  	User::WaitForRequest(requestStatus);		
       
  2083 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2084 	
       
  2085 	// wait for second answer
       
  2086 	User::WaitForRequest(requestStatus2);		
       
  2087 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  2088 	
       
  2089 	// wait for third answer
       
  2090 	User::WaitForRequest(requestStatus3);		
       
  2091 	AssertMockLtsyStatusL();
       
  2092 	ASSERT_EQUALS(KErrNone, requestStatus3.Int());
       
  2093 	
       
  2094 	CleanupStack::PopAndDestroy(3); // packetQoS, packetQoS2, packetQoS3, 
       
  2095 	CleanupStack::PopAndDestroy(11, this); //packetContext, packetContext2,packetContext3
       
  2096 											//packetService, phone2,telServer2, 
       
  2097 										   //expectData3, expectData2, expectData, data, this									   
       
  2098 
       
  2099 	}
       
  2100 
       
  2101 
       
  2102 /**
       
  2103 @SYMTestCaseID BA-CTSY-PKTC-PCMAC-0005
       
  2104 @SYMComponent  telephony_ctsy
       
  2105 @SYMTestCaseDesc Test support in CTSY for RPacketContext::ModifyActiveContext with timeout
       
  2106 @SYMTestPriority High
       
  2107 @SYMTestActions Invokes RPacketContext::ModifyActiveContext and tests for timeout
       
  2108 @SYMTestExpectedResults Pass
       
  2109 @SYMTestType CT
       
  2110 */
       
  2111 void CCTsyPacketContextFU::TestModifyActiveContext0005L()
       
  2112 	{
       
  2113 	
       
  2114 	OpenEtelServerL(EUseExtendedError);
       
  2115 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2116 	OpenPhoneL();
       
  2117 
       
  2118 	RBuf8 data;
       
  2119 	CleanupClosePushL(data);
       
  2120 	
       
  2121 	RBuf8 expectData;
       
  2122 	CleanupClosePushL(expectData);
       
  2123 
       
  2124 	RPacketService packetService;
       
  2125 	OpenPacketServiceL(packetService);
       
  2126 	CleanupClosePushL(packetService);
       
  2127 	
       
  2128 	// Open new context
       
  2129 	TInfoName contextId;	
       
  2130 	RPacketContext packetContext;
       
  2131 	packetContext.OpenNewContext(packetService, contextId);
       
  2132 	CleanupClosePushL(packetContext);
       
  2133 	
       
  2134 	
       
  2135 	// initialisation of the context 
       
  2136 	TInt status = InitContextL(packetContext, contextId);
       
  2137 	ASSERT_EQUALS(KErrNone, status);
       
  2138 		
       
  2139  	// Set context in Active state
       
  2140  	status = SetContextActiveL(contextId);
       
  2141  	ASSERT_EQUALS(KErrNone, status);
       
  2142  	
       
  2143  	//SetProfileParameters
       
  2144  	RPacketQoS::TQoSGPRSRequested gprsRequested;
       
  2145  	RPacketQoS packetQoS;
       
  2146  	status = CreateQoSAndSetProfileParamLC(packetQoS, packetContext, contextId, gprsRequested);
       
  2147 	ASSERT_EQUALS(KErrNone, status);
       
  2148 	
       
  2149 	//-------------------------------------------------------------------------
       
  2150 	// Test A: Test timeout of RPacketContext::ModifyActiveContext
       
  2151  	//------------------------------------------------------------------------- 
       
  2152  	TRequestStatus requestStatus; 	
       
  2153  	// data for ExpectL
       
  2154  	RPacketQoS::TQoSGPRSRequested* qosProfile97 = &gprsRequested;    	
       
  2155 	CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* expectArray = NULL;
       
  2156  	TContextConfiguration expectConfig;
       
  2157  	expectConfig.iContextName = contextId;
       
  2158     expectConfig.iQosParams97 = qosProfile97;
       
  2159     expectConfig.iQosParams99 = NULL;
       
  2160 	expectConfig.iQosParamsR5 = NULL;
       
  2161     expectConfig.iConfiguration = RPacketContext::EPdpTypeIPv4;    	 	
       
  2162  	
       
  2163  	TMockLtsyData2 < TContextConfiguration, CArrayPtrFlat<RPacketContext::CTFTMediaAuthorizationV3>* > 
       
  2164  																			ltsyExpect(expectConfig, expectArray);
       
  2165 	ltsyExpect.SerialiseL(expectData);	 	
       
  2166 	
       
  2167 	iMockLTSY.ExpectL(EPacketContextModifyActiveContext, expectData);
       
  2168 	
       
  2169  	packetContext.ModifyActiveContext(requestStatus); 	
       
  2170  		
       
  2171 	User::WaitForRequest(requestStatus);		
       
  2172 	AssertMockLtsyStatusL();
       
  2173 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  2174 
       
  2175 	CleanupStack::PopAndDestroy(6, this); //packetQoS, packetService, packetContext, expectData, data, this
       
  2176 
       
  2177 	}
       
  2178 
       
  2179 
       
  2180 /**
       
  2181 @SYMTestCaseID BA-CTSY-PKTC-PCNCC-0001
       
  2182 @SYMComponent  telephony_ctsy
       
  2183 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyConfigChanged
       
  2184 @SYMTestPriority High
       
  2185 @SYMTestActions Invokes RPacketContext::NotifyConfigChanged
       
  2186 @SYMTestExpectedResults Pass
       
  2187 @SYMTestType CT
       
  2188 */
       
  2189 void CCTsyPacketContextFU::TestNotifyConfigChanged0001L()
       
  2190 	{
       
  2191 
       
  2192 	OpenEtelServerL(EUseExtendedError);
       
  2193 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2194 	OpenPhoneL();
       
  2195 
       
  2196 	RBuf8 data;
       
  2197 	CleanupClosePushL(data);
       
  2198 	
       
  2199 	RPacketService packetService;
       
  2200 	OpenPacketServiceL(packetService);
       
  2201 	CleanupClosePushL(packetService);
       
  2202 	
       
  2203 	// Open new context
       
  2204 	TInfoName contextId;	
       
  2205 	RPacketContext packetContext;
       
  2206 	packetContext.OpenNewContext(packetService, contextId);
       
  2207 	CleanupClosePushL(packetContext);
       
  2208 	
       
  2209 	TRequestStatus mockLtsyStatus;
       
  2210 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2211 	
       
  2212  	//-------------------------------------------------------------------------
       
  2213 	// TEST C: Successful completion request of
       
  2214 	// RPacketContext::NotifyConfigChanged when result is not cached.
       
  2215  	//-------------------------------------------------------------------------
       
  2216 	// data for NotifyConfigChanged	
       
  2217 	TRequestStatus requestStatus;
       
  2218 	RPacketContext::TContextConfigGPRS contextConfig;	
       
  2219 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);	
       
  2220 	
       
  2221 	//data for ComleteL   
       
  2222  	RPacketContext::TContextConfigGPRS configComplete;  	 	
       
  2223  	// (just this data is copied in CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2 
       
  2224 	// see CMmPacketContextGsmWcdma.cpp line 339) 	  
       
  2225     _LIT(KPointName, "Some Name");
       
  2226     configComplete.iAccessPointName.Copy(KPointName);
       
  2227     _LIT(KPdpAdd, "Some Add");
       
  2228     configComplete.iPdpAddress.Copy(KPdpAdd);    	
       
  2229 	configComplete.iPdpCompression = RPacketContext::KPdpDataCompression;		
       
  2230 	_LIT(KPrimaryDns, "Some PrimaryDns");
       
  2231 	configComplete.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns);
       
  2232 	_LIT(KSecondaryDns, "Some SecondaryDns");
       
  2233 	configComplete.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns);	
       
  2234  	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData(contextId, configComplete);
       
  2235 	ltsyData.SerialiseL(data);	
       
  2236 
       
  2237 	// send request	
       
  2238 	packetContext.NotifyConfigChanged(requestStatus, pckgConfig);
       
  2239 		
       
  2240 	// sent completion
       
  2241 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2242 	// wait for completion
       
  2243 	User::WaitForRequest(mockLtsyStatus);
       
  2244 		
       
  2245 	// wait for request
       
  2246 	User::WaitForRequest(requestStatus);		
       
  2247 	AssertMockLtsyStatusL();		
       
  2248 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2249 	ASSERT_EQUALS(configComplete.iAccessPointName, 		contextConfig.iAccessPointName);
       
  2250 	ASSERT_EQUALS(configComplete.iPdpAddress, 			contextConfig.iPdpAddress );
       
  2251 	ASSERT_EQUALS(configComplete.iPdpCompression, 		contextConfig.iPdpCompression);
       
  2252 	ASSERT_EQUALS(configComplete.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, 	contextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  2253 	ASSERT_EQUALS(configComplete.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, contextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);	
       
  2254 
       
  2255 	
       
  2256  	//-------------------------------------------------------------------------
       
  2257 	// TEST E: Unsolicited completion of RPacketContext::NotifyConfigChanged
       
  2258 	// from LTSY.
       
  2259  	//-------------------------------------------------------------------------
       
  2260 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2261 	// sent completion
       
  2262 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2263 	// wait for completion
       
  2264 	User::WaitForRequest(mockLtsyStatus);
       
  2265 	AssertMockLtsyStatusL();	
       
  2266 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2267 	
       
  2268 	CleanupStack::PopAndDestroy(2); // packetService, packetContext
       
  2269 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
  2270 	}
       
  2271 	
       
  2272 	
       
  2273 /**
       
  2274 @SYMTestCaseID BA-CTSY-PKTC-PCNCC-0001b
       
  2275 @SYMComponent  telephony_ctsy
       
  2276 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyConfigChanged
       
  2277 @SYMTestPriority High
       
  2278 @SYMTestActions Invokes CMmPacketServiceTsy::DialUpContext via RPacketContext::NotifyConfigChanged
       
  2279 @SYMTestExpectedResults Pass
       
  2280 @SYMTestType CT
       
  2281 */
       
  2282 void CCTsyPacketContextFU::TestNotifyConfigChanged0001bL()
       
  2283 	{
       
  2284 
       
  2285 	OpenEtelServerL(EUseExtendedError);
       
  2286 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2287 	OpenPhoneL();
       
  2288 
       
  2289 	RBuf8 data;
       
  2290 	CleanupClosePushL(data);
       
  2291 	
       
  2292 	RPacketService packetService;
       
  2293 	OpenPacketServiceL(packetService);
       
  2294 	CleanupClosePushL(packetService);
       
  2295 	
       
  2296 	// Open new context
       
  2297 	TInfoName contextId;	
       
  2298 	RPacketContext packetContext;
       
  2299 	packetContext.OpenNewContext(packetService, contextId);
       
  2300 	CleanupClosePushL(packetContext);
       
  2301 
       
  2302 	
       
  2303  	//-------------------------------------------------------------------------
       
  2304 	// call completition of RPacketContext::NotifyConfigChanged
       
  2305 	// to call CMmPacketServiceTsy::DialUpContext
       
  2306 	// with ContextID ==  KStringExternal
       
  2307  	//------------------------------------------------------------------------- 	
       
  2308  	//data for ComleteL   
       
  2309  	RPacketContext::TContextConfigGPRS configComplete;  	 
       
  2310  	TInfoName ContextID;	
       
  2311  	_LIT( KStringExternal,  "External"  );
       
  2312  	ContextID.Copy(KStringExternal);
       
  2313   	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData(ContextID, configComplete);
       
  2314 	ltsyData.SerialiseL(data);	
       
  2315  	
       
  2316 	TRequestStatus mockLtsyStatus;
       
  2317 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2318 	// sent completion
       
  2319 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2320 	// wait for completion
       
  2321 	User::WaitForRequest(mockLtsyStatus);
       
  2322 	AssertMockLtsyStatusL();	
       
  2323 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2324 	
       
  2325 	
       
  2326 	//-------------------------------------------------------------------------
       
  2327 	// call completition of RPacketContext::NotifyConfigChanged
       
  2328 	// to call CMmPacketServiceTsy::DialUpContext
       
  2329 	// with ContextID ==  KStringExternal2
       
  2330  	//------------------------------------------------------------------------- 	
       
  2331  	//data for ComleteL     	 
       
  2332   	_LIT( KStringExternal2,  "External2"  );
       
  2333  	ContextID.Copy(KStringExternal2);
       
  2334   	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData2(ContextID, configComplete);
       
  2335 	data.Close();
       
  2336 	ltsyData2.SerialiseL(data);	
       
  2337  	
       
  2338  	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2339 	// sent completion
       
  2340 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2341 	// wait for completion
       
  2342 	User::WaitForRequest(mockLtsyStatus);
       
  2343 	AssertMockLtsyStatusL();	
       
  2344 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2345 	
       
  2346 	
       
  2347 	//-------------------------------------------------------------------------
       
  2348 	// call completition of RPacketContext::NotifyConfigChanged
       
  2349 	// to call CMmPacketServiceTsy::DialUpContext
       
  2350 	// with (ContextID !=  KStringExternal2)&&(ContextID !=  KStringExternal)
       
  2351  	//------------------------------------------------------------------------- 	
       
  2352  	//data for ComleteL     	 
       
  2353   	_LIT( KSomeId,  "SomeId"  );
       
  2354  	ContextID.Copy(KSomeId);
       
  2355   	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData3(ContextID, configComplete);
       
  2356 	data.Close();
       
  2357 	ltsyData3.SerialiseL(data);
       
  2358  	
       
  2359  	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2360 	// sent completion
       
  2361 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2362 	// wait for completion
       
  2363 	User::WaitForRequest(mockLtsyStatus);
       
  2364 	AssertMockLtsyStatusL();	
       
  2365 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2366 	
       
  2367 	
       
  2368 	CleanupStack::PopAndDestroy(2); // packetService, packetContext
       
  2369 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
  2370 	}
       
  2371 
       
  2372 /**
       
  2373 @SYMTestCaseID BA-CTSY-PKTC-PCNCC-0001c
       
  2374 @SYMComponent  telephony_ctsy
       
  2375 @SYMDEF DEF126915
       
  2376 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyConfigChanged using R99/R4 Context params
       
  2377 @SYMTestPriority High
       
  2378 @SYMTestActions Invokes RPacketContext::NotifyConfigChange. R99/R4 Context params returned
       
  2379 @SYMTestExpectedResults Pass
       
  2380 @SYMTestType CT
       
  2381 */
       
  2382 void CCTsyPacketContextFU::TestNotifyConfigChanged0001cL()
       
  2383 	{
       
  2384 
       
  2385 	OpenEtelServerL(EUseExtendedError);
       
  2386 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2387 	OpenPhoneL();
       
  2388 
       
  2389 	RBuf8 data;
       
  2390 	CleanupClosePushL(data);
       
  2391 	
       
  2392 	RPacketService packetService;
       
  2393 	OpenPacketServiceL(packetService);
       
  2394 	CleanupClosePushL(packetService);
       
  2395 	
       
  2396 	// Open new context
       
  2397 	TInfoName contextId;	
       
  2398 	RPacketContext packetContext;
       
  2399 	packetContext.OpenNewContext(packetService, contextId);
       
  2400 	CleanupClosePushL(packetContext);
       
  2401 	
       
  2402 	TRequestStatus mockLtsyStatus;
       
  2403 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2404 	
       
  2405 	
       
  2406  	//-------------------------------------------------------------------------
       
  2407 	// TEST C: Successful completion request of
       
  2408 	// RPacketContext::NotifyConfigChanged, using TContextConfigR99_R4 return 
       
  2409 	// params, when result is not cached.
       
  2410  	//-------------------------------------------------------------------------
       
  2411 	// data for NotifyConfigChanged	
       
  2412 	TRequestStatus requestStatus;
       
  2413 	RPacketContext::TContextConfigGPRS contextConfig;	
       
  2414 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);	
       
  2415 	
       
  2416 	//data for ComleteL   
       
  2417  	RPacketContext::TContextConfigR99_R4 configComplete;  	 	
       
  2418  	// (just this data is copied in CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2 
       
  2419 	// see CMmPacketContextGsmWcdma.cpp line 339) 	  
       
  2420     _LIT(KPointName, "Some Name");
       
  2421     configComplete.iAccessPointName.Copy(KPointName);
       
  2422     _LIT(KPdpAdd, "Some Add");
       
  2423     configComplete.iPdpAddress.Copy(KPdpAdd);    	
       
  2424 	_LIT(KPrimaryDns, "Some PrimaryDns");
       
  2425 	configComplete.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns);
       
  2426 	_LIT(KSecondaryDns, "Some SecondaryDns");
       
  2427 	configComplete.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns);	
       
  2428  	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigR99_R4 > ltsyData(contextId, configComplete);
       
  2429 	ltsyData.SerialiseL(data);	
       
  2430 
       
  2431 	// send request	
       
  2432 	packetContext.NotifyConfigChanged(requestStatus, pckgConfig);
       
  2433 		
       
  2434 	// sent completion
       
  2435 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2436 	// wait for completion
       
  2437 	User::WaitForRequest(mockLtsyStatus);
       
  2438 		
       
  2439 	// wait for request
       
  2440 	User::WaitForRequest(requestStatus);		
       
  2441 	AssertMockLtsyStatusL();		
       
  2442 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2443 	ASSERT_EQUALS(configComplete.iAccessPointName, 		contextConfig.iAccessPointName);
       
  2444 	ASSERT_EQUALS(configComplete.iPdpAddress, 			contextConfig.iPdpAddress );
       
  2445 	ASSERT_EQUALS(configComplete.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, 	contextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  2446 	ASSERT_EQUALS(configComplete.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, contextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);	
       
  2447 
       
  2448 	CleanupStack::PopAndDestroy(2); // packetService, packetContext
       
  2449 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
  2450 	}
       
  2451 
       
  2452 
       
  2453 /**
       
  2454 @SYMTestCaseID BA-CTSY-PKTC-PCNCC-0002
       
  2455 @SYMComponent  telephony_ctsy
       
  2456 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::NotifyConfigChanged
       
  2457 @SYMTestPriority High
       
  2458 @SYMTestActions Invokes cancelling of RPacketContext::NotifyConfigChanged
       
  2459 @SYMTestExpectedResults Pass
       
  2460 @SYMTestType CT
       
  2461 */
       
  2462 void CCTsyPacketContextFU::TestNotifyConfigChanged0002L()
       
  2463 	{
       
  2464 	OpenEtelServerL(EUseExtendedError);
       
  2465 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2466 	OpenPhoneL();
       
  2467 
       
  2468 	RBuf8 data;
       
  2469 	CleanupClosePushL(data);
       
  2470 	
       
  2471 	RPacketService packetService;
       
  2472 	OpenPacketServiceL(packetService);
       
  2473 	CleanupClosePushL(packetService);
       
  2474 	
       
  2475 	// Open new context
       
  2476 	TInfoName contextId;	
       
  2477 	RPacketContext packetContext;
       
  2478 	packetContext.OpenNewContext(packetService, contextId);
       
  2479 	CleanupClosePushL(packetContext);
       
  2480 	
       
  2481 	TRequestStatus mockLtsyStatus;
       
  2482 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2483 	
       
  2484  	//-------------------------------------------------------------------------
       
  2485 	// Test cancelling of RPacketContext::NotifyConfigChanged
       
  2486  	//------------------------------------------------------------------------- 	
       
  2487 	// data for NotifyConfigChanged	
       
  2488 	TRequestStatus requestStatus;
       
  2489 	RPacketContext::TContextConfigGPRS contextConfig;	
       
  2490 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);	
       
  2491 	
       
  2492 	//data for ComleteL    
       
  2493  	RPacketContext::TContextConfigGPRS configComplete;
       
  2494  	_LIT (KNewName, "Some new Name");
       
  2495  	configComplete.iPdpAddress.Copy(KNewName); 	
       
  2496  	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData(contextId, configComplete);
       
  2497 	ltsyData.SerialiseL(data);	
       
  2498 
       
  2499 	// send request	
       
  2500 	packetContext.NotifyConfigChanged(requestStatus, pckgConfig);	
       
  2501 	//send cancellation
       
  2502 	packetContext.CancelAsyncRequest(EPacketContextNotifyConfigChanged);
       
  2503 		
       
  2504 	// sent completion
       
  2505 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2506 	// wait for completion
       
  2507 	User::WaitForRequest(mockLtsyStatus);
       
  2508 	
       
  2509 	// wait for request
       
  2510 	User::WaitForRequest(requestStatus);		
       
  2511 	AssertMockLtsyStatusL();
       
  2512 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  2513 
       
  2514 	CleanupStack::PopAndDestroy(2); // packetService, packetContext
       
  2515 	CleanupStack::PopAndDestroy(2); // data, this	
       
  2516 	}
       
  2517 
       
  2518 
       
  2519 /**
       
  2520 @SYMTestCaseID BA-CTSY-PKTC-PCNCC-0003
       
  2521 @SYMComponent  telephony_ctsy
       
  2522 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyConfigChanged with bad parameter data
       
  2523 @SYMTestPriority High
       
  2524 @SYMTestActions Invokes RPacketContext::NotifyConfigChanged with bad parameter data
       
  2525 @SYMTestExpectedResults Pass
       
  2526 @SYMTestType CT
       
  2527 */
       
  2528 void CCTsyPacketContextFU::TestNotifyConfigChanged0003L()
       
  2529 	{
       
  2530 	OpenEtelServerL(EUseExtendedError);
       
  2531 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2532 	OpenPhoneL();
       
  2533 
       
  2534 	RBuf8 data;
       
  2535 	CleanupClosePushL(data);
       
  2536 	
       
  2537 	RPacketService packetService;
       
  2538 	OpenPacketServiceL(packetService);
       
  2539 	CleanupClosePushL(packetService);
       
  2540 	
       
  2541 	// Open new context
       
  2542 	TInfoName contextId;	
       
  2543 	RPacketContext packetContext;
       
  2544 	packetContext.OpenNewContext(packetService, contextId);
       
  2545 	CleanupClosePushL(packetContext);
       
  2546 	
       
  2547 	TRequestStatus mockLtsyStatus;
       
  2548 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2549 
       
  2550 	//-------------------------------------------------------------------------
       
  2551 	// Test A: Test passing wrong version of parameters to
       
  2552 	// RPacketContext::NotifyConfigChanged
       
  2553  	//-------------------------------------------------------------------------
       
  2554 	// data for NotifyConfigChanged	
       
  2555 	TRequestStatus requestStatus;
       
  2556 	RPacketContext::TContextConfigCDMA contextConfig;	
       
  2557 	TPckg<RPacketContext::TContextConfigCDMA> pckgConfig(contextConfig);	
       
  2558 
       
  2559 	// send request	
       
  2560 	packetContext.NotifyConfigChanged(requestStatus, pckgConfig);
       
  2561 
       
  2562 	// wait for request
       
  2563 	User::WaitForRequest(requestStatus);		
       
  2564 	AssertMockLtsyStatusL();
       
  2565 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2566 
       
  2567 	CleanupStack::PopAndDestroy(2); // packetService, packetContext
       
  2568 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  2569 	}
       
  2570 
       
  2571 
       
  2572 /**
       
  2573 @SYMTestCaseID BA-CTSY-PKTC-PCNCC-0004
       
  2574 @SYMComponent  telephony_ctsy
       
  2575 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::NotifyConfigChanged
       
  2576 @SYMTestPriority High
       
  2577 @SYMTestActions Invokes multiple client requests to RPacketContext::NotifyConfigChanged
       
  2578 @SYMTestExpectedResults Pass
       
  2579 @SYMTestType CT
       
  2580 */
       
  2581 void CCTsyPacketContextFU::TestNotifyConfigChanged0004L()
       
  2582 	{
       
  2583 					
       
  2584 	OpenEtelServerL(EUseExtendedError);
       
  2585 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2586 	OpenPhoneL();
       
  2587 
       
  2588 	RBuf8 data;
       
  2589 	CleanupClosePushL(data);
       
  2590 	
       
  2591 	RBuf8 data2;
       
  2592 	CleanupClosePushL(data2);
       
  2593 
       
  2594 	// Open second client
       
  2595 	RTelServer telServer2;
       
  2596 	TInt ret = telServer2.Connect();
       
  2597 	ASSERT_EQUALS(KErrNone, ret);
       
  2598 	CleanupClosePushL(telServer2);
       
  2599 
       
  2600 	RMobilePhone phone2;
       
  2601 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  2602 	ASSERT_EQUALS(KErrNone, ret);
       
  2603 	CleanupClosePushL(phone2);
       
  2604 	
       
  2605 	RPacketService packetService;
       
  2606 	OpenPacketServiceL(packetService);
       
  2607 	CleanupClosePushL(packetService);
       
  2608 	
       
  2609 	RPacketService packetService2;                
       
  2610 	ret = packetService2.Open(phone2);
       
  2611 	ASSERT_EQUALS(KErrNone, ret);
       
  2612 	CleanupClosePushL(packetService2);
       
  2613 	
       
  2614 	// Open first context
       
  2615 	TInfoName contextId;	
       
  2616 	RPacketContext packetContext;
       
  2617 	packetContext.OpenNewContext(packetService, contextId);
       
  2618 	CleanupClosePushL(packetContext);
       
  2619 	
       
  2620 	// Open second context
       
  2621 	TInfoName contextId2;	
       
  2622 	RPacketContext packetContext2;
       
  2623 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  2624 	CleanupClosePushL(packetContext2);
       
  2625 
       
  2626 	//-------------------------------------------------------------------------
       
  2627 	// Test A: Test multiple clients requesting RPacketContext::NotifyConfigChanged
       
  2628  	//-------------------------------------------------------------------------
       
  2629 	
       
  2630 	// data for NotifyConfigChanged	1
       
  2631 	TRequestStatus requestStatus;
       
  2632 	RPacketContext::TContextConfigGPRS contextConfig1;	
       
  2633 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig1(contextConfig1);	
       
  2634 	
       
  2635 	//data for ComleteL 1   
       
  2636  	RPacketContext::TContextConfigGPRS configComplete1;
       
  2637  	// (just this data is copied in CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2 
       
  2638 	// see CMmPacketContextGsmWcdma.cpp line 339) 	  
       
  2639     _LIT(KPointName, "Some Name");
       
  2640     configComplete1.iAccessPointName.Copy(KPointName);
       
  2641     _LIT(KPdpAdd, "Some Add");
       
  2642     configComplete1.iPdpAddress.Copy(KPdpAdd);    	
       
  2643 	configComplete1.iPdpCompression = RPacketContext::KPdpDataCompression;		
       
  2644 	_LIT(KPrimaryDns, "Some PrimaryDns");
       
  2645 	configComplete1.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns);
       
  2646 	_LIT(KSecondaryDns, "Some SecondaryDns");
       
  2647 	configComplete1.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns);	 	
       
  2648  	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData(contextId, configComplete1);
       
  2649 	ltsyData.SerialiseL(data);
       
  2650 	
       
  2651 	
       
  2652 	// data for NotifyConfigChanged	2
       
  2653 	TRequestStatus requestStatus2;
       
  2654 	RPacketContext::TContextConfigR99_R4 contextConfig2;	
       
  2655 	TPckg<RPacketContext::TContextConfigR99_R4> pckgConfig2(contextConfig2);	
       
  2656 	
       
  2657 	//data for ComleteL 2 
       
  2658  	RPacketContext::TContextConfigGPRS configComplete2; 
       
  2659  	// (just this data is copied in CMmPacketContextGsmWcdmaExt::CompleteActivatePhase2 
       
  2660 	// see CMmPacketContextGsmWcdma.cpp line 339) 	  
       
  2661     _LIT(KPointName2, "Some Name2");
       
  2662     configComplete2.iAccessPointName.Copy(KPointName2);
       
  2663     _LIT(KPdpAdd2, "Some Add2");
       
  2664     configComplete2.iPdpAddress.Copy(KPdpAdd2);    	
       
  2665 	configComplete2.iPdpCompression = RPacketContext::KPdpDataCompression;		
       
  2666 	_LIT(KPrimaryDns2, "Some PrimaryDns2");
       
  2667 	configComplete2.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns2);
       
  2668 	_LIT(KSecondaryDns2, "Some SecondaryDns2");
       
  2669 	configComplete2.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns2);
       
  2670  	TMockLtsyData2 < TInfoName, RPacketContext::TContextConfigGPRS > ltsyData2(contextId2, configComplete2);
       
  2671 	ltsyData2.SerialiseL(data2);
       
  2672 	
       
  2673 	// send first request	
       
  2674 	packetContext.NotifyConfigChanged(requestStatus, pckgConfig1);
       
  2675 	
       
  2676 	// send second request	
       
  2677 	packetContext2.NotifyConfigChanged(requestStatus2, pckgConfig2);
       
  2678 	
       
  2679 	// sent first completion
       
  2680 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data);
       
  2681 	
       
  2682 	// sent second completion
       
  2683 	iMockLTSY.CompleteL(EPacketContextNotifyConfigChanged, KErrNone, data2);	
       
  2684 	
       
  2685 	// wait for first answer
       
  2686 	User::WaitForRequest(requestStatus);
       
  2687 		
       
  2688 	// wait for second answer
       
  2689 	User::WaitForRequest(requestStatus2);	
       
  2690 	AssertMockLtsyStatusL();		
       
  2691 	
       
  2692 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2693 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  2694 	
       
  2695 	
       
  2696 	ASSERT_EQUALS(configComplete1.iAccessPointName, 	contextConfig1.iAccessPointName);
       
  2697 	ASSERT_EQUALS(configComplete1.iPdpAddress, 			contextConfig1.iPdpAddress );
       
  2698 	ASSERT_EQUALS(configComplete1.iPdpCompression, 		contextConfig1.iPdpCompression);
       
  2699 	ASSERT_EQUALS(configComplete1.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, 	
       
  2700 				  contextConfig1.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  2701 	ASSERT_EQUALS(configComplete1.iProtocolConfigOption.iDnsAddresses.iSecondaryDns,
       
  2702 				  contextConfig1.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
       
  2703 				  	
       
  2704 	ASSERT_EQUALS(configComplete2.iAccessPointName, 	contextConfig2.iAccessPointName);
       
  2705 	ASSERT_EQUALS(configComplete2.iPdpAddress, 			contextConfig2.iPdpAddress);
       
  2706 	ASSERT_EQUALS(configComplete2.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, 	 
       
  2707 				  contextConfig2.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  2708 	ASSERT_EQUALS(configComplete2.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, 
       
  2709 				  contextConfig2.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
       
  2710 				  
       
  2711 	CleanupStack::PopAndDestroy(9, this); //packetContext2, packetContext, packetService2, packetService, phone2, telServer2, data,data2 this
       
  2712 	}
       
  2713 
       
  2714 
       
  2715 /**
       
  2716 @SYMTestCaseID BA-CTSY-PKTC-PCNDT-0001
       
  2717 @SYMComponent  telephony_ctsy
       
  2718 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyDataTransferred
       
  2719 @SYMTestPriority High
       
  2720 @SYMTestActions Invokes RPacketContext::NotifyDataTransferred
       
  2721 @SYMTestExpectedResults Pass
       
  2722 @SYMTestType CT
       
  2723 */
       
  2724 void CCTsyPacketContextFU::TestNotifyDataTransferred0001L()
       
  2725 	{
       
  2726 
       
  2727 	OpenEtelServerL(EUseExtendedError);
       
  2728 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2729 	OpenPhoneL();
       
  2730 	
       
  2731 	RBuf8 data;
       
  2732 	CleanupClosePushL(data);
       
  2733 		
       
  2734 	RPacketService packetService;
       
  2735 	OpenPacketServiceL(packetService);
       
  2736 	CleanupClosePushL(packetService);
       
  2737 	
       
  2738 	// Open new context
       
  2739 	TInfoName contextId;	
       
  2740 	RPacketContext packetContext;
       
  2741 	packetContext.OpenNewContext(packetService, contextId);
       
  2742 	CleanupClosePushL(packetContext);	
       
  2743 		
       
  2744 	//-------------------------------------------------------------------------
       
  2745 	//check that this requests is not supported by CTSY
       
  2746  	//-------------------------------------------------------------------------	
       
  2747 	TRequestStatus requestStatus;
       
  2748 	RPacketContext::TDataVolume volume;
       
  2749 	TUint rcvdGranularity = 1;
       
  2750 	TUint sentGranularity = 1;
       
  2751 	
       
  2752 	packetContext.NotifyDataTransferred(requestStatus, volume, rcvdGranularity, sentGranularity);
       
  2753 	User::WaitForRequest(requestStatus);		
       
  2754 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  2755 	
       
  2756 	//-------------------------------------------------------------------------
       
  2757 	// TEST E: Unsolicited completion of RPacketContext::NotifyConfigChanged
       
  2758 	// from LTSY.
       
  2759  	//-------------------------------------------------------------------------
       
  2760  	TRequestStatus mockLtsyStatus;
       
  2761 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2762 	
       
  2763 	RPacketContext::TDataVolume dataVolume;
       
  2764 	dataVolume. iBytesReceived = 111;	
       
  2765 	TMockLtsyData2 < TInfoName, RPacketContext::TDataVolume > ltsyData(contextId, dataVolume);
       
  2766 	ltsyData.SerialiseL(data);
       
  2767 	
       
  2768 	iMockLTSY.CompleteL(EPacketContextNotifyDataTransferred, KErrNone, data);
       
  2769 	
       
  2770 	User::WaitForRequest(mockLtsyStatus);		
       
  2771 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  2772 	
       
  2773 	AssertMockLtsyStatusL();
       
  2774 	CleanupStack::PopAndDestroy(4, this); // packetService, packetContext, data, this	
       
  2775 	}
       
  2776 
       
  2777 /**
       
  2778 @SYMTestCaseID BA-CTSY-PKTC-PCEPF-0001
       
  2779 @SYMComponent  telephony_ctsy
       
  2780 @SYMTestCaseDesc Test support in CTSY for RPacketContext::EnumeratePacketFilters
       
  2781 @SYMTestPriority High
       
  2782 @SYMTestActions Invokes RPacketContext::EnumeratePacketFilters
       
  2783 @SYMTestExpectedResults Pass
       
  2784 @SYMTestType CT
       
  2785 */
       
  2786 void CCTsyPacketContextFU::TestEnumeratePacketFilters0001L()
       
  2787 	{
       
  2788 
       
  2789 	OpenEtelServerL(EUseExtendedError);
       
  2790 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2791 	OpenPhoneL();
       
  2792 
       
  2793 	
       
  2794 	RPacketService packetService;
       
  2795 	OpenPacketServiceL(packetService);
       
  2796 	CleanupClosePushL(packetService);
       
  2797 	
       
  2798 	RBuf8 data;
       
  2799 	CleanupClosePushL(data);
       
  2800 	
       
  2801 	// Open new context 
       
  2802 	TInfoName contextId;	
       
  2803 	RPacketContext packetContext;
       
  2804 	packetContext.OpenNewContext(packetService, contextId);
       
  2805 	CleanupClosePushL(packetContext);	
       
  2806 	
       
  2807   	//-------------------------------------------------------------------------
       
  2808 	// TEST C: Successful completion request of
       
  2809 	// RPacketContext::EnumeratePacketFilters when result is not cached.
       
  2810  	//-------------------------------------------------------------------------
       
  2811 	TRequestStatus requestStatus;
       
  2812 	TInt count = 11;  // some nonzero value 
       
  2813 	packetContext.EnumeratePacketFilters(requestStatus, count);
       
  2814 	User::WaitForRequest(requestStatus);		
       
  2815 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2816 	ASSERT_EQUALS(0, count);
       
  2817 	
       
  2818 	
       
  2819 	//-------------------------------------------------------------------------
       
  2820 	// Add filter and test again
       
  2821  	//-------------------------------------------------------------------------	
       
  2822 	// Open new secondary context
       
  2823 	TInfoName contextIdSecondary;	
       
  2824 	RPacketContext packetContextSecondary;
       
  2825 	packetContextSecondary.OpenNewSecondaryContext(packetService, contextId, contextIdSecondary);
       
  2826 	CleanupClosePushL(packetContextSecondary);
       
  2827 			
       
  2828 	RPacketQoS packetQoSSecondary;
       
  2829 	RPacketQoS::TQoSGPRSRequested secondaryRequested;
       
  2830 	TInt err = CreateQoSAndSetProfileParamLC(packetQoSSecondary, packetContextSecondary,
       
  2831 											 contextIdSecondary, secondaryRequested, contextId);	
       
  2832 	ASSERT_EQUALS(KErrNone, err);	
       
  2833 	CleanupClosePushL(packetQoSSecondary);
       
  2834 		
       
  2835 	// add new filter
       
  2836 	RPacketContext::TPacketFilterV2 filter;
       
  2837 	filter.iId = 1;
       
  2838 	RPacketContext::TPacketFilterV2Pckg filterPckg (filter);	
       
  2839 	err = AddContextPacketFilterL(packetContextSecondary, contextIdSecondary, filter);
       
  2840 		
       
  2841 	ASSERT_EQUALS(KErrNone, err);	
       
  2842 		
       
  2843 	// send request
       
  2844 	packetContextSecondary.EnumeratePacketFilters(requestStatus, count);
       
  2845 	User::WaitForRequest(requestStatus);		
       
  2846 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2847 	ASSERT_EQUALS(1, count);		
       
  2848 
       
  2849 	AssertMockLtsyStatusL();
       
  2850 	CleanupStack::PopAndDestroy(7, this); // packetQoSSecondary, packetContextSecondary, packetService, packetContext,data, this	
       
  2851 	}
       
  2852 
       
  2853 /**
       
  2854 @SYMTestCaseID BA-CTSY-PKTC-PCEPF-0004
       
  2855 @SYMComponent  telephony_ctsy
       
  2856 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::EnumeratePacketFilters
       
  2857 @SYMTestPriority High
       
  2858 @SYMTestActions Invokes multiple client requests to RPacketContext::EnumeratePacketFilters
       
  2859 @SYMTestExpectedResults Pass
       
  2860 @SYMTestType CT
       
  2861 */
       
  2862 void CCTsyPacketContextFU::TestEnumeratePacketFilters0004L()
       
  2863 	{
       
  2864 					
       
  2865 	OpenEtelServerL(EUseExtendedError);
       
  2866 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2867 	OpenPhoneL();
       
  2868 
       
  2869 	// Open second client
       
  2870 	RTelServer telServer2;
       
  2871 	TInt ret = telServer2.Connect();
       
  2872 	ASSERT_EQUALS(KErrNone, ret);
       
  2873 	CleanupClosePushL(telServer2);
       
  2874 
       
  2875 	RMobilePhone phone2;
       
  2876 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  2877 	ASSERT_EQUALS(KErrNone, ret);
       
  2878 	CleanupClosePushL(phone2);
       
  2879 	
       
  2880 	RPacketService packetService;
       
  2881 	OpenPacketServiceL(packetService);
       
  2882 	CleanupClosePushL(packetService);
       
  2883 	
       
  2884 	RPacketService packetService2;                
       
  2885 	ret = packetService2.Open(phone2);
       
  2886 	ASSERT_EQUALS(KErrNone, ret);
       
  2887 	CleanupClosePushL(packetService2);
       
  2888 	
       
  2889 	// Open first context
       
  2890 	TInfoName contextId;	
       
  2891 	RPacketContext packetContext;
       
  2892 	packetContext.OpenNewContext(packetService, contextId);
       
  2893 	CleanupClosePushL(packetContext);
       
  2894 	
       
  2895 	// Open second context
       
  2896 	TInfoName contextId2;	
       
  2897 	RPacketContext packetContext2;
       
  2898 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  2899 	CleanupClosePushL(packetContext2);
       
  2900 
       
  2901 	//-------------------------------------------------------------------------
       
  2902 	// Test A: Test multiple clients requesting RPacketContext::EnumeratePacketFilters
       
  2903  	//-------------------------------------------------------------------------
       
  2904 	
       
  2905 	TRequestStatus requestStatus;
       
  2906 	TInt count = 11;  // some nonzero value 
       
  2907 	TRequestStatus requestStatus2;
       
  2908 	TInt count2 = 22;  // some nonzero value 
       
  2909 	
       
  2910 	// send first request
       
  2911 	packetContext.EnumeratePacketFilters(requestStatus, count);
       
  2912 	// send second request
       
  2913 	packetContext2.EnumeratePacketFilters(requestStatus2, count2);
       
  2914 	
       
  2915 	User::WaitForRequest(requestStatus);		
       
  2916 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2917 	ASSERT_EQUALS(0, count);
       
  2918 	
       
  2919 	User::WaitForRequest(requestStatus2);		
       
  2920 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  2921 	ASSERT_EQUALS(0, count2);
       
  2922 		
       
  2923 	CleanupStack::PopAndDestroy(7, this); // packetContext2, packetContext, packetService2, packetService, phone2, telServer2, this
       
  2924 	}
       
  2925 
       
  2926 
       
  2927 /**
       
  2928 @SYMTestCaseID BA-CTSY-PKTC-PCGDVT-0001
       
  2929 @SYMComponent  telephony_ctsy
       
  2930 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetDataVolumeTransferred
       
  2931 @SYMTestPriority High
       
  2932 @SYMTestActions Invokes RPacketContext::GetDataVolumeTransferred
       
  2933 @SYMTestExpectedResults Pass
       
  2934 @SYMTestType CT
       
  2935 */
       
  2936 void CCTsyPacketContextFU::TestGetDataVolumeTransferred0001L()
       
  2937 	{
       
  2938 
       
  2939 	OpenEtelServerL(EUseExtendedError);
       
  2940 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2941 	OpenPhoneL();
       
  2942 
       
  2943 	RBuf8 data;
       
  2944 	CleanupClosePushL(data);
       
  2945 	
       
  2946 	RBuf8 expectData;
       
  2947 	CleanupClosePushL(expectData);
       
  2948 	
       
  2949 	RPacketService packetService;
       
  2950 	OpenPacketServiceL(packetService);
       
  2951 	CleanupClosePushL(packetService);
       
  2952 	
       
  2953 	// Open new context
       
  2954 	TInfoName contextId;	
       
  2955 	RPacketContext packetContext;	
       
  2956 	packetContext.OpenNewContext(packetService, contextId);
       
  2957 	CleanupClosePushL(packetContext);		
       
  2958 		
       
  2959  	//-------------------------------------------------------------------------
       
  2960 	// TEST A: failure to dispatch request to LTSY
       
  2961  	//-------------------------------------------------------------------------
       
  2962  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  2963 	expData.SerialiseL(expectData);
       
  2964  	
       
  2965 	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred,expectData, KErrNotSupported);	
       
  2966 	
       
  2967 	TRequestStatus requestStatus;
       
  2968 	RPacketContext::TDataVolume volume;	
       
  2969 	packetContext.GetDataVolumeTransferred(requestStatus, volume);
       
  2970 	User::WaitForRequest(requestStatus);		
       
  2971 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2972 	AssertMockLtsyStatusL();
       
  2973 
       
  2974 	//-------------------------------------------------------------------------
       
  2975 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2976  	//-------------------------------------------------------------------------	
       
  2977  	// data for CompleteL
       
  2978  	RPacketContext::TDataVolume volumeCompleteL;
       
  2979  	volumeCompleteL.iBytesReceived = 0x111;
       
  2980  	volumeCompleteL.iBytesSent     = 0x222;
       
  2981  	TMockLtsyData2 <TInfoName, RPacketContext::TDataVolume > ltsyData1(contextId, volumeCompleteL);
       
  2982 	ltsyData1.SerialiseL(data);
       
  2983  	
       
  2984  	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred, expectData);	 	
       
  2985  	iMockLTSY.CompleteL(EPacketContextGetDataVolumeTransferred, KErrGeneral, data);	
       
  2986 	
       
  2987 	packetContext.GetDataVolumeTransferred(requestStatus, volume);
       
  2988 	User::WaitForRequest(requestStatus);		
       
  2989 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  2990 	AssertMockLtsyStatusL();
       
  2991 		
       
  2992  	//-------------------------------------------------------------------------
       
  2993 	// TEST C: Successful completion request of
       
  2994 	// RPacketContext::GetDataVolumeTransferred when result is not cached.
       
  2995  	//-------------------------------------------------------------------------
       
  2996 	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred, expectData);	 	
       
  2997  	iMockLTSY.CompleteL(EPacketContextGetDataVolumeTransferred, KErrNone, data);	
       
  2998 	
       
  2999 	packetContext.GetDataVolumeTransferred(requestStatus, volume);
       
  3000 	User::WaitForRequest(requestStatus);		
       
  3001 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3002 	ASSERT_EQUALS(volumeCompleteL.iBytesReceived, volume.iBytesReceived);
       
  3003 	ASSERT_EQUALS(volumeCompleteL.iBytesSent, volume.iBytesSent);
       
  3004 	AssertMockLtsyStatusL();
       
  3005 
       
  3006   	//-------------------------------------------------------------------------
       
  3007 	// TEST E: Unsolicited completion of RPacketContext::GetDataVolumeTransferred
       
  3008 	// from LTSY.
       
  3009  	//-------------------------------------------------------------------------
       
  3010 	TRequestStatus mockLtsyStatus;
       
  3011 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3012 	
       
  3013 	iMockLTSY.CompleteL(EPacketContextGetDataVolumeTransferred, KErrNone, data);
       
  3014 	User::WaitForRequest(mockLtsyStatus);		
       
  3015 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  3016 	AssertMockLtsyStatusL();
       
  3017 		
       
  3018 	//-------------------------------------------------------------------------
       
  3019 	// TEST of RPacketContext::GetDataVolumeTransferred
       
  3020 	// when ContextStatus == RPacketContext::EStatusDeleted in CMmPacketContextTsy
       
  3021  	//------------------------------------------------------------------------- 		
       
  3022 	
       
  3023 	// set Context status as RPacketContext::EStatusDeleted	
       
  3024 	TInt err = SetContextStatusL(contextId, RPacketContext::EStatusDeleted);
       
  3025 	ASSERT_EQUALS(KErrNone, err);	
       
  3026 	
       
  3027 	// send request	
       
  3028 	packetContext.GetDataVolumeTransferred(requestStatus, volume);
       
  3029 	User::WaitForRequest(requestStatus);		
       
  3030 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3031 	ASSERT_EQUALS(volumeCompleteL.iBytesReceived, volume.iBytesReceived);
       
  3032 	ASSERT_EQUALS(volumeCompleteL.iBytesSent, volume.iBytesSent);		
       
  3033 
       
  3034 	AssertMockLtsyStatusL();
       
  3035 	CleanupStack::PopAndDestroy(5, this); // packetContext, packetService, expectData, data, this
       
  3036 	
       
  3037 	}
       
  3038 
       
  3039 
       
  3040 /**
       
  3041 @SYMTestCaseID BA-CTSY-PKTC-PCGDVT-0002
       
  3042 @SYMComponent  telephony_ctsy
       
  3043 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::GetDataVolumeTransferred
       
  3044 @SYMTestPriority High
       
  3045 @SYMTestActions Invokes cancelling of RPacketContext::GetDataVolumeTransferred
       
  3046 @SYMTestExpectedResults Pass
       
  3047 @SYMTestType CT
       
  3048 */
       
  3049 void CCTsyPacketContextFU::TestGetDataVolumeTransferred0002L()
       
  3050 	{
       
  3051 	OpenEtelServerL(EUseExtendedError);
       
  3052 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3053 	OpenPhoneL();
       
  3054 	
       
  3055 	RPacketService packetService;
       
  3056 	OpenPacketServiceL(packetService);
       
  3057 	CleanupClosePushL(packetService);
       
  3058 	
       
  3059 	// Open new context
       
  3060 	TInfoName contextId;	
       
  3061 	RPacketContext packetContext;	
       
  3062 	packetContext.OpenNewContext(packetService, contextId);
       
  3063 	CleanupClosePushL(packetContext);	
       
  3064 	
       
  3065 	RBuf8 data;
       
  3066 	CleanupClosePushL(data);
       
  3067 	
       
  3068 	RBuf8 expectData;
       
  3069 	CleanupClosePushL(expectData);
       
  3070 
       
  3071  	//-------------------------------------------------------------------------
       
  3072 	// Test cancelling of RPacketContext::GetDataVolumeTransferred
       
  3073  	//-------------------------------------------------------------------------
       
  3074  	TRequestStatus requestStatus;
       
  3075 	RPacketContext::TDataVolume volume;	
       
  3076 	
       
  3077 	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3078 	expData.SerialiseL(expectData);
       
  3079 	
       
  3080 	// data for CompleteL
       
  3081  	RPacketContext::TDataVolume volumeCompleteL;
       
  3082  	volumeCompleteL.iBytesReceived = 0x111;
       
  3083  	volumeCompleteL.iBytesSent     = 0x222;
       
  3084  	TMockLtsyData2 <TInfoName, RPacketContext::TDataVolume > ltsyData1(contextId, volumeCompleteL);
       
  3085 	ltsyData1.SerialiseL(data);
       
  3086  	 	
       
  3087  	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred, expectData);	 	
       
  3088  	 	
       
  3089  	// send request  	
       
  3090  	packetContext.GetDataVolumeTransferred(requestStatus, volume);
       
  3091  	
       
  3092  	//sent cancelling
       
  3093  	packetContext.CancelAsyncRequest(EPacketContextGetDataVolumeTransferred); 	
       
  3094  	
       
  3095  	//send complete request
       
  3096  	iMockLTSY.CompleteL(EPacketContextGetDataVolumeTransferred, KErrNone, data, 10);
       
  3097  	
       
  3098 	User::WaitForRequest(requestStatus);		
       
  3099 	// TSY has started a request and it is not possible to then cancel 
       
  3100     // this request. The best thing for the TSY to do in this case is to
       
  3101     // proceed as though the Cancel never happened.
       
  3102 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3103 	ASSERT_EQUALS(volumeCompleteL.iBytesReceived, volume.iBytesReceived);
       
  3104 	ASSERT_EQUALS(volumeCompleteL.iBytesSent, volume.iBytesSent);
       
  3105 	AssertMockLtsyStatusL();	
       
  3106 	
       
  3107 	CleanupStack::PopAndDestroy(5, this); // packetContext, packetService,expectData, data, this	
       
  3108 	}
       
  3109 
       
  3110 
       
  3111 /**
       
  3112 @SYMTestCaseID BA-CTSY-PKTC-PCGDVT-0004
       
  3113 @SYMComponent  telephony_ctsy
       
  3114 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::GetDataVolumeTransferred
       
  3115 @SYMTestPriority High
       
  3116 @SYMTestActions Invokes multiple client requests to RPacketContext::GetDataVolumeTransferred
       
  3117 @SYMTestExpectedResults Pass
       
  3118 @SYMTestType CT
       
  3119 */
       
  3120 void CCTsyPacketContextFU::TestGetDataVolumeTransferred0004L()
       
  3121 	{
       
  3122 					
       
  3123 	OpenEtelServerL(EUseExtendedError);
       
  3124 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3125 	OpenPhoneL();
       
  3126 
       
  3127 	RBuf8 data;
       
  3128 	CleanupClosePushL(data);
       
  3129 		
       
  3130 	RBuf8 data2;
       
  3131 	CleanupClosePushL(data2);
       
  3132 	
       
  3133 	RBuf8 expectData;
       
  3134 	CleanupClosePushL(expectData);
       
  3135 	
       
  3136 	RBuf8 expectData2;
       
  3137 	CleanupClosePushL(expectData2);
       
  3138 
       
  3139 	// Open second client
       
  3140 	RTelServer telServer2;
       
  3141 	TInt ret = telServer2.Connect();
       
  3142 	ASSERT_EQUALS(KErrNone, ret);
       
  3143 	CleanupClosePushL(telServer2);
       
  3144 
       
  3145 	RMobilePhone phone2;
       
  3146 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  3147 	ASSERT_EQUALS(KErrNone, ret);
       
  3148 	CleanupClosePushL(phone2);
       
  3149 	
       
  3150 	RPacketService packetService;
       
  3151 	OpenPacketServiceL(packetService);
       
  3152 	CleanupClosePushL(packetService);
       
  3153 	
       
  3154 	RPacketService packetService2;                
       
  3155 	ret = packetService2.Open(phone2);
       
  3156 	ASSERT_EQUALS(KErrNone, ret);
       
  3157 	CleanupClosePushL(packetService2);
       
  3158 	
       
  3159 	// Open first context
       
  3160 	TInfoName contextId;	
       
  3161 	RPacketContext packetContext;
       
  3162 	packetContext.OpenNewContext(packetService, contextId);
       
  3163 	CleanupClosePushL(packetContext);
       
  3164 	
       
  3165 	// Open second context
       
  3166 	TInfoName contextId2;	
       
  3167 	RPacketContext packetContext2;
       
  3168 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  3169 	CleanupClosePushL(packetContext2);
       
  3170 
       
  3171 	//-------------------------------------------------------------------------
       
  3172 	// Test A: Test multiple clients requesting RPacketContext::GetDataVolumeTransferred
       
  3173  	//-------------------------------------------------------------------------
       
  3174 
       
  3175 	// data for first CompleteL
       
  3176  	RPacketContext::TDataVolume volumeCompleteL;
       
  3177  	volumeCompleteL.iBytesReceived = 0x111;
       
  3178  	volumeCompleteL.iBytesSent     = 0x222;
       
  3179  	TMockLtsyData2 <TInfoName, RPacketContext::TDataVolume > ltsyData1(contextId, volumeCompleteL);
       
  3180 	ltsyData1.SerialiseL(data);
       
  3181 	
       
  3182 	// data for second CompleteL
       
  3183   	TMockLtsyData2 <TInfoName, RPacketContext::TDataVolume > ltsyData2(contextId2, volumeCompleteL);
       
  3184 	ltsyData2.SerialiseL(data2);	
       
  3185 	
       
  3186 	// for the first request
       
  3187 	TRequestStatus requestStatus;
       
  3188 	RPacketContext::TDataVolume volume;
       
  3189 	
       
  3190 	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3191 	expData.SerialiseL(expectData);
       
  3192 	
       
  3193 	// for the second request
       
  3194 	TRequestStatus requestStatus2;
       
  3195 	RPacketContext::TDataVolume volume2;
       
  3196 	
       
  3197 	TMockLtsyData1 <TInfoName> expData2(contextId2);
       
  3198 	expData2.SerialiseL(expectData2);
       
  3199 	
       
  3200 	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred, expectData);	 	
       
  3201  	iMockLTSY.CompleteL(EPacketContextGetDataVolumeTransferred, KErrNone, data);
       
  3202 	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred, expectData2); 	 
       
  3203 	iMockLTSY.CompleteL(EPacketContextGetDataVolumeTransferred, KErrNone, data2);
       
  3204 	
       
  3205 	// send first request
       
  3206 	packetContext.GetDataVolumeTransferred(requestStatus, volume);		
       
  3207 	
       
  3208 	// send second request
       
  3209 	packetContext2.GetDataVolumeTransferred(requestStatus2, volume2);
       
  3210 	
       
  3211 	// wait for first answer
       
  3212 	User::WaitForRequest(requestStatus);		
       
  3213 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3214 	ASSERT_EQUALS(volumeCompleteL.iBytesReceived, volume.iBytesReceived);
       
  3215 	ASSERT_EQUALS(volumeCompleteL.iBytesSent, volume.iBytesSent);
       
  3216 	
       
  3217 	// wait for second answer
       
  3218 	User::WaitForRequest(requestStatus2);		
       
  3219 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  3220 	ASSERT_EQUALS(volumeCompleteL.iBytesReceived, volume2.iBytesReceived);
       
  3221 	ASSERT_EQUALS(volumeCompleteL.iBytesSent, volume2.iBytesSent);
       
  3222 	
       
  3223 	AssertMockLtsyStatusL();
       
  3224 	CleanupStack::PopAndDestroy(2); // expectData2, expectData
       
  3225 	CleanupStack::PopAndDestroy(9, this); //packetContext2, packetContext, packetService2, packetService, phone2, telServer2, data,data2 this
       
  3226 
       
  3227 	}
       
  3228 
       
  3229 
       
  3230 /**
       
  3231 @SYMTestCaseID BA-CTSY-PKTC-PCGDVT-0005
       
  3232 @SYMComponent  telephony_ctsy
       
  3233 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetDataVolumeTransferred with timeout
       
  3234 @SYMTestPriority High
       
  3235 @SYMTestActions Invokes RPacketContext::GetDataVolumeTransferred and tests for timeout
       
  3236 @SYMTestExpectedResults Pass
       
  3237 @SYMTestType CT
       
  3238 */
       
  3239 void CCTsyPacketContextFU::TestGetDataVolumeTransferred0005L()
       
  3240 	{
       
  3241 
       
  3242 	OpenEtelServerL(EUseExtendedError);
       
  3243 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3244 	OpenPhoneL();
       
  3245 	
       
  3246 	RBuf8 expectData;
       
  3247 	CleanupClosePushL(expectData);
       
  3248 	
       
  3249 	RPacketService packetService;
       
  3250 	OpenPacketServiceL(packetService);
       
  3251 	CleanupClosePushL(packetService);
       
  3252 	
       
  3253 	// Open new context
       
  3254 	TInfoName contextId;	
       
  3255 	RPacketContext packetContext;	
       
  3256 	packetContext.OpenNewContext(packetService, contextId);
       
  3257 	CleanupClosePushL(packetContext);
       
  3258 
       
  3259 	//-------------------------------------------------------------------------
       
  3260 	// Test A: Test timeout of RPacketContext::GetDataVolumeTransferred
       
  3261  	//------------------------------------------------------------------------- 	
       
  3262 	
       
  3263 	TRequestStatus requestStatus;
       
  3264 	RPacketContext::TDataVolume volume;
       
  3265 	
       
  3266 	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3267 	expData.SerialiseL(expectData);
       
  3268 	
       
  3269 	iMockLTSY.ExpectL(EPacketContextGetDataVolumeTransferred, expectData);
       
  3270 	
       
  3271 	packetContext.GetDataVolumeTransferred(requestStatus, volume);	
       
  3272 	
       
  3273 	User::WaitForRequest(requestStatus);		
       
  3274 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());	
       
  3275 	
       
  3276 	AssertMockLtsyStatusL();
       
  3277 	CleanupStack::PopAndDestroy(4, this); //packetContext, packetService,  expectData, this
       
  3278 
       
  3279 	}
       
  3280 
       
  3281 
       
  3282 /**
       
  3283 @SYMTestCaseID BA-CTSY-PKTC-PCNCSC-0001
       
  3284 @SYMComponent  telephony_ctsy
       
  3285 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyConnectionSpeedChange
       
  3286 @SYMTestPriority High
       
  3287 @SYMTestActions Invokes RPacketContext::NotifyConnectionSpeedChange
       
  3288 @SYMTestExpectedResults Pass
       
  3289 @SYMTestType CT
       
  3290 */
       
  3291 void CCTsyPacketContextFU::TestNotifyConnectionSpeedChange0001L()
       
  3292 	{
       
  3293 	OpenEtelServerL(EUseExtendedError);
       
  3294 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3295 	OpenPhoneL();
       
  3296 
       
  3297 	RBuf8 data;
       
  3298 	CleanupClosePushL(data);
       
  3299 	
       
  3300 	RPacketService packetService;
       
  3301 	OpenPacketServiceL(packetService);
       
  3302 	CleanupClosePushL(packetService);
       
  3303 	
       
  3304 	// Open new context
       
  3305 	TInfoName contextId;	
       
  3306 	RPacketContext packetContext;	
       
  3307 	packetContext.OpenNewContext(packetService, contextId);	
       
  3308 	CleanupClosePushL(packetContext);
       
  3309 	
       
  3310 	TRequestStatus mockLtsyStatus;
       
  3311 	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
  3312 	
       
  3313   	//-------------------------------------------------------------------------
       
  3314 	// TEST C: Successful completion request of
       
  3315 	// RPacketContext::NotifyConnectionSpeedChange when result is not cached.
       
  3316  	//-------------------------------------------------------------------------
       
  3317 	// data for CompleteL
       
  3318 	TInt completeRate = 9600;
       
  3319 	TMockLtsyData2 <TInfoName, TInt > ltsyData(contextId, completeRate);
       
  3320 	ltsyData.SerialiseL(data);	
       
  3321 	
       
  3322 	TRequestStatus requestStatus;
       
  3323 	TUint rate;
       
  3324 	// send request
       
  3325 	packetContext.NotifyConnectionSpeedChange(requestStatus, rate);
       
  3326 	
       
  3327 	// send completion 
       
  3328 	iMockLTSY.CompleteL (EPacketContextNotifyConnectionSpeedChange, KErrNone, data);
       
  3329 	// wait for completion
       
  3330 	User::WaitForRequest(mockLtsyStatus);
       
  3331 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  3332 	
       
  3333 	User::WaitForRequest(requestStatus);
       
  3334 	AssertMockLtsyStatusL();		
       
  3335 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3336 	ASSERT_EQUALS(completeRate, (TInt)rate);
       
  3337 
       
  3338  	//-------------------------------------------------------------------------
       
  3339 	// TEST E: Unsolicited completion of RPacketContext::NotifyConnectionSpeedChange
       
  3340 	// from LTSY.
       
  3341  	//-------------------------------------------------------------------------
       
  3342 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3343 	// send completion 
       
  3344 	iMockLTSY.CompleteL (EPacketContextNotifyConnectionSpeedChange, KErrNone, data);
       
  3345 	// wait for completion
       
  3346 	User::WaitForRequest(mockLtsyStatus);
       
  3347 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  3348 
       
  3349 	AssertMockLtsyStatusL();
       
  3350 	CleanupStack::PopAndDestroy(4, this); //packetContext, packetService, data, this
       
  3351 	}
       
  3352 
       
  3353 
       
  3354 /**
       
  3355 @SYMTestCaseID BA-CTSY-PKTC-PCNCSC-0002
       
  3356 @SYMComponent  telephony_ctsy
       
  3357 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::NotifyConnectionSpeedChange
       
  3358 @SYMTestPriority High
       
  3359 @SYMTestActions Invokes cancelling of RPacketContext::NotifyConnectionSpeedChange
       
  3360 @SYMTestExpectedResults Pass
       
  3361 @SYMTestType CT
       
  3362 */
       
  3363 void CCTsyPacketContextFU::TestNotifyConnectionSpeedChange0002L()
       
  3364 	{
       
  3365 	OpenEtelServerL(EUseExtendedError);
       
  3366 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3367 	OpenPhoneL();
       
  3368 	
       
  3369 	RPacketService packetService;
       
  3370 	OpenPacketServiceL(packetService);
       
  3371 	CleanupClosePushL(packetService);
       
  3372 	
       
  3373 	// Open new context
       
  3374 	TInfoName contextId;	
       
  3375 	RPacketContext packetContext;	
       
  3376 	packetContext.OpenNewContext(packetService, contextId);	
       
  3377 	CleanupClosePushL(packetContext);
       
  3378 
       
  3379 	TRequestStatus mockLtsyStatus;
       
  3380 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3381 
       
  3382 	RBuf8 data;
       
  3383 	CleanupClosePushL(data);
       
  3384 
       
  3385  	//-------------------------------------------------------------------------
       
  3386 	// Test cancelling of RPacketContext::NotifyConnectionSpeedChange
       
  3387  	//-------------------------------------------------------------------------
       
  3388  	
       
  3389 	// data for CompleteL
       
  3390 	TInt completeRate = 9600;
       
  3391 	TMockLtsyData2 <TInfoName, TInt > ltsyData(contextId, completeRate);
       
  3392 	ltsyData.SerialiseL(data);	
       
  3393 	
       
  3394 	TRequestStatus requestStatus;
       
  3395 	TUint rate;
       
  3396 	// send request
       
  3397 	packetContext.NotifyConnectionSpeedChange(requestStatus, rate);
       
  3398 	packetContext.CancelAsyncRequest(EPacketContextNotifyConnectionSpeedChange);
       
  3399 	
       
  3400 	// send completion 
       
  3401 	iMockLTSY.CompleteL (EPacketContextNotifyConnectionSpeedChange, KErrNone, data);
       
  3402 
       
  3403 	User::WaitForRequest(requestStatus);
       
  3404 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
  3405 
       
  3406 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  3407 	User::WaitForRequest(mockLtsyStatus);	
       
  3408 	AssertMockLtsyStatusL();		
       
  3409 	CleanupStack::PopAndDestroy(4, this); //packetContext, packetService, data, this
       
  3410 	
       
  3411 	}
       
  3412 
       
  3413 
       
  3414 /**
       
  3415 @SYMTestCaseID BA-CTSY-PKTC-PCNCSC-0004
       
  3416 @SYMComponent  telephony_ctsy
       
  3417 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::NotifyConnectionSpeedChange
       
  3418 @SYMTestPriority High
       
  3419 @SYMTestActions Invokes multiple client requests to RPacketContext::NotifyConnectionSpeedChange
       
  3420 @SYMTestExpectedResults Pass
       
  3421 @SYMTestType CT
       
  3422 */
       
  3423 void CCTsyPacketContextFU::TestNotifyConnectionSpeedChange0004L()
       
  3424 	{
       
  3425 					
       
  3426 	OpenEtelServerL(EUseExtendedError);
       
  3427 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3428 	OpenPhoneL();
       
  3429 
       
  3430 	RBuf8 data;
       
  3431 	CleanupClosePushL(data);
       
  3432 	
       
  3433 	RBuf8 data2;
       
  3434 	CleanupClosePushL(data2);
       
  3435 
       
  3436 	// Open second client
       
  3437 	RTelServer telServer2;
       
  3438 	TInt ret = telServer2.Connect();
       
  3439 	ASSERT_EQUALS(KErrNone, ret);
       
  3440 	CleanupClosePushL(telServer2);
       
  3441 
       
  3442 	RMobilePhone phone2;
       
  3443 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  3444 	ASSERT_EQUALS(KErrNone, ret);
       
  3445 	CleanupClosePushL(phone2);
       
  3446 	
       
  3447 	RPacketService packetService;
       
  3448 	OpenPacketServiceL(packetService);
       
  3449 	CleanupClosePushL(packetService);
       
  3450 	
       
  3451 	RPacketService packetService2;                
       
  3452 	ret = packetService2.Open(phone2);
       
  3453 	ASSERT_EQUALS(KErrNone, ret);
       
  3454 	CleanupClosePushL(packetService2);
       
  3455 	
       
  3456 	// Open first context
       
  3457 	TInfoName contextId;	
       
  3458 	RPacketContext packetContext;
       
  3459 	packetContext.OpenNewContext(packetService, contextId);
       
  3460 	CleanupClosePushL(packetContext);
       
  3461 	
       
  3462 	// Open second context
       
  3463 	TInfoName contextId2;	
       
  3464 	RPacketContext packetContext2;
       
  3465 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  3466 	CleanupClosePushL(packetContext2);
       
  3467 
       
  3468 	//-------------------------------------------------------------------------
       
  3469 	// Test A: Test multiple clients requesting RPacketContext::NotifyConnectionSpeedChange
       
  3470  	//-------------------------------------------------------------------------
       
  3471 	TUint rate;	
       
  3472 	TRequestStatus requestStatus;	
       
  3473 	TRequestStatus requestStatus2;
       
  3474 	TUint rate2;
       
  3475 	
       
  3476 		
       
  3477 	// data for CompleteL 1
       
  3478 	TInt completeRate = 9600;
       
  3479 	TMockLtsyData2 <TInfoName, TInt > ltsyData(contextId, completeRate);
       
  3480 	ltsyData.SerialiseL(data);
       
  3481 
       
  3482 	// data for CompleteL 2
       
  3483 	TInt completeRate2 = 4800;
       
  3484 	TMockLtsyData2 <TInfoName, TInt > ltsyData2(contextId2, completeRate2);
       
  3485 	ltsyData2.SerialiseL(data2);
       
  3486 	
       
  3487 	// send first request	
       
  3488 	packetContext.NotifyConnectionSpeedChange(requestStatus, rate);
       
  3489 	
       
  3490 	// send second request	
       
  3491 	packetContext2.NotifyConnectionSpeedChange(requestStatus2, rate2);
       
  3492 	
       
  3493 	// sent first completion
       
  3494 	iMockLTSY.CompleteL (EPacketContextNotifyConnectionSpeedChange, KErrNone, data);
       
  3495 	
       
  3496 	// sent second completion
       
  3497 	iMockLTSY.CompleteL (EPacketContextNotifyConnectionSpeedChange, KErrNone, data2);	
       
  3498 	
       
  3499 	// wait for first answer
       
  3500 	User::WaitForRequest(requestStatus);
       
  3501 		
       
  3502 	// wait for second answer
       
  3503 	User::WaitForRequest(requestStatus2);
       
  3504 	
       
  3505 	AssertMockLtsyStatusL();		
       
  3506 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3507 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  3508 	ASSERT_EQUALS(completeRate, (TInt)rate);
       
  3509 	ASSERT_EQUALS(completeRate2, (TInt)rate2);
       
  3510 	
       
  3511 	CleanupStack::PopAndDestroy(9, this); //packetContext2, packetContext, packetService2, packetService, phone2, telServer2, data,data2 this
       
  3512 
       
  3513 	}
       
  3514 
       
  3515 
       
  3516 
       
  3517 /**
       
  3518 @SYMTestCaseID BA-CTSY-PKTC-PCDL-0001
       
  3519 @SYMComponent  telephony_ctsy
       
  3520 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Delete
       
  3521 @SYMTestPriority High
       
  3522 @SYMTestActions Invokes RPacketContext::Delete
       
  3523 @SYMTestExpectedResults Pass
       
  3524 @SYMTestType CT
       
  3525 */
       
  3526 void CCTsyPacketContextFU::TestDelete0001L()
       
  3527 	{
       
  3528 
       
  3529 	OpenEtelServerL(EUseExtendedError);
       
  3530 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3531 	OpenPhoneL();
       
  3532 
       
  3533 	RBuf8 data;
       
  3534 	CleanupClosePushL(data);
       
  3535 	
       
  3536 	RBuf8 expectData;
       
  3537 	CleanupClosePushL(expectData);
       
  3538 		
       
  3539 	RPacketService packetService;
       
  3540 	OpenPacketServiceL(packetService);
       
  3541 	CleanupClosePushL(packetService);
       
  3542 	
       
  3543 	// Open new context
       
  3544 	TInfoName contextId;	
       
  3545 	RPacketContext packetContext;	
       
  3546 	packetContext.OpenNewContext(packetService, contextId);	
       
  3547 	CleanupClosePushL(packetContext);
       
  3548 	
       
  3549 	
       
  3550 	//-------------------------------------------------------------------------
       
  3551 	// SEND Delete request when ContextStatus is Unknown
       
  3552  	//-------------------------------------------------------------------------
       
  3553 	TRequestStatus requestStatus;	
       
  3554 	packetContext.Delete(requestStatus);
       
  3555 	
       
  3556 	User::WaitForRequest(requestStatus);	
       
  3557 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());	
       
  3558 	AssertMockLtsyStatusL();
       
  3559 	
       
  3560 	
       
  3561  	// Set context in Active state
       
  3562  	SetContextActiveL(contextId);
       
  3563 	
       
  3564 	//-------------------------------------------------------------------------
       
  3565 	// TEST E: Unsolicited completion of RPacketContext::Delete
       
  3566 	// from LTSY.
       
  3567  	//-------------------------------------------------------------------------
       
  3568  	TMockLtsyData1 <TInfoName > ltsyData(contextId);
       
  3569 	ltsyData.SerialiseL(data);
       
  3570 	TRequestStatus mockLtsyStatus;
       
  3571 	
       
  3572 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3573 	// send completion 
       
  3574 	iMockLTSY.CompleteL(EPacketContextDelete, KErrNone, data);
       
  3575 	// wait for completion
       
  3576 	User::WaitForRequest(mockLtsyStatus);
       
  3577 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  3578 	AssertMockLtsyStatusL();
       
  3579 	
       
  3580  	//-------------------------------------------------------------------------
       
  3581 	// TEST A: failure to dispatch request to LTSY
       
  3582  	//-------------------------------------------------------------------------
       
  3583  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3584 	expData.SerialiseL(expectData);
       
  3585 	
       
  3586 	iMockLTSY.ExpectL(EPacketContextDelete, expectData, KErrNotSupported);
       
  3587 
       
  3588 	packetContext.Delete(requestStatus);
       
  3589 	
       
  3590 	User::WaitForRequest(requestStatus);	
       
  3591 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  3592 	AssertMockLtsyStatusL();
       
  3593 	
       
  3594 	//-------------------------------------------------------------------------
       
  3595 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  3596  	//-------------------------------------------------------------------------
       
  3597 	iMockLTSY.ExpectL (EPacketContextDelete, expectData);
       
  3598 	iMockLTSY.CompleteL(EPacketContextDelete, KErrGeneral, data);
       
  3599 
       
  3600 	packetContext.Delete(requestStatus);
       
  3601 	
       
  3602 	User::WaitForRequest(requestStatus);	
       
  3603 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());	
       
  3604 	AssertMockLtsyStatusL();
       
  3605 
       
  3606  	//-------------------------------------------------------------------------
       
  3607 	// TEST C: Successful completion request of
       
  3608 	// RPacketContext::Delete when result is not cached.
       
  3609  	//-------------------------------------------------------------------------
       
  3610 	iMockLTSY.ExpectL (EPacketContextDelete, expectData);
       
  3611 	iMockLTSY.CompleteL(EPacketContextDelete, KErrNone, data);
       
  3612 
       
  3613 	packetContext.Delete(requestStatus);
       
  3614 		
       
  3615 	User::WaitForRequest(requestStatus);	
       
  3616 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  3617 	AssertMockLtsyStatusL();
       
  3618 
       
  3619  	//-------------------------------------------------------------------------
       
  3620 	// TEST D: failure to modify context parameters when context deleted
       
  3621  	//-------------------------------------------------------------------------
       
  3622 	packetContext.ModifyActiveContext(requestStatus);
       
  3623 	User::WaitForRequest(requestStatus);		
       
  3624 	AssertMockLtsyStatusL();
       
  3625 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  3626 
       
  3627 	CleanupStack::PopAndDestroy(5, this); //packetContext, packetService, expectData, data, this	
       
  3628 	}
       
  3629 
       
  3630 
       
  3631 
       
  3632 /**
       
  3633 @SYMTestCaseID BA-CTSY-PKTC-PCDL-0004
       
  3634 @SYMComponent  telephony_ctsy
       
  3635 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::Delete
       
  3636 @SYMTestPriority High
       
  3637 @SYMTestActions Invokes multiple client requests to RPacketContext::Delete
       
  3638 @SYMTestExpectedResults Pass
       
  3639 @SYMTestType CT
       
  3640 */
       
  3641 void CCTsyPacketContextFU::TestDelete0004L()
       
  3642 	{
       
  3643 					
       
  3644 	OpenEtelServerL(EUseExtendedError);
       
  3645 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3646 	OpenPhoneL();
       
  3647 
       
  3648 	RBuf8 data;
       
  3649 	CleanupClosePushL(data);	
       
  3650 	
       
  3651 	RBuf8 data2;
       
  3652 	CleanupClosePushL(data2);
       
  3653 	
       
  3654 	RBuf8 expectData;
       
  3655 	CleanupClosePushL(expectData);
       
  3656 	
       
  3657 	RBuf8 expectData2;
       
  3658 	CleanupClosePushL(expectData2);
       
  3659 
       
  3660 	// Open second client
       
  3661 	RTelServer telServer2;
       
  3662 	TInt ret = telServer2.Connect();
       
  3663 	ASSERT_EQUALS(KErrNone, ret);
       
  3664 	CleanupClosePushL(telServer2);
       
  3665 
       
  3666 	RMobilePhone phone2;
       
  3667 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  3668 	ASSERT_EQUALS(KErrNone, ret);
       
  3669 	CleanupClosePushL(phone2);
       
  3670 	
       
  3671 	RPacketService packetService;
       
  3672 	OpenPacketServiceL(packetService);
       
  3673 	CleanupClosePushL(packetService);
       
  3674 	
       
  3675 	RPacketService packetService2;                
       
  3676 	ret = packetService2.Open(phone2);
       
  3677 	ASSERT_EQUALS(KErrNone, ret);
       
  3678 	CleanupClosePushL(packetService2);
       
  3679 	
       
  3680 	// Open first context
       
  3681 	TInfoName contextId;	
       
  3682 	RPacketContext packetContext;
       
  3683 	packetContext.OpenNewContext(packetService, contextId);
       
  3684 	CleanupClosePushL(packetContext);
       
  3685 	
       
  3686 	// Open second context
       
  3687 	TInfoName contextId2;	
       
  3688 	RPacketContext packetContext2;
       
  3689 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  3690 	CleanupClosePushL(packetContext2);
       
  3691 	
       
  3692 	// Set first context in Active state
       
  3693  	SetContextActiveL(contextId);
       
  3694  	
       
  3695  	// Set second context in Active state
       
  3696  	SetContextActiveL(contextId2);
       
  3697 
       
  3698 	//-------------------------------------------------------------------------
       
  3699 	// Test A: Test multiple clients requesting RPacketContext::Delete
       
  3700  	//-------------------------------------------------------------------------
       
  3701 	
       
  3702  	// data for first CompleteL
       
  3703  	TMockLtsyData1 <TInfoName > ltsyData(contextId);
       
  3704 	ltsyData.SerialiseL(data);
       
  3705  	
       
  3706 	// data for second CompleteL
       
  3707  	TMockLtsyData1 <TInfoName > ltsyData2(contextId2);
       
  3708 	ltsyData2.SerialiseL(data2);	
       
  3709 	
       
  3710 	// for the first request
       
  3711 	TRequestStatus requestStatus;
       
  3712 	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3713 	expData.SerialiseL(expectData);
       
  3714 	
       
  3715 	// for the second request
       
  3716 	TRequestStatus requestStatus2;
       
  3717 	TMockLtsyData1 <TInfoName> expData2(contextId2);
       
  3718 	expData2.SerialiseL(expectData2);
       
  3719 	
       
  3720 		
       
  3721 	iMockLTSY.ExpectL(EPacketContextDelete, expectData);	 	
       
  3722  	iMockLTSY.CompleteL(EPacketContextDelete, KErrNone, data);
       
  3723 	iMockLTSY.ExpectL(EPacketContextDelete, expectData2); 	 
       
  3724 	iMockLTSY.CompleteL(EPacketContextDelete, KErrNone, data2);
       
  3725 	
       
  3726 	// send first request
       
  3727 	packetContext.Delete(requestStatus);		
       
  3728 	
       
  3729 	// send second request
       
  3730 	packetContext2.Delete(requestStatus2);
       
  3731 	
       
  3732 	// wait for first answer
       
  3733 	User::WaitForRequest(requestStatus);		
       
  3734 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3735 		
       
  3736 	// wait for second answer
       
  3737 	User::WaitForRequest(requestStatus2);		
       
  3738 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  3739 
       
  3740 	AssertMockLtsyStatusL();
       
  3741 	CleanupStack::PopAndDestroy(2); // expectData2, expectData
       
  3742 	CleanupStack::PopAndDestroy(9, this); //packetContext2, packetContext, packetService2, packetService, phone2, telServer2, data,data2 this
       
  3743 	}
       
  3744 
       
  3745 
       
  3746 /**
       
  3747 @SYMTestCaseID BA-CTSY-PKTC-PCDL-0005
       
  3748 @SYMComponent  telephony_ctsy
       
  3749 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Delete with timeout
       
  3750 @SYMTestPriority High
       
  3751 @SYMTestActions Invokes RPacketContext::Delete and tests for timeout
       
  3752 @SYMTestExpectedResults Pass
       
  3753 @SYMTestType CT
       
  3754 */
       
  3755 void CCTsyPacketContextFU::TestDelete0005L()
       
  3756 	{
       
  3757 
       
  3758 	OpenEtelServerL(EUseExtendedError);
       
  3759 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3760 	OpenPhoneL();
       
  3761 
       
  3762 	RBuf8 data;
       
  3763 	CleanupClosePushL(data);
       
  3764 	
       
  3765 	RBuf8 expectData;
       
  3766 	CleanupClosePushL(expectData);
       
  3767 	
       
  3768 	RPacketService packetService;
       
  3769 	OpenPacketServiceL(packetService);
       
  3770 	CleanupClosePushL(packetService);
       
  3771 	
       
  3772 	// Open new context
       
  3773 	TInfoName contextId;	
       
  3774 	RPacketContext packetContext;	
       
  3775 	packetContext.OpenNewContext(packetService, contextId);	
       
  3776 	CleanupClosePushL(packetContext);
       
  3777 	
       
  3778 	// Set context in Active state
       
  3779  	SetContextActiveL(contextId);
       
  3780 	
       
  3781 	//-------------------------------------------------------------------------
       
  3782 	// Test A: Test timeout of RPacketContext::Delete
       
  3783  	//------------------------------------------------------------------------- 	
       
  3784  	TRequestStatus requestStatus; 	
       
  3785  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3786 	expData.SerialiseL(expectData);
       
  3787 	iMockLTSY.ExpectL (EPacketContextDelete, expectData);
       
  3788 
       
  3789 	packetContext.Delete(requestStatus);
       
  3790 		
       
  3791 	User::WaitForRequest(requestStatus);	
       
  3792 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());	
       
  3793 	AssertMockLtsyStatusL();
       
  3794 	 	
       
  3795 	CleanupStack::PopAndDestroy(5, this); //packetContext, packetService, data, expectData, this
       
  3796 	}
       
  3797 
       
  3798 
       
  3799 /**
       
  3800 @SYMTestCaseID BA-CTSY-PKTC-PCA-0001
       
  3801 @SYMComponent  telephony_ctsy
       
  3802 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Activate
       
  3803 @SYMTestPriority High
       
  3804 @SYMTestActions Invokes RPacketContext::Activate
       
  3805 @SYMTestExpectedResults Pass
       
  3806 @SYMTestType CT
       
  3807 */
       
  3808 void CCTsyPacketContextFU::TestActivate0001L()
       
  3809 	{
       
  3810 
       
  3811 	OpenEtelServerL(EUseExtendedError);
       
  3812 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3813 	OpenPhoneL();
       
  3814 
       
  3815 	RBuf8 data;
       
  3816 	CleanupClosePushL(data);
       
  3817 	
       
  3818 	RBuf8 expectData;
       
  3819 	CleanupClosePushL(expectData);	
       
  3820 	
       
  3821 	RPacketService packetService;
       
  3822 	OpenPacketServiceL(packetService);
       
  3823 	CleanupClosePushL(packetService);
       
  3824 	
       
  3825 	// Open new context
       
  3826 	TInfoName contextId;	
       
  3827 	RPacketContext packetContext;
       
  3828 	packetContext.OpenNewContext(packetService, contextId);
       
  3829 	CleanupClosePushL(packetContext);
       
  3830 	
       
  3831 	// initialisation of the context 
       
  3832 	TInt status = InitContextL(packetContext, contextId);
       
  3833 	ASSERT_EQUALS(KErrNone, status);
       
  3834 		
       
  3835  	//-------------------------------------------------------------------------
       
  3836 	// TEST A: failure to dispatch request to LTSY
       
  3837  	//-------------------------------------------------------------------------
       
  3838  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3839 	expData.SerialiseL(expectData);
       
  3840 	
       
  3841 	TRequestStatus requestStatus;
       
  3842 	iMockLTSY.ExpectL(EPacketContextActivate, expectData, KErrNotSupported);
       
  3843 	
       
  3844 	packetContext.Activate(requestStatus);
       
  3845 	User::WaitForRequest(requestStatus);
       
  3846 	AssertMockLtsyStatusL();
       
  3847 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3848 
       
  3849 	//-------------------------------------------------------------------------
       
  3850 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  3851  	//-------------------------------------------------------------------------
       
  3852 	RPacketContext::TContextConfigGPRS contextConfig;
       
  3853 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigGPRS > ltsyData1(contextId, contextConfig);
       
  3854 	ltsyData1.SerialiseL(data);
       
  3855 	
       
  3856 	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  3857 	iMockLTSY.CompleteL(EPacketContextActivate, KErrGeneral, data);
       
  3858 	
       
  3859 	packetContext.Activate(requestStatus);
       
  3860 	User::WaitForRequest(requestStatus);
       
  3861 	AssertMockLtsyStatusL();
       
  3862 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3863 
       
  3864  	//-------------------------------------------------------------------------
       
  3865 	// TEST C: Successful completion request of
       
  3866 	// RPacketContext::Activate when result is not cached.
       
  3867  	//-------------------------------------------------------------------------
       
  3868 	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  3869 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data);
       
  3870 		
       
  3871 	packetContext.Activate(requestStatus);
       
  3872 	User::WaitForRequest(requestStatus);
       
  3873 	AssertMockLtsyStatusL();
       
  3874 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  3875  
       
  3876  	//-------------------------------------------------------------------------
       
  3877 	// TEST E: Unsolicited completion of RPacketContext::Activate
       
  3878 	// from LTSY.
       
  3879  	//-------------------------------------------------------------------------
       
  3880 	TRequestStatus mockLtsyStatus;
       
  3881 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3882 	
       
  3883 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data);
       
  3884 	User::WaitForRequest(mockLtsyStatus);
       
  3885 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3886 	AssertMockLtsyStatusL();
       
  3887 
       
  3888 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
  3889 	CleanupStack::PopAndDestroy(3, this); // expectData, data, this
       
  3890 	
       
  3891 	}
       
  3892 
       
  3893 /**
       
  3894 @SYMTestCaseID BA-CTSY-PKTC-PCA-0001b
       
  3895 @SYMComponent  telephony_ctsy
       
  3896 
       
  3897 @SYMDEF DEF126915
       
  3898 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Activate with R99/R4 params
       
  3899 @SYMTestPriority High
       
  3900 @SYMTestActions Invokes RPacketContext::Activate with R99/R4 context config params
       
  3901 @SYMTestExpectedResults Pass
       
  3902 @SYMTestType CT
       
  3903 */
       
  3904 void CCTsyPacketContextFU::TestActivate0001bL()
       
  3905 	{
       
  3906 
       
  3907 	OpenEtelServerL(EUseExtendedError);
       
  3908 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3909 	OpenPhoneL();
       
  3910 
       
  3911 	RBuf8 data;
       
  3912 	CleanupClosePushL(data);
       
  3913 	
       
  3914 	RBuf8 expectData;
       
  3915 	CleanupClosePushL(expectData);	
       
  3916 	
       
  3917 	RPacketService packetService;
       
  3918 	OpenPacketServiceL(packetService);
       
  3919 	CleanupClosePushL(packetService);
       
  3920 	
       
  3921 	// Open new context
       
  3922 	TInfoName contextId;	
       
  3923 	RPacketContext packetContext;
       
  3924 	packetContext.OpenNewContext(packetService, contextId);
       
  3925 	CleanupClosePushL(packetContext);
       
  3926 	
       
  3927 	// initialisation of the context 
       
  3928 	TInt status = InitContextL(packetContext, contextId);
       
  3929 	ASSERT_EQUALS(KErrNone, status);
       
  3930 	
       
  3931 
       
  3932 	//-------------------------------------------------------------------------
       
  3933 	// TEST C: Successful completion request of
       
  3934 	// RPacketContext::Activate, using TContextConfigR99_R4, when result is 
       
  3935 	// not cached.
       
  3936  	//-------------------------------------------------------------------------
       
  3937  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  3938 	expData.SerialiseL(expectData);
       
  3939 	
       
  3940 	TRequestStatus requestStatus;
       
  3941 	
       
  3942 	RPacketContext::TContextConfigR99_R4 contextConfig;
       
  3943 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigR99_R4 > ltsyData1(contextId, contextConfig);
       
  3944 	ltsyData1.SerialiseL(data);
       
  3945 	
       
  3946 	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  3947 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data);
       
  3948 	
       
  3949 	packetContext.Activate(requestStatus);
       
  3950 	User::WaitForRequest(requestStatus);
       
  3951 	AssertMockLtsyStatusL();
       
  3952 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  3953 	
       
  3954 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
  3955 	CleanupStack::PopAndDestroy(3, this); // expectData, data, this
       
  3956 	
       
  3957 	}
       
  3958 
       
  3959 
       
  3960 /**
       
  3961 @SYMTestCaseID BA-CTSY-PKTC-PCA-0002
       
  3962 @SYMComponent  telephony_ctsy
       
  3963 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::Activate
       
  3964 @SYMTestPriority High
       
  3965 @SYMTestActions Invokes cancelling of RPacketContext::Activate
       
  3966 @SYMTestExpectedResults Pass
       
  3967 @SYMTestType CT
       
  3968 */
       
  3969 void CCTsyPacketContextFU::TestActivate0002L()
       
  3970 	{
       
  3971 
       
  3972 // This test should test cancellation of Activate
       
  3973 // If this API does not have a cancel, the test step should be completely removed.
       
  3974 
       
  3975 	OpenEtelServerL(EUseExtendedError);
       
  3976 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3977 	OpenPhoneL();
       
  3978 	
       
  3979 	RBuf8 data;
       
  3980 	CleanupClosePushL(data);
       
  3981 	
       
  3982 	RBuf8 expectData;
       
  3983 	CleanupClosePushL(expectData);
       
  3984 	
       
  3985 	RPacketService packetService;
       
  3986 	OpenPacketServiceL(packetService);
       
  3987 	CleanupClosePushL(packetService);	
       
  3988 	
       
  3989 	// Open new context
       
  3990 	TInfoName contextId;	
       
  3991 	RPacketContext packetContext;
       
  3992 	packetContext.OpenNewContext(packetService, contextId);
       
  3993 	CleanupClosePushL(packetContext);
       
  3994 	
       
  3995 	// initialisation of the context 
       
  3996 	TInt status = InitContextL(packetContext, contextId);
       
  3997 	ASSERT_EQUALS(KErrNone, status);
       
  3998 	
       
  3999 		
       
  4000  	//-------------------------------------------------------------------------
       
  4001 	// Test cancelling of RPacketContext::Activate
       
  4002  	//------------------------------------------------------------------------- 
       
  4003  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  4004 	expData.SerialiseL(expectData);
       
  4005  
       
  4006    	TRequestStatus	requestStatus;	
       
  4007  	RPacketContext::TContextConfigGPRS contextConfig;
       
  4008 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigGPRS > ltsyData1(contextId, contextConfig);
       
  4009 	ltsyData1.SerialiseL(data);
       
  4010 	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  4011 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data, 10);
       
  4012 	
       
  4013 	packetContext.Activate(requestStatus);
       
  4014 	packetContext.CancelAsyncRequest(EPacketContextActivate);
       
  4015 	
       
  4016 	User::WaitForRequest(requestStatus);
       
  4017 	AssertMockLtsyStatusL();
       
  4018 	// TSY has started a request and it is not possible to then cancel 
       
  4019     // this request. The best thing for the TSY to do in this case is to
       
  4020     // proceed as though the Cancel never happened.
       
  4021 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4022 	
       
  4023 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
  4024 	CleanupStack::PopAndDestroy(3); //  this, expectData, data	
       
  4025 	}
       
  4026 
       
  4027 
       
  4028 /**
       
  4029 @SYMTestCaseID BA-CTSY-PKTC-PCA-0003
       
  4030 @SYMComponent  telephony_ctsy
       
  4031 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Activate with bad parameter data
       
  4032 @SYMTestPriority High
       
  4033 @SYMTestActions Invokes RPacketContext::Activate with bad parameter data
       
  4034 @SYMTestExpectedResults Pass
       
  4035 @SYMTestType CT
       
  4036 */
       
  4037 void CCTsyPacketContextFU::TestActivate0003L()
       
  4038 	{
       
  4039 	OpenEtelServerL(EUseExtendedError);
       
  4040 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4041 	OpenPhoneL();
       
  4042 
       
  4043 
       
  4044 	RPacketService packetService;
       
  4045 	OpenPacketServiceL(packetService);
       
  4046 	CleanupClosePushL(packetService);
       
  4047 	
       
  4048 	// Open new context
       
  4049 	TInfoName contextId;	
       
  4050 	RPacketContext packetContext;
       
  4051 	packetContext.OpenNewContext(packetService, contextId);
       
  4052 	CleanupClosePushL(packetContext);
       
  4053 	
       
  4054 	// -----------------------------------------------------------------------
       
  4055 	// call Activate without initialisation of the context
       
  4056 	// -----------------------------------------------------------------------
       
  4057 	TRequestStatus	requestStatus;
       
  4058 	packetContext.Activate(requestStatus);
       
  4059 	User::WaitForRequest(requestStatus);
       
  4060 	AssertMockLtsyStatusL();
       
  4061 	ASSERT_EQUALS(KErrArgument, requestStatus.Int()); 	
       
  4062  	
       
  4063 	CleanupStack::PopAndDestroy(3, this); //packetContext, packetService, this
       
  4064 	}
       
  4065 
       
  4066 
       
  4067 /**
       
  4068 @SYMTestCaseID BA-CTSY-PKTC-PCA-0004
       
  4069 @SYMComponent  telephony_ctsy
       
  4070 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::Activate
       
  4071 @SYMTestPriority High
       
  4072 @SYMTestActions Invokes multiple client requests to RPacketContext::Activate
       
  4073 @SYMTestExpectedResults Pass
       
  4074 @SYMTestType CT
       
  4075 */
       
  4076 void CCTsyPacketContextFU::TestActivate0004L()
       
  4077 	{
       
  4078 					
       
  4079 	OpenEtelServerL(EUseExtendedError);
       
  4080 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4081 	OpenPhoneL();
       
  4082 
       
  4083 	RBuf8 data;
       
  4084 	CleanupClosePushL(data);
       
  4085 	
       
  4086 	RBuf8 expectData;
       
  4087 	CleanupClosePushL(expectData);
       
  4088 	
       
  4089 	RBuf8 data2;
       
  4090 	CleanupClosePushL(data2);
       
  4091 	
       
  4092 	RBuf8 expectData2;
       
  4093 	CleanupClosePushL(expectData2);
       
  4094 
       
  4095 	// Open second client
       
  4096 	RTelServer telServer2;
       
  4097 	TInt ret = telServer2.Connect();
       
  4098 	ASSERT_EQUALS(KErrNone, ret);
       
  4099 	CleanupClosePushL(telServer2);
       
  4100 
       
  4101 	RMobilePhone phone2;
       
  4102 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  4103 	ASSERT_EQUALS(KErrNone, ret);
       
  4104 	CleanupClosePushL(phone2);
       
  4105 	
       
  4106 	// Open PacketService for the first client
       
  4107 	RPacketService packetService;
       
  4108 	OpenPacketServiceL(packetService);
       
  4109 	CleanupClosePushL(packetService);
       
  4110 	
       
  4111 	// Open PacketService for the second client
       
  4112 	RPacketService packetService2;
       
  4113 	packetService2.Open(phone2);
       
  4114 	CleanupClosePushL(packetService2);
       
  4115 
       
  4116 	// Open first context
       
  4117 	TInfoName contextId;	
       
  4118 	RPacketContext packetContext;
       
  4119 	packetContext.OpenNewContext(packetService, contextId);
       
  4120 	CleanupClosePushL(packetContext);
       
  4121 	
       
  4122 	// initialisation of the first context 
       
  4123 	TInt status = InitContextL(packetContext, contextId);
       
  4124 	ASSERT_EQUALS(KErrNone, status);
       
  4125 	
       
  4126 	// Open second context
       
  4127 	TInfoName contextId2;	
       
  4128 	RPacketContext packetContext2;
       
  4129 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  4130 	CleanupClosePushL(packetContext2);
       
  4131 	
       
  4132 	// initialisation of the second context 
       
  4133 	status = InitContextL(packetContext2, contextId2);
       
  4134 	ASSERT_EQUALS(KErrNone, status);
       
  4135 			
       
  4136  	// data for ExpectL for first client
       
  4137  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  4138 	expData.SerialiseL(expectData);
       
  4139 	
       
  4140 	// data for CompleteL for first client
       
  4141 	RPacketContext::TContextConfigGPRS contextConfig;
       
  4142 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigGPRS > ltsyData1(contextId, contextConfig);
       
  4143 	ltsyData1.SerialiseL(data);	
       
  4144 	
       
  4145 	// data for ExpectL for second client
       
  4146  	TMockLtsyData1 <TInfoName> expData2(contextId2);
       
  4147 	expData2.SerialiseL(expectData2);
       
  4148 	
       
  4149 	// data for CompleteL for second client
       
  4150 	RPacketContext::TContextConfigGPRS contextConfig2;
       
  4151 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigGPRS > ltsyData2(contextId2, contextConfig2);
       
  4152 	ltsyData2.SerialiseL(data2);
       
  4153 	
       
  4154 	// first request
       
  4155 	TRequestStatus	requestStatus;
       
  4156 	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  4157 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data);		
       
  4158 	packetContext.Activate(requestStatus);
       
  4159 	
       
  4160 	// second request
       
  4161 	TRequestStatus	requestStatus2;
       
  4162 	iMockLTSY.ExpectL(EPacketContextActivate, expectData2);
       
  4163 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data2);		
       
  4164 	packetContext2.Activate(requestStatus2);	
       
  4165 	
       
  4166 	// wait for first answer
       
  4167 	User::WaitForRequest(requestStatus);
       
  4168 	ASSERT_EQUALS(KErrNone, requestStatus.Int());		
       
  4169 	
       
  4170 	// wait for the second answer
       
  4171 	User::WaitForRequest(requestStatus2);
       
  4172 	AssertMockLtsyStatusL();
       
  4173 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());		
       
  4174 	
       
  4175 	CleanupStack::PopAndDestroy(11, this); // ... phone2, telServer2, expectData, data, this
       
  4176 	}
       
  4177 
       
  4178 /**
       
  4179 @SYMTestCaseID BA-CTSY-PKTC-PCA-0005
       
  4180 @SYMComponent  telephony_ctsy
       
  4181 @SYMTestCaseDesc Test support in CTSY for RPacketContext::Activate with timeout
       
  4182 @SYMTestPriority High
       
  4183 @SYMTestActions Invokes RPacketContext::Activate and tests for timeout
       
  4184 @SYMTestExpectedResults Pass
       
  4185 @SYMTestType CT
       
  4186 */
       
  4187 void CCTsyPacketContextFU::TestActivate0005L()
       
  4188 	{
       
  4189 
       
  4190 	OpenEtelServerL(EUseExtendedError);
       
  4191 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4192 	OpenPhoneL();
       
  4193 
       
  4194 	RPacketService packetService;
       
  4195 	OpenPacketServiceL(packetService);
       
  4196 	CleanupClosePushL(packetService);
       
  4197 	
       
  4198 	RBuf8 data;
       
  4199 	CleanupClosePushL(data);
       
  4200 	
       
  4201 	RBuf8 expectData;
       
  4202 	CleanupClosePushL(expectData);
       
  4203 	
       
  4204 	// Open new context
       
  4205 	TInfoName contextId;	
       
  4206 	RPacketContext packetContext;
       
  4207 	packetContext.OpenNewContext(packetService, contextId);
       
  4208 	CleanupClosePushL(packetContext);
       
  4209 	
       
  4210 	// initialisation of the context 
       
  4211 	TInt status = InitContextL(packetContext, contextId);
       
  4212 	ASSERT_EQUALS(KErrNone, status);		
       
  4213  
       
  4214 	//-------------------------------------------------------------------------
       
  4215 	// Test A: Test timeout of RPacketContext::Activate
       
  4216  	//-------------------------------------------------------------------------
       
  4217  	TMockLtsyData1 <TInfoName> expData(contextId);
       
  4218 	expData.SerialiseL(expectData);
       
  4219 	
       
  4220  	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  4221  	
       
  4222  	TRequestStatus	requestStatus;
       
  4223 	packetContext.Activate(requestStatus);
       
  4224 	User::WaitForRequest(requestStatus);
       
  4225 	AssertMockLtsyStatusL();
       
  4226 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int()); 	
       
  4227 
       
  4228 	CleanupStack::PopAndDestroy(5, this); // data, expectData, packetContext, packetService, this
       
  4229 	}
       
  4230 
       
  4231 
       
  4232 /**
       
  4233 @SYMTestCaseID BA-CTSY-PKTC-PCGC-0001
       
  4234 @SYMComponent  telephony_ctsy
       
  4235 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetConfig
       
  4236 @SYMTestPriority High
       
  4237 @SYMTestActions Invokes RPacketContext::GetConfig
       
  4238 @SYMTestExpectedResults Pass
       
  4239 @SYMTestType CT
       
  4240 */
       
  4241 void CCTsyPacketContextFU::TestGetConfig0001L()
       
  4242 	{
       
  4243 
       
  4244 	OpenEtelServerL(EUseExtendedError);
       
  4245 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4246 	OpenPhoneL();
       
  4247 
       
  4248 	RBuf8 data;
       
  4249 	CleanupClosePushL(data);
       
  4250 	
       
  4251 	RBuf8 expectData;
       
  4252 	CleanupClosePushL(expectData);
       
  4253 	
       
  4254 	RPacketService packetService;
       
  4255 	OpenPacketServiceL(packetService);
       
  4256 	CleanupClosePushL(packetService);
       
  4257 		
       
  4258 	// Open new context
       
  4259 	TInfoName contextId;	
       
  4260 	RPacketContext packetContext;
       
  4261 	packetContext.OpenNewContext(packetService, contextId);
       
  4262 	CleanupClosePushL(packetContext);				
       
  4263  	
       
  4264  	//-------------------------------------------------------------------------
       
  4265 	// TEST C1: Successful completion request of
       
  4266 	// RPacketContext::GetConfig with  RPacketContext::TContextConfigGPRS param
       
  4267  	//-------------------------------------------------------------------------
       
  4268 	TRequestStatus	requestStatus;
       
  4269 	RPacketContext::TContextConfigGPRS contextConfig;
       
  4270 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig); 
       
  4271 	
       
  4272 	packetContext.GetConfig(requestStatus, pckgConfig);
       
  4273 	
       
  4274 	User::WaitForRequest(requestStatus);	
       
  4275 	AssertMockLtsyStatusL();
       
  4276 	
       
  4277 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 	
       
  4278 	TBuf8<50> null50; 	
       
  4279 	TBuf8<252> nullName; 
       
  4280 	ASSERT_EQUALS(nullName, 					contextConfig.iAccessPointName);
       
  4281 	ASSERT_EQUALS(RPacketContext::ENotRequired, contextConfig.iAnonymousAccessReqd);
       
  4282 	ASSERT_EQUALS(0, 							contextConfig.iNWIContext);
       
  4283 	ASSERT_EQUALS(null50, 						contextConfig.iPdpAddress );
       
  4284 	ASSERT_EQUALS((TUint)0,						contextConfig.iPdpCompression);
       
  4285 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, contextConfig.iPdpType );	
       
  4286 	ASSERT_EQUALS(0, 							contextConfig.iUseEdge);			
       
  4287 	ASSERT_EQUALS(RPacketContext::EProtocolNone,contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  4288 	ASSERT_EQUALS(null50, 		contextConfig.iProtocolConfigOption.iAuthInfo.iUsername);
       
  4289 	ASSERT_EQUALS(null50, 		contextConfig.iProtocolConfigOption.iAuthInfo.iPassword);
       
  4290 	ASSERT_EQUALS(null50,		contextConfig.iProtocolConfigOption.iChallenge);
       
  4291 	ASSERT_EQUALS(null50, 		contextConfig.iProtocolConfigOption.iResponse);	
       
  4292 	ASSERT_EQUALS((TUint8)0, 	contextConfig.iProtocolConfigOption.iId);
       
  4293 	ASSERT_EQUALS(null50, 		contextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  4294 	ASSERT_EQUALS(null50, 		contextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
       
  4295 	
       
  4296 	
       
  4297 	//-------------------------------------------------------------------------
       
  4298 	// TEST C2: Successful completion request of
       
  4299 	// RPacketContext::GetConfig with  RPacketContext::TContextConfigR99_R4 param
       
  4300  	//-------------------------------------------------------------------------
       
  4301 	RPacketContext::TContextConfigR99_R4 contextConfig2;
       
  4302 	TPckg<RPacketContext::TContextConfigR99_R4> pckgConfig2(contextConfig2); 
       
  4303 	
       
  4304 	packetContext.GetConfig(requestStatus, pckgConfig2);
       
  4305 	
       
  4306 	User::WaitForRequest(requestStatus);
       
  4307 	AssertMockLtsyStatusL();			
       
  4308 	
       
  4309 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 		
       
  4310 	ASSERT_EQUALS(nullName, 					contextConfig2.iAccessPointName);
       
  4311 	ASSERT_EQUALS(0, 							contextConfig2.iNWIContext);
       
  4312 	ASSERT_EQUALS(RPacketContext::EBestEffort, 	contextConfig2.iPFI);
       
  4313 	ASSERT_EQUALS(null50, 						contextConfig2.iPdpAddress);
       
  4314 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, contextConfig2.iPdpType );
       
  4315 	ASSERT_EQUALS(0, 							contextConfig2.iUseEdge);
       
  4316 	ASSERT_EQUALS(RPacketContext::EProtocolNone,contextConfig2.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  4317 	ASSERT_EQUALS(null50, 		contextConfig2.iProtocolConfigOption.iAuthInfo.iUsername);
       
  4318 	ASSERT_EQUALS(null50, 		contextConfig2.iProtocolConfigOption.iAuthInfo.iPassword);
       
  4319 	ASSERT_EQUALS(null50, 		contextConfig2.iProtocolConfigOption.iChallenge);
       
  4320 	ASSERT_EQUALS(null50, 		contextConfig2.iProtocolConfigOption.iResponse);	
       
  4321 	ASSERT_EQUALS((TUint8)0, 	contextConfig2.iProtocolConfigOption.iId);
       
  4322 	ASSERT_EQUALS(null50, 		contextConfig2.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  4323 	ASSERT_EQUALS(null50, 		contextConfig2.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
       
  4324 	
       
  4325 	//-------------------------------------------------------------------------
       
  4326 	// TEST D: RPacketContext::GetConfig again, this time CTSY
       
  4327 	// will get result from the cache.
       
  4328  	//-------------------------------------------------------------------------
       
  4329  	
       
  4330  	// initialisation of the context 
       
  4331 	TInt status = InitContextL(packetContext, contextId);
       
  4332 	ASSERT_EQUALS(KErrNone, status);		
       
  4333  
       
  4334 	//value to Config...
       
  4335 	RPacketContext::TContextConfigGPRS setConfig;       
       
  4336     _LIT(KPointName, "Some Name");
       
  4337     setConfig.iAccessPointName.Copy(KPointName);
       
  4338 	setConfig.iAnonymousAccessReqd = RPacketContext::ERequired;
       
  4339 	setConfig.iNWIContext = ETrue;	
       
  4340 	_LIT(KPdpAdd, "Some Add");
       
  4341     setConfig.iPdpAddress.Copy(KPdpAdd);	
       
  4342 	setConfig.iPdpCompression = RPacketContext::KPdpDataCompression;	
       
  4343 	setConfig.iPdpType = RPacketContext::EPdpTypeIPv6;	
       
  4344 	setConfig.iUseEdge = ETrue;		
       
  4345 	setConfig.iProtocolConfigOption.iAuthInfo.iProtocol = RPacketContext::EProtocolCHAP;
       
  4346 	_LIT(KUsername, "Some Username");
       
  4347 	setConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(KUsername);
       
  4348 	_LIT(KPassword, "Some Password");
       
  4349 	setConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(KPassword);
       
  4350 	_LIT(KChallenge, "Challenge");
       
  4351 	setConfig.iProtocolConfigOption.iChallenge.Copy(KChallenge);
       
  4352 	_LIT(KResponse, "Response");
       
  4353 	setConfig.iProtocolConfigOption.iResponse.Copy(KResponse);
       
  4354 	setConfig.iProtocolConfigOption.iId = 10;
       
  4355 	_LIT(KPrimaryDns, "Some PrimaryDns");
       
  4356 	setConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns);
       
  4357 	_LIT(KSecondaryDns, "Some SecondaryDns");
       
  4358 	setConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns);	
       
  4359 	TPckg<RPacketContext::TContextConfigGPRS> pckgSet(setConfig);
       
  4360 	
       
  4361 	// Set new value to Config
       
  4362 	TMockLtsyData1<TInfoName > contexName(contextId);
       
  4363     contexName.SerialiseL(data);    
       
  4364     TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(setConfig, contextId);
       
  4365     expExpect.SerialiseL(expectData);    
       
  4366     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  4367     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);    
       
  4368     packetContext.SetConfig(requestStatus, pckgSet);
       
  4369     User::WaitForRequest(requestStatus);
       
  4370     ASSERT_EQUALS(KErrNone, requestStatus.Int());    
       
  4371     
       
  4372     // Get new values
       
  4373     packetContext.GetConfig(requestStatus, pckgConfig);
       
  4374 	
       
  4375 	User::WaitForRequest(requestStatus);	
       
  4376 	AssertMockLtsyStatusL();	
       
  4377 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  4378 	ASSERT_EQUALS(setConfig.iAccessPointName, 		contextConfig.iAccessPointName);
       
  4379 	ASSERT_EQUALS(setConfig.iAnonymousAccessReqd, 	contextConfig.iAnonymousAccessReqd);
       
  4380 	ASSERT_EQUALS(setConfig.iNWIContext, 			contextConfig.iNWIContext);
       
  4381 	ASSERT_EQUALS(setConfig.iPdpAddress, 			contextConfig.iPdpAddress );
       
  4382 	ASSERT_EQUALS(setConfig.iPdpCompression, 		contextConfig.iPdpCompression);
       
  4383 	ASSERT_EQUALS(setConfig.iPdpType,				contextConfig.iPdpType );	
       
  4384 	ASSERT_EQUALS(setConfig.iUseEdge, 				contextConfig.iUseEdge);			
       
  4385 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iAuthInfo.iProtocol,			contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  4386 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iAuthInfo.iUsername, 			contextConfig.iProtocolConfigOption.iAuthInfo.iUsername);
       
  4387 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iAuthInfo.iPassword, 			contextConfig.iProtocolConfigOption.iAuthInfo.iPassword);
       
  4388 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iChallenge, 					contextConfig.iProtocolConfigOption.iChallenge);
       
  4389 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iResponse, 					contextConfig.iProtocolConfigOption.iResponse);	
       
  4390 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iId, 						 	contextConfig.iProtocolConfigOption.iId);
       
  4391 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, 	contextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  4392 	ASSERT_EQUALS(setConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, 	contextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);	
       
  4393 	
       
  4394 	CleanupStack::PopAndDestroy(5, this); // expectData, data, packetContext, packetService, this	
       
  4395 	}
       
  4396 
       
  4397 
       
  4398 /**
       
  4399 @SYMTestCaseID BA-CTSY-PKTC-PCGC-0003
       
  4400 @SYMComponent  telephony_ctsy
       
  4401 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetConfig with bad parameter data
       
  4402 @SYMTestPriority High
       
  4403 @SYMTestActions Invokes RPacketContext::GetConfig with bad parameter data
       
  4404 @SYMTestExpectedResults Pass
       
  4405 @SYMTestType CT
       
  4406 */
       
  4407 void CCTsyPacketContextFU::TestGetConfig0003L()
       
  4408 	{
       
  4409 	OpenEtelServerL(EUseExtendedError);
       
  4410 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4411 	OpenPhoneL();
       
  4412 
       
  4413 	RPacketService packetService;
       
  4414 	OpenPacketServiceL(packetService);
       
  4415 	CleanupClosePushL(packetService);
       
  4416 		
       
  4417 	// Open new context
       
  4418 	TInfoName contextId;	
       
  4419 	RPacketContext packetContext;
       
  4420 	packetContext.OpenNewContext(packetService, contextId);
       
  4421 	CleanupClosePushL(packetContext);
       
  4422 	
       
  4423 
       
  4424 	//-------------------------------------------------------------------------
       
  4425 	// Test A: Test passing wrong version of parameters to
       
  4426 	// RPacketContext::GetConfig
       
  4427  	//-------------------------------------------------------------------------
       
  4428 	TRequestStatus	requestStatus;
       
  4429 	RPacketContext::TContextConfigCDMA contextConfig;
       
  4430 	TPckg<RPacketContext::TContextConfigCDMA> pckgConfig(contextConfig); 
       
  4431 	
       
  4432 	packetContext.GetConfig(requestStatus, pckgConfig);
       
  4433 	
       
  4434 	User::WaitForRequest(requestStatus);	
       
  4435 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); 	
       
  4436 	AssertMockLtsyStatusL();
       
  4437 
       
  4438 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this	
       
  4439 	}
       
  4440 
       
  4441 
       
  4442 /**
       
  4443 @SYMTestCaseID BA-CTSY-PKTC-PCGC-0004
       
  4444 @SYMComponent  telephony_ctsy
       
  4445 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::GetConfig
       
  4446 @SYMTestPriority High
       
  4447 @SYMTestActions Invokes multiple client requests to RPacketContext::GetConfig
       
  4448 @SYMTestExpectedResults Pass
       
  4449 @SYMTestType CT
       
  4450 */
       
  4451 void CCTsyPacketContextFU::TestGetConfig0004L()
       
  4452 	{
       
  4453 					
       
  4454 	OpenEtelServerL(EUseExtendedError);
       
  4455 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4456 	OpenPhoneL();
       
  4457 
       
  4458 	// Open second client
       
  4459 	RTelServer telServer2;
       
  4460 	TInt ret = telServer2.Connect();
       
  4461 	ASSERT_EQUALS(KErrNone, ret);
       
  4462 	CleanupClosePushL(telServer2);
       
  4463 
       
  4464 	RMobilePhone phone2;
       
  4465 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4466 	ASSERT_EQUALS(KErrNone, ret);
       
  4467 	CleanupClosePushL(phone2);
       
  4468 	
       
  4469 	RPacketService packetService;
       
  4470 	OpenPacketServiceL(packetService);
       
  4471 	CleanupClosePushL(packetService);
       
  4472 	
       
  4473 	RPacketService packetService2;                
       
  4474 	ret = packetService2.Open(phone2);
       
  4475 	ASSERT_EQUALS(KErrNone, ret);
       
  4476 	CleanupClosePushL(packetService2);
       
  4477 	
       
  4478 	// Open first context
       
  4479 	TInfoName contextId;	
       
  4480 	RPacketContext packetContext;
       
  4481 	packetContext.OpenNewContext(packetService, contextId);
       
  4482 	CleanupClosePushL(packetContext);
       
  4483 	
       
  4484 	// Open second context
       
  4485 	TInfoName contextId2;	
       
  4486 	RPacketContext packetContext2;
       
  4487 	packetContext2.OpenNewContext(packetService2, contextId2);
       
  4488 	CleanupClosePushL(packetContext2);
       
  4489 	//-------------------------------------------------------------------------
       
  4490 	// Test A: Test multiple clients requesting RPacketContext::GetConfig
       
  4491  	//-------------------------------------------------------------------------
       
  4492 	
       
  4493 	TRequestStatus	requestStatus;
       
  4494 	RPacketContext::TContextConfigGPRS contextConfig;
       
  4495 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig); 
       
  4496 	
       
  4497 	TRequestStatus	requestStatus2;
       
  4498 	RPacketContext::TContextConfigR99_R4 contextConfig2;
       
  4499 	TPckg<RPacketContext::TContextConfigR99_R4> pckgConfig2(contextConfig2); 
       
  4500 	
       
  4501 	// send first request
       
  4502 	packetContext.GetConfig(requestStatus, pckgConfig);
       
  4503 	// send second request
       
  4504 	packetContext2.GetConfig(requestStatus2, pckgConfig2);
       
  4505 	
       
  4506 	// wait for the first answer
       
  4507 	User::WaitForRequest(requestStatus);	
       
  4508 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 	
       
  4509 	TBuf8<50> null50; 	
       
  4510 	TBuf8<252> nullName; 
       
  4511 	ASSERT_EQUALS(nullName, contextConfig.iAccessPointName);
       
  4512 	ASSERT_EQUALS(RPacketContext::ENotRequired, contextConfig.iAnonymousAccessReqd);
       
  4513 	ASSERT_EQUALS(0, contextConfig.iNWIContext);
       
  4514 	ASSERT_EQUALS(null50, contextConfig.iPdpAddress );
       
  4515 	ASSERT_EQUALS((TUint)0, contextConfig.iPdpCompression);
       
  4516 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, contextConfig.iPdpType );	
       
  4517 	ASSERT_EQUALS(0, contextConfig.iUseEdge);			
       
  4518 	ASSERT_EQUALS(RPacketContext::EProtocolNone, contextConfig.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  4519 	ASSERT_EQUALS(null50, contextConfig.iProtocolConfigOption.iAuthInfo.iUsername);
       
  4520 	ASSERT_EQUALS(null50, contextConfig.iProtocolConfigOption.iAuthInfo.iPassword);
       
  4521 	ASSERT_EQUALS(null50, contextConfig.iProtocolConfigOption.iChallenge);
       
  4522 	ASSERT_EQUALS(null50, contextConfig.iProtocolConfigOption.iResponse);	
       
  4523 	ASSERT_EQUALS((TUint8)0, contextConfig.iProtocolConfigOption.iId);
       
  4524 	ASSERT_EQUALS(null50, contextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  4525 	ASSERT_EQUALS(null50, contextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
       
  4526 	
       
  4527 	// wait for the second answer
       
  4528 	User::WaitForRequest(requestStatus2);
       
  4529 	AssertMockLtsyStatusL();	
       
  4530 	ASSERT_EQUALS(KErrNone, requestStatus2.Int()); 		
       
  4531 	ASSERT_EQUALS(nullName, contextConfig2.iAccessPointName);
       
  4532 	ASSERT_EQUALS(0, contextConfig2.iNWIContext);
       
  4533 	ASSERT_EQUALS(RPacketContext::EBestEffort, contextConfig2.iPFI);
       
  4534 	ASSERT_EQUALS(null50, contextConfig2.iPdpAddress);
       
  4535 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, contextConfig2.iPdpType );
       
  4536 	ASSERT_EQUALS(0, contextConfig2.iUseEdge);
       
  4537 	ASSERT_EQUALS(RPacketContext::EProtocolNone, contextConfig2.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  4538 	ASSERT_EQUALS(null50, contextConfig2.iProtocolConfigOption.iAuthInfo.iUsername);
       
  4539 	ASSERT_EQUALS(null50, contextConfig2.iProtocolConfigOption.iAuthInfo.iPassword);
       
  4540 	ASSERT_EQUALS(null50, contextConfig2.iProtocolConfigOption.iChallenge);
       
  4541 	ASSERT_EQUALS(null50, contextConfig2.iProtocolConfigOption.iResponse);	
       
  4542 	ASSERT_EQUALS((TUint8)0, contextConfig2.iProtocolConfigOption.iId);
       
  4543 	ASSERT_EQUALS(null50, contextConfig2.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);
       
  4544 	ASSERT_EQUALS(null50, contextConfig2.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);
       
  4545 	
       
  4546 	CleanupStack::PopAndDestroy(7, this); //packetContext2, packetContext, packetService2, packetService, phone2, telServer2, this
       
  4547 	}
       
  4548 
       
  4549 
       
  4550 
       
  4551 /**
       
  4552 @SYMTestCaseID BA-CTSY-PKTC-PCGS-0001
       
  4553 @SYMComponent  telephony_ctsy
       
  4554 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetStatus
       
  4555 @SYMTestPriority High
       
  4556 @SYMTestActions Invokes RPacketContext::GetStatus
       
  4557 @SYMTestExpectedResults Pass
       
  4558 @SYMTestType CT
       
  4559 */
       
  4560 void CCTsyPacketContextFU::TestGetStatus0001L()
       
  4561     {
       
  4562     OpenEtelServerL(EUseExtendedError);
       
  4563     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4564     OpenPhoneL();
       
  4565 
       
  4566     RBuf8 data;
       
  4567     CleanupClosePushL(data);
       
  4568 
       
  4569     
       
  4570     RPacketService packetService;
       
  4571     OpenPacketServiceL(packetService);
       
  4572     CleanupClosePushL(packetService);
       
  4573     
       
  4574     TInfoName contextId;  
       
  4575     RPacketContext packetContext;
       
  4576     packetContext.OpenNewContext(packetService, contextId);
       
  4577     CleanupClosePushL(packetContext);
       
  4578 
       
  4579     // test 1: context not inited
       
  4580     RPacketContext::TContextStatus contextStatus;    
       
  4581     packetContext.GetStatus(contextStatus);
       
  4582     ASSERT_EQUALS(RPacketContext::EStatusUnknown, contextStatus);
       
  4583     
       
  4584     // initialisation of the context 
       
  4585 	TInt status = InitContextL(packetContext, contextId);
       
  4586 	ASSERT_EQUALS(KErrNone, status);
       
  4587 		
       
  4588     // test2: context inited
       
  4589     packetContext.GetStatus(contextStatus);
       
  4590     ASSERT_EQUALS(RPacketContext::EStatusInactive, contextStatus);
       
  4591     
       
  4592 
       
  4593     AssertMockLtsyStatusL();
       
  4594     CleanupStack::PopAndDestroy(2); //packetContext, packetService
       
  4595     CleanupStack::PopAndDestroy(2, this); // data, this 
       
  4596     }
       
  4597 
       
  4598 
       
  4599 /**
       
  4600 @SYMTestCaseID BA-CTSY-PKTC-PCGS-0002
       
  4601 @SYMComponent  telephony_ctsy
       
  4602 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::GetStatus
       
  4603 @SYMTestPriority High
       
  4604 @SYMTestActions Invokes cancelling of RPacketContext::GetStatus
       
  4605 @SYMTestExpectedResults Pass
       
  4606 @SYMTestType CT
       
  4607 */
       
  4608 /*void CCTsyPacketContextFU::TestGetStatus0002L()
       
  4609     {
       
  4610 
       
  4611 // This test should test cancellation of GetStatus
       
  4612 // If this API does not have a cancel, the test step should be completely removed.
       
  4613 
       
  4614     OpenEtelServerL(EUseExtendedError);
       
  4615     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4616     OpenPhoneL();
       
  4617 
       
  4618     TRequestStatus mockLtsyStatus;
       
  4619     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4620 
       
  4621     RBuf8 data;
       
  4622     CleanupClosePushL(data);
       
  4623 
       
  4624     //-------------------------------------------------------------------------
       
  4625     // Test cancelling of RPacketContext::GetStatus
       
  4626     //-------------------------------------------------------------------------
       
  4627     
       
  4628     // Remove the test above if this is not relevant for this API
       
  4629 
       
  4630     // Wait for completion of iMockLTSY.NotifyTerminated
       
  4631     // User::WaitForRequest(mockLtsyStatus);
       
  4632     CleanupStack::PopAndDestroy(2); // data, this
       
  4633     
       
  4634     }*/
       
  4635 
       
  4636 
       
  4637 /**
       
  4638 @SYMTestCaseID BA-CTSY-PKTC-PCGS-0003
       
  4639 @SYMComponent  telephony_ctsy
       
  4640 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetStatus with bad parameter data
       
  4641 @SYMTestPriority High
       
  4642 @SYMTestActions Invokes RPacketContext::GetStatus with bad parameter data
       
  4643 @SYMTestExpectedResults Pass
       
  4644 @SYMTestType CT
       
  4645 */
       
  4646 /*void CCTsyPacketContextFU::TestGetStatus0003L()
       
  4647     {
       
  4648 
       
  4649 // This test should test sending bad parameter data for GetStatus
       
  4650 // If this API does not have any parameters, then remove this test completely.
       
  4651 
       
  4652     OpenEtelServerL(EUseExtendedError);
       
  4653     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4654     OpenPhoneL();
       
  4655 
       
  4656     RBuf8 data;
       
  4657     CleanupClosePushL(data);
       
  4658 
       
  4659     //-------------------------------------------------------------------------
       
  4660     // Test A: Test passing wrong version of parameters to
       
  4661     // RPacketContext::GetStatus
       
  4662     //-------------------------------------------------------------------------
       
  4663 
       
  4664     // Remove the test above if it is not relevant for this API
       
  4665 
       
  4666     //-------------------------------------------------------------------------
       
  4667     // Test B: Test passing wrong descriptor size to parameter in
       
  4668     // RPacketContext::GetStatus
       
  4669     //-------------------------------------------------------------------------
       
  4670 
       
  4671     // Remove the test above if it is not relevant for this API
       
  4672     
       
  4673     //-------------------------------------------------------------------------
       
  4674     // Test C: Test passing out of bounds parameters to
       
  4675     // RPacketContext::GetStatus
       
  4676     //-------------------------------------------------------------------------
       
  4677     
       
  4678     // Remove the test above if it is not relevant for this API
       
  4679 
       
  4680     // Done !
       
  4681     CleanupStack::PopAndDestroy(2, this); // data, this
       
  4682 
       
  4683     }*/
       
  4684 
       
  4685 
       
  4686 /**
       
  4687 @SYMTestCaseID BA-CTSY-PKTC-PCGS-0004
       
  4688 @SYMComponent  telephony_ctsy
       
  4689 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::GetStatus
       
  4690 @SYMTestPriority High
       
  4691 @SYMTestActions Invokes multiple client requests to RPacketContext::GetStatus
       
  4692 @SYMTestExpectedResults Pass
       
  4693 @SYMTestType CT
       
  4694 */
       
  4695 /*void CCTsyPacketContextFU::TestGetStatus0004L()
       
  4696     {
       
  4697 
       
  4698                     
       
  4699     OpenEtelServerL(EUseExtendedError);
       
  4700     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4701     OpenPhoneL();
       
  4702 
       
  4703     RBuf8 data;
       
  4704     CleanupClosePushL(data);
       
  4705 
       
  4706     // Open second client
       
  4707     RTelServer telServer2;
       
  4708     TInt ret = telServer2.Connect();
       
  4709     ASSERT_EQUALS(KErrNone, ret);
       
  4710     CleanupClosePushL(telServer2);
       
  4711 
       
  4712     RMobilePhone phone2;
       
  4713     ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4714     ASSERT_EQUALS(KErrNone, ret);
       
  4715     CleanupClosePushL(phone2);
       
  4716 
       
  4717     //-------------------------------------------------------------------------
       
  4718     // Test A: Test multiple clients requesting RPacketContext::GetStatus
       
  4719     //-------------------------------------------------------------------------
       
  4720 
       
  4721     // If this API is flow controlled by Etel or if this API is
       
  4722     // synchronous, remove this test completely.
       
  4723 
       
  4724     // To write this test:
       
  4725     // If this API has parameters which have different versions, then each
       
  4726     // client in this test should use a different version of parameter.
       
  4727     // Otherwise, they should use the same version.
       
  4728     // All versions of parameters should be used. i.e. If there are three
       
  4729     // versions of a parameter, there should be three clients, one using
       
  4730     // each one. If the parameter does not have different versions, use
       
  4731     // two clients each using the same version.
       
  4732 
       
  4733 
       
  4734     // Done !
       
  4735     CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  4736 
       
  4737     }*/
       
  4738 
       
  4739 
       
  4740 /**
       
  4741 @SYMTestCaseID BA-CTSY-PKTC-PCGS-0005
       
  4742 @SYMComponent  telephony_ctsy
       
  4743 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetStatus with timeout
       
  4744 @SYMTestPriority High
       
  4745 @SYMTestActions Invokes RPacketContext::GetStatus and tests for timeout
       
  4746 @SYMTestExpectedResults Pass
       
  4747 @SYMTestType CT
       
  4748 */
       
  4749 /*void CCTsyPacketContextFU::TestGetStatus0005L()
       
  4750     {
       
  4751 
       
  4752 
       
  4753     OpenEtelServerL(EUseExtendedError);
       
  4754     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4755     OpenPhoneL();
       
  4756 
       
  4757     RBuf8 data;
       
  4758     CleanupClosePushL(data);
       
  4759 
       
  4760     //-------------------------------------------------------------------------
       
  4761     // Test A: Test timeout of RPacketContext::GetStatus
       
  4762     //-------------------------------------------------------------------------
       
  4763 
       
  4764     // If this API does not have a timeout, then remove this test completely.
       
  4765 
       
  4766     // Done !
       
  4767     CleanupStack::PopAndDestroy(2, this); // data, this
       
  4768 
       
  4769     }*/
       
  4770 
       
  4771  /**
       
  4772 @SYMTestCaseID BA-CTSY-PKTC-PCSC-0001
       
  4773 @SYMComponent  telephony_ctsy
       
  4774 @SYMTestCaseDesc Test support in CTSY for RPacketContext::SetConfig
       
  4775 @SYMTestPriority High
       
  4776 @SYMTestActions Invokes RPacketContext::SetConfig
       
  4777 @SYMTestExpectedResults Pass
       
  4778 @SYMTestType CT
       
  4779 */
       
  4780 void CCTsyPacketContextFU::TestSetConfig0001L()
       
  4781     {
       
  4782 
       
  4783     OpenEtelServerL(EUseExtendedError);
       
  4784     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4785     OpenPhoneL();
       
  4786 
       
  4787     RBuf8 data;
       
  4788     CleanupClosePushL(data);
       
  4789     
       
  4790     RBuf8 expectData;
       
  4791     CleanupClosePushL(expectData);
       
  4792 
       
  4793     RPacketService packetService;
       
  4794     OpenPacketServiceL(packetService);
       
  4795     CleanupClosePushL(packetService);
       
  4796     
       
  4797     TInfoName contextId;  
       
  4798     RPacketContext packetContext;
       
  4799     packetContext.OpenNewContext(packetService, contextId);
       
  4800     CleanupClosePushL(packetContext);
       
  4801     
       
  4802     // initialisation of the context 
       
  4803  	TInt status = InitContextL(packetContext, contextId);
       
  4804 	ASSERT_EQUALS(KErrNone, status);  
       
  4805  
       
  4806 	// data for SetContext
       
  4807     RPacketContext::TContextConfigGPRS setConfig;
       
  4808      _LIT(KPointName, "Some Name");
       
  4809     setConfig.iAccessPointName.Copy(KPointName);
       
  4810 	setConfig.iAnonymousAccessReqd = RPacketContext::ERequired;
       
  4811 	setConfig.iNWIContext = ETrue;	
       
  4812 	_LIT(KPdpAdd, "Some Add");
       
  4813     setConfig.iPdpAddress.Copy(KPdpAdd);	
       
  4814 	setConfig.iPdpCompression = RPacketContext::KPdpDataCompression;	
       
  4815 	setConfig.iPdpType = RPacketContext::EPdpTypeIPv6;	
       
  4816 	setConfig.iUseEdge = ETrue;		
       
  4817 	setConfig.iProtocolConfigOption.iAuthInfo.iProtocol = RPacketContext::EProtocolCHAP;
       
  4818 	_LIT(KUsername, "Some Username");
       
  4819 	setConfig.iProtocolConfigOption.iAuthInfo.iUsername.Copy(KUsername);
       
  4820 	_LIT(KPassword, "Some Password");
       
  4821 	setConfig.iProtocolConfigOption.iAuthInfo.iPassword.Copy(KPassword);
       
  4822 	_LIT(KChallenge, "Challenge");
       
  4823 	setConfig.iProtocolConfigOption.iChallenge.Copy(KChallenge);
       
  4824 	_LIT(KResponse, "Response");
       
  4825 	setConfig.iProtocolConfigOption.iResponse.Copy(KResponse);
       
  4826 	setConfig.iProtocolConfigOption.iId = 10;
       
  4827 	_LIT(KPrimaryDns, "Some PrimaryDns");
       
  4828 	setConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns);
       
  4829 	_LIT(KSecondaryDns, "Some SecondaryDns");
       
  4830 	setConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns);    
       
  4831     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(setConfig);    
       
  4832     
       
  4833     TRequestStatus requestStatus;    
       
  4834 
       
  4835     //-------------------------------------------------------------------------
       
  4836     // TEST A: failure to dispatch request to LTSY
       
  4837     //-------------------------------------------------------------------------
       
  4838 	TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(setConfig, contextId);
       
  4839     expExpect.SerialiseL(expectData);
       
  4840     
       
  4841     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData, KErrNotSupported);
       
  4842 
       
  4843     packetContext.SetConfig(requestStatus, pckgConfig);
       
  4844     User::WaitForRequest(requestStatus);
       
  4845     AssertMockLtsyStatusL();
       
  4846     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  4847 
       
  4848 
       
  4849     //-------------------------------------------------------------------------
       
  4850     // TEST B: failure on completion of pending request from LTSY->CTSY
       
  4851     //-------------------------------------------------------------------------
       
  4852     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  4853 
       
  4854     TMockLtsyData1<TInfoName > contexName(contextId);
       
  4855     contexName.SerialiseL(data);
       
  4856     
       
  4857     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrGeneral, data);
       
  4858     packetContext.SetConfig(requestStatus, pckgConfig);
       
  4859     User::WaitForRequest(requestStatus);
       
  4860     AssertMockLtsyStatusL();
       
  4861     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  4862 
       
  4863     //-------------------------------------------------------------------------
       
  4864     // TEST C: Successful completion request of
       
  4865     // RPacketContext::SetConfig when result is not cached.
       
  4866     //-------------------------------------------------------------------------
       
  4867     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  4868     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  4869 
       
  4870     packetContext.SetConfig(requestStatus, pckgConfig);
       
  4871 
       
  4872     User::WaitForRequest(requestStatus);
       
  4873     AssertMockLtsyStatusL();
       
  4874     ASSERT_EQUALS(KErrNone, requestStatus.Int());  
       
  4875        
       
  4876     //--------------------------------------------
       
  4877     // Successful completion for R99 
       
  4878     //--------------------------------------------     
       
  4879     RPacketContext::TContextConfigR99_R4 setConfig99;    
       
  4880      _LIT(KPointName99, "Some Name99");
       
  4881     setConfig99.iAccessPointName.Copy(KPointName99);
       
  4882 	setConfig99.iNWIContext = ETrue;	
       
  4883 	_LIT(KPdpAdd99, "Some Add99");
       
  4884     setConfig99.iPdpAddress.Copy(KPdpAdd99);		
       
  4885 	setConfig99.iPdpType = RPacketContext::EPdpTypeIPv6;			
       
  4886 	setConfig99.iProtocolConfigOption.iAuthInfo.iProtocol = RPacketContext::EProtocolCHAP;
       
  4887 	_LIT(KUsername99, "Some Username99");
       
  4888 	setConfig99.iProtocolConfigOption.iAuthInfo.iUsername.Copy(KUsername99);
       
  4889 	_LIT(KPassword99, "Some Password99");
       
  4890 	setConfig99.iProtocolConfigOption.iAuthInfo.iPassword.Copy(KPassword99);
       
  4891 	_LIT(KChallenge99, "Challenge99");
       
  4892 	setConfig99.iProtocolConfigOption.iChallenge.Copy(KChallenge99);
       
  4893 	_LIT(KResponse99, "Response99");
       
  4894 	setConfig99.iProtocolConfigOption.iResponse.Copy(KResponse99);
       
  4895 	setConfig99.iProtocolConfigOption.iId = 10;
       
  4896 	_LIT(KPrimaryDns99, "Some PrimaryDns99");
       
  4897 	setConfig99.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(KPrimaryDns99);
       
  4898 	_LIT(KSecondaryDns99, "Some SecondaryDns99");
       
  4899 	setConfig99.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(KSecondaryDns99); 	
       
  4900 	setConfig99.iPFI = RPacketContext::ESignalling;	   
       
  4901     TPckg<RPacketContext::TContextConfigR99_R4> pckgConfig3(setConfig99);    
       
  4902 
       
  4903  	TMockLtsyData2<RPacketContext::TContextConfigR99_R4, TInfoName > expExpect4(setConfig99, contextId);
       
  4904     expectData.Close();
       
  4905     expExpect4.SerialiseL(expectData);
       
  4906     
       
  4907     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  4908     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  4909 
       
  4910     packetContext.SetConfig(requestStatus, pckgConfig3);
       
  4911 
       
  4912     User::WaitForRequest(requestStatus);
       
  4913     
       
  4914     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4915     AssertMockLtsyStatusL();
       
  4916     
       
  4917     //--------------------------------------------
       
  4918     // failure to dispatch request for R99 
       
  4919     //--------------------------------------------    
       
  4920     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData, KErrNotSupported);
       
  4921     //iMockLTSY.CompleteL(EPacketContextSetConfig, KErrGeneral, data);
       
  4922 
       
  4923     packetContext.SetConfig(requestStatus, pckgConfig3);
       
  4924 
       
  4925     User::WaitForRequest(requestStatus);
       
  4926     
       
  4927     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  4928     AssertMockLtsyStatusL();
       
  4929         
       
  4930     //-------------------------------------------------------------------------
       
  4931     // TEST E: Unsolicited completion of RPacketContext::SetConfig
       
  4932     // from LTSY.
       
  4933     //-------------------------------------------------------------------------
       
  4934     TRequestStatus mockLtsyStatus;
       
  4935     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4936     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data, 0);
       
  4937     User::WaitForRequest(mockLtsyStatus);        
       
  4938     
       
  4939     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());  
       
  4940 
       
  4941     AssertMockLtsyStatusL();
       
  4942     CleanupStack::PopAndDestroy(2); //packetContext, packetService
       
  4943     CleanupStack::PopAndDestroy(3, this); // data, expectData, this    
       
  4944     }
       
  4945 
       
  4946 
       
  4947 /**
       
  4948 @SYMTestCaseID BA-CTSY-PKTC-PCSC-0002
       
  4949 @SYMComponent  telephony_ctsy
       
  4950 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketContext::SetConfig
       
  4951 @SYMTestPriority High
       
  4952 @SYMTestActions Invokes cancelling of RPacketContext::SetConfig
       
  4953 @SYMTestExpectedResults Pass
       
  4954 @SYMTestType CT
       
  4955 */
       
  4956 void CCTsyPacketContextFU::TestSetConfig0002L()
       
  4957     {
       
  4958     
       
  4959     OpenEtelServerL(EUseExtendedError);
       
  4960     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4961     OpenPhoneL();
       
  4962 
       
  4963 	RBuf8 data;
       
  4964     CleanupClosePushL(data);
       
  4965 	
       
  4966     RBuf8 expectData;
       
  4967     CleanupClosePushL(expectData);
       
  4968 
       
  4969     RPacketService packetService;
       
  4970     OpenPacketServiceL(packetService);
       
  4971     CleanupClosePushL(packetService);
       
  4972     
       
  4973     TInfoName contextId;  
       
  4974     RPacketContext packetContext;
       
  4975     packetContext.OpenNewContext(packetService, contextId);
       
  4976     CleanupClosePushL(packetContext);
       
  4977     
       
  4978     // initialisation of the context 
       
  4979  	TInt status = InitContextL(packetContext, contextId);
       
  4980 	ASSERT_EQUALS(KErrNone, status); 
       
  4981 	
       
  4982 	// data for SetConfig
       
  4983     RPacketContext::TContextConfigGPRS contextConfig;
       
  4984     _LIT(KPdpAdd, "Some Add");
       
  4985     contextConfig.iPdpAddress.Copy(KPdpAdd);
       
  4986     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);    
       
  4987     
       
  4988     // data for ExpectL
       
  4989     TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(contextConfig, contextId);
       
  4990     expExpect.SerialiseL(expectData);
       
  4991     
       
  4992     //data for CompleteL    
       
  4993     TMockLtsyData1<TInfoName > contexName(contextId);
       
  4994     contexName.SerialiseL(data);    
       
  4995 
       
  4996     TRequestStatus mockLtsyStatus;
       
  4997     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4998     
       
  4999     TRequestStatus requestStatus;
       
  5000     //-------------------------------------------------------------------------
       
  5001     // Test cancelling of RPacketContext::SetConfig
       
  5002     //-------------------------------------------------------------------------    
       
  5003     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  5004     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data, 20);
       
  5005 
       
  5006     packetContext.SetConfig(requestStatus, pckgConfig);
       
  5007 	
       
  5008     packetContext.CancelAsyncRequest(EPacketContextSetConfig);
       
  5009 
       
  5010     User::WaitForRequest(requestStatus);    
       
  5011     AssertMockLtsyStatusL();    
       
  5012     // TSY has started a request and it is not possible to then cancel 
       
  5013     // this request. (see CMmPacketContextTsy.cpp line 483)
       
  5014     ASSERT_EQUALS(KErrNone, requestStatus.Int());    
       
  5015 
       
  5016     // Wait for completion of iMockLTSY.NotifyTerminated
       
  5017     User::WaitForRequest(mockLtsyStatus);
       
  5018      
       
  5019     CleanupStack::PopAndDestroy(2);
       
  5020     CleanupStack::PopAndDestroy(3, this); // expectData, data, this    
       
  5021     }
       
  5022 
       
  5023 
       
  5024 /**
       
  5025 @SYMTestCaseID BA-CTSY-PKTC-PCSC-0003
       
  5026 @SYMComponent  telephony_ctsy
       
  5027 @SYMTestCaseDesc Test support in CTSY for RPacketContext::SetConfig with bad parameter data
       
  5028 @SYMTestPriority High
       
  5029 @SYMTestActions Invokes RPacketContext::SetConfig with bad parameter data
       
  5030 @SYMTestExpectedResults Pass
       
  5031 @SYMTestType CT
       
  5032 */
       
  5033 void CCTsyPacketContextFU::TestSetConfig0003L()
       
  5034     {
       
  5035     
       
  5036     OpenEtelServerL(EUseExtendedError);
       
  5037     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5038     OpenPhoneL();
       
  5039 
       
  5040     RBuf8 data;
       
  5041     CleanupClosePushL(data);
       
  5042     
       
  5043     RPacketService packetService;
       
  5044     OpenPacketServiceL(packetService);
       
  5045     CleanupClosePushL(packetService);
       
  5046     
       
  5047     TInfoName contextId;  
       
  5048     RPacketContext packetContext;
       
  5049     packetContext.OpenNewContext(packetService, contextId);
       
  5050     CleanupClosePushL(packetContext);
       
  5051     
       
  5052     // initialisation of the context 
       
  5053 	 TInt status = InitContextL(packetContext, contextId);
       
  5054 	 ASSERT_EQUALS(KErrNone, status);  
       
  5055  
       
  5056     //-------------------------------------------------------------------------
       
  5057     // Test A: Test passing wrong version of parameters to
       
  5058     // RPacketContext::SetConfig
       
  5059     //-------------------------------------------------------------------------
       
  5060 
       
  5061     RPacketContext::TContextConfigCDMA contextConfig;
       
  5062     TPckg<RPacketContext::TContextConfigCDMA> pckgConfig(contextConfig);    
       
  5063 
       
  5064     TRequestStatus requestStatus;
       
  5065         
       
  5066     packetContext.SetConfig(requestStatus, pckgConfig);
       
  5067 
       
  5068     User::WaitForRequest(requestStatus);
       
  5069     
       
  5070     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5071     AssertMockLtsyStatusL();
       
  5072     
       
  5073 
       
  5074     //------------------------------------------------
       
  5075     //set config for context that was not inited, using GPRS
       
  5076     //------------------------------------------------
       
  5077     TInfoName contextId2;  
       
  5078     RPacketContext packetContext2;
       
  5079     packetContext2.OpenNewContext(packetService, contextId2);
       
  5080     CleanupClosePushL(packetContext2);
       
  5081     
       
  5082 
       
  5083     RPacketContext::TContextConfigGPRS contextConfig2;
       
  5084     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig2(contextConfig2);    
       
  5085     
       
  5086     packetContext2.SetConfig(requestStatus, pckgConfig2);
       
  5087 
       
  5088     User::WaitForRequest(requestStatus);
       
  5089     
       
  5090     ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  5091     AssertMockLtsyStatusL();
       
  5092     
       
  5093 
       
  5094     //------------------------------------------------
       
  5095     //set config for context that was not inited, using R99_R4
       
  5096     //------------------------------------------------
       
  5097     RPacketContext::TContextConfigR99_R4 contextConfig3;
       
  5098     TPckg<RPacketContext::TContextConfigR99_R4> pckgConfig3(contextConfig3);    
       
  5099 
       
  5100     packetContext2.SetConfig(requestStatus, pckgConfig3);
       
  5101 
       
  5102     User::WaitForRequest(requestStatus);
       
  5103     
       
  5104     ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  5105     AssertMockLtsyStatusL();
       
  5106 
       
  5107     CleanupStack::PopAndDestroy(1); //packetContext2
       
  5108     
       
  5109     CleanupStack::PopAndDestroy(2); //packetContext packetService
       
  5110     CleanupStack::PopAndDestroy(2, this); // data, this
       
  5111 
       
  5112     }
       
  5113 
       
  5114 
       
  5115 /**
       
  5116 @SYMTestCaseID BA-CTSY-PKTC-PCSC-0004
       
  5117 @SYMComponent  telephony_ctsy
       
  5118 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::SetConfig
       
  5119 @SYMTestPriority High
       
  5120 @SYMTestActions Invokes multiple client requests to RPacketContext::SetConfig
       
  5121 @SYMTestExpectedResults Pass
       
  5122 @SYMTestType CT
       
  5123 */
       
  5124 void CCTsyPacketContextFU::TestSetConfig0004L()
       
  5125     {
       
  5126     
       
  5127     OpenEtelServerL(EUseExtendedError);
       
  5128     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5129     OpenPhoneL();
       
  5130 
       
  5131     RBuf8 data;
       
  5132     CleanupClosePushL(data);
       
  5133 
       
  5134     RBuf8 data2;
       
  5135     CleanupClosePushL(data2);
       
  5136     
       
  5137     RBuf8 expectData;
       
  5138     CleanupClosePushL(expectData);
       
  5139     
       
  5140     RBuf8 expectData2;
       
  5141     CleanupClosePushL(expectData2);
       
  5142 
       
  5143     // Open second client
       
  5144     RTelServer telServer2;
       
  5145     TInt ret = telServer2.Connect();
       
  5146     ASSERT_EQUALS(KErrNone, ret);
       
  5147     CleanupClosePushL(telServer2);
       
  5148 
       
  5149     RMobilePhone phone2;
       
  5150     ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  5151     ASSERT_EQUALS(KErrNone, ret);
       
  5152     CleanupClosePushL(phone2);
       
  5153 
       
  5154 
       
  5155     RPacketService packetService;
       
  5156     OpenPacketServiceL(packetService);
       
  5157     CleanupClosePushL(packetService);
       
  5158 
       
  5159     RPacketService packetService2;                
       
  5160     ret = packetService2.Open(phone2);
       
  5161     ASSERT_EQUALS(KErrNone, ret);
       
  5162     CleanupClosePushL(packetService2);
       
  5163     
       
  5164     // Open first context
       
  5165     TInfoName contextId;  
       
  5166     RPacketContext packetContext;
       
  5167     packetContext.OpenNewContext(packetService, contextId);
       
  5168     CleanupClosePushL(packetContext);
       
  5169     
       
  5170     // Open second context
       
  5171     TInfoName contextId2; 
       
  5172     RPacketContext packetContext2;
       
  5173     packetContext2.OpenNewContext(packetService2, contextId2);
       
  5174     CleanupClosePushL(packetContext2);
       
  5175 
       
  5176 
       
  5177     // initialisation of the first context 
       
  5178  	TInt status = InitContextL(packetContext, contextId);
       
  5179  	ASSERT_EQUALS(KErrNone, status);
       
  5180   
       
  5181  	// initialisation of the second context 
       
  5182 	 status = InitContextL(packetContext2, contextId2);
       
  5183  	ASSERT_EQUALS(KErrNone, status);
       
  5184     
       
  5185     TRequestStatus mockLtsyStatus;
       
  5186     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5187 
       
  5188 
       
  5189     //-------------------------------------------------------------------------
       
  5190     // Test A: Test multiple clients requesting RPacketContext::SetConfig
       
  5191     //-------------------------------------------------------------------------    
       
  5192     RPacketContext::TContextConfigGPRS contextConfig;
       
  5193     _LIT(KPdpAdd, "Some Add");
       
  5194     contextConfig.iPdpAddress.Copy(KPdpAdd);
       
  5195     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);
       
  5196     // for the first ExpectL    
       
  5197     TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(contextConfig, contextId);
       
  5198     expExpect.SerialiseL(expectData);
       
  5199     
       
  5200     RPacketContext::TContextConfigR99_R4 contextConfig2;
       
  5201     TPckg<RPacketContext::TContextConfigR99_R4> pckgConfig2(contextConfig2);
       
  5202     // for the second ExpectL
       
  5203     TMockLtsyData2<RPacketContext::TContextConfigR99_R4, TInfoName > expExpect2(contextConfig2, contextId2);
       
  5204     expExpect2.SerialiseL(expectData2);
       
  5205     
       
  5206     // for the first ComleteL
       
  5207     TMockLtsyData1< TInfoName > ltsyData(contextId);
       
  5208     ltsyData.SerialiseL(data);
       
  5209     
       
  5210     // for the second ComleteL
       
  5211     TMockLtsyData1< TInfoName > ltsyData2(contextId2);
       
  5212     ltsyData2.SerialiseL(data2);    
       
  5213 
       
  5214     TRequestStatus  requestStatus;    
       
  5215     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  5216     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data, 10);
       
  5217 
       
  5218     TRequestStatus  requestStatus2;    
       
  5219     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData2);
       
  5220     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data2, 10);
       
  5221 
       
  5222     packetContext.SetConfig(requestStatus, pckgConfig);
       
  5223     packetContext2.SetConfig(requestStatus2, pckgConfig2);
       
  5224     
       
  5225     User::WaitForRequest(requestStatus);
       
  5226     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5227     User::WaitForRequest(requestStatus2);
       
  5228     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  5229 
       
  5230     User::WaitForRequest(mockLtsyStatus);
       
  5231 
       
  5232     // packetContext, packetService, packetContext2, packetService2
       
  5233     //one2, telServer2, data2,
       
  5234     CleanupStack::PopAndDestroy(2); //expectData2, expectData
       
  5235     CleanupStack::PopAndDestroy(9, this); // data, this
       
  5236 
       
  5237     }
       
  5238 
       
  5239 
       
  5240 /**
       
  5241 @SYMTestCaseID BA-CTSY-PKTC-PCSC-0005
       
  5242 @SYMComponent  telephony_ctsy
       
  5243 @SYMTestCaseDesc Test support in CTSY for RPacketContext::SetConfig with timeout
       
  5244 @SYMTestPriority High
       
  5245 @SYMTestActions Invokes RPacketContext::SetConfig and tests for timeout
       
  5246 @SYMTestExpectedResults Pass
       
  5247 @SYMTestType CT
       
  5248 */
       
  5249 void CCTsyPacketContextFU::TestSetConfig0005L()
       
  5250     {
       
  5251     
       
  5252     OpenEtelServerL(EUseExtendedError);
       
  5253     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5254     OpenPhoneL();
       
  5255 
       
  5256     RBuf8 data;
       
  5257     CleanupClosePushL(data);
       
  5258     
       
  5259     RBuf8 expectData;
       
  5260     CleanupClosePushL(expectData);
       
  5261 
       
  5262     //-------------------------------------------------------------------------
       
  5263     // Test A: Test timeout of RPacketContext::SetConfig
       
  5264     //-------------------------------------------------------------------------
       
  5265 
       
  5266     RPacketService packetService;
       
  5267     OpenPacketServiceL(packetService);
       
  5268     CleanupClosePushL(packetService);
       
  5269     
       
  5270     TInfoName contextId;  
       
  5271     RPacketContext packetContext;
       
  5272     packetContext.OpenNewContext(packetService, contextId);
       
  5273     CleanupClosePushL(packetContext);
       
  5274     
       
  5275     // initialisation of the first context 
       
  5276     TInt status = InitContextL(packetContext, contextId);
       
  5277     ASSERT_EQUALS(KErrNone, status);
       
  5278 
       
  5279     RPacketContext::TContextConfigGPRS contextConfig;
       
  5280     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);    
       
  5281     TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(contextConfig, contextId);
       
  5282     expExpect.SerialiseL(expectData);
       
  5283 
       
  5284     TRequestStatus requestStatus;
       
  5285     
       
  5286     TMockLtsyData1<TInfoName > contexName(contextId);
       
  5287     contexName.SerialiseL(data);
       
  5288     
       
  5289     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  5290     
       
  5291     packetContext.SetConfig(requestStatus, pckgConfig);
       
  5292 
       
  5293     User::WaitForRequest(requestStatus);
       
  5294     
       
  5295     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  5296     AssertMockLtsyStatusL();
       
  5297     
       
  5298     
       
  5299     CleanupStack::PopAndDestroy(2); //packetContext packetService, 
       
  5300     CleanupStack::PopAndDestroy(3, this); // data, expectData, this
       
  5301 
       
  5302     }
       
  5303 
       
  5304 
       
  5305 #ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
  5306 
       
  5307 /**
       
  5308 @SYMTestCaseID BA-CTSY-PKTC-PCGCI-0001
       
  5309 @SYMComponent  telephony_ctsy
       
  5310 @SYMTestCaseDesc Test support in CTSY for RPacketContext::GetConnectionInfo
       
  5311 @SYMTestPriority High
       
  5312 @SYMTestActions Invokes requests to RPacketContext::GetConnectionInfo
       
  5313 @SYMTestExpectedResults Pass
       
  5314 @SYMTestType CT
       
  5315 */
       
  5316 void CCTsyPacketContextFU::TestGetConnectionInfo0001L()
       
  5317 	{					
       
  5318 	OpenEtelServerL(EUseExtendedError);
       
  5319 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5320 	OpenPhoneL();
       
  5321 
       
  5322 	RBuf8 data;
       
  5323 	CleanupClosePushL(data);
       
  5324 	
       
  5325 	RPacketService packetService;
       
  5326 	OpenPacketServiceL(packetService);
       
  5327 	CleanupClosePushL(packetService);
       
  5328 	
       
  5329 	TInfoName contextId;	
       
  5330 	RPacketContext packetContext;
       
  5331 	packetContext.OpenNewContext(packetService, contextId);
       
  5332 	CleanupClosePushL(packetContext);
       
  5333 	
       
  5334 	TRequestStatus mockLtsyStatus;	
       
  5335     TRequestStatus requestStatus;
       
  5336 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1;
       
  5337 	RPacketContext::TConnectionInfoV1 respConnectionInfoV1;
       
  5338 	
       
  5339  	//-------------------------------------------------------------------------
       
  5340 	// TEST A1: Successful completion of RPacketContext::GetConnectionInfo
       
  5341 	// request.
       
  5342  	//-------------------------------------------------------------------------
       
  5343  	
       
  5344 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1(reqConnectionInfoV1); 
       
  5345 	    	
       
  5346 	//Get connection info
       
  5347 	packetContext.GetConnectionInfo(requestStatus, pckgReqConnectionInfoV1);	
       
  5348 	User::WaitForRequest(requestStatus);	
       
  5349 	AssertMockLtsyStatusL();
       
  5350 	
       
  5351 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 	
       
  5352 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1.ExtensionId());
       
  5353 	ASSERT_EQUALS((TUint32)0,                                     reqConnectionInfoV1.iValid);
       
  5354 
       
  5355  	//-------------------------------------------------------------------------
       
  5356 	// TEST A2: Successful completion of RPacketContext::GetConnectionInfo
       
  5357 	// request where RPacketContext::TConnectionInfoV1 parameter contains 
       
  5358 	// valid data.
       
  5359  	//-------------------------------------------------------------------------
       
  5360 	
       
  5361 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5362 	
       
  5363 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory;
       
  5364 	respConnectionInfoV1.iHSDPACategory = 5;
       
  5365 	respConnectionInfoV1.iValid |= RPacketContext::KHSUPACategory;
       
  5366 	respConnectionInfoV1.iHSUPACategory = 6;	    	
       
  5367 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData(contextId, respConnectionInfoV1);
       
  5368 	ltsyData.SerialiseL(data);
       
  5369 	
       
  5370 	// Change connection information
       
  5371 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5372 	User::WaitForRequest(mockLtsyStatus);
       
  5373 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5374 
       
  5375 	//Get connection info
       
  5376 	packetContext.GetConnectionInfo(requestStatus, pckgReqConnectionInfoV1);
       
  5377 	User::WaitForRequest(requestStatus);	
       
  5378 	AssertMockLtsyStatusL();
       
  5379 	
       
  5380 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 	
       
  5381 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1.ExtensionId());
       
  5382 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1.iValid);
       
  5383 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1.iHSDPACategory);
       
  5384 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1.iHSUPACategory);
       
  5385 	
       
  5386     CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data, this	
       
  5387     }
       
  5388 
       
  5389 /**
       
  5390 @SYMTestCaseID BA-CTSY-PKTC-PCGCI-0002
       
  5391 @SYMComponent  telephony_ctsy
       
  5392 @SYMTestCaseDesc Test support in CTSY for canceling RPacketContext::GetConnectionInfo 
       
  5393 @SYMTestPriority High
       
  5394 @SYMTestActions Invokes RPacketContext::GetConnectionInfo cancel request
       
  5395 @SYMTestExpectedResults Pass
       
  5396 @SYMTestType CT
       
  5397 */
       
  5398 void CCTsyPacketContextFU::TestGetConnectionInfo0002L()
       
  5399 	{					
       
  5400 	OpenEtelServerL(EUseExtendedError);
       
  5401 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5402 	OpenPhoneL();
       
  5403 	
       
  5404 	RPacketService packetService;
       
  5405 	OpenPacketServiceL(packetService);
       
  5406 	CleanupClosePushL(packetService);
       
  5407 	
       
  5408 	TInfoName contextId;	
       
  5409 	RPacketContext packetContext;
       
  5410 	packetContext.OpenNewContext(packetService, contextId);
       
  5411 	CleanupClosePushL(packetContext);
       
  5412 	
       
  5413 	TRequestStatus mockLtsyStatus;	
       
  5414     TRequestStatus requestStatus;
       
  5415 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1;
       
  5416 	RPacketContext::TConnectionInfoV1 respConnectionInfoV1;
       
  5417 	
       
  5418  	//-------------------------------------------------------------------------
       
  5419 	// TEST A1: Cancel RPacketContext::GetConnectionInfo request 
       
  5420 	// successfully.
       
  5421  	//-------------------------------------------------------------------------
       
  5422  	
       
  5423 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1(reqConnectionInfoV1); 
       
  5424 	    	
       
  5425 	//Get connection info
       
  5426 	packetContext.GetConnectionInfo(requestStatus, pckgReqConnectionInfoV1);
       
  5427 	
       
  5428 	//Cancel connection info request
       
  5429 	packetContext.CancelAsyncRequest(EPacketContextGetConnectionInfo);	
       
  5430 	
       
  5431 	User::WaitForRequest(requestStatus);	
       
  5432 	AssertMockLtsyStatusL();
       
  5433 	
       
  5434 	//requestStatus should be KErrNone if CTSY completed GetConnectionInfo() 
       
  5435 	//request before cancel request arrived. requestStatus should be KErrCancel 
       
  5436 	//if CTSY received cancel request before before GetConnectionInfo() request
       
  5437 	//was completed.
       
  5438 	if ( !( requestStatus.Int() == KErrNone ||  
       
  5439 	        requestStatus.Int() == KErrCancel ) )
       
  5440 		{
       
  5441 		//Wrong error value. Check fails here.
       
  5442 		ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  5443 		}
       
  5444 	
       
  5445     CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this	
       
  5446     }
       
  5447 
       
  5448 /**
       
  5449 @SYMTestCaseID BA-CTSY-PKTC-PCGCI-0004
       
  5450 @SYMComponent  telephony_ctsy
       
  5451 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::GetConnectionInfo
       
  5452 @SYMTestPriority High
       
  5453 @SYMTestActions Invokes multiple client requests to RPacketContext::GetConnectionInfo
       
  5454 @SYMTestExpectedResults Pass
       
  5455 @SYMTestType CT
       
  5456 */
       
  5457 void CCTsyPacketContextFU::TestGetConnectionInfo0004L()
       
  5458 	{
       
  5459 	OpenEtelServerL(EUseExtendedError);
       
  5460 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5461 	OpenPhoneL();
       
  5462 
       
  5463 	RBuf8 data;
       
  5464 	CleanupClosePushL(data);
       
  5465 	
       
  5466 	RPacketService packetService;
       
  5467 	OpenPacketServiceL(packetService);
       
  5468 	CleanupClosePushL(packetService);
       
  5469 	
       
  5470 	TInfoName contextId;	
       
  5471 	RPacketContext packetContext;
       
  5472 	packetContext.OpenNewContext(packetService, contextId);
       
  5473 	CleanupClosePushL(packetContext);
       
  5474 	
       
  5475 	TRequestStatus mockLtsyStatus;	
       
  5476     TRequestStatus requestStatus1;
       
  5477     TRequestStatus requestStatus2;
       
  5478     
       
  5479 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1_1;
       
  5480 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1_2;
       
  5481 	RPacketContext::TConnectionInfoV1 respConnectionInfoV1;
       
  5482 	
       
  5483 	//-------------------------------------------------------------------------
       
  5484 	// TEST A1: Successful completion of RPacketContext::GetConnectionInfo
       
  5485 	// request.
       
  5486  	//-------------------------------------------------------------------------
       
  5487  	
       
  5488 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1_1(reqConnectionInfoV1_1);
       
  5489 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1_2(reqConnectionInfoV1_2);
       
  5490 	    	
       
  5491 	//Get connection info
       
  5492 	packetContext.GetConnectionInfo(requestStatus1, pckgReqConnectionInfoV1_1);
       
  5493 	packetContext.GetConnectionInfo(requestStatus2, pckgReqConnectionInfoV1_2);
       
  5494 		
       
  5495 	User::WaitForRequest(requestStatus1);
       
  5496 	User::WaitForRequest(requestStatus2);	
       
  5497 	AssertMockLtsyStatusL();
       
  5498 	
       
  5499 	//Check results
       
  5500 	ASSERT_EQUALS(KErrNone, requestStatus1.Int()); 	
       
  5501 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1_1.ExtensionId());
       
  5502 	ASSERT_EQUALS((TUint32)0,                                     reqConnectionInfoV1_1.iValid);
       
  5503 	ASSERT_EQUALS(KErrNone, requestStatus2.Int()); 	
       
  5504 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1_2.ExtensionId());
       
  5505 	ASSERT_EQUALS((TUint32)0,                                     reqConnectionInfoV1_2.iValid);
       
  5506 	
       
  5507 	//-------------------------------------------------------------------------
       
  5508 	// TEST A2: Successful completion of RPacketContext::GetConnectionInfo
       
  5509 	// request where RPacketContext::TConnectionInfoV1 parameter contains 
       
  5510 	// valid data.
       
  5511  	//-------------------------------------------------------------------------
       
  5512  	
       
  5513  	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5514 	
       
  5515 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory;
       
  5516 	respConnectionInfoV1.iHSDPACategory = 5;
       
  5517 	respConnectionInfoV1.iValid |= RPacketContext::KHSUPACategory;
       
  5518 	respConnectionInfoV1.iHSUPACategory = 6;	    	
       
  5519 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData(contextId, respConnectionInfoV1);
       
  5520 	ltsyData.SerialiseL(data);
       
  5521 	
       
  5522 	// Change connection information
       
  5523 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5524 	User::WaitForRequest(mockLtsyStatus);
       
  5525 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5526  	
       
  5527  	//Get connection info
       
  5528 	packetContext.GetConnectionInfo(requestStatus1, pckgReqConnectionInfoV1_1);
       
  5529 	packetContext.GetConnectionInfo(requestStatus2, pckgReqConnectionInfoV1_2);
       
  5530 	
       
  5531 	User::WaitForRequest(requestStatus1);
       
  5532 	User::WaitForRequest(requestStatus2);
       
  5533 	AssertMockLtsyStatusL();
       
  5534 	
       
  5535 	//Check results
       
  5536 	ASSERT_EQUALS(KErrNone, requestStatus1.Int()); 	
       
  5537 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1_1.ExtensionId());
       
  5538 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_1.iValid);
       
  5539 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1_1.iHSDPACategory);
       
  5540 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_1.iHSUPACategory);
       
  5541  	ASSERT_EQUALS(KErrNone, requestStatus2.Int()); 	
       
  5542 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1_2.ExtensionId());
       
  5543 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_2.iValid);
       
  5544 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1_2.iHSDPACategory);
       
  5545 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_2.iHSUPACategory);
       
  5546 	
       
  5547 	CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data
       
  5548 	}
       
  5549 	
       
  5550 /**
       
  5551 @SYMTestCaseID BA-CTSY-PKTC-PCNCIC-0001
       
  5552 @SYMComponent  telephony_ctsy
       
  5553 @SYMTestCaseDesc Test support in CTSY for RPacketContext::NotifyConnectionInfoChange
       
  5554 @SYMTestPriority High
       
  5555 @SYMTestActions Invokes requests to RPacketContext::NotifyConnectionInfoChange
       
  5556 @SYMTestExpectedResults Pass
       
  5557 @SYMTestType CT
       
  5558 */
       
  5559 void CCTsyPacketContextFU::TestNotifyConnectionInfoChange0001L()
       
  5560 	{
       
  5561 	INFO_PRINTF1(_L("Testing notification of change in TConnectionInfoV1.iValid .."));
       
  5562 	TestNotifyConnectionInfoChange0001_workerL(ETrue,EFalse,EFalse);
       
  5563 	INFO_PRINTF1(_L("Testing notification of change in TConnectionInfoV1.iHSDPACategory .."));
       
  5564 	TestNotifyConnectionInfoChange0001_workerL(EFalse,ETrue,EFalse);
       
  5565 	INFO_PRINTF1(_L("Testing notification of change in TConnectionInfoV1.iHSUPACategory .."));
       
  5566 	TestNotifyConnectionInfoChange0001_workerL(EFalse,EFalse,ETrue);
       
  5567 	INFO_PRINTF1(_L("Testing that no change leads to no notification .."));
       
  5568 	TestNotifyConnectionInfoChange0001_workerL(ETrue,ETrue,ETrue,ETrue);
       
  5569 	INFO_PRINTF1(_L(" All ok!"));
       
  5570 	}
       
  5571 
       
  5572 
       
  5573 void CCTsyPacketContextFU::TestNotifyConnectionInfoChange0001_workerL(TBool aChangeValid,TBool aChangeHSDPACategory,TBool aChangeHSUPACategory,TBool aResendFirst)
       
  5574 	{
       
  5575 	OpenEtelServerL(EUseExtendedError);
       
  5576 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5577 	OpenPhoneL();
       
  5578 
       
  5579 	RBuf8 data;
       
  5580 	CleanupClosePushL(data);
       
  5581 	
       
  5582 	RPacketService packetService;
       
  5583 	OpenPacketServiceL(packetService);
       
  5584 	CleanupClosePushL(packetService);
       
  5585 	
       
  5586 	TInfoName contextId;
       
  5587 	RPacketContext packetContext;
       
  5588 	packetContext.OpenNewContext(packetService, contextId);
       
  5589 	CleanupClosePushL(packetContext);
       
  5590 	
       
  5591 	TRequestStatus mockLtsyStatus;
       
  5592     TRequestStatus requestStatus;
       
  5593 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1;
       
  5594 	RPacketContext::TConnectionInfoV1 respConnectionInfoV1;
       
  5595 	
       
  5596  	//-------------------------------------------------------------------------
       
  5597 	// TEST A1: Successful completion of
       
  5598 	// RPacketContext::NotifyConnectionInfoChange request.
       
  5599  	//-------------------------------------------------------------------------
       
  5600  	
       
  5601 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5602  	
       
  5603 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1(reqConnectionInfoV1); 
       
  5604 	    	
       
  5605 	//Make NotifyConnectionInfoChange request
       
  5606 	packetContext.NotifyConnectionInfoChange(requestStatus, pckgReqConnectionInfoV1);
       
  5607 
       
  5608 	//Send response via MockLTSY
       
  5609 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory;
       
  5610 	respConnectionInfoV1.iHSDPACategory = 1;
       
  5611 	respConnectionInfoV1.iHSUPACategory = 0;
       
  5612 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData1(contextId, respConnectionInfoV1);
       
  5613 	ltsyData1.SerialiseL(data);
       
  5614 	
       
  5615 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5616 	User::WaitForRequest(mockLtsyStatus);
       
  5617 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5618 	
       
  5619 	//NotifyConnectionInfoChange request is completed to test client
       
  5620 	User::WaitForRequest(requestStatus);
       
  5621 	AssertMockLtsyStatusL();
       
  5622 	
       
  5623 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5624 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1.ExtensionId());
       
  5625 	ASSERT_EQUALS(respConnectionInfoV1.iValid,			reqConnectionInfoV1.iValid);
       
  5626 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,	reqConnectionInfoV1.iHSDPACategory);
       
  5627 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,	reqConnectionInfoV1.iHSUPACategory);
       
  5628 	
       
  5629 	
       
  5630 	// special case to ensure no notification occurs when same data is received twice
       
  5631 	if(aResendFirst)
       
  5632 		{
       
  5633 		iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5634 		iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5635 		User::WaitForRequest(mockLtsyStatus);
       
  5636 		ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());		
       
  5637 		}
       
  5638 	
       
  5639  	//-------------------------------------------------------------------------
       
  5640 	// TEST A2: Successful completion of
       
  5641 	// RPacketContext::NotifyConnectionInfoChange request where
       
  5642 	// RPacketContext::TConnectionInfoV1 parameter data changes.
       
  5643  	//-------------------------------------------------------------------------
       
  5644 	
       
  5645 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5646 	
       
  5647 	//Make NotifyConnectionInfoChange request
       
  5648 	packetContext.NotifyConnectionInfoChange(requestStatus, pckgReqConnectionInfoV1);
       
  5649 	
       
  5650 	//Send response via MockLTSY
       
  5651 	respConnectionInfoV1.iValid = aChangeValid ? (RPacketContext::KHSDPACategory | RPacketContext::KHSUPACategory) : RPacketContext::KHSDPACategory ;
       
  5652 	respConnectionInfoV1.iHSDPACategory = aChangeHSDPACategory ? 5 : 1;
       
  5653 	respConnectionInfoV1.iHSUPACategory = aChangeHSUPACategory ? 6 : 0;
       
  5654 	
       
  5655 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData2(contextId, respConnectionInfoV1);
       
  5656 	data.Close();
       
  5657 	ltsyData2.SerialiseL(data);
       
  5658 	
       
  5659 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5660 	User::WaitForRequest(mockLtsyStatus);
       
  5661 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5662 
       
  5663 	//NotifyConnectionInfoChange request is completed to test client
       
  5664 	User::WaitForRequest(requestStatus);
       
  5665 	AssertMockLtsyStatusL();
       
  5666 	
       
  5667 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5668 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1.ExtensionId());
       
  5669 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1.iValid);
       
  5670 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1.iHSDPACategory);
       
  5671 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1.iHSUPACategory);
       
  5672 	
       
  5673     CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data, this
       
  5674     }
       
  5675 
       
  5676 /**
       
  5677 @SYMTestCaseID BA-CTSY-PKTC-PCNCIC-0002
       
  5678 @SYMComponent  telephony_ctsy
       
  5679 @SYMTestCaseDesc Test support in CTSY for cancel RPacketContext::NotifyConnectionInfoChange request
       
  5680 @SYMTestPriority High
       
  5681 @SYMTestActions Invokes cancel RPacketContext::NotifyConnectionInfoChange request
       
  5682 @SYMTestExpectedResults Pass
       
  5683 @SYMTestType CT
       
  5684 */
       
  5685 void CCTsyPacketContextFU::TestNotifyConnectionInfoChange0002L()
       
  5686 	{
       
  5687 	OpenEtelServerL(EUseExtendedError);
       
  5688 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5689 	OpenPhoneL();
       
  5690 	
       
  5691 	RBuf8 data;
       
  5692 	CleanupClosePushL(data);	
       
  5693 	
       
  5694 	RPacketService packetService;
       
  5695 	OpenPacketServiceL(packetService);
       
  5696 	CleanupClosePushL(packetService);
       
  5697 	
       
  5698 	TInfoName contextId;	
       
  5699 	RPacketContext packetContext;
       
  5700 	packetContext.OpenNewContext(packetService, contextId);
       
  5701 	CleanupClosePushL(packetContext);
       
  5702 		
       
  5703 	TRequestStatus mockLtsyStatus;	
       
  5704     TRequestStatus requestStatus;
       
  5705 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1;
       
  5706 	RPacketContext::TConnectionInfoV1 respConnectionInfoV1;
       
  5707 	
       
  5708  	//-------------------------------------------------------------------------
       
  5709 	// TEST A1: RPacketContext::NotifyConnectionInfoChange request can be
       
  5710 	// cancelled successfully. 
       
  5711  	//-------------------------------------------------------------------------	
       
  5712  	
       
  5713 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1(reqConnectionInfoV1); 
       
  5714 	    	
       
  5715 	//Make NotifyConnectionInfoChange request
       
  5716 	packetContext.NotifyConnectionInfoChange(requestStatus, pckgReqConnectionInfoV1);
       
  5717 
       
  5718 	User::After( 1000 );
       
  5719 	
       
  5720 	//Cancel NotifyConnectionInfoChange request	
       
  5721 	packetContext.CancelAsyncRequest(EPacketContextNotifyConnectionInfoChange);
       
  5722 	
       
  5723 	//NotifyConnectionInfoChange request is completed to test client	
       
  5724 	User::WaitForRequest(requestStatus);	
       
  5725 	AssertMockLtsyStatusL();
       
  5726 	
       
  5727 	ASSERT_EQUALS(KErrCancel, requestStatus.Int()); 
       
  5728 	
       
  5729  	//-------------------------------------------------------------------------
       
  5730 	// TEST A2: RPacketContext::NotifyConnectionInfoChange request can be
       
  5731 	// made again after cancelled. 
       
  5732  	//-------------------------------------------------------------------------		
       
  5733 
       
  5734 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 	
       
  5735 	    	
       
  5736 	//Send response via MockLTSY. Nothing should happen because 
       
  5737 	//NotifyConnectionInfoChange request has been cancelled.
       
  5738 	respConnectionInfoV1.iHSDPACategory = 2;
       
  5739 	respConnectionInfoV1.iHSUPACategory = 3;
       
  5740 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory | RPacketContext::KHSUPACategory;
       
  5741 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData(contextId, respConnectionInfoV1);
       
  5742 	ltsyData.SerialiseL(data);
       
  5743 	
       
  5744 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5745 	User::WaitForRequest(mockLtsyStatus);
       
  5746 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  5747 	
       
  5748 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  5749 		
       
  5750 	respConnectionInfoV1.iHSDPACategory = 3;
       
  5751 	respConnectionInfoV1.iHSUPACategory = 4;
       
  5752 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory | RPacketContext::KHSUPACategory;
       
  5753 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyDat2(contextId, respConnectionInfoV1);
       
  5754 	ltsyData.SerialiseL(data);
       
  5755 	
       
  5756 	//Make NotifyConnectionInfoChange request
       
  5757 	packetContext.NotifyConnectionInfoChange(requestStatus, pckgReqConnectionInfoV1);
       
  5758 	
       
  5759 	//Send response again via MockLTSY	
       
  5760 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5761 	User::WaitForRequest(mockLtsyStatus);
       
  5762 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());		
       
  5763 	
       
  5764 	//NotifyConnectionInfoChange request is completed to test client	
       
  5765 	User::WaitForRequest(requestStatus);	
       
  5766 	AssertMockLtsyStatusL();
       
  5767 	
       
  5768 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 	
       
  5769 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1.ExtensionId());
       
  5770 	ASSERT_EQUALS(respConnectionInfoV1.iValid,       			  reqConnectionInfoV1.iValid);
       
  5771 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,       	  reqConnectionInfoV1.iHSDPACategory);
       
  5772 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,       	  reqConnectionInfoV1.iHSUPACategory);	
       
  5773 
       
  5774     CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data, this
       
  5775 	}
       
  5776 
       
  5777 /**
       
  5778 @SYMTestCaseID BA-CTSY-PKTC-PCNCIC-0004
       
  5779 @SYMComponent  telephony_ctsy
       
  5780 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketContext::NotifyConnectionInfoChange
       
  5781 @SYMTestPriority High
       
  5782 @SYMTestActions Invokes multiple client requests to RPacketContext::NotifyConnectionInfoChange
       
  5783 @SYMTestExpectedResults Pass
       
  5784 @SYMTestType CT
       
  5785 */
       
  5786 void CCTsyPacketContextFU::TestNotifyConnectionInfoChange0004L()
       
  5787 	{	
       
  5788 	OpenEtelServerL(EUseExtendedError);
       
  5789 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5790 	OpenPhoneL();
       
  5791 
       
  5792 	RBuf8 data;
       
  5793 	CleanupClosePushL(data);
       
  5794 	
       
  5795 	//Open new context
       
  5796 	RPacketService packetService1;
       
  5797 	OpenPacketServiceL(packetService1);
       
  5798 	CleanupClosePushL(packetService1);
       
  5799 	
       
  5800 	TInfoName contextId;	
       
  5801 	RPacketContext packetContext1;
       
  5802 	packetContext1.OpenNewContext(packetService1, contextId);
       
  5803 	CleanupClosePushL(packetContext1);	
       
  5804 	
       
  5805 	// Open second client and existing context
       
  5806 	RTelServer telServer2;
       
  5807 	TInt ret = telServer2.Connect();
       
  5808 	ASSERT_EQUALS(KErrNone, ret);
       
  5809 	CleanupClosePushL(telServer2);
       
  5810 	
       
  5811 	RMobilePhone phone2;
       
  5812 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  5813 	ASSERT_EQUALS(KErrNone, ret);
       
  5814 	CleanupClosePushL(phone2);	
       
  5815 	
       
  5816 	RPacketService packetService2;                
       
  5817 	ret = packetService2.Open(phone2);
       
  5818 	ASSERT_EQUALS(KErrNone, ret);
       
  5819 	CleanupClosePushL(packetService2);	
       
  5820 	
       
  5821 	RPacketContext packetContext2;
       
  5822     ret = packetContext2.OpenExistingContext(packetService2, contextId);
       
  5823 	ASSERT_EQUALS(KErrNone, ret);
       
  5824 	CleanupClosePushL(packetContext2);    		
       
  5825 	
       
  5826 	//Open third client and new context
       
  5827 	RTelServer telServer3;
       
  5828 	ret = telServer3.Connect();
       
  5829 	ASSERT_EQUALS(KErrNone, ret);
       
  5830 	CleanupClosePushL(telServer3);
       
  5831 	
       
  5832 	RMobilePhone phone3;
       
  5833 	ret = phone3.Open(telServer3,KMmTsyPhoneName);
       
  5834 	ASSERT_EQUALS(KErrNone, ret);
       
  5835 	CleanupClosePushL(phone3);	
       
  5836 	
       
  5837 	RPacketService packetService3;                
       
  5838 	ret = packetService3.Open(phone3);
       
  5839 	ASSERT_EQUALS(KErrNone, ret);
       
  5840 	CleanupClosePushL(packetService3);	
       
  5841 	
       
  5842 	TInfoName contextId2;	
       
  5843 	RPacketContext packetContext3;
       
  5844 	packetContext3.OpenNewContext(packetService3, contextId2);
       
  5845 	CleanupClosePushL(packetContext3);	
       
  5846 	
       
  5847 	TRequestStatus mockLtsyStatus;	
       
  5848     TRequestStatus requestStatus1;
       
  5849     TRequestStatus requestStatus2;
       
  5850     TRequestStatus requestStatus3;
       
  5851 	RPacketContext::TConnectionInfoV1 respConnectionInfoV1;    
       
  5852 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1_1;
       
  5853 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1_1(reqConnectionInfoV1_1); 	
       
  5854 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1_2;
       
  5855 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1_2(reqConnectionInfoV1_2); 	
       
  5856 	RPacketContext::TConnectionInfoV1 reqConnectionInfoV1_3;
       
  5857 	TPckg<RPacketContext::TConnectionInfoV1> pckgReqConnectionInfoV1_3(reqConnectionInfoV1_3); 	
       
  5858 	
       
  5859  	//-------------------------------------------------------------------------
       
  5860 	// TEST A1: Successful completion of 
       
  5861 	// RPacketContext::NotifyConnectionInfoChange request for multible clients.
       
  5862  	//-------------------------------------------------------------------------
       
  5863  	
       
  5864 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 	
       
  5865 	    	
       
  5866 	//Make NotifyConnectionInfoChange requests
       
  5867 	packetContext1.NotifyConnectionInfoChange(requestStatus1, pckgReqConnectionInfoV1_1);
       
  5868 	packetContext2.NotifyConnectionInfoChange(requestStatus2, pckgReqConnectionInfoV1_2);
       
  5869 	packetContext3.NotifyConnectionInfoChange(requestStatus3, pckgReqConnectionInfoV1_3);		
       
  5870 
       
  5871 	//Send response via MockLTSY to first packet context
       
  5872 	respConnectionInfoV1.iHSDPACategory = 2;
       
  5873 	respConnectionInfoV1.iHSUPACategory = 3;
       
  5874 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory | RPacketContext::KHSUPACategory;
       
  5875 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData1(contextId, respConnectionInfoV1);
       
  5876 	ltsyData1.SerialiseL(data);
       
  5877 	
       
  5878 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5879 	User::WaitForRequest(mockLtsyStatus);
       
  5880 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  5881 	
       
  5882 	//NotifyConnectionInfoChange request is completed to the test clients 1 & 2
       
  5883 	User::WaitForRequest(requestStatus1);
       
  5884 	User::WaitForRequest(requestStatus2);		
       
  5885 	AssertMockLtsyStatusL();
       
  5886 	
       
  5887 	ASSERT_EQUALS(KErrNone, requestStatus1.Int()); 	
       
  5888 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1_1.ExtensionId());
       
  5889 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_1.iValid);
       
  5890 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,	reqConnectionInfoV1_1.iHSDPACategory);
       
  5891 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_1.iHSUPACategory);
       
  5892 
       
  5893 	ASSERT_EQUALS(KErrNone, requestStatus2.Int()); 	
       
  5894 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1_2.ExtensionId());
       
  5895 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_2.iValid);
       
  5896 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,	reqConnectionInfoV1_2.iHSDPACategory);
       
  5897 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_2.iHSUPACategory);
       
  5898 	
       
  5899 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
       
  5900 	
       
  5901 	//Call notification again
       
  5902 	packetContext1.NotifyConnectionInfoChange(requestStatus1, pckgReqConnectionInfoV1_1);
       
  5903 	packetContext2.NotifyConnectionInfoChange(requestStatus2, pckgReqConnectionInfoV1_2);	
       
  5904 
       
  5905 	//Send response via MockLTSY to second packet context
       
  5906 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData2(contextId2, respConnectionInfoV1);
       
  5907 	data.Close();
       
  5908 	ltsyData2.SerialiseL(data);
       
  5909 	
       
  5910 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5911 	User::WaitForRequest(mockLtsyStatus);
       
  5912 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  5913 	
       
  5914 	//NotifyConnectionInfoChange request is completed to the test client 3
       
  5915 	User::WaitForRequest(requestStatus3);		
       
  5916 	AssertMockLtsyStatusL();
       
  5917 	
       
  5918 	ASSERT_EQUALS(KErrNone, requestStatus3.Int()); 	
       
  5919 	ASSERT_EQUALS((TInt)TConnectionInfoBase::KConnectionInfoV1,   reqConnectionInfoV1_3.ExtensionId());
       
  5920 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_3.iValid);
       
  5921 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,	reqConnectionInfoV1_3.iHSDPACategory);
       
  5922 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_3.iHSUPACategory);
       
  5923 	
       
  5924 	//Call notification again
       
  5925 	packetContext3.NotifyConnectionInfoChange(requestStatus3, pckgReqConnectionInfoV1_3);	
       
  5926 	
       
  5927  	//-------------------------------------------------------------------------
       
  5928 	// TEST A2: Successful completion of 
       
  5929 	// RPacketContext::NotifyConnectionInfoChange request for multiple clients. 
       
  5930 	// RPacketContext::TConnectionInfoV1 parameter data changes.
       
  5931  	//-------------------------------------------------------------------------		
       
  5932 
       
  5933 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 		    			
       
  5934 
       
  5935 	//Send response via MockLTSY to first packet context	
       
  5936 	respConnectionInfoV1.iValid = RPacketContext::KHSDPACategory;
       
  5937 	respConnectionInfoV1.iHSDPACategory = 5;
       
  5938 	respConnectionInfoV1.iValid |= RPacketContext::KHSUPACategory;
       
  5939 	respConnectionInfoV1.iHSUPACategory = 6;	    	
       
  5940 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData3(contextId, respConnectionInfoV1);
       
  5941 	data.Close();	
       
  5942 	ltsyData3.SerialiseL(data);
       
  5943 	
       
  5944 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5945 	User::WaitForRequest(mockLtsyStatus);
       
  5946 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5947 			
       
  5948 	//NotifyConnectionInfoChange request is completed to the test clients 1 & 2
       
  5949 	User::WaitForRequest(requestStatus1);
       
  5950 	User::WaitForRequest(requestStatus2);		
       
  5951 	AssertMockLtsyStatusL();
       
  5952 	
       
  5953 	ASSERT_EQUALS(KErrNone, requestStatus1.Int()); 	
       
  5954 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1_1.ExtensionId());
       
  5955 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_1.iValid);
       
  5956 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1_1.iHSDPACategory);
       
  5957 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_1.iHSUPACategory);	
       
  5958 	
       
  5959 	ASSERT_EQUALS(KErrNone, requestStatus2.Int()); 	
       
  5960 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1_2.ExtensionId());
       
  5961 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_2.iValid);
       
  5962 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1_2.iHSDPACategory);
       
  5963 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_2.iHSUPACategory);
       
  5964 	
       
  5965 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5966 		
       
  5967 	//Call notification again
       
  5968 	packetContext1.NotifyConnectionInfoChange(requestStatus1, pckgReqConnectionInfoV1_1);
       
  5969 	packetContext2.NotifyConnectionInfoChange(requestStatus2, pckgReqConnectionInfoV1_2);		
       
  5970 		
       
  5971 	//Send response via MockLTSY to second packet context
       
  5972 	TMockLtsyData2< TInfoName, RPacketContext::TConnectionInfoV1 > ltsyData4(contextId2, respConnectionInfoV1);
       
  5973 	data.Close();	
       
  5974 	ltsyData4.SerialiseL(data);
       
  5975 	
       
  5976 	iMockLTSY.CompleteL(EPacketContextNotifyConnectionInfoChange, KErrNone, data);
       
  5977 	User::WaitForRequest(mockLtsyStatus);
       
  5978 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  5979 	
       
  5980 	//NotifyConnectionInfoChange request is completed to the test client 3	
       
  5981 	User::WaitForRequest(requestStatus3);		
       
  5982 	AssertMockLtsyStatusL();	
       
  5983 	
       
  5984 	ASSERT_EQUALS(KErrNone, requestStatus3.Int()); 	
       
  5985 	ASSERT_EQUALS(respConnectionInfoV1.ExtensionId(),   reqConnectionInfoV1_3.ExtensionId());
       
  5986 	ASSERT_EQUALS(respConnectionInfoV1.iValid,          reqConnectionInfoV1_3.iValid);
       
  5987 	ASSERT_EQUALS(respConnectionInfoV1.iHSDPACategory,  reqConnectionInfoV1_3.iHSDPACategory);
       
  5988 	ASSERT_EQUALS(respConnectionInfoV1.iHSUPACategory,  reqConnectionInfoV1_3.iHSUPACategory);	
       
  5989 	
       
  5990 	CleanupStack::PopAndDestroy(12, this); //packetContext3, packetService3, phone3, telServer3,
       
  5991 									       //packetContext2, packetService2, phone2, telServer2, 
       
  5992 									       //packetContext1, packetService1, data, this			
       
  5993     }
       
  5994 
       
  5995 #endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
       
  5996 
       
  5997 /**
       
  5998 @SYMTestCaseID BA-CTSY-PKTC-PCONSC-0001
       
  5999 @SYMDEF DEF125564
       
  6000 @SYMComponent  telephony_ctsy
       
  6001 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenNewSecondaryContext
       
  6002 @SYMTestPriority High
       
  6003 @SYMTestActions Invokes RPacketContext::OpenNewSecondaryContext
       
  6004 @SYMTestExpectedResults Pass
       
  6005 @SYMTestType CT
       
  6006 */    
       
  6007 void CCTsyPacketContextFU::TestOpenNewSecondaryContext0001L()
       
  6008 	{
       
  6009 	
       
  6010 	OpenEtelServerL(EUseExtendedError);
       
  6011 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6012 	OpenPhoneL();
       
  6013 	
       
  6014 	RBuf8 data;
       
  6015 	CleanupClosePushL(data);
       
  6016 	
       
  6017 	RBuf8 expectData;
       
  6018 	CleanupClosePushL(expectData);
       
  6019 
       
  6020 	RPacketService packetService;
       
  6021     OpenPacketServiceL(packetService);
       
  6022     CleanupClosePushL(packetService);
       
  6023     
       
  6024     TInfoName contextId;  
       
  6025     RPacketContext packetContext;
       
  6026     packetContext.OpenNewContext(packetService, contextId);
       
  6027     CleanupClosePushL(packetContext);
       
  6028     
       
  6029     //-------------------------------------------------------------------------
       
  6030 	// TEST C: Successful completion request of
       
  6031 	// RPacketContext::SetConfig when result is not cached.
       
  6032  	//-------------------------------------------------------------------------
       
  6033 	TInfoName contextIdSecondary;	
       
  6034 	RPacketContext packetContextSecondary;
       
  6035 	TInt err = packetContextSecondary.OpenNewSecondaryContext(packetService, contextId, contextIdSecondary);	
       
  6036 	ASSERT_EQUALS(KErrNone, err);
       
  6037 	CleanupClosePushL(packetContextSecondary);
       
  6038 	
       
  6039     //-------------------------------------------------------------------------
       
  6040 	// Try to Activate SecondaryContext in order to 
       
  6041 	// call CMmPacketQoSGsmWcdmaExt::ProfileAsked()
       
  6042  	//-------------------------------------------------------------------------
       
  6043  	
       
  6044  	// initialisation of the secondary context 
       
  6045 	TInt status = InitContextL(packetContextSecondary, contextIdSecondary, contextId);
       
  6046 	ASSERT_EQUALS(KErrNone, status);
       
  6047 	AssertMockLtsyStatusL();
       
  6048 	
       
  6049 	// create new QoS
       
  6050 	RBuf profileName;
       
  6051 	CleanupClosePushL(profileName);
       
  6052 	RPacketQoS packetQoS;
       
  6053 	packetQoS.OpenNewQoS(packetContextSecondary, profileName);
       
  6054 	CleanupClosePushL(packetQoS);
       
  6055 	
       
  6056  	
       
  6057 	// try to activate SecondaryContext	in order to call CMmPacketQoSGsmWcdmaExt::ProfileAsked()
       
  6058 	TRequestStatus requestStatus;
       
  6059 	packetContextSecondary.Activate(requestStatus);
       
  6060 	User::WaitForRequest(requestStatus);
       
  6061 	AssertMockLtsyStatusL();
       
  6062 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  6063 	AssertMockLtsyStatusL();
       
  6064 	
       
  6065 			
       
  6066 	//-------------------------------------------------------------------------	
       
  6067 	// Try to open too many contexts
       
  6068  	//-------------------------------------------------------------------------	
       
  6069 	RPacketContext newPacketContext[KMmMaxNumberOfContexts - 2];
       
  6070  	for (TInt i = 0; i < KMmMaxNumberOfContexts - 2; i++) // -2 -- because there are already 2 contexts
       
  6071  		{ 		
       
  6072  			TInfoName newContextIdSecondary;
       
  6073  			err = newPacketContext[i].OpenNewSecondaryContext(packetService, contextId, newContextIdSecondary);
       
  6074  			ASSERT_EQUALS(KErrNone, err);
       
  6075     		CleanupClosePushL(newPacketContext[i]);
       
  6076  		}
       
  6077  		
       
  6078  	RPacketContext OneMorePacketContext;
       
  6079  	TInfoName contextIdSecondary1;
       
  6080  	err = OneMorePacketContext.OpenNewSecondaryContext(packetService, contextId, contextIdSecondary1);
       
  6081  	TInt expectedError = ( KErrOverflow & 0x0000FFFF ) |
       
  6082                     	 ( KErrUmtsMaxNumOfContextExceededByPhone << 16 );
       
  6083  	ASSERT_EQUALS(expectedError, err); 	
       
  6084 	
       
  6085 	AssertMockLtsyStatusL();
       
  6086 	CleanupStack::PopAndDestroy( (KMmMaxNumberOfContexts - 2) ); // set of contexts...	
       
  6087 	CleanupStack::PopAndDestroy(8, this); // this...
       
  6088 	}
       
  6089 
       
  6090 /**
       
  6091 @SYMTestCaseID BA-CTSY-PKTC-PCONSC-0001b
       
  6092 @SYMComponent  telephony_ctsy
       
  6093 @SYMTestCaseDesc Test support in CTSY for Activation of RPacketContext::OpenNewSecondaryContext
       
  6094 @SYMTestPriority High
       
  6095 @SYMTestActions Invokes RPacketContext::Activate after RPacketContext::RemovePacketFilter for SecondaryContext
       
  6096 @SYMTestExpectedResults Pass
       
  6097 @SYMTestType CT
       
  6098 */    
       
  6099 void CCTsyPacketContextFU::TestOpenNewSecondaryContext0001bL()
       
  6100 	{
       
  6101 	OpenEtelServerL(EUseExtendedError);
       
  6102     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6103     OpenPhoneL();
       
  6104 
       
  6105     RBuf8 data;
       
  6106     CleanupClosePushL(data);
       
  6107     
       
  6108     RBuf8 expectData;
       
  6109     CleanupClosePushL(expectData);
       
  6110 
       
  6111     RPacketService packetService;
       
  6112     OpenPacketServiceL(packetService);
       
  6113     CleanupClosePushL(packetService);
       
  6114     
       
  6115     // Open new primary packet context
       
  6116     TInfoName contextId;  
       
  6117     RPacketContext packetContext;
       
  6118     packetContext.OpenNewContext(packetService, contextId);
       
  6119     CleanupClosePushL(packetContext);
       
  6120     
       
  6121     // initialisation of the context 
       
  6122  	TInt status = InitContextL(packetContext, contextId);
       
  6123 	ASSERT_EQUALS(KErrNone, status);  
       
  6124  
       
  6125 	// data for SetContext
       
  6126     RPacketContext::TContextConfigGPRS setConfig;
       
  6127      _LIT(KPointName, "Some Name");
       
  6128     setConfig.iAccessPointName.Copy(KPointName);
       
  6129     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(setConfig);    
       
  6130     
       
  6131     TRequestStatus requestStatus;    
       
  6132 
       
  6133     TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(setConfig, contextId);
       
  6134     expExpect.SerialiseL(expectData);
       
  6135     
       
  6136     TMockLtsyData1<TInfoName > contextName(contextId);
       
  6137    	contextName.SerialiseL(data);
       
  6138  	  
       
  6139     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  6140     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  6141 
       
  6142     packetContext.SetConfig(requestStatus, pckgConfig);
       
  6143 
       
  6144     User::WaitForRequest(requestStatus);
       
  6145     AssertMockLtsyStatusL();
       
  6146     ASSERT_EQUALS(KErrNone, requestStatus.Int());  
       
  6147    
       
  6148     TMockLtsyData1 <TInfoName> expData(contextId);
       
  6149 	expData.SerialiseL(expectData);
       
  6150 	
       
  6151 	// Activate this primary context.
       
  6152 	RPacketContext::TContextConfigGPRS contextConfig;
       
  6153 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigGPRS > ltsyData1(contextId, contextConfig);
       
  6154 	ltsyData1.SerialiseL(data);
       
  6155 	iMockLTSY.ExpectL(EPacketContextActivate, expectData);
       
  6156 	iMockLTSY.CompleteL(EPacketContextActivate, KErrNone, data);
       
  6157 		
       
  6158 	packetContext.Activate(requestStatus);
       
  6159 	User::WaitForRequest(requestStatus);
       
  6160 	AssertMockLtsyStatusL();
       
  6161 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  6162     
       
  6163    	// Open new secondary context
       
  6164 	TInfoName contextIdSecondary;	
       
  6165 	RPacketContext packetContextSecondary;
       
  6166 	TInt err = packetContextSecondary.OpenNewSecondaryContext(packetService, contextId, contextIdSecondary);
       
  6167  	ASSERT_EQUALS(KErrNone, err);	
       
  6168 	CleanupClosePushL(packetContextSecondary);
       
  6169 	
       
  6170    	// initialisation of the secondary context 
       
  6171 	status = InitContextL(packetContextSecondary, contextIdSecondary, contextId);
       
  6172 	ASSERT_EQUALS(KErrNone, status);
       
  6173 	AssertMockLtsyStatusL();
       
  6174 	
       
  6175 	// Add filter
       
  6176 	RPacketContext::TPacketFilterV2 filter;
       
  6177 	filter.iId = 1;
       
  6178 	RPacketContext::TPacketFilterV2Pckg filterPckg (filter);
       
  6179 	err = AddContextPacketFilterL(packetContextSecondary, contextIdSecondary,filter);// ETrue means that this request doesn't reache LTSY
       
  6180 	ASSERT_EQUALS(KErrNone, err);
       
  6181 	AssertMockLtsyStatusL();	
       
  6182 	
       
  6183 	// set context Active
       
  6184 	SetContextActiveL(contextIdSecondary);
       
  6185 	AssertMockLtsyStatusL();
       
  6186 	
       
  6187 	// Open and set QoS profile
       
  6188 	RPacketQoS packetQoSSecondary;
       
  6189 	RPacketQoS::TQoSGPRSRequested secondaryRequested;
       
  6190 	err = CreateQoSAndSetProfileParamLC(packetQoSSecondary, packetContextSecondary,
       
  6191 											 contextIdSecondary, secondaryRequested, contextId);// contextId -- is name of "primary" context
       
  6192 	ASSERT_EQUALS(KErrNone, err);
       
  6193 	AssertMockLtsyStatusL();
       
  6194 
       
  6195 	// Remove the already added packet filter
       
  6196 	TInt filterId = 1;
       
  6197 	packetContextSecondary.RemovePacketFilter(requestStatus, filterId);
       
  6198 	User::WaitForRequest(requestStatus);
       
  6199 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  6200 	AssertMockLtsyStatusL();		
       
  6201 	
       
  6202 	// Activate the secondary context
       
  6203 				
       
  6204 	packetContextSecondary.Activate(requestStatus);
       
  6205 	User::WaitForRequest(requestStatus);
       
  6206 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  6207 	
       
  6208 	CleanupStack::PopAndDestroy(7, this);
       
  6209 	
       
  6210 	}
       
  6211 
       
  6212 
       
  6213 /**
       
  6214 @SYMTestCaseID BA-CTSY-PKTC-PCONSC-0003
       
  6215 @SYMComponent  telephony_ctsy
       
  6216 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenNewSecondaryContext with bad parameter data
       
  6217 @SYMTestPriority High
       
  6218 @SYMTestActions Invokes RPacketContext::OpenNewSecondaryContext with bad parameter data
       
  6219 @SYMTestExpectedResults Pass
       
  6220 @SYMTestType CT
       
  6221 */
       
  6222 void CCTsyPacketContextFU::TestOpenNewSecondaryContext0003L()
       
  6223 	{
       
  6224 	OpenEtelServerL(EUseExtendedError);
       
  6225 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6226 	OpenPhoneL();
       
  6227 	
       
  6228 	RPacketService packetService;
       
  6229     OpenPacketServiceL(packetService);
       
  6230     CleanupClosePushL(packetService);
       
  6231     
       
  6232     TInfoName contextId;  
       
  6233     RPacketContext packetContext;
       
  6234     packetContext.OpenNewContext(packetService, contextId);
       
  6235     CleanupClosePushL(packetContext);     
       
  6236       
       
  6237     RPacketContext packetContextSecondary;
       
  6238  	TInfoName contextIdSecondary;
       
  6239  	
       
  6240     // -----------------------------------------------------------------------
       
  6241     // Test with too long ContextId
       
  6242     // ----------------------------------------------------------------------    
       
  6243     TBuf<KMaxInfoName + 1> longContextId;
       
  6244     _LIT(KLongId, "qwertyuiopasdfghj");
       
  6245     longContextId.Copy(KLongId);
       
  6246 	TInt err = packetContextSecondary.OpenNewSecondaryContext(packetService, longContextId, contextIdSecondary);    
       
  6247 	ASSERT_EQUALS(KErrArgument, err);	
       
  6248 	//We need to close the sub sessiun before we open a new context 
       
  6249 	packetContextSecondary.Close();
       
  6250 	
       
  6251  	
       
  6252 	
       
  6253 	// -----------------------------------------------------------------------
       
  6254     // Previous OpenNewSecondaryContext failed with KErrArgument
       
  6255     // so try OpenNewSecondaryContext with correct params
       
  6256     // ----------------------------------------------------------------------     
       
  6257 	err = packetContextSecondary.OpenNewSecondaryContext(packetService, contextId, contextIdSecondary);    
       
  6258 	ASSERT_EQUALS(KErrNone, err);         	   
       
  6259         
       
  6260     AssertMockLtsyStatusL();
       
  6261 	CleanupStack::PopAndDestroy(3, this); // this, ...
       
  6262 	}
       
  6263 	
       
  6264 	
       
  6265 	
       
  6266 /**
       
  6267 @SYMTestCaseID BA-CTSY-PKTC-PCONSC-0003b
       
  6268 @SYMComponent  telephony_ctsy
       
  6269 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenNewSecondaryContext with wrong ContextId
       
  6270 @SYMTestPriority High
       
  6271 @SYMTestActions Invokes RPacketContext::OpenNewSecondaryContext with bad parameter data
       
  6272 @SYMTestExpectedResults Pass
       
  6273 @SYMTestType CT
       
  6274 */
       
  6275 void CCTsyPacketContextFU::TestOpenNewSecondaryContext0003bL()
       
  6276 	{	
       
  6277 	OpenEtelServerL(EUseExtendedError);
       
  6278 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6279 	OpenPhoneL();
       
  6280 	
       
  6281 	RPacketService packetService;
       
  6282     OpenPacketServiceL(packetService);
       
  6283     CleanupClosePushL(packetService);
       
  6284     
       
  6285     TInfoName contextId;  
       
  6286     RPacketContext packetContext;
       
  6287     packetContext.OpenNewContext(packetService, contextId);
       
  6288     CleanupClosePushL(packetContext); 
       
  6289    
       
  6290 	
       
  6291 	// -----------------------------------------------------------------------
       
  6292     // Test with wrong ContextId
       
  6293     // ----------------------------------------------------------------------
       
  6294     RPacketContext packetContextSecondary;
       
  6295     TInfoName wrongContextId;
       
  6296     _LIT(KSameId, "WrongId");
       
  6297     wrongContextId.Copy(KSameId);    
       
  6298     
       
  6299     TInfoName contextIdSecondary;
       
  6300     TInt err = packetContextSecondary.OpenNewSecondaryContext(packetService, wrongContextId, contextIdSecondary);
       
  6301 	CleanupClosePushL(packetContextSecondary);        
       
  6302     ASSERT_EQUALS(KErrArgument, err);
       
  6303     
       
  6304     AssertMockLtsyStatusL();    
       
  6305 	CleanupStack::PopAndDestroy(4, this); // this, ...
       
  6306 	}
       
  6307 	
       
  6308 	
       
  6309 	
       
  6310 /**
       
  6311 @SYMTestCaseID BA-CTSY-PKTC-PCONSC-0003c
       
  6312 @SYMComponent  telephony_ctsy
       
  6313 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenNewSecondaryContext with with empty PacketService
       
  6314 @SYMTestPriority High
       
  6315 @SYMTestActions Invokes RPacketContext::OpenNewSecondaryContext with bad parameter data
       
  6316 @SYMTestExpectedResults Pass
       
  6317 @SYMTestType CT
       
  6318 */
       
  6319 void CCTsyPacketContextFU::TestOpenNewSecondaryContext0003cL()
       
  6320 	{	
       
  6321 	OpenEtelServerL(EUseExtendedError);
       
  6322 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6323 	OpenPhoneL();
       
  6324 		
       
  6325 	RPacketService packetService;
       
  6326     OpenPacketServiceL(packetService);
       
  6327     CleanupClosePushL(packetService);
       
  6328     
       
  6329     TInfoName contextId;  
       
  6330     RPacketContext packetContext;
       
  6331     packetContext.OpenNewContext(packetService, contextId);
       
  6332     CleanupClosePushL(packetContext); 
       
  6333 	      
       
  6334     // -----------------------------------------------------------------------
       
  6335     // Test with empty PacketService
       
  6336     // -----------------------------------------------------------------------    
       
  6337     RPacketService emptyPacketService;
       
  6338     RPacketContext packetContextSecondary;
       
  6339     TInfoName contextIdSecondary; 
       
  6340     // there should be EEtelPanicNullHandle panic 
       
  6341     TInt err = packetContextSecondary.OpenNewSecondaryContext(emptyPacketService, contextId, contextIdSecondary);
       
  6342     
       
  6343     AssertMockLtsyStatusL();    
       
  6344 	CleanupStack::PopAndDestroy(3, this); // this, ...
       
  6345 	}
       
  6346 
       
  6347 /**
       
  6348 @SYMTestCaseID BA-CTSY-PKTC-PCONC-0001
       
  6349 @SYMComponent  telephony_ctsy
       
  6350 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenNewContext
       
  6351 @SYMTestPriority High
       
  6352 @SYMTestActions Invokes RPacketContext::OpenNewContext
       
  6353 @SYMTestExpectedResults Pass
       
  6354 @SYMTestType CT
       
  6355 */    
       
  6356 void CCTsyPacketContextFU::TestOpenNewContext0001L()
       
  6357 	{
       
  6358 	
       
  6359 	OpenEtelServerL(EUseExtendedError);
       
  6360 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6361 	OpenPhoneL();
       
  6362 		
       
  6363 	RPacketService packetService;
       
  6364     OpenPacketServiceL(packetService);
       
  6365     CleanupClosePushL(packetService);    
       
  6366        
       
  6367  	//-------------------------------------------------------------------------
       
  6368 	// TEST C: Successful completion request of
       
  6369 	// RPacketContext::SetConfig when result is not cached.
       
  6370  	//------------------------------------------------------------------------
       
  6371 	TInfoName contextId;  
       
  6372     RPacketContext packetContext;
       
  6373     packetContext.OpenNewContext(packetService, contextId);
       
  6374     CleanupClosePushL(packetContext);
       
  6375 
       
  6376  	AssertMockLtsyStatusL();
       
  6377 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this
       
  6378 	}
       
  6379 
       
  6380 /**
       
  6381 @SYMTestCaseID BA-CTSY-PKTC-PCONC-0003
       
  6382 @SYMComponent  telephony_ctsy
       
  6383 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenNewContext with bad parameter data
       
  6384 @SYMTestPriority High
       
  6385 @SYMTestActions Invokes RPacketContext::OpenNewContext with bad parameter data
       
  6386 @SYMTestExpectedResults Pass
       
  6387 @SYMTestType CT
       
  6388 */
       
  6389 void CCTsyPacketContextFU::TestOpenNewContext0003L()
       
  6390 	{
       
  6391 	OpenEtelServerL(EUseExtendedError);
       
  6392 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6393 	OpenPhoneL();
       
  6394 	
       
  6395 	RPacketService packetService;
       
  6396     OpenPacketServiceL(packetService);
       
  6397     CleanupClosePushL(packetService);
       
  6398 	
       
  6399 	//-------------------------------------------------------------------------	
       
  6400 	// Try to open too many contexts
       
  6401  	//-------------------------------------------------------------------------                	
       
  6402     TInt err = 0;  	
       
  6403  	for (TInt i = 0; i < KMmMaxNumberOfContexts; i++)
       
  6404  		{
       
  6405  			RPacketContext newPacketContext;
       
  6406  			TInfoName contextId;
       
  6407  			err = newPacketContext.OpenNewContext(packetService, contextId);
       
  6408  			ASSERT_EQUALS(KErrNone, err);
       
  6409     		CleanupClosePushL(newPacketContext); 			
       
  6410  		}
       
  6411  		
       
  6412  	RPacketContext OneMorePacketContext;
       
  6413  	TInfoName contextId1;
       
  6414  	err = OneMorePacketContext.OpenNewContext(packetService, contextId1);
       
  6415  	TInt expectedError = ( KErrOverflow & 0x0000FFFF ) |
       
  6416                     	 ( KErrUmtsMaxNumOfContextExceededByPhone << 16 );
       
  6417  	ASSERT_EQUALS(expectedError, err); 		
       
  6418 
       
  6419 	//-------------------------------------------------------------------------
       
  6420 	// Use non-created packetService
       
  6421  	//-------------------------------------------------------------------------	
       
  6422 	RPacketService packetService2;       
       
  6423     TInfoName contextId2;
       
  6424     RPacketContext packetContext2;
       
  6425         
       
  6426     // there should be expected EEtelPanicNullHandle panic 
       
  6427     packetContext2.OpenNewContext(packetService2, contextId2);  
       
  6428       
       
  6429 	CleanupStack::PopAndDestroy (KErrUmtsMaxNumOfContextExceededByPhone);
       
  6430 	CleanupStack::PopAndDestroy(2, this); //  packetService1, this
       
  6431 	}
       
  6432 
       
  6433 	
       
  6434 /**
       
  6435 @SYMTestCaseID BA-CTSY-PKTC-PCONEC-0001
       
  6436 @SYMComponent  telephony_ctsy
       
  6437 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenExistingContext
       
  6438 @SYMTestPriority High
       
  6439 @SYMTestActions Invokes RPacketContext::OpenExistingContext
       
  6440 @SYMTestExpectedResults Pass
       
  6441 @SYMTestType CT
       
  6442 */    
       
  6443 void CCTsyPacketContextFU::TestOpenExistingContext0001L()
       
  6444 	{
       
  6445 	OpenEtelServerL(EUseExtendedError);
       
  6446 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6447 	OpenPhoneL();	
       
  6448 	
       
  6449 	RBuf8 data;
       
  6450     CleanupClosePushL(data);
       
  6451 	
       
  6452 	RPacketService packetService;
       
  6453     OpenPacketServiceL(packetService);
       
  6454     CleanupClosePushL(packetService);    
       
  6455         
       
  6456 	TInfoName contextId; 
       
  6457 	RPacketContext packetContext;
       
  6458     packetContext.OpenNewContext(packetService, contextId);
       
  6459     CleanupClosePushL(packetContext);   
       
  6460           
       
  6461     //-------------------------------------------------------------------------
       
  6462 	// TEST C: Successful completion request of
       
  6463 	// RPacketContext::SetConfig when result is not cached.
       
  6464  	//-------------------------------------------------------------------------
       
  6465  	RPacketContext packetContext2;
       
  6466 	TInt err = packetContext2.OpenExistingContext(packetService, contextId);	
       
  6467 	CleanupClosePushL(packetContext2);
       
  6468 	ASSERT_EQUALS(KErrNone, err);
       
  6469 		
       
  6470 	// -----------------------------------------------------------------------
       
  6471     // Test contextId == KStringExternal and iDialUpContext created
       
  6472     // ----------------------------------------------------------------------           
       
  6473     TRequestStatus	mockLtsyStatus;
       
  6474     // Data for CompleteL
       
  6475 	TInfoName sndName;	
       
  6476 	TInt sndResult = KErrNotFound;
       
  6477 	TMockLtsyData2 <TInfoName, TInt > ltsyData(sndName, sndResult);
       
  6478 	ltsyData.SerialiseL(data);	
       
  6479     
       
  6480     // ---  create iDialUpContext at first -----------
       
  6481 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
       
  6482  	// Issue the Complete...	
       
  6483 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);
       
  6484 	// wait for completion 
       
  6485 	User::WaitForRequest(mockLtsyStatus);
       
  6486 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  6487 	//------------------------------------------
       
  6488 	
       
  6489 	RPacketContext packetContext3;
       
  6490     TInfoName longContextId3;
       
  6491     _LIT( KStringExternal,  "External"  );
       
  6492     longContextId3.Copy(KStringExternal);
       
  6493 	err = packetContext3.OpenExistingContext(packetService, longContextId3);
       
  6494 	ASSERT_EQUALS(KErrNone, err);
       
  6495 	CleanupClosePushL(packetContext3); 		
       
  6496 		
       
  6497 	AssertMockLtsyStatusL();
       
  6498 	CleanupStack::PopAndDestroy(6, this); //packetContext3, packetContext2, packetContext, packetService, data, this
       
  6499 	}
       
  6500 
       
  6501 /**
       
  6502 @SYMTestCaseID BA-CTSY-PKTC-PCONEC-0003
       
  6503 @SYMComponent  telephony_ctsy
       
  6504 @SYMTestCaseDesc Test support in CTSY for RPacketContext::OpenExistingContext with bad parameter data
       
  6505 @SYMTestPriority High
       
  6506 @SYMTestActions Invokes RPacketContext::OpenExistingContext with bad parameter data
       
  6507 @SYMTestExpectedResults Pass
       
  6508 @SYMTestType CT
       
  6509 */
       
  6510 void CCTsyPacketContextFU::TestOpenExistingContext0003L()
       
  6511 	{
       
  6512 	OpenEtelServerL(EUseExtendedError);
       
  6513 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6514 	OpenPhoneL();
       
  6515 
       
  6516 	RPacketService packetService;
       
  6517     OpenPacketServiceL(packetService);
       
  6518     CleanupClosePushL(packetService);    
       
  6519         
       
  6520 	TInfoName contextId;
       
  6521 	//-------------------------------------------------------------------------
       
  6522 	// Test with non-existing context
       
  6523  	//------------------------------------------------------------------------- 
       
  6524  	_LIT(KSomeContext, "SomeContext");
       
  6525 	contextId.Copy(KSomeContext);
       
  6526 	RPacketContext packetContext1;
       
  6527 	TInt err = packetContext1.OpenExistingContext(packetService, contextId);
       
  6528 	ASSERT_EQUALS(KErrNotFound, err);
       
  6529 	AssertMockLtsyStatusL();	
       
  6530 	
       
  6531 	// -----------------------------------------------------------------------
       
  6532     // Test with too long ContextId
       
  6533     // ----------------------------------------------------------------------    
       
  6534     RPacketContext packetContext2;
       
  6535     TBuf<KMaxInfoName + 1> longContextId;
       
  6536     _LIT(KLongId, "qwertyuiopasdfghj");
       
  6537     longContextId.Copy(KLongId);
       
  6538 	err = packetContext2.OpenExistingContext(packetService, longContextId);    
       
  6539 	ASSERT_EQUALS(KErrOverflow, err);
       
  6540 	
       
  6541 	// -----------------------------------------------------------------------
       
  6542     // Test contextId == KStringExternal, but when iDialUpContext is NOT created
       
  6543     // ----------------------------------------------------------------------    
       
  6544     RPacketContext packetContext3;
       
  6545     TInfoName longContextId3;
       
  6546     _LIT( KStringExternal,  "External"  );
       
  6547     longContextId3.Copy(KStringExternal);
       
  6548 	err = packetContext3.OpenExistingContext(packetService, longContextId3);    
       
  6549 	ASSERT_EQUALS(KErrNotFound, err);		
       
  6550 
       
  6551     //-------------------------------------------------------------------------
       
  6552 	// Test with epmty contextId
       
  6553  	//-------------------------------------------------------------------------
       
  6554  	RPacketContext packetContext4;
       
  6555  	contextId.Zero();
       
  6556     // there should be expected KErrBadName panic  	
       
  6557  	err = packetContext4.OpenExistingContext(packetService, contextId); 	
       
  6558  	
       
  6559 	AssertMockLtsyStatusL();
       
  6560 	CleanupStack::PopAndDestroy(1, this); // this
       
  6561 	}
       
  6562