telephonyserverplugins/common_tsy/test/component/src/cctsypacketservicefu.cpp
changeset 0 3553901f7fa8
child 21 2492a6e4aed7
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 //
       
    15 
       
    16 /**
       
    17  @file The TEFUnit test suite for PacketService in the Common TSY.
       
    18 */
       
    19 
       
    20 #include "cctsypacketservicefu.h"
       
    21 #include <etel.h>
       
    22 #include <etelmm.h>
       
    23 #include <et_clsvr.h>
       
    24 #include <ctsy/mmtsy_names.h>
       
    25 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    26 #include "tmockltsydata.h"
       
    27 #include <ctsy/serviceapi/gsmerror.h>
       
    28 
       
    29 #include <pcktcs.h>
       
    30 #include <ctsy/serviceapi/mmtsy_defaults.h>
       
    31 #include "cctsyactiveretriever.h"
       
    32 #include "Cmmpacketservicetsy.h"
       
    33 #include "pcktretrieve.h"
       
    34 #include "e32property.h"
       
    35 #include "cmockltsyfactory.h"
       
    36 #include "utils.h"
       
    37 
       
    38 #define MBMS_MONITORSERVICECOUNTZERO						0
       
    39 #define MBMS_MONITORSERVICECOUNTONE							1
       
    40 #define MBMS_MONITORSERVICECOUNTMULTIPLE					3
       
    41 
       
    42 CTestSuite* CCTsyPacketServiceFU::CreateSuiteL(const TDesC& aName)
       
    43 	{
       
    44 	SUB_SUITE;
       
    45 
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetPreferredBearer0001L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetPreferredBearer0004L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextAdded0001L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextAdded0002L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextAdded0004L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyStatusChange0001L);
       
    52 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyStatusChange0002L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyStatusChange0004L);
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyStatusChange0001aL);	
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetPreferredBearer0001L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetPreferredBearer0004L);
       
    57 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetPreferredBearer0005L);
       
    58 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetContextNameInNif0001L);
       
    59 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetContextNameInNif0003L);
       
    60 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetContextNameInNif0004L);
       
    61 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMSClassChange0001L);
       
    62 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMSClassChange0002L);
       
    63 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMSClassChange0004L);
       
    64 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetCurrentReleaseMode0001L);
       
    65 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateContextsInNif0001L);
       
    66 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateContextsInNif0003L);
       
    67 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateContextsInNif0004L);
       
    68 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyAttachModeChange0001L);
       
    69 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetDefaultContextParams0001L);
       
    70 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetDefaultContextParams0003L);
       
    71 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetDefaultContextParams0004L);
       
    72 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyDynamicCapsChange0001L);
       
    73 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyDynamicCapsChange0001bL);
       
    74 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyDynamicCapsChange0001cL);
       
    75 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyDynamicCapsChange0002L);
       
    76 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyDynamicCapsChange0004L);
       
    77 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyReleaseModeChange0001L);
       
    78 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestRejectActivationRequest0001L);
       
    79 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestRejectActivationRequest0002L);
       
    80 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestRejectActivationRequest0004L);
       
    81 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestRejectActivationRequest0005L);
       
    82 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetDefaultContextParams0001L);
       
    83 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetDefaultContextParams0002L);
       
    84 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetDefaultContextParams0003L);
       
    85 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetDefaultContextParams0004L);
       
    86 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetDefaultContextParams0005L);
       
    87 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyChangeOfNtwkRegStatus0001L);
       
    88 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyChangeOfNtwkRegStatus0002L);
       
    89 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyChangeOfNtwkRegStatus0004L);
       
    90 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextActivationRequested0001L);
       
    91 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextActivationRequested0001bL);
       
    92 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextActivationRequested0002L);
       
    93 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextActivationRequested0003L);
       
    94 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyContextActivationRequested0004L);
       
    95 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestAttach0001L);
       
    96 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestAttach0002L);
       
    97 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestAttach0004L);
       
    98 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestAttach0005L);
       
    99 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestDetach0001L);
       
   100 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestDetach0002L);
       
   101 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestDetach0004L);
       
   102 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestDetach0005L);
       
   103 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetStatus0001L);
       
   104 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestOpen0001L);
       
   105 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestOpen0003L);
       
   106 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestOpen0004L);
       
   107 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMSClass0001L);
       
   108 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMSClass0004L);
       
   109 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetNifInfo0001L);
       
   110 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetNifInfo0003L);
       
   111 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetNifInfo0004L);
       
   112 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetMSClass0001L);
       
   113 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestDeactivateNIF0001L);
       
   114 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateNifs0001L);
       
   115 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateNifs0004L);
       
   116 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetAttachMode0001L);
       
   117 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetAttachMode0004L);
       
   118 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetAttachMode0005L);
       
   119 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetStaticCaps0001L);
       
   120 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetStaticCaps0001bL);
       
   121 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetStaticCaps0003L);
       
   122 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetAttachMode0001L);
       
   123 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetAttachMode0004L);
       
   124 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestSetAttachMode0005L);
       
   125 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetContextInfo0001L);
       
   126 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetContextInfo0003L);
       
   127 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetContextInfo0004L);
       
   128 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetDynamicCaps0001L);
       
   129 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetDynamicCaps0001bL);
       
   130 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetNtwkRegStatus0001L);
       
   131 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetNtwkRegStatus0004L);
       
   132 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetNtwkRegStatus0005L);
       
   133 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateContexts0001L);
       
   134 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateContexts0004L);
       
   135 	
       
   136 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestCompleteNotifyEGprsInfoChange0001L);
       
   137 	ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestCompleteSetAlwaysOn0001L);
       
   138 	
       
   139     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestTsyMbmsSupportCaps0001L);
       
   140     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestTsyMbmsSupportCaps0001bL);
       
   141     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMbmsNetworkServiceStatusChange0001L);
       
   142     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMbmsNetworkServiceStatusChange0002L);
       
   143     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMbmsNetworkServiceStatusChange0003L);
       
   144     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMbmsNetworkServiceStatus0001L);
       
   145     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMbmsNetworkServiceStatus0001bL);
       
   146     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMbmsNetworkServiceStatus0001cL);
       
   147     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMbmsNetworkServiceStatus0002L);
       
   148     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMbmsNetworkServiceStatus0003L);
       
   149     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestGetMbmsNetworkServiceStatus0005L);
       
   150     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMbmsServiceAvailabilityChange0001L);
       
   151     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMbmsServiceAvailabilityChange0002L);
       
   152     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestNotifyMbmsServiceAvailabilityChange0004L);
       
   153     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsMonitorServiceList0001L);
       
   154     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsMonitorServiceList0002L);
       
   155     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsMonitorServiceList0003L);
       
   156     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsMonitorServiceList0005L);
       
   157     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestStart0001L); 
       
   158     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestStart0002L); 
       
   159     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateMbmsMonitorServiceList0001L);
       
   160     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateMbmsMonitorServiceList0002L);
       
   161     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateMbmsMonitorServiceList0004L);
       
   162     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateMbmsActiveServiceList0001L);
       
   163     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestEnumerateMbmsActiveServiceList0002L);
       
   164     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsSessionList0001L);
       
   165     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsSessionList0002L);
       
   166     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsSessionList0003L);
       
   167     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestUpdateMbmsSessionList0005L);
       
   168     
       
   169     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestRetrievePcktMbmsSessionListStart0001L);
       
   170     ADD_TEST_STEP_ISO_CPP(CCTsyPacketServiceFU, TestRetrievePcktMbmsSessionListStart0002L);
       
   171 
       
   172 	END_SUITE;
       
   173 	}
       
   174 
       
   175 
       
   176 //
       
   177 // Actual test cases
       
   178 //
       
   179 
       
   180 
       
   181 /**
       
   182 @SYMTestCaseID BA-CTSY-PKTS-PSGPB-0001
       
   183 @SYMPREQ 1551
       
   184 @SYMComponent  telephony_ctsy
       
   185 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetPreferredBearer
       
   186 @SYMTestPriority High
       
   187 @SYMTestActions Invokes RPacketService::GetPreferredBearer
       
   188 @SYMTestExpectedResults Pass
       
   189 @SYMTestType CT
       
   190 */
       
   191 void CCTsyPacketServiceFU::TestGetPreferredBearer0001L()
       
   192 	{
       
   193 
       
   194 	OpenEtelServerL(EUseExtendedError);
       
   195 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   196 	OpenPhoneL();
       
   197 
       
   198 	RBuf8 data;
       
   199 	CleanupClosePushL(data);
       
   200 
       
   201 	RPacketService packetService;
       
   202 	OpenPacketServiceL(packetService);
       
   203 	CleanupClosePushL(packetService);
       
   204 	
       
   205 	//-------------------------------------------------------------------------
       
   206 	// TEST D: RPacketService::GetPreferredBearer again, this time CTSY
       
   207 	// will get result from the cache.
       
   208  	//-------------------------------------------------------------------------	 		
       
   209  	TRequestStatus	requestStatus;
       
   210 	RPacketService::TPreferredBearer bearer;
       
   211 	packetService.GetPreferredBearer(requestStatus, bearer);
       
   212 	User::WaitForRequest(requestStatus);
       
   213 	
       
   214 	AssertMockLtsyStatusL();
       
   215 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   216 	ASSERT_EQUALS(RPacketService::EBearerPacketSwitched, bearer);
       
   217 	
       
   218 	// --- change PreferredBearer -----------------------------------------------
       
   219 	TRequestStatus mockLtsyStatus;
       
   220 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   221 	
       
   222 	// data for setting
       
   223 	RPacketService::TPreferredBearer newBearer = RPacketService::EBearerCircuitSwitched;
       
   224 	TMockLtsyData1 <RPacketService::TPreferredBearer> ltsyData(newBearer);
       
   225 	ltsyData.SerialiseL(data);		
       
   226 	
       
   227 	iMockLTSY.CompleteL(EPacketNotifyAttachModeChange, KErrNone, data);	
       
   228 	User::WaitForRequest(mockLtsyStatus);	
       
   229 	AssertMockLtsyStatusL();
       
   230 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   231 		
       
   232 	//-------------------------------------------------------------------------
       
   233 	// TEST D2: RPacketService::GetPreferredBearer again, this time CTSY
       
   234 	// will get result from the cache.
       
   235  	//-------------------------------------------------------------------------	 
       
   236 	packetService.GetPreferredBearer(requestStatus, bearer);
       
   237 	User::WaitForRequest(requestStatus);
       
   238 	
       
   239 	AssertMockLtsyStatusL();
       
   240 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   241 	ASSERT_EQUALS(newBearer, bearer);
       
   242 
       
   243 	AssertMockLtsyStatusL();
       
   244 	CleanupStack::PopAndDestroy(1); // packetService
       
   245 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   246 
       
   247 	}
       
   248 
       
   249 
       
   250 /**
       
   251 @SYMTestCaseID BA-CTSY-PKTS-PSGPB-0004
       
   252 @SYMPREQ 1551
       
   253 @SYMComponent  telephony_ctsy
       
   254 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetPreferredBearer
       
   255 @SYMTestPriority High
       
   256 @SYMTestActions Invokes multiple client requests to RPacketService::GetPreferredBearer
       
   257 @SYMTestExpectedResults Pass
       
   258 @SYMTestType CT
       
   259 */
       
   260 void CCTsyPacketServiceFU::TestGetPreferredBearer0004L()
       
   261 	{					
       
   262 	OpenEtelServerL(EUseExtendedError);
       
   263 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   264 	OpenPhoneL();
       
   265 
       
   266 	// Open second client
       
   267 	RTelServer telServer2;
       
   268 	TInt ret = telServer2.Connect();
       
   269 	ASSERT_EQUALS(KErrNone, ret);
       
   270 	CleanupClosePushL(telServer2);
       
   271 
       
   272 	RMobilePhone phone2;
       
   273 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
   274 	ASSERT_EQUALS(KErrNone, ret);
       
   275 	CleanupClosePushL(phone2);
       
   276 	
       
   277 	RPacketService packetService;
       
   278 	OpenPacketServiceL(packetService);
       
   279 	CleanupClosePushL(packetService);
       
   280 
       
   281 	RPacketService packetService2;                
       
   282 	ret = packetService2.Open(phone2);
       
   283 	ASSERT_EQUALS(KErrNone, ret);	
       
   284 	CleanupClosePushL(packetService2);
       
   285 	
       
   286 	//-------------------------------------------------------------------------
       
   287 	// Test A: Test multiple clients requesting RPacketService::GetPreferredBearer
       
   288  	//-------------------------------------------------------------------------
       
   289 
       
   290 	TRequestStatus	requestStatus;
       
   291 	RPacketService::TPreferredBearer bearer;
       
   292 	
       
   293 	TRequestStatus	requestStatus2;
       
   294 	RPacketService::TPreferredBearer bearer2;
       
   295 	
       
   296 	packetService.GetPreferredBearer(requestStatus, bearer);
       
   297 	packetService2.GetPreferredBearer(requestStatus2, bearer2);
       
   298 	
       
   299 	User::WaitForRequest(requestStatus);	
       
   300 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   301 	ASSERT_EQUALS(RPacketService::EBearerPacketSwitched, bearer);
       
   302 	
       
   303 	User::WaitForRequest(requestStatus2);	
       
   304 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   305 	ASSERT_EQUALS(RPacketService::EBearerPacketSwitched, bearer2);
       
   306 	
       
   307 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
   308 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
   309 	}
       
   310 
       
   311 
       
   312 /**
       
   313 @SYMTestCaseID BA-CTSY-PKTS-PSNCA-0001
       
   314 @SYMPREQ 1551
       
   315 @SYMComponent  telephony_ctsy
       
   316 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyContextAdded
       
   317 @SYMTestPriority High
       
   318 @SYMTestActions Invokes RPacketService::NotifyContextAdded
       
   319 @SYMTestExpectedResults Pass
       
   320 @SYMTestType CT
       
   321 */
       
   322 void CCTsyPacketServiceFU::TestNotifyContextAdded0001L()
       
   323 	{
       
   324 	OpenEtelServerL(EUseExtendedError);
       
   325 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   326 	OpenPhoneL();
       
   327 
       
   328 	RBuf8 data;
       
   329 	CleanupClosePushL(data);
       
   330 	 
       
   331 	RPacketService packetService;
       
   332 	OpenPacketServiceL(packetService);
       
   333 	CleanupClosePushL(packetService);
       
   334 	
       
   335 	TRequestStatus mockLtsyStatus;
       
   336 	
       
   337 	//-------------------------------------------------------------------------
       
   338 	// TEST E: Unsolicited completion 
       
   339 	// from LTSY.
       
   340  	//-------------------------------------------------------------------------
       
   341  	// Data for CompleteL
       
   342 	TInfoName sndName;
       
   343 	_LIT(Kname, "newName");
       
   344 	sndName.Copy(Kname);	
       
   345 	TInt sndResult = 0;
       
   346 	TMockLtsyData2 <TInfoName, TInt > ltsyData(sndName, sndResult);
       
   347 	ltsyData.SerialiseL(data);	
       
   348  	
       
   349  	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
       
   350  	// Issue the Complete...	
       
   351 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);
       
   352 	// wait for completion 
       
   353 	User::WaitForRequest(mockLtsyStatus);
       
   354 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   355 		
       
   356   	//-------------------------------------------------------------------------
       
   357 	// TEST C: Successful completion request of
       
   358 	// RPacketService::NotifyContextAdded when result is not cached.
       
   359  	//------------------------------------------------------------------------- 	
       
   360  
       
   361 	TRequestStatus	requestStatus;
       
   362 	TInfoName contextId;
       
   363 	
       
   364 	// sent request
       
   365 	packetService.NotifyContextAdded(requestStatus, contextId);
       
   366 	
       
   367 	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
   368 	// Issue the Complete...	
       
   369 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);	
       
   370 	
       
   371 	// wait for completion 
       
   372 	User::WaitForRequest(mockLtsyStatus);
       
   373 	// wait for request
       
   374 	User::WaitForRequest(requestStatus);	
       
   375 	
       
   376 	AssertMockLtsyStatusL();	
       
   377 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   378 	ASSERT_EQUALS(sndName, contextId);	
       
   379 	
       
   380 	//-------------------------------------------------------------------------
       
   381 	// TEST First call of API when sndResult != KErrNone and empty name is used
       
   382  	//------------------------------------------------------------------------- 	
       
   383  	iMockLTSY.NotifyTerminated(mockLtsyStatus); 		
       
   384 	sndResult = KErrGeneral;
       
   385 	sndName.Zero();
       
   386 	TMockLtsyData2 <TInfoName, TInt > ltsyData2(sndName, sndResult);
       
   387 	data.Close();
       
   388 	ltsyData2.SerialiseL(data);	
       
   389 
       
   390 	// sent request
       
   391 	packetService.NotifyContextAdded(requestStatus, contextId);
       
   392 				
       
   393 	// Issue the Complete...	
       
   394 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);	
       
   395 	
       
   396 	// wait for completion 
       
   397 	User::WaitForRequest(mockLtsyStatus);
       
   398 	// wait for request
       
   399 	User::WaitForRequest(requestStatus);	
       
   400 	
       
   401 	AssertMockLtsyStatusL();	
       
   402 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   403 	sndName.Append(KStringExternal);
       
   404 	ASSERT_EQUALS(sndName, contextId);
       
   405 		
       
   406 		
       
   407 	//-------------------------------------------------------------------------
       
   408 	// TEST Second call of API when sndResult != KErrNone and empty name is used 
       
   409  	//------------------------------------------------------------------------- 
       
   410  	 		
       
   411  	iMockLTSY.NotifyTerminated(mockLtsyStatus); 		
       
   412 	sndResult = KErrGeneral;
       
   413 	sndName.Zero();
       
   414 	TMockLtsyData2 <TInfoName, TInt > ltsyData3(sndName, sndResult);
       
   415 	data.Close();
       
   416 	ltsyData3.SerialiseL(data);
       
   417 
       
   418 	// sent request
       
   419 	packetService.NotifyContextAdded(requestStatus, contextId);
       
   420 				
       
   421 	// Issue the Complete...	
       
   422 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);	
       
   423 	
       
   424 	// wait for completion 
       
   425 	User::WaitForRequest(mockLtsyStatus);
       
   426 	// wait for request
       
   427 	User::WaitForRequest(requestStatus);	
       
   428 	
       
   429 	AssertMockLtsyStatusL();	
       
   430 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   431 	sndName.Append(KStringExternal2);
       
   432 	ASSERT_EQUALS(sndName, contextId);
       
   433 	
       
   434 	
       
   435 	//-------------------------------------------------------------------------
       
   436 	// TEST Call API when sndResult != KErrNone and non-empty name is used 
       
   437  	//------------------------------------------------------------------------- 	
       
   438  	
       
   439  	iMockLTSY.NotifyTerminated(mockLtsyStatus); 		
       
   440 	sndResult = KErrGeneral;
       
   441 	_LIT(Kname2, "NN");
       
   442 	sndName.Copy(Kname2);
       
   443 	TMockLtsyData2 <TInfoName, TInt > ltsyData4(sndName, sndResult);
       
   444 	data.Close();
       
   445 	ltsyData4.SerialiseL(data);
       
   446 
       
   447 	// sent request
       
   448 	packetService.NotifyContextAdded(requestStatus, contextId);
       
   449 				
       
   450 	// Issue the Complete...	
       
   451 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);	
       
   452 	
       
   453 	// wait for completion 
       
   454 	User::WaitForRequest(mockLtsyStatus);
       
   455 	// wait for request
       
   456 	User::WaitForRequest(requestStatus);	
       
   457 	
       
   458 	AssertMockLtsyStatusL();	
       
   459 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   460 	sndName.Copy(KStringExternal2);
       
   461 	ASSERT_EQUALS(sndName, contextId);	
       
   462 	
       
   463 	AssertMockLtsyStatusL();	
       
   464 	CleanupStack::PopAndDestroy(1); // packetService 
       
   465 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   466 	
       
   467 	}
       
   468 
       
   469 
       
   470 /**
       
   471 @SYMTestCaseID BA-CTSY-PKTS-PSNCA-0002
       
   472 @SYMPREQ 1551
       
   473 @SYMComponent  telephony_ctsy
       
   474 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyContextAdded
       
   475 @SYMTestPriority High
       
   476 @SYMTestActions Invokes cancelling of RPacketService::NotifyContextAdded
       
   477 @SYMTestExpectedResults Pass
       
   478 @SYMTestType CT
       
   479 */
       
   480 void CCTsyPacketServiceFU::TestNotifyContextAdded0002L()
       
   481 	{
       
   482     OpenEtelServerL(EUseExtendedError);
       
   483 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   484 	OpenPhoneL();
       
   485 
       
   486 	RPacketService packetService;
       
   487 	OpenPacketServiceL(packetService);
       
   488 	CleanupClosePushL(packetService);
       
   489 	
       
   490 	//-------------------------------------------------------------------------
       
   491 	// Test cancelling of RPacketService::NotifyContextAdded
       
   492  	//-------------------------------------------------------------------------
       
   493  		
       
   494  	TRequestStatus	requestStatus;
       
   495 	TInfoName contextId;
       
   496 
       
   497 	packetService.NotifyContextAdded(requestStatus, contextId);
       
   498     packetService.CancelAsyncRequest(EPacketNotifyContextAdded);
       
   499 			 	
       
   500 	User::WaitForRequest(requestStatus);
       
   501 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
   502 
       
   503 	CleanupStack::PopAndDestroy(2); // packetService, this
       
   504 	}
       
   505 
       
   506 /**
       
   507 @SYMTestCaseID BA-CTSY-PKTS-PSNCA-0004
       
   508 @SYMPREQ 1551
       
   509 @SYMComponent  telephony_ctsy
       
   510 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyContextAdded
       
   511 @SYMTestPriority High
       
   512 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyContextAdded
       
   513 @SYMTestExpectedResults Pass
       
   514 @SYMTestType CT
       
   515 */
       
   516 void CCTsyPacketServiceFU::TestNotifyContextAdded0004L()
       
   517 	{
       
   518 					
       
   519 	OpenEtelServerL(EUseExtendedError);
       
   520 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   521 	OpenPhoneL();
       
   522 
       
   523 	RBuf8 data;
       
   524 	CleanupClosePushL(data);
       
   525 
       
   526 	// Open second client
       
   527 	RTelServer telServer2;
       
   528 	TInt ret = telServer2.Connect();
       
   529 	ASSERT_EQUALS(KErrNone, ret);
       
   530 	CleanupClosePushL(telServer2);
       
   531 
       
   532 	RMobilePhone phone2;
       
   533 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
   534 	ASSERT_EQUALS(KErrNone, ret);
       
   535 	CleanupClosePushL(phone2);
       
   536 	
       
   537 	RPacketService packetService;
       
   538 	OpenPacketServiceL(packetService);
       
   539 	CleanupClosePushL(packetService);
       
   540 
       
   541 	RPacketService packetService2;                
       
   542 	ret = packetService2.Open(phone2);
       
   543 	ASSERT_EQUALS(KErrNone, ret);
       
   544 	CleanupClosePushL(packetService2);
       
   545 
       
   546 	//-------------------------------------------------------------------------
       
   547 	// Test A: Test multiple clients requesting RPacketService::NotifyContextAdded
       
   548  	//-------------------------------------------------------------------------
       
   549 
       
   550 	// Data for CompleteL
       
   551 	TInfoName sndName;
       
   552 	_LIT(Kname, "newName");
       
   553 	sndName.Copy(Kname);	
       
   554 	TInt sndResult = 0;
       
   555 	TMockLtsyData2 <TInfoName, TInt > ltsyData(sndName, sndResult);
       
   556 	ltsyData.SerialiseL(data);	
       
   557 
       
   558 	TRequestStatus	requestStatus;
       
   559 	TInfoName contextId;	
       
   560 	// sent first request
       
   561 	packetService.NotifyContextAdded(requestStatus, contextId);
       
   562 	
       
   563 	TRequestStatus	requestStatus2;
       
   564 	TInfoName contextId2;
       
   565 	// sent second request
       
   566 	packetService2.NotifyContextAdded(requestStatus2, contextId2);
       
   567 	
       
   568 	// Issue the Complete...	
       
   569 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);		
       
   570 		
       
   571 	// wait for the first request
       
   572 	User::WaitForRequest(requestStatus);		
       
   573 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   574 	ASSERT_EQUALS(sndName, contextId);
       
   575 	
       
   576 	// wait for the second request
       
   577 	User::WaitForRequest(requestStatus2);		
       
   578 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   579 	ASSERT_EQUALS(sndName, contextId2);
       
   580 
       
   581 	AssertMockLtsyStatusL();
       
   582 	
       
   583 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
   584 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
   585 	}
       
   586 
       
   587 
       
   588 
       
   589 
       
   590 /**
       
   591 @SYMTestCaseID BA-CTSY-PKTS-PSNSC-0001
       
   592 @SYMPREQ 1551
       
   593 @SYMComponent  telephony_ctsy
       
   594 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyStatusChange
       
   595 @SYMTestPriority High
       
   596 @SYMTestActions Invokes RPacketService::NotifyStatusChange
       
   597 @SYMTestExpectedResults Pass
       
   598 @SYMTestType CT
       
   599 */
       
   600 void CCTsyPacketServiceFU::TestNotifyStatusChange0001L()
       
   601 	{
       
   602 
       
   603 	OpenEtelServerL(EUseExtendedError);
       
   604 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   605 	OpenPhoneL();
       
   606 
       
   607 	RBuf8 data;
       
   608 	CleanupClosePushL(data);
       
   609 	
       
   610 	RPacketService packetService;
       
   611 	OpenPacketServiceL(packetService);
       
   612 	CleanupClosePushL(packetService);
       
   613 	
       
   614 	TRequestStatus mockLtsyStatus;
       
   615 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   616 	
       
   617  	//-------------------------------------------------------------------------
       
   618 	// TEST C: Successful completion request of
       
   619 	// RPacketService::NotifyStatusChange when result is not cached.
       
   620  	//-------------------------------------------------------------------------
       
   621 
       
   622 	// Data for CompleteL
       
   623 	RPacketService::TStatus sendStatus = RPacketService::EStatusAttached;
       
   624 	TBool isResumed = EFalse;
       
   625 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData(sendStatus, isResumed);
       
   626 	ltsyData.SerialiseL(data);	
       
   627 		
       
   628 	TRequestStatus requestStatus;
       
   629 	RPacketService::TStatus contextStatus;
       
   630 	//send request	
       
   631 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   632 	
       
   633 	// Issue the Complete...	
       
   634 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);
       
   635 	
       
   636 	// wait for completion
       
   637 	User::WaitForRequest(mockLtsyStatus);
       
   638 	// wait for request
       
   639 	User::WaitForRequest(requestStatus);
       
   640 	
       
   641 	AssertMockLtsyStatusL();
       
   642 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   643 	ASSERT_EQUALS(sendStatus, contextStatus);
       
   644 	
       
   645 	//-------------------------------------------------------------------------
       
   646 	// TEST E: Unsolicited completion of RPacketService::NotifyStatusChange
       
   647 	// from LTSY.
       
   648  	//-------------------------------------------------------------------------
       
   649  
       
   650  	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   651  	 	
       
   652  	// Issue the Complete...	
       
   653 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);	
       
   654 	// wait for completion
       
   655 	User::WaitForRequest(mockLtsyStatus);
       
   656 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   657 	
       
   658 	//-------------------------------------------------------------------------
       
   659 	// TEST E_1: Unsolicited completion of RPacketService::NotifyStatusChange
       
   660 	// from LTSY. When isresumed == ETrue
       
   661  	//------------------------------------------------------------------------- 
       
   662  	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   663  	
       
   664  	isResumed = ETrue;
       
   665 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData0(sendStatus, isResumed);
       
   666 	data.Close();
       
   667 	ltsyData0.SerialiseL(data);	 	 	 	
       
   668  	// Issue the Complete...	
       
   669 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);	
       
   670 	// wait for completion
       
   671 	User::WaitForRequest(mockLtsyStatus);
       
   672 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   673 	
       
   674 	//-------------------------------------------------------------------------
       
   675 	// TEST E_2: Unsolicited completion of RPacketService::NotifyStatusChange
       
   676 	// from LTSY. When Packet is Suspended  
       
   677  	//-------------------------------------------------------------------------
       
   678  	// Change RPacketService status  to RPacketService::EStatusSuspended 		
       
   679 	sendStatus = RPacketService::EStatusSuspended;
       
   680 	isResumed = EFalse;	
       
   681 	TInt err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
   682 	ASSERT_EQUALS(KErrNone, err);	
       
   683 	
       
   684 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 	
       
   685 	isResumed = ETrue;
       
   686 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData2(sendStatus, isResumed);
       
   687 	data.Close();
       
   688 	ltsyData2.SerialiseL(data);	 	
       
   689  	// Issue the Complete...	
       
   690 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);	
       
   691 	// wait for completion
       
   692 	User::WaitForRequest(mockLtsyStatus);
       
   693 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   694 	
       
   695 	
       
   696 	//-------------------------------------------------------------------------
       
   697 	// TEST E_3: Unsolicited completion of RPacketService::NotifyStatusChange
       
   698 	// from LTSY. When Packet is Suspended, has RPacketContext and there are iDialUpContext 
       
   699 	// and iSecondaryDialUpContext.
       
   700  	//-------------------------------------------------------------------------
       
   701  	
       
   702  	// ----  Cause iDialUpContext to be created --------------
       
   703  	iMockLTSY.NotifyTerminated(mockLtsyStatus); 		
       
   704 	TInt sndResult = KErrGeneral;
       
   705 	TInfoName sndName;
       
   706 	sndName.Zero();
       
   707 	TMockLtsyData2 <TInfoName, TInt > ltsyData3(sndName, sndResult);
       
   708 	data.Close();
       
   709 	ltsyData3.SerialiseL(data);	
       
   710 	// Issue the Complete to create iDialUpContext
       
   711 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);		
       
   712 	// wait for completion 
       
   713 	User::WaitForRequest(mockLtsyStatus);
       
   714 	AssertMockLtsyStatusL();	
       
   715 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   716 	
       
   717 	// Open new context
       
   718 	TInfoName contextId;	
       
   719 	RPacketContext packetContext;	
       
   720 	packetContext.OpenNewContext(packetService, contextId);	
       
   721 	CleanupClosePushL(packetContext);
       
   722  	
       
   723  	// ----  Cause iSecondaryDialUpContext to be created --------------
       
   724  	sndName.Zero();
       
   725  	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
       
   726  	// Issue the Complete to create iSecondaryDialUpContext
       
   727 	iMockLTSY.CompleteL(EPacketNotifyContextAdded, KErrNone, data);		
       
   728 	// wait for completion 
       
   729 	User::WaitForRequest(mockLtsyStatus);
       
   730 	AssertMockLtsyStatusL();	
       
   731 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   732  	
       
   733  	// Change RPacketService status  to RPacketService::EStatusSuspended 		
       
   734 	sendStatus = RPacketService::EStatusSuspended;
       
   735 	isResumed = EFalse;	
       
   736 	err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
   737 	ASSERT_EQUALS(KErrNone, err);
       
   738 	
       
   739 	iMockLTSY.NotifyTerminated(mockLtsyStatus); 	
       
   740 	isResumed = ETrue;
       
   741 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData4(sendStatus, isResumed);
       
   742 	data.Close();
       
   743 	ltsyData4.SerialiseL(data);	 	
       
   744  	// Issue the Complete...	
       
   745 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);	
       
   746 	// wait for completion
       
   747 	User::WaitForRequest(mockLtsyStatus);
       
   748 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
   749 	
       
   750  	AssertMockLtsyStatusL();
       
   751  	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
   752 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
   753 	}
       
   754 
       
   755 
       
   756 /**
       
   757 @SYMTestCaseID BA-CTSY-PKTS-PSNSC-0002
       
   758 @SYMPREQ 1551
       
   759 @SYMComponent  telephony_ctsy
       
   760 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyStatusChange
       
   761 @SYMTestPriority High
       
   762 @SYMTestActions Invokes cancelling of RPacketService::NotifyStatusChange
       
   763 @SYMTestExpectedResults Pass
       
   764 @SYMTestType CT
       
   765 */
       
   766 void CCTsyPacketServiceFU::TestNotifyStatusChange0002L()
       
   767 	{
       
   768 
       
   769 	OpenEtelServerL(EUseExtendedError);
       
   770 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   771 	OpenPhoneL();
       
   772 
       
   773 	RBuf8 data;
       
   774 	CleanupClosePushL(data);
       
   775 	
       
   776 	RPacketService packetService;
       
   777 	OpenPacketServiceL(packetService);
       
   778 	CleanupClosePushL(packetService);
       
   779 	
       
   780 	TRequestStatus mockLtsyStatus;
       
   781 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   782 
       
   783  	//-------------------------------------------------------------------------
       
   784 	// Test cancelling of RPacketService::NotifyStatusChange
       
   785  	//------------------------------------------------------------------------- 	
       
   786 	// Data for CompleteL
       
   787 	RPacketService::TStatus sendStatus = RPacketService::EStatusSuspended;
       
   788 	TBool isResumed = EFalse;
       
   789 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData(sendStatus, isResumed);
       
   790 	ltsyData.SerialiseL(data);	
       
   791 	
       
   792 	TRequestStatus requestStatus;
       
   793 	RPacketService::TStatus contextStatus;
       
   794 	
       
   795 	//send request	
       
   796 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   797 	// Cancel request
       
   798     packetService.CancelAsyncRequest(EPacketNotifyStatusChange);
       
   799 		
       
   800 	// Issue the Complete...	
       
   801 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);
       
   802 	 	
       
   803 	User::WaitForRequest(requestStatus);
       
   804 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
   805 	
       
   806 	// Wait for completion of iMockLTSY.NotifyTerminated
       
   807 	User::WaitForRequest(mockLtsyStatus);		
       
   808 	AssertMockLtsyStatusL();	
       
   809 	CleanupStack::PopAndDestroy(1); // packetService 
       
   810 	CleanupStack::PopAndDestroy(2); // data, this
       
   811 	
       
   812 	}
       
   813 
       
   814 
       
   815 
       
   816 /**
       
   817 @SYMTestCaseID BA-CTSY-PKTS-PSNSC-0004
       
   818 @SYMPREQ 1551
       
   819 @SYMComponent  telephony_ctsy
       
   820 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyStatusChange
       
   821 @SYMTestPriority High
       
   822 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyStatusChange
       
   823 @SYMTestExpectedResults Pass
       
   824 @SYMTestType CT
       
   825 */
       
   826 void CCTsyPacketServiceFU::TestNotifyStatusChange0004L()
       
   827 	{
       
   828 					
       
   829 	OpenEtelServerL(EUseExtendedError);
       
   830 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   831 	OpenPhoneL();
       
   832 
       
   833 	RBuf8 data;
       
   834 	CleanupClosePushL(data);
       
   835 
       
   836 	// Open second client
       
   837 	RTelServer telServer2;
       
   838 	TInt ret = telServer2.Connect();
       
   839 	ASSERT_EQUALS(KErrNone, ret);
       
   840 	CleanupClosePushL(telServer2);
       
   841 
       
   842 	RMobilePhone phone2;
       
   843 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
   844 	ASSERT_EQUALS(KErrNone, ret);
       
   845 	CleanupClosePushL(phone2);
       
   846 	
       
   847 	RPacketService packetService;
       
   848 	OpenPacketServiceL(packetService);
       
   849 	CleanupClosePushL(packetService);
       
   850 
       
   851 	RPacketService packetService2;                
       
   852 	ret = packetService2.Open(phone2);
       
   853 	ASSERT_EQUALS(KErrNone, ret);
       
   854 	CleanupClosePushL(packetService2);
       
   855 
       
   856 	//-------------------------------------------------------------------------
       
   857 	// Test A: Test multiple clients requesting RPacketService::NotifyStatusChange
       
   858  	//-------------------------------------------------------------------------
       
   859 
       
   860 	// Data for CompleteL
       
   861 	RPacketService::TStatus sendStatus = RPacketService::EStatusAttached;
       
   862 	TBool isResumed = EFalse;
       
   863 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData(sendStatus, isResumed);
       
   864 	ltsyData.SerialiseL(data);	
       
   865 	
       
   866 	TRequestStatus requestStatus;
       
   867 	RPacketService::TStatus contextStatus;	
       
   868 	// sent first request
       
   869 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   870 	
       
   871 	TRequestStatus requestStatus2;
       
   872 	RPacketService::TStatus contextStatus2;
       
   873 	// sent second request
       
   874 	packetService2.NotifyStatusChange(requestStatus2, contextStatus2);
       
   875 	
       
   876 	// Issue the Complete...	
       
   877 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);		
       
   878 		
       
   879 	// wait for the first request
       
   880 	User::WaitForRequest(requestStatus);		
       
   881 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   882 	ASSERT_EQUALS(sendStatus, contextStatus);	
       
   883 	// wait for the second request
       
   884 	User::WaitForRequest(requestStatus2);		
       
   885 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   886 	ASSERT_EQUALS(sendStatus, contextStatus2);
       
   887 
       
   888 	AssertMockLtsyStatusL();
       
   889 	
       
   890 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
   891 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
   892 	}
       
   893 
       
   894 /**
       
   895 @SYMTestCaseID BA-CTSY-PKTS-PSNSC-0001a
       
   896 @SYMPREQ 1551
       
   897 @SYMComponent  telephony_ctsy
       
   898 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyStatusChange request which is completed with error. 
       
   899 @SYMTestPriority High
       
   900 @SYMTestActions Invokes RPacketService::NotifyStatusChange
       
   901 @SYMTestExpectedResults Pass
       
   902 @SYMTestType CT
       
   903 */
       
   904 void CCTsyPacketServiceFU::TestNotifyStatusChange0001aL()
       
   905 	{
       
   906 
       
   907 	OpenEtelServerL(EUseExtendedError);
       
   908 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   909 	OpenPhoneL();
       
   910 
       
   911 	RBuf8 completeData;
       
   912 	CleanupClosePushL(completeData);
       
   913 	
       
   914 	RPacketService packetService;
       
   915 	OpenPacketServiceL(packetService);
       
   916 	CleanupClosePushL(packetService);	
       
   917 	
       
   918 	TRequestStatus requestStatus;
       
   919 
       
   920 	//-------------------------------------------------------------------------
       
   921 	// Test A: RPacketService::TStatus changes from RPacketService::EStatusAttached
       
   922 	// to RPacketService::EStatusUnattached with error KErrGsmPSConnectionBarred
       
   923  	//-------------------------------------------------------------------------
       
   924 
       
   925 	//Data for CompleteL
       
   926 	RPacketService::TStatus sendStatus = RPacketService::EStatusAttached;
       
   927 	TBool isResumed = EFalse;
       
   928 	TMockLtsyData2 <RPacketService::TStatus, TBool> ltsyData(sendStatus, isResumed);
       
   929 	ltsyData.SerialiseL(completeData);	
       
   930 		
       
   931 	RPacketService::TStatus contextStatus;
       
   932     
       
   933     //Send request		
       
   934 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   935 	
       
   936 	//Issue the Complete...	
       
   937 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, completeData);
       
   938 	
       
   939 	//NotifyStatusChange should be completed with status RPacketService::EStatusAttached
       
   940 	//and KErrNone
       
   941 	User::WaitForRequest(requestStatus);
       
   942 	AssertMockLtsyStatusL();
       
   943 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   944 	ASSERT_EQUALS(sendStatus, contextStatus);
       
   945 		
       
   946 	//Data for CompleteL
       
   947 	sendStatus = RPacketService::EStatusUnattached;
       
   948 	isResumed = EFalse;
       
   949 	TMockLtsyData2 <RPacketService::TStatus, TBool> ltsyData2(sendStatus, isResumed);
       
   950 	completeData.Close();
       
   951 	ltsyData2.SerialiseL(completeData);	
       
   952 
       
   953     //Send request	
       
   954 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   955 	
       
   956 	//Issue the Complete...	
       
   957 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrGsmPSConnectionBarred, completeData);
       
   958 	
       
   959 	//NotifyStatusChange should be completed with status RPacketService::EStatusUnattached
       
   960 	//and KErrGsmPSConnectionBarred
       
   961 	User::WaitForRequest(requestStatus);
       
   962 	AssertMockLtsyStatusL();
       
   963 	ASSERT_EQUALS(KErrGsmPSConnectionBarred, requestStatus.Int());
       
   964 	ASSERT_EQUALS(sendStatus, contextStatus);	
       
   965 	
       
   966 	//-------------------------------------------------------------------------
       
   967 	// Test B: RPacketService::TStatus changes from RPacketService::EStatusAttached
       
   968 	// to RPacketService::EStatusSuspended with error KErrGsmCSConnectionBarred
       
   969  	//-------------------------------------------------------------------------
       
   970 
       
   971 	//Data for CompleteL
       
   972 	sendStatus = RPacketService::EStatusAttached;
       
   973 	completeData.Close();
       
   974 	ltsyData.SerialiseL(completeData);	
       
   975 		
       
   976 	//Send request	
       
   977 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   978 	
       
   979 	//Issue the Complete...	
       
   980 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, completeData);
       
   981 	
       
   982 	//NotifyStatusChange should be completed with status RPacketService::EStatusAttached
       
   983 	//and KErrNone
       
   984 	User::WaitForRequest(requestStatus);
       
   985 	AssertMockLtsyStatusL();
       
   986 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   987 	ASSERT_EQUALS(sendStatus, contextStatus);
       
   988 		
       
   989 	//Data for CompleteL
       
   990 	sendStatus = RPacketService::EStatusSuspended;
       
   991 	isResumed = EFalse;
       
   992 	TMockLtsyData2 <RPacketService::TStatus, TBool> ltsyData3(sendStatus, isResumed);
       
   993 	completeData.Close();
       
   994 	ltsyData3.SerialiseL(completeData);	
       
   995 
       
   996 	//Send request	
       
   997 	packetService.NotifyStatusChange(requestStatus, contextStatus);
       
   998 	
       
   999 	//Issue the Complete...	
       
  1000 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrGsmCSConnectionBarred, completeData);
       
  1001 	
       
  1002 	//NotifyStatusChange should be completed with status RPacketService::EStatusUnattached
       
  1003 	//and KErrGsmCSConnectionBarred
       
  1004 	User::WaitForRequest(requestStatus);	
       
  1005 	AssertMockLtsyStatusL();
       
  1006 	ASSERT_EQUALS(KErrGsmCSConnectionBarred, requestStatus.Int());
       
  1007 	ASSERT_EQUALS(sendStatus, contextStatus);			
       
  1008 	
       
  1009 	CleanupStack::PopAndDestroy(3, this); // packetService, completeData, this	
       
  1010 	}
       
  1011 
       
  1012 /**
       
  1013 @SYMTestCaseID BA-CTSY-PKTS-PSSPB-0001
       
  1014 @SYMPREQ 1551
       
  1015 @SYMComponent  telephony_ctsy
       
  1016 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetPreferredBearer
       
  1017 @SYMTestPriority High
       
  1018 @SYMTestActions Invokes RPacketService::SetPreferredBearer
       
  1019 @SYMTestExpectedResults Pass
       
  1020 @SYMTestType CT
       
  1021 */
       
  1022 void CCTsyPacketServiceFU::TestSetPreferredBearer0001L()
       
  1023 	{
       
  1024 
       
  1025 	OpenEtelServerL(EUseExtendedError);
       
  1026 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1027 	OpenPhoneL();
       
  1028 
       
  1029 	RBuf8 data;
       
  1030 	CleanupClosePushL(data);
       
  1031 	
       
  1032 	RPacketService packetService;		
       
  1033 	// Open PacketService
       
  1034 	OpenPacketServiceL(packetService);
       
  1035 	CleanupClosePushL(packetService);
       
  1036 	
       
  1037  	//-------------------------------------------------------------------------
       
  1038 	// TEST A: failure to dispatch request to LTSY
       
  1039  	//-------------------------------------------------------------------------
       
  1040  	TRequestStatus	requestStatus;
       
  1041 	RPacketService::TPreferredBearer bearer = RPacketService::EBearerCircuitSwitched; 
       
  1042 	// data for ExpectL
       
  1043 	TMockLtsyData1<RPacketService::TPreferredBearer> expPrefBearerPckg(bearer);
       
  1044 	expPrefBearerPckg.SerialiseL(data);
       
  1045 	
       
  1046 	iMockLTSY.ExpectL(EPacketSetPrefBearer, data, KErrNotSupported);
       
  1047 	
       
  1048 	packetService.SetPreferredBearer(requestStatus, bearer);	
       
  1049 	User::WaitForRequest(requestStatus);
       
  1050 	AssertMockLtsyStatusL();
       
  1051 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  1052 
       
  1053 	//-------------------------------------------------------------------------
       
  1054 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  1055  	//-------------------------------------------------------------------------
       
  1056 
       
  1057 	iMockLTSY.ExpectL(EPacketSetPrefBearer, data);
       
  1058 	iMockLTSY.CompleteL(EPacketSetPrefBearer, KErrGeneral);	
       
  1059 	
       
  1060 	
       
  1061 	packetService.SetPreferredBearer(requestStatus, bearer);	
       
  1062 	User::WaitForRequest(requestStatus);
       
  1063 	AssertMockLtsyStatusL();
       
  1064 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  1065 
       
  1066  	//-------------------------------------------------------------------------
       
  1067 	// TEST C: Successful completion request of
       
  1068 	// RPacketService::SetPreferredBearer when result is not cached.
       
  1069  	//-------------------------------------------------------------------------
       
  1070 
       
  1071 	iMockLTSY.ExpectL(EPacketSetPrefBearer, data);
       
  1072 	iMockLTSY.CompleteL(EPacketSetPrefBearer, KErrNone);	
       
  1073 
       
  1074 	packetService.SetPreferredBearer(requestStatus, bearer);	
       
  1075 	User::WaitForRequest(requestStatus); 	
       
  1076 	AssertMockLtsyStatusL();
       
  1077 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1078 
       
  1079  	//-------------------------------------------------------------------------
       
  1080 	// TEST E: Unsolicited completion of RPacketService::SetPreferredBearer
       
  1081 	// from LTSY.
       
  1082  	//-------------------------------------------------------------------------
       
  1083  	
       
  1084  	TRequestStatus mockLtsyStatus;
       
  1085 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  1086 	
       
  1087 	iMockLTSY.CompleteL(EPacketSetPrefBearer, KErrNone);
       
  1088 	User::WaitForRequest(mockLtsyStatus); 	
       
  1089 
       
  1090 	AssertMockLtsyStatusL();
       
  1091 	CleanupStack::PopAndDestroy(); // packetService
       
  1092 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1093 	
       
  1094 	}
       
  1095 
       
  1096 
       
  1097 /**
       
  1098 @SYMTestCaseID BA-CTSY-PKTS-PSSPB-0004
       
  1099 @SYMPREQ 1551
       
  1100 @SYMComponent  telephony_ctsy
       
  1101 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::SetPreferredBearer
       
  1102 @SYMTestPriority High
       
  1103 @SYMTestActions Invokes multiple client requests to RPacketService::SetPreferredBearer
       
  1104 @SYMTestExpectedResults Pass
       
  1105 @SYMTestType CT
       
  1106 */
       
  1107 void CCTsyPacketServiceFU::TestSetPreferredBearer0004L()
       
  1108 	{
       
  1109 					
       
  1110 	OpenEtelServerL(EUseExtendedError);
       
  1111 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1112 	OpenPhoneL();
       
  1113 
       
  1114 	RBuf8 data;
       
  1115 	CleanupClosePushL(data);
       
  1116 
       
  1117 	// Open second client
       
  1118 	RTelServer telServer2;
       
  1119 	TInt ret = telServer2.Connect();
       
  1120 	ASSERT_EQUALS(KErrNone, ret);
       
  1121 	CleanupClosePushL(telServer2);
       
  1122 
       
  1123 	RMobilePhone phone2;
       
  1124 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  1125 	ASSERT_EQUALS(KErrNone, ret);
       
  1126 	CleanupClosePushL(phone2);
       
  1127 	
       
  1128 	RPacketService packetService;
       
  1129 	OpenPacketServiceL(packetService);
       
  1130 	CleanupClosePushL(packetService);
       
  1131 
       
  1132 	RPacketService packetService2;                
       
  1133 	ret = packetService2.Open(phone2);
       
  1134 	ASSERT_EQUALS(KErrNone, ret);
       
  1135 	CleanupClosePushL(packetService2);
       
  1136 	//-------------------------------------------------------------------------
       
  1137 	// Test A: Test multiple clients requesting RPacketService::SetPreferredBearer
       
  1138  	//-------------------------------------------------------------------------
       
  1139 	
       
  1140 	TRequestStatus	requestStatus;
       
  1141 	RPacketService::TPreferredBearer bearer = RPacketService::EBearerCircuitSwitched; 
       
  1142 	
       
  1143 	TRequestStatus	requestStatus2;
       
  1144 	RPacketService::TPreferredBearer bearer2 = RPacketService::EBearerPacketSwitched;
       
  1145 	
       
  1146 	// data for ExpectL
       
  1147 	TMockLtsyData1<RPacketService::TPreferredBearer> expPrefBearerPckg(bearer);
       
  1148 	expPrefBearerPckg.SerialiseL(data);
       
  1149 	
       
  1150 	iMockLTSY.ExpectL(EPacketSetPrefBearer, data);
       
  1151 	iMockLTSY.CompleteL(EPacketSetPrefBearer, KErrNone);	
       
  1152 	
       
  1153 	// send first request
       
  1154 	packetService.SetPreferredBearer(requestStatus, bearer);	
       
  1155 	packetService2.SetPreferredBearer(requestStatus2, bearer2);
       
  1156 	
       
  1157 	//wait for first answer
       
  1158 	User::WaitForRequest(requestStatus); 	
       
  1159 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1160 	
       
  1161 	//wait for second answer
       
  1162 	User::WaitForRequest(requestStatus2); 	
       
  1163 	AssertMockLtsyStatusL();
       
  1164 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());	
       
  1165 
       
  1166 	CleanupStack::PopAndDestroy(2);	 //packetService, packetService2
       
  1167 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  1168 
       
  1169 	}
       
  1170 
       
  1171 
       
  1172 /**
       
  1173 @SYMTestCaseID BA-CTSY-PKTS-PSSPB-0005
       
  1174 @SYMPREQ 1551
       
  1175 @SYMComponent  telephony_ctsy
       
  1176 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetPreferredBearer with timeout
       
  1177 @SYMTestPriority High
       
  1178 @SYMTestActions Invokes RPacketService::SetPreferredBearer and tests for timeout
       
  1179 @SYMTestExpectedResults Pass
       
  1180 @SYMTestType CT
       
  1181 */
       
  1182 void CCTsyPacketServiceFU::TestSetPreferredBearer0005L()
       
  1183 	{
       
  1184 
       
  1185 	OpenEtelServerL(EUseExtendedError);
       
  1186 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1187 	OpenPhoneL();
       
  1188 
       
  1189 	RBuf8 data;
       
  1190 	CleanupClosePushL(data);
       
  1191 	
       
  1192 	RPacketService packetService;
       
  1193 	OpenPacketServiceL(packetService);
       
  1194 	CleanupClosePushL(packetService);
       
  1195 
       
  1196 	//-------------------------------------------------------------------------
       
  1197 	// Test A: Test timeout of RPacketService::SetPreferredBearer
       
  1198  	//-------------------------------------------------------------------------
       
  1199  	TRequestStatus	requestStatus;
       
  1200 	RPacketService::TPreferredBearer bearer = RPacketService::EBearerCircuitSwitched; 	
       
  1201 	
       
  1202 	// data for ExpectL
       
  1203 	TMockLtsyData1<RPacketService::TPreferredBearer> expPrefBearerPckg(bearer);
       
  1204 	expPrefBearerPckg.SerialiseL(data);
       
  1205 	
       
  1206 	iMockLTSY.ExpectL(EPacketSetPrefBearer, data);
       
  1207 
       
  1208 	packetService.SetPreferredBearer(requestStatus, bearer);	
       
  1209 	User::WaitForRequest(requestStatus); 	
       
  1210 	AssertMockLtsyStatusL();
       
  1211 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  1212 
       
  1213 	CleanupStack::PopAndDestroy(1); //packetService
       
  1214 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1215 	}
       
  1216 
       
  1217 
       
  1218 /**
       
  1219 @SYMTestCaseID BA-CTSY-PKTS-PSGCNIN-0001
       
  1220 @SYMPREQ 1551
       
  1221 @SYMComponent  telephony_ctsy
       
  1222 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetContextNameInNif
       
  1223 @SYMTestPriority High
       
  1224 @SYMTestActions Invokes RPacketService::GetContextNameInNif
       
  1225 @SYMTestExpectedResults Pass
       
  1226 @SYMTestType CT
       
  1227 */
       
  1228 void CCTsyPacketServiceFU::TestGetContextNameInNif0001L()
       
  1229 	{
       
  1230 
       
  1231 	OpenEtelServerL(EUseExtendedError);
       
  1232 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1233 	OpenPhoneL();
       
  1234 
       
  1235 	RBuf8 data;
       
  1236 	CleanupClosePushL(data);
       
  1237 	
       
  1238 	RBuf8 expectData;
       
  1239 	CleanupClosePushL(expectData);
       
  1240 	
       
  1241 	
       
  1242 	RPacketService packetService;
       
  1243 	OpenPacketServiceL(packetService);
       
  1244 	CleanupClosePushL(packetService);
       
  1245 
       
  1246 	//-------------------------------------------------------------------------
       
  1247 	// TEST C: Successful completion request of
       
  1248 	// RPacketService::GetContextNameInNif when result is not cached.
       
  1249  	//-------------------------------------------------------------------------	
       
  1250 	// Open new context
       
  1251 	TInfoName contextId;	
       
  1252 	RPacketContext packetContext;
       
  1253 	packetContext.OpenNewContext(packetService, contextId);
       
  1254 	CleanupClosePushL(packetContext); 
       
  1255 	
       
  1256 	// Open one more  context
       
  1257 	TInfoName contextId2;	
       
  1258 	RPacketContext packetContext2;
       
  1259 	packetContext2.OpenNewContext(packetService, contextId2);
       
  1260 	CleanupClosePushL(packetContext2);
       
  1261 	
       
  1262 	TRequestStatus	requestStatus;
       
  1263 	TInfoName existingContextName;
       
  1264 	existingContextName.Copy(contextId);
       
  1265 	TInfoName contextName;
       
  1266 	TInt index = 1;	// ask for the second context's name
       
  1267 		
       
  1268 	packetService.GetContextNameInNif(requestStatus, existingContextName, index, contextName);
       
  1269 	User::WaitForRequest(requestStatus); 	
       
  1270 	AssertMockLtsyStatusL();
       
  1271 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1272 	ASSERT_EQUALS(contextId2, contextName);	 	
       
  1273 
       
  1274 	//----------------------------------------------------------------------------
       
  1275 	// Test with context with different PDP address
       
  1276 	//----------------------------------------------------------------------------
       
  1277 	// Open third context
       
  1278 	TInfoName contextId3;	
       
  1279 	RPacketContext packetContext3;
       
  1280 	packetContext3.OpenNewContext(packetService, contextId3);
       
  1281 	CleanupClosePushL(packetContext3);
       
  1282 	
       
  1283 	//initialisation of the third context
       
  1284 	TInt err = InitContextL (packetContext3, contextId3);
       
  1285 	ASSERT_EQUALS(KErrNone, err);
       
  1286 		
       
  1287 	// data for setting another PDP adddress
       
  1288 	RPacketContext::TContextConfigGPRS contextConfig;
       
  1289 	_LIT(KPdpAdd, "Some Add");
       
  1290 	contextConfig.iPdpAddress.Copy(KPdpAdd);
       
  1291 	TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);	
       
  1292 	TRequestStatus	setConfigStatus;
       
  1293 	
       
  1294 	// data for ExpectL
       
  1295 	TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(contextConfig, contextId3);
       
  1296     expExpect.SerialiseL(expectData);
       
  1297     // data for CompleteL
       
  1298     TMockLtsyData1<TInfoName > ltsyData(contextId3);
       
  1299     ltsyData.SerialiseL(data);
       
  1300 		
       
  1301 	iMockLTSY.ExpectL(EPacketContextSetConfig,expectData);				
       
  1302 	iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);	
       
  1303 	// set another PDP adddress		
       
  1304 	packetContext3.SetConfig(setConfigStatus, pckgConfig);	
       
  1305 	// wait for SetConfig
       
  1306 	User::WaitForRequest(setConfigStatus);
       
  1307 	ASSERT_EQUALS(KErrNone, setConfigStatus.Int());
       
  1308 				
       
  1309 	// ask for the third context's name
       
  1310 	index = 2;			
       
  1311 	packetService.GetContextNameInNif(requestStatus, existingContextName, index, contextName);
       
  1312 	User::WaitForRequest(requestStatus); 	
       
  1313 	AssertMockLtsyStatusL();
       
  1314 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  1315 		
       
  1316 	AssertMockLtsyStatusL();
       
  1317 	CleanupStack::PopAndDestroy(4); //packetContext3, packetContext2, packetContext, packetService
       
  1318 	CleanupStack::PopAndDestroy(3, this); // expectData, data, this		
       
  1319 	}
       
  1320 
       
  1321 
       
  1322 /**
       
  1323 @SYMTestCaseID BA-CTSY-PKTS-PSGCNIN-0003
       
  1324 @SYMPREQ 1551
       
  1325 @SYMComponent  telephony_ctsy
       
  1326 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetContextNameInNif with bad parameter data
       
  1327 @SYMTestPriority High
       
  1328 @SYMTestActions Invokes RPacketService::GetContextNameInNif with bad parameter data
       
  1329 @SYMTestExpectedResults Pass
       
  1330 @SYMTestType CT
       
  1331 */
       
  1332 void CCTsyPacketServiceFU::TestGetContextNameInNif0003L()
       
  1333 	{
       
  1334 
       
  1335 	OpenEtelServerL(EUseExtendedError);
       
  1336 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1337 	OpenPhoneL();
       
  1338 
       
  1339 	RBuf8 data;
       
  1340 	CleanupClosePushL(data);
       
  1341 	
       
  1342 	RPacketService packetService;
       
  1343 	OpenPacketServiceL(packetService);
       
  1344 	CleanupClosePushL(packetService);
       
  1345 
       
  1346 	// Open new context
       
  1347 	TInfoName contextId;	
       
  1348 	RPacketContext packetContext;
       
  1349 	packetContext.OpenNewContext(packetService, contextId);
       
  1350 	CleanupClosePushL(packetContext);
       
  1351 	//-------------------------------------------------------------------------
       
  1352 	// Test A: Test passing wrong version of parameters to
       
  1353 	// RPacketService::GetContextNameInNif
       
  1354  	//------------------------------------------------------------------------- 	
       
  1355 
       
  1356 	// -- Case with wrong existingContextName ---------------------------------
       
  1357 	TRequestStatus	requestStatus;
       
  1358 	_LIT(KWrongName, "SomeName");
       
  1359 	TBuf <0x100> existingContextName(KWrongName);	
       
  1360 	TInfoName contextName;
       
  1361 	TInt index = 0;
       
  1362 	
       
  1363 	packetService.GetContextNameInNif(requestStatus, existingContextName, index, contextName);
       
  1364 	User::WaitForRequest(requestStatus); 	
       
  1365 	AssertMockLtsyStatusL();
       
  1366 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  1367 	
       
  1368 	// -- Case with wrong index ---------------------------------
       
  1369 	existingContextName.Copy(contextId);	
       
  1370 	index = -1;
       
  1371 	
       
  1372 	packetService.GetContextNameInNif(requestStatus, existingContextName, index, contextName);
       
  1373 	User::WaitForRequest(requestStatus); 	
       
  1374 	AssertMockLtsyStatusL();
       
  1375 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  1376 	
       
  1377 	//-------------------------------------------------------------------------
       
  1378 	// Test C: Test passing out of bounds parameters to
       
  1379 	// RPacketService::GetContextNameInNif
       
  1380  	//------------------------------------------------------------------------- 
       
  1381  	
       
  1382 	// ----------- Wrong Size of fourth parameter -----------------------------
       
  1383  	existingContextName.Copy(contextId);
       
  1384 	TBuf <1> contextName2; // descriptor with wrong size
       
  1385 	index = 0;
       
  1386 	
       
  1387 	packetService.GetContextNameInNif(requestStatus, existingContextName, index, contextName2);
       
  1388 	User::WaitForRequest(requestStatus); 	
       
  1389 	AssertMockLtsyStatusL();
       
  1390 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  1391  	 	
       
  1392  	// ----------- Wrong Size of second parameter ----------------------------	
       
  1393  	_LIT(KVeryLongName, "Some_Very_Very_Very_Very_Very_Very_Very_LONG_Name");
       
  1394  	TBuf <0x100> existingContextName3(KVeryLongName);
       
  1395 	index = 0;
       
  1396 		
       
  1397 	packetService.GetContextNameInNif(requestStatus, existingContextName3, index, contextName);
       
  1398 	User::WaitForRequest(requestStatus); 	
       
  1399 	AssertMockLtsyStatusL();
       
  1400 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());		
       
  1401 	
       
  1402 	CleanupStack::PopAndDestroy(2); //packetContext, packetService
       
  1403 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1404 
       
  1405 	}
       
  1406 
       
  1407 
       
  1408 /**
       
  1409 @SYMTestCaseID BA-CTSY-PKTS-PSGCNIN-0004
       
  1410 @SYMPREQ 1551
       
  1411 @SYMComponent  telephony_ctsy
       
  1412 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetContextNameInNif
       
  1413 @SYMTestPriority High
       
  1414 @SYMTestActions Invokes multiple client requests to RPacketService::GetContextNameInNif
       
  1415 @SYMTestExpectedResults Pass
       
  1416 @SYMTestType CT
       
  1417 */
       
  1418 void CCTsyPacketServiceFU::TestGetContextNameInNif0004L()
       
  1419 	{
       
  1420 					
       
  1421 	OpenEtelServerL(EUseExtendedError);
       
  1422 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1423 	OpenPhoneL();
       
  1424 
       
  1425 	RBuf8 data;
       
  1426 	CleanupClosePushL(data);
       
  1427 
       
  1428 	// Open second client
       
  1429 	RTelServer telServer2;
       
  1430 	TInt ret = telServer2.Connect();
       
  1431 	ASSERT_EQUALS(KErrNone, ret);
       
  1432 	CleanupClosePushL(telServer2);
       
  1433 
       
  1434 	RMobilePhone phone2;
       
  1435 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  1436 	ASSERT_EQUALS(KErrNone, ret);
       
  1437 	CleanupClosePushL(phone2);
       
  1438 	
       
  1439 	RPacketService packetService;
       
  1440 	OpenPacketServiceL(packetService);
       
  1441 	CleanupClosePushL(packetService);
       
  1442 	
       
  1443 	RPacketService packetService2;                
       
  1444 	ret = packetService2.Open(phone2);
       
  1445 	ASSERT_EQUALS(KErrNone, ret);
       
  1446 	CleanupClosePushL(packetService2);
       
  1447 	
       
  1448 	
       
  1449 	// Open new context
       
  1450 	TInfoName contextId;	
       
  1451 	RPacketContext packetContext;
       
  1452 	packetContext.OpenNewContext(packetService, contextId);
       
  1453 	CleanupClosePushL(packetContext);
       
  1454 
       
  1455 	//-------------------------------------------------------------------------
       
  1456 	// Test A: Test multiple clients requesting RPacketService::GetContextNameInNif
       
  1457  	//-------------------------------------------------------------------------
       
  1458 
       
  1459 	TRequestStatus	requestStatus;
       
  1460 	TInfoName existingContextName;
       
  1461 	existingContextName.Copy(contextId);
       
  1462 	TInfoName contextName;
       
  1463 	TInt index = 0;	
       
  1464 	//send first request		
       
  1465 	packetService.GetContextNameInNif(requestStatus, existingContextName, index, contextName);
       
  1466 	
       
  1467 	TRequestStatus	requestStatus2;
       
  1468 	TInfoName contextName2;
       
  1469 	//send second request		
       
  1470 	packetService2.GetContextNameInNif(requestStatus2, existingContextName, index, contextName2);
       
  1471 	
       
  1472 	// wait for first answer	
       
  1473 	User::WaitForRequest(requestStatus); 		
       
  1474 	AssertMockLtsyStatusL();
       
  1475 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1476 	ASSERT_EQUALS(contextId, contextName);	 
       
  1477 
       
  1478 	// wait for second answer	
       
  1479 	User::WaitForRequest(requestStatus2); 		
       
  1480 	AssertMockLtsyStatusL();
       
  1481 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  1482 	ASSERT_EQUALS(contextId, contextName2);
       
  1483 	
       
  1484 	CleanupStack::PopAndDestroy(3); //packetContext, packetService2, packetService
       
  1485 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  1486 
       
  1487 	}
       
  1488 
       
  1489 
       
  1490 /**
       
  1491 @SYMTestCaseID BA-CTSY-PKTS-PSNMCC-0001
       
  1492 @SYMPREQ 1551
       
  1493 @SYMComponent  telephony_ctsy
       
  1494 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyMSClassChange
       
  1495 @SYMTestPriority High
       
  1496 @SYMTestActions Invokes RPacketService::NotifyMSClassChange
       
  1497 @SYMTestExpectedResults Pass
       
  1498 @SYMTestType CT
       
  1499 */
       
  1500 void CCTsyPacketServiceFU::TestNotifyMSClassChange0001L()
       
  1501 	{
       
  1502 
       
  1503 	OpenEtelServerL(EUseExtendedError);
       
  1504 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1505 	OpenPhoneL();
       
  1506 
       
  1507 	RBuf8 data;
       
  1508 	CleanupClosePushL(data);
       
  1509 	
       
  1510 	RPacketService packetService;
       
  1511 	OpenPacketServiceL(packetService);
       
  1512 	CleanupClosePushL(packetService);	
       
  1513 	
       
  1514 	TRequestStatus mockLtsyStatus;
       
  1515 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  1516 	
       
  1517   	//-------------------------------------------------------------------------
       
  1518 	// TEST C: Successful completion request of
       
  1519 	// RPacketService::NotifyMSClassChange when result is not cached.
       
  1520  	//-------------------------------------------------------------------------
       
  1521 
       
  1522 	// Data for CompleteL	
       
  1523 	RPacketService::TMSClass sendClass = RPacketService::EMSClassSuspensionRequired;
       
  1524 	TMockLtsyData1 < RPacketService::TMSClass > ltsyData(sendClass);
       
  1525 	ltsyData.SerialiseL(data);		
       
  1526 	
       
  1527 	TRequestStatus requestStatus;
       
  1528 	RPacketService::TMSClass msClass;
       
  1529 	//send request
       
  1530 	packetService.NotifyMSClassChange(requestStatus, msClass);
       
  1531 		
       
  1532 	// Issue the Complete...	
       
  1533 	iMockLTSY.CompleteL(EPacketNotifyMSClassChange, KErrNone, data);
       
  1534 
       
  1535 	// wait for CompleteL		
       
  1536 	User::WaitForRequest(mockLtsyStatus);
       
  1537 	
       
  1538 	// wait for request
       
  1539 	User::WaitForRequest(requestStatus);
       
  1540 	AssertMockLtsyStatusL();
       
  1541 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1542 	ASSERT_EQUALS(sendClass, msClass);
       
  1543 
       
  1544  	AssertMockLtsyStatusL();
       
  1545 	CleanupStack::PopAndDestroy(); // packetService
       
  1546 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1547 	
       
  1548 	}
       
  1549 
       
  1550 
       
  1551 /**
       
  1552 @SYMTestCaseID BA-CTSY-PKTS-PSNMCC-0002
       
  1553 @SYMPREQ 1551
       
  1554 @SYMComponent  telephony_ctsy
       
  1555 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyMSClassChange
       
  1556 @SYMTestPriority High
       
  1557 @SYMTestActions Invokes cancelling of RPacketService::NotifyMSClassChange
       
  1558 @SYMTestExpectedResults Pass
       
  1559 @SYMTestType CT
       
  1560 */
       
  1561 void CCTsyPacketServiceFU::TestNotifyMSClassChange0002L()
       
  1562 	{
       
  1563 	OpenEtelServerL(EUseExtendedError);
       
  1564 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1565 	OpenPhoneL();	
       
  1566 	
       
  1567 	RPacketService packetService;
       
  1568 	OpenPacketServiceL(packetService);
       
  1569 	CleanupClosePushL(packetService);
       
  1570 
       
  1571  	//-------------------------------------------------------------------------
       
  1572 	// Test cancelling of RPacketService::NotifyMSClassChange
       
  1573  	//-------------------------------------------------------------------------
       
  1574  	
       
  1575 	TRequestStatus requestStatus;
       
  1576 	RPacketService::TMSClass msClass;
       
  1577 
       
  1578 	packetService.NotifyMSClassChange(requestStatus, msClass);
       
  1579     packetService.CancelAsyncRequest(EPacketNotifyMSClassChange);
       
  1580     			 	
       
  1581 	User::WaitForRequest(requestStatus);
       
  1582 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
  1583 
       
  1584 	CleanupStack::PopAndDestroy(2); // packetService, this
       
  1585 	}
       
  1586 
       
  1587 
       
  1588 
       
  1589 /**
       
  1590 @SYMTestCaseID BA-CTSY-PKTS-PSNMCC-0004
       
  1591 @SYMPREQ 1551
       
  1592 @SYMComponent  telephony_ctsy
       
  1593 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyMSClassChange
       
  1594 @SYMTestPriority High
       
  1595 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyMSClassChange
       
  1596 @SYMTestExpectedResults Pass
       
  1597 @SYMTestType CT
       
  1598 */
       
  1599 void CCTsyPacketServiceFU::TestNotifyMSClassChange0004L()
       
  1600 	{
       
  1601 					
       
  1602 	OpenEtelServerL(EUseExtendedError);
       
  1603 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1604 	OpenPhoneL();
       
  1605 
       
  1606 	RBuf8 data;
       
  1607 	CleanupClosePushL(data);
       
  1608 
       
  1609 	// Open second client
       
  1610 	RTelServer telServer2;
       
  1611 	TInt ret = telServer2.Connect();
       
  1612 	ASSERT_EQUALS(KErrNone, ret);
       
  1613 	CleanupClosePushL(telServer2);
       
  1614 
       
  1615 	RMobilePhone phone2;
       
  1616 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  1617 	ASSERT_EQUALS(KErrNone, ret);
       
  1618 	CleanupClosePushL(phone2);
       
  1619 	
       
  1620 	RPacketService packetService;
       
  1621 	OpenPacketServiceL(packetService);
       
  1622 	CleanupClosePushL(packetService);
       
  1623 
       
  1624 	RPacketService packetService2;                
       
  1625 	ret = packetService2.Open(phone2);
       
  1626 	ASSERT_EQUALS(KErrNone, ret);
       
  1627 	CleanupClosePushL(packetService2);
       
  1628 
       
  1629 	//-------------------------------------------------------------------------
       
  1630 	// Test A: Test multiple clients requesting RPacketService::NotifyMSClassChange
       
  1631  	//-------------------------------------------------------------------------
       
  1632 
       
  1633 	// Data for CompleteL
       
  1634 	RPacketService::TMSClass sendClass = RPacketService::EMSClassPacketSwitchedOnly;
       
  1635 	TMockLtsyData1 < RPacketService::TMSClass > ltsyData(sendClass);
       
  1636 	ltsyData.SerialiseL(data);
       
  1637 	
       
  1638 	TRequestStatus requestStatus;
       
  1639 	RPacketService::TMSClass msClass;	
       
  1640 	// sent first request
       
  1641 	packetService.NotifyMSClassChange(requestStatus, msClass);
       
  1642 	
       
  1643 	TRequestStatus requestStatus2;
       
  1644 	RPacketService::TMSClass msClass2;
       
  1645 	// sent second request
       
  1646 	packetService2.NotifyMSClassChange(requestStatus2, msClass2);
       
  1647 	
       
  1648 	// Issue the Complete...	
       
  1649 	iMockLTSY.CompleteL(EPacketNotifyMSClassChange, KErrNone, data);	
       
  1650 		
       
  1651 	// wait for the first request
       
  1652 	User::WaitForRequest(requestStatus);		
       
  1653 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1654 	ASSERT_EQUALS(sendClass, msClass);	
       
  1655 	// wait for the second request
       
  1656 	User::WaitForRequest(requestStatus2);		
       
  1657 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  1658 	ASSERT_EQUALS(sendClass, msClass2);
       
  1659 
       
  1660 	AssertMockLtsyStatusL();
       
  1661 
       
  1662 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  1663 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  1664 
       
  1665 	}
       
  1666 
       
  1667 
       
  1668 /**
       
  1669 @SYMTestCaseID BA-CTSY-PKTS-PSGCRM-0001
       
  1670 @SYMPREQ 1551
       
  1671 @SYMComponent  telephony_ctsy
       
  1672 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetCurrentReleaseMode
       
  1673 @SYMTestPriority High
       
  1674 @SYMTestActions Invokes RPacketService::GetCurrentReleaseMode
       
  1675 @SYMTestExpectedResults Pass
       
  1676 @SYMTestType CT
       
  1677 */
       
  1678 void CCTsyPacketServiceFU::TestGetCurrentReleaseMode0001L()
       
  1679 	{
       
  1680 
       
  1681 	OpenEtelServerL(EUseExtendedError);
       
  1682 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1683 	OpenPhoneL();
       
  1684 
       
  1685 	RPacketService packetService;
       
  1686 	OpenPacketServiceL(packetService);
       
  1687 	CleanupClosePushL(packetService);
       
  1688 	
       
  1689 	// Test API is not supported
       
  1690 	TRequestStatus requestStatus;
       
  1691 	RPacketService::TPacketReleaseMode releaseMode;
       
  1692 	
       
  1693 	packetService.GetCurrentReleaseMode(requestStatus, releaseMode);
       
  1694 	User::WaitForRequest(requestStatus);			
       
  1695 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  1696 
       
  1697 	AssertMockLtsyStatusL();
       
  1698 	CleanupStack::PopAndDestroy(2, this); // packetService, this
       
  1699 	
       
  1700 	}
       
  1701 
       
  1702 
       
  1703 /**
       
  1704 @SYMTestCaseID BA-CTSY-PKTS-PSECIN-0001
       
  1705 @SYMPREQ 1551
       
  1706 @SYMComponent  telephony_ctsy
       
  1707 @SYMTestCaseDesc Test support in CTSY for RPacketService::EnumerateContextsInNif
       
  1708 @SYMTestPriority High
       
  1709 @SYMTestActions Invokes RPacketService::EnumerateContextsInNif
       
  1710 @SYMTestExpectedResults Pass
       
  1711 @SYMTestType CT
       
  1712 */
       
  1713 void CCTsyPacketServiceFU::TestEnumerateContextsInNif0001L()
       
  1714 	{
       
  1715 
       
  1716 	OpenEtelServerL(EUseExtendedError);
       
  1717 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1718 	OpenPhoneL();
       
  1719 	
       
  1720 	RBuf8 data;
       
  1721 	CleanupClosePushL(data);
       
  1722 	
       
  1723 	RPacketService packetService;
       
  1724 	OpenPacketServiceL(packetService);
       
  1725 	CleanupClosePushL(packetService);
       
  1726 	
       
  1727 	TRequestStatus requestStatus;	
       
  1728 	
       
  1729 	//-------------------------------------------------------------------------
       
  1730 	// TEST EnumerateContextsInNif without any Context
       
  1731  	//-------------------------------------------------------------------------
       
  1732 	TInt count;		
       
  1733 	TInfoName someContext(_L("SomeName"));
       
  1734 	packetService.EnumerateContextsInNif(requestStatus, someContext, count);
       
  1735 	User::WaitForRequest(requestStatus);			
       
  1736 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  1737 	ASSERT_EQUALS(0, count);	
       
  1738 		
       
  1739 	// open first context
       
  1740 	TInfoName contextId; 
       
  1741  	RPacketContext packetContext;
       
  1742  	packetContext.OpenNewContext(packetService, contextId);
       
  1743  	CleanupClosePushL(packetContext);	 	
       
  1744  	 	
       
  1745  	// open second context
       
  1746 	TInfoName contextId2; 
       
  1747  	RPacketContext packetContext2;
       
  1748  	packetContext2.OpenNewContext(packetService, contextId2);
       
  1749  	CleanupClosePushL(packetContext2);
       
  1750  	
       
  1751 	InitContextL(packetContext2, contextId2);
       
  1752     // ------- change PdpAddress for second context ---------------------------
       
  1753     RPacketContext::TContextConfigGPRS contextConfig;
       
  1754     _LIT(KPdpAdd, "Some Add");
       
  1755     contextConfig.iPdpAddress.Copy(KPdpAdd);
       
  1756     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);      
       
  1757 
       
  1758 	TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(contextConfig, contextId2);
       
  1759     expExpect.SerialiseL(data);
       
  1760     iMockLTSY.ExpectL(EPacketContextSetConfig, data);
       
  1761 
       
  1762     TMockLtsyData1<TInfoName > contexName(contextId2);
       
  1763     data.Close();
       
  1764     contexName.SerialiseL(data);        
       
  1765     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  1766 
       
  1767     packetContext2.SetConfig(requestStatus, pckgConfig);    
       
  1768 	User::WaitForRequest(requestStatus);
       
  1769 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1770 	// -------------------------------------------------------------------------
       
  1771  	
       
  1772  	// open third context
       
  1773 	TInfoName contextId3; 
       
  1774  	RPacketContext packetContext3;
       
  1775  	packetContext3.OpenNewContext(packetService, contextId3);
       
  1776  	CleanupClosePushL(packetContext3);
       
  1777  	 	
       
  1778  	//-------------------------------------------------------------------------
       
  1779 	// TEST C: Successful completion request of
       
  1780 	// RPacketService::EnumerateContextsInNif when result is not cached.
       
  1781  	//-------------------------------------------------------------------------
       
  1782 	packetService.EnumerateContextsInNif(requestStatus, contextId, count);
       
  1783 	User::WaitForRequest(requestStatus);			
       
  1784 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  1785 	ASSERT_EQUALS(2, count);	
       
  1786 
       
  1787 	AssertMockLtsyStatusL();
       
  1788 	CleanupStack::PopAndDestroy(6, this); //packetContext3, packetContext2, packetContext, packetService, data, this	
       
  1789 	}
       
  1790 
       
  1791 
       
  1792 
       
  1793 /**
       
  1794 @SYMTestCaseID BA-CTSY-PKTS-PSECIN-0003
       
  1795 @SYMPREQ 1551
       
  1796 @SYMComponent  telephony_ctsy
       
  1797 @SYMTestCaseDesc Test support in CTSY for RPacketService::EnumerateContextsInNif with bad parameter data
       
  1798 @SYMTestPriority High
       
  1799 @SYMTestActions Invokes RPacketService::EnumerateContextsInNif with bad parameter data
       
  1800 @SYMTestExpectedResults Pass
       
  1801 @SYMTestType CT
       
  1802 */
       
  1803 void CCTsyPacketServiceFU::TestEnumerateContextsInNif0003L()
       
  1804 	{
       
  1805 	OpenEtelServerL(EUseExtendedError);
       
  1806 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1807 	OpenPhoneL();
       
  1808 	
       
  1809 	RPacketService packetService;
       
  1810 	OpenPacketServiceL(packetService);
       
  1811 	CleanupClosePushL(packetService);
       
  1812 	
       
  1813 	// open new context
       
  1814 	TInfoName contextId; 
       
  1815  	RPacketContext packetContext;
       
  1816  	packetContext.OpenNewContext(packetService, contextId);
       
  1817  	CleanupClosePushL(packetContext);
       
  1818 
       
  1819 	//-------------------------------------------------------------------------
       
  1820 	// Test A: Test passing out of bounds parameters to
       
  1821 	// RPacketService::EnumerateContextsInNif
       
  1822  	//------------------------------------------------------------------------- 	
       
  1823 	TRequestStatus requestStatus;
       
  1824 	TInt count;
       
  1825  	_LIT(KLongName, "Very_very_very_very_very_very_very_very_very_very_very_LongName");
       
  1826  	TBuf <0x100> someLongName(KLongName);		
       
  1827 	// test wrong context' name
       
  1828 	packetService.EnumerateContextsInNif(requestStatus, someLongName, count);
       
  1829 	User::WaitForRequest(requestStatus);			
       
  1830 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  1831 
       
  1832 	CleanupStack::PopAndDestroy(3, this); // packetContext, packetService, this	
       
  1833 	}
       
  1834 
       
  1835 
       
  1836 /**
       
  1837 @SYMTestCaseID BA-CTSY-PKTS-PSECIN-0004
       
  1838 @SYMPREQ 1551
       
  1839 @SYMComponent  telephony_ctsy
       
  1840 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::EnumerateContextsInNif
       
  1841 @SYMTestPriority High
       
  1842 @SYMTestActions Invokes multiple client requests to RPacketService::EnumerateContextsInNif
       
  1843 @SYMTestExpectedResults Pass
       
  1844 @SYMTestType CT
       
  1845 */
       
  1846 void CCTsyPacketServiceFU::TestEnumerateContextsInNif0004L()
       
  1847 	{
       
  1848 						
       
  1849 	OpenEtelServerL(EUseExtendedError);
       
  1850 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1851 	OpenPhoneL();
       
  1852 	
       
  1853 	// Open second client
       
  1854 	RTelServer telServer2;
       
  1855 	TInt ret = telServer2.Connect();
       
  1856 	ASSERT_EQUALS(KErrNone, ret);
       
  1857 	CleanupClosePushL(telServer2);
       
  1858 
       
  1859 	RMobilePhone phone2;
       
  1860 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  1861 	ASSERT_EQUALS(KErrNone, ret);
       
  1862 	CleanupClosePushL(phone2);
       
  1863 	
       
  1864 	RPacketService packetService;
       
  1865 	OpenPacketServiceL(packetService);
       
  1866 	CleanupClosePushL(packetService);
       
  1867 	
       
  1868 	RPacketService packetService2;                
       
  1869 	ret = packetService2.Open(phone2);
       
  1870 	ASSERT_EQUALS(KErrNone, ret);
       
  1871 	CleanupClosePushL(packetService2);	
       
  1872 	
       
  1873 	// Open new context
       
  1874 	TInfoName contextId;	
       
  1875 	RPacketContext packetContext;
       
  1876 	packetContext.OpenNewContext(packetService, contextId);
       
  1877 	CleanupClosePushL(packetContext);
       
  1878 
       
  1879 	//-------------------------------------------------------------------------
       
  1880 	// Test A: Test multiple clients requesting RPacketService::EnumerateContextsInNif
       
  1881  	//-------------------------------------------------------------------------
       
  1882 	
       
  1883 	TRequestStatus requestStatus;
       
  1884 	TInt count;
       
  1885 	//send first request		
       
  1886 	packetService.EnumerateContextsInNif(requestStatus, contextId, count);
       
  1887 	
       
  1888 	TRequestStatus requestStatus2;
       
  1889 	TInt count2;
       
  1890 	//send second request		
       
  1891 	packetService2.EnumerateContextsInNif(requestStatus2, contextId, count2);
       
  1892 	
       
  1893 	// wait for first answer	
       
  1894 	User::WaitForRequest(requestStatus); 		
       
  1895 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1896 	ASSERT_EQUALS(1, count);	 
       
  1897 
       
  1898 	// wait for second answer	
       
  1899 	User::WaitForRequest(requestStatus2); 		
       
  1900 	AssertMockLtsyStatusL();
       
  1901 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  1902 	ASSERT_EQUALS(1, count2);
       
  1903 	
       
  1904 	CleanupStack::PopAndDestroy(3); //packetContext, packetService2, packetService
       
  1905 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
  1906 
       
  1907 	}
       
  1908 
       
  1909 
       
  1910 /**
       
  1911 @SYMTestCaseID BA-CTSY-PKTS-PSNAMC-0001
       
  1912 @SYMPREQ 1551
       
  1913 @SYMComponent  telephony_ctsy
       
  1914 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyAttachModeChange
       
  1915 @SYMTestPriority High
       
  1916 @SYMTestActions Invokes RPacketService::NotifyAttachModeChange
       
  1917 @SYMTestExpectedResults Pass
       
  1918 @SYMTestType CT
       
  1919 */
       
  1920 void CCTsyPacketServiceFU::TestNotifyAttachModeChange0001L()
       
  1921 	{
       
  1922 
       
  1923 	OpenEtelServerL(EUseExtendedError);
       
  1924 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1925 	OpenPhoneL();
       
  1926 
       
  1927 	RBuf8 data;
       
  1928 	CleanupClosePushL(data);
       
  1929 
       
  1930 	RPacketService packetService;		
       
  1931 	// Open PacketService
       
  1932 	OpenPacketServiceL(packetService);
       
  1933 	CleanupClosePushL(packetService); 
       
  1934 
       
  1935 	// Post request
       
  1936 	TRequestStatus requestStatus;
       
  1937 	RPacketService::TAttachMode attachMode;		
       
  1938 		
       
  1939 	// check that this request isn't supported by CTSY
       
  1940 	packetService.NotifyAttachModeChange(requestStatus, attachMode);
       
  1941 	
       
  1942 	User::WaitForRequest(requestStatus);	
       
  1943 	AssertMockLtsyStatusL();
       
  1944 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  1945 
       
  1946 	AssertMockLtsyStatusL();
       
  1947 	CleanupStack::PopAndDestroy(); //packetService
       
  1948 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1949 	
       
  1950 	}
       
  1951 
       
  1952 
       
  1953 /**
       
  1954 @SYMTestCaseID BA-CTSY-PKTS-PSGDCP-0001
       
  1955 @SYMPREQ 1551
       
  1956 @SYMComponent  telephony_ctsy
       
  1957 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetDefaultContextParams
       
  1958 @SYMTestPriority High
       
  1959 @SYMTestActions Invokes RPacketService::GetDefaultContextParams
       
  1960 @SYMTestExpectedResults Pass
       
  1961 @SYMTestType CT
       
  1962 */
       
  1963 void CCTsyPacketServiceFU::TestGetDefaultContextParams0001L()
       
  1964 	{
       
  1965 
       
  1966 	OpenEtelServerL(EUseExtendedError);
       
  1967 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1968 	OpenPhoneL();
       
  1969 
       
  1970 	RPacketService packetService;
       
  1971 	OpenPacketServiceL(packetService);
       
  1972 	CleanupClosePushL(packetService);
       
  1973 	
       
  1974 	TRequestStatus requestStatus;
       
  1975 	RPacketContext::TContextConfigGPRS packetData;
       
  1976 	TPckg <RPacketContext::TContextConfigGPRS> pckg(packetData);		
       
  1977 
       
  1978     // -----------------------------------------------------------------------
       
  1979     // Send request, when there is no DefaultContextParams in CTSY
       
  1980     // -----------------------------------------------------------------------    	
       
  1981 	packetService.GetDefaultContextParams(requestStatus, pckg);
       
  1982 	User::WaitForRequest(requestStatus);
       
  1983 	AssertMockLtsyStatusL();
       
  1984 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());			 	
       
  1985 
       
  1986  	//-------------------------------------------------------------------------
       
  1987 	// TEST C1: Successful completion request of
       
  1988 	// RPacketService::GetDefaultContextParams when result is not cached
       
  1989  	//-------------------------------------------------------------------------
       
  1990 	TRequestStatus mockLtsyStatus;
       
  1991 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1992 	// generate completion
       
  1993 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);
       
  1994 	User::WaitForRequest(mockLtsyStatus); 
       
  1995 	
       
  1996 	packetService.GetDefaultContextParams(requestStatus, pckg);
       
  1997 	User::WaitForRequest(requestStatus);
       
  1998 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1999 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, pckg().iPdpType);
       
  2000 	ASSERT_EQUALS((TUint)0, pckg().iPdpCompression);	
       
  2001 	AssertMockLtsyStatusL();
       
  2002 	
       
  2003 	//-------------------------------------------------------------------------
       
  2004 	// TEST C2: Successful completion request of
       
  2005 	// RPacketService::GetDefaultContextParams when result is not cached
       
  2006  	//-------------------------------------------------------------------------
       
  2007 	RPacketContext::TContextConfigR99_R4 packetData2;
       
  2008 	TPckg <RPacketContext::TContextConfigR99_R4> pckg2(packetData2);
       
  2009 	
       
  2010 	packetService.GetDefaultContextParams(requestStatus, pckg2);
       
  2011 	User::WaitForRequest(requestStatus);
       
  2012 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2013 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, pckg().iPdpType);
       
  2014 	ASSERT_EQUALS((TUint)0, pckg().iPdpCompression);	
       
  2015 	AssertMockLtsyStatusL();
       
  2016 	
       
  2017 	
       
  2018 	//-------------------------------------------------------------------------
       
  2019 	// TEST C3: Successful completion request of
       
  2020 	// RPacketService::GetDefaultContextParams when result is not cached
       
  2021  	//-------------------------------------------------------------------------
       
  2022 	RPacketContext::TContextConfig_R5 packetData3;
       
  2023 	TPckg <RPacketContext::TContextConfig_R5> pckg3(packetData3);
       
  2024 	
       
  2025 	packetService.GetDefaultContextParams(requestStatus, pckg3);
       
  2026 	User::WaitForRequest(requestStatus);
       
  2027 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2028 	AssertMockLtsyStatusL();	
       
  2029 	
       
  2030 	CleanupStack::PopAndDestroy(2, this); // packetService, this	
       
  2031 	}
       
  2032 
       
  2033 
       
  2034 /**
       
  2035 @SYMTestCaseID BA-CTSY-PKTS-PSGDCP-0003
       
  2036 @SYMPREQ 1551
       
  2037 @SYMComponent  telephony_ctsy
       
  2038 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetDefaultContextParams with bad parameter data
       
  2039 @SYMTestPriority High
       
  2040 @SYMTestActions Invokes RPacketService::GetDefaultContextParams with bad parameter data
       
  2041 @SYMTestExpectedResults Pass
       
  2042 @SYMTestType CT
       
  2043 */
       
  2044 void CCTsyPacketServiceFU::TestGetDefaultContextParams0003L()
       
  2045 	{
       
  2046 	OpenEtelServerL(EUseExtendedError);
       
  2047 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2048 	OpenPhoneL();
       
  2049 
       
  2050 	RPacketService packetService;
       
  2051 	OpenPacketServiceL(packetService);
       
  2052 	CleanupClosePushL(packetService);
       
  2053 	
       
  2054 	TRequestStatus requestStatus;
       
  2055 	TPacketDataConfigBase packetData;
       
  2056 	TPckg <TPacketDataConfigBase> pckg(packetData);		
       
  2057 
       
  2058     //-------------------------------------------------------------------------
       
  2059 	// Test A: Test passing wrong version of parameters to
       
  2060 	// RPacketService::GetDefaultContextParams
       
  2061  	//-------------------------------------------------------------------------
       
  2062 	TRequestStatus mockLtsyStatus;
       
  2063 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2064 	// generate completion
       
  2065 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);
       
  2066 	User::WaitForRequest(mockLtsyStatus); 
       
  2067 	
       
  2068 	packetService.GetDefaultContextParams(requestStatus, pckg);
       
  2069 	User::WaitForRequest(requestStatus);
       
  2070 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2071 
       
  2072 	AssertMockLtsyStatusL();
       
  2073 	CleanupStack::PopAndDestroy(2, this); // packetService, this
       
  2074 	}
       
  2075 
       
  2076 
       
  2077 /**
       
  2078 @SYMTestCaseID BA-CTSY-PKTS-PSGDCP-0004
       
  2079 @SYMPREQ 1551
       
  2080 @SYMComponent  telephony_ctsy
       
  2081 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetDefaultContextParams
       
  2082 @SYMTestPriority High
       
  2083 @SYMTestActions Invokes multiple client requests to RPacketService::GetDefaultContextParams
       
  2084 @SYMTestExpectedResults Pass
       
  2085 @SYMTestType CT
       
  2086 */
       
  2087 void CCTsyPacketServiceFU::TestGetDefaultContextParams0004L()
       
  2088 	{
       
  2089 					
       
  2090 	OpenEtelServerL(EUseExtendedError);
       
  2091 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2092 	OpenPhoneL();
       
  2093 	
       
  2094 	// Open second client
       
  2095 	RTelServer telServer2;
       
  2096 	TInt ret = telServer2.Connect();
       
  2097 	ASSERT_EQUALS(KErrNone, ret);
       
  2098 	CleanupClosePushL(telServer2);
       
  2099 
       
  2100 	RMobilePhone phone2;
       
  2101 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  2102 	ASSERT_EQUALS(KErrNone, ret);
       
  2103 	CleanupClosePushL(phone2);
       
  2104 	
       
  2105 	RPacketService packetService;
       
  2106 	OpenPacketServiceL(packetService);
       
  2107 	CleanupClosePushL(packetService);
       
  2108 
       
  2109 	RPacketService packetService2;                
       
  2110 	ret = packetService2.Open(phone2);
       
  2111 	ASSERT_EQUALS(KErrNone, ret);
       
  2112 	CleanupClosePushL(packetService2);
       
  2113 
       
  2114 	//-------------------------------------------------------------------------
       
  2115 	// Test A: Test multiple clients requesting RPacketService::GetDefaultContextParams
       
  2116  	//-------------------------------------------------------------------------
       
  2117 
       
  2118 	// data for first request
       
  2119 	TRequestStatus requestStatus;
       
  2120 	RPacketContext::TContextConfigGPRS packetData;
       
  2121 	TPckg <RPacketContext::TContextConfigGPRS> pckg(packetData);
       
  2122 	
       
  2123 	// data for second request
       
  2124 	TRequestStatus requestStatus2;
       
  2125 	RPacketContext::TContextConfigR99_R4 packetData2;
       
  2126 	TPckg <RPacketContext::TContextConfigR99_R4> pckg2(packetData2);
       
  2127 		
       
  2128 	TRequestStatus mockLtsyStatus;
       
  2129 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2130 	// generate completion
       
  2131 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);
       
  2132 	User::WaitForRequest(mockLtsyStatus); 
       
  2133 		
       
  2134 	// send first request 
       
  2135 	packetService.GetDefaultContextParams(requestStatus, pckg);
       
  2136 	
       
  2137 	// send second request 
       
  2138 	packetService2.GetDefaultContextParams(requestStatus2, pckg2);
       
  2139 	
       
  2140 	// wait for first answer
       
  2141 	User::WaitForRequest(requestStatus);
       
  2142 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2143 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, pckg().iPdpType);
       
  2144 	ASSERT_EQUALS((TUint)0, pckg().iPdpCompression);
       
  2145 	
       
  2146 	// wait for second answer
       
  2147 	User::WaitForRequest(requestStatus2);
       
  2148 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());	
       
  2149 	ASSERT_EQUALS(RPacketContext::EPdpTypeIPv4, pckg2().iPdpType);
       
  2150 
       
  2151 	CleanupStack::PopAndDestroy(2); // packetService2, packetService
       
  2152 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
  2153 
       
  2154 	}
       
  2155 
       
  2156 /**
       
  2157 @SYMTestCaseID BA-CTSY-PKTS-PSNDCC-0001
       
  2158 @SYMPREQ 1551
       
  2159 @SYMComponent  telephony_ctsy
       
  2160 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyDynamicCapsChange
       
  2161 @SYMTestPriority High
       
  2162 @SYMTestActions Invokes RPacketService::NotifyDynamicCapsChange
       
  2163 @SYMTestExpectedResults Pass
       
  2164 @SYMTestType CT
       
  2165 */
       
  2166 void CCTsyPacketServiceFU::TestNotifyDynamicCapsChange0001L()
       
  2167 	{
       
  2168 
       
  2169 	OpenEtelServerL(EUseExtendedError);
       
  2170 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2171 	OpenPhoneL();
       
  2172 
       
  2173 	RBuf8 data;
       
  2174 	CleanupClosePushL(data);
       
  2175 	
       
  2176 	RPacketService packetService;
       
  2177 	OpenPacketServiceL(packetService);
       
  2178 	CleanupClosePushL(packetService);
       
  2179 	
       
  2180 	// Open new context
       
  2181 	TInfoName contextId;	
       
  2182 	RPacketContext packetContext;
       
  2183 	packetContext.OpenNewContext(packetService, contextId);
       
  2184 	CleanupClosePushL(packetContext);
       
  2185 	
       
  2186   	//-------------------------------------------------------------------------
       
  2187 	// TEST C: Successful completion request of
       
  2188 	// RPacketService::NotifyDynamicCapsChange when result is not cached.
       
  2189 	// using  CMmPacketServiceGsmWcdmaExt::CompleteDynamicCapsChange function	
       
  2190  	//-------------------------------------------------------------------------	
       
  2191 	// data for CompleteL	
       
  2192 	TBool gprsIsSupportedOnCell = EFalse;
       
  2193 	TBool csServicesIsSupportedOnCell = ETrue;
       
  2194 	TMockLtsyData2 <TBool, TBool> ltsyData(gprsIsSupportedOnCell, csServicesIsSupportedOnCell);
       
  2195 	ltsyData.SerialiseL(data);	
       
  2196 			
       
  2197 	TRequestStatus requestStatus;
       
  2198 	RPacketService::TDynamicCapsFlags caps;
       
  2199 	//send request
       
  2200 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2201 	
       
  2202 	// Issue the Complete...	
       
  2203 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);
       
  2204 		
       
  2205 	User::WaitForRequest(requestStatus);
       
  2206 	AssertMockLtsyStatusL();
       
  2207 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2208 	ASSERT_EQUALS((TUint)RPacketService::KCapsRxCSCall, caps);
       
  2209 
       
  2210 	
       
  2211 	//-------------------------------------------------------------------------
       
  2212 	// TEST C: Successful completion request of
       
  2213 	// RPacketService::NotifyDynamicCapsChange when result is not cached.
       
  2214 	// using  CMmPacketServiceGsmWcdmaExt::SetDynamicCapsFlag function	
       
  2215  	//-------------------------------------------------------------------------	
       
  2216 	RPacketContext::TContextConfigGPRS contextConfig;
       
  2217 	TMockLtsyData2< TInfoName, RPacketContext::TContextConfigGPRS > ltsyData1(contextId, contextConfig);
       
  2218 	data.Close();
       
  2219 	ltsyData1.SerialiseL(data);
       
  2220 				
       
  2221 	//send request
       
  2222 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2223 	
       
  2224 	// Issue the Complete...	
       
  2225 	iMockLTSY.CompleteL(EPacketContextActivate, KErrGeneral, data);
       
  2226 		
       
  2227 	User::WaitForRequest(requestStatus);
       
  2228 	AssertMockLtsyStatusL();
       
  2229 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2230 	ASSERT_EQUALS((TUint)(RPacketService::KCapsRxCSCall | RPacketService::KCapsActivate), caps);		
       
  2231 
       
  2232  	//-------------------------------------------------------------------------
       
  2233 	// TEST C: Successful completion request of
       
  2234 	// RPacketService::NotifyDynamicCapsChange when result is not cached.
       
  2235 	// using  CMmPacketServiceGsmWcdmaExt::CompleteTransferCapsChange	
       
  2236  	//-------------------------------------------------------------------------	
       
  2237 	TDynamicTransferCapsFlags transferCaps = KCapsHSDPA;
       
  2238 	TMockLtsyData1< TDynamicTransferCapsFlags > ltsyData2(transferCaps);
       
  2239 	data.Close();
       
  2240 	ltsyData2.SerialiseL(data);
       
  2241 				
       
  2242 	//send request
       
  2243 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2244 	
       
  2245 	// Issue the Complete...	
       
  2246 	iMockLTSY.CompleteL(EPacketNotifyTransferCapsIPC, KErrNone, data);
       
  2247 		
       
  2248 	User::WaitForRequest(requestStatus);
       
  2249 	AssertMockLtsyStatusL();
       
  2250 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2251 	ASSERT_EQUALS((TUint) (RPacketService::KCapsRxCSCall |
       
  2252 						   RPacketService::KCapsActivate | 
       
  2253 						   RPacketService::KCapsHSDPA), caps);		
       
  2254 
       
  2255  	AssertMockLtsyStatusL();
       
  2256 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
  2257 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  2258 		
       
  2259 	}
       
  2260 	
       
  2261 	
       
  2262 /**
       
  2263 @SYMTestCaseID BA-CTSY-PKTS-PSNDCC-0001b
       
  2264 @SYMPREQ 1551
       
  2265 @SYMComponent  telephony_ctsy
       
  2266 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyDynamicCapsChange with different RPacketService status
       
  2267 @SYMTestPriority High
       
  2268 @SYMTestActions Invokes RPacketService::NotifyDynamicCapsChange
       
  2269 @SYMTestExpectedResults Pass
       
  2270 @SYMTestType CT
       
  2271 */
       
  2272 void CCTsyPacketServiceFU::TestNotifyDynamicCapsChange0001bL()
       
  2273 	{
       
  2274 
       
  2275 	OpenEtelServerL(EUseExtendedError);
       
  2276 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2277 	OpenPhoneL();
       
  2278 
       
  2279 	RBuf8 data;
       
  2280 	CleanupClosePushL(data);
       
  2281 	
       
  2282 	RPacketService packetService;
       
  2283 	OpenPacketServiceL(packetService);
       
  2284 	CleanupClosePushL(packetService);
       
  2285 	
       
  2286 	// Open new context
       
  2287 	TInfoName contextId;	
       
  2288 	RPacketContext packetContext;
       
  2289 	packetContext.OpenNewContext(packetService, contextId);
       
  2290 	CleanupClosePushL(packetContext);
       
  2291 	
       
  2292   	//-------------------------------------------------------------------------
       
  2293 	// TEST Successful completion request of
       
  2294 	// RPacketService::NotifyDynamicCapsChange when result is not cached.
       
  2295 	// using  CMmPacketServiceGsmWcdmaExt::CompleteDynamicCapsChange function
       
  2296 	// with  different RPacketService status  	
       
  2297  	//-------------------------------------------------------------------------	
       
  2298  	 
       
  2299  	// Change RPacketService status  to RPacketService::EStatusAttached 		
       
  2300 	RPacketService::TStatus sendStatus = RPacketService::EStatusAttached;
       
  2301 	TBool isResumed = EFalse;	
       
  2302 	TInt err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
  2303 	ASSERT_EQUALS(KErrNone, err);	
       
  2304  	
       
  2305 	// data for CompleteL	
       
  2306 	TBool gprsIsSupportedOnCell = ETrue;
       
  2307 	TBool csServicesIsSupportedOnCell = ETrue;	
       
  2308 	TMockLtsyData2 <TBool, TBool> ltsyData1_2(gprsIsSupportedOnCell, csServicesIsSupportedOnCell);
       
  2309 	ltsyData1_2.SerialiseL(data);	
       
  2310 			
       
  2311 	//send request
       
  2312 	TRequestStatus requestStatus;
       
  2313 	RPacketService::TDynamicCapsFlags caps;
       
  2314 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2315 	
       
  2316 	// Issue the Complete...	
       
  2317 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);
       
  2318 		
       
  2319 	User::WaitForRequest(requestStatus);
       
  2320 	AssertMockLtsyStatusL();
       
  2321 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2322 	// Prepare sampleCaps
       
  2323 	TUint sampleCaps = 0;  // expected caps from CTSY
       
  2324 	// Deativate KCapsManualAttach in dynamicCaps 
       
  2325     sampleCaps &= ~RPacketService::KCapsManualAttach;
       
  2326     // Activate KCapsSMSTransfer, KCapsManualDetach and
       
  2327     // KCapsRxContextActivationReq in dynamicCaps 
       
  2328     sampleCaps |= RPacketService::KCapsSMSTransfer |
       
  2329                    RPacketService::KCapsManualDetach |
       
  2330                    RPacketService::KCapsRxContextActivationReq;	                   
       
  2331     sampleCaps |= RPacketService::KCapsRxCSCall;
       
  2332     		
       
  2333 	ASSERT_EQUALS(sampleCaps, caps);
       
  2334 	
       
  2335 	
       
  2336 	//-------------------------------------------------------------------------		
       
  2337 	// Change RPacketService status  to RPacketService::EStatusSuspended 		
       
  2338 	sendStatus = RPacketService::EStatusSuspended;
       
  2339 	isResumed = EFalse;	
       
  2340 	err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
  2341 	ASSERT_EQUALS(KErrNone, err);	
       
  2342 	
       
  2343 	//send request
       
  2344 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2345 	
       
  2346 	// Issue the Complete...	
       
  2347 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);			
       
  2348 	User::WaitForRequest(requestStatus);
       
  2349 	AssertMockLtsyStatusL();
       
  2350 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2351 	// Prepare sampleCaps	
       
  2352 	sampleCaps = 0;  // expected caps from CTSY
       
  2353 	sampleCaps |= RPacketService::KCapsManualDetach;      
       
  2354     // Deativate KCapsSMSTransfer, KCapsManualAttach and
       
  2355     // KCapsRxContextActivationReq in dynamicCaps 
       
  2356     sampleCaps &= ~( RPacketService::KCapsSMSTransfer |
       
  2357     				 RPacketService::KCapsManualAttach |
       
  2358     				 RPacketService::KCapsRxContextActivationReq );  				   
       
  2359 	sampleCaps |= RPacketService::KCapsRxCSCall;
       
  2360 	ASSERT_EQUALS(sampleCaps, caps);	
       
  2361 	 
       
  2362 	 
       
  2363 	//-------------------------------------------------------------------------
       
  2364 	// change RPacketService status  to RPacketService::EStatusActive
       
  2365 	// to check status changing after status EStatusSuspended	
       
  2366 	sendStatus = RPacketService::EStatusActive;
       
  2367 	isResumed = EFalse;	
       
  2368 	err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
  2369 	ASSERT_EQUALS(KErrNone, err);
       
  2370 	
       
  2371 	// and issue completition
       
  2372 	TRequestStatus mockLtsyStatus;
       
  2373 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2374 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);
       
  2375 	User::WaitForRequest(mockLtsyStatus);
       
  2376 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2377 	
       
  2378 				
       
  2379 	//-------------------------------------------------------------------------			
       
  2380 	// Now Change RPacketService status  to RPacketService::EStatusUnattached 		
       
  2381 	sendStatus = RPacketService::EStatusUnattached;
       
  2382 	isResumed = EFalse;		
       
  2383 	err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
  2384 	ASSERT_EQUALS(KErrNone, err);	
       
  2385 	
       
  2386 	//send request
       
  2387 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2388 	
       
  2389 	// Issue the Complete...	
       
  2390 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);			
       
  2391 	User::WaitForRequest(requestStatus);
       
  2392 	AssertMockLtsyStatusL();
       
  2393 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2394 	// Prepare sampleCaps		
       
  2395 	sampleCaps = 0;  // expected caps from CTSY
       
  2396 	sampleCaps |= RPacketService::KCapsManualAttach;
       
  2397     sampleCaps &= ~( RPacketService::KCapsSMSTransfer |
       
  2398                      RPacketService::KCapsManualDetach |
       
  2399                      RPacketService::KCapsRxContextActivationReq ); 				   
       
  2400 	sampleCaps |= RPacketService::KCapsRxCSCall;
       
  2401 	ASSERT_EQUALS(sampleCaps, caps);
       
  2402 	
       
  2403 	
       
  2404 	
       
  2405 	//-------------------------------------------------------------------------		
       
  2406 	// Change Context status to Active
       
  2407 	SetContextActiveL(contextId);	
       
  2408 	// Change RPacketService status  to RPacketService::EStatusActive 		
       
  2409 	sendStatus = RPacketService::EStatusActive;
       
  2410 	isResumed = EFalse;	
       
  2411 	err = SetPacketServiceStatusL(sendStatus, isResumed);	
       
  2412 	ASSERT_EQUALS(KErrNone, err);	
       
  2413 	
       
  2414 	//send request
       
  2415 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2416 	
       
  2417 	// Issue the Complete...	
       
  2418 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);			
       
  2419 	User::WaitForRequest(requestStatus);
       
  2420 	AssertMockLtsyStatusL();
       
  2421 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2422 	// Prepare sampleCaps
       
  2423 	sampleCaps = 0;  // expected caps from CTSY
       
  2424 	// Deativate KCapsManualAttach in dynamicCaps 
       
  2425     sampleCaps &= ~RPacketService::KCapsManualAttach;
       
  2426     sampleCaps |= RPacketService::KCapsSMSTransfer |
       
  2427                    RPacketService::KCapsManualDetach |
       
  2428                    RPacketService::KCapsRxContextActivationReq;	
       
  2429 	sampleCaps |= RPacketService::KCapsRxCSCall;                     
       
  2430 	ASSERT_EQUALS(sampleCaps, caps);	
       
  2431 	
       
  2432 	
       
  2433 	//-------------------------------------------------------------------------
       
  2434 	// TEST  Successful completion request of
       
  2435 	// RPacketService::NotifyDynamicCapsChange when result is not cached.
       
  2436 	// using  CMmPacketServiceGsmWcdmaExt::CompleteTransferCapsChange
       
  2437 	// with different params	
       
  2438  	//-------------------------------------------------------------------------	
       
  2439 	TDynamicTransferCapsFlags transferCaps = KCapsEGPRS;
       
  2440 	TMockLtsyData1< TDynamicTransferCapsFlags > ltsyData2(transferCaps);
       
  2441 	data.Close();
       
  2442 	ltsyData2.SerialiseL(data);
       
  2443 				
       
  2444 	//send request
       
  2445 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2446 	
       
  2447 	// Issue the Complete...	
       
  2448 	iMockLTSY.CompleteL(EPacketNotifyTransferCapsIPC, KErrNone, data);
       
  2449 		
       
  2450 	User::WaitForRequest(requestStatus);
       
  2451 	AssertMockLtsyStatusL();
       
  2452 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2453 	// Prepare sampleCaps
       
  2454     sampleCaps &= ~RPacketService::KCapsHSDPA;
       
  2455     sampleCaps |= RPacketService::KCapsRxCSCall |
       
  2456                   RPacketService::KCapsRxContextActivationReq;                  
       
  2457     sampleCaps |= RPacketService::KCapsEGPRS;   
       
  2458 	ASSERT_EQUALS(sampleCaps, caps);		
       
  2459 	
       
  2460 	//-------------------Issue the same Complete to increase coverage... -------------------
       
  2461 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2462 	iMockLTSY.CompleteL(EPacketNotifyTransferCapsIPC, KErrNone, data);
       
  2463 	User::WaitForRequest(mockLtsyStatus);
       
  2464 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2465 	
       
  2466 	
       
  2467  	AssertMockLtsyStatusL();
       
  2468 	CleanupStack::PopAndDestroy(2); // packetContext, packetService
       
  2469 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  2470 		
       
  2471 	}
       
  2472 
       
  2473 /**
       
  2474 @SYMTestCaseID BA-CTSY-PKTS-PSNDCC-0001c
       
  2475 @SYMPREQ 1551
       
  2476 @SYMComponent  telephony_ctsy
       
  2477 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyDynamicCapsChange (HSUPA)
       
  2478 @SYMTestPriority High
       
  2479 @SYMTestActions Invokes RPacketService::NotifyDynamicCapsChange
       
  2480 @SYMTestExpectedResults Pass
       
  2481 @SYMTestType CT
       
  2482 */
       
  2483 void CCTsyPacketServiceFU::TestNotifyDynamicCapsChange0001cL()
       
  2484 	{
       
  2485 	
       
  2486 	OpenEtelServerL(EUseExtendedError);
       
  2487 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2488 	OpenPhoneL();
       
  2489 
       
  2490 	RBuf8 data;
       
  2491 	CleanupClosePushL(data);
       
  2492 
       
  2493     RPacketService packetService;       
       
  2494     OpenPacketServiceL(packetService);
       
  2495     CleanupClosePushL(packetService); 
       
  2496     
       
  2497     TDynamicTransferCapsFlags transferCaps = KCapsHSDPA;
       
  2498 	TMockLtsyData1< TDynamicTransferCapsFlags > ltsyData(transferCaps);
       
  2499 	data.Close();
       
  2500 	ltsyData.SerialiseL(data);
       
  2501 	
       
  2502 	// Send complete from LTSY before Notify request
       
  2503 	TRequestStatus mockLtsyStatus;	
       
  2504 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2505 	iMockLTSY.CompleteL(EPacketNotifyTransferCapsIPC, KErrNone, data);
       
  2506 	User::WaitForRequest(mockLtsyStatus);
       
  2507 	
       
  2508 	// Send notify request
       
  2509 	RPacketService::TDynamicCapsFlags caps;
       
  2510     TRequestStatus requestStatus;
       
  2511     packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2512 	
       
  2513 	// Change caps
       
  2514 	transferCaps = KCapsHSDPA | KCapsHSUPA;
       
  2515 	TMockLtsyData1< TDynamicTransferCapsFlags > ltsyData2(transferCaps);
       
  2516 	data.Close();
       
  2517 	ltsyData2.SerialiseL(data);
       
  2518 	iMockLTSY.CompleteL(EPacketNotifyTransferCapsIPC, KErrNone, data);	
       
  2519     
       
  2520     User::WaitForRequest(requestStatus);
       
  2521 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2522 	
       
  2523 	const RPacketService::TDynamicCapsFlags KHsdpa(RPacketService::KCapsHSDPA);
       
  2524     const RPacketService::TDynamicCapsFlags KHsupa(RPacketService::KCapsHSUPA);
       
  2525     ASSERT_EQUALS(KHsdpa | KHsupa, caps);
       
  2526     
       
  2527     AssertMockLtsyStatusL();
       
  2528     
       
  2529 	CleanupStack::PopAndDestroy(3); // packetService, data, this
       
  2530 	}
       
  2531 
       
  2532 /**
       
  2533 @SYMTestCaseID BA-CTSY-PKTS-PSNDCC-0002
       
  2534 @SYMPREQ 1551
       
  2535 @SYMComponent  telephony_ctsy
       
  2536 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyDynamicCapsChange
       
  2537 @SYMTestPriority High
       
  2538 @SYMTestActions Invokes cancelling of RPacketService::NotifyDynamicCapsChange
       
  2539 @SYMTestExpectedResults Pass
       
  2540 @SYMTestType CT
       
  2541 */
       
  2542 void CCTsyPacketServiceFU::TestNotifyDynamicCapsChange0002L()
       
  2543 	{
       
  2544 	OpenEtelServerL(EUseExtendedError);
       
  2545 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2546 	OpenPhoneL();
       
  2547 
       
  2548 	RPacketService packetService;
       
  2549 	OpenPacketServiceL(packetService);
       
  2550 	CleanupClosePushL(packetService);
       
  2551 	
       
  2552  	//-------------------------------------------------------------------------
       
  2553 	// Test cancelling of RPacketService::NotifyDynamicCapsChange
       
  2554  	//------------------------------------------------------------------------- 	
       
  2555 			
       
  2556 	TRequestStatus requestStatus;
       
  2557 	RPacketService::TDynamicCapsFlags caps;
       
  2558 
       
  2559 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2560 	packetService.CancelAsyncRequest(EPacketNotifyDynamicCapsChange);
       
  2561 			
       
  2562 	User::WaitForRequest(requestStatus);
       
  2563 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
  2564 
       
  2565 	AssertMockLtsyStatusL();
       
  2566 	CleanupStack::PopAndDestroy(2); // packetService, this	
       
  2567 	}
       
  2568 
       
  2569 
       
  2570 
       
  2571 /**
       
  2572 @SYMTestCaseID BA-CTSY-PKTS-PSNDCC-0004
       
  2573 @SYMPREQ 1551
       
  2574 @SYMComponent  telephony_ctsy
       
  2575 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyDynamicCapsChange
       
  2576 @SYMTestPriority High
       
  2577 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyDynamicCapsChange
       
  2578 @SYMTestExpectedResults Pass
       
  2579 @SYMTestType CT
       
  2580 */
       
  2581 void CCTsyPacketServiceFU::TestNotifyDynamicCapsChange0004L()
       
  2582 	{
       
  2583 					
       
  2584 	OpenEtelServerL(EUseExtendedError);
       
  2585 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2586 	OpenPhoneL();
       
  2587 
       
  2588 	RBuf8 data;
       
  2589 	CleanupClosePushL(data);
       
  2590 
       
  2591 	// Open second client
       
  2592 	RTelServer telServer2;
       
  2593 	TInt ret = telServer2.Connect();
       
  2594 	ASSERT_EQUALS(KErrNone, ret);
       
  2595 	CleanupClosePushL(telServer2);
       
  2596 
       
  2597 	RMobilePhone phone2;
       
  2598 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  2599 	ASSERT_EQUALS(KErrNone, ret);
       
  2600 	CleanupClosePushL(phone2);
       
  2601 	
       
  2602 	RPacketService packetService;
       
  2603 	OpenPacketServiceL(packetService);
       
  2604 	CleanupClosePushL(packetService);
       
  2605 
       
  2606 	RPacketService packetService2;                
       
  2607 	ret = packetService2.Open(phone2);
       
  2608 	ASSERT_EQUALS(KErrNone, ret);
       
  2609 	CleanupClosePushL(packetService2);
       
  2610 
       
  2611 	//-------------------------------------------------------------------------
       
  2612 	// Test A: Test multiple clients requesting RPacketService::NotifyDynamicCapsChange
       
  2613  	//-------------------------------------------------------------------------
       
  2614 	
       
  2615 	// data for CompleteL	
       
  2616 	TBool gprsIsSupportedOnCell = ETrue;
       
  2617 	TBool csServicesIsSupportedOnCell = EFalse;
       
  2618 	TMockLtsyData2 <TBool, TBool> ltsyData(gprsIsSupportedOnCell, csServicesIsSupportedOnCell);
       
  2619 	ltsyData.SerialiseL(data);	
       
  2620 			
       
  2621 	// data for first request	
       
  2622 	TRequestStatus requestStatus;
       
  2623 	RPacketService::TDynamicCapsFlags caps;
       
  2624 	
       
  2625 	// data for second request	
       
  2626 	TRequestStatus requestStatus2;
       
  2627 	RPacketService::TDynamicCapsFlags caps2;
       
  2628 	
       
  2629 	packetService.NotifyDynamicCapsChange(requestStatus, caps);
       
  2630 	packetService2.NotifyDynamicCapsChange(requestStatus2, caps2);
       
  2631 	
       
  2632 	// Issue the Complete...	
       
  2633 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);
       
  2634 		
       
  2635 	// wait for first answer
       
  2636 	User::WaitForRequest(requestStatus);
       
  2637 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2638 	ASSERT_EQUALS((TUint)RPacketService::KCapsManualAttach, caps);
       
  2639 	
       
  2640 	// wait for second answer
       
  2641 	User::WaitForRequest(requestStatus2);
       
  2642 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());	
       
  2643 	ASSERT_EQUALS((TUint)RPacketService::KCapsManualAttach, caps2);
       
  2644 
       
  2645 	AssertMockLtsyStatusL();
       
  2646 	CleanupStack::PopAndDestroy(2); // packetService2, packetService
       
  2647 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  2648 
       
  2649 	}
       
  2650 
       
  2651 
       
  2652 /**
       
  2653 @SYMTestCaseID BA-CTSY-PKTS-PSNRMC-0001
       
  2654 @SYMPREQ 1551
       
  2655 @SYMComponent  telephony_ctsy
       
  2656 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyReleaseModeChange
       
  2657 @SYMTestPriority High
       
  2658 @SYMTestActions Invokes RPacketService::NotifyReleaseModeChange
       
  2659 @SYMTestExpectedResults Pass
       
  2660 @SYMTestType CT
       
  2661 */
       
  2662 void CCTsyPacketServiceFU::TestNotifyReleaseModeChange0001L()
       
  2663 	{
       
  2664 
       
  2665 	OpenEtelServerL(EUseExtendedError);
       
  2666 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2667 	OpenPhoneL();
       
  2668 	
       
  2669 	RBuf8 data;
       
  2670 	CleanupClosePushL(data);
       
  2671 	
       
  2672 	RPacketService packetService;
       
  2673 	OpenPacketServiceL(packetService);
       
  2674 	CleanupClosePushL(packetService);		
       
  2675 	
       
  2676 	// -----------------------------------------------------------------
       
  2677 	// just check that this API isn't supported by CTSY
       
  2678 	// -----------------------------------------------------------------
       
  2679 	TRequestStatus requestStatus;
       
  2680 	RPacketService::TPacketReleaseMode releaseMode;
       
  2681 	packetService.NotifyReleaseModeChange(requestStatus, releaseMode);
       
  2682 	
       
  2683 	User::WaitForRequest(requestStatus);
       
  2684 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  2685 	AssertMockLtsyStatusL();
       
  2686 	
       
  2687 	//-------------------------------------------------------------------------
       
  2688 	// TEST E: Unsolicited completion of RPacketService::NotifyReleaseModeChange
       
  2689 	// from LTSY. 
       
  2690 	// This test is used for CMmPacketServiceTsy::CompleteNetworkModeChange
       
  2691  	//-------------------------------------------------------------------------
       
  2692  	TRequestStatus mockLtsyStatus;
       
  2693 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2694 	// data for CompleteL
       
  2695 	RMobilePhone::TMobilePhoneNetworkMode ntwkMode(
       
  2696                                         RMobilePhone::ENetworkModeGsm );
       
  2697 	TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkMode> pckg(ntwkMode );
       
  2698 	pckg.SerialiseL(data);
       
  2699 	// generate completion
       
  2700 	iMockLTSY.CompleteL(EPacketNotifyReleaseModeChange, KErrNone, data);
       
  2701 	User::WaitForRequest(mockLtsyStatus);
       
  2702 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2703 	
       
  2704 	AssertMockLtsyStatusL();
       
  2705 	CleanupStack::PopAndDestroy(3, this); // packetService, data, this	
       
  2706 	}
       
  2707 
       
  2708 
       
  2709 /**
       
  2710 @SYMTestCaseID BA-CTSY-PKTS-PSRAR-0001
       
  2711 @SYMPREQ 1551
       
  2712 @SYMComponent  telephony_ctsy
       
  2713 @SYMTestCaseDesc Test support in CTSY for RPacketService::RejectActivationRequest
       
  2714 @SYMTestPriority High
       
  2715 @SYMTestActions Invokes RPacketService::RejectActivationRequest
       
  2716 @SYMTestExpectedResults Pass
       
  2717 @SYMTestType CT
       
  2718 */
       
  2719 void CCTsyPacketServiceFU::TestRejectActivationRequest0001L()
       
  2720 	{
       
  2721 
       
  2722 	OpenEtelServerL(EUseExtendedError);
       
  2723 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2724 	OpenPhoneL();
       
  2725 
       
  2726 	RPacketService packetService;
       
  2727 	OpenPacketServiceL(packetService);
       
  2728 	CleanupClosePushL(packetService);
       
  2729 	
       
  2730  	//-------------------------------------------------------------------------
       
  2731 	// TEST A: failure to dispatch request to LTSY
       
  2732  	//-------------------------------------------------------------------------
       
  2733 	iMockLTSY.ExpectL(EPacketRejectActivationRequest, KErrNotSupported);
       
  2734 			
       
  2735 	TRequestStatus requestStatus;
       
  2736 	packetService.RejectActivationRequest(requestStatus);	
       
  2737 	
       
  2738 	User::WaitForRequest(requestStatus);
       
  2739 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2740 
       
  2741  	//-------------------------------------------------------------------------
       
  2742 	// TEST C: Successful completion request of
       
  2743 	// RPacketService::RejectActivationRequest when result is not cached.
       
  2744  	//-------------------------------------------------------------------------
       
  2745 
       
  2746 	iMockLTSY.ExpectL(EPacketRejectActivationRequest);
       
  2747 	iMockLTSY.CompleteL(EPacketRejectActivationRequest, KErrNone);
       
  2748 	
       
  2749 	packetService.RejectActivationRequest(requestStatus);	
       
  2750 		
       
  2751 	User::WaitForRequest(requestStatus);
       
  2752 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  2753 	
       
  2754  	//-------------------------------------------------------------------------
       
  2755 	// TEST E: Unsolicited completion of RPacketService::RejectActivationRequest
       
  2756 	// from LTSY.
       
  2757  	//-------------------------------------------------------------------------
       
  2758 
       
  2759 	TRequestStatus mockLtsyStatus;
       
  2760 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2761 	// generate completion
       
  2762 	iMockLTSY.CompleteL(EPacketRejectActivationRequest, KErrNone);
       
  2763 	User::WaitForRequest(mockLtsyStatus); 
       
  2764 	
       
  2765 	AssertMockLtsyStatusL();
       
  2766 	CleanupStack::PopAndDestroy(2, this); // RPacketService, this	
       
  2767 	}
       
  2768 
       
  2769 
       
  2770 /**
       
  2771 @SYMTestCaseID BA-CTSY-PKTS-PSRAR-0002
       
  2772 @SYMPREQ 1551
       
  2773 @SYMComponent  telephony_ctsy
       
  2774 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::RejectActivationRequest
       
  2775 @SYMTestPriority High
       
  2776 @SYMTestActions Invokes cancelling of RPacketService::RejectActivationRequest
       
  2777 @SYMTestExpectedResults Pass
       
  2778 @SYMTestType CT
       
  2779 */
       
  2780 void CCTsyPacketServiceFU::TestRejectActivationRequest0002L()
       
  2781 	{
       
  2782 	OpenEtelServerL(EUseExtendedError);
       
  2783 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2784 	OpenPhoneL();
       
  2785 
       
  2786 	RPacketService packetService;
       
  2787 	OpenPacketServiceL(packetService);
       
  2788 	CleanupClosePushL(packetService);
       
  2789 
       
  2790  	//-------------------------------------------------------------------------
       
  2791 	// Test cancelling of RPacketService::RejectActivationRequest
       
  2792  	//-------------------------------------------------------------------------
       
  2793  	TRequestStatus requestStatus;
       
  2794  	
       
  2795 	iMockLTSY.ExpectL(EPacketRejectActivationRequest);
       
  2796 	iMockLTSY.CompleteL(EPacketRejectActivationRequest, KErrNone, 5);
       
  2797 	
       
  2798 	packetService.RejectActivationRequest(requestStatus);	
       
  2799 	packetService.CancelAsyncRequest(EPacketRejectActivationRequest);
       
  2800 		
       
  2801 	User::WaitForRequest(requestStatus);
       
  2802 	
       
  2803 	// TSY has started a request and it is not possible to then
       
  2804     // cancel this request. TSY proceed as though the Cancel never happened. The server's 
       
  2805     // call to the TSY cancel function will return synchronously.
       
  2806     
       
  2807     // so check that reguest completed as without CancelAsyncRequest
       
  2808 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2809 	AssertMockLtsyStatusL();
       
  2810 	
       
  2811 	CleanupStack::PopAndDestroy(2); // packetService, this	
       
  2812 	}
       
  2813 
       
  2814 
       
  2815 
       
  2816 /**
       
  2817 @SYMTestCaseID BA-CTSY-PKTS-PSRAR-0004
       
  2818 @SYMPREQ 1551
       
  2819 @SYMComponent  telephony_ctsy
       
  2820 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::RejectActivationRequest
       
  2821 @SYMTestPriority High
       
  2822 @SYMTestActions Invokes multiple client requests to RPacketService::RejectActivationRequest
       
  2823 @SYMTestExpectedResults Pass
       
  2824 @SYMTestType CT
       
  2825 */
       
  2826 void CCTsyPacketServiceFU::TestRejectActivationRequest0004L()
       
  2827 	{
       
  2828 					
       
  2829 	OpenEtelServerL(EUseExtendedError);
       
  2830 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2831 	OpenPhoneL();
       
  2832 
       
  2833 	RBuf8 data;
       
  2834 	CleanupClosePushL(data);
       
  2835 
       
  2836 	// Open second client
       
  2837 	RTelServer telServer2;
       
  2838 	TInt ret = telServer2.Connect();
       
  2839 	ASSERT_EQUALS(KErrNone, ret);
       
  2840 	CleanupClosePushL(telServer2);
       
  2841 
       
  2842 	RMobilePhone phone2;
       
  2843 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  2844 	ASSERT_EQUALS(KErrNone, ret);
       
  2845 	CleanupClosePushL(phone2);
       
  2846 
       
  2847 	
       
  2848 	RPacketService packetService;
       
  2849 	OpenPacketServiceL(packetService);
       
  2850 	CleanupClosePushL(packetService);
       
  2851 
       
  2852 	RPacketService packetService2;                
       
  2853 	ret = packetService2.Open(phone2);
       
  2854 	ASSERT_EQUALS(KErrNone, ret);
       
  2855 	CleanupClosePushL(packetService2);
       
  2856 
       
  2857 	//-------------------------------------------------------------------------
       
  2858 	// Test A: Test multiple clients requesting RPacketService::RejectActivationRequest
       
  2859  	//-------------------------------------------------------------------------
       
  2860 
       
  2861 	iMockLTSY.ExpectL(EPacketRejectActivationRequest);
       
  2862 	iMockLTSY.CompleteL(EPacketRejectActivationRequest, KErrNone);
       
  2863 	
       
  2864 	// send first request
       
  2865 	TRequestStatus requestStatus;
       
  2866 	packetService.RejectActivationRequest(requestStatus);	
       
  2867 	
       
  2868 	// send second request
       
  2869 	TRequestStatus requestStatus2;
       
  2870 	packetService2.RejectActivationRequest(requestStatus2);				
       
  2871 	
       
  2872 	//wait for first answer
       
  2873 	User::WaitForRequest(requestStatus);
       
  2874 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2875 
       
  2876 	//wait for second answer
       
  2877 	User::WaitForRequest(requestStatus2);
       
  2878 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  2879 	AssertMockLtsyStatusL();	
       
  2880 
       
  2881 	CleanupStack::PopAndDestroy(2); // packetService2, packetService
       
  2882 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  2883 	}
       
  2884 
       
  2885 
       
  2886 /**
       
  2887 @SYMTestCaseID BA-CTSY-PKTS-PSRAR-0005
       
  2888 @SYMPREQ 1551
       
  2889 @SYMComponent  telephony_ctsy
       
  2890 @SYMTestCaseDesc Test support in CTSY for RPacketService::RejectActivationRequest with timeout
       
  2891 @SYMTestPriority High
       
  2892 @SYMTestActions Invokes RPacketService::RejectActivationRequest and tests for timeout
       
  2893 @SYMTestExpectedResults Pass
       
  2894 @SYMTestType CT
       
  2895 */
       
  2896 void CCTsyPacketServiceFU::TestRejectActivationRequest0005L()
       
  2897 	{
       
  2898 
       
  2899 	OpenEtelServerL(EUseExtendedError);
       
  2900 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2901 	OpenPhoneL();
       
  2902 
       
  2903 	RPacketService packetService;
       
  2904 	OpenPacketServiceL(packetService);
       
  2905 	CleanupClosePushL(packetService);
       
  2906 
       
  2907 	//-------------------------------------------------------------------------
       
  2908 	// Test A: Test timeout of RPacketService::RejectActivationRequest
       
  2909  	//-------------------------------------------------------------------------
       
  2910 	TRequestStatus requestStatus;
       
  2911 	iMockLTSY.ExpectL(EPacketRejectActivationRequest);
       
  2912 	
       
  2913 	packetService.RejectActivationRequest(requestStatus);	
       
  2914 		
       
  2915 	User::WaitForRequest(requestStatus);
       
  2916 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  2917 
       
  2918 	CleanupStack::PopAndDestroy(2, this); // packetService, this
       
  2919 	}
       
  2920 
       
  2921 
       
  2922 /**
       
  2923 @SYMTestCaseID BA-CTSY-PKTS-PSSDCP-0001
       
  2924 @SYMPREQ 1551
       
  2925 @SYMComponent  telephony_ctsy
       
  2926 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetDefaultContextParams
       
  2927 @SYMTestPriority High
       
  2928 @SYMTestActions Invokes RPacketService::SetDefaultContextParams
       
  2929 @SYMTestExpectedResults Pass
       
  2930 @SYMTestType CT
       
  2931 */
       
  2932 void CCTsyPacketServiceFU::TestSetDefaultContextParams0001L()
       
  2933 	{
       
  2934 
       
  2935 	OpenEtelServerL(EUseExtendedError);
       
  2936 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2937 	OpenPhoneL();
       
  2938 
       
  2939 	RPacketService packetService;
       
  2940 	OpenPacketServiceL(packetService);
       
  2941 	CleanupClosePushL(packetService);
       
  2942 	
       
  2943 	RBuf8 expectData;
       
  2944 	CleanupClosePushL(expectData);	
       
  2945 	
       
  2946  	//-------------------------------------------------------------------------
       
  2947 	// TEST A: failure to dispatch request to LTSY
       
  2948  	//-------------------------------------------------------------------------
       
  2949 	TRequestStatus requestStatus;
       
  2950 	RPacketContext::TContextConfigGPRS configGPRS;
       
  2951 	_LIT(KSameName, "AccessPointName");
       
  2952 	configGPRS.iAccessPointName.Copy(KSameName);
       
  2953 	configGPRS.iPdpType = RPacketContext::EPdpTypeIPv6;
       
  2954 	configGPRS.iPdpCompression = RPacketContext::KPdpHeaderCompression;	
       
  2955 	TPckg <RPacketContext::TContextConfigGPRS> pckg(configGPRS);	
       
  2956 	
       
  2957 	// data for ExpectL
       
  2958 	TMockLtsyData1<RPacketContext::TContextConfigGPRS> expPckg(configGPRS );
       
  2959 	expPckg.SerialiseL(expectData);
       
  2960 	
       
  2961 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData, KErrNotSupported);
       
  2962 		
       
  2963 	packetService.SetDefaultContextParams(requestStatus, pckg);
       
  2964 	User::WaitForRequest(requestStatus);
       
  2965 	AssertMockLtsyStatusL();
       
  2966 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  2967 
       
  2968 	//-------------------------------------------------------------------------
       
  2969 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2970  	//-------------------------------------------------------------------------
       
  2971 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData);
       
  2972 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrGeneral);
       
  2973 		
       
  2974 	packetService.SetDefaultContextParams(requestStatus, pckg);
       
  2975 	User::WaitForRequest(requestStatus);
       
  2976 	AssertMockLtsyStatusL();
       
  2977 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  2978 
       
  2979  
       
  2980  	//-------------------------------------------------------------------------
       
  2981 	// TEST C: Successful completion request of
       
  2982 	// RPacketService::SetDefaultContextParams when result is not cached.
       
  2983  	//-------------------------------------------------------------------------
       
  2984 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData);
       
  2985 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);
       
  2986 		
       
  2987 	packetService.SetDefaultContextParams(requestStatus, pckg);
       
  2988 	User::WaitForRequest(requestStatus);
       
  2989 	AssertMockLtsyStatusL();
       
  2990 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2991 	
       
  2992 	
       
  2993 	//-------------------------------------------------------------------------
       
  2994 	// TEST C_2: Successful completion request of
       
  2995 	// RPacketService::SetDefaultContextParams whith another params.
       
  2996  	//-------------------------------------------------------------------------
       
  2997  	RPacketContext::TContextConfigR99_R4 configR99;	
       
  2998 	_LIT(KSameName2, "AccessPointName2");
       
  2999 	configR99.iAccessPointName.Copy(KSameName2);
       
  3000 	configR99.iPdpType = RPacketContext::EPdpTypeIPv6;	
       
  3001 	TPckg <RPacketContext::TContextConfigR99_R4> pckg2(configR99);	
       
  3002 	
       
  3003 	// data for ExpectL
       
  3004 	TMockLtsyData1<RPacketContext::TContextConfigR99_R4> expPckg2(configR99);
       
  3005 	expectData.Close();
       
  3006 	expPckg2.SerialiseL(expectData);
       
  3007  	
       
  3008 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData);
       
  3009 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);
       
  3010 		
       
  3011 	packetService.SetDefaultContextParams(requestStatus, pckg2);
       
  3012 	User::WaitForRequest(requestStatus);
       
  3013 	AssertMockLtsyStatusL();
       
  3014 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3015 
       
  3016   	//-------------------------------------------------------------------------
       
  3017 	// TEST E: Unsolicited completion of RPacketService::SetDefaultContextParams
       
  3018 	// from LTSY.
       
  3019  	//-------------------------------------------------------------------------
       
  3020 	TRequestStatus mockLtsyStatus;
       
  3021 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3022 	// generate completion
       
  3023 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);
       
  3024 	User::WaitForRequest(mockLtsyStatus); 
       
  3025 
       
  3026 	AssertMockLtsyStatusL();
       
  3027 	CleanupStack::PopAndDestroy(3, this); // expectData, packetService, this	
       
  3028 	}
       
  3029 
       
  3030 
       
  3031 /**
       
  3032 @SYMTestCaseID BA-CTSY-PKTS-PSSDCP-0002
       
  3033 @SYMPREQ 1551
       
  3034 @SYMComponent  telephony_ctsy
       
  3035 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::SetDefaultContextParams
       
  3036 @SYMTestPriority High
       
  3037 @SYMTestActions Invokes cancelling of RPacketService::SetDefaultContextParams
       
  3038 @SYMTestExpectedResults Pass
       
  3039 @SYMTestType CT
       
  3040 */
       
  3041 void CCTsyPacketServiceFU::TestSetDefaultContextParams0002L()
       
  3042 	{
       
  3043 
       
  3044 	OpenEtelServerL(EUseExtendedError);
       
  3045 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3046 	OpenPhoneL();
       
  3047 
       
  3048 	RPacketService packetService;
       
  3049 	OpenPacketServiceL(packetService);
       
  3050 	CleanupClosePushL(packetService);	
       
  3051 	
       
  3052 	RBuf8 expectData;
       
  3053 	CleanupClosePushL(expectData);
       
  3054 
       
  3055 	TRequestStatus mockLtsyStatus;	
       
  3056 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3057 
       
  3058  	//-------------------------------------------------------------------------
       
  3059 	// Test cancelling of RPacketService::SetDefaultContextParams
       
  3060  	//-------------------------------------------------------------------------
       
  3061  	TRequestStatus requestStatus;
       
  3062 	RPacketContext::TContextConfigGPRS configGPRS;
       
  3063 	TPckg <RPacketContext::TContextConfigGPRS> pckg(configGPRS);
       
  3064 	
       
  3065 	// data for ExpectL
       
  3066 	TMockLtsyData1<RPacketContext::TContextConfigGPRS> expPckg(configGPRS );
       
  3067 	expPckg.SerialiseL(expectData);
       
  3068 	
       
  3069 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData);
       
  3070 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone, 5);
       
  3071 			
       
  3072 	// send request	
       
  3073 	packetService.SetDefaultContextParams(requestStatus, pckg);
       
  3074 	//cancel request	
       
  3075 	packetService.CancelAsyncRequest(EPacketSetDefaultContextParams);
       
  3076 		
       
  3077 	User::WaitForRequest(requestStatus);
       
  3078 	AssertMockLtsyStatusL();
       
  3079 	
       
  3080 	// TSY has started a request and it is not possible to then
       
  3081     // cancel this request. TSY proceed as though the Cancel never happened. The server's 
       
  3082     // call to the TSY cancel function will return synchronously.
       
  3083     
       
  3084     // so check that reguest completed as without CancelAsyncRequest	
       
  3085 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	 	
       
  3086 
       
  3087 	// Wait for completion of iMockLTSY.NotifyTerminated	
       
  3088 	User::WaitForRequest(mockLtsyStatus);
       
  3089 	AssertMockLtsyStatusL();
       
  3090 	CleanupStack::PopAndDestroy(3, this); // expectData, packetService, this	
       
  3091 	}
       
  3092 
       
  3093 
       
  3094 /**
       
  3095 @SYMTestCaseID BA-CTSY-PKTS-PSSDCP-0003
       
  3096 @SYMPREQ 1551
       
  3097 @SYMComponent  telephony_ctsy
       
  3098 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetDefaultContextParams with bad parameter data
       
  3099 @SYMTestPriority High
       
  3100 @SYMTestActions Invokes RPacketService::SetDefaultContextParams with bad parameter data
       
  3101 @SYMTestExpectedResults Pass
       
  3102 @SYMTestType CT
       
  3103 */
       
  3104 void CCTsyPacketServiceFU::TestSetDefaultContextParams0003L()
       
  3105 	{
       
  3106 
       
  3107 	OpenEtelServerL(EUseExtendedError);
       
  3108 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3109 	OpenPhoneL();
       
  3110 	
       
  3111 	RPacketService packetService;
       
  3112 	OpenPacketServiceL(packetService);
       
  3113 	CleanupClosePushL(packetService);	
       
  3114 	
       
  3115 	TRequestStatus requestStatus;
       
  3116 	TInt garbage;
       
  3117 	TPckg <TInt> pckg(garbage);	
       
  3118 	
       
  3119 	// call function with wrong argument 	
       
  3120 	packetService.SetDefaultContextParams(requestStatus, pckg);
       
  3121 	
       
  3122 	User::WaitForRequest(requestStatus);
       
  3123 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());	
       
  3124 
       
  3125 	CleanupStack::PopAndDestroy(2, this); // packetService, this
       
  3126 	}
       
  3127 
       
  3128 
       
  3129 /**
       
  3130 @SYMTestCaseID BA-CTSY-PKTS-PSSDCP-0004
       
  3131 @SYMPREQ 1551
       
  3132 @SYMComponent  telephony_ctsy
       
  3133 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::SetDefaultContextParams
       
  3134 @SYMTestPriority High
       
  3135 @SYMTestActions Invokes multiple client requests to RPacketService::SetDefaultContextParams
       
  3136 @SYMTestExpectedResults Pass
       
  3137 @SYMTestType CT
       
  3138 */
       
  3139 void CCTsyPacketServiceFU::TestSetDefaultContextParams0004L()
       
  3140 	{			
       
  3141 	OpenEtelServerL(EUseExtendedError);
       
  3142 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3143 	OpenPhoneL();
       
  3144 
       
  3145 	RBuf8 data;
       
  3146 	CleanupClosePushL(data);
       
  3147 
       
  3148 	// Open second client
       
  3149 	RTelServer telServer2;
       
  3150 	TInt ret = telServer2.Connect();
       
  3151 	ASSERT_EQUALS(KErrNone, ret);
       
  3152 	CleanupClosePushL(telServer2);
       
  3153 
       
  3154 	RMobilePhone phone2;
       
  3155 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  3156 	ASSERT_EQUALS(KErrNone, ret);
       
  3157 	CleanupClosePushL(phone2);
       
  3158 	
       
  3159 	RPacketService packetService;
       
  3160 	OpenPacketServiceL(packetService);
       
  3161 	CleanupClosePushL(packetService);
       
  3162 
       
  3163 	RPacketService packetService2;                
       
  3164 	ret = packetService2.Open(phone2);
       
  3165 	ASSERT_EQUALS(KErrNone, ret);
       
  3166 	CleanupClosePushL(packetService2);
       
  3167 	
       
  3168 	RBuf8 expectData;
       
  3169 	CleanupClosePushL(expectData);
       
  3170 	
       
  3171 	RBuf8 expectData2;
       
  3172 	CleanupClosePushL(expectData2);
       
  3173 
       
  3174 	//-------------------------------------------------------------------------
       
  3175 	// Test A: Test multiple clients requesting RPacketService::SetDefaultContextParams
       
  3176  	//-------------------------------------------------------------------------
       
  3177 
       
  3178 	// data for first call of API
       
  3179 	TRequestStatus requestStatus;
       
  3180 	RPacketContext::TContextConfigGPRS configGPRS;
       
  3181 	_LIT(KSameName, "AccessPointName");
       
  3182 	configGPRS.iAccessPointName.Copy(KSameName);
       
  3183 	configGPRS.iPdpType = RPacketContext::EPdpTypeIPv6;
       
  3184 	configGPRS.iPdpCompression = RPacketContext::KPdpHeaderCompression;	
       
  3185 	TPckg <RPacketContext::TContextConfigGPRS> pckg(configGPRS);	
       
  3186 	// data for the first ExpectL
       
  3187 	TMockLtsyData1<RPacketContext::TContextConfigGPRS> expPckg(configGPRS);
       
  3188 	expPckg.SerialiseL(expectData);
       
  3189 	
       
  3190 	// data for second call of API
       
  3191 	TRequestStatus requestStatus2;
       
  3192 	RPacketContext::TContextConfigR99_R4 configR99;	
       
  3193 	TPckg <RPacketContext::TContextConfigR99_R4> pckg2(configR99);	
       
  3194 	// data for the second ExpectL
       
  3195 	TMockLtsyData1<RPacketContext::TContextConfigR99_R4> expPckg2(configR99);
       
  3196 	expPckg2.SerialiseL(expectData2);
       
  3197 	
       
  3198 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData);
       
  3199 	iMockLTSY.CompleteL(EPacketSetDefaultContextParams, KErrNone);	
       
  3200 		
       
  3201 	// send first request		
       
  3202 	packetService.SetDefaultContextParams(requestStatus, pckg);		
       
  3203 
       
  3204 	// send second request		
       
  3205 	packetService2.SetDefaultContextParams(requestStatus2, pckg2);
       
  3206 	
       
  3207 	//wait for first answer	
       
  3208 	User::WaitForRequest(requestStatus);
       
  3209 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3210 	
       
  3211 	//wait for second answer	
       
  3212 	User::WaitForRequest(requestStatus2);
       
  3213 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  3214 	
       
  3215 	AssertMockLtsyStatusL();		
       
  3216 	CleanupStack::PopAndDestroy(4); // expectData2, expectData, packetService2, packetService
       
  3217 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  3218 	}
       
  3219 
       
  3220 
       
  3221 /**
       
  3222 @SYMTestCaseID BA-CTSY-PKTS-PSSDCP-0005
       
  3223 @SYMPREQ 1551
       
  3224 @SYMComponent  telephony_ctsy
       
  3225 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetDefaultContextParams with timeout
       
  3226 @SYMTestPriority High
       
  3227 @SYMTestActions Invokes RPacketService::SetDefaultContextParams and tests for timeout
       
  3228 @SYMTestExpectedResults Pass
       
  3229 @SYMTestType CT
       
  3230 */
       
  3231 void CCTsyPacketServiceFU::TestSetDefaultContextParams0005L()
       
  3232 	{
       
  3233 
       
  3234 	OpenEtelServerL(EUseExtendedError);
       
  3235 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3236 	OpenPhoneL();
       
  3237 
       
  3238 	RPacketService packetService;
       
  3239 	OpenPacketServiceL(packetService);
       
  3240 	CleanupClosePushL(packetService);
       
  3241 	
       
  3242 	RBuf8 expectData;
       
  3243 	CleanupClosePushL(expectData);
       
  3244 
       
  3245 	//-------------------------------------------------------------------------
       
  3246 	// Test A: Test timeout of RPacketService::SetDefaultContextParams
       
  3247  	//------------------------------------------------------------------------- 	
       
  3248  	TRequestStatus requestStatus;
       
  3249 	RPacketContext::TContextConfigGPRS configGPRS;
       
  3250 	_LIT(KSameName, "AccessPointName");
       
  3251 	configGPRS.iAccessPointName.Copy(KSameName);
       
  3252 	configGPRS.iPdpType = RPacketContext::EPdpTypeIPv6;
       
  3253 	configGPRS.iPdpCompression = RPacketContext::KPdpHeaderCompression;	
       
  3254 	TPckg <RPacketContext::TContextConfigGPRS> pckg(configGPRS);
       
  3255 	
       
  3256 	// data for  ExpectL
       
  3257 	TMockLtsyData1<RPacketContext::TContextConfigGPRS> expPckg(configGPRS);
       
  3258 	expPckg.SerialiseL(expectData);
       
  3259 	
       
  3260 	iMockLTSY.ExpectL(EPacketSetDefaultContextParams, expectData);
       
  3261 	packetService.SetDefaultContextParams(requestStatus, pckg);	
       
  3262 	
       
  3263 	User::WaitForRequest(requestStatus);
       
  3264 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  3265 		
       
  3266 	AssertMockLtsyStatusL();
       
  3267 	CleanupStack::PopAndDestroy(3, this); //expectData,  packetService, this
       
  3268 	}
       
  3269 
       
  3270 
       
  3271 /**
       
  3272 @SYMTestCaseID BA-CTSY-PKTS-PSNCONRS-0001
       
  3273 @SYMPREQ 1551
       
  3274 @SYMCR 1595
       
  3275 @SYMComponent  telephony_ctsy
       
  3276 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyChangeOfNtwkRegStatus
       
  3277 @SYMTestPriority High
       
  3278 @SYMTestActions Invokes RPacketService::NotifyChangeOfNtwkRegStatus
       
  3279 @SYMTestExpectedResults Pass
       
  3280 @SYMTestType CT
       
  3281 */
       
  3282 void CCTsyPacketServiceFU::TestNotifyChangeOfNtwkRegStatus0001L()
       
  3283 	{
       
  3284 
       
  3285 	OpenEtelServerL(EUseExtendedError);
       
  3286 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3287 	OpenPhoneL();
       
  3288 
       
  3289 	RBuf8 data;
       
  3290 	CleanupClosePushL(data);
       
  3291 	
       
  3292  	RPacketService packetService;		
       
  3293 	// Open PacketService
       
  3294 	OpenPacketServiceL(packetService);
       
  3295 	CleanupClosePushL(packetService);	
       
  3296 	
       
  3297 	//-------------------------------------------------------------------------
       
  3298 	// TEST notification from the MocKLTSY when 
       
  3299 	// there is no client NotifyChangeOfNtwkRegStatus pending
       
  3300  	//-------------------------------------------------------------------------  	
       
  3301 	TRequestStatus mockLtsyStatus;
       
  3302 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  3303 	RPacketService::TRegistrationStatus sndData0 = RPacketService::ERegisteredOnHomeNetwork;
       
  3304 	TMockLtsyData1<RPacketService::TRegistrationStatus> ltsyData0(sndData0);
       
  3305 	ltsyData0.SerialiseL(data); 
       
  3306 	
       
  3307 	// Issue the Complete...	
       
  3308 	iMockLTSY.CompleteL(EPacketNotifyChangeOfNtwkRegStatus, KErrNone, data);
       
  3309 	User::WaitForRequest(mockLtsyStatus);	
       
  3310 	AssertMockLtsyStatusL();
       
  3311 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3312 	
       
  3313 	//-------------------------------------------------------------------------
       
  3314 	// TEST C: Successful completion request of
       
  3315 	// RPacketService::NotifyChangeOfNtwkRegStatus when result is not cached.
       
  3316  	//-------------------------------------------------------------------------    	
       
  3317 	TRequestStatus requestStatus;
       
  3318 	RPacketService::TRegistrationStatus registrationStatus;	
       
  3319 	
       
  3320 	// Post request		
       
  3321 	packetService.NotifyChangeOfNtwkRegStatus(requestStatus, registrationStatus);	
       
  3322 	
       
  3323 	// firstly issue notification  from  the MockLTSY 
       
  3324     // which has the same registration state as is already saved
       
  3325    	RPacketService::TRegistrationStatus sndData = RPacketService::ERegisteredOnHomeNetwork;
       
  3326 	TMockLtsyData1<RPacketService::TRegistrationStatus> ltsyData(sndData);
       
  3327 	data.Close();
       
  3328 	ltsyData.SerialiseL(data);    
       
  3329 	// Issue the Complete with the same registration state as is already saved
       
  3330 	iMockLTSY.CompleteL(EPacketNotifyChangeOfNtwkRegStatus, KErrNone, data);
       
  3331 	 
       
  3332 	// check that NotifyChangeOfNtwkRegStatus isn't completed
       
  3333 	ASSERT_EQUALS (KRequestPending, requestStatus.Int());
       
  3334 	
       
  3335 	//data for Complete with new registration state
       
  3336 	RPacketService::TRegistrationStatus sndData2 = RPacketService::ERegisteredRoaming;
       
  3337 	TMockLtsyData1<RPacketService::TRegistrationStatus> ltsyData2(sndData2);
       
  3338 	data.Close();
       
  3339 	ltsyData2.SerialiseL(data);		
       
  3340 	// Issue the Complete with new registration state
       
  3341 	iMockLTSY.CompleteL(EPacketNotifyChangeOfNtwkRegStatus, KErrNone, data);
       
  3342 	
       
  3343 	// wait for completion of NotifyChangeOfNtwkRegStatus
       
  3344 	User::WaitForRequest(requestStatus);	
       
  3345 	AssertMockLtsyStatusL();
       
  3346 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  3347 	ASSERT_EQUALS(sndData2, registrationStatus);
       
  3348 		
       
  3349 	//-------------------------------------------------------------------------
       
  3350 	// TEST : Completion  of request 
       
  3351 	// RPacketService::NotifyChangeOfNtwkRegStatus with extended error code.
       
  3352  	//-------------------------------------------------------------------------    	
       
  3353 		
       
  3354 	// Post request		
       
  3355 	packetService.NotifyChangeOfNtwkRegStatus(requestStatus, registrationStatus);	
       
  3356 		
       
  3357 	//data for Complete with registration state
       
  3358 	data.Close();
       
  3359 	ltsyData.SerialiseL(data);    
       
  3360 	// Issue the Complete with the same registration state as is already saved
       
  3361 	iMockLTSY.CompleteL(EPacketNotifyChangeOfNtwkRegStatus, SYMBIAN_EXTERR(KErrGsmCCNetworkOutOfOrder,KErrNotFound), data);
       
  3362 
       
  3363 	// check that NotifyChangeOfNtwkRegStatus completed with extended error code
       
  3364 	User::WaitForRequest(requestStatus);
       
  3365 	AssertMockLtsyStatusL();
       
  3366 	ASSERT_EQUALS (KErrGsmCCNetworkOutOfOrder, requestStatus.Int());
       
  3367 	ASSERT_EQUALS(sndData, registrationStatus);
       
  3368 	
       
  3369 	// Check that basic error code is returned when error granuality set to EErrorBasic
       
  3370 	RTelServer::TErrorGranularity granularity(RTelServer::EErrorBasic);
       
  3371 	TInt ret = iTelServer.SetExtendedErrorGranularity(granularity);
       
  3372 	ASSERT_EQUALS(KErrNone, ret);
       
  3373 
       
  3374 	// Post request		
       
  3375 	packetService.NotifyChangeOfNtwkRegStatus(requestStatus, registrationStatus);	
       
  3376 		
       
  3377 	//data for Complete with registration state
       
  3378 	data.Close();
       
  3379 	ltsyData2.SerialiseL(data);    
       
  3380 
       
  3381 	// Issue the Complete with the same registration state as is already saved
       
  3382 	iMockLTSY.CompleteL(EPacketNotifyChangeOfNtwkRegStatus, SYMBIAN_EXTERR(KErrGsmCCNetworkOutOfOrder,KErrNotFound), data);
       
  3383 	
       
  3384 	// check that NotifyChangeOfNtwkRegStatus completed with basic error code
       
  3385 	User::WaitForRequest(requestStatus);
       
  3386 	AssertMockLtsyStatusL();
       
  3387 	ASSERT_EQUALS (KErrNotFound, requestStatus.Int());
       
  3388 	ASSERT_EQUALS(sndData2, registrationStatus);
       
  3389 		
       
  3390 	CleanupStack::PopAndDestroy(); // packetService
       
  3391 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
  3392 	
       
  3393 	}
       
  3394 
       
  3395 
       
  3396 /**
       
  3397 @SYMTestCaseID BA-CTSY-PKTS-PSNCONRS-0002
       
  3398 @SYMPREQ 1551
       
  3399 @SYMComponent  telephony_ctsy
       
  3400 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyChangeOfNtwkRegStatus
       
  3401 @SYMTestPriority High
       
  3402 @SYMTestActions Invokes cancelling of RPacketService::NotifyChangeOfNtwkRegStatus
       
  3403 @SYMTestExpectedResults Pass
       
  3404 @SYMTestType CT
       
  3405 */
       
  3406 void CCTsyPacketServiceFU::TestNotifyChangeOfNtwkRegStatus0002L()
       
  3407 	{	
       
  3408 	OpenEtelServerL(EUseExtendedError);
       
  3409 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3410 	OpenPhoneL();
       
  3411 
       
  3412 	RPacketService packetService;		
       
  3413 	
       
  3414 	// Open PacketService
       
  3415 	OpenPacketServiceL(packetService);
       
  3416 	CleanupClosePushL(packetService);
       
  3417 	
       
  3418  	//-------------------------------------------------------------------------
       
  3419 	// Test cancelling of RPacketService::NotifyChangeOfNtwkRegStatus
       
  3420  	//------------------------------------------------------------------------- 	
       
  3421  	TRequestStatus requestStatus;
       
  3422 	RPacketService::TRegistrationStatus registrationStatus;	
       
  3423 	
       
  3424 	packetService.NotifyChangeOfNtwkRegStatus(requestStatus, registrationStatus);
       
  3425     packetService.CancelAsyncRequest(EPacketNotifyChangeOfNtwkRegStatus); 	
       
  3426  	
       
  3427 	User::WaitForRequest(requestStatus);	
       
  3428 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  3429 	
       
  3430 	AssertMockLtsyStatusL();	
       
  3431 	CleanupStack::PopAndDestroy(2);// packetService, data
       
  3432 	}
       
  3433 
       
  3434 
       
  3435 
       
  3436 /**
       
  3437 @SYMTestCaseID BA-CTSY-PKTS-PSNCONRS-0004
       
  3438 @SYMPREQ 1551
       
  3439 @SYMComponent  telephony_ctsy
       
  3440 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyChangeOfNtwkRegStatus
       
  3441 @SYMTestPriority High
       
  3442 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyChangeOfNtwkRegStatus
       
  3443 @SYMTestExpectedResults Pass
       
  3444 @SYMTestType CT
       
  3445 */
       
  3446 void CCTsyPacketServiceFU::TestNotifyChangeOfNtwkRegStatus0004L()
       
  3447 	{					
       
  3448 	OpenEtelServerL(EUseExtendedError);
       
  3449 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3450 	OpenPhoneL();
       
  3451 
       
  3452 	RBuf8 data;
       
  3453 	CleanupClosePushL(data);
       
  3454 	
       
  3455 	// Open second client
       
  3456 	RTelServer telServer2;
       
  3457 	TInt ret = telServer2.Connect();
       
  3458 	ASSERT_EQUALS(KErrNone, ret);
       
  3459 	CleanupClosePushL(telServer2);
       
  3460 
       
  3461 	RMobilePhone phone2;
       
  3462 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  3463 	ASSERT_EQUALS(KErrNone, ret);
       
  3464 	CleanupClosePushL(phone2);
       
  3465 	
       
  3466 	RPacketService packetService;
       
  3467 	OpenPacketServiceL(packetService);
       
  3468 	CleanupClosePushL(packetService);
       
  3469 
       
  3470 	RPacketService packetService2;                
       
  3471 	ret = packetService2.Open(phone2);
       
  3472 	ASSERT_EQUALS(KErrNone, ret);
       
  3473 	CleanupClosePushL(packetService2); 
       
  3474 	
       
  3475 	
       
  3476 	//-------------------------------------------------------------------------
       
  3477 	// Test A: Test multiple clients requesting RPacketService::NotifyChangeOfNtwkRegStatus
       
  3478  	//-------------------------------------------------------------------------
       
  3479 	
       
  3480 	RPacketService::TRegistrationStatus sndData = RPacketService::ERegisteredRoaming;
       
  3481 	TMockLtsyData1<RPacketService::TRegistrationStatus> ltsyData(sndData);
       
  3482 	ltsyData.SerialiseL(data); 	 	
       
  3483  		
       
  3484 	TRequestStatus requestStatus;
       
  3485 	RPacketService::TRegistrationStatus registrationStatus;	
       
  3486 	
       
  3487 	TRequestStatus requestStatus2;
       
  3488 	RPacketService::TRegistrationStatus registrationStatus2;	
       
  3489 	
       
  3490 	packetService.NotifyChangeOfNtwkRegStatus(requestStatus, registrationStatus);	
       
  3491 	packetService2.NotifyChangeOfNtwkRegStatus(requestStatus2, registrationStatus2);
       
  3492 				
       
  3493 	iMockLTSY.CompleteL(EPacketNotifyChangeOfNtwkRegStatus, KErrNone, data);
       
  3494 	
       
  3495 	// wait for first
       
  3496 	User::WaitForRequest(requestStatus);	
       
  3497 	AssertMockLtsyStatusL();
       
  3498 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  3499 	ASSERT_EQUALS(sndData, registrationStatus);
       
  3500 	
       
  3501 	// wait for second
       
  3502 	User::WaitForRequest(requestStatus2);	
       
  3503 	AssertMockLtsyStatusL();
       
  3504 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());	
       
  3505 	ASSERT_EQUALS(sndData, registrationStatus2);	
       
  3506 
       
  3507 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  3508 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  3509 	}
       
  3510 
       
  3511 
       
  3512 
       
  3513 /**
       
  3514 @SYMTestCaseID BA-CTSY-PKTS-PSNCAR-0001
       
  3515 @SYMPREQ 1551
       
  3516 @SYMComponent  telephony_ctsy
       
  3517 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyContextActivationRequested
       
  3518 @SYMTestPriority High
       
  3519 @SYMTestActions Invokes RPacketService::NotifyContextActivationRequested
       
  3520 @SYMTestExpectedResults Pass
       
  3521 @SYMTestType CT
       
  3522 */
       
  3523 void CCTsyPacketServiceFU::TestNotifyContextActivationRequested0001L()
       
  3524 	{
       
  3525 
       
  3526 	OpenEtelServerL(EUseExtendedError);
       
  3527 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3528 	OpenPhoneL();
       
  3529 
       
  3530 	RBuf8 data;
       
  3531 	CleanupClosePushL(data);
       
  3532 	
       
  3533 	RPacketService packetService;
       
  3534 	OpenPacketServiceL(packetService);
       
  3535 	CleanupClosePushL(packetService);
       
  3536 	
       
  3537   	//-------------------------------------------------------------------------
       
  3538 	// TEST A: Successful completion request of
       
  3539 	// RPacketService::NotifyContextActivationRequested 
       
  3540  	//-------------------------------------------------------------------------
       
  3541 
       
  3542 	// Data for CompleteL
       
  3543 	RPacketContext::TContextConfigGPRS sndContextParam;	
       
  3544 	sndContextParam.iPdpType         = RPacketContext::EPdpTypeIPv6;
       
  3545 	sndContextParam.iAccessPointName.Copy(_L8("PointName"));
       
  3546 	sndContextParam.iPdpAddress.Copy(_L8("PdpAddress"));
       
  3547 	sndContextParam.iPdpCompression = 112233;
       
  3548 	sndContextParam.iAnonymousAccessReqd = RPacketContext::ERequired;
       
  3549 	sndContextParam.iUseEdge = ETrue;
       
  3550 	sndContextParam.iProtocolConfigOption.iAuthInfo.iProtocol = RPacketContext::EProtocolCHAP;
       
  3551 	sndContextParam.iProtocolConfigOption.iAuthInfo.iUsername.Copy(_L8("username1"));
       
  3552 	sndContextParam.iProtocolConfigOption.iAuthInfo.iPassword.Copy(_L8("password1234"));
       
  3553 	sndContextParam.iProtocolConfigOption.iChallenge.Copy(_L8("pseudorandom1"));
       
  3554 	sndContextParam.iProtocolConfigOption.iResponse.Copy(_L8("response1234")); 
       
  3555 	sndContextParam.iProtocolConfigOption.iId = 0x01;
       
  3556 	sndContextParam.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(_L8("PriDNS_1")); 
       
  3557 	sndContextParam.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(_L8("SecDNS_2")); 
       
  3558 	sndContextParam.iProtocolConfigOption.iMiscBuffer.Copy(_L8("buffer1234")); 
       
  3559 	sndContextParam.iNWIContext = ETrue;
       
  3560 	TMockLtsyData1 <RPacketContext::TContextConfigGPRS > ltsyData(sndContextParam);
       
  3561 	ltsyData.SerialiseL(data);	
       
  3562 	
       
  3563 	TRequestStatus requestStatus;
       
  3564 	RPacketContext::TContextConfigGPRS getContextParam;	
       
  3565 	TPckg<RPacketContext::TContextConfigGPRS> pckgParam(getContextParam);
       
  3566 	
       
  3567 	// Send request
       
  3568 	packetService.NotifyContextActivationRequested(requestStatus, pckgParam);
       
  3569 	
       
  3570 	TRequestStatus mockLtsyStatus;
       
  3571 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3572 	// Issue the Complete...	
       
  3573 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);		
       
  3574 	// Wait for completion 
       
  3575 	User::WaitForRequest(mockLtsyStatus);
       
  3576 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3577     // Wait for answer 
       
  3578 	User::WaitForRequest(requestStatus);
       
  3579 	AssertMockLtsyStatusL();
       
  3580 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3581 	// Check that test case's and received TSY's packet context parameters match
       
  3582 	ASSERT_EQUALS(sndContextParam.iPdpType, getContextParam.iPdpType);
       
  3583 	ASSERT_EQUALS(sndContextParam.iAccessPointName, getContextParam.iAccessPointName);
       
  3584 	ASSERT_EQUALS(sndContextParam.iPdpAddress, getContextParam.iPdpAddress);
       
  3585 	ASSERT_EQUALS(sndContextParam.iPdpCompression, getContextParam.iPdpCompression);
       
  3586 	ASSERT_EQUALS(sndContextParam.iAnonymousAccessReqd, getContextParam.iAnonymousAccessReqd);
       
  3587     ASSERT_EQUALS(sndContextParam.iUseEdge, getContextParam.iUseEdge);	
       
  3588 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iAuthInfo.iProtocol, getContextParam.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  3589 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iAuthInfo.iUsername, getContextParam.iProtocolConfigOption.iAuthInfo.iUsername);	
       
  3590 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iAuthInfo.iPassword, getContextParam.iProtocolConfigOption.iAuthInfo.iPassword);	
       
  3591 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iChallenge, getContextParam.iProtocolConfigOption.iChallenge);	
       
  3592 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iResponse, getContextParam.iProtocolConfigOption.iResponse);	
       
  3593 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iId, getContextParam.iProtocolConfigOption.iId);	
       
  3594 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, getContextParam.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);	
       
  3595 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, getContextParam.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);	
       
  3596 	ASSERT_EQUALS(sndContextParam.iProtocolConfigOption.iMiscBuffer, getContextParam.iProtocolConfigOption.iMiscBuffer);	
       
  3597 	ASSERT_EQUALS(sndContextParam.iNWIContext, getContextParam.iNWIContext);	
       
  3598 	
       
  3599  	//-------------------------------------------------------------------------
       
  3600 	// TEST B: Unsolicited completion of RPacketService::NotifyContextActivationRequested
       
  3601 	// from LTSY.
       
  3602  	//-------------------------------------------------------------------------
       
  3603  	
       
  3604 	// Issue Unsolicited completion	
       
  3605 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3606 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);		
       
  3607 	// Wait for completion 
       
  3608 	User::WaitForRequest(mockLtsyStatus);
       
  3609 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  3610 
       
  3611 	AssertMockLtsyStatusL();
       
  3612 	CleanupStack::PopAndDestroy(3, this); // RPacketService, data, this
       
  3613 	
       
  3614 	}
       
  3615 	
       
  3616 /**
       
  3617 @SYMTestCaseID BA-CTSY-PKTS-PSNCAR-0001b
       
  3618 @SYMPREQ 1551
       
  3619 @SYMComponent  telephony_ctsy
       
  3620 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyContextActivationRequested
       
  3621 @SYMTestPriority High
       
  3622 @SYMTestActions Invokes RPacketService::NotifyContextActivationRequested requests using different parameter class versions
       
  3623 @SYMTestExpectedResults Pass
       
  3624 @SYMTestType CT
       
  3625 */
       
  3626 void CCTsyPacketServiceFU::TestNotifyContextActivationRequested0001bL()
       
  3627 	{
       
  3628 
       
  3629 	OpenEtelServerL(EUseExtendedError);
       
  3630 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3631 	OpenPhoneL();
       
  3632 
       
  3633 	RBuf8 data;
       
  3634 	CleanupClosePushL(data);
       
  3635 	
       
  3636 	RPacketService packetService;
       
  3637 	OpenPacketServiceL(packetService);
       
  3638 	CleanupClosePushL(packetService);  
       
  3639 	
       
  3640 	TRequestStatus requestStatus;	
       
  3641 	TRequestStatus mockLtsyStatus;
       
  3642 	
       
  3643 	// ------------------------------------------------------------------------
       
  3644 	// NotifyContextActivationRequested 
       
  3645 	// with RPacketContext::TContextConfig_R5 as parameter	
       
  3646 	// ------------------------------------------------------------------------
       
  3647 
       
  3648 	// Create R5 related data for CompleteL
       
  3649 	RPacketContext::TContextConfig_R5 testCaseContextR5;	
       
  3650 	testCaseContextR5.iPdpType         = RPacketContext::EPdpTypeIPv6;
       
  3651 	testCaseContextR5.iAccessPointName.Copy(_L8("PointName"));
       
  3652     testCaseContextR5.iPdpAddress.Copy(_L8("PdpAddress"));
       
  3653 	testCaseContextR5.iUseEdge = EFalse;
       
  3654 	testCaseContextR5.iProtocolConfigOption.iAuthInfo.iProtocol = RPacketContext::EProtocolNone;
       
  3655 	testCaseContextR5.iProtocolConfigOption.iAuthInfo.iUsername.Copy(_L8("username"));
       
  3656 	testCaseContextR5.iProtocolConfigOption.iAuthInfo.iPassword.Copy(_L8("password"));
       
  3657 	testCaseContextR5.iProtocolConfigOption.iChallenge.Copy(_L8("pseudorandom_data"));
       
  3658 	testCaseContextR5.iProtocolConfigOption.iResponse.Copy(_L8("123abc"));
       
  3659 	testCaseContextR5.iProtocolConfigOption.iId = 0x11;
       
  3660 	testCaseContextR5.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(_L8("PrimaryDNS"));
       
  3661 	testCaseContextR5.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(_L8("SecondaryDNS"));
       
  3662 	testCaseContextR5.iProtocolConfigOption.iMiscBuffer.Copy(_L8("Miscellaneous buffer content"));
       
  3663 	testCaseContextR5.iNWIContext = ETrue;
       
  3664 	testCaseContextR5.iPFI = RPacketContext::EBestEffort;
       
  3665 	// R5 parameters
       
  3666 	testCaseContextR5.iPdpHeaderCompression = RPacketContext::ENoHeaderCompression;
       
  3667 	testCaseContextR5.iPdpDataCompression = RPacketContext::ENoDataCompression;
       
  3668 	TMockLtsyData1<RPacketContext::TContextConfig_R5> ltsyData(testCaseContextR5);
       
  3669 	ltsyData.SerialiseL(data);	
       
  3670 	
       
  3671 	// Create R5 related package that will received data from licensee TSY
       
  3672 	RPacketContext::TContextConfig_R5 getContextR5Param;	
       
  3673 	TPckg<RPacketContext::TContextConfig_R5> pckgParamR5(getContextR5Param);
       
  3674 			
       
  3675 	// Send request
       
  3676 	packetService.NotifyContextActivationRequested(requestStatus, pckgParamR5);
       
  3677 	
       
  3678 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3679 	// Issue the Complete...	
       
  3680 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);		
       
  3681 	// Wait for completion 
       
  3682 	User::WaitForRequest(mockLtsyStatus);
       
  3683 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3684     User::WaitForRequest(requestStatus);
       
  3685 
       
  3686     // Check that test case's and received TSY's packet context parameters match
       
  3687     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3688     ASSERT_EQUALS( testCaseContextR5.iPdpType, getContextR5Param.iPdpType );
       
  3689     ASSERT_EQUALS( testCaseContextR5.iAccessPointName, getContextR5Param.iAccessPointName );
       
  3690 	ASSERT_EQUALS( testCaseContextR5.iPdpAddress, getContextR5Param.iPdpAddress );
       
  3691 	ASSERT_EQUALS( testCaseContextR5.iUseEdge, getContextR5Param.iUseEdge );
       
  3692 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iAuthInfo.iProtocol, getContextR5Param.iProtocolConfigOption.iAuthInfo.iProtocol );
       
  3693 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iAuthInfo.iUsername, getContextR5Param.iProtocolConfigOption.iAuthInfo.iUsername );
       
  3694 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iAuthInfo.iPassword, getContextR5Param.iProtocolConfigOption.iAuthInfo.iPassword );
       
  3695 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iChallenge, getContextR5Param.iProtocolConfigOption.iChallenge );
       
  3696 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iResponse, getContextR5Param.iProtocolConfigOption.iResponse );
       
  3697 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iId, getContextR5Param.iProtocolConfigOption.iId );
       
  3698 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, getContextR5Param.iProtocolConfigOption.iDnsAddresses.iPrimaryDns );
       
  3699 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, getContextR5Param.iProtocolConfigOption.iDnsAddresses.iSecondaryDns );
       
  3700 	ASSERT_EQUALS( testCaseContextR5.iProtocolConfigOption.iMiscBuffer, getContextR5Param.iProtocolConfigOption.iMiscBuffer );
       
  3701 	ASSERT_EQUALS( testCaseContextR5.iNWIContext, getContextR5Param.iNWIContext );
       
  3702 	ASSERT_EQUALS( testCaseContextR5.iPFI, getContextR5Param.iPFI );
       
  3703 	ASSERT_EQUALS( testCaseContextR5.iPdpHeaderCompression, getContextR5Param.iPdpHeaderCompression );
       
  3704 	ASSERT_EQUALS( testCaseContextR5.iPdpDataCompression, getContextR5Param.iPdpDataCompression );
       
  3705 
       
  3706 	// Resend request
       
  3707 	packetService.NotifyContextActivationRequested(requestStatus, pckgParamR5);
       
  3708 
       
  3709     AssertMockLtsyStatusL();
       
  3710 
       
  3711 	// ------------------------------------------------------------------------
       
  3712 	// NotifyContextActivationRequested 
       
  3713 	// with RPacketContext::TContextConfigR99_R4 as parameter	
       
  3714 	// ------------------------------------------------------------------------	
       
  3715 	
       
  3716 	// Cancel request before making new request with TContextConfigR99_R4
       
  3717     packetService.CancelAsyncRequest(EPacketNotifyContextActivationRequested);
       
  3718     User::WaitForRequest(requestStatus);
       
  3719     ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
  3720 	
       
  3721 	// Create R99_R4 related data for CompleteL
       
  3722 	RPacketContext::TContextConfigR99_R4 testCaseContextR99_R4;	
       
  3723 	testCaseContextR99_R4.iPdpType = RPacketContext::EPdpTypeIPv6;
       
  3724 	testCaseContextR99_R4.iAccessPointName.Copy(_L8("PointName"));
       
  3725 	testCaseContextR99_R4.iPdpAddress.Copy(_L8("PdpAddress"));
       
  3726 	testCaseContextR99_R4.iUseEdge = ETrue;
       
  3727 	testCaseContextR99_R4.iProtocolConfigOption.iAuthInfo.iProtocol = RPacketContext::EProtocolPAP;
       
  3728 	testCaseContextR99_R4.iProtocolConfigOption.iAuthInfo.iUsername.Copy(_L8("username_username"));
       
  3729 	testCaseContextR99_R4.iProtocolConfigOption.iAuthInfo.iPassword.Copy(_L8("password_password"));
       
  3730 	testCaseContextR99_R4.iProtocolConfigOption.iChallenge.Copy(_L8("pseudorandom_pseudorandom"));
       
  3731 	testCaseContextR99_R4.iProtocolConfigOption.iResponse.Copy(_L8("pseudorandom_response"));
       
  3732 	testCaseContextR99_R4.iProtocolConfigOption.iId = 0x92;
       
  3733 	testCaseContextR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns.Copy(_L8("DnsAddresses_PrimaryDns") );
       
  3734 	testCaseContextR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns.Copy(_L8("DnsAddresses_SecondaryDns") );
       
  3735 	testCaseContextR99_R4.iProtocolConfigOption.iMiscBuffer.Copy(_L8("miscbuffer"));
       
  3736 	testCaseContextR99_R4.iNWIContext = EFalse;
       
  3737 	testCaseContextR99_R4.iPFI = RPacketContext::ESignalling;
       
  3738 	TMockLtsyData1<RPacketContext::TContextConfigR99_R4> ltsyDataR99_R4(testCaseContextR99_R4);
       
  3739 	data.Close();
       
  3740 	ltsyDataR99_R4.SerialiseL(data);	
       
  3741 	
       
  3742 	// Create R99_R4 related package that will received data from licensee TSY
       
  3743 	RPacketContext::TContextConfigR99_R4 getContextParametersR99_R4;	
       
  3744 	TPckg<RPacketContext::TContextConfigR99_R4> pckgParamR99_R4(getContextParametersR99_R4);	
       
  3745 	
       
  3746 	// Send request
       
  3747 	packetService.NotifyContextActivationRequested(requestStatus, pckgParamR99_R4);
       
  3748 	
       
  3749 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3750 	// Issue the Complete...	
       
  3751 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);
       
  3752 	// Wait for completion 
       
  3753 	User::WaitForRequest(mockLtsyStatus);
       
  3754 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3755 	User::WaitForRequest(requestStatus);
       
  3756 	
       
  3757     // Check that test case's and received TSY's packet context parameters match
       
  3758     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3759     ASSERT_EQUALS( testCaseContextR99_R4.iPdpType, getContextParametersR99_R4.iPdpType );
       
  3760     ASSERT_EQUALS( testCaseContextR99_R4.iAccessPointName, getContextParametersR99_R4.iAccessPointName );
       
  3761 	ASSERT_EQUALS( testCaseContextR99_R4.iPdpAddress, getContextParametersR99_R4.iPdpAddress );
       
  3762 	ASSERT_EQUALS( testCaseContextR99_R4.iUseEdge, getContextParametersR99_R4.iUseEdge );
       
  3763 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iAuthInfo.iProtocol, getContextParametersR99_R4.iProtocolConfigOption.iAuthInfo.iProtocol );
       
  3764 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iAuthInfo.iUsername, getContextParametersR99_R4.iProtocolConfigOption.iAuthInfo.iUsername );
       
  3765 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iAuthInfo.iPassword, getContextParametersR99_R4.iProtocolConfigOption.iAuthInfo.iPassword );
       
  3766 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iChallenge, getContextParametersR99_R4.iProtocolConfigOption.iChallenge );
       
  3767 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iResponse, getContextParametersR99_R4.iProtocolConfigOption.iResponse );
       
  3768 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iId, getContextParametersR99_R4.iProtocolConfigOption.iId );
       
  3769 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, getContextParametersR99_R4.iProtocolConfigOption.iDnsAddresses.iPrimaryDns );
       
  3770 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, getContextParametersR99_R4.iProtocolConfigOption.iDnsAddresses.iSecondaryDns );
       
  3771 	ASSERT_EQUALS( testCaseContextR99_R4.iProtocolConfigOption.iMiscBuffer, getContextParametersR99_R4.iProtocolConfigOption.iMiscBuffer );
       
  3772 	ASSERT_EQUALS( testCaseContextR99_R4.iNWIContext, getContextParametersR99_R4.iNWIContext );
       
  3773 	ASSERT_EQUALS( testCaseContextR99_R4.iPFI, getContextParametersR99_R4.iPFI );
       
  3774 
       
  3775 	// Resend request
       
  3776 	packetService.NotifyContextActivationRequested(requestStatus, pckgParamR99_R4);
       
  3777 
       
  3778 	AssertMockLtsyStatusL();		
       
  3779 	
       
  3780     // RPacketService, data, this 
       
  3781 	CleanupStack::PopAndDestroy(3, this); 	
       
  3782 	}
       
  3783 
       
  3784 /**
       
  3785 @SYMTestCaseID BA-CTSY-PKTS-PSNCAR-0002
       
  3786 @SYMPREQ 1551
       
  3787 @SYMComponent  telephony_ctsy
       
  3788 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyContextActivationRequested
       
  3789 @SYMTestPriority High
       
  3790 @SYMTestActions Invokes cancelling of RPacketService::NotifyContextActivationRequested
       
  3791 @SYMTestExpectedResults Pass
       
  3792 @SYMTestType CT
       
  3793 */
       
  3794 void CCTsyPacketServiceFU::TestNotifyContextActivationRequested0002L()
       
  3795 	{
       
  3796 	OpenEtelServerL(EUseExtendedError);
       
  3797 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3798 	OpenPhoneL();
       
  3799 	
       
  3800 	RPacketService packetService;
       
  3801 	OpenPacketServiceL(packetService);
       
  3802 	CleanupClosePushL(packetService);
       
  3803 
       
  3804  	//-------------------------------------------------------------------------
       
  3805 	// Test cancelling of RPacketService::NotifyContextActivationRequested
       
  3806  	//------------------------------------------------------------------------- 	 	
       
  3807 	// Data for CompleteL
       
  3808 	RPacketContext::TContextConfigGPRS configGPRS;
       
  3809 	TPckg<RPacketContext::TContextConfigGPRS> pckgParam(configGPRS);
       
  3810 
       
  3811 	TRequestStatus requestStatus;
       
  3812 	
       
  3813 	packetService.NotifyContextActivationRequested(requestStatus, pckgParam);
       
  3814 	packetService.CancelAsyncRequest(EPacketNotifyContextActivationRequested);
       
  3815 	
       
  3816     // Wait for answer 
       
  3817 	User::WaitForRequest(requestStatus);
       
  3818 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());	
       
  3819 	
       
  3820 	AssertMockLtsyStatusL();
       
  3821 	CleanupStack::PopAndDestroy(2); // this, packetService	
       
  3822 	}
       
  3823 
       
  3824 
       
  3825 /**
       
  3826 @SYMTestCaseID BA-CTSY-PKTS-PSNCAR-0003
       
  3827 @SYMPREQ 1551
       
  3828 @SYMComponent  telephony_ctsy
       
  3829 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyContextActivationRequested with bad parameter data
       
  3830 @SYMTestPriority High
       
  3831 @SYMTestActions Invokes RPacketService::NotifyContextActivationRequested with bad parameter data
       
  3832 @SYMTestExpectedResults Pass
       
  3833 @SYMTestType CT
       
  3834 */
       
  3835 void CCTsyPacketServiceFU::TestNotifyContextActivationRequested0003L()
       
  3836 	{
       
  3837 	OpenEtelServerL(EUseExtendedError);
       
  3838 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3839 	OpenPhoneL();
       
  3840 
       
  3841 	RBuf8 data;
       
  3842 	CleanupClosePushL(data);
       
  3843 	
       
  3844 	RPacketService packetService;
       
  3845 	OpenPacketServiceL(packetService);
       
  3846 	CleanupClosePushL(packetService);
       
  3847 
       
  3848 	
       
  3849 	//---------------------------------------------------------------------------------
       
  3850 	// send wrong type of parameter
       
  3851 	//---------------------------------------------------------------------------------	
       
  3852 	// Data for CompleteL
       
  3853 	TPacketDataConfigBase context;
       
  3854 	TMockLtsyData1 <TPacketDataConfigBase> ltsyData(context);
       
  3855 	ltsyData.SerialiseL(data);	
       
  3856 	
       
  3857 	TRequestStatus requestStatus;
       
  3858 	TInt contextParameters; // wrong type of parameter	
       
  3859 	TPckg<TInt> pckgParam(contextParameters);
       
  3860 	
       
  3861 	// send request
       
  3862 	packetService.NotifyContextActivationRequested(requestStatus, pckgParam);
       
  3863 	
       
  3864 	TRequestStatus mockLtsyStatus;
       
  3865 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3866 	// Issue the Complete...	
       
  3867 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);		
       
  3868 	// wait for completion 
       
  3869 	User::WaitForRequest(mockLtsyStatus);
       
  3870 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3871     
       
  3872     // wait for answer 
       
  3873 	User::WaitForRequest(requestStatus);
       
  3874 	AssertMockLtsyStatusL();
       
  3875 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3876 
       
  3877 	//---------------------------------------------------------------------------------
       
  3878 	// type of parameter to send is  RPacketContext::TContextConfigCDMA  
       
  3879 	// isn't supported
       
  3880 	//---------------------------------------------------------------------------------
       
  3881 	RPacketContext::TContextConfigCDMA contextParametersCDMA;	
       
  3882 	TPckg<RPacketContext::TContextConfigCDMA> pckgParamCDMA(contextParametersCDMA);
       
  3883 	
       
  3884 	// send request
       
  3885 	packetService.NotifyContextActivationRequested(requestStatus, pckgParamCDMA);
       
  3886 	
       
  3887 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3888 	// Issue the Complete...	
       
  3889 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);		
       
  3890 	// wait for completion 
       
  3891 	User::WaitForRequest(mockLtsyStatus);
       
  3892 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3893     
       
  3894     // wait for answer 
       
  3895 	User::WaitForRequest(requestStatus);
       
  3896 	AssertMockLtsyStatusL();
       
  3897 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3898 	
       
  3899 	CleanupStack::PopAndDestroy();// packetService
       
  3900 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  3901 
       
  3902 	}
       
  3903 
       
  3904 
       
  3905 /**
       
  3906 @SYMTestCaseID BA-CTSY-PKTS-PSNCAR-0004
       
  3907 @SYMPREQ 1551
       
  3908 @SYMComponent  telephony_ctsy
       
  3909 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyContextActivationRequested
       
  3910 @SYMTestPriority High
       
  3911 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyContextActivationRequested
       
  3912 @SYMTestExpectedResults Pass
       
  3913 @SYMTestType CT
       
  3914 */
       
  3915 void CCTsyPacketServiceFU::TestNotifyContextActivationRequested0004L()
       
  3916 	{
       
  3917 					
       
  3918 	OpenEtelServerL(EUseExtendedError);
       
  3919 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3920 	OpenPhoneL();
       
  3921 
       
  3922 	RBuf8 data;
       
  3923 	CleanupClosePushL(data);
       
  3924 
       
  3925 	// Open second client
       
  3926 	RTelServer telServer2;
       
  3927 	TInt ret = telServer2.Connect();
       
  3928 	ASSERT_EQUALS(KErrNone, ret);
       
  3929 	CleanupClosePushL(telServer2);
       
  3930 
       
  3931 	RMobilePhone phone2;
       
  3932 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  3933 	ASSERT_EQUALS(KErrNone, ret);
       
  3934 	CleanupClosePushL(phone2);
       
  3935 	
       
  3936 	RPacketService packetService;
       
  3937 	OpenPacketServiceL(packetService);
       
  3938 	CleanupClosePushL(packetService);
       
  3939 
       
  3940 	RPacketService packetService2;                
       
  3941 	ret = packetService2.Open(phone2);
       
  3942 	ASSERT_EQUALS(KErrNone, ret);
       
  3943 	CleanupClosePushL(packetService2); 
       
  3944 
       
  3945 	//-------------------------------------------------------------------------
       
  3946 	// Test A: Test multiple clients requesting 
       
  3947 	// RPacketService::NotifyContextActivationRequested
       
  3948  	//-------------------------------------------------------------------------
       
  3949 	
       
  3950 	// Data for CompleteL
       
  3951 	RPacketContext::TContextConfigGPRS sendConfigGPRS;	
       
  3952 	sendConfigGPRS.iPdpType         = RPacketContext::EPdpTypeIPv6;
       
  3953 	sendConfigGPRS.iPdpAddress.Copy(_L8("PdpAddress"));
       
  3954 	sendConfigGPRS.iAccessPointName.Copy(_L8("PointName"));
       
  3955 	TMockLtsyData1 <RPacketContext::TContextConfigGPRS > ltsyData(sendConfigGPRS);
       
  3956 	ltsyData.SerialiseL(data);	
       
  3957 		
       
  3958 	TRequestStatus requestStatus;
       
  3959 	RPacketContext::TContextConfigGPRS getConfigGPRS;	
       
  3960 	TPckg<RPacketContext::TContextConfigGPRS> pckgParam(getConfigGPRS);	
       
  3961 	// Send first request
       
  3962 	packetService.NotifyContextActivationRequested(requestStatus, pckgParam);
       
  3963 		
       
  3964 	TRequestStatus requestStatus2;
       
  3965 	RPacketContext::TContextConfigR99_R4 getConfigR99;	
       
  3966 	TPckg<RPacketContext::TContextConfigR99_R4> pckgParam2(getConfigR99);	
       
  3967 	// Send second request
       
  3968 	packetService2.NotifyContextActivationRequested(requestStatus2, pckgParam2);
       
  3969 		
       
  3970 	TRequestStatus mockLtsyStatus;
       
  3971 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  3972 	// Issue the Complete...	
       
  3973 	iMockLTSY.CompleteL(EPacketNotifyContextActivationRequested, KErrNone, data);		
       
  3974 	// Wait for completion 
       
  3975 	User::WaitForRequest(mockLtsyStatus);
       
  3976 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  3977     
       
  3978     // Wait for the first answer 
       
  3979 	User::WaitForRequest(requestStatus);
       
  3980 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3981 	ASSERT_EQUALS(sendConfigGPRS.iPdpType, getConfigGPRS.iPdpType);
       
  3982 	ASSERT_EQUALS(sendConfigGPRS.iAccessPointName, getConfigGPRS.iAccessPointName);
       
  3983 	ASSERT_EQUALS(sendConfigGPRS.iPdpAddress, getConfigGPRS.iPdpAddress);
       
  3984 	ASSERT_EQUALS(sendConfigGPRS.iPdpCompression, getConfigGPRS.iPdpCompression);
       
  3985 	ASSERT_EQUALS(sendConfigGPRS.iAnonymousAccessReqd, getConfigGPRS.iAnonymousAccessReqd);
       
  3986     ASSERT_EQUALS(sendConfigGPRS.iUseEdge, getConfigGPRS.iUseEdge);	
       
  3987 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iAuthInfo.iProtocol, getConfigGPRS.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  3988 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iAuthInfo.iUsername, getConfigGPRS.iProtocolConfigOption.iAuthInfo.iUsername);	
       
  3989 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iAuthInfo.iPassword, getConfigGPRS.iProtocolConfigOption.iAuthInfo.iPassword);	
       
  3990 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iChallenge, getConfigGPRS.iProtocolConfigOption.iChallenge);	
       
  3991 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iResponse, getConfigGPRS.iProtocolConfigOption.iResponse);	
       
  3992 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iId, getConfigGPRS.iProtocolConfigOption.iId);	
       
  3993 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, getConfigGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);	
       
  3994 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, getConfigGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);	
       
  3995 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iMiscBuffer, getConfigGPRS.iProtocolConfigOption.iMiscBuffer);	
       
  3996 	ASSERT_EQUALS(sendConfigGPRS.iNWIContext, getConfigGPRS.iNWIContext);		
       
  3997 	
       
  3998 	// Wait for the second answer 
       
  3999 	User::WaitForRequest(requestStatus2);
       
  4000 	AssertMockLtsyStatusL();
       
  4001 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  4002 	ASSERT_EQUALS(sendConfigGPRS.iPdpType, getConfigR99.iPdpType);
       
  4003 	ASSERT_EQUALS(sendConfigGPRS.iAccessPointName, getConfigR99.iAccessPointName);
       
  4004 	ASSERT_EQUALS(sendConfigGPRS.iPdpAddress, getConfigR99.iPdpAddress);
       
  4005     ASSERT_EQUALS(sendConfigGPRS.iUseEdge, getConfigR99.iUseEdge);	
       
  4006 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iAuthInfo.iProtocol, getConfigR99.iProtocolConfigOption.iAuthInfo.iProtocol);	
       
  4007 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iAuthInfo.iUsername, getConfigR99.iProtocolConfigOption.iAuthInfo.iUsername);	
       
  4008 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iAuthInfo.iPassword, getConfigR99.iProtocolConfigOption.iAuthInfo.iPassword);	
       
  4009 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iChallenge, getConfigR99.iProtocolConfigOption.iChallenge);	
       
  4010 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iResponse, getConfigR99.iProtocolConfigOption.iResponse);	
       
  4011 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iId, getConfigR99.iProtocolConfigOption.iId);	
       
  4012 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iDnsAddresses.iPrimaryDns, getConfigR99.iProtocolConfigOption.iDnsAddresses.iPrimaryDns);	
       
  4013 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iDnsAddresses.iSecondaryDns, getConfigR99.iProtocolConfigOption.iDnsAddresses.iSecondaryDns);	
       
  4014 	ASSERT_EQUALS(sendConfigGPRS.iProtocolConfigOption.iMiscBuffer, getConfigR99.iProtocolConfigOption.iMiscBuffer);	
       
  4015 	ASSERT_EQUALS(sendConfigGPRS.iNWIContext, getConfigR99.iNWIContext);
       
  4016 	ASSERT_EQUALS(RPacketContext::EBestEffort, getConfigR99.iPFI );	
       
  4017 
       
  4018 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  4019 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  4020 
       
  4021 	}
       
  4022 
       
  4023 /**
       
  4024 @SYMTestCaseID BA-CTSY-PKTS-PSA-0001
       
  4025 @SYMPREQ 1551
       
  4026 @SYMComponent  telephony_ctsy
       
  4027 @SYMTestCaseDesc Test support in CTSY for RPacketService::Attach
       
  4028 @SYMTestPriority High
       
  4029 @SYMTestActions Invokes RPacketService::Attach
       
  4030 @SYMTestExpectedResults Pass
       
  4031 @SYMTestType CT
       
  4032 */
       
  4033 void CCTsyPacketServiceFU::TestAttach0001L()
       
  4034 	{
       
  4035 
       
  4036 	OpenEtelServerL(EUseExtendedError);
       
  4037 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4038 	OpenPhoneL();
       
  4039 	
       
  4040 	RPacketService packetService;
       
  4041 	OpenPacketServiceL(packetService);
       
  4042 	CleanupClosePushL(packetService);	
       
  4043 	
       
  4044 	TRequestStatus requestStatus;
       
  4045 	
       
  4046 	//-------------------------------------------------------------------------
       
  4047 	// TEST A: failure to dispatch request to LTSY
       
  4048  	//-------------------------------------------------------------------------
       
  4049 	iMockLTSY.ExpectL(EPacketAttach, KErrNotSupported);	
       
  4050 	packetService.Attach(requestStatus);
       
  4051 	
       
  4052 	User::WaitForRequest(requestStatus);
       
  4053 	//prepare error code 
       
  4054 	TInt errorCode = ( KErrGeneral & 0x0000FFFF ) |( KErrGsmMMNetworkFailure << 16 );	
       
  4055 	errorCode = (errorCode>>16) | 0xFFFF0000;
       
  4056 	ASSERT_EQUALS(errorCode, requestStatus.Int());	
       
  4057 	
       
  4058  	//-------------------------------------------------------------------------
       
  4059 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  4060  	//-------------------------------------------------------------------------
       
  4061 	iMockLTSY.ExpectL(EPacketAttach);
       
  4062 	iMockLTSY.CompleteL(EPacketAttach, KErrGeneral);
       
  4063 	
       
  4064 	packetService.Attach(requestStatus);	
       
  4065 	User::WaitForRequest(requestStatus);
       
  4066 	AssertMockLtsyStatusL();
       
  4067 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  4068 
       
  4069 	// TEST B: failure with specific error (KErrGsmPSConnectionBarred) from LTSY->CTSY 
       
  4070 	iMockLTSY.ExpectL(EPacketAttach);
       
  4071 	iMockLTSY.CompleteL(EPacketAttach, KErrGsmPSConnectionBarred);
       
  4072 		
       
  4073 	packetService.Attach(requestStatus);	
       
  4074 	User::WaitForRequest(requestStatus);
       
  4075 	AssertMockLtsyStatusL();
       
  4076 	ASSERT_EQUALS(KErrGsmPSConnectionBarred, requestStatus.Int());
       
  4077 		
       
  4078  	//-------------------------------------------------------------------------
       
  4079 	// TEST C: Successful completion request of
       
  4080 	// RPacketService::Attach when result is not cached.
       
  4081  	//-------------------------------------------------------------------------
       
  4082 
       
  4083 	iMockLTSY.ExpectL(EPacketAttach);
       
  4084 	iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4085 	
       
  4086 	packetService.Attach(requestStatus);	
       
  4087 	User::WaitForRequest(requestStatus);
       
  4088 	AssertMockLtsyStatusL();
       
  4089 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4090 
       
  4091  	//-------------------------------------------------------------------------
       
  4092 	// TEST D: RPacketService::Attach again, this time CTSY
       
  4093 	// will get result from the cache.
       
  4094  	//-------------------------------------------------------------------------
       
  4095 	packetService.Attach(requestStatus);	
       
  4096 	User::WaitForRequest(requestStatus);
       
  4097 	ASSERT_EQUALS(KErrAlreadyExists, requestStatus.Int());
       
  4098 	AssertMockLtsyStatusL();
       
  4099 	
       
  4100  	//-------------------------------------------------------------------------
       
  4101 	// TEST E: Unsolicited completion of RPacketService::Attach
       
  4102 	// from LTSY.
       
  4103  	//-------------------------------------------------------------------------	
       
  4104 	TRequestStatus mockLtsyStatus;
       
  4105 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  4106 	//Unsolicited completion
       
  4107 	iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4108 	User::WaitForRequest(mockLtsyStatus); 
       
  4109 	
       
  4110 	AssertMockLtsyStatusL();
       
  4111 	CleanupStack::PopAndDestroy(2, this); // packetService, this
       
  4112 	}
       
  4113 
       
  4114 
       
  4115 /**
       
  4116 @SYMTestCaseID BA-CTSY-PKTS-PSA-0002
       
  4117 @SYMPREQ 1551
       
  4118 @SYMComponent  telephony_ctsy
       
  4119 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::Attach
       
  4120 @SYMTestPriority High
       
  4121 @SYMTestActions Invokes cancelling of RPacketService::Attach
       
  4122 @SYMTestExpectedResults Pass
       
  4123 @SYMTestType CT
       
  4124 */
       
  4125 void CCTsyPacketServiceFU::TestAttach0002L()
       
  4126 	{
       
  4127 	OpenEtelServerL(EUseExtendedError);
       
  4128 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4129 	OpenPhoneL();
       
  4130 
       
  4131 	RPacketService packetService;
       
  4132 	OpenPacketServiceL(packetService);
       
  4133 	CleanupClosePushL(packetService);
       
  4134 	
       
  4135 	TRequestStatus mockLtsyStatus;
       
  4136 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4137 
       
  4138  	//-------------------------------------------------------------------------
       
  4139 	// Test cancelling of RPacketService::Attach
       
  4140  	//-------------------------------------------------------------------------
       
  4141  	TRequestStatus requestStatus;
       
  4142 	iMockLTSY.ExpectL(EPacketAttach);
       
  4143 	iMockLTSY.CompleteL(EPacketAttach, KErrNone, 5);	
       
  4144 	packetService.Attach(requestStatus);
       
  4145 	packetService.CancelAsyncRequest(EPacketAttach);
       
  4146 	
       
  4147 	User::WaitForRequest(requestStatus);
       
  4148 	// TSY has started a request and it is not possible to then
       
  4149     // cancel this request. The best thing for the TSY to do in this case
       
  4150     // is to proceed as though the Cancel never happened. The server's 
       
  4151     // call to the TSY cancel function will return synchronously.
       
  4152 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4153 
       
  4154 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  4155 	User::WaitForRequest(mockLtsyStatus);
       
  4156 	AssertMockLtsyStatusL();
       
  4157 	CleanupStack::PopAndDestroy(2); // packetService, this
       
  4158 	
       
  4159 	}
       
  4160 
       
  4161 
       
  4162 /**
       
  4163 @SYMTestCaseID BA-CTSY-PKTS-PSA-0004
       
  4164 @SYMPREQ 1551
       
  4165 @SYMComponent  telephony_ctsy
       
  4166 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::Attach
       
  4167 @SYMTestPriority High
       
  4168 @SYMTestActions Invokes multiple client requests to RPacketService::Attach
       
  4169 @SYMTestExpectedResults Pass
       
  4170 @SYMTestType CT
       
  4171 */
       
  4172 void CCTsyPacketServiceFU::TestAttach0004L()
       
  4173 	{
       
  4174 					
       
  4175 	OpenEtelServerL(EUseExtendedError);
       
  4176 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4177 	OpenPhoneL();
       
  4178 
       
  4179 	RBuf8 data;
       
  4180 	CleanupClosePushL(data);
       
  4181 
       
  4182 	// Open second client
       
  4183 	RTelServer telServer2;
       
  4184 	TInt ret = telServer2.Connect();
       
  4185 	ASSERT_EQUALS(KErrNone, ret);
       
  4186 	CleanupClosePushL(telServer2);
       
  4187 
       
  4188 	RMobilePhone phone2;
       
  4189 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4190 	ASSERT_EQUALS(KErrNone, ret);
       
  4191 	CleanupClosePushL(phone2);
       
  4192 	
       
  4193 	RPacketService packetService;
       
  4194 	OpenPacketServiceL(packetService);
       
  4195 	CleanupClosePushL(packetService);
       
  4196 
       
  4197 	RPacketService packetService2;                
       
  4198 	ret = packetService2.Open(phone2);
       
  4199 	ASSERT_EQUALS(KErrNone, ret);
       
  4200 	CleanupClosePushL(packetService2); 
       
  4201 
       
  4202 	//-------------------------------------------------------------------------
       
  4203 	// Test A: Test multiple clients requesting RPacketService::Attach
       
  4204  	//-------------------------------------------------------------------------
       
  4205 
       
  4206 	TRequestStatus requestStatus;
       
  4207 	TRequestStatus requestStatus2;
       
  4208 	iMockLTSY.ExpectL(EPacketAttach);
       
  4209 	iMockLTSY.CompleteL(EPacketAttach, KErrNone, 2);
       
  4210 	
       
  4211 	packetService.Attach(requestStatus);	
       
  4212 	packetService2.Attach(requestStatus2);
       
  4213 	
       
  4214 	// wait for the first answer
       
  4215 	User::WaitForRequest(requestStatus);
       
  4216 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4217 	
       
  4218 	// wait for the second answer
       
  4219 	User::WaitForRequest(requestStatus2);
       
  4220 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4221 	
       
  4222 	AssertMockLtsyStatusL();
       
  4223 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  4224 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this	
       
  4225 	}
       
  4226 
       
  4227 
       
  4228 /**
       
  4229 @SYMTestCaseID BA-CTSY-PKTS-PSA-0005
       
  4230 @SYMPREQ 1551
       
  4231 @SYMComponent  telephony_ctsy
       
  4232 @SYMTestCaseDesc Test support in CTSY for RPacketService::Attach with timeout
       
  4233 @SYMTestPriority High
       
  4234 @SYMTestActions Invokes RPacketService::Attach and tests for timeout
       
  4235 @SYMTestExpectedResults Pass
       
  4236 @SYMTestType CT
       
  4237 */
       
  4238 void CCTsyPacketServiceFU::TestAttach0005L()
       
  4239 	{
       
  4240 	OpenEtelServerL(EUseExtendedError);
       
  4241 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4242 	OpenPhoneL();
       
  4243 
       
  4244 	RPacketService packetService;
       
  4245 	OpenPacketServiceL(packetService);
       
  4246 	CleanupClosePushL(packetService);
       
  4247 
       
  4248 	//-------------------------------------------------------------------------
       
  4249 	// Test A: Test timeout of RPacketService::Attach
       
  4250  	//-------------------------------------------------------------------------
       
  4251 	TRequestStatus requestStatus;
       
  4252 	iMockLTSY.ExpectL(EPacketAttach);
       
  4253 	packetService.Attach(requestStatus);
       
  4254 		
       
  4255 	User::WaitForRequest(requestStatus);
       
  4256 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  4257 	
       
  4258 	AssertMockLtsyStatusL();
       
  4259 	CleanupStack::PopAndDestroy(2, this); // packetService, this
       
  4260 	}
       
  4261 
       
  4262 
       
  4263 /**
       
  4264 @SYMTestCaseID BA-CTSY-PKTS-PSD-0001
       
  4265 @SYMPREQ 1551
       
  4266 @SYMComponent  telephony_ctsy
       
  4267 @SYMTestCaseDesc Test support in CTSY for RPacketService::Detach
       
  4268 @SYMTestPriority High
       
  4269 @SYMTestActions Invokes RPacketService::Detach
       
  4270 @SYMTestExpectedResults Pass
       
  4271 @SYMTestType CT
       
  4272 */
       
  4273 void CCTsyPacketServiceFU::TestDetach0001L()
       
  4274     {
       
  4275     OpenEtelServerL(EUseExtendedError);
       
  4276     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4277     OpenPhoneL();
       
  4278 
       
  4279     RBuf8 data;
       
  4280     CleanupClosePushL(data);
       
  4281 
       
  4282     RBuf8 dataExpect;
       
  4283     CleanupClosePushL(dataExpect);
       
  4284 
       
  4285     RPacketService packetService;       
       
  4286     OpenPacketServiceL(packetService);
       
  4287     CleanupClosePushL(packetService); 
       
  4288       
       
  4289     // make status "attached"
       
  4290     TRequestStatus requestStatus;
       
  4291     TRequestStatus mockLtsyStatus;
       
  4292     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4293     iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4294     User::WaitForRequest(mockLtsyStatus);
       
  4295     AssertMockLtsyStatusL();
       
  4296 
       
  4297     //-------------------------------------------------------------------------
       
  4298     // TEST A: failure to dispatch request to LTSY
       
  4299      //-------------------------------------------------------------------------
       
  4300 
       
  4301     iMockLTSY.ExpectL(EPacketDetach, KErrNotSupported);
       
  4302 
       
  4303     packetService.Detach(requestStatus);
       
  4304     User::WaitForRequest(requestStatus);
       
  4305     AssertMockLtsyStatusL();
       
  4306     ASSERT_EQUALS(KErrGsmMMNetworkFailure, requestStatus.Int());
       
  4307 
       
  4308     //-------------------------------------------------------------------------
       
  4309     // TEST B: failure on completion of pending request from LTSY->CTSY
       
  4310     //-------------------------------------------------------------------------
       
  4311     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4312     iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4313     User::WaitForRequest(mockLtsyStatus);
       
  4314     AssertMockLtsyStatusL();
       
  4315 
       
  4316     iMockLTSY.ExpectL(EPacketDetach);
       
  4317     iMockLTSY.CompleteL(EPacketDetach, KErrGeneral);
       
  4318 
       
  4319     // data for ExpectL
       
  4320     RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenPossible;
       
  4321     TMockLtsyData1<RPacketService::TAttachMode> ltsyData2(attachMode);
       
  4322     ltsyData2.SerialiseL(dataExpect);
       
  4323      
       
  4324     iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  4325 
       
  4326     packetService.Detach(requestStatus);
       
  4327     User::WaitForRequest(requestStatus);
       
  4328     AssertMockLtsyStatusL();
       
  4329     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  4330 
       
  4331      //-------------------------------------------------------------------------
       
  4332     // TEST C: Successful completion request of
       
  4333     // RPacketService::Detach when result is not cached.
       
  4334      //-------------------------------------------------------------------------
       
  4335 
       
  4336     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4337     iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4338     User::WaitForRequest(mockLtsyStatus);
       
  4339     AssertMockLtsyStatusL();
       
  4340 
       
  4341     iMockLTSY.ExpectL(EPacketDetach);
       
  4342     iMockLTSY.CompleteL(EPacketDetach, KErrNone);
       
  4343 
       
  4344     iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  4345 
       
  4346     packetService.Detach(requestStatus);
       
  4347     User::WaitForRequest(requestStatus);
       
  4348     AssertMockLtsyStatusL();
       
  4349     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4350 
       
  4351      //-------------------------------------------------------------------------
       
  4352     // TEST D: RPacketService::Detach again
       
  4353      //-------------------------------------------------------------------------
       
  4354 
       
  4355     packetService.Detach(requestStatus);
       
  4356     User::WaitForRequest(requestStatus);
       
  4357     AssertMockLtsyStatusL();
       
  4358     ASSERT_EQUALS(KErrAlreadyExists, requestStatus.Int());
       
  4359 
       
  4360     //---------------------------------
       
  4361     // Detach if context is not active
       
  4362     //---------------------------------
       
  4363        
       
  4364     // Open new context
       
  4365     TInfoName contextId; 
       
  4366     RPacketContext packetContext;
       
  4367     packetContext.OpenNewContext(packetService, contextId);
       
  4368     CleanupClosePushL(packetContext);
       
  4369           
       
  4370     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4371     iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4372     User::WaitForRequest(mockLtsyStatus);
       
  4373     AssertMockLtsyStatusL();
       
  4374 
       
  4375     iMockLTSY.ExpectL(EPacketDetach);
       
  4376     iMockLTSY.CompleteL(EPacketDetach, KErrNone);
       
  4377 
       
  4378     iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  4379 
       
  4380     packetService.Detach(requestStatus);
       
  4381     User::WaitForRequest(requestStatus);
       
  4382     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4383 
       
  4384     AssertMockLtsyStatusL();
       
  4385 
       
  4386     //---------------------------------
       
  4387     // Detach if context is active
       
  4388     //---------------------------------
       
  4389            
       
  4390     // initialisation of the context 
       
  4391     TInt status = InitContextL(packetContext, contextId);
       
  4392     ASSERT_EQUALS(KErrNone, status);
       
  4393 
       
  4394     // Set context in Active state
       
  4395     status = SetContextActiveL(contextId);
       
  4396     ASSERT_EQUALS(KErrNone, status); 
       
  4397        
       
  4398     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4399     iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4400     User::WaitForRequest(mockLtsyStatus);
       
  4401     AssertMockLtsyStatusL();
       
  4402 
       
  4403     packetService.Detach(requestStatus);
       
  4404     User::WaitForRequest(requestStatus);
       
  4405     ASSERT_EQUALS(KErrInUse, requestStatus.Int());
       
  4406     AssertMockLtsyStatusL();
       
  4407 
       
  4408     //-------------------------------------------------------------------------
       
  4409     // TEST E: Unsolicited completion of RPacketService::Detach
       
  4410     // from LTSY. With attach mode == RPacketService::EAttachWhenNeeded;
       
  4411     // and 
       
  4412     //------------------------------------------------------------------------- 
       
  4413 
       
  4414     // --- Set AttachMode  to RPacketService::EAttachWhenNeeded
       
  4415     // data for ExpectL
       
  4416     attachMode = RPacketService::EAttachWhenNeeded;
       
  4417     TMockLtsyData1<RPacketService::TAttachMode> ltsyData3(attachMode);
       
  4418     dataExpect.Close();
       
  4419     ltsyData3.SerialiseL(dataExpect);
       
  4420 
       
  4421     // Set attachMode status to  EAttachWhenNeeded 
       
  4422     iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);		
       
  4423     iMockLTSY.CompleteL(EPacketSetAttachMode, KErrNone);
       
  4424     	
       
  4425     packetService.SetAttachMode(requestStatus, attachMode);	
       
  4426     User::WaitForRequest(requestStatus);
       
  4427     ASSERT_EQUALS(KErrNone, requestStatus.Int());  
       
  4428 
       
  4429     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4430     // send Unsolicited completion
       
  4431     iMockLTSY.CompleteL(EPacketDetach, KErrNone);
       
  4432     User::WaitForRequest(mockLtsyStatus);
       
  4433     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  4434 
       
  4435     CleanupStack::PopAndDestroy(1); //packetContext
       
  4436     CleanupStack::PopAndDestroy(1); //packetService
       
  4437     CleanupStack::PopAndDestroy(3, this); //dataExpect,  data, this
       
  4438 
       
  4439     }
       
  4440 
       
  4441 /**
       
  4442 @SYMTestCaseID BA-CTSY-PKTS-PSD-0002
       
  4443 @SYMPREQ 1551
       
  4444 @SYMComponent  telephony_ctsy
       
  4445 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::Detach
       
  4446 @SYMTestPriority High
       
  4447 @SYMTestActions Invokes cancelling of RPacketService::Detach
       
  4448 @SYMTestExpectedResults Pass
       
  4449 @SYMTestType CT
       
  4450 */
       
  4451 void CCTsyPacketServiceFU::TestDetach0002L()
       
  4452 	{
       
  4453 	OpenEtelServerL(EUseExtendedError);
       
  4454 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4455 	OpenPhoneL();
       
  4456 
       
  4457 	RBuf8 data;
       
  4458 	CleanupClosePushL(data);
       
  4459 
       
  4460 	RBuf8 dataExpect;
       
  4461 	CleanupClosePushL(dataExpect);
       
  4462 	
       
  4463     RPacketService packetService;       
       
  4464     OpenPacketServiceL(packetService);
       
  4465     CleanupClosePushL(packetService);	
       
  4466 
       
  4467  	//-------------------------------------------------------------------------
       
  4468 	// Test cancelling of RPacketService::Detach
       
  4469  	//-------------------------------------------------------------------------
       
  4470  	
       
  4471 	TRequestStatus mockLtsyStatus;
       
  4472 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4473 	iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4474 	User::WaitForRequest(mockLtsyStatus);
       
  4475 	AssertMockLtsyStatusL();
       
  4476 
       
  4477 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4478 	iMockLTSY.ExpectL(EPacketDetach);
       
  4479 	iMockLTSY.CompleteL(EPacketDetach, KErrNone);
       
  4480 	
       
  4481 	// data for ExpectL
       
  4482  	RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenPossible;
       
  4483  	TMockLtsyData1<RPacketService::TAttachMode> ltsyData(attachMode);
       
  4484  	ltsyData.SerialiseL(dataExpect);
       
  4485 	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  4486 	
       
  4487     TRequestStatus requestStatus;
       
  4488 	packetService.Detach(requestStatus);
       
  4489 	packetService.CancelAsyncRequest(EPacketDetach);
       
  4490 	User::WaitForRequest(requestStatus);
       
  4491 	// TSY has started a request and it is not possible to then
       
  4492     // cancel this request. The best thing for the TSY to do in this case
       
  4493     // is to proceed as though the Cancel never happened. The server's 
       
  4494     // call to the TSY cancel function will return synchronously
       
  4495 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4496 
       
  4497 	// Wait for completion of iMockLTSY.NotifyTerminated
       
  4498 	User::WaitForRequest(mockLtsyStatus);
       
  4499 	CleanupStack::PopAndDestroy(1); //packetService
       
  4500 	CleanupStack::PopAndDestroy(3, this); //dataExpect,  data, this
       
  4501 	}
       
  4502 
       
  4503 
       
  4504 /**
       
  4505 @SYMTestCaseID BA-CTSY-PKTS-PSD-0004
       
  4506 @SYMPREQ 1551
       
  4507 @SYMComponent  telephony_ctsy
       
  4508 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::Detach
       
  4509 @SYMTestPriority High
       
  4510 @SYMTestActions Invokes multiple client requests to RPacketService::Detach
       
  4511 @SYMTestExpectedResults Pass
       
  4512 @SYMTestType CT
       
  4513 */
       
  4514 void CCTsyPacketServiceFU::TestDetach0004L()
       
  4515 	{
       
  4516 	OpenEtelServerL(EUseExtendedError);
       
  4517 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4518 	OpenPhoneL();
       
  4519 
       
  4520 	RBuf8 data;
       
  4521 	CleanupClosePushL(data); 
       
  4522 	
       
  4523 	RBuf8 dataExpect;
       
  4524 	CleanupClosePushL(dataExpect); 
       
  4525 
       
  4526 	// Open second client
       
  4527 	RTelServer telServer2;
       
  4528 	TInt ret = telServer2.Connect();
       
  4529 	ASSERT_EQUALS(KErrNone, ret);
       
  4530 	CleanupClosePushL(telServer2);
       
  4531 
       
  4532 	RMobilePhone phone2;
       
  4533 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4534 	ASSERT_EQUALS(KErrNone, ret);
       
  4535 	CleanupClosePushL(phone2);
       
  4536 
       
  4537     RPacketService packetService;
       
  4538     OpenPacketServiceL(packetService);
       
  4539     CleanupClosePushL(packetService);
       
  4540 
       
  4541     RPacketService packetService2;                
       
  4542     ret = packetService2.Open(phone2);
       
  4543     ASSERT_EQUALS(KErrNone, ret); 
       
  4544     CleanupClosePushL(packetService2);
       
  4545 
       
  4546 	//-------------------------------------------------------------------------
       
  4547 	// Test A: Test multiple clients requesting RPacketService::Detach
       
  4548  	//-------------------------------------------------------------------------
       
  4549 	TRequestStatus mockLtsyStatus;
       
  4550 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4551 	iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4552 	User::WaitForRequest(mockLtsyStatus);
       
  4553 	AssertMockLtsyStatusL();
       
  4554 
       
  4555 	iMockLTSY.ExpectL(EPacketDetach);
       
  4556 	iMockLTSY.CompleteL(EPacketDetach, KErrNone);
       
  4557 	
       
  4558 	// data for ExpectL
       
  4559  	RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenPossible;
       
  4560  	TMockLtsyData1<RPacketService::TAttachMode> ltsyData(attachMode);
       
  4561  	ltsyData.SerialiseL(dataExpect); 		
       
  4562 	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  4563 	
       
  4564 	TRequestStatus requestStatus;
       
  4565 	packetService.Detach(requestStatus);
       
  4566 
       
  4567 	TRequestStatus requestStatus2;
       
  4568 	packetService2.Detach(requestStatus2);
       
  4569 		
       
  4570 	User::WaitForRequest(requestStatus);
       
  4571 	AssertMockLtsyStatusL();
       
  4572 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4573 
       
  4574 	User::WaitForRequest(requestStatus2);
       
  4575 	AssertMockLtsyStatusL();
       
  4576 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4577 
       
  4578 	CleanupStack::PopAndDestroy(2);
       
  4579 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, dataExpect, data, this
       
  4580 
       
  4581 	}
       
  4582 
       
  4583 
       
  4584 /**
       
  4585 @SYMTestCaseID BA-CTSY-PKTS-PSD-0005
       
  4586 @SYMPREQ 1551
       
  4587 @SYMComponent  telephony_ctsy
       
  4588 @SYMTestCaseDesc Test support in CTSY for RPacketService::Detach with timeout
       
  4589 @SYMTestPriority High
       
  4590 @SYMTestActions Invokes RPacketService::Detach and tests for timeout
       
  4591 @SYMTestExpectedResults Pass
       
  4592 @SYMTestType CT
       
  4593 */
       
  4594 void CCTsyPacketServiceFU::TestDetach0005L()
       
  4595 	{
       
  4596 
       
  4597 	OpenEtelServerL(EUseExtendedError);
       
  4598 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4599 	OpenPhoneL();
       
  4600 
       
  4601 	RBuf8 data;
       
  4602 	CleanupClosePushL(data);
       
  4603 	
       
  4604 	RBuf8 dataExpect;
       
  4605 	CleanupClosePushL(dataExpect);
       
  4606 
       
  4607     RPacketService packetService;       
       
  4608     OpenPacketServiceL(packetService);
       
  4609     CleanupClosePushL(packetService);	
       
  4610 
       
  4611 	//-------------------------------------------------------------------------
       
  4612 	// Test A: Test timeout of RPacketService::Detach
       
  4613  	//-------------------------------------------------------------------------
       
  4614 
       
  4615 	// make status "attached"
       
  4616     TRequestStatus requestStatus;
       
  4617 	TRequestStatus mockLtsyStatus;
       
  4618 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4619 	iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4620 	User::WaitForRequest(mockLtsyStatus);
       
  4621 	AssertMockLtsyStatusL();
       
  4622 
       
  4623 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4624 	iMockLTSY.ExpectL(EPacketDetach);
       
  4625 	iMockLTSY.CompleteL(EPacketAttach, KErrNone);
       
  4626 
       
  4627 	// data for ExpectL
       
  4628  	RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenPossible;
       
  4629  	TMockLtsyData1<RPacketService::TAttachMode> ltsyData(attachMode);
       
  4630  	ltsyData.SerialiseL(dataExpect); 		
       
  4631 	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  4632 
       
  4633 	packetService.Detach(requestStatus);
       
  4634 	User::WaitForRequest(requestStatus);
       
  4635 
       
  4636 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  4637 
       
  4638 	User::WaitForRequest(mockLtsyStatus);
       
  4639 	AssertMockLtsyStatusL();
       
  4640 
       
  4641 	CleanupStack::PopAndDestroy(1);
       
  4642 	CleanupStack::PopAndDestroy(3, this); // dataExpect, data, this
       
  4643 
       
  4644 	}
       
  4645 
       
  4646 
       
  4647 /**
       
  4648 @SYMTestCaseID BA-CTSY-PKTS-PSGS-0001
       
  4649 @SYMPREQ 1551
       
  4650 @SYMComponent  telephony_ctsy
       
  4651 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetStatus
       
  4652 @SYMTestPriority High
       
  4653 @SYMTestActions Invokes RPacketService::GetStatus
       
  4654 @SYMTestExpectedResults Pass
       
  4655 @SYMTestType CT
       
  4656 */
       
  4657 void CCTsyPacketServiceFU::TestGetStatus0001L()
       
  4658 	{
       
  4659 
       
  4660 	OpenEtelServerL(EUseExtendedError);
       
  4661 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4662 	OpenPhoneL();
       
  4663 
       
  4664 	RBuf8 data;
       
  4665 	CleanupClosePushL(data);
       
  4666 	
       
  4667     RPacketService packetService;       
       
  4668     OpenPacketServiceL(packetService);
       
  4669     CleanupClosePushL(packetService);	
       
  4670 
       
  4671     RPacketService::TStatus status;
       
  4672     TInt ret = packetService.GetStatus(status);
       
  4673     ASSERT_EQUALS(KErrNone, ret);
       
  4674     ASSERT_EQUALS(RPacketService::EStatusUnattached, status);
       
  4675 
       
  4676     // now change status 
       
  4677 	TRequestStatus mockLtsyStatus;
       
  4678 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4679 	
       
  4680 	RPacketService::TStatus sendStatus = RPacketService::EStatusAttached;
       
  4681 	TBool isResumed = EFalse;
       
  4682 	TMockLtsyData2 <RPacketService::TStatus, TBool > ltsyData(sendStatus, isResumed);
       
  4683 	ltsyData.SerialiseL(data);	
       
  4684 		
       
  4685 	iMockLTSY.CompleteL(EPacketNotifyStatusChange, KErrNone, data);
       
  4686 
       
  4687 	User::WaitForRequest(mockLtsyStatus);
       
  4688 
       
  4689     // get new status
       
  4690     ret = packetService.GetStatus(status);
       
  4691     ASSERT_EQUALS(KErrNone, ret);
       
  4692     ASSERT_EQUALS(RPacketService::EStatusAttached, status);
       
  4693 
       
  4694 
       
  4695 	AssertMockLtsyStatusL();
       
  4696 	CleanupStack::PopAndDestroy(1); //packetService
       
  4697 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  4698 	
       
  4699 	}
       
  4700 
       
  4701 
       
  4702 
       
  4703 /**
       
  4704 @SYMTestCaseID BA-CTSY-PKTS-PSO-0001
       
  4705 @SYMPREQ 1551
       
  4706 @SYMComponent  telephony_ctsy
       
  4707 @SYMTestCaseDesc Test support in CTSY for RPacketService::Open
       
  4708 @SYMTestPriority High
       
  4709 @SYMTestActions Invokes RPacketService::Open
       
  4710 @SYMTestExpectedResults Pass
       
  4711 @SYMTestType CT
       
  4712 */
       
  4713 void CCTsyPacketServiceFU::TestOpen0001L()
       
  4714 	{
       
  4715     OpenEtelServerL(EUseExtendedError);
       
  4716 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4717 	OpenPhoneL();
       
  4718 	
       
  4719 	RBuf8 data;
       
  4720 	CleanupClosePushL(data);
       
  4721 
       
  4722 
       
  4723     TRequestStatus mockLtsyStatus;
       
  4724 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4725 	
       
  4726 	iMockLTSY.ExpectL(EPacketNotifyStatusChange);
       
  4727 	
       
  4728 	TBool resumed = EFalse;
       
  4729     RPacketService::TStatus	status(RPacketService::EStatusUnattached);
       
  4730     TMockLtsyData2<RPacketService::TStatus , TBool> comNotifyStatus(status, resumed);
       
  4731 	comNotifyStatus.SerialiseL(data);
       
  4732 	iMockLTSY.CompleteL(EPacketNotifyStatusChange,KErrNone, data);
       
  4733 	
       
  4734 	TBool expInitState = ETrue;	 
       
  4735 	TMockLtsyData1<TBool> expGetAttachMode(expInitState);
       
  4736 	data.Close();
       
  4737 	expGetAttachMode.SerialiseL(data);
       
  4738 	iMockLTSY.ExpectL(EPacketGetAttachMode, data);
       
  4739 	
       
  4740 	RPacketService::TAttachMode mode(RPacketService::EAttachWhenNeeded);
       
  4741 	TMockLtsyData1<RPacketService::TAttachMode> comGetAttachMode(mode);
       
  4742 	data.Close();
       
  4743 	comGetAttachMode.SerialiseL(data);
       
  4744 	iMockLTSY.CompleteL(EPacketGetAttachMode,KErrNone, data);
       
  4745 	
       
  4746     TInt maxServices = 10;
       
  4747 	TMockLtsyData1< TInt > iniData(maxServices);
       
  4748     iniData.SerialiseL(data); 	
       
  4749 	iMockLTSY.ExpectL(EPacketEnumerateMbmsMonitorServiceList);
       
  4750 	iMockLTSY.CompleteL( EPacketEnumerateMbmsMonitorServiceList, KErrNone, data );
       
  4751 	
       
  4752 	TInt maxMonitorServices = 10; 
       
  4753 	TMockLtsyData1< TInt > iniData2(maxMonitorServices);
       
  4754     iniData2.SerialiseL(data); 	
       
  4755     iMockLTSY.ExpectL(EPacketEnumerateMbmsActiveServiceList);
       
  4756 	iMockLTSY.CompleteL( EPacketEnumerateMbmsActiveServiceList, KErrNone, data );
       
  4757 	
       
  4758 	//this is actually a sync call to LTSY where return represents a context id offset rather than error code.
       
  4759 	iMockLTSY.ExpectL(EPacketInitProxiesIPC, 3);	
       
  4760 	
       
  4761 	//this actually completes before all messages between CTSY<->LTSY have finished.
       
  4762 	RPacketService packetService;
       
  4763 	TInt ret = packetService.Open(iPhone);
       
  4764     ASSERT_EQUALS(KErrNone, ret); 
       
  4765 	CleanupClosePushL(packetService);
       
  4766 		
       
  4767 	// Wait for the end of initialisation
       
  4768 	User::WaitForRequest(mockLtsyStatus);
       
  4769 	AssertMockLtsyStatusL();
       
  4770 
       
  4771     CleanupStack::PopAndDestroy(1); 
       
  4772 	AssertMockLtsyStatusL();
       
  4773 	CleanupStack::PopAndDestroy(2, this); // this
       
  4774 	}
       
  4775 
       
  4776 
       
  4777 /**
       
  4778 @SYMTestCaseID BA-CTSY-PKTS-PSO-0003
       
  4779 @SYMPREQ 1551
       
  4780 @SYMComponent  telephony_ctsy
       
  4781 @SYMTestCaseDesc Test support in CTSY for RPacketService::Open with bad parameter data
       
  4782 @SYMTestPriority High
       
  4783 @SYMTestActions Invokes RPacketService::Open with bad parameter data
       
  4784 @SYMTestExpectedResults Pass
       
  4785 @SYMTestType CT
       
  4786 */
       
  4787 void CCTsyPacketServiceFU::TestOpen0003L()
       
  4788 	{
       
  4789 	OpenEtelServerL(EUseExtendedError);
       
  4790 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4791 	OpenPhoneL();
       
  4792 
       
  4793 	RBuf8 data;
       
  4794 	CleanupClosePushL(data);
       
  4795 
       
  4796 	RMobilePhone phone;
       
  4797 
       
  4798     // using unopened RMobilePhone as a bad param, panic expected
       
  4799 	RPacketService packetService;
       
  4800 	TInt ret = packetService.Open(phone);
       
  4801     ASSERT_EQUALS(KErrArgument, ret); 
       
  4802 	CleanupClosePushL(packetService);
       
  4803 
       
  4804 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  4805 	}
       
  4806 
       
  4807 
       
  4808 /**
       
  4809 @SYMTestCaseID BA-CTSY-PKTS-PSO-0004
       
  4810 @SYMPREQ 1551
       
  4811 @SYMComponent  telephony_ctsy
       
  4812 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::Open
       
  4813 @SYMTestPriority High
       
  4814 @SYMTestActions Invokes multiple client requests to RPacketService::Open
       
  4815 @SYMTestExpectedResults Pass
       
  4816 @SYMTestType CT
       
  4817 */
       
  4818 void CCTsyPacketServiceFU::TestOpen0004L()
       
  4819 	{
       
  4820 	OpenEtelServerL(EUseExtendedError);
       
  4821 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4822 	OpenPhoneL();
       
  4823 
       
  4824 	RBuf8 data;
       
  4825 	CleanupClosePushL(data);
       
  4826 
       
  4827 	// Open second client
       
  4828 	RTelServer telServer2;
       
  4829 	TInt ret = telServer2.Connect();
       
  4830 	ASSERT_EQUALS(KErrNone, ret);
       
  4831 	CleanupClosePushL(telServer2);
       
  4832 
       
  4833 	RMobilePhone phone2;
       
  4834 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4835 	ASSERT_EQUALS(KErrNone, ret);
       
  4836 	CleanupClosePushL(phone2);
       
  4837 
       
  4838 	RMobilePhone phone3;
       
  4839 	ret = phone3.Open(telServer2,KMmTsyPhoneName);
       
  4840 	ASSERT_EQUALS(KErrNone, ret);
       
  4841 	CleanupClosePushL(phone3);
       
  4842 
       
  4843 	CleanupStack::PopAndDestroy(1);
       
  4844 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  4845 
       
  4846 	}
       
  4847 
       
  4848 
       
  4849 /**
       
  4850 @SYMTestCaseID BA-CTSY-PKTS-PSGMC-0001
       
  4851 @SYMPREQ 1551
       
  4852 @SYMComponent  telephony_ctsy
       
  4853 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetMSClass
       
  4854 @SYMTestPriority High
       
  4855 @SYMTestActions Invokes RPacketService::GetMSClass
       
  4856 @SYMTestExpectedResults Pass
       
  4857 @SYMTestType CT
       
  4858 */
       
  4859 void CCTsyPacketServiceFU::TestGetMSClass0001L()
       
  4860 	{
       
  4861 
       
  4862 	OpenEtelServerL(EUseExtendedError);
       
  4863 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4864 	OpenPhoneL();
       
  4865 
       
  4866 	RBuf8 data;
       
  4867 	CleanupClosePushL(data);
       
  4868 
       
  4869 	
       
  4870 	RPacketService packetService;       
       
  4871     OpenPacketServiceL(packetService);
       
  4872     CleanupClosePushL(packetService);
       
  4873     
       
  4874 	TRequestStatus requestStatus;
       
  4875 	RPacketService::TMSClass curClass;
       
  4876 	RPacketService::TMSClass maxClass;
       
  4877 	
       
  4878 	
       
  4879  	//-------------------------------------------------------------------------
       
  4880 	// TEST C: Successful completion request of
       
  4881 	// RPacketService::GetMSClass when result is not cached.
       
  4882  	//-------------------------------------------------------------------------
       
  4883 
       
  4884     packetService.GetMSClass(requestStatus, curClass, maxClass);
       
  4885 
       
  4886 	User::WaitForRequest(requestStatus);
       
  4887 	AssertMockLtsyStatusL();
       
  4888 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4889 	ASSERT_EQUALS(KMaxMsClass, maxClass);
       
  4890 	ASSERT_EQUALS(RPacketService::EMSClassUnknown, curClass);
       
  4891 	
       
  4892 
       
  4893 	// change current msclass
       
  4894 	RPacketService::TMSClass sendClass = RPacketService::EMSClassSuspensionRequired;
       
  4895 	TMockLtsyData1 < RPacketService::TMSClass > ltsyData(sendClass);
       
  4896 	ltsyData.SerialiseL(data);		
       
  4897 	
       
  4898 	TRequestStatus mockLtsyStatus;
       
  4899 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4900 	iMockLTSY.CompleteL(EPacketNotifyMSClassChange, KErrNone, data);
       
  4901 	User::WaitForRequest(mockLtsyStatus);
       
  4902 
       
  4903 
       
  4904     //get new msclass
       
  4905     packetService.GetMSClass(requestStatus, curClass, maxClass);
       
  4906 
       
  4907 	User::WaitForRequest(requestStatus);
       
  4908 	AssertMockLtsyStatusL();
       
  4909 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4910 	ASSERT_EQUALS(RPacketService::EMSClassSuspensionRequired, curClass);
       
  4911 
       
  4912 	AssertMockLtsyStatusL();
       
  4913 	CleanupStack::PopAndDestroy(1); //packetService 
       
  4914 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  4915 	
       
  4916 	}
       
  4917 
       
  4918 
       
  4919 
       
  4920 /**
       
  4921 @SYMTestCaseID BA-CTSY-PKTS-PSGMC-0004
       
  4922 @SYMPREQ 1551
       
  4923 @SYMComponent  telephony_ctsy
       
  4924 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetMSClass
       
  4925 @SYMTestPriority High
       
  4926 @SYMTestActions Invokes multiple client requests to RPacketService::GetMSClass
       
  4927 @SYMTestExpectedResults Pass
       
  4928 @SYMTestType CT
       
  4929 */
       
  4930 void CCTsyPacketServiceFU::TestGetMSClass0004L()
       
  4931 	{
       
  4932 
       
  4933 					
       
  4934 	OpenEtelServerL(EUseExtendedError);
       
  4935 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4936 	OpenPhoneL();
       
  4937 
       
  4938 	RBuf8 data;
       
  4939 	CleanupClosePushL(data);
       
  4940 
       
  4941 	// Open second client
       
  4942 	RTelServer telServer2;
       
  4943 	TInt ret = telServer2.Connect();
       
  4944 	ASSERT_EQUALS(KErrNone, ret);
       
  4945 	CleanupClosePushL(telServer2);
       
  4946 
       
  4947 	RMobilePhone phone2;
       
  4948 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4949 	ASSERT_EQUALS(KErrNone, ret);
       
  4950 	CleanupClosePushL(phone2);
       
  4951 
       
  4952 
       
  4953     RPacketService packetService;
       
  4954     OpenPacketServiceL(packetService);
       
  4955     CleanupClosePushL(packetService);
       
  4956 
       
  4957     RPacketService packetService2;                
       
  4958     ret = packetService2.Open(phone2);
       
  4959     ASSERT_EQUALS(KErrNone, ret); 
       
  4960     CleanupClosePushL(packetService2);
       
  4961     
       
  4962 	//-------------------------------------------------------------------------
       
  4963 	// Test A: Test multiple clients requesting RPacketService::GetMSClass
       
  4964  	//-------------------------------------------------------------------------
       
  4965 
       
  4966 	// If this API is flow controlled by Etel or if this API is
       
  4967 	// synchronous, remove this test completely.
       
  4968 	
       
  4969 	TRequestStatus requestStatus;
       
  4970 	RPacketService::TMSClass curClass;
       
  4971 	RPacketService::TMSClass maxClass;	
       
  4972 
       
  4973     packetService.GetMSClass(requestStatus, curClass, maxClass);
       
  4974 
       
  4975 
       
  4976 	TRequestStatus requestStatus2;
       
  4977 	RPacketService::TMSClass curClass2;
       
  4978 	RPacketService::TMSClass maxClass2;	
       
  4979 
       
  4980     packetService2.GetMSClass(requestStatus2, curClass2, maxClass2);
       
  4981 
       
  4982 
       
  4983 	User::WaitForRequest(requestStatus);
       
  4984 	AssertMockLtsyStatusL();
       
  4985 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4986 	ASSERT_EQUALS(KMaxMsClass, maxClass);
       
  4987 	ASSERT_EQUALS(RPacketService::EMSClassUnknown, curClass);
       
  4988 
       
  4989 	User::WaitForRequest(requestStatus2);
       
  4990 	AssertMockLtsyStatusL();
       
  4991 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  4992 	ASSERT_EQUALS(KMaxMsClass, maxClass2);
       
  4993 	ASSERT_EQUALS(RPacketService::EMSClassUnknown, curClass2);
       
  4994 
       
  4995 	CleanupStack::PopAndDestroy(2);
       
  4996 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  4997 
       
  4998 	}
       
  4999 
       
  5000 
       
  5001 
       
  5002 /**
       
  5003 @SYMTestCaseID BA-CTSY-PKTS-PSGNI-0001
       
  5004 @SYMPREQ 1551
       
  5005 @SYMComponent  telephony_ctsy
       
  5006 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetNifInfo
       
  5007 @SYMTestPriority High
       
  5008 @SYMTestActions Invokes RPacketService::GetNifInfo
       
  5009 @SYMTestExpectedResults Pass
       
  5010 @SYMTestType CT
       
  5011 */
       
  5012 void CCTsyPacketServiceFU::TestGetNifInfo0001L()
       
  5013 	{
       
  5014 
       
  5015 	OpenEtelServerL(EUseExtendedError);
       
  5016 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5017 	OpenPhoneL();
       
  5018 
       
  5019 	RBuf8 data;
       
  5020 	CleanupClosePushL(data);
       
  5021 
       
  5022 	RBuf8 expectData;
       
  5023 	CleanupClosePushL(expectData);
       
  5024 
       
  5025     RPacketService packetService;       
       
  5026     OpenPacketServiceL(packetService);
       
  5027     CleanupClosePushL(packetService);
       
  5028 	
       
  5029 
       
  5030 	TRequestStatus requestStatus;
       
  5031 	TInt index(0);
       
  5032 	TPckgBuf<RPacketService::TNifInfoV2> nifInfo;
       
  5033 
       
  5034  	//-------------------------------------------------------------------------
       
  5035 	// Completion request of RPacketService::GetNifInfo when there is no context and so no nif
       
  5036  	//-------------------------------------------------------------------------
       
  5037 
       
  5038 	packetService.GetNifInfo(requestStatus, index, nifInfo);
       
  5039 	
       
  5040 	User::WaitForRequest(requestStatus);
       
  5041 	AssertMockLtsyStatusL();
       
  5042 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  5043 
       
  5044 
       
  5045     //** open new context ****************************        
       
  5046 	RPacketContext packetContext;
       
  5047     TInfoName contextId; 
       
  5048     packetContext.OpenNewContext(packetService, contextId);
       
  5049     CleanupClosePushL(packetContext);
       
  5050 	
       
  5051     //Completion request of RPacketService::GetNifInfo when there is 1 context
       
  5052 	packetService.GetNifInfo(requestStatus, index, nifInfo);
       
  5053 	
       
  5054 	User::WaitForRequest(requestStatus);
       
  5055 	AssertMockLtsyStatusL();
       
  5056 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5057 	
       
  5058 	TName contextName(contextId);
       
  5059 	RPacketService::TNifInfoV2 nifData(nifInfo());
       
  5060 	ASSERT_EQUALS(contextName, nifData.iContextName);
       
  5061 	ASSERT_EQUALS(RPacketContext::EStatusUnknown, nifData.iNifStatus);
       
  5062 
       
  5063 
       
  5064     //** change pdp address 1 *****************
       
  5065     InitContextL(packetContext, contextId);
       
  5066 
       
  5067     RPacketContext::TContextConfigGPRS contextConfig;
       
  5068     _LIT(KPdpAdd, "Some Add");
       
  5069     contextConfig.iPdpAddress.Copy(KPdpAdd);
       
  5070     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig(contextConfig);    
       
  5071     
       
  5072 
       
  5073 	TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect(contextConfig, contextId);
       
  5074     expExpect.SerialiseL(expectData);
       
  5075 
       
  5076     TMockLtsyData1<TInfoName > contexName(contextId);
       
  5077     contexName.SerialiseL(data);
       
  5078     
       
  5079     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  5080     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  5081 
       
  5082     packetContext.SetConfig(requestStatus, pckgConfig);
       
  5083     
       
  5084 	User::WaitForRequest(requestStatus);
       
  5085     
       
  5086     //** open second context ******************    
       
  5087 	RPacketContext packetContext2;
       
  5088     TInfoName contextId2; 
       
  5089     packetContext2.OpenNewContext(packetService, contextId2);
       
  5090     CleanupClosePushL(packetContext2);
       
  5091 
       
  5092     InitContextL(packetContext2, contextId2);
       
  5093 
       
  5094     //** change pdp address 2 *****************
       
  5095     contextConfig.iPdpAddress.Copy(KPdpAdd);
       
  5096     TPckg<RPacketContext::TContextConfigGPRS> pckgConfig2(contextConfig);    
       
  5097     
       
  5098 
       
  5099 	TMockLtsyData2<RPacketContext::TContextConfigGPRS, TInfoName > expExpect2(contextConfig, contextId2);
       
  5100     expectData.Close();
       
  5101     expExpect2.SerialiseL(expectData);
       
  5102 
       
  5103     TMockLtsyData1<TInfoName > contexName2(contextId2);
       
  5104     data.Close();
       
  5105     contexName2.SerialiseL(data);
       
  5106     
       
  5107     iMockLTSY.ExpectL(EPacketContextSetConfig, expectData);
       
  5108     iMockLTSY.CompleteL(EPacketContextSetConfig, KErrNone, data);
       
  5109 
       
  5110     packetContext2.SetConfig(requestStatus, pckgConfig2);
       
  5111     
       
  5112 	User::WaitForRequest(requestStatus);
       
  5113 
       
  5114     //******************************************
       
  5115     
       
  5116     // check one more test branch
       
  5117     index = 1;
       
  5118     
       
  5119 	packetService.GetNifInfo(requestStatus, index, nifInfo);
       
  5120 	
       
  5121 	User::WaitForRequest(requestStatus);
       
  5122 	AssertMockLtsyStatusL();
       
  5123 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  5124     
       
  5125 	AssertMockLtsyStatusL();
       
  5126 	CleanupStack::PopAndDestroy(3); //packetService, packetContext, packetContext2		
       
  5127 	CleanupStack::PopAndDestroy(3, this); // expectData, data, this
       
  5128 	
       
  5129 	}
       
  5130 
       
  5131 
       
  5132 
       
  5133 /**
       
  5134 @SYMTestCaseID BA-CTSY-PKTS-PSGNI-0003
       
  5135 @SYMPREQ 1551
       
  5136 @SYMComponent  telephony_ctsy
       
  5137 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetNifInfo with bad parameter data
       
  5138 @SYMTestPriority High
       
  5139 @SYMTestActions Invokes RPacketService::GetNifInfo with bad parameter data
       
  5140 @SYMTestExpectedResults Pass
       
  5141 @SYMTestType CT
       
  5142 */
       
  5143 void CCTsyPacketServiceFU::TestGetNifInfo0003L()
       
  5144 	{
       
  5145 					
       
  5146 	OpenEtelServerL(EUseExtendedError);
       
  5147 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5148 	OpenPhoneL();
       
  5149 
       
  5150 	RBuf8 data;
       
  5151 	CleanupClosePushL(data);
       
  5152 
       
  5153 
       
  5154     RPacketService packetService;       
       
  5155     OpenPacketServiceL(packetService);
       
  5156     CleanupClosePushL(packetService);
       
  5157 	
       
  5158 	RPacketContext packetContext;
       
  5159     TInfoName contextId; 
       
  5160     packetContext.OpenNewContext(packetService, contextId);
       
  5161     CleanupClosePushL(packetContext);
       
  5162 
       
  5163 	
       
  5164 	TRequestStatus requestStatus;
       
  5165 	TInt index(0);
       
  5166 	
       
  5167 
       
  5168 	//-------------------------------------------------------------------------
       
  5169 	// Test C: Test passing out of bounds parameters to
       
  5170 	// RPacketService::GetNifInfo
       
  5171  	//-------------------------------------------------------------------------
       
  5172  	
       
  5173  	index = -1;
       
  5174 	TPckgBuf<RPacketService::TNifInfoV2> nifInfo;
       
  5175 	
       
  5176 	packetService.GetNifInfo(requestStatus, index, nifInfo);
       
  5177 	
       
  5178 	User::WaitForRequest(requestStatus);
       
  5179 	AssertMockLtsyStatusL();
       
  5180 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  5181 
       
  5182  	index = 1;
       
  5183 	
       
  5184 	packetService.GetNifInfo(requestStatus, index, nifInfo);
       
  5185 	
       
  5186 	User::WaitForRequest(requestStatus);
       
  5187 	AssertMockLtsyStatusL();
       
  5188 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  5189 	
       
  5190     index = 0;
       
  5191 	TPckgBuf<RPacketContext::TDnsInfoV2> wrongInfo;
       
  5192 
       
  5193 	packetService.GetNifInfo(requestStatus, index, wrongInfo);
       
  5194 	
       
  5195 	User::WaitForRequest(requestStatus);
       
  5196 	AssertMockLtsyStatusL();
       
  5197 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  5198 
       
  5199 	AssertMockLtsyStatusL();
       
  5200 	CleanupStack::PopAndDestroy(2); //packetService, packetContext	
       
  5201 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  5202 	
       
  5203 	}
       
  5204 
       
  5205 
       
  5206 /**
       
  5207 @SYMTestCaseID BA-CTSY-PKTS-PSGNI-0004
       
  5208 @SYMPREQ 1551
       
  5209 @SYMComponent  telephony_ctsy
       
  5210 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetNifInfo
       
  5211 @SYMTestPriority High
       
  5212 @SYMTestActions Invokes multiple client requests to RPacketService::GetNifInfo
       
  5213 @SYMTestExpectedResults Pass
       
  5214 @SYMTestType CT
       
  5215 */
       
  5216 void CCTsyPacketServiceFU::TestGetNifInfo0004L()
       
  5217 	{
       
  5218 	OpenEtelServerL(EUseExtendedError);
       
  5219 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5220 	OpenPhoneL();
       
  5221 
       
  5222 	RBuf8 data;
       
  5223 	CleanupClosePushL(data);
       
  5224 
       
  5225 	// Open second client
       
  5226 	RTelServer telServer2;
       
  5227 	TInt ret = telServer2.Connect();
       
  5228 	ASSERT_EQUALS(KErrNone, ret);
       
  5229 	CleanupClosePushL(telServer2);
       
  5230 
       
  5231 	RMobilePhone phone2;
       
  5232 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  5233 	ASSERT_EQUALS(KErrNone, ret);
       
  5234 	CleanupClosePushL(phone2);
       
  5235 	
       
  5236     RPacketService packetService;
       
  5237     OpenPacketServiceL(packetService);
       
  5238     CleanupClosePushL(packetService);
       
  5239 
       
  5240     RPacketService packetService2;                
       
  5241     ret = packetService2.Open(phone2);
       
  5242     ASSERT_EQUALS(KErrNone, ret); 
       
  5243     CleanupClosePushL(packetService2);
       
  5244     
       
  5245 	RPacketContext packetContext;
       
  5246     TInfoName contextId; 
       
  5247     packetContext.OpenNewContext(packetService, contextId);
       
  5248     CleanupClosePushL(packetContext);
       
  5249     
       
  5250 	RPacketContext packetContext2;
       
  5251     TInfoName contextId2; 
       
  5252     packetContext2.OpenNewContext(packetService2, contextId2);
       
  5253     CleanupClosePushL(packetContext2);
       
  5254     
       
  5255 	//-------------------------------------------------------------------------
       
  5256 	// Test A: Test multiple clients requesting RPacketService::GetNifInfo
       
  5257  	//-------------------------------------------------------------------------
       
  5258 
       
  5259 	TRequestStatus requestStatus;
       
  5260 	TInt index(0);
       
  5261 	TPckgBuf<RPacketService::TNifInfoV2> nifInfo;
       
  5262 	
       
  5263 	packetService.GetNifInfo(requestStatus, index, nifInfo);
       
  5264 	
       
  5265 	
       
  5266 	TRequestStatus requestStatus2;
       
  5267 	TInt index2(0);
       
  5268 	TPckgBuf<RPacketService::TNifInfoV2> nifInfo2;
       
  5269 	
       
  5270 	packetService2.GetNifInfo(requestStatus2, index2, nifInfo2);
       
  5271 
       
  5272 	
       
  5273 	User::WaitForRequest(requestStatus);
       
  5274 	AssertMockLtsyStatusL();
       
  5275 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5276 	
       
  5277 	TName contextName(contextId);
       
  5278 	RPacketService::TNifInfoV2 nifData(nifInfo());
       
  5279 	ASSERT_EQUALS(contextName, nifData.iContextName);
       
  5280 	ASSERT_EQUALS(RPacketContext::EStatusUnknown, nifData.iNifStatus);
       
  5281 
       
  5282 
       
  5283 	User::WaitForRequest(requestStatus2);
       
  5284 	AssertMockLtsyStatusL();
       
  5285 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  5286 	
       
  5287 	TName contextName2(contextId);
       
  5288 	RPacketService::TNifInfoV2 nifData2(nifInfo2());
       
  5289 	ASSERT_EQUALS(contextName2, nifData2.iContextName);
       
  5290 	ASSERT_EQUALS(RPacketContext::EStatusUnknown, nifData2.iNifStatus);
       
  5291 
       
  5292 	CleanupStack::PopAndDestroy(4);
       
  5293 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  5294 	}
       
  5295 
       
  5296 
       
  5297 
       
  5298 /**
       
  5299 @SYMTestCaseID BA-CTSY-PKTS-PSSMSC-0001
       
  5300 @SYMPREQ 1551
       
  5301 @SYMComponent  telephony_ctsy
       
  5302 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetMSClass
       
  5303 @SYMTestPriority High
       
  5304 @SYMTestActions Invokes RPacketService::SetMSClass
       
  5305 @SYMTestExpectedResults Pass
       
  5306 @SYMTestType CT
       
  5307 */
       
  5308 void CCTsyPacketServiceFU::TestSetMSClass0001L()
       
  5309 	{
       
  5310 
       
  5311 	OpenEtelServerL(EUseExtendedError);
       
  5312 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5313 	OpenPhoneL();
       
  5314 
       
  5315 	RBuf8 data;
       
  5316 	CleanupClosePushL(data);
       
  5317 
       
  5318     RPacketService packetService;       
       
  5319     OpenPacketServiceL(packetService);
       
  5320     CleanupClosePushL(packetService);
       
  5321 
       
  5322 
       
  5323 	TRequestStatus requestStatus;
       
  5324 	RPacketService::TMSClass msclass(RPacketService::EMSClassDualMode);
       
  5325 	
       
  5326 	packetService.SetMSClass(requestStatus, msclass);
       
  5327 	
       
  5328 	User::WaitForRequest(requestStatus);
       
  5329 	AssertMockLtsyStatusL();
       
  5330 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5331 	
       
  5332 	AssertMockLtsyStatusL();
       
  5333 	CleanupStack::PopAndDestroy(1); //packetService
       
  5334 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  5335 	
       
  5336 	}
       
  5337 
       
  5338 
       
  5339 
       
  5340 
       
  5341 /**
       
  5342 @SYMTestCaseID BA-CTSY-PKTS-PSDN-0001
       
  5343 @SYMPREQ 1551
       
  5344 @SYMComponent  telephony_ctsy
       
  5345 @SYMTestCaseDesc Test support in CTSY for RPacketService::DeactivateNIF
       
  5346 @SYMTestPriority High
       
  5347 @SYMTestActions Invokes RPacketService::DeactivateNIF
       
  5348 @SYMTestExpectedResults Pass
       
  5349 @SYMTestType CT
       
  5350 */
       
  5351 void CCTsyPacketServiceFU::TestDeactivateNIF0001L()
       
  5352 	{
       
  5353 
       
  5354 	OpenEtelServerL(EUseExtendedError);
       
  5355 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5356 	OpenPhoneL();
       
  5357 
       
  5358 	RBuf8 data;
       
  5359 	CleanupClosePushL(data);
       
  5360 
       
  5361     RPacketService packetService;       
       
  5362     OpenPacketServiceL(packetService);
       
  5363     CleanupClosePushL(packetService);
       
  5364 
       
  5365 	RPacketContext packetContext;
       
  5366     TInfoName contextId; 
       
  5367     packetContext.OpenNewContext(packetService, contextId);
       
  5368     CleanupClosePushL(packetContext);
       
  5369 
       
  5370 	
       
  5371 	// Test API is not supported
       
  5372 
       
  5373 	TRequestStatus requestStatus;
       
  5374 	
       
  5375 	packetService.DeactivateNIF(requestStatus, contextId);
       
  5376 	
       
  5377 	User::WaitForRequest(requestStatus);
       
  5378 	
       
  5379 	AssertMockLtsyStatusL();
       
  5380 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5381 
       
  5382 	AssertMockLtsyStatusL();
       
  5383 	CleanupStack::PopAndDestroy(2);     //packetService, packetContext
       
  5384 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  5385 	
       
  5386 	}
       
  5387 
       
  5388 
       
  5389 /**
       
  5390 @SYMTestCaseID BA-CTSY-PKTS-PSEN-0001
       
  5391 @SYMPREQ 1551
       
  5392 @SYMComponent  telephony_ctsy
       
  5393 @SYMTestCaseDesc Test support in CTSY for RPacketService::EnumerateNifs
       
  5394 @SYMTestPriority High
       
  5395 @SYMTestActions Invokes RPacketService::EnumerateNifs
       
  5396 @SYMTestExpectedResults Pass
       
  5397 @SYMTestType CT
       
  5398 */
       
  5399 void CCTsyPacketServiceFU::TestEnumerateNifs0001L()
       
  5400 	{
       
  5401 
       
  5402 	OpenEtelServerL(EUseExtendedError);
       
  5403 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5404 	OpenPhoneL();
       
  5405 
       
  5406 	RBuf8 data;
       
  5407 	CleanupClosePushL(data);
       
  5408 
       
  5409     RPacketService packetService;       
       
  5410     OpenPacketServiceL(packetService);
       
  5411     CleanupClosePushL(packetService);
       
  5412 
       
  5413 
       
  5414 	TRequestStatus requestStatus;
       
  5415 	TInt nifNum(0);
       
  5416 	
       
  5417 
       
  5418  	//-------------------------------------------------------------------------
       
  5419 	// Successful completion request of
       
  5420 	// RPacketService::EnumerateNifs when there is  no contexts and no nifs
       
  5421  	//-------------------------------------------------------------------------
       
  5422 	
       
  5423 	packetService.EnumerateNifs(requestStatus, nifNum);
       
  5424 	
       
  5425 	User::WaitForRequest(requestStatus);
       
  5426 	
       
  5427 	AssertMockLtsyStatusL();
       
  5428 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5429 	ASSERT_EQUALS(0, nifNum);
       
  5430 
       
  5431 	
       
  5432 	// add context
       
  5433 	RPacketContext packetContext;
       
  5434     TInfoName contextId; 
       
  5435     packetContext.OpenNewContext(packetService, contextId);
       
  5436     CleanupClosePushL(packetContext);
       
  5437 	
       
  5438 
       
  5439  	//-------------------------------------------------------------------------
       
  5440 	// TEST C: Successful completion request of
       
  5441 	// RPacketService::EnumerateNifs when 1 context and therefore 1 nif.
       
  5442  	//-------------------------------------------------------------------------
       
  5443 	
       
  5444 	packetService.EnumerateNifs(requestStatus, nifNum);
       
  5445 	
       
  5446 	User::WaitForRequest(requestStatus);
       
  5447 	
       
  5448 	AssertMockLtsyStatusL();
       
  5449 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5450 	ASSERT_EQUALS(1, nifNum);
       
  5451 
       
  5452 	// add context
       
  5453 	RPacketContext packetContext2;
       
  5454     TInfoName contextId2; 
       
  5455     packetContext2.OpenNewContext(packetService, contextId2);
       
  5456     CleanupClosePushL(packetContext2);
       
  5457 
       
  5458  	//-------------------------------------------------------------------------
       
  5459 	// TEST C: Successful completion request of
       
  5460 	// RPacketService::EnumerateNifs when there are multiple contexts 
       
  5461  	//-------------------------------------------------------------------------
       
  5462 	
       
  5463 	packetService.EnumerateNifs(requestStatus, nifNum);
       
  5464 	
       
  5465 	User::WaitForRequest(requestStatus);
       
  5466 	
       
  5467 	AssertMockLtsyStatusL();
       
  5468 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5469 	ASSERT_EQUALS(1, nifNum);
       
  5470 
       
  5471 
       
  5472 	AssertMockLtsyStatusL();
       
  5473 	CleanupStack::PopAndDestroy(1); //packetContext2
       
  5474 	CleanupStack::PopAndDestroy(2); //packetService, packetContext
       
  5475 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  5476 	
       
  5477 	}
       
  5478 
       
  5479 
       
  5480 
       
  5481 
       
  5482 /**
       
  5483 @SYMTestCaseID BA-CTSY-PKTS-PSEN-0004
       
  5484 @SYMPREQ 1551
       
  5485 @SYMComponent  telephony_ctsy
       
  5486 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::EnumerateNifs
       
  5487 @SYMTestPriority High
       
  5488 @SYMTestActions Invokes multiple client requests to RPacketService::EnumerateNifs
       
  5489 @SYMTestExpectedResults Pass
       
  5490 @SYMTestType CT
       
  5491 */
       
  5492 void CCTsyPacketServiceFU::TestEnumerateNifs0004L()
       
  5493 	{					
       
  5494 	OpenEtelServerL(EUseExtendedError);
       
  5495 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5496 	OpenPhoneL();
       
  5497 
       
  5498 	RBuf8 data;
       
  5499 	CleanupClosePushL(data);
       
  5500 
       
  5501 	// Open second client
       
  5502 	RTelServer telServer2;
       
  5503 	TInt ret = telServer2.Connect();
       
  5504 	ASSERT_EQUALS(KErrNone, ret);
       
  5505 	CleanupClosePushL(telServer2);
       
  5506 
       
  5507 	RMobilePhone phone2;
       
  5508 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  5509 	ASSERT_EQUALS(KErrNone, ret);
       
  5510 	CleanupClosePushL(phone2);
       
  5511 	
       
  5512     RPacketService packetService;
       
  5513     OpenPacketServiceL(packetService);
       
  5514     CleanupClosePushL(packetService);
       
  5515 
       
  5516     RPacketService packetService2;                
       
  5517     ret = packetService2.Open(phone2);
       
  5518     ASSERT_EQUALS(KErrNone, ret); 
       
  5519     CleanupClosePushL(packetService2);
       
  5520     
       
  5521 	RPacketContext packetContext;
       
  5522     TInfoName contextId; 
       
  5523     packetContext.OpenNewContext(packetService, contextId);
       
  5524     CleanupClosePushL(packetContext);
       
  5525     
       
  5526 	RPacketContext packetContext2;
       
  5527     TInfoName contextId2; 
       
  5528     packetContext2.OpenNewContext(packetService2, contextId2);
       
  5529     CleanupClosePushL(packetContext2);
       
  5530     
       
  5531 
       
  5532 	//-------------------------------------------------------------------------
       
  5533 	// Test A: Test multiple clients requesting RPacketService::EnumerateNifs
       
  5534  	//-------------------------------------------------------------------------
       
  5535 	TRequestStatus requestStatus;
       
  5536 	TInt nifNum(0);
       
  5537 		
       
  5538 	packetService.EnumerateNifs(requestStatus, nifNum);
       
  5539 
       
  5540 
       
  5541 	TRequestStatus requestStatus2;
       
  5542 	TInt nifNum2(0);
       
  5543 		
       
  5544 	packetService2.EnumerateNifs(requestStatus2, nifNum2);
       
  5545 	
       
  5546 	
       
  5547 	User::WaitForRequest(requestStatus);
       
  5548 	
       
  5549 	AssertMockLtsyStatusL();
       
  5550 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5551 	ASSERT_EQUALS(1, nifNum);
       
  5552 
       
  5553 
       
  5554 	User::WaitForRequest(requestStatus2);
       
  5555 	
       
  5556 	AssertMockLtsyStatusL();
       
  5557 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  5558 	ASSERT_EQUALS(1, nifNum2);
       
  5559 
       
  5560 	CleanupStack::PopAndDestroy(4);
       
  5561 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  5562 
       
  5563 	}
       
  5564 
       
  5565 
       
  5566 /**
       
  5567 @SYMTestCaseID BA-CTSY-PKTS-PSGAM-0001
       
  5568 @SYMPREQ 1551
       
  5569 @SYMComponent  telephony_ctsy
       
  5570 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetAttachMode
       
  5571 @SYMTestPriority High
       
  5572 @SYMTestActions Invokes RPacketService::GetAttachMode
       
  5573 @SYMTestExpectedResults Pass
       
  5574 @SYMTestType CT
       
  5575 */
       
  5576 void CCTsyPacketServiceFU::TestGetAttachMode0001L()
       
  5577 	{
       
  5578 	OpenEtelServerL(EUseExtendedError);
       
  5579 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5580 	OpenPhoneL();
       
  5581 
       
  5582 	RBuf8 dataExpect;
       
  5583 	CleanupClosePushL(dataExpect);
       
  5584 	RBuf8 dataComplete;
       
  5585 	CleanupClosePushL(dataComplete);
       
  5586 	
       
  5587 	RPacketService packetService;		
       
  5588 	// Open PacketService
       
  5589 	OpenPacketServiceL(packetService);
       
  5590 	CleanupClosePushL(packetService);
       
  5591 	
       
  5592 	
       
  5593  	//-------------------------------------------------------------------------
       
  5594 	// TEST A: failure to dispatch request to LTSY
       
  5595  	//-------------------------------------------------------------------------
       
  5596 	TBool sndData = FALSE;
       
  5597 	TMockLtsyData1<TBool> ltsyData(sndData);
       
  5598 	ltsyData.SerialiseL(dataExpect);
       
  5599 		
       
  5600 	iMockLTSY.ExpectL(EPacketGetAttachMode, dataExpect, KErrNotSupported);
       
  5601 	
       
  5602 	// Post request
       
  5603 	TRequestStatus requestStatus;
       
  5604 	RPacketService::TAttachMode attachMode;	
       
  5605 	packetService.GetAttachMode(requestStatus, attachMode);		
       
  5606 	User::WaitForRequest(requestStatus);	
       
  5607 	AssertMockLtsyStatusL();
       
  5608 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());	
       
  5609 
       
  5610 	//-------------------------------------------------------------------------
       
  5611 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  5612  	//-------------------------------------------------------------------------
       
  5613 	RPacketService::TAttachMode retMode = RPacketService::EAttachWhenNeeded;
       
  5614 	TMockLtsyData1<RPacketService::TAttachMode> ltsyDataComplete(retMode);
       
  5615 	ltsyDataComplete.SerialiseL(dataComplete);
       
  5616 	iMockLTSY.ExpectL(EPacketGetAttachMode, dataExpect);	
       
  5617 	
       
  5618 	iMockLTSY.CompleteL(EPacketGetAttachMode, KErrGeneral, dataComplete);
       
  5619 	
       
  5620 	packetService.GetAttachMode(requestStatus, attachMode);	
       
  5621 	User::WaitForRequest(requestStatus);
       
  5622 	AssertMockLtsyStatusL();
       
  5623 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  5624 	
       
  5625  	//-------------------------------------------------------------------------
       
  5626 	// TEST C: Successful completion request of
       
  5627 	// RPacketService::GetAttachMode when result is not cached.
       
  5628  	//-------------------------------------------------------------------------	
       
  5629 	iMockLTSY.ExpectL(EPacketGetAttachMode, dataExpect);		
       
  5630 	iMockLTSY.CompleteL(EPacketGetAttachMode, KErrNone, dataComplete);
       
  5631 	
       
  5632 	packetService.GetAttachMode(requestStatus, attachMode);	
       
  5633 	User::WaitForRequest(requestStatus);
       
  5634 	AssertMockLtsyStatusL();
       
  5635 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5636 	ASSERT_EQUALS(retMode, attachMode);
       
  5637 	
       
  5638 	//-------------------------------------------------------------------------
       
  5639 	// TEST E: Unsolicited completion of RMobilePhone::GetSubscriberId
       
  5640 	// from LTSY.
       
  5641  	//-------------------------------------------------------------------------
       
  5642 	TRequestStatus mockLtsyStatus;
       
  5643 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5644 	iMockLTSY.CompleteL(EPacketGetAttachMode, KErrNone, dataComplete);
       
  5645 	User::WaitForRequest(mockLtsyStatus);
       
  5646 	
       
  5647 	AssertMockLtsyStatusL();	
       
  5648 	CleanupStack::PopAndDestroy(); // packetService
       
  5649 	CleanupStack::PopAndDestroy(3, this); // dataExpect, dataComplete, this	
       
  5650 	}
       
  5651 	
       
  5652 	
       
  5653 /**
       
  5654 @SYMTestCaseID BA-CTSY-PKTS-PSGAM-0004
       
  5655 @SYMPREQ 1551
       
  5656 @SYMComponent  telephony_ctsy
       
  5657 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetAttachMode
       
  5658 @SYMTestPriority High
       
  5659 @SYMTestActions Invokes multiple client requests to RPacketService::GetAttachMode
       
  5660 @SYMTestExpectedResults Pass
       
  5661 @SYMTestType CT
       
  5662 */
       
  5663 void CCTsyPacketServiceFU::TestGetAttachMode0004L()
       
  5664 	{
       
  5665 	OpenEtelServerL(EUseExtendedError);
       
  5666 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5667 	OpenPhoneL();
       
  5668 
       
  5669 	RBuf8 data;
       
  5670 	CleanupClosePushL(data);
       
  5671 	
       
  5672 	RBuf8 dataComplete;
       
  5673 	CleanupClosePushL(dataComplete);
       
  5674 
       
  5675 	// Open second client
       
  5676 	RTelServer telServer2;
       
  5677 	TInt ret = telServer2.Connect();
       
  5678 	ASSERT_EQUALS(KErrNone, ret);
       
  5679 	CleanupClosePushL(telServer2);
       
  5680 
       
  5681 	RMobilePhone phone2;
       
  5682 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  5683 	ASSERT_EQUALS(KErrNone, ret);
       
  5684 	CleanupClosePushL(phone2);
       
  5685 	
       
  5686 	RPacketService packetService;
       
  5687 	OpenPacketServiceL(packetService);
       
  5688 	CleanupClosePushL(packetService);
       
  5689 
       
  5690 	RPacketService packetService2;                
       
  5691 	ret = packetService2.Open(phone2);
       
  5692 	ASSERT_EQUALS(KErrNone, ret);
       
  5693 	CleanupClosePushL(packetService2); 
       
  5694 
       
  5695 	//-------------------------------------------------------------------------
       
  5696 	// Test A: Test multiple clients requesting RPacketService::GetAttachMode
       
  5697  	//-------------------------------------------------------------------------
       
  5698 	
       
  5699 	// data for ExpectL  
       
  5700 	TBool sndData = FALSE;
       
  5701 	TMockLtsyData1<TBool> ltsyData(sndData);
       
  5702 	ltsyData.SerialiseL(data);
       
  5703 	
       
  5704 	// data for CompleteL
       
  5705 	RPacketService::TAttachMode retMode = RPacketService::EAttachWhenNeeded;
       
  5706 	TMockLtsyData1<RPacketService::TAttachMode> ltsyDataComplete(retMode);
       
  5707 	ltsyDataComplete.SerialiseL(dataComplete);	
       
  5708 	
       
  5709 	iMockLTSY.ExpectL(EPacketGetAttachMode, data);		
       
  5710 	iMockLTSY.CompleteL(EPacketGetAttachMode, KErrNone, dataComplete);
       
  5711 	
       
  5712 	// send first request
       
  5713 	TRequestStatus requestStatus;
       
  5714 	RPacketService::TAttachMode attachMode;
       
  5715 	packetService.GetAttachMode(requestStatus, attachMode);	
       
  5716 		
       
  5717 	// send second request
       
  5718 	TRequestStatus requestStatus2;
       
  5719 	RPacketService::TAttachMode attachMode2;
       
  5720 	packetService2.GetAttachMode(requestStatus2, attachMode2);
       
  5721 	
       
  5722 	//wait for first
       
  5723 	User::WaitForRequest(requestStatus);
       
  5724 	AssertMockLtsyStatusL();
       
  5725 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5726 	ASSERT_EQUALS(retMode, attachMode);	
       
  5727 	
       
  5728 	//wait for second
       
  5729 	User::WaitForRequest(requestStatus2);
       
  5730 	AssertMockLtsyStatusL();
       
  5731 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  5732 	
       
  5733 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  5734 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, data, dataComplete, this
       
  5735 	}
       
  5736 
       
  5737 
       
  5738 
       
  5739 /**
       
  5740 @SYMTestCaseID BA-CTSY-PKTS-PSGAM-0005
       
  5741 @SYMPREQ 1551
       
  5742 @SYMComponent  telephony_ctsy
       
  5743 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetAttachMode with timeout
       
  5744 @SYMTestPriority High
       
  5745 @SYMTestActions Invokes RPacketService::GetAttachMode and tests for timeout
       
  5746 @SYMTestExpectedResults Pass
       
  5747 @SYMTestType CT
       
  5748 */
       
  5749 void CCTsyPacketServiceFU::TestGetAttachMode0005L()
       
  5750 	{
       
  5751 	OpenEtelServerL(EUseExtendedError);
       
  5752 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5753 	OpenPhoneL();
       
  5754 
       
  5755 	RBuf8 dataExpect;
       
  5756 	CleanupClosePushL(dataExpect);
       
  5757 		
       
  5758 	RPacketService packetService;		
       
  5759 	// Open PacketService
       
  5760 	OpenPacketServiceL(packetService);
       
  5761 	CleanupClosePushL(packetService);
       
  5762 
       
  5763 	//-------------------------------------------------------------------------
       
  5764 	// Test A: Test timeout of RPacketService::GetAttachMode
       
  5765  	//-------------------------------------------------------------------------
       
  5766  	
       
  5767 	// Expect request in LTSY
       
  5768 	TBool sndData = FALSE;
       
  5769 	TMockLtsyData1<TBool> ltsyData(sndData);
       
  5770 	ltsyData.SerialiseL(dataExpect);
       
  5771 	
       
  5772 	iMockLTSY.ExpectL(EPacketGetAttachMode, dataExpect);
       
  5773 	
       
  5774 	// Post request
       
  5775 	TRequestStatus requestStatus;
       
  5776 	RPacketService::TAttachMode attachMode;		
       
  5777 	packetService.GetAttachMode(requestStatus, attachMode);
       
  5778 	User::WaitForRequest(requestStatus);
       
  5779 
       
  5780 	// Check status is KErrTimedOut
       
  5781 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int())	
       
  5782 	
       
  5783 	CleanupStack::PopAndDestroy(); //packetService
       
  5784 	CleanupStack::PopAndDestroy(2, this); // dataExpect, this
       
  5785 	}
       
  5786 
       
  5787 
       
  5788 /**
       
  5789 @SYMTestCaseID BA-CTSY-PKTS-PSGSC-0001
       
  5790 @SYMPREQ 1551
       
  5791 @SYMComponent  telephony_ctsy
       
  5792 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetStaticCaps
       
  5793 @SYMTestPriority High
       
  5794 @SYMTestActions Invokes RPacketService::GetStaticCaps
       
  5795 @SYMTestExpectedResults Pass
       
  5796 @SYMTestType CT
       
  5797 */
       
  5798 void CCTsyPacketServiceFU::TestGetStaticCaps0001L()
       
  5799 	{
       
  5800 
       
  5801 	OpenEtelServerL(EUseExtendedError);
       
  5802 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5803 	OpenPhoneL();
       
  5804 
       
  5805 	RBuf8 data;
       
  5806 	CleanupClosePushL(data);
       
  5807 	
       
  5808     RPacketService packetService;       
       
  5809     OpenPacketServiceL(packetService);
       
  5810     CleanupClosePushL(packetService);
       
  5811     
       
  5812   	TRequestStatus mockLtsyStatus;	
       
  5813   	// Check static caps are 
       
  5814 	// RPacketService::KCapsSuspendSupported |
       
  5815 	// RPacketService::KCapsNetworkAvailabilitySupported | 
       
  5816 	// RPacketService::KCapsSetDefaultContextSupported | 
       
  5817 	// RPacketService::KCapsChangeAttachModeSupported | 
       
  5818 	// RPacketService::KCapsGetDataTransferredSupported | 
       
  5819 	// RPacketService::KCapsPreferredBearerSupported | 
       
  5820 	// RPacketService::KCapsPdpDataCompSupported | 
       
  5821 	// RPacketService::KCapsPdpHeaderCompSupported | 
       
  5822 	// RPacketService::KCapsMSClassSupported |
       
  5823 	// RPacketService::KCapsNotifyMSClassSupported		  	
       
  5824     TUint staticCaps = 0;
       
  5825    	TUint expectedCaps = 	RPacketService::KCapsSuspendSupported |
       
  5826 							RPacketService::KCapsNetworkAvailabilitySupported | 
       
  5827 							RPacketService::KCapsSetDefaultContextSupported | 
       
  5828 							RPacketService::KCapsChangeAttachModeSupported | 
       
  5829 							RPacketService::KCapsGetDataTransferredSupported | 
       
  5830 							RPacketService::KCapsPreferredBearerSupported | 
       
  5831 							RPacketService::KCapsPdpDataCompSupported | 
       
  5832 							RPacketService::KCapsPdpHeaderCompSupported | 
       
  5833 						    RPacketService::KCapsMSClassSupported |
       
  5834 							RPacketService::KCapsNotifyMSClassSupported;
       
  5835 
       
  5836 	TMockLtsyData1<TUint> ltsyData(expectedCaps);
       
  5837 	data.Close();
       
  5838 	ltsyData.SerialiseL(data);
       
  5839 
       
  5840 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  5841 	iMockLTSY.CompleteL( EPacketGetStaticCaps, KErrNone, data );
       
  5842 	User::WaitForRequest(mockLtsyStatus);	
       
  5843 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5844 			   		
       
  5845    	TInt ret = packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4);
       
  5846  	AssertMockLtsyStatusL();
       
  5847 	ASSERT_EQUALS(KErrNone, ret);				
       
  5848 	ASSERT_EQUALS(expectedCaps, staticCaps);
       
  5849 
       
  5850 	CleanupStack::PopAndDestroy(3, this); // data, packetService, this
       
  5851 	
       
  5852 	}
       
  5853 
       
  5854 /**
       
  5855 @SYMTestCaseID BA-CTSY-PKTS-PSGSC-0001b
       
  5856 @SYMPREQ 1551
       
  5857 @SYMComponent  telephony_ctsy
       
  5858 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetStaticCaps. Caps retrieved from LTSY
       
  5859 @SYMTestPriority High
       
  5860 @SYMTestActions Invokes RPacketService::GetStaticCaps
       
  5861 @SYMTestExpectedResults Pass
       
  5862 @SYMTestType CT
       
  5863 */
       
  5864 void CCTsyPacketServiceFU::TestGetStaticCaps0001bL()
       
  5865 	{
       
  5866 	
       
  5867 	OpenEtelServerL(EUseExtendedError);
       
  5868 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5869 	
       
  5870 	RProperty::Define( KMockLtsyFactoryProperty, EVersionProperty, RProperty::EInt );
       
  5871 	
       
  5872 	//Get current version
       
  5873 	TInt version(0);
       
  5874 	RProperty::Get( KMockLtsyFactoryProperty, EVersionProperty, version );
       
  5875 	RProperty::Set( KMockLtsyFactoryProperty, EVersionProperty, EVersion3 );
       
  5876 	
       
  5877 	OpenPhoneL();
       
  5878 
       
  5879 	RBuf8 data;
       
  5880 	CleanupClosePushL(data);
       
  5881 	
       
  5882     RPacketService packetService;       
       
  5883     OpenPacketServiceL(packetService);
       
  5884     CleanupClosePushL(packetService);
       
  5885 	
       
  5886 	TUint caps;
       
  5887 	RPacketContext::TProtocolType protType(RPacketContext::EPdpTypeIPv4);
       
  5888 
       
  5889 	TInt ret = packetService.GetStaticCaps(caps, protType);
       
  5890 
       
  5891 	AssertMockLtsyStatusL();
       
  5892 	ASSERT_EQUALS(KErrNone, ret);
       
  5893 	
       
  5894 	ASSERT_EQUALS(KMmPacketServiceStaticCaps | RPacketService::KCapsHSUPASupported, caps);
       
  5895 	
       
  5896 	//Reset original version
       
  5897 	RProperty::Set( KMockLtsyFactoryProperty, EVersionProperty, version );
       
  5898 	
       
  5899 	CleanupStack::PopAndDestroy(3, this); // packetService, data, this
       
  5900 	
       
  5901 	}
       
  5902 
       
  5903 /**
       
  5904 @SYMTestCaseID BA-CTSY-PKTS-PSGSC-0003
       
  5905 @SYMPREQ 1551
       
  5906 @SYMComponent  telephony_ctsy
       
  5907 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetStaticCaps with bad parameter data
       
  5908 @SYMTestPriority High
       
  5909 @SYMTestActions Invokes RPacketService::GetStaticCaps with bad parameter data
       
  5910 @SYMTestExpectedResults Pass
       
  5911 @SYMTestType CT
       
  5912 */
       
  5913 void CCTsyPacketServiceFU::TestGetStaticCaps0003L()
       
  5914 	{
       
  5915 	OpenEtelServerL(EUseExtendedError);
       
  5916 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5917 	OpenPhoneL();
       
  5918 
       
  5919 	RBuf8 data;
       
  5920 	CleanupClosePushL(data);
       
  5921 	
       
  5922     RPacketService packetService;       
       
  5923     OpenPacketServiceL(packetService);
       
  5924     CleanupClosePushL(packetService);
       
  5925 	
       
  5926 	TUint caps;
       
  5927 
       
  5928 	TInt ret = packetService.GetStaticCaps(caps, (RPacketContext::TProtocolType)(-1));
       
  5929 //    ERR_PRINTF2(_L("<font color=Orange>@CTSYKnownFailure: defect id = %d</font>"), 12701);
       
  5930 	ASSERT_EQUALS(KErrArgument, ret);	
       
  5931 	
       
  5932 	AssertMockLtsyStatusL();
       
  5933 	CleanupStack::PopAndDestroy(3, this); // packetService, data, this
       
  5934 	}
       
  5935 
       
  5936 /**
       
  5937 @SYMTestCaseID BA-CTSY-PKTS-PSSAM-0001
       
  5938 @SYMPREQ 1551
       
  5939 @SYMComponent  telephony_ctsy
       
  5940 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetAttachMode
       
  5941 @SYMTestPriority High
       
  5942 @SYMTestActions Invokes RPacketService::SetAttachMode
       
  5943 @SYMTestExpectedResults Pass
       
  5944 @SYMTestType CT
       
  5945 */
       
  5946 void CCTsyPacketServiceFU::TestSetAttachMode0001L()
       
  5947 	{
       
  5948 
       
  5949 	OpenEtelServerL(EUseExtendedError);
       
  5950 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5951 	OpenPhoneL();
       
  5952 
       
  5953 	RBuf8 dataExpect;
       
  5954 	CleanupClosePushL(dataExpect);
       
  5955 	RBuf8 dataComplete;
       
  5956 	CleanupClosePushL(dataComplete);
       
  5957 	
       
  5958 	RPacketService packetService;		
       
  5959 	// Open PacketService
       
  5960 	OpenPacketServiceL(packetService);
       
  5961 	CleanupClosePushL(packetService);	
       
  5962 	
       
  5963  	//-------------------------------------------------------------------------
       
  5964 	// TEST A: failure to dispatch request to LTSY
       
  5965  	//-------------------------------------------------------------------------
       
  5966 	RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenNeeded;
       
  5967 	TMockLtsyData1<RPacketService::TAttachMode> ltsyData(attachMode);
       
  5968 	ltsyData.SerialiseL(dataExpect);	
       
  5969 	
       
  5970 	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect, KErrNotSupported);
       
  5971 	
       
  5972 	// Post request
       
  5973 	TRequestStatus requestStatus;
       
  5974 	packetService.SetAttachMode(requestStatus, attachMode);		
       
  5975 	User::WaitForRequest(requestStatus);	
       
  5976 	AssertMockLtsyStatusL();
       
  5977 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5978 	
       
  5979 	//-------------------------------------------------------------------------
       
  5980 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  5981  	//-------------------------------------------------------------------------	
       
  5982  	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);		
       
  5983 	iMockLTSY.CompleteL(EPacketSetAttachMode, KErrGeneral);
       
  5984 	
       
  5985 	packetService.SetAttachMode(requestStatus, attachMode);	
       
  5986 	User::WaitForRequest(requestStatus);
       
  5987 	AssertMockLtsyStatusL();
       
  5988 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  5989  	
       
  5990 
       
  5991  	//-------------------------------------------------------------------------
       
  5992 	// TEST C: Successful completion request of
       
  5993 	// RPacketService::GetAttachMode when result is not cached.
       
  5994  	//-------------------------------------------------------------------------
       
  5995 	
       
  5996 	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);		
       
  5997 	iMockLTSY.CompleteL(EPacketSetAttachMode, KErrNone);
       
  5998 	
       
  5999 	packetService.SetAttachMode(requestStatus, attachMode);	
       
  6000 	User::WaitForRequest(requestStatus);
       
  6001 	AssertMockLtsyStatusL();
       
  6002 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6003 	
       
  6004 	//-------------------------------------------------------------------------
       
  6005 	// TEST E: Unsolicited completion of RMobilePhone::GetSubscriberId
       
  6006 	// from LTSY.
       
  6007  	//-------------------------------------------------------------------------
       
  6008 	TRequestStatus mockLtsyStatus;
       
  6009 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6010 	iMockLTSY.CompleteL(EPacketSetAttachMode, KErrNone);
       
  6011 	User::WaitForRequest(mockLtsyStatus);
       
  6012 
       
  6013 	
       
  6014  	AssertMockLtsyStatusL();	
       
  6015 	CleanupStack::PopAndDestroy(); // packetService
       
  6016 	CleanupStack::PopAndDestroy(3, this); // dataExpect, dataComplete, this
       
  6017 	}
       
  6018 	
       
  6019 /**
       
  6020 @SYMTestCaseID BA-CTSY-PKTS-PSSAM-0004
       
  6021 @SYMPREQ 1551
       
  6022 @SYMComponent  telephony_ctsy
       
  6023 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::SetAttachMode
       
  6024 @SYMTestPriority High
       
  6025 @SYMTestActions Invokes multiple client requests to RPacketService::SetAttachMode
       
  6026 @SYMTestExpectedResults Pass
       
  6027 @SYMTestType CT
       
  6028 */
       
  6029 void CCTsyPacketServiceFU::TestSetAttachMode0004L()
       
  6030 	{
       
  6031 					
       
  6032 	OpenEtelServerL(EUseExtendedError);
       
  6033 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6034 	OpenPhoneL();
       
  6035 
       
  6036 	RBuf8 data;
       
  6037 	CleanupClosePushL(data);
       
  6038 
       
  6039 	// Open second client
       
  6040 	RTelServer telServer2;
       
  6041 	TInt ret = telServer2.Connect();
       
  6042 	ASSERT_EQUALS(KErrNone, ret);
       
  6043 	CleanupClosePushL(telServer2);
       
  6044 
       
  6045 	RMobilePhone phone2;
       
  6046 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  6047 	ASSERT_EQUALS(KErrNone, ret);
       
  6048 	CleanupClosePushL(phone2);
       
  6049 	
       
  6050 	RPacketService packetService;
       
  6051 	OpenPacketServiceL(packetService);
       
  6052 	CleanupClosePushL(packetService);
       
  6053 
       
  6054 	RPacketService packetService2;                
       
  6055 	ret = packetService2.Open(phone2);
       
  6056 	ASSERT_EQUALS(KErrNone, ret);
       
  6057 	CleanupClosePushL(packetService2); 
       
  6058 	
       
  6059 	//-------------------------------------------------------------------------
       
  6060 	// Test A: Test multiple clients requesting RPacketService::SetAttachMode
       
  6061  	//-------------------------------------------------------------------------
       
  6062 
       
  6063 	RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenNeeded;
       
  6064 	TMockLtsyData1<RPacketService::TAttachMode> ltsyData(attachMode);
       
  6065 	ltsyData.SerialiseL(data);
       
  6066 	
       
  6067 	iMockLTSY.ExpectL(EPacketSetAttachMode, data);		
       
  6068 	iMockLTSY.CompleteL(EPacketSetAttachMode, KErrNone);
       
  6069 	
       
  6070 	// send first request
       
  6071 	TRequestStatus requestStatus;	
       
  6072 	packetService.SetAttachMode(requestStatus, attachMode);	
       
  6073 	
       
  6074 	// send second request 
       
  6075 	TRequestStatus requestStatus2;	
       
  6076 	packetService2.SetAttachMode(requestStatus2, attachMode);		
       
  6077 	
       
  6078 	// wait for first
       
  6079 	User::WaitForRequest(requestStatus);
       
  6080 	AssertMockLtsyStatusL();
       
  6081 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6082 	
       
  6083 	// wait for second
       
  6084 	User::WaitForRequest(requestStatus2);
       
  6085 	AssertMockLtsyStatusL();
       
  6086 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  6087 	
       
  6088 	CleanupStack::PopAndDestroy(2);  //packetService, packetService2
       
  6089 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  6090 	}
       
  6091 
       
  6092 /**
       
  6093 @SYMTestCaseID BA-CTSY-PKTS-PSSAM-0005
       
  6094 @SYMPREQ 1551
       
  6095 @SYMComponent  telephony_ctsy
       
  6096 @SYMTestCaseDesc Test support in CTSY for RPacketService::SetAttachMode with timeout
       
  6097 @SYMTestPriority High
       
  6098 @SYMTestActions Invokes RPacketService::SetAttachMode and tests for timeout
       
  6099 @SYMTestExpectedResults Pass
       
  6100 @SYMTestType CT
       
  6101 */
       
  6102 void CCTsyPacketServiceFU::TestSetAttachMode0005L()
       
  6103 	{
       
  6104 	OpenEtelServerL(EUseExtendedError);
       
  6105 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6106 	OpenPhoneL();
       
  6107 
       
  6108 	RBuf8 dataExpect;
       
  6109 	CleanupClosePushL(dataExpect);
       
  6110 		
       
  6111 	RPacketService packetService;		
       
  6112 	// Open PacketService
       
  6113 	OpenPacketServiceL(packetService);
       
  6114 	CleanupClosePushL(packetService);
       
  6115 
       
  6116 	//-------------------------------------------------------------------------
       
  6117 	// Test A: Test timeout of RPacketService::GetAttachMode
       
  6118  	//-------------------------------------------------------------------------
       
  6119 
       
  6120 	// Expect request in LTSY
       
  6121 	RPacketService::TAttachMode attachMode = RPacketService::EAttachWhenNeeded;
       
  6122 	TMockLtsyData1<RPacketService::TAttachMode> ltsyData(attachMode);
       
  6123 	ltsyData.SerialiseL(dataExpect);	
       
  6124 		
       
  6125 	iMockLTSY.ExpectL(EPacketSetAttachMode, dataExpect);
       
  6126 	
       
  6127 	// Post request
       
  6128 	TRequestStatus requestStatus;		
       
  6129 	packetService.SetAttachMode(requestStatus, attachMode);
       
  6130 	User::WaitForRequest(requestStatus);
       
  6131 
       
  6132 	// Check status is KErrTimedOut
       
  6133 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int())	
       
  6134 
       
  6135 	AssertMockLtsyStatusL();
       
  6136 	CleanupStack::PopAndDestroy(3, this); // packetService, dataExpect, this
       
  6137 	}
       
  6138 
       
  6139 
       
  6140 /**
       
  6141 @SYMTestCaseID BA-CTSY-PKTS-PSGCI-0001
       
  6142 @SYMPREQ 1551
       
  6143 @SYMComponent  telephony_ctsy
       
  6144 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetContextInfo
       
  6145 @SYMTestPriority High
       
  6146 @SYMTestActions Invokes RPacketService::GetContextInfo
       
  6147 @SYMTestExpectedResults Pass
       
  6148 @SYMTestType CT
       
  6149 */
       
  6150 void CCTsyPacketServiceFU::TestGetContextInfo0001L()
       
  6151 	{
       
  6152 
       
  6153 	OpenEtelServerL(EUseExtendedError);
       
  6154 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6155 	OpenPhoneL();
       
  6156 
       
  6157 	RBuf8 data;
       
  6158 	CleanupClosePushL(data);
       
  6159 
       
  6160     RPacketService packetService;       
       
  6161     OpenPacketServiceL(packetService);
       
  6162     CleanupClosePushL(packetService);
       
  6163 	
       
  6164 	RPacketContext packetContext;
       
  6165     TInfoName contextId; 
       
  6166     packetContext.OpenNewContext(packetService, contextId);
       
  6167     CleanupClosePushL(packetContext);
       
  6168 	
       
  6169 
       
  6170 	TRequestStatus requestStatus;
       
  6171 	TInt index(0);
       
  6172 	RPacketService::TContextInfo info;
       
  6173 	
       
  6174 	
       
  6175  	//-------------------------------------------------------------------------
       
  6176 	// TEST C: Successful completion request of
       
  6177 	// RPacketService::GetContextInfo when result is not cached.
       
  6178  	//-------------------------------------------------------------------------
       
  6179 	
       
  6180 	packetService.GetContextInfo(requestStatus, index, info);
       
  6181 
       
  6182 	User::WaitForRequest(requestStatus);
       
  6183 	AssertMockLtsyStatusL();
       
  6184 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6185 	
       
  6186 	TBuf<KMaxName> testBuf(contextId);
       
  6187 	
       
  6188 	ASSERT_EQUALS(testBuf, info.iName);
       
  6189 	ASSERT_EQUALS(RPacketContext::EStatusUnknown, info.iStatus);
       
  6190 
       
  6191 	AssertMockLtsyStatusL();
       
  6192 	CleanupStack::PopAndDestroy(4, this); // packetContext, packetService, data, this
       
  6193 	
       
  6194 	}
       
  6195 
       
  6196 /**
       
  6197 @SYMTestCaseID BA-CTSY-PKTS-PSGCI-0003
       
  6198 @SYMPREQ 1551
       
  6199 @SYMComponent  telephony_ctsy
       
  6200 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetContextInfo with bad parameter data
       
  6201 @SYMTestPriority High
       
  6202 @SYMTestActions Invokes RPacketService::GetContextInfo with bad parameter data
       
  6203 @SYMTestExpectedResults Pass
       
  6204 @SYMTestType CT
       
  6205 */
       
  6206 void CCTsyPacketServiceFU::TestGetContextInfo0003L()
       
  6207 	{
       
  6208 	OpenEtelServerL(EUseExtendedError);
       
  6209 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6210 	OpenPhoneL();
       
  6211 
       
  6212 	RBuf8 data;
       
  6213 	CleanupClosePushL(data);
       
  6214 
       
  6215     RPacketService packetService;       
       
  6216     OpenPacketServiceL(packetService);
       
  6217     CleanupClosePushL(packetService);
       
  6218 	
       
  6219 	
       
  6220 	TRequestStatus requestStatus;
       
  6221 	RPacketService::TContextInfo info;
       
  6222 	TInt index(-1);
       
  6223 	
       
  6224 	packetService.GetContextInfo(requestStatus, index, info);	
       
  6225 	User::WaitForRequest(requestStatus);
       
  6226 	
       
  6227 	AssertMockLtsyStatusL();
       
  6228 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  6229 
       
  6230 	RPacketContext packetContext;
       
  6231     TInfoName contextId; 
       
  6232     packetContext.OpenNewContext(packetService, contextId);
       
  6233     CleanupClosePushL(packetContext);
       
  6234 
       
  6235     index = 1;
       
  6236 	packetService.GetContextInfo(requestStatus, index, info);	
       
  6237 	User::WaitForRequest(requestStatus);
       
  6238 	
       
  6239 	AssertMockLtsyStatusL();
       
  6240 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  6241 
       
  6242 	CleanupStack::PopAndDestroy(2);  //packetContext, packetService
       
  6243 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  6244 
       
  6245 	}
       
  6246 
       
  6247 
       
  6248 /**
       
  6249 @SYMTestCaseID BA-CTSY-PKTS-PSGCI-0004
       
  6250 @SYMPREQ 1551
       
  6251 @SYMComponent  telephony_ctsy
       
  6252 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetContextInfo
       
  6253 @SYMTestPriority High
       
  6254 @SYMTestActions Invokes multiple client requests to RPacketService::GetContextInfo
       
  6255 @SYMTestExpectedResults Pass
       
  6256 @SYMTestType CT
       
  6257 */
       
  6258 void CCTsyPacketServiceFU::TestGetContextInfo0004L()
       
  6259 	{
       
  6260 					
       
  6261 	OpenEtelServerL(EUseExtendedError);
       
  6262 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6263 	OpenPhoneL();
       
  6264 
       
  6265 	RBuf8 data;
       
  6266 	CleanupClosePushL(data);
       
  6267 
       
  6268 	// Open second client
       
  6269 	RTelServer telServer2;
       
  6270 	TInt ret = telServer2.Connect();
       
  6271 	ASSERT_EQUALS(KErrNone, ret);
       
  6272 	CleanupClosePushL(telServer2);
       
  6273 
       
  6274 	RMobilePhone phone2;
       
  6275 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  6276 	ASSERT_EQUALS(KErrNone, ret);
       
  6277 	CleanupClosePushL(phone2);
       
  6278 
       
  6279 	//-------------------------------------------------------------------------
       
  6280 	// Test A: Test multiple clients requesting RPacketService::GetContextInfo
       
  6281  	//-------------------------------------------------------------------------
       
  6282 	
       
  6283     RPacketService packetService;
       
  6284     OpenPacketServiceL(packetService);
       
  6285     CleanupClosePushL(packetService);
       
  6286 
       
  6287     RPacketService packetService2;                
       
  6288     ret = packetService2.Open(phone2);
       
  6289     ASSERT_EQUALS(KErrNone, ret); 
       
  6290     CleanupClosePushL(packetService2);
       
  6291     
       
  6292 	RPacketContext packetContext;
       
  6293     TInfoName contextId; 
       
  6294     packetContext.OpenNewContext(packetService, contextId);
       
  6295     CleanupClosePushL(packetContext);
       
  6296     
       
  6297 	RPacketContext packetContext2;
       
  6298     TInfoName contextId2; 
       
  6299     packetContext2.OpenNewContext(packetService2, contextId2);
       
  6300     CleanupClosePushL(packetContext2);
       
  6301     
       
  6302 	
       
  6303 	TRequestStatus requestStatus;
       
  6304 	RPacketService::TContextInfo info;
       
  6305 	TInt index(0);
       
  6306 		
       
  6307 	packetService.GetContextInfo(requestStatus, index, info);		
       
  6308 	
       
  6309 
       
  6310 	TRequestStatus requestStatus2;
       
  6311 	RPacketService::TContextInfo info2;
       
  6312 	TInt index2(1);
       
  6313 
       
  6314 	packetService2.GetContextInfo(requestStatus2, index2, info2);	
       
  6315 
       
  6316 	
       
  6317 	User::WaitForRequest(requestStatus);	
       
  6318 	AssertMockLtsyStatusL();
       
  6319 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6320 	
       
  6321 	TBuf<KMaxName> testBuf(contextId);
       
  6322 		
       
  6323 	ASSERT_EQUALS(testBuf, info.iName);
       
  6324 	ASSERT_EQUALS(RPacketContext::EStatusUnknown, info.iStatus);
       
  6325 
       
  6326 	
       
  6327 	User::WaitForRequest(requestStatus2);	
       
  6328 	AssertMockLtsyStatusL();
       
  6329 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  6330 
       
  6331 	TBuf<KMaxName> testBuf2(contextId2);
       
  6332 		
       
  6333 	ASSERT_EQUALS(testBuf2, info2.iName);
       
  6334 	ASSERT_EQUALS(RPacketContext::EStatusUnknown, info2.iStatus);
       
  6335 
       
  6336 
       
  6337 	CleanupStack::PopAndDestroy(4);  //packetService(2) packetContexts(2)
       
  6338 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  6339 
       
  6340 	}
       
  6341 
       
  6342 
       
  6343 
       
  6344 
       
  6345 /**
       
  6346 @SYMTestCaseID BA-CTSY-PKTS-PSGDC-0001
       
  6347 @SYMPREQ 1551
       
  6348 @SYMComponent  telephony_ctsy
       
  6349 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetDynamicCaps
       
  6350 @SYMTestPriority High
       
  6351 @SYMTestActions Invokes RPacketService::GetDynamicCaps
       
  6352 @SYMTestExpectedResults Pass
       
  6353 @SYMTestType CT
       
  6354 */
       
  6355 void CCTsyPacketServiceFU::TestGetDynamicCaps0001L()
       
  6356 	{
       
  6357 
       
  6358 	OpenEtelServerL(EUseExtendedError);
       
  6359 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6360 	OpenPhoneL();
       
  6361 
       
  6362 	RBuf8 data;
       
  6363 	CleanupClosePushL(data);
       
  6364 
       
  6365     RPacketService packetService;       
       
  6366     OpenPacketServiceL(packetService);
       
  6367     CleanupClosePushL(packetService);
       
  6368 	
       
  6369     // first get the default
       
  6370     RPacketService::TDynamicCapsFlags caps;
       
  6371     TInt ret = packetService.GetDynamicCaps(caps);
       
  6372     ASSERT_EQUALS(KErrNone, ret); 
       
  6373     const RPacketService::TDynamicCapsFlags KZeroCaps(0);
       
  6374     ASSERT_EQUALS(KZeroCaps, caps); 
       
  6375 
       
  6376 	//now change caps
       
  6377 	TBool gprsIsSupportedOnCell = EFalse;
       
  6378 	TBool csServicesIsSupportedOnCell = ETrue;
       
  6379 	TMockLtsyData2 <TBool, TBool> ltsyData(gprsIsSupportedOnCell, csServicesIsSupportedOnCell);
       
  6380 	ltsyData.SerialiseL(data);	
       
  6381 				
       
  6382  	TRequestStatus mockLtsyStatus;
       
  6383 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6384 	iMockLTSY.CompleteL(EPacketNotifyDynamicCapsChange, KErrNone, data);
       
  6385 	User::WaitForRequest(mockLtsyStatus);
       
  6386 	AssertMockLtsyStatusL();
       
  6387 	
       
  6388 		
       
  6389     //now get new caps
       
  6390     ret = packetService.GetDynamicCaps(caps);
       
  6391     ASSERT_EQUALS(KErrNone, ret); 
       
  6392     const RPacketService::TDynamicCapsFlags KRxCs(RPacketService::KCapsRxCSCall);
       
  6393     ASSERT_EQUALS(KRxCs, caps); 
       
  6394 
       
  6395 
       
  6396 	AssertMockLtsyStatusL();
       
  6397 	CleanupStack::PopAndDestroy(); //packetService
       
  6398 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  6399 	
       
  6400 	}
       
  6401 
       
  6402 /**
       
  6403 @SYMTestCaseID BA-CTSY-PKTS-PSGDC-0001b
       
  6404 @SYMPREQ 1551
       
  6405 @SYMComponent  telephony_ctsy
       
  6406 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetDynamicCaps (HSUPA)
       
  6407 @SYMTestPriority High
       
  6408 @SYMTestActions Invokes RPacketService::GetDynamicCaps
       
  6409 @SYMTestExpectedResults Pass
       
  6410 @SYMTestType CT
       
  6411 */
       
  6412 void CCTsyPacketServiceFU::TestGetDynamicCaps0001bL()
       
  6413 	{
       
  6414 	
       
  6415 	OpenEtelServerL(EUseExtendedError);
       
  6416 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6417 	OpenPhoneL();
       
  6418 
       
  6419 	RBuf8 data;
       
  6420 	CleanupClosePushL(data);
       
  6421 
       
  6422     RPacketService packetService;       
       
  6423     OpenPacketServiceL(packetService);
       
  6424     CleanupClosePushL(packetService);
       
  6425     
       
  6426     RPacketService::TDynamicCapsFlags caps;
       
  6427     
       
  6428     // Get default caps
       
  6429     TInt ret = packetService.GetDynamicCaps(caps);
       
  6430     ASSERT_EQUALS(KErrNone, ret); 
       
  6431     const RPacketService::TDynamicCapsFlags KZeroCaps(0);
       
  6432     ASSERT_EQUALS(KZeroCaps, caps); 
       
  6433     
       
  6434     // Change caps
       
  6435     TDynamicTransferCapsFlags transferCaps = KCapsHSDPA | KCapsHSUPA;
       
  6436 	TMockLtsyData1< TDynamicTransferCapsFlags > ltsyData(transferCaps);
       
  6437 	data.Close();
       
  6438 	ltsyData.SerialiseL(data);
       
  6439 	
       
  6440 	TRequestStatus mockLtsyStatus;	
       
  6441 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6442 	iMockLTSY.CompleteL(EPacketNotifyTransferCapsIPC, KErrNone, data);
       
  6443 	User::WaitForRequest(mockLtsyStatus);	
       
  6444 	
       
  6445 	// Get new caps
       
  6446 	ret = packetService.GetDynamicCaps(caps);
       
  6447     ASSERT_EQUALS(KErrNone, ret);
       
  6448     
       
  6449     const RPacketService::TDynamicCapsFlags KHsupa(RPacketService::KCapsHSUPA);
       
  6450     ASSERT_TRUE(KHsupa&caps);
       
  6451     
       
  6452     AssertMockLtsyStatusL();
       
  6453     
       
  6454 	CleanupStack::PopAndDestroy(3); // packetService, data, this
       
  6455 	
       
  6456 	}
       
  6457 
       
  6458 /**
       
  6459 @SYMTestCaseID BA-CTSY-PKTS-PSGNRS-0001
       
  6460 @SYMPREQ 1551
       
  6461 @SYMCR 1595
       
  6462 @SYMComponent  telephony_ctsy
       
  6463 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetNtwkRegStatus
       
  6464 @SYMTestPriority High
       
  6465 @SYMTestActions Invokes RPacketService::GetNtwkRegStatus
       
  6466 @SYMTestExpectedResults Pass
       
  6467 @SYMTestType CT
       
  6468 */
       
  6469 void CCTsyPacketServiceFU::TestGetNtwkRegStatus0001L()
       
  6470 	{
       
  6471 
       
  6472 	OpenEtelServerL(EUseExtendedError);
       
  6473 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6474 	OpenPhoneL();
       
  6475 
       
  6476 	RBuf8 data;
       
  6477 	CleanupClosePushL(data);
       
  6478 
       
  6479     RPacketService packetService;       
       
  6480     OpenPacketServiceL(packetService);
       
  6481     CleanupClosePushL(packetService);
       
  6482     	
       
  6483     //-------------------------------------------------------------------------
       
  6484 	// TEST A: failure to dispatch request to LTSY
       
  6485  	//-------------------------------------------------------------------------
       
  6486 	// Queue response
       
  6487 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus, KErrNotSupported);
       
  6488 	// Post request
       
  6489 	TRequestStatus requestStatus;
       
  6490 	RPacketService::TRegistrationStatus regStatus;
       
  6491 	packetService.GetNtwkRegStatus(requestStatus, regStatus);
       
  6492 	User::WaitForRequest(requestStatus);
       
  6493 	AssertMockLtsyStatusL();
       
  6494 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  6495 
       
  6496  	//-------------------------------------------------------------------------
       
  6497 	// TEST C: Successful completion request of
       
  6498 	// RPacketService::GetNtwkRegStatus when result is not cached.
       
  6499  	//-------------------------------------------------------------------------
       
  6500     RPacketService::TRegistrationStatus reqStatusComplete = RPacketService::ERegisteredOnHomeNetwork;
       
  6501 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus);
       
  6502 	TMockLtsyData1<RPacketService::TRegistrationStatus> ltsyData(reqStatusComplete);
       
  6503 	ltsyData.SerialiseL(data);
       
  6504 	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, KErrNone, data);
       
  6505 	regStatus = RPacketService::TRegistrationStatus(0);
       
  6506 
       
  6507 	packetService.GetNtwkRegStatus(requestStatus, regStatus);
       
  6508 	
       
  6509 	User::WaitForRequest(requestStatus);
       
  6510 	AssertMockLtsyStatusL();
       
  6511 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6512 	ASSERT_TRUE(reqStatusComplete == regStatus);
       
  6513 	
       
  6514 	//-------------------------------------------------------------------------
       
  6515 	// TEST : Completion of request 
       
  6516 	// RPacketService::GetNtwkRegStatus with extended error code.
       
  6517  	//-------------------------------------------------------------------------
       
  6518   
       
  6519 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus);
       
  6520 	data.Close();
       
  6521 	ltsyData.SerialiseL(data);
       
  6522 	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, SYMBIAN_EXTERR(KErrGsmCCNetworkOutOfOrder,KErrNotFound), data);
       
  6523 	regStatus = RPacketService::TRegistrationStatus(0);
       
  6524 
       
  6525 	packetService.GetNtwkRegStatus(requestStatus, regStatus);
       
  6526 	
       
  6527 	User::WaitForRequest(requestStatus);
       
  6528 	AssertMockLtsyStatusL();
       
  6529 	ASSERT_EQUALS(KErrGsmCCNetworkOutOfOrder, requestStatus.Int());
       
  6530 	
       
  6531 	// Check that basic error code is returned when error granuality set to EErrorBasic
       
  6532 	RTelServer::TErrorGranularity granularity(RTelServer::EErrorBasic);
       
  6533 
       
  6534 	TInt ret = iTelServer.SetExtendedErrorGranularity(granularity);
       
  6535 	ASSERT_EQUALS(KErrNone, ret);
       
  6536 
       
  6537 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus);
       
  6538 	data.Close();
       
  6539 	ltsyData.SerialiseL(data);
       
  6540 	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, SYMBIAN_EXTERR(KErrGsmCCNetworkOutOfOrder,KErrNotFound), data);
       
  6541 	regStatus = RPacketService::TRegistrationStatus(0);
       
  6542 
       
  6543 	packetService.GetNtwkRegStatus(requestStatus, regStatus);
       
  6544 	
       
  6545 	User::WaitForRequest(requestStatus);
       
  6546 	AssertMockLtsyStatusL();
       
  6547 	ASSERT_EQUALS(KErrNotFound, requestStatus.Int());
       
  6548 
       
  6549 	//-------------------------------------------------------------------------
       
  6550 	// TEST E: Unsolicited completion of RPacketService::SetDefaultContextParams
       
  6551 	// from LTSY.
       
  6552  	//-------------------------------------------------------------------------
       
  6553   	TRequestStatus mockLtsyStatus;
       
  6554 	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
  6555  	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, KErrNone, data);
       
  6556  	User::WaitForRequest(mockLtsyStatus);
       
  6557 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  6558 	
       
  6559 	//-------------------------------------------------------------------------
       
  6560 	// TEST E_2: Unsolicited completion of RPacketService::SetDefaultContextParams
       
  6561 	// from LTSY with the same reqStatusComplete
       
  6562  	//-------------------------------------------------------------------------
       
  6563   	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
  6564  	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, KErrNone, data);
       
  6565  	User::WaitForRequest(mockLtsyStatus);
       
  6566 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  6567 	
       
  6568 	//-------------------------------------------------------------------------
       
  6569 	// TEST E_3: Unsolicited completion of RPacketService::SetDefaultContextParams
       
  6570 	// from LTSY when there is NotifyChangeOfNtwkRegStatus was called
       
  6571  	//-------------------------------------------------------------------------	
       
  6572 	RPacketService::TRegistrationStatus registrationStatus;		
       
  6573 	// Post NotifyChangeOfNtwkRegStatus request		
       
  6574 	packetService.NotifyChangeOfNtwkRegStatus(requestStatus, registrationStatus);
       
  6575 		
       
  6576 	reqStatusComplete = RPacketService::ERegisteredRoaming;
       
  6577 	TMockLtsyData1<RPacketService::TRegistrationStatus> ltsyData2(reqStatusComplete);
       
  6578 	data.Close();
       
  6579 	ltsyData2.SerialiseL(data);
       
  6580 	
       
  6581 	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
  6582  	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, KErrNone, data);
       
  6583  	User::WaitForRequest(mockLtsyStatus);
       
  6584 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  6585 		
       
  6586 	User::WaitForRequest(mockLtsyStatus);
       
  6587 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6588 	ASSERT_EQUALS(reqStatusComplete, registrationStatus);
       
  6589 	
       
  6590 	
       
  6591 	//-------------------------------------------------------------------------
       
  6592 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  6593  	//-------------------------------------------------------------------------
       
  6594 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus);
       
  6595 	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, KErrGeneral, data);
       
  6596 	packetService.GetNtwkRegStatus(requestStatus, regStatus);
       
  6597 	User::WaitForRequest(requestStatus);
       
  6598 	AssertMockLtsyStatusL();
       
  6599    	ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); 
       
  6600 
       
  6601 
       
  6602 	AssertMockLtsyStatusL();
       
  6603     CleanupStack::PopAndDestroy(); // packetService
       
  6604 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  6605 	
       
  6606 	}
       
  6607 
       
  6608 
       
  6609 
       
  6610 /**
       
  6611 @SYMTestCaseID BA-CTSY-PKTS-PSGNRS-0004
       
  6612 @SYMPREQ 1551
       
  6613 @SYMComponent  telephony_ctsy
       
  6614 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetNtwkRegStatus
       
  6615 @SYMTestPriority High
       
  6616 @SYMTestActions Invokes multiple client requests to RPacketService::GetNtwkRegStatus
       
  6617 @SYMTestExpectedResults Pass
       
  6618 @SYMTestType CT
       
  6619 */
       
  6620 void CCTsyPacketServiceFU::TestGetNtwkRegStatus0004L()
       
  6621 	{
       
  6622 
       
  6623 					
       
  6624 	OpenEtelServerL(EUseExtendedError);
       
  6625 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6626 	OpenPhoneL();
       
  6627 
       
  6628 	RBuf8 data;
       
  6629 	CleanupClosePushL(data);
       
  6630 
       
  6631 	// Open second client
       
  6632 	RTelServer telServer2;
       
  6633 	TInt ret = telServer2.Connect();
       
  6634 	ASSERT_EQUALS(KErrNone, ret);
       
  6635 	CleanupClosePushL(telServer2);
       
  6636 
       
  6637 	RMobilePhone phone2;
       
  6638 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  6639 	ASSERT_EQUALS(KErrNone, ret);
       
  6640 	CleanupClosePushL(phone2);
       
  6641 
       
  6642     RPacketService packetService;
       
  6643     OpenPacketServiceL(packetService);
       
  6644     CleanupClosePushL(packetService);
       
  6645 
       
  6646     RPacketService packetService2;                
       
  6647     ret = packetService2.Open(phone2);
       
  6648     ASSERT_EQUALS(KErrNone, ret); 
       
  6649     CleanupClosePushL(packetService2);
       
  6650     
       
  6651 
       
  6652     const RPacketService::TRegistrationStatus KRegStatus(RPacketService::ENotRegisteredNotSearching);
       
  6653     
       
  6654 	// Expect call down to LTSY for this IPC from first client
       
  6655 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus);
       
  6656 
       
  6657 	RPacketService::TRegistrationStatus regStatus(KRegStatus);
       
  6658 	TMockLtsyData1<RPacketService::TRegistrationStatus> regData(regStatus);
       
  6659 	regData.SerialiseL(data);
       
  6660 	
       
  6661 	iMockLTSY.CompleteL(EPacketGetNtwkRegStatus, KErrNone, data);
       
  6662 
       
  6663 	RPacketService::TRegistrationStatus regStatus1;
       
  6664 	TRequestStatus requestStatus1;
       
  6665 	packetService.GetNtwkRegStatus(requestStatus1, regStatus1);
       
  6666 
       
  6667 	RPacketService::TRegistrationStatus regStatus2;
       
  6668 	TRequestStatus requestStatus2;
       
  6669 	packetService2.GetNtwkRegStatus(requestStatus2, regStatus2);
       
  6670 
       
  6671 	// Check result for first client
       
  6672 	User::WaitForRequest(requestStatus1);
       
  6673 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  6674 	ASSERT_TRUE(regStatus1 == KRegStatus);
       
  6675 
       
  6676 	// Check result for second client
       
  6677 	User::WaitForRequest(requestStatus2);
       
  6678 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  6679 
       
  6680 	AssertMockLtsyStatusL();
       
  6681 
       
  6682 	CleanupStack::PopAndDestroy(2); // packetService packetService2
       
  6683 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  6684 
       
  6685 	}
       
  6686 
       
  6687 
       
  6688 /**
       
  6689 @SYMTestCaseID BA-CTSY-PKTS-PSGNRS-0005
       
  6690 @SYMPREQ 1551
       
  6691 @SYMComponent  telephony_ctsy
       
  6692 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetNtwkRegStatus with timeout
       
  6693 @SYMTestPriority High
       
  6694 @SYMTestActions Invokes RPacketService::GetNtwkRegStatus and tests for timeout
       
  6695 @SYMTestExpectedResults Pass
       
  6696 @SYMTestType CT
       
  6697 */
       
  6698 void CCTsyPacketServiceFU::TestGetNtwkRegStatus0005L()
       
  6699 	{
       
  6700 
       
  6701 	OpenEtelServerL(EUseExtendedError);
       
  6702 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6703 	OpenPhoneL();
       
  6704 
       
  6705 	RBuf8 data;
       
  6706 	CleanupClosePushL(data);
       
  6707 
       
  6708     RPacketService packetService;       
       
  6709     OpenPacketServiceL(packetService);
       
  6710     CleanupClosePushL(packetService);
       
  6711     	
       
  6712     	
       
  6713 	//-------------------------------------------------------------------------
       
  6714 	// Test A: Test timeout of RPacketService::GetNtwkRegStatus
       
  6715  	//-------------------------------------------------------------------------
       
  6716 
       
  6717 	iMockLTSY.ExpectL(EPacketGetNtwkRegStatus);
       
  6718 
       
  6719 	TRequestStatus requestStatus;
       
  6720 	RPacketService::TRegistrationStatus regStatus;
       
  6721 	
       
  6722 	packetService.GetNtwkRegStatus(requestStatus, regStatus);
       
  6723 	
       
  6724 	User::WaitForRequest(requestStatus);
       
  6725 	AssertMockLtsyStatusL();
       
  6726 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int()); 
       
  6727 
       
  6728     CleanupStack::PopAndDestroy(); // packetService
       
  6729 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  6730 
       
  6731 	}
       
  6732 
       
  6733 
       
  6734 
       
  6735 /**
       
  6736 @SYMTestCaseID BA-CTSY-PKTS-PSEC-0001
       
  6737 @SYMPREQ 1551
       
  6738 @SYMComponent  telephony_ctsy
       
  6739 @SYMTestCaseDesc Test support in CTSY for RPacketService::EnumerateContexts
       
  6740 @SYMTestPriority High
       
  6741 @SYMTestActions Invokes RPacketService::EnumerateContexts
       
  6742 @SYMTestExpectedResults Pass
       
  6743 @SYMTestType CT
       
  6744 */
       
  6745 void CCTsyPacketServiceFU::TestEnumerateContexts0001L()
       
  6746 	{
       
  6747 
       
  6748 	OpenEtelServerL(EUseExtendedError);
       
  6749 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6750 	OpenPhoneL();
       
  6751 
       
  6752 	RBuf8 data;
       
  6753 	CleanupClosePushL(data);
       
  6754 
       
  6755 	RPacketService packetService;		
       
  6756 	// Open PacketService
       
  6757 	OpenPacketServiceL(packetService);
       
  6758 	CleanupClosePushL(packetService); 
       
  6759 
       
  6760 
       
  6761 	
       
  6762 	//-------------------------------------------------------------------------
       
  6763 	// TEST D: RPacketService::EnumerateContexts again, this time CTSY
       
  6764 	// will get result from the cache.
       
  6765  	//------------------------------------------------------------------------- 	
       
  6766 	TRequestStatus requestStatus;
       
  6767  	TInt count;
       
  6768  	TInt maxAllowed; 	
       
  6769 	
       
  6770 	packetService.EnumerateContexts(requestStatus, count, maxAllowed);
       
  6771 	
       
  6772 	User::WaitForRequest(requestStatus);
       
  6773 	AssertMockLtsyStatusL();	
       
  6774 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6775 	ASSERT_EQUALS(0, count);
       
  6776 	// Maximum number of simultaneous contexts supported by this phone
       
  6777 	const TInt maxNumberOfContexts = 11;
       
  6778 	ASSERT_EQUALS(maxNumberOfContexts, maxAllowed);
       
  6779 
       
  6780  	//-------------------------------------------------------------------------
       
  6781 	// TEST C: Successful completion request of
       
  6782 	// RPacketService::EnumerateContexts when result is not cached.
       
  6783  	//-------------------------------------------------------------------------	
       
  6784   
       
  6785     // Open new context
       
  6786 	TInfoName contextId;
       
  6787 	RPacketContext packetContext;
       
  6788 	packetContext.OpenNewContext(packetService, contextId);
       
  6789 	CleanupClosePushL(packetContext); 
       
  6790 	
       
  6791 	// send request to get number of opened contexts
       
  6792 	packetService.EnumerateContexts(requestStatus, count, maxAllowed);	
       
  6793 	User::WaitForRequest(requestStatus);
       
  6794 	
       
  6795 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6796 	ASSERT_EQUALS(1, count);
       
  6797 	ASSERT_EQUALS(maxNumberOfContexts, maxAllowed);
       
  6798  
       
  6799 	AssertMockLtsyStatusL();
       
  6800 	CleanupStack::PopAndDestroy(2);// packetContext, packetService
       
  6801 	CleanupStack::PopAndDestroy(2, this); // data, this	
       
  6802 	
       
  6803 	}
       
  6804 
       
  6805 
       
  6806 /**
       
  6807 @SYMTestCaseID BA-CTSY-PKTS-PSEC-0004
       
  6808 @SYMPREQ 1551
       
  6809 @SYMComponent  telephony_ctsy
       
  6810 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::EnumerateContexts
       
  6811 @SYMTestPriority High
       
  6812 @SYMTestActions Invokes multiple client requests to RPacketService::EnumerateContexts
       
  6813 @SYMTestExpectedResults Pass
       
  6814 @SYMTestType CT
       
  6815 */
       
  6816 void CCTsyPacketServiceFU::TestEnumerateContexts0004L()
       
  6817 	{
       
  6818 					
       
  6819 	OpenEtelServerL(EUseExtendedError);
       
  6820 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6821 	OpenPhoneL();
       
  6822 
       
  6823 	RBuf8 data;
       
  6824 	CleanupClosePushL(data);
       
  6825 
       
  6826 	// Open second client
       
  6827 	RTelServer telServer2;
       
  6828 	TInt ret = telServer2.Connect();
       
  6829 	ASSERT_EQUALS(KErrNone, ret);
       
  6830 	CleanupClosePushL(telServer2);
       
  6831 
       
  6832 	RMobilePhone phone2;
       
  6833 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  6834 	ASSERT_EQUALS(KErrNone, ret);
       
  6835 	CleanupClosePushL(phone2);
       
  6836 	
       
  6837 	RPacketService packetService;
       
  6838 	OpenPacketServiceL(packetService);
       
  6839 	CleanupClosePushL(packetService);
       
  6840 
       
  6841 	RPacketService packetService2;                
       
  6842 	ret = packetService2.Open(phone2);
       
  6843 	ASSERT_EQUALS(KErrNone, ret);
       
  6844 	CleanupClosePushL(packetService2); 
       
  6845 	//-------------------------------------------------------------------------
       
  6846 	// Test A: Test multiple clients requesting RPacketService::EnumerateContexts
       
  6847  	//-------------------------------------------------------------------------
       
  6848 
       
  6849 	TRequestStatus requestStatus;
       
  6850  	TInt count;
       
  6851  	TInt maxAllowed; 
       
  6852  	
       
  6853  	TRequestStatus requestStatus2;
       
  6854  	TInt count2;
       
  6855  	TInt maxAllowed2;	
       
  6856 	
       
  6857 	//first request
       
  6858 	packetService.EnumerateContexts(requestStatus, count, maxAllowed);
       
  6859 	packetService2.EnumerateContexts(requestStatus2, count2, maxAllowed2);
       
  6860 	
       
  6861 	//wait for first answer
       
  6862 	User::WaitForRequest(requestStatus);	
       
  6863 	AssertMockLtsyStatusL();	
       
  6864 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6865 	ASSERT_EQUALS(0, count);
       
  6866 	// Maximum number of simultaneous contexts supported by this phone
       
  6867 	const TInt maxNumberOfContexts = 11;
       
  6868 	ASSERT_EQUALS(maxNumberOfContexts, maxAllowed);
       
  6869 	
       
  6870 	//wait for second answer
       
  6871 	User::WaitForRequest(requestStatus2);
       
  6872 	AssertMockLtsyStatusL();	
       
  6873 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  6874 	ASSERT_EQUALS(0, count2);
       
  6875 	ASSERT_EQUALS(maxNumberOfContexts, maxAllowed2);
       
  6876 		
       
  6877 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  6878 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  6879 	}
       
  6880 	
       
  6881 	
       
  6882 
       
  6883 /**
       
  6884 @SYMTestCaseID BA-CTSY-PKTS-PSCNEIC-0001
       
  6885 @SYMPREQ 1551
       
  6886 @SYMComponent  telephony_ctsy
       
  6887 @SYMTestCaseDesc Test support in CTSY for internal CMmPacketServiceTsy::CompleteNotifyEGprsInfoChange
       
  6888 @SYMTestPriority High
       
  6889 @SYMTestExpectedResults Pass
       
  6890 @SYMTestType CT 
       
  6891 */
       
  6892 void CCTsyPacketServiceFU::TestCompleteNotifyEGprsInfoChange0001L()
       
  6893 	{	
       
  6894 	OpenEtelServerL(EUseExtendedError);
       
  6895 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6896 	OpenPhoneL();
       
  6897 
       
  6898 	RBuf8 data;
       
  6899 	CleanupClosePushL(data);
       
  6900 
       
  6901 	RPacketService packetService;		
       
  6902 	// Open PacketService
       
  6903 	OpenPacketServiceL(packetService);
       
  6904 	CleanupClosePushL(packetService);
       
  6905 	
       
  6906 	TBool lastEdgeGprsSupport = EFalse;	
       
  6907 	TMockLtsyData1 <TBool> ltsyData(lastEdgeGprsSupport);
       
  6908 	ltsyData.SerialiseL(data);	
       
  6909 		
       
  6910 	//-------------------------------------------------------------------------
       
  6911 	// Test CompleteNotifyEGprsInfoChange with no CustomTsy
       
  6912  	//-------------------------------------------------------------------------
       
  6913  	TRequestStatus mockLtsyStatus;
       
  6914 	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
  6915 	iMockLTSY.CompleteL(EMmTsyNotifyEGprsInfoChangeIPC, KErrNone, data);	
       
  6916 	User::WaitForRequest(mockLtsyStatus);
       
  6917 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());			
       
  6918 	AssertMockLtsyStatusL();	
       
  6919 	
       
  6920 	//-------------------------------------------------------------------------
       
  6921 	// Test CompleteNotifyEGprsInfoChange with CustomTsy
       
  6922  	//-------------------------------------------------------------------------
       
  6923 	
       
  6924 	// prepare iMockLTSY.ExpectLs for RMmCustomAPI opening
       
  6925 	iMockLTSY.ExpectL(ECustomGetIccCallForwardingStatusIPC);
       
  6926 	RMmCustomAPI::TViagCacheRecordId currentlyRetrievedCache;
       
  6927 	currentlyRetrievedCache.iCacheId	= 1;
       
  6928 	currentlyRetrievedCache.iRecordId	= 0;		
       
  6929 	TMockLtsyData1 <RMmCustomAPI::TViagCacheRecordId> ltsyDataCustomAPI(currentlyRetrievedCache);
       
  6930 	data.Close();
       
  6931 	ltsyDataCustomAPI.SerialiseL(data);			
       
  6932 	iMockLTSY.ExpectL(EReadViagHomeZoneCacheIPC, data);
       
  6933 				
       
  6934 	// Create CustomTsy			
       
  6935 	RMmCustomAPI customAPI;		
       
  6936 	TInt ret = customAPI.Open (iPhone);	
       
  6937 	ASSERT_EQUALS(KErrNone, ret);
       
  6938 	CleanupClosePushL(customAPI);
       
  6939 	
       
  6940 		
       
  6941 	iMockLTSY.NotifyTerminated(mockLtsyStatus);		
       
  6942 	iMockLTSY.CompleteL(EMmTsyNotifyEGprsInfoChangeIPC, KErrNone, data);	
       
  6943 	User::WaitForRequest(mockLtsyStatus);
       
  6944 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  6945 	
       
  6946 	CleanupStack::PopAndDestroy(4, this); //  customAPI, packetService, data, this
       
  6947 	
       
  6948 	}
       
  6949 	
       
  6950 	
       
  6951 	
       
  6952 	
       
  6953 /**
       
  6954 @SYMTestCaseID BA-CTSY-PKTS-PSCSAO-0001
       
  6955 @SYMPREQ 1551
       
  6956 @SYMComponent  telephony_ctsy
       
  6957 @SYMTestCaseDesc Test support in CTSY for internal CMmPacketServiceTsy::CompleteSetAlwaysOn
       
  6958 @SYMTestPriority High
       
  6959 @SYMTestExpectedResults Pass
       
  6960 @SYMTestType CT 
       
  6961 */
       
  6962 void CCTsyPacketServiceFU::TestCompleteSetAlwaysOn0001L()
       
  6963 	{	
       
  6964 	
       
  6965 	OpenEtelServerL(EUseExtendedError);
       
  6966 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6967 	OpenPhoneL();
       
  6968 
       
  6969 	RBuf8 data;
       
  6970 	CleanupClosePushL(data);
       
  6971 	
       
  6972 	RBuf8 expectData;
       
  6973 	CleanupClosePushL(expectData);
       
  6974 
       
  6975 	RPacketService packetService;		
       
  6976 	// Open PacketService
       
  6977 	OpenPacketServiceL(packetService);
       
  6978 	CleanupClosePushL(packetService);
       
  6979 	
       
  6980 	// data for CompleteL
       
  6981 	TInt result = 0;
       
  6982 	TMockLtsyData1 <TInt> ltsyData(result);
       
  6983 	ltsyData.SerialiseL(data);
       
  6984 	
       
  6985 	//-------------------------------------------------------------------------
       
  6986 	// Test CompleteSetAlwaysOn with no CustomTsy
       
  6987 	// and when  EMultimodePacketServiceReqHandleUnknown == reqHandle 
       
  6988 	// (line 3157 in CMmPacketServiceTsy.cpp)
       
  6989  	//-------------------------------------------------------------------------
       
  6990  	TRequestStatus mockLtsyStatus;
       
  6991  	
       
  6992 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  6993 		
       
  6994 	iMockLTSY.CompleteL(ECustomSetAlwaysOnMode, KErrNone, data);	
       
  6995 	User::WaitForRequest(mockLtsyStatus);
       
  6996 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());			
       
  6997 	AssertMockLtsyStatusL();
       
  6998 		
       
  6999 	
       
  7000 	//-------------------------------------------------------------------------
       
  7001 	// Test CompleteSetAlwaysOn with  CustomTsy
       
  7002  	//------------------------------------------------------------------------- 	 	
       
  7003  	
       
  7004 	// prepare iMockLTSY.ExpectLs for RMmCustomAPI opening
       
  7005 	iMockLTSY.ExpectL(ECustomGetIccCallForwardingStatusIPC);
       
  7006 	RMmCustomAPI::TViagCacheRecordId currentlyRetrievedCache;
       
  7007 	currentlyRetrievedCache.iCacheId	= 1;
       
  7008 	currentlyRetrievedCache.iRecordId	= 0;		
       
  7009 	TMockLtsyData1 <RMmCustomAPI::TViagCacheRecordId> ltsyDataCustomAPI(currentlyRetrievedCache);
       
  7010 	data.Close();
       
  7011 	ltsyDataCustomAPI.SerialiseL(data);			
       
  7012 	iMockLTSY.ExpectL(EReadViagHomeZoneCacheIPC, data);
       
  7013 	
       
  7014  	// Create CustomTsy			
       
  7015 	RMmCustomAPI customAPI;		
       
  7016 	TInt ret = customAPI.Open (iPhone);	
       
  7017 	ASSERT_EQUALS(KErrNone, ret); 	
       
  7018 	CleanupClosePushL(customAPI);
       
  7019 	
       
  7020 	TRequestStatus requestStatus; 
       
  7021 	RMmCustomAPI::TSetAlwaysOnMode mode = RMmCustomAPI::EAlwaysModeBoth; 	
       
  7022 	
       
  7023 	// data for ExpectL
       
  7024 	TMockLtsyData1 <RMmCustomAPI::TSetAlwaysOnMode> expData(mode);
       
  7025 	expData.SerialiseL(expectData);
       
  7026 	
       
  7027 	// prepare ExpectL and CompleteL
       
  7028 	iMockLTSY.ExpectL(ECustomSetAlwaysOnMode, expectData);	
       
  7029 	iMockLTSY.CompleteL(ECustomSetAlwaysOnMode, KErrNone, data);
       
  7030  	
       
  7031  	// Send request to set AlwaysOnMode	 
       
  7032     customAPI.SetAlwaysOn(requestStatus, mode);
       
  7033 	User::WaitForRequest(requestStatus);
       
  7034 	ASSERT_EQUALS(KErrNone, requestStatus.Int());				
       
  7035 	
       
  7036 	CleanupStack::PopAndDestroy(5, this); // customAPI, packetService,expectData,  data, this	
       
  7037 	}
       
  7038 	
       
  7039 
       
  7040 /**
       
  7041 @SYMTestCaseID BA-CTSY-PKTS-PTMS-0001
       
  7042 @SYMPREQ 1551
       
  7043 @SYMComponent  telephony_ctsy
       
  7044 @SYMTestCaseDesc Test support in CTSY for RPacketService::CompleteGetStaticCaps
       
  7045 @SYMTestPriority 
       
  7046 @SYMTestActions Invokes RPacketService::CompleteGetStaticCaps with KCapsMBMSSupported capability
       
  7047 @SYMTestExpectedResults Pass
       
  7048 @SYMTestType CT
       
  7049 */
       
  7050 void CCTsyPacketServiceFU::TestTsyMbmsSupportCaps0001L()
       
  7051     {
       
  7052     OpenEtelServerL(EUseExtendedError);
       
  7053 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7054 	OpenPhoneL();
       
  7055 
       
  7056 	RBuf8 data;
       
  7057 	CleanupClosePushL(data);
       
  7058 	
       
  7059     RPacketService packetService;       
       
  7060     OpenPacketServiceL(packetService, RPacketService::EStatusUnattached, RPacketService::EAttachWhenNeeded);
       
  7061     CleanupClosePushL(packetService);
       
  7062   	TRequestStatus mockLtsyStatus;
       
  7063  	
       
  7064  	//-------------------------------------------------------------------------
       
  7065 	// TEST A: Successful completion request of
       
  7066 	// RPacketService::CompleteGetStaticCaps.
       
  7067  	//------------------------------------------------------------------------- 
       
  7068  			
       
  7069  	// data for ExpectL
       
  7070 	// Ensure RPacketService::GetStaticCaps returns caps KCapsMBMSSupported.			  	
       
  7071     TUint staticCaps = 0;
       
  7072    	TUint expectedCaps = 	RPacketService::KCapsSuspendSupported |
       
  7073 							RPacketService::KCapsNetworkAvailabilitySupported | 
       
  7074 							RPacketService::KCapsSetDefaultContextSupported | 
       
  7075 							RPacketService::KCapsChangeAttachModeSupported | 
       
  7076 							RPacketService::KCapsGetDataTransferredSupported | 
       
  7077 							RPacketService::KCapsPreferredBearerSupported | 
       
  7078 							RPacketService::KCapsPdpDataCompSupported | 
       
  7079 							RPacketService::KCapsPdpHeaderCompSupported | 
       
  7080 						    RPacketService::KCapsMSClassSupported |
       
  7081 							RPacketService::KCapsNotifyMSClassSupported |
       
  7082 							RPacketService::KCapsMBMSSupported;	
       
  7083 
       
  7084 	TMockLtsyData1<TUint> ltsyData(expectedCaps);
       
  7085 	data.Close();
       
  7086 	ltsyData.SerialiseL(data);    
       
  7087 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  7088 	iMockLTSY.CompleteL( EPacketGetStaticCaps, KErrNone, data );
       
  7089 	User::WaitForRequest(mockLtsyStatus);	
       
  7090 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  7091 			
       
  7092 	TInt ret = packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4);
       
  7093 	ASSERT_EQUALS(KErrNone, ret);	 	
       
  7094 	ASSERT_EQUALS(staticCaps, expectedCaps);
       
  7095 		
       
  7096 	AssertMockLtsyStatusL();
       
  7097 	CleanupStack::PopAndDestroy( 3, this );  // packetService, data, this	
       
  7098     }
       
  7099     
       
  7100 /**
       
  7101 @SYMTestCaseID BA-CTSY-PKTS-PTMS-0002
       
  7102 @SYMPREQ 1551
       
  7103 @SYMComponent  telephony_ctsy
       
  7104 @SYMTestCaseDesc Test support in CTSY for RPacketService::CompleteGetStaticCaps
       
  7105 @SYMTestPriority 
       
  7106 @SYMTestActions Invokes RPacketService::CompleteGetStaticCaps without KCapsMBMSSupported capability
       
  7107 @SYMTestExpectedResults Pass
       
  7108 @SYMTestType CT
       
  7109 */
       
  7110 void CCTsyPacketServiceFU::TestTsyMbmsSupportCaps0001bL()
       
  7111     {
       
  7112     OpenEtelServerL(EUseExtendedError);
       
  7113 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7114 	OpenPhoneL();
       
  7115 
       
  7116 	RBuf8 data;
       
  7117 	CleanupClosePushL(data);
       
  7118 	
       
  7119     RPacketService packetService;       
       
  7120     OpenPacketServiceL(packetService, RPacketService::EStatusUnattached, RPacketService::EAttachWhenNeeded);
       
  7121     CleanupClosePushL(packetService);
       
  7122   	TRequestStatus mockLtsyStatus;
       
  7123  	
       
  7124  	//-------------------------------------------------------------------------
       
  7125 	// TEST A: Successful completion request of
       
  7126 	// RPacketService::CompleteGetStaticCaps.
       
  7127  	//------------------------------------------------------------------------- 
       
  7128  			
       
  7129  	// data for ExpectL
       
  7130 	// Ensure RPacketService::GetStaticCaps returns caps KCapsMBMSSupported.			  	
       
  7131     TUint staticCaps = 0;
       
  7132    	TUint expectedCaps = 	RPacketService::KCapsSuspendSupported |
       
  7133 							RPacketService::KCapsNetworkAvailabilitySupported | 
       
  7134 							RPacketService::KCapsSetDefaultContextSupported | 
       
  7135 							RPacketService::KCapsChangeAttachModeSupported | 
       
  7136 							RPacketService::KCapsGetDataTransferredSupported | 
       
  7137 							RPacketService::KCapsPreferredBearerSupported | 
       
  7138 							RPacketService::KCapsPdpDataCompSupported | 
       
  7139 							RPacketService::KCapsPdpHeaderCompSupported | 
       
  7140 						    RPacketService::KCapsMSClassSupported |
       
  7141 							RPacketService::KCapsNotifyMSClassSupported;
       
  7142 
       
  7143 	TMockLtsyData1<TUint> ltsyData(expectedCaps);
       
  7144 	data.Close();
       
  7145 	ltsyData.SerialiseL(data);    
       
  7146 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  7147 	iMockLTSY.CompleteL( EPacketGetStaticCaps, KErrNone, data );
       
  7148 	User::WaitForRequest(mockLtsyStatus);	
       
  7149 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  7150 			
       
  7151 	TInt ret = packetService.GetStaticCaps(staticCaps, RPacketContext::EPdpTypeIPv4);
       
  7152 	ASSERT_EQUALS(KErrNone, ret);	 	
       
  7153 	ASSERT_EQUALS(staticCaps, expectedCaps);
       
  7154 		
       
  7155 	AssertMockLtsyStatusL();
       
  7156 	CleanupStack::PopAndDestroy( 3, this );  // packetService, data, this	
       
  7157     }
       
  7158         
       
  7159 /**
       
  7160 @SYMTestCaseID BA-CTSY-PKTS-PNMNSSC-0001
       
  7161 @SYMPREQ 1551
       
  7162 @SYMComponent  telephony_ctsy
       
  7163 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7164 @SYMTestPriority High
       
  7165 @SYMTestActions Invokes RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7166 @SYMTestExpectedResults Pass
       
  7167 @SYMTestType CT
       
  7168 */
       
  7169 void CCTsyPacketServiceFU::TestNotifyMbmsNetworkServiceStatusChange0001L()
       
  7170     {
       
  7171     OpenEtelServerL(EUseExtendedError);
       
  7172 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7173 	OpenPhoneL();
       
  7174 
       
  7175 	RBuf8 data;
       
  7176 	CleanupClosePushL(data);
       
  7177 	
       
  7178     RPacketService packetService;       
       
  7179     OpenPacketServiceL(packetService);
       
  7180     CleanupClosePushL(packetService);
       
  7181  
       
  7182  	TRequestStatus mockLtsyStatus;
       
  7183  	   	
       
  7184 	//-------------------------------------------------------------------------
       
  7185 	// TEST E: Unsolicited completion 
       
  7186 	// from LTSY.
       
  7187  	//-------------------------------------------------------------------------
       
  7188 
       
  7189 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7190 	TMbmsNetworkServiceStatus sndData0 = EMbmsSupported;
       
  7191 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData0(sndData0);
       
  7192 	ltsyData0.SerialiseL(data); 
       
  7193 	
       
  7194 	// Issue the Complete...	
       
  7195 	iMockLTSY.CompleteL(EPacketNotifyMbmsNetworkServiceStatusChange, KErrNone, data);
       
  7196 	User::WaitForRequest(mockLtsyStatus);	
       
  7197 	AssertMockLtsyStatusL();
       
  7198 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  7199 	
       
  7200  	//-------------------------------------------------------------------------
       
  7201 	// TEST C: Successful completion request of
       
  7202 	// RPacketService::NotifyMbmsNetworkServiceStatusChange when result is not cached.
       
  7203  	//-------------------------------------------------------------------------
       
  7204 
       
  7205 	TRequestStatus	requestStatus;
       
  7206 	TMbmsNetworkServiceStatus mbmsNetworkServiceStatus;
       
  7207 	
       
  7208 	// sent request
       
  7209 	packetService.NotifyMbmsNetworkServiceStatusChange(requestStatus, mbmsNetworkServiceStatus);
       
  7210 	
       
  7211 	// firstly issue notification  from  the MockLTSY 
       
  7212     // which has the same service status as is already saved
       
  7213    	TMbmsNetworkServiceStatus compData = EMbmsSupported;
       
  7214 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData(compData);
       
  7215 	data.Close();
       
  7216 	ltsyData.SerialiseL(data);    
       
  7217 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7218 	
       
  7219 	// Issue the Complete with the same service status state as is already saved
       
  7220 	iMockLTSY.CompleteL(EPacketNotifyMbmsNetworkServiceStatusChange, KErrNone, data);
       
  7221 	User::WaitForRequest(mockLtsyStatus);	
       
  7222 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	 
       
  7223 	
       
  7224 	// check that NotifyMbmsNetworkServiceStatusChange isn't completed
       
  7225 	ASSERT_EQUALS (KRequestPending, requestStatus.Int());
       
  7226 	
       
  7227 	//data for Complete with new service status
       
  7228 	TMbmsNetworkServiceStatus compData2 = EMbmsNotSupported;
       
  7229 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData2(compData2);
       
  7230 	data.Close();
       
  7231 	ltsyData2.SerialiseL(data);		
       
  7232 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7233 	// Issue the Complete with new service status
       
  7234 	iMockLTSY.CompleteL(EPacketNotifyMbmsNetworkServiceStatusChange, KErrNone, data);
       
  7235 	User::WaitForRequest(mockLtsyStatus);	
       
  7236 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  7237 	
       
  7238 	
       
  7239 	
       
  7240 	// wait for completion of NotifyMbmsNetworkServiceStatusChange
       
  7241 	User::WaitForRequest(requestStatus);	
       
  7242 	AssertMockLtsyStatusL();
       
  7243 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  7244 	ASSERT_EQUALS(EMbmsNotSupported, mbmsNetworkServiceStatus);
       
  7245  	//-------------------------------------------------------------------------
       
  7246 	// TEST D: RPacketService::NotifyMbmsNetworkServiceStatusChange again, this time CTSY
       
  7247 	// will get result from the cache.
       
  7248  	//-------------------------------------------------------------------------
       
  7249 
       
  7250 	// sent request
       
  7251 	packetService.NotifyMbmsNetworkServiceStatusChange(requestStatus, mbmsNetworkServiceStatus);
       
  7252 	
       
  7253 	//data for Complete with new service status
       
  7254 	TMbmsNetworkServiceStatus compData3 = EMbmsSupported;
       
  7255 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData3(compData3);
       
  7256 	data.Close();
       
  7257 	ltsyData3.SerialiseL(data);		
       
  7258 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7259 	
       
  7260 	// Issue the Complete with new service status
       
  7261 	iMockLTSY.CompleteL(EPacketNotifyMbmsNetworkServiceStatusChange, KErrNone, data);
       
  7262 	User::WaitForRequest(mockLtsyStatus);	
       
  7263 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  7264 	User::WaitForRequest(requestStatus);	
       
  7265 	AssertMockLtsyStatusL();
       
  7266 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  7267 	ASSERT_EQUALS(EMbmsSupported, mbmsNetworkServiceStatus);
       
  7268     		
       
  7269 	AssertMockLtsyStatusL();
       
  7270 	CleanupStack::PopAndDestroy( 3, this );  // packetService, data, this		
       
  7271     }
       
  7272 
       
  7273 /**
       
  7274 @SYMTestCaseID BA-CTSY-PKTS-PNMNSSC-0002
       
  7275 @SYMPREQ 1551
       
  7276 @SYMComponent  telephony_ctsy
       
  7277 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7278 @SYMTestPriority High
       
  7279 @SYMTestActions Invokes cancelling of RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7280 @SYMTestExpectedResults Pass
       
  7281 @SYMTestType CT
       
  7282 */
       
  7283 void CCTsyPacketServiceFU::TestNotifyMbmsNetworkServiceStatusChange0002L()
       
  7284     {
       
  7285     OpenEtelServerL(EUseExtendedError);
       
  7286 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7287 	OpenPhoneL();
       
  7288 	
       
  7289     RPacketService packetService;       
       
  7290     OpenPacketServiceL(packetService);
       
  7291     CleanupClosePushL(packetService);
       
  7292  
       
  7293  	//-------------------------------------------------------------------------
       
  7294 	// Test cancelling of RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7295  	//-------------------------------------------------------------------------
       
  7296 
       
  7297  	TRequestStatus requestStatus;
       
  7298 	TMbmsNetworkServiceStatus regStatus;	
       
  7299 	
       
  7300 	packetService.NotifyMbmsNetworkServiceStatusChange(requestStatus, regStatus);
       
  7301     packetService.CancelAsyncRequest(EPacketNotifyMbmsNetworkServiceStatusChange); 	
       
  7302 
       
  7303 	User::WaitForRequest(requestStatus);	
       
  7304 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  7305 
       
  7306 	AssertMockLtsyStatusL();	
       
  7307 	CleanupStack::PopAndDestroy(2);// packetServicethis, data
       
  7308 		
       
  7309     }
       
  7310 
       
  7311 /**
       
  7312 @SYMTestCaseID BA-CTSY-PKTS-PNMNSSC-0004
       
  7313 @SYMPREQ 1551
       
  7314 @SYMComponent  telephony_ctsy
       
  7315 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7316 @SYMTestPriority High
       
  7317 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyMbmsNetworkServiceStatusChange
       
  7318 @SYMTestExpectedResults Pass
       
  7319 @SYMTestType CT
       
  7320 */
       
  7321 void CCTsyPacketServiceFU::TestNotifyMbmsNetworkServiceStatusChange0003L()
       
  7322     {
       
  7323     OpenEtelServerL(EUseExtendedError);
       
  7324 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7325 	OpenPhoneL();
       
  7326 
       
  7327 	RBuf8 data;
       
  7328 	CleanupClosePushL(data);
       
  7329 	
       
  7330 	// Open second client
       
  7331 	RTelServer telServer2;
       
  7332 	TInt ret = telServer2.Connect();
       
  7333 	ASSERT_EQUALS(KErrNone, ret);
       
  7334 	CleanupClosePushL(telServer2);
       
  7335 
       
  7336 	RMobilePhone phone2;
       
  7337 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  7338 	ASSERT_EQUALS(KErrNone, ret);
       
  7339 	CleanupClosePushL(phone2);
       
  7340 	
       
  7341 	RPacketService packetService;
       
  7342 	OpenPacketServiceL(packetService);
       
  7343 	CleanupClosePushL(packetService);
       
  7344 
       
  7345 	RPacketService packetService2;                
       
  7346 	ret = packetService2.Open(phone2);
       
  7347 	ASSERT_EQUALS(KErrNone, ret);
       
  7348 	CleanupClosePushL(packetService2); 
       
  7349 	
       
  7350 	//-------------------------------------------------------------------------
       
  7351 	// Test A: Test multiple clients requesting RPacketService::NotifyChangeOfNtwkRegStatus
       
  7352  	//-------------------------------------------------------------------------
       
  7353 	
       
  7354 	TMbmsNetworkServiceStatus sndData = EMbmsNotSupported;
       
  7355 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData(sndData);
       
  7356 	ltsyData.SerialiseL(data); 	 	
       
  7357  		
       
  7358 	TRequestStatus requestStatus;
       
  7359 	TMbmsNetworkServiceStatus regStatus;	
       
  7360 	
       
  7361 	TRequestStatus requestStatus2;
       
  7362 	TMbmsNetworkServiceStatus regStatus2;	
       
  7363 	
       
  7364 	// Post first request	
       
  7365 	packetService.NotifyMbmsNetworkServiceStatusChange(requestStatus, regStatus);
       
  7366 		
       
  7367 	// Post second request	
       
  7368 	packetService2.NotifyMbmsNetworkServiceStatusChange(requestStatus2, regStatus2);
       
  7369 				
       
  7370 	// Issue the Complete...	
       
  7371  	iMockLTSY.CompleteL(EPacketNotifyMbmsNetworkServiceStatusChange, KErrNone, data);
       
  7372 	
       
  7373 	// wait for first
       
  7374 	User::WaitForRequest(requestStatus);	
       
  7375 	AssertMockLtsyStatusL();
       
  7376 	ASSERT_EQUALS(KErrNone, requestStatus.Int());	
       
  7377 	ASSERT_EQUALS(sndData, regStatus);
       
  7378 	
       
  7379 	// wait for second
       
  7380 	User::WaitForRequest(requestStatus2);	
       
  7381 	AssertMockLtsyStatusL();
       
  7382 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());	
       
  7383 	ASSERT_EQUALS(sndData, regStatus2);	
       
  7384 
       
  7385 	CleanupStack::PopAndDestroy(2); // packetService, packetService2
       
  7386 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  7387 	
       
  7388     }
       
  7389 
       
  7390 /**
       
  7391 @SYMTestCaseID BA-CTSY-PKTS-PGMNSSC-0001
       
  7392 @SYMPREQ 1551
       
  7393 @SYMComponent  telephony_ctsy
       
  7394 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetMbmsNetworkServiceStatus
       
  7395 @SYMTestPriority High
       
  7396 @SYMTestActions Invokes RPacketService::GetMbmsNetworkServiceStatus
       
  7397 @SYMTestExpectedResults Pass
       
  7398 @SYMTestType CT
       
  7399 */
       
  7400 void CCTsyPacketServiceFU::TestGetMbmsNetworkServiceStatus0001L()
       
  7401     {
       
  7402     OpenEtelServerL(EUseExtendedError);
       
  7403 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7404 	OpenPhoneL();
       
  7405 
       
  7406 	RBuf8 data;
       
  7407 	CleanupClosePushL(data);
       
  7408 
       
  7409     RPacketService packetService;       
       
  7410     OpenPacketServiceL(packetService);
       
  7411     CleanupClosePushL(packetService);
       
  7412     
       
  7413     //-------------------------------------------------------------------------
       
  7414 	// TEST A: failure to dispatch request to LTSY
       
  7415  	//-------------------------------------------------------------------------
       
  7416 
       
  7417 	// Post request
       
  7418     TRequestStatus requestStatus;
       
  7419     TMbmsNetworkServiceStatus mbmsNetworkServiceStatus;
       
  7420 	
       
  7421 	// Queue response
       
  7422     TBool expData = ETrue;
       
  7423 	TMockLtsyData1<TBool> ltsyData(expData);
       
  7424 	data.Close();
       
  7425 	ltsyData.SerialiseL(data);
       
  7426 	iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus, data,  KErrNotSupported);
       
  7427 
       
  7428 	packetService.GetMbmsNetworkServiceStatus(requestStatus, ETrue, mbmsNetworkServiceStatus);
       
  7429 	User::WaitForRequest(requestStatus);
       
  7430 	AssertMockLtsyStatusL();
       
  7431 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  7432 
       
  7433 	//-------------------------------------------------------------------------
       
  7434 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  7435  	//-------------------------------------------------------------------------
       
  7436 	data.Close();
       
  7437 	ltsyData.SerialiseL(data);
       
  7438 	iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus, data,  KErrNone);
       
  7439 
       
  7440 	packetService.GetMbmsNetworkServiceStatus(requestStatus, ETrue, mbmsNetworkServiceStatus);
       
  7441 
       
  7442 	iMockLTSY.CompleteL(EPacketGetMbmsNetworkServiceStatus, KErrGeneral);
       
  7443 	
       
  7444 	User::WaitForRequest(requestStatus);
       
  7445 	AssertMockLtsyStatusL();
       
  7446 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  7447 	
       
  7448  	//-------------------------------------------------------------------------
       
  7449 	// TEST C: Successful completion request of
       
  7450 	// RPacketService::GetMbmsNetworkServiceStatus --> EMbmsSupported.
       
  7451  	//-------------------------------------------------------------------------	
       
  7452 
       
  7453     // data for ExpectL
       
  7454 	data.Close();
       
  7455 	ltsyData.SerialiseL(data);
       
  7456 	iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus, data,  KErrNone);
       
  7457 
       
  7458 	packetService.GetMbmsNetworkServiceStatus(requestStatus, ETrue, mbmsNetworkServiceStatus);
       
  7459 
       
  7460 	// data for CompleteL
       
  7461 	TMbmsNetworkServiceStatus completeMbmsNetworkServiceStatus = EMbmsSupported;
       
  7462 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyCompData(completeMbmsNetworkServiceStatus);
       
  7463 	data.Close();
       
  7464 	ltsyCompData.SerialiseL(data);
       
  7465 	iMockLTSY.CompleteL(EPacketGetMbmsNetworkServiceStatus, KErrNone, data);
       
  7466 
       
  7467 	
       
  7468     User::WaitForRequest(requestStatus);
       
  7469 	AssertMockLtsyStatusL();
       
  7470 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );   
       
  7471 	ASSERT_EQUALS(completeMbmsNetworkServiceStatus, mbmsNetworkServiceStatus);
       
  7472 		
       
  7473 	//-------------------------------------------------------------------------
       
  7474 	// TEST D: Successful completion request of
       
  7475 	// RPacketService::GetMbmsNetworkServiceStatus --> read value from CTSY cache.
       
  7476  	//-------------------------------------------------------------------------	
       
  7477  	
       
  7478 	packetService.GetMbmsNetworkServiceStatus(requestStatus, ETrue, mbmsNetworkServiceStatus);
       
  7479     User::WaitForRequest(requestStatus);
       
  7480 	AssertMockLtsyStatusL();
       
  7481 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );   
       
  7482 	ASSERT_EQUALS(completeMbmsNetworkServiceStatus, mbmsNetworkServiceStatus);
       
  7483 	
       
  7484 	//-------------------------------------------------------------------------
       
  7485 	// TEST E: changing the cache with notifiyer
       
  7486 	// RPacketService::GetMbmsNetworkServiceStatus --> read value from CTSY cache.
       
  7487  	//-------------------------------------------------------------------------	
       
  7488 	completeMbmsNetworkServiceStatus = EMbmsNotSupported;
       
  7489 	data.Close();
       
  7490 	TRequestStatus mockLtsyStatus;
       
  7491 	ltsyCompData.SerialiseL(data);
       
  7492 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  7493 	iMockLTSY.CompleteL(EPacketNotifyMbmsNetworkServiceStatusChange, KErrNone, data);
       
  7494 	User::WaitForRequest(mockLtsyStatus); 	
       
  7495 
       
  7496 	packetService.GetMbmsNetworkServiceStatus(requestStatus, ETrue, mbmsNetworkServiceStatus);
       
  7497     User::WaitForRequest(requestStatus);
       
  7498 	AssertMockLtsyStatusL();
       
  7499 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );   
       
  7500 	ASSERT_EQUALS(completeMbmsNetworkServiceStatus, mbmsNetworkServiceStatus);
       
  7501 	
       
  7502 	//-------------------------------------------------------------------------
       
  7503 	// TEST F: changing the cache with getter
       
  7504 	// RPacketService::GetMbmsNetworkServiceStatus --> read value from CTSY cache.
       
  7505  	//-------------------------------------------------------------------------	
       
  7506 	completeMbmsNetworkServiceStatus = EMbmsSupported;
       
  7507 	data.Close();
       
  7508 	ltsyCompData.SerialiseL(data);
       
  7509 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  7510 	iMockLTSY.CompleteL(EPacketGetMbmsNetworkServiceStatus, KErrNone, data);
       
  7511 	User::WaitForRequest(mockLtsyStatus); 	
       
  7512 
       
  7513 	packetService.GetMbmsNetworkServiceStatus(requestStatus, ETrue, mbmsNetworkServiceStatus);
       
  7514     User::WaitForRequest(requestStatus);
       
  7515 	AssertMockLtsyStatusL();
       
  7516 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );   
       
  7517 	ASSERT_EQUALS(completeMbmsNetworkServiceStatus, mbmsNetworkServiceStatus);
       
  7518 	
       
  7519  	AssertMockLtsyStatusL();
       
  7520 	CleanupStack::PopAndDestroy( 3, this );  //  packetService, data, this	
       
  7521     }
       
  7522 
       
  7523 /**
       
  7524 @SYMTestCaseID BA-CTSY-PKTS-PGMNSSC-0001b
       
  7525 @SYMPREQ 1551
       
  7526 @SYMComponent  telephony_ctsy
       
  7527 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetMbmsNetworkServiceStatus
       
  7528 @SYMTestPriority High
       
  7529 @SYMTestActions Invokes RPacketService::GetMbmsNetworkServiceStatus with status EMbmsNotSupported
       
  7530 @SYMTestExpectedResults Pass
       
  7531 @SYMTestType CT
       
  7532 */
       
  7533 
       
  7534 void CCTsyPacketServiceFU::TestGetMbmsNetworkServiceStatus0001bL()
       
  7535     {
       
  7536     OpenEtelServerL(EUseExtendedError);
       
  7537 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7538 	OpenPhoneL();
       
  7539 
       
  7540 	RBuf8 data;
       
  7541 	CleanupClosePushL(data);
       
  7542 
       
  7543 	RBuf8 data2;
       
  7544 	CleanupClosePushL(data2);
       
  7545 	
       
  7546     RPacketService packetService;       
       
  7547     OpenPacketServiceL(packetService);
       
  7548     CleanupClosePushL(packetService);
       
  7549     
       
  7550     //-------------------------------------------------------------------------
       
  7551 	// TEST C: Successful completion request of
       
  7552 	// RPacketService::GetMbmsNetworkServiceStatus --> EMbmsNotSupported.
       
  7553  	//-------------------------------------------------------------------------	
       
  7554  	
       
  7555  	// Post request
       
  7556     TRequestStatus requestStatus;
       
  7557     TBool aAttemptAttach = ETrue;
       
  7558    	TMbmsNetworkServiceStatus regStatus;
       
  7559    	
       
  7560      // data for ExpectL
       
  7561     TMbmsNetworkServiceStatus regStatusComplete = EMbmsNotSupported;
       
  7562     TMockLtsyData1<TBool> ltsyData(aAttemptAttach);
       
  7563 	ltsyData.SerialiseL(data);
       
  7564 	iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus,data);     
       
  7565 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData2(regStatusComplete);
       
  7566 	ltsyData2.SerialiseL(data2);
       
  7567     // data for CompleteL
       
  7568 	iMockLTSY.CompleteL(EPacketGetMbmsNetworkServiceStatus, KErrNone, data2);
       
  7569 	regStatus = TMbmsNetworkServiceStatus(2);
       
  7570 	
       
  7571 	packetService.GetMbmsNetworkServiceStatus(requestStatus, aAttemptAttach, regStatus);
       
  7572     User::WaitForRequest(requestStatus);
       
  7573 	AssertMockLtsyStatusL();
       
  7574 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );   
       
  7575 	ASSERT_TRUE(regStatusComplete == regStatus);
       
  7576 	
       
  7577 	//-------------------------------------------------------------------------
       
  7578 	// TEST D: Successful completion request of
       
  7579 	// RPacketService::GetMbmsNetworkServiceStatus --> read value from CTSY cache.
       
  7580  	//-------------------------------------------------------------------------	
       
  7581  	
       
  7582   	// data for ExpectL
       
  7583   	aAttemptAttach = EFalse;	
       
  7584     TMbmsNetworkServiceStatus aMBMSServiceStatus = EMbmsNotSupported;  
       
  7585     TMockLtsyData1<TBool> ltsyDataa(aAttemptAttach);
       
  7586 	ltsyDataa.SerialiseL(data); 
       
  7587 
       
  7588 	regStatus = TMbmsNetworkServiceStatus(2);
       
  7589 		
       
  7590 	packetService.GetMbmsNetworkServiceStatus(requestStatus, aAttemptAttach, regStatus);
       
  7591     User::WaitForRequest(requestStatus);
       
  7592 	ASSERT_EQUALS( KErrNone, requestStatus.Int() ); 
       
  7593 	ASSERT_TRUE(aMBMSServiceStatus == regStatus);
       
  7594 	
       
  7595     AssertMockLtsyStatusL();
       
  7596 	CleanupStack::PopAndDestroy( 4, this );  // packetService, data2, data, this	
       
  7597     }
       
  7598 
       
  7599 /**
       
  7600 @SYMTestCaseID BA-CTSY-PKTS-PGMNSSC-0001c
       
  7601 @SYMPREQ 1551
       
  7602 @SYMComponent  telephony_ctsy
       
  7603 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetMbmsNetworkServiceStatus
       
  7604 @SYMTestPriority High
       
  7605 @SYMTestActions Invokes RPacketService::GetMbmsNetworkServiceStatus with status EMbmsSupportUnknown
       
  7606 @SYMTestExpectedResults Pass
       
  7607 @SYMTestType CT
       
  7608 */
       
  7609 
       
  7610 void CCTsyPacketServiceFU::TestGetMbmsNetworkServiceStatus0001cL()
       
  7611     {
       
  7612     OpenEtelServerL(EUseExtendedError);
       
  7613 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7614 	OpenPhoneL();
       
  7615 
       
  7616 	RBuf8 data;
       
  7617 	CleanupClosePushL(data);
       
  7618 
       
  7619 	RBuf8 data2;
       
  7620 	CleanupClosePushL(data2);
       
  7621 	
       
  7622     RPacketService packetService;       
       
  7623     OpenPacketServiceL(packetService);
       
  7624     CleanupClosePushL(packetService);
       
  7625     
       
  7626     //-------------------------------------------------------------------------
       
  7627 	// TEST C: Successful completion request of
       
  7628 	// RPacketService::GetMbmsNetworkServiceStatus --> EMbmsNotSupported.
       
  7629  	//-------------------------------------------------------------------------	
       
  7630  	
       
  7631  	// Post request
       
  7632     TRequestStatus requestStatus;
       
  7633     TBool aAttemptAttach = ETrue;
       
  7634     TMbmsNetworkServiceStatus regStatus;
       
  7635    	
       
  7636      // data for ExpectL
       
  7637     TMbmsNetworkServiceStatus regStatusComplete = EMbmsSupportUnknown;
       
  7638     TMockLtsyData1<TBool> ltsyData(aAttemptAttach);
       
  7639 	ltsyData.SerialiseL(data);
       
  7640 	iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus,data);     
       
  7641 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData2(regStatusComplete);
       
  7642 	ltsyData2.SerialiseL(data2);
       
  7643     // data for CompleteL
       
  7644 	iMockLTSY.CompleteL(EPacketGetMbmsNetworkServiceStatus, KErrNone, data2);
       
  7645 	regStatus = TMbmsNetworkServiceStatus(0);
       
  7646 	
       
  7647 	packetService.GetMbmsNetworkServiceStatus(requestStatus, aAttemptAttach, regStatus);
       
  7648     User::WaitForRequest(requestStatus);
       
  7649 	AssertMockLtsyStatusL();
       
  7650 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );   
       
  7651 	ASSERT_TRUE(regStatusComplete == regStatus);
       
  7652 	
       
  7653 	//-------------------------------------------------------------------------
       
  7654 	// TEST D: Successful completion request of
       
  7655 	// RPacketService::GetMbmsNetworkServiceStatus --> read value from CTSY cache.
       
  7656  	//-------------------------------------------------------------------------	
       
  7657  	
       
  7658  	 aAttemptAttach = EFalse;	
       
  7659     // data for ExpectL
       
  7660     TMbmsNetworkServiceStatus aMBMSServiceStatus = EMbmsSupportUnknown;  
       
  7661     TMockLtsyData1<TBool> ltsyDataa(aAttemptAttach);
       
  7662 	ltsyDataa.SerialiseL(data); 
       
  7663 
       
  7664 	regStatus = TMbmsNetworkServiceStatus(0);
       
  7665 		
       
  7666 	packetService.GetMbmsNetworkServiceStatus(requestStatus, aAttemptAttach, regStatus);
       
  7667     User::WaitForRequest(requestStatus);
       
  7668 	ASSERT_EQUALS( KErrNone, requestStatus.Int() ); 
       
  7669 	ASSERT_TRUE(aMBMSServiceStatus == regStatus);
       
  7670 	
       
  7671     AssertMockLtsyStatusL();
       
  7672 	CleanupStack::PopAndDestroy( 4, this );  // packetService, data2, data, this	
       
  7673     }
       
  7674     	
       
  7675 /**
       
  7676 @SYMTestCaseID BA-CTSY-PKTS-PGMNSSC-0002
       
  7677 @SYMPREQ 1551
       
  7678 @SYMComponent  telephony_ctsy
       
  7679 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::GetMbmsNetworkServiceStatus
       
  7680 @SYMTestPriority High
       
  7681 @SYMTestActions Invokes cancelling of RPacketService::GetMbmsNetworkServiceStatus
       
  7682 @SYMTestExpectedResults Pass
       
  7683 @SYMTestType CT
       
  7684 */
       
  7685 void CCTsyPacketServiceFU::TestGetMbmsNetworkServiceStatus0002L()
       
  7686     {
       
  7687     OpenEtelServerL(EUseExtendedError);
       
  7688     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7689     OpenPhoneL();
       
  7690 
       
  7691     RBuf8 data;
       
  7692     CleanupClosePushL(data);
       
  7693 
       
  7694     RPacketService packetService;       
       
  7695     OpenPacketServiceL(packetService);
       
  7696     CleanupClosePushL(packetService);
       
  7697     	
       
  7698     //-------------------------------------------------------------------------
       
  7699     // Test cancelling of RPacketService::GetMbmsNetworkServiceStatus
       
  7700     //-------------------------------------------------------------------------
       
  7701      	
       
  7702     // data for ExpectL
       
  7703     TBool attemptAttach = ETrue;
       
  7704     TMbmsNetworkServiceStatus regStatusComplete = EMbmsSupported;
       
  7705     TMockLtsyData1<TBool> ltsyData(attemptAttach);
       
  7706     data.Close();
       
  7707     ltsyData.SerialiseL(data);
       
  7708     iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus, data); 
       
  7709     	    
       
  7710     // Post request
       
  7711     TRequestStatus requestStatus;
       
  7712 	packetService.GetMbmsNetworkServiceStatus(requestStatus, attemptAttach, regStatusComplete);
       
  7713     packetService.CancelAsyncRequest(EPacketGetMbmsNetworkServiceStatus);
       
  7714 	
       
  7715 	User::WaitForRequest(requestStatus);
       
  7716 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  7717 	AssertMockLtsyStatusL();		
       
  7718 	
       
  7719 	CleanupStack::PopAndDestroy( 3, this );  // packetService, data, this	
       
  7720     }
       
  7721 
       
  7722 /**
       
  7723 @SYMTestCaseID BA-CTSY-PKTS-PGMNSSC-0003
       
  7724 @SYMPREQ 1551
       
  7725 @SYMComponent  telephony_ctsy
       
  7726 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::GetMbmsNetworkServiceStatus
       
  7727 @SYMTestPriority High
       
  7728 @SYMTestActions Invokes multiple client requests to RPacketService::GetMbmsNetworkServiceStatus
       
  7729 @SYMTestExpectedResults Pass
       
  7730 @SYMTestType CT
       
  7731 */
       
  7732 void CCTsyPacketServiceFU::TestGetMbmsNetworkServiceStatus0003L()
       
  7733     {
       
  7734 	OpenEtelServerL(EUseExtendedError);
       
  7735 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7736 	OpenPhoneL();
       
  7737 
       
  7738 	RBuf8 data;
       
  7739 	CleanupClosePushL(data);
       
  7740 	
       
  7741 	RBuf8 data2;
       
  7742 	CleanupClosePushL(data2);
       
  7743 	
       
  7744 	// Open second client
       
  7745 	RTelServer telServer2;
       
  7746 	TInt ret = telServer2.Connect();
       
  7747 	ASSERT_EQUALS(KErrNone, ret);
       
  7748 	CleanupClosePushL(telServer2);
       
  7749 
       
  7750 	RMobilePhone phone2;
       
  7751 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  7752 	ASSERT_EQUALS(KErrNone, ret);
       
  7753 	CleanupClosePushL(phone2);
       
  7754 
       
  7755     RPacketService packetService;
       
  7756     OpenPacketServiceL(packetService);
       
  7757     CleanupClosePushL(packetService);
       
  7758 
       
  7759     RPacketService packetService2;                
       
  7760     ret = packetService2.Open(phone2);
       
  7761     ASSERT_EQUALS(KErrNone, ret); 
       
  7762     CleanupClosePushL(packetService2);   
       
  7763     
       
  7764     //-------------------------------------------------------------------------
       
  7765 	// Test A: Test multiple clients requesting RPacketService::GetMbmsNetworkServiceStatus
       
  7766 	// iMbmsStatuscached = FALSE
       
  7767  	//-------------------------------------------------------------------------
       
  7768     
       
  7769     // data for ExpectL    	
       
  7770     TBool aAttemptAttach = ETrue;
       
  7771 	TMockLtsyData1<TBool> ltsyData2(aAttemptAttach);
       
  7772 	ltsyData2.SerialiseL(data2);
       
  7773     
       
  7774 	// first client
       
  7775 	TMbmsNetworkServiceStatus regStatus1 = EMbmsSupported;
       
  7776 	iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus, data2);     
       
  7777 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData(regStatus1);
       
  7778 	ltsyData.SerialiseL(data);
       
  7779 	
       
  7780     // data for CompleteL
       
  7781 	iMockLTSY.CompleteL(EPacketGetMbmsNetworkServiceStatus, KErrNone, data);	
       
  7782 	
       
  7783 	// send first request
       
  7784 	TRequestStatus requestStatus1;
       
  7785   	packetService.GetMbmsNetworkServiceStatus(requestStatus1, aAttemptAttach, regStatus1);
       
  7786    	
       
  7787 	// send second request
       
  7788 	TRequestStatus requestStatus2;
       
  7789     TMbmsNetworkServiceStatus regStatus2 = EMbmsNotSupported;
       
  7790    	packetService2.GetMbmsNetworkServiceStatus(requestStatus2, aAttemptAttach, regStatus2);
       
  7791 
       
  7792 	//wait for first answer
       
  7793 	User::WaitForRequest(requestStatus1);
       
  7794 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  7795 
       
  7796 	//wait for second answer
       
  7797 	User::WaitForRequest(requestStatus2);
       
  7798 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  7799 
       
  7800     //-------------------------------------------------------------------------
       
  7801 	// Test A: Test multiple clients requesting RPacketService::GetMbmsNetworkServiceStatus
       
  7802 	// iMbmsStatuscached = TRUE
       
  7803  	//-------------------------------------------------------------------------
       
  7804  	
       
  7805  	// data for ExpectL    	
       
  7806     aAttemptAttach = EFalse;
       
  7807 	TMockLtsyData1<TBool> ltsyData3(aAttemptAttach);
       
  7808 	ltsyData3.SerialiseL(data2);
       
  7809     
       
  7810 	// first client
       
  7811 	regStatus1 = EMbmsSupported;    
       
  7812 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyDataa(regStatus1);
       
  7813 	ltsyDataa.SerialiseL(data);	
       
  7814 	
       
  7815 	// send first request
       
  7816   	packetService.GetMbmsNetworkServiceStatus(requestStatus1, aAttemptAttach, regStatus1);
       
  7817    	
       
  7818 	// send second request
       
  7819     regStatus2 = EMbmsNotSupported;
       
  7820    	packetService2.GetMbmsNetworkServiceStatus(requestStatus2, aAttemptAttach, regStatus2);
       
  7821 
       
  7822 	//wait for first answer
       
  7823 	User::WaitForRequest(requestStatus1);
       
  7824 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  7825 
       
  7826 	//wait for second answer
       
  7827 	User::WaitForRequest(requestStatus2);
       
  7828 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  7829 	
       
  7830 	AssertMockLtsyStatusL();
       
  7831 	CleanupStack::PopAndDestroy(2); // packetService packetService2
       
  7832 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, data2, data, this
       
  7833     }
       
  7834 
       
  7835 /**
       
  7836 @SYMTestCaseID BA-CTSY-PKTS-PGMNSSC-0005
       
  7837 @SYMPREQ 1551
       
  7838 @SYMComponent  telephony_ctsy
       
  7839 @SYMTestCaseDesc Test support in CTSY for RPacketService::GetMbmsNetworkServiceStatus with timeout
       
  7840 @SYMTestPriority High
       
  7841 @SYMTestActions Invokes RPacketService::GetMbmsNetworkServiceStatus and tests for timeout
       
  7842 @SYMTestExpectedResults Pass
       
  7843 @SYMTestType CT
       
  7844 */
       
  7845 void CCTsyPacketServiceFU::TestGetMbmsNetworkServiceStatus0005L()
       
  7846     {
       
  7847     OpenEtelServerL(EUseExtendedError);
       
  7848 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7849 	OpenPhoneL();
       
  7850 
       
  7851 	RBuf8 data;
       
  7852 	CleanupClosePushL(data);
       
  7853 
       
  7854 	RBuf8 data2;
       
  7855 	CleanupClosePushL(data2);
       
  7856 	
       
  7857     RPacketService packetService;       
       
  7858     OpenPacketServiceL(packetService);
       
  7859     CleanupClosePushL(packetService);
       
  7860     	
       
  7861     	
       
  7862 	//-------------------------------------------------------------------------
       
  7863 	// Test A: Test timeout of RPacketService::GetMbmsNetworkServiceStatus
       
  7864  	//-------------------------------------------------------------------------
       
  7865 
       
  7866 	// Post request
       
  7867 	TMbmsNetworkServiceStatus regStatus = EMbmsSupported;
       
  7868 	TRequestStatus requestStatus;
       
  7869     TBool aAttemptAttach = ETrue;
       
  7870     
       
  7871 	// data for ExpectL   
       
  7872 	TMockLtsyData1<TBool> ltsyData2(aAttemptAttach);
       
  7873 	ltsyData2.SerialiseL(data2);
       
  7874     iMockLTSY.ExpectL(EPacketGetMbmsNetworkServiceStatus, data2); 
       
  7875      
       
  7876 	TMockLtsyData1<TMbmsNetworkServiceStatus> ltsyData(regStatus);
       
  7877 	ltsyData.SerialiseL(data);	
       
  7878 
       
  7879 	packetService.GetMbmsNetworkServiceStatus(requestStatus,aAttemptAttach, regStatus);
       
  7880 	User::WaitForRequest(requestStatus);
       
  7881 	AssertMockLtsyStatusL();
       
  7882 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  7883 	
       
  7884 	CleanupStack::PopAndDestroy(4, this); // packetService, data2, data, this
       
  7885 
       
  7886     }
       
  7887 
       
  7888 /**
       
  7889 @SYMTestCaseID BA-CTSY-PKTS-PNMSASC-0001
       
  7890 @SYMPREQ 1551
       
  7891 @SYMComponent  telephony_ctsy
       
  7892 @SYMTestCaseDesc Test support in CTSY for RPacketService::NotifyMbmsServiceAvailabilityChange
       
  7893 @SYMTestPriority High
       
  7894 @SYMTestActions Invokes RPacketService::NotifyMbmsServiceAvailabilityChange
       
  7895 @SYMTestExpectedResults Pass
       
  7896 @SYMTestType CT
       
  7897 */
       
  7898 void CCTsyPacketServiceFU::TestNotifyMbmsServiceAvailabilityChange0001L()
       
  7899     {
       
  7900     OpenEtelServerL( EUseExtendedError );
       
  7901 	CleanupStack::PushL(TCleanupItem( Cleanup,this ) );
       
  7902 	OpenPhoneL();
       
  7903 
       
  7904 	RBuf8 data;
       
  7905 	CleanupClosePushL( data );
       
  7906 
       
  7907 	RPacketService packetService;		
       
  7908 	// Open PacketService
       
  7909 	OpenPacketServiceL( packetService );
       
  7910 	CleanupClosePushL( packetService ); 
       
  7911 	
       
  7912 	TRequestStatus requestStatus;
       
  7913 	TRequestStatus mockLtsyStatus;
       
  7914  
       
  7915 	TInt maxValue = 10;
       
  7916  
       
  7917  	// set maximum monitored service value during TSY startup.
       
  7918  	TMockLtsyData1<TInt> ltsyData(maxValue);
       
  7919  	data.Close();
       
  7920 	ltsyData.SerialiseL(data);
       
  7921  	// data for CompleteL
       
  7922  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  7923 	iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data);
       
  7924 	User::WaitForRequest(mockLtsyStatus);	
       
  7925 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  7926 
       
  7927   	//-------------------------------------------------------------------------
       
  7928 	// TEST A: failure to dispatch request to LTSY
       
  7929  	//-------------------------------------------------------------------------
       
  7930 
       
  7931 	// Issue the Complete...
       
  7932     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7933    	iMockLTSY.CompleteL(EPacketNotifyMbmsServiceAvailabilityChange, KErrNone);
       
  7934    		
       
  7935 	User::WaitForRequest(mockLtsyStatus);	
       
  7936 	AssertMockLtsyStatusL();
       
  7937 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  7938 	
       
  7939   	//-------------------------------------------------------------------------
       
  7940 	// TEST B: Test Notify after update
       
  7941  	//-------------------------------------------------------------------------
       
  7942 	
       
  7943     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  7944 	CleanupStack::PushL(multipleEntries);
       
  7945 	RPacketService::TMbmsServiceAvailabilityV1 entry1, entry2;
       
  7946 	
       
  7947 	for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  7948 		{
       
  7949 		entry1.iTmgi.SetServiceId(i); 
       
  7950 		entry1.iTmgi.SetMCC(i);
       
  7951 		entry1.iTmgi.SetMNC(i);
       
  7952 		entry1.iMbmsServiceMode = KBroadcast;
       
  7953 		entry1.iMbmsAccessBearer = E2GBearer;
       
  7954 		entry1.iMbmsAvailabilityStatus = EMbmsUnavailable;
       
  7955 		multipleEntries->AddEntryL( entry1 );
       
  7956 		}
       
  7957 	
       
  7958 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  7959 	CleanupStack::PushL(zeroEntry);
       
  7960 
       
  7961 	TMmMbmsMonitorServiceListParams expData;
       
  7962 	expData.iActionType = EAddEntries;
       
  7963 	expData.iServiceList = zeroEntry; // existing list
       
  7964 	expData.iListOfChanges = multipleEntries; // list to add
       
  7965     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  7966     data.Close();
       
  7967     expExpect1.SerialiseL(data);
       
  7968 
       
  7969     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  7970 
       
  7971     // post notifiyer
       
  7972 	packetService.NotifyMbmsServiceAvailabilityChange(requestStatus);
       
  7973 	TRequestStatus reqStatus;
       
  7974 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries);	
       
  7975 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  7976 	User::WaitForRequest(reqStatus);
       
  7977 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  7978 	
       
  7979 	//wait for notifiyer
       
  7980 	User::WaitForRequest(requestStatus);
       
  7981 	ASSERT_EQUALS( KErrNone, requestStatus.Int() );
       
  7982 	
       
  7983 			
       
  7984  	//-------------------------------------------------------------------------
       
  7985 	// TEST C: Successful completion request of
       
  7986 	// RPacketService::NotifyMbmsServiceAvailabilityChange.
       
  7987  	//-------------------------------------------------------------------------
       
  7988   
       
  7989 	// post a request
       
  7990 	packetService.NotifyMbmsServiceAvailabilityChange(requestStatus);
       
  7991 	
       
  7992     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7993    	iMockLTSY.CompleteL(EPacketNotifyMbmsServiceAvailabilityChange, KErrNone);
       
  7994 	User::WaitForRequest(mockLtsyStatus);
       
  7995 	AssertMockLtsyStatusL();		
       
  7996 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	 
       
  7997 	
       
  7998 	// wait for completion of NotifyMbmsServiceAvailabilityChange
       
  7999 	User::WaitForRequest(requestStatus);	
       
  8000 	AssertMockLtsyStatusL();
       
  8001 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  8002 	
       
  8003  	//-------------------------------------------------------------------------
       
  8004 	// TEST C: Successful completion request of
       
  8005 	// RPacketService::NotifyMbmsServiceAvailabilityChange with one available entries.
       
  8006  	//-------------------------------------------------------------------------
       
  8007     CPcktMbmsMonitoredServiceList* availEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  8008 	CleanupStack::PushL(availEntries);
       
  8009 	availEntries->AddEntryL(multipleEntries->GetEntryL(1));
       
  8010     TMockLtsyData1<CPcktMbmsMonitoredServiceList*> expExpect2(availEntries);
       
  8011     data.Close();
       
  8012     expExpect2.SerialiseL(data);
       
  8013 
       
  8014 	// post a request
       
  8015 	packetService.NotifyMbmsServiceAvailabilityChange(requestStatus);
       
  8016 	
       
  8017     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  8018    	iMockLTSY.CompleteL(EPacketNotifyMbmsServiceAvailabilityChange, KErrNone, data);
       
  8019 	User::WaitForRequest(mockLtsyStatus);
       
  8020 	AssertMockLtsyStatusL();		
       
  8021 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	 
       
  8022 	
       
  8023 	// wait for completion of NotifyMbmsServiceAvailabilityChange
       
  8024 	User::WaitForRequest(requestStatus);	
       
  8025 	AssertMockLtsyStatusL();
       
  8026 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  8027     
       
  8028 	//Check that the avaiability is correct
       
  8029   	CFilteringActiveScheduler scheduler;
       
  8030 	CActiveScheduler::Install(&scheduler);
       
  8031 	CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService);	 
       
  8032 	CleanupStack::PushL(monitorList);
       
  8033 	CActiveRetriever::ResetRequestsNumber();
       
  8034 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList);
       
  8035 	CleanupStack::PushL(activeRetriever);
       
  8036 	scheduler.AddRetrieverL(*activeRetriever);
       
  8037 	monitorList->Start(activeRetriever->Status());
       
  8038 	activeRetriever->Activate();
       
  8039 	scheduler.StartScheduler();
       
  8040 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8041 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());	
       
  8042  	CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL();
       
  8043 	CleanupStack::PushL( list );
       
  8044 	ASSERT_EQUALS(multipleEntries->Enumerate(), list->Enumerate());
       
  8045 	for(TInt i = 0; i < multipleEntries->Enumerate(); ++i)
       
  8046 		{
       
  8047 		entry1 = multipleEntries->GetEntryL(i);
       
  8048 		entry2 = list->GetEntryL(i);
       
  8049 		ASSERT_EQUALS(entry1.iMbmsAccessBearer, entry2.iMbmsAccessBearer);
       
  8050 		ASSERT_EQUALS(entry1.iMbmsServiceMode, entry2.iMbmsServiceMode);
       
  8051 		ASSERT_EQUALS(entry1.iTmgi.GetServiceId(), entry2.iTmgi.GetServiceId());
       
  8052 		ASSERT_EQUALS(entry1.iTmgi.GetMCC(), entry2.iTmgi.GetMCC());
       
  8053 		ASSERT_EQUALS(entry1.iTmgi.GetMNC(), entry2.iTmgi.GetMNC());
       
  8054 		if(i == 1)
       
  8055 			{
       
  8056 			ASSERT_EQUALS(EMbmsAvailable, entry2.iMbmsAvailabilityStatus);
       
  8057 			}
       
  8058 		else
       
  8059 			{
       
  8060 			ASSERT_EQUALS(EMbmsUnavailable, entry2.iMbmsAvailabilityStatus);
       
  8061 			}
       
  8062 		}
       
  8063 	
       
  8064  	//-------------------------------------------------------------------------
       
  8065 	// TEST E: Unsolicited completion of RPacketService::UpdateMbmsMonitorServiceListL
       
  8066 	// from LTSY.
       
  8067  	//-------------------------------------------------------------------------
       
  8068 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  8069  	 	
       
  8070  	// Issue the Complete...	
       
  8071  	iMockLTSY.CompleteL(EPacketNotifyMbmsServiceAvailabilityChange, KErrNone);	
       
  8072 	// wait for completion
       
  8073 	User::WaitForRequest(mockLtsyStatus);
       
  8074 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  8075  			   	
       
  8076 	AssertMockLtsyStatusL();
       
  8077 	CleanupStack::PopAndDestroy(9, this);
       
  8078     }
       
  8079 
       
  8080 /**
       
  8081 @SYMTestCaseID BA-CTSY-PKTS-PNMSASC-0002
       
  8082 @SYMPREQ 1551
       
  8083 @SYMComponent  telephony_ctsy
       
  8084 @SYMTestCaseDesc 
       
  8085 @SYMTestPriority High 
       
  8086 @SYMTestActionsInvokes cancelling of RPacketService::NotifyMbmsServiceAvailabilityChange 
       
  8087 @SYMTestExpectedResults Pass 
       
  8088 @SYMTestType CT 
       
  8089 */
       
  8090 void CCTsyPacketServiceFU::TestNotifyMbmsServiceAvailabilityChange0002L()
       
  8091     {
       
  8092     OpenEtelServerL(EUseExtendedError);
       
  8093 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8094 	OpenPhoneL();
       
  8095 
       
  8096 	RBuf8 data;
       
  8097 	CleanupClosePushL(data);
       
  8098 
       
  8099     RPacketService packetService;       
       
  8100     OpenPacketServiceL(packetService);
       
  8101     CleanupClosePushL(packetService);
       
  8102  
       
  8103   	TRequestStatus requestStatus;	
       
  8104 
       
  8105  	//-------------------------------------------------------------------------
       
  8106 	// Test cancelling of RPacketService::NotifyMbmsServiceAvailabilityChange
       
  8107  	//-------------------------------------------------------------------------
       
  8108  				
       
  8109 	// sent request
       
  8110 	packetService.NotifyMbmsServiceAvailabilityChange(requestStatus);
       
  8111 
       
  8112     // Cancel request
       
  8113     packetService.CancelAsyncRequest(EPacketNotifyMbmsServiceAvailabilityChange);
       
  8114     
       
  8115 	User::WaitForRequest(requestStatus);	
       
  8116 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  8117 
       
  8118 	AssertMockLtsyStatusL();
       
  8119 	CleanupStack::PopAndDestroy(3, this); // packetservice, data, this
       
  8120     }
       
  8121 
       
  8122 /**
       
  8123 @SYMTestCaseID BA-CTSY-PKTS-PNMSASC-0004
       
  8124 @SYMPREQ 1551
       
  8125 @SYMComponent  telephony_ctsy
       
  8126 @SYMTestCaseDesc 
       
  8127 @SYMTestPriority High 
       
  8128 @SYMTestActions Invokes multiple client requests to RPacketService::NotifyMbmsServiceAvailabilityChange  
       
  8129 @SYMTestExpectedResults Pass 
       
  8130 @SYMTestType CT 
       
  8131 */
       
  8132 void CCTsyPacketServiceFU::TestNotifyMbmsServiceAvailabilityChange0004L()
       
  8133     {
       
  8134 	OpenEtelServerL(EUseExtendedError);
       
  8135 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8136 	OpenPhoneL();
       
  8137 
       
  8138 	RBuf8 data;
       
  8139 	CleanupClosePushL(data);
       
  8140 
       
  8141 	// Open second client
       
  8142 	RTelServer telServer2;
       
  8143 	TInt ret = telServer2.Connect();
       
  8144 	ASSERT_EQUALS(KErrNone, ret);
       
  8145 	CleanupClosePushL(telServer2);
       
  8146 
       
  8147 	RMobilePhone phone2;
       
  8148 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  8149 	ASSERT_EQUALS(KErrNone, ret);
       
  8150 	CleanupClosePushL(phone2);
       
  8151 	
       
  8152 	RPacketService packetService;
       
  8153 	OpenPacketServiceL(packetService);
       
  8154 	CleanupClosePushL(packetService);
       
  8155 
       
  8156 	RPacketService packetService2;               
       
  8157 	ret = packetService2.Open(phone2);
       
  8158 	ASSERT_EQUALS(KErrNone, ret);
       
  8159 	CleanupClosePushL(packetService2); 
       
  8160 	
       
  8161 	TRequestStatus requestStatus;
       
  8162 	TRequestStatus requestStatus2;
       
  8163 	TRequestStatus mockLtsyStatus;
       
  8164  
       
  8165    	TInt maxAllowed = 10; 
       
  8166 	TInt maxvalue = 10;
       
  8167  	
       
  8168  	// check maximum monitored service value during TSY startup.
       
  8169  	TMockLtsyData1<TInt> ltsyData(maxvalue);
       
  8170  	data.Close();
       
  8171 	ltsyData.SerialiseL(data);
       
  8172 	
       
  8173  	// data for CompleteL
       
  8174  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  8175 	iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data);
       
  8176 	User::WaitForRequest(mockLtsyStatus);	
       
  8177 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  8178 		
       
  8179 	ASSERT_EQUALS( maxvalue, maxAllowed );
       
  8180 	
       
  8181    	//**** Add existing list ****//
       
  8182  	CFilteringActiveScheduler scheduler;
       
  8183 	CActiveScheduler::Install(&scheduler);
       
  8184 	
       
  8185 	//List retriever
       
  8186 	CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService);	 
       
  8187 	CleanupStack::PushL(monitorList);
       
  8188 
       
  8189 	CActiveRetriever::ResetRequestsNumber();
       
  8190 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList);
       
  8191 	CleanupStack::PushL(activeRetriever);
       
  8192 	scheduler.AddRetrieverL(*activeRetriever);
       
  8193     
       
  8194 	RBuf8 completeData;
       
  8195 	CleanupClosePushL(completeData);    
       
  8196 	
       
  8197     RPacketService::TMbmsServiceAvailabilityV1 existingParams;
       
  8198     
       
  8199     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  8200 	CleanupStack::PushL(multipleEntries);
       
  8201 	
       
  8202 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  8203 	CleanupStack::PushL(zeroEntry);
       
  8204 	
       
  8205 	for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  8206 		{
       
  8207 		existingParams.iTmgi.SetServiceId(i); 
       
  8208 	    existingParams.iTmgi.SetMCC(i);
       
  8209 	    existingParams.iTmgi.SetMNC(i);
       
  8210 	    existingParams.iMbmsServiceMode = KBroadcast;
       
  8211 	    existingParams.iMbmsAccessBearer = E2GBearer;
       
  8212 	   	existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable;
       
  8213 		multipleEntries->AddEntryL(existingParams);
       
  8214 		}
       
  8215 	
       
  8216 	TMmMbmsMonitorServiceListParams expData;
       
  8217 	expData.iActionType = EAddEntries;
       
  8218 	expData.iServiceList = zeroEntry; // existing list
       
  8219 	expData.iListOfChanges = multipleEntries; // list to add
       
  8220     TMockLtsyData1<TMmMbmsMonitorServiceListParams> params(expData);
       
  8221     data.Close();
       
  8222     params.SerialiseL(data);
       
  8223 
       
  8224 	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8225 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, completeData);
       
  8226 	
       
  8227 	packetService.UpdateMbmsMonitorServiceListL(requestStatus, EAddEntries, multipleEntries);	
       
  8228 	User::WaitForRequest(requestStatus);
       
  8229 	ASSERT_EQUALS(KErrNone, requestStatus.Int()); 
       
  8230 		
       
  8231 	monitorList->Start(activeRetriever->Status());
       
  8232 	activeRetriever->Activate();
       
  8233 	scheduler.StartScheduler();
       
  8234 
       
  8235 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8236 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8237 
       
  8238 	CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL();
       
  8239 	CleanupStack::PushL(list);
       
  8240 	
       
  8241 	ASSERT_EQUALS(MBMS_MONITORSERVICECOUNTMULTIPLE, list->Enumerate() );
       
  8242 
       
  8243 	CleanupStack::PopAndDestroy(list);
       
  8244 
       
  8245    	//**** Add existing list ****//
       
  8246 	
       
  8247 	//-------------------------------------------------------------------------
       
  8248 	// Test A: Test multiple clients requesting RPacketService::NotifyMbmsServiceAvailabilityChange
       
  8249  	//-------------------------------------------------------------------------
       
  8250   
       
  8251 	// Post first request	
       
  8252 	packetService.NotifyMbmsServiceAvailabilityChange(requestStatus);
       
  8253 	
       
  8254 	// Post second request
       
  8255 	packetService2.NotifyMbmsServiceAvailabilityChange(requestStatus2);
       
  8256 	
       
  8257 	// Issue the Complete...
       
  8258 	CPcktMbmsMonitoredServiceList* availEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  8259 	CleanupStack::PushL(availEntries);
       
  8260 	
       
  8261 	RPacketService::TMbmsServiceAvailabilityV1 updatedParams;
       
  8262 
       
  8263 	updatedParams.iTmgi.SetServiceId(1); 
       
  8264 	updatedParams.iTmgi.SetMCC(1);
       
  8265 	updatedParams.iTmgi.SetMNC(1);
       
  8266 	updatedParams.iMbmsServiceMode = KBroadcast;
       
  8267 	updatedParams.iMbmsAccessBearer = E2GBearer;
       
  8268 	updatedParams.iMbmsAvailabilityStatus = EMbmsAvailable;
       
  8269 	
       
  8270 	availEntries->AddEntryL(updatedParams);
       
  8271 	TMockLtsyData1<CPcktMbmsMonitoredServiceList*> availParams(availEntries);
       
  8272 	data.Close();
       
  8273 	availParams.SerialiseL(data);
       
  8274 	
       
  8275     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  8276    	iMockLTSY.CompleteL(EPacketNotifyMbmsServiceAvailabilityChange, KErrNone, data);
       
  8277 			
       
  8278 	User::WaitForRequest(mockLtsyStatus);
       
  8279 	AssertMockLtsyStatusL();		
       
  8280 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	 
       
  8281 
       
  8282 	// wait for second completion of NotifyMbmsServiceAvailabilityChange
       
  8283 	User::WaitForRequest(requestStatus2);	
       
  8284 	AssertMockLtsyStatusL();
       
  8285 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());		
       
  8286 		
       
  8287 	monitorList->Start(activeRetriever->Status());
       
  8288 	activeRetriever->Activate();
       
  8289 	scheduler.StartScheduler();
       
  8290 
       
  8291 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8292 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8293 	
       
  8294 	list = monitorList->RetrieveListL();
       
  8295 	CleanupStack::PushL(list);
       
  8296 		
       
  8297 	RPacketService::TMbmsServiceAvailabilityV1 entry1, entry2;
       
  8298 	
       
  8299 	ASSERT_EQUALS(multipleEntries->Enumerate(), list->Enumerate());
       
  8300 	
       
  8301 	for(TInt i = 0; i < multipleEntries->Enumerate(); ++i)
       
  8302 		{
       
  8303 		entry1 = multipleEntries->GetEntryL(i);
       
  8304 		entry2 = list->GetEntryL(i);
       
  8305 		ASSERT_EQUALS(entry1.iMbmsAccessBearer, entry2.iMbmsAccessBearer);
       
  8306 	  	ASSERT_EQUALS(entry1.iMbmsServiceMode, entry2.iMbmsServiceMode);
       
  8307 	  	ASSERT_EQUALS(entry1.iTmgi.GetServiceId(), entry2.iTmgi.GetServiceId());
       
  8308 	  	ASSERT_EQUALS(entry1.iTmgi.GetMCC(), entry2.iTmgi.GetMCC());
       
  8309 	  	ASSERT_EQUALS(entry1.iTmgi.GetMNC(), entry2.iTmgi.GetMNC());
       
  8310 	  	if(i == 1)
       
  8311 	  		{
       
  8312 	  		ASSERT_EQUALS(EMbmsAvailable, entry2.iMbmsAvailabilityStatus);
       
  8313 	 		}
       
  8314 		else
       
  8315 			{
       
  8316 			ASSERT_EQUALS(EMbmsUnavailable, entry2.iMbmsAvailabilityStatus);
       
  8317 			}
       
  8318 		}
       
  8319 
       
  8320 	AssertMockLtsyStatusL();
       
  8321 	CleanupStack::PopAndDestroy(13, this); // availEntries, list, zeroEntry, multipleEntries, completeData,
       
  8322 	// activeRetriever, monitorList, packetService2, packetService, phone2, telServer2, data, this
       
  8323     }
       
  8324 
       
  8325 /**
       
  8326 @SYMTestCaseID BA-CTSY-PKTS-PUMMSL-0001
       
  8327 @SYMPREQ 1551
       
  8328 @SYMComponent  telephony_ctsy
       
  8329 @SYMTestCaseDesc Test support in CTSY for RPacketService::UpdateMbmsMonitorServiceListL
       
  8330 @SYMTestPriority High
       
  8331 @SYMTestActions Invokes RPacketService::UpdateMbmsMonitorServiceListL
       
  8332 @SYMTestExpectedResults Pass
       
  8333 @SYMTestType CT
       
  8334 */
       
  8335 
       
  8336 void CCTsyPacketServiceFU::TestUpdateMbmsMonitorServiceList0001L()
       
  8337     {
       
  8338   	OpenEtelServerL( EUseExtendedError );
       
  8339 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  8340 	OpenPhoneL();
       
  8341 	
       
  8342 	
       
  8343 	RPacketService packetService;
       
  8344     OpenPacketServiceL( packetService );
       
  8345     CleanupClosePushL( packetService );
       
  8346 
       
  8347   	CFilteringActiveScheduler scheduler;
       
  8348 	CActiveScheduler::Install(&scheduler);
       
  8349 	
       
  8350 	RBuf8 data;
       
  8351 	CleanupClosePushL(data);
       
  8352 	
       
  8353 	TInt maxvalue = 100;
       
  8354  	TMockLtsyData1<TInt> ltsyData(maxvalue);
       
  8355  	data.Close();
       
  8356 	ltsyData.SerialiseL(data);
       
  8357 	// Set the maximal number of services 
       
  8358  	TRequestStatus mockLtsyStatus;
       
  8359  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  8360 	iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data);
       
  8361 	User::WaitForRequest(mockLtsyStatus);	
       
  8362 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  8363 	
       
  8364 	CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService);	 
       
  8365 	CleanupStack::PushL(monitorList);
       
  8366 
       
  8367 	CActiveRetriever::ResetRequestsNumber();
       
  8368 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList);
       
  8369 	CleanupStack::PushL(activeRetriever);
       
  8370 	scheduler.AddRetrieverL(*activeRetriever);
       
  8371 	
       
  8372 	//-------------------------------------------------------------------------
       
  8373 	// TEST A: failure to dispatch request to LTSY
       
  8374  	//-------------------------------------------------------------------------
       
  8375 	CPcktMbmsMonitoredServiceList* oneEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  8376 	CleanupStack::PushL(oneEntry);
       
  8377     RPacketService::TMbmsServiceAvailabilityV1 entry;
       
  8378     entry.iTmgi.SetServiceId(15);
       
  8379     entry.iTmgi.SetMCC(15);
       
  8380     entry.iTmgi.SetMNC(6);
       
  8381     entry.iMbmsServiceMode = KBroadcast;
       
  8382     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  8383     entry.iMbmsAccessBearer = E3GBearer;
       
  8384     oneEntry->AddEntryL(entry);
       
  8385 
       
  8386 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  8387 	CleanupStack::PushL(zeroEntry);
       
  8388 
       
  8389 	TMmMbmsMonitorServiceListParams expData;
       
  8390 	expData.iActionType = EAddEntries;
       
  8391 	expData.iServiceList = zeroEntry; // existing list
       
  8392 	expData.iListOfChanges = oneEntry; // list to add
       
  8393     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  8394     data.Close();
       
  8395     expExpect1.SerialiseL(data);
       
  8396 
       
  8397     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data, KErrNotSupported);
       
  8398 
       
  8399 	TRequestStatus reqStatus;
       
  8400  	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, oneEntry);
       
  8401 
       
  8402 	User::WaitForRequest(reqStatus);
       
  8403 	AssertMockLtsyStatusL();
       
  8404 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  8405 	
       
  8406 	monitorList->Start(activeRetriever->Status());
       
  8407 	activeRetriever->Activate();
       
  8408 	scheduler.StartScheduler();
       
  8409 
       
  8410 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8411 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());	
       
  8412 	
       
  8413 	
       
  8414  	CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL();
       
  8415 	CleanupStack::PushL( list );
       
  8416 	
       
  8417 	ASSERT_EQUALS(0, list->Enumerate() );
       
  8418 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*zeroEntry, *list) );
       
  8419 	CleanupStack::PopAndDestroy( list );
       
  8420 	
       
  8421 	//-------------------------------------------------------------------------
       
  8422 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  8423  	//-------------------------------------------------------------------------
       
  8424 
       
  8425 	expData.iActionType = EAddEntries;
       
  8426 	expData.iServiceList = zeroEntry; // existing list
       
  8427 	expData.iListOfChanges = oneEntry; // list to add
       
  8428     data.Close();
       
  8429     expExpect1.SerialiseL(data);
       
  8430 
       
  8431     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8432 
       
  8433 	
       
  8434 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, oneEntry);	
       
  8435 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrGeneral);	
       
  8436 	User::WaitForRequest(reqStatus);
       
  8437 	AssertMockLtsyStatusL();
       
  8438 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
       
  8439 	
       
  8440 	
       
  8441 	monitorList->Start(activeRetriever->Status());
       
  8442 	activeRetriever->Activate();
       
  8443 	scheduler.StartScheduler();
       
  8444 
       
  8445 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8446 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8447 	
       
  8448 	list = monitorList->RetrieveListL();
       
  8449 	CleanupStack::PushL( list );
       
  8450 	
       
  8451 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*zeroEntry, *list) );
       
  8452 	CleanupStack::PopAndDestroy( list );
       
  8453 	
       
  8454  	//-------------------------------------------------------------------------
       
  8455 	// TEST C: Successful completion request of
       
  8456 	// RPacketService::UpdateMbmsMonitorServiceListL
       
  8457  	//-------------------------------------------------------------------------
       
  8458  	
       
  8459     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  8460 	CleanupStack::PushL(multipleEntries);
       
  8461 	RPacketService::TMbmsServiceAvailabilityV1 param2;
       
  8462 	for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  8463 		{
       
  8464 		param2.iTmgi.SetServiceId(i); 
       
  8465 	    param2.iTmgi.SetMCC(i);
       
  8466 	    param2.iTmgi.SetMNC(i);
       
  8467 	    param2.iMbmsServiceMode = KBroadcast;
       
  8468 	    param2.iMbmsAccessBearer = E2GBearer;
       
  8469 		multipleEntries->AddEntryL( param2 );
       
  8470 		}
       
  8471 	
       
  8472 	expData.iActionType = EAddEntries;
       
  8473 	expData.iServiceList = zeroEntry; // existing list
       
  8474 	expData.iListOfChanges = multipleEntries; // list to add
       
  8475     data.Close();
       
  8476     expExpect1.SerialiseL(data);
       
  8477 
       
  8478     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8479 	
       
  8480 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries);	
       
  8481 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  8482 	User::WaitForRequest(reqStatus);
       
  8483 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  8484 	
       
  8485 	monitorList->Start(activeRetriever->Status());
       
  8486 	activeRetriever->Activate();
       
  8487 	scheduler.StartScheduler();
       
  8488 
       
  8489 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8490 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8491 
       
  8492 	list = monitorList->RetrieveListL();
       
  8493 	CleanupStack::PushL( list );
       
  8494 	
       
  8495 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) );
       
  8496 	CleanupStack::PopAndDestroy( list );
       
  8497    
       
  8498  
       
  8499  	//-------------------------------------------------------------------------
       
  8500 	// TEST E: Unsolicited completion of RPacketService::UpdateMbmsMonitorServiceListL
       
  8501 	// from LTSY.
       
  8502  	//-------------------------------------------------------------------------
       
  8503 
       
  8504 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  8505  	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);	
       
  8506 
       
  8507 	User::WaitForRequest(mockLtsyStatus);
       
  8508 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  8509 		
       
  8510  	//-------------------------------------------------------------------------
       
  8511 	// TEST F: Coverage test(s) for RPacketService::UpdateMbmsMonitorServiceListL
       
  8512  	//-------------------------------------------------------------------------
       
  8513 
       
  8514 	//-------------------------------------------------------------------------
       
  8515 	// Test removing one entry 
       
  8516  	//-------------------------------------------------------------------------
       
  8517 
       
  8518 	oneEntry->DeleteEntryL(0);
       
  8519 	oneEntry->AddEntryL(multipleEntries->GetEntryL(1));
       
  8520 	expData.iActionType = ERemoveEntries;
       
  8521 	expData.iServiceList = multipleEntries; // existing list
       
  8522 	expData.iListOfChanges = oneEntry; // list to add
       
  8523     data.Close();
       
  8524     expExpect1.SerialiseL(data);
       
  8525 	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8526 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, ERemoveEntries, oneEntry);	
       
  8527    	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  8528 	User::WaitForRequest(reqStatus);
       
  8529 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  8530 	
       
  8531 	monitorList->Start(activeRetriever->Status());
       
  8532 	activeRetriever->Activate();
       
  8533 	scheduler.StartScheduler();
       
  8534 
       
  8535 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8536 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8537 
       
  8538 	list = monitorList->RetrieveListL();
       
  8539 	CleanupStack::PushL( list );
       
  8540 	
       
  8541 	multipleEntries->DeleteEntryL(1);
       
  8542 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) );
       
  8543 	CleanupStack::PopAndDestroy( list );
       
  8544 
       
  8545 	//-------------------------------------------------------------------------
       
  8546 	// Test adding entries again
       
  8547  	//-------------------------------------------------------------------------
       
  8548     CPcktMbmsMonitoredServiceList* multipleEntries2 = CPcktMbmsMonitoredServiceList::NewL();
       
  8549 	CleanupStack::PushL(multipleEntries2);
       
  8550 	for( TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  8551 		{
       
  8552 		param2.iTmgi.SetServiceId(i+10); 
       
  8553 	    param2.iTmgi.SetMCC(i+10);
       
  8554 	    param2.iTmgi.SetMNC(i+10);
       
  8555 	    param2.iMbmsServiceMode = KBroadcast;
       
  8556 	    param2.iMbmsAccessBearer = E2GBearer;
       
  8557 		multipleEntries2->AddEntryL( param2 );
       
  8558 		}
       
  8559 
       
  8560 	expData.iActionType = EAddEntries;
       
  8561 	expData.iServiceList = multipleEntries; // existing list
       
  8562 	expData.iListOfChanges = multipleEntries2; // list to add
       
  8563     data.Close();
       
  8564     expExpect1.SerialiseL(data);
       
  8565 
       
  8566     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8567 	
       
  8568 	
       
  8569 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries2);	
       
  8570 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  8571 	User::WaitForRequest(reqStatus);
       
  8572 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  8573 	
       
  8574 	monitorList->Start(activeRetriever->Status());
       
  8575 	activeRetriever->Activate();
       
  8576 	scheduler.StartScheduler();
       
  8577 
       
  8578 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8579 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8580 
       
  8581 	list = monitorList->RetrieveListL();
       
  8582 	CleanupStack::PushL( list );
       
  8583 	for(TInt i = 0; i < multipleEntries2->Enumerate(); ++i)
       
  8584 		{
       
  8585 		multipleEntries->AddEntryL(multipleEntries2->GetEntryL(i));
       
  8586 		}
       
  8587 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) );
       
  8588 	CleanupStack::PopAndDestroy( list );
       
  8589 
       
  8590 	//-------------------------------------------------------------------------
       
  8591 	// Test try adding more entries - one fails, other success
       
  8592  	//-------------------------------------------------------------------------
       
  8593 	while(multipleEntries2->Enumerate() > 0)
       
  8594 		{
       
  8595 		multipleEntries2->DeleteEntryL(0);
       
  8596 		}
       
  8597 	for( TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  8598 		{
       
  8599 		param2.iTmgi.SetServiceId(i+20); 
       
  8600 	    param2.iTmgi.SetMCC(i+20);
       
  8601 	    param2.iTmgi.SetMNC(i+20);
       
  8602 	    param2.iMbmsServiceMode = KBroadcast;
       
  8603 	    param2.iMbmsAccessBearer = E2GBearer;
       
  8604 		multipleEntries2->AddEntryL( param2 );
       
  8605 		}
       
  8606 
       
  8607 	expData.iActionType = EAddEntries;
       
  8608 	expData.iServiceList = multipleEntries; // existing list
       
  8609 	expData.iListOfChanges = multipleEntries2; // list to add
       
  8610     data.Close();
       
  8611     expExpect1.SerialiseL(data);
       
  8612 
       
  8613     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8614 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries2 );
       
  8615 	while(multipleEntries2->Enumerate()>1)
       
  8616 		{
       
  8617 		multipleEntries->AddEntryL(multipleEntries2->GetEntryL(0));
       
  8618 		multipleEntries2->DeleteEntryL(0);
       
  8619 		}
       
  8620 	TMockLtsyData1<CPcktMbmsMonitoredServiceList *> compData(multipleEntries2);
       
  8621     data.Close();
       
  8622     compData.SerialiseL(data);
       
  8623     iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrMbmsImpreciseServiceEntries, data);
       
  8624 	
       
  8625 	User::WaitForRequest(reqStatus);
       
  8626 	ASSERT_EQUALS( KErrMbmsImpreciseServiceEntries, reqStatus.Int() );
       
  8627 	
       
  8628 	
       
  8629 	monitorList->Start(activeRetriever->Status());
       
  8630 	activeRetriever->Activate();
       
  8631 	scheduler.StartScheduler();
       
  8632 
       
  8633 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8634 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8635 
       
  8636 	list = monitorList->RetrieveListL();
       
  8637 	CleanupStack::PushL( list );
       
  8638 	
       
  8639 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) );
       
  8640 	CleanupStack::PopAndDestroy( list );
       
  8641 
       
  8642 	//-------------------------------------------------------------------------
       
  8643 	// Test add entries which already exists
       
  8644  	//-------------------------------------------------------------------------
       
  8645 
       
  8646 	while(multipleEntries2->Enumerate()>0)
       
  8647 		{
       
  8648 		multipleEntries2->DeleteEntryL(0);
       
  8649 		}
       
  8650 	while(oneEntry->Enumerate()>0)
       
  8651 		{
       
  8652 		oneEntry->DeleteEntryL(0);
       
  8653 		}
       
  8654 	for( TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  8655 		{
       
  8656 		param2.iTmgi.SetServiceId(i+10); 
       
  8657 	    param2.iTmgi.SetMCC(i+10);
       
  8658 	    param2.iTmgi.SetMNC(i+10);
       
  8659 	    param2.iMbmsServiceMode = KBroadcast;
       
  8660 	    param2.iMbmsAccessBearer = E2GBearer;
       
  8661 		multipleEntries2->AddEntryL( param2 );
       
  8662 		param2.iTmgi.SetServiceId(i+110); 
       
  8663 	    param2.iTmgi.SetMCC(i+110);
       
  8664 	    param2.iTmgi.SetMNC(i+110);
       
  8665 	    param2.iMbmsServiceMode = KBroadcast;
       
  8666 	    param2.iMbmsAccessBearer = E2GBearer;
       
  8667 		multipleEntries2->AddEntryL( param2 );
       
  8668 		oneEntry->AddEntryL( param2 );
       
  8669 		}
       
  8670 
       
  8671 	expData.iActionType = EAddEntries;
       
  8672 	expData.iServiceList = multipleEntries; // existing list
       
  8673 	expData.iListOfChanges = oneEntry; // list to add
       
  8674     data.Close();
       
  8675     expExpect1.SerialiseL(data);
       
  8676 
       
  8677     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8678 	
       
  8679 	
       
  8680 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries2);	
       
  8681 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  8682 	User::WaitForRequest(reqStatus);
       
  8683 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  8684 	
       
  8685 	monitorList->Start(activeRetriever->Status());
       
  8686 	activeRetriever->Activate();
       
  8687 	scheduler.StartScheduler();
       
  8688 
       
  8689 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8690 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8691 
       
  8692 	list = monitorList->RetrieveListL();
       
  8693 	CleanupStack::PushL( list );
       
  8694 	for(TInt i = 0; i < oneEntry->Enumerate(); ++i)
       
  8695 		{
       
  8696 		multipleEntries->AddEntryL(oneEntry->GetEntryL(i));
       
  8697 		}
       
  8698 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*multipleEntries, *list) );
       
  8699 	CleanupStack::PopAndDestroy( list );
       
  8700 	
       
  8701 	//-------------------------------------------------------------------------
       
  8702 	// Test removing all entries
       
  8703  	//-------------------------------------------------------------------------
       
  8704 
       
  8705 	expData.iActionType = ERemoveAllEntries;
       
  8706 	expData.iServiceList = multipleEntries; // existing list
       
  8707 	expData.iListOfChanges = NULL; // list to add
       
  8708     data.Close();
       
  8709     expExpect1.SerialiseL(data);
       
  8710 	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8711 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, ERemoveAllEntries, NULL);	
       
  8712    	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  8713 	User::WaitForRequest(reqStatus);
       
  8714 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  8715 	
       
  8716 	monitorList->Start(activeRetriever->Status());
       
  8717 	activeRetriever->Activate();
       
  8718 	scheduler.StartScheduler();
       
  8719 
       
  8720 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  8721 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  8722 
       
  8723 	list = monitorList->RetrieveListL();
       
  8724 	CleanupStack::PushL( list );
       
  8725 	
       
  8726 	
       
  8727 	ASSERT_EQUALS(0, list->Enumerate() );
       
  8728 	CleanupStack::PopAndDestroy( list );
       
  8729 	
       
  8730 		
       
  8731  	AssertMockLtsyStatusL();
       
  8732 
       
  8733 	CleanupStack::PopAndDestroy( 9, this );
       
  8734     }
       
  8735 
       
  8736 /**
       
  8737 @SYMTestCaseID BA-CTSY-PKTS-PUMMSL-0002
       
  8738 @SYMPREQ 1551
       
  8739 @SYMComponent  telephony_ctsy
       
  8740 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::UpdateMbmsMonitorServiceListL
       
  8741 @SYMTestPriority High
       
  8742 @SYMTestActions Invokes cancelling of RPacketService::UpdateMbmsMonitorServiceListL
       
  8743 @SYMTestExpectedResults Pass
       
  8744 @SYMTestType CT
       
  8745 */
       
  8746 void CCTsyPacketServiceFU::TestUpdateMbmsMonitorServiceList0002L()
       
  8747 	{
       
  8748 
       
  8749 	OpenEtelServerL( EUseExtendedError );
       
  8750 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  8751 	OpenPhoneL();
       
  8752 		
       
  8753 	RPacketService packetService;
       
  8754     OpenPacketServiceL( packetService );
       
  8755     CleanupClosePushL( packetService );
       
  8756 
       
  8757 	RBuf8 data;
       
  8758 	CleanupClosePushL(data);
       
  8759 	
       
  8760 		
       
  8761 	CPcktMbmsMonitoredServiceList* entryList = CPcktMbmsMonitoredServiceList ::NewL();
       
  8762 	CleanupStack::PushL(entryList);
       
  8763 	RPacketService::TMbmsServiceAvailabilityV1 param;
       
  8764 	param.iTmgi.SetServiceId(0); 
       
  8765     entryList->AddEntryL( param );
       
  8766 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  8767 	CleanupStack::PushL(zeroEntry);
       
  8768 
       
  8769 	TMmMbmsMonitorServiceListParams expData;
       
  8770 	expData.iActionType = EAddEntries;
       
  8771 	expData.iServiceList = zeroEntry; // existing list
       
  8772 	expData.iListOfChanges = entryList; // list to add
       
  8773     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  8774     data.Close();
       
  8775     expExpect1.SerialiseL(data);
       
  8776 
       
  8777  	//-------------------------------------------------------------------------
       
  8778 	// Test cancelling of RPacketService::UpdateMbmsMonitorServiceListL
       
  8779  	//-------------------------------------------------------------------------
       
  8780  	
       
  8781    // Expected data from CTSY
       
  8782  	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8783 	
       
  8784 	TRequestStatus reqStatus;
       
  8785 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, entryList);	
       
  8786 	packetService.CancelAsyncRequest(EPacketUpdateMbmsMonitorServiceList);
       
  8787 	
       
  8788 	User::WaitForRequest(reqStatus);
       
  8789 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
  8790 	AssertMockLtsyStatusL();
       
  8791 	
       
  8792 	CleanupStack::PopAndDestroy(5);
       
  8793 
       
  8794 	}
       
  8795 
       
  8796 
       
  8797 /**
       
  8798 @SYMTestCaseID BA-CTSY-PKTS-PUMMSL-0003
       
  8799 @SYMPREQ 1551
       
  8800 @SYMComponent  telephony_ctsy
       
  8801 @SYMTestCaseDesc Test support in CTSY for RPacketService::UpdateMbmsMonitorServiceListL with bad parameter data
       
  8802 @SYMTestPriority High
       
  8803 @SYMTestActions Invokes RPacketService::UpdateMbmsMonitorServiceListL with bad parameter data
       
  8804 @SYMTestExpectedResults Pass
       
  8805 @SYMTestType CT
       
  8806 */
       
  8807 void CCTsyPacketServiceFU::TestUpdateMbmsMonitorServiceList0003L()
       
  8808 	{	
       
  8809 	OpenEtelServerL( EUseExtendedError );
       
  8810 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  8811 	OpenPhoneL();
       
  8812 		
       
  8813 	RPacketService packetService;
       
  8814     OpenPacketServiceL( packetService );
       
  8815     CleanupClosePushL( packetService );
       
  8816 
       
  8817 	RBuf8 data;
       
  8818 	CleanupClosePushL(data);
       
  8819 	
       
  8820 	// check maximum monitored service value during TSY startup.
       
  8821 	TInt maxvalue = 0;
       
  8822  	TMockLtsyData1<TInt> ltsyData(maxvalue);
       
  8823  	data.Close();
       
  8824 	ltsyData.SerialiseL(data);
       
  8825  	// data for CompleteL
       
  8826  	TRequestStatus mockLtsyStatus;
       
  8827  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  8828 	iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data);
       
  8829 	User::WaitForRequest(mockLtsyStatus);	
       
  8830 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());	
       
  8831 		
       
  8832 	//-------------------------------------------------------------------------
       
  8833 	// Test C: Test passing out of bounds parameters to
       
  8834 	// RPacketService::UpdateMbmsMonitorServiceListL
       
  8835  	//-------------------------------------------------------------------------
       
  8836     RPacketService::TMbmsServiceAvailabilityV1 existingParams;
       
  8837        
       
  8838     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  8839 	CleanupStack::PushL(multipleEntries);
       
  8840 
       
  8841 	// create maximum number of entries plus 1
       
  8842 	for(TInt i=0; i < MBMS_MONITORSERVICECOUNTMULTIPLE + 1 ;i++)
       
  8843 		{
       
  8844 		existingParams.iTmgi.SetServiceId(i); 
       
  8845 	    existingParams.iTmgi.SetMCC(i);
       
  8846 	    existingParams.iTmgi.SetMNC(i);
       
  8847 	    existingParams.iMbmsServiceMode = KBroadcast;
       
  8848 	    existingParams.iMbmsAccessBearer = E2GBearer;
       
  8849 	   	existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable;
       
  8850 		multipleEntries->AddEntryL( existingParams );
       
  8851 		}
       
  8852 
       
  8853 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  8854 	CleanupStack::PushL(zeroEntry);
       
  8855 	
       
  8856 	TMmMbmsMonitorServiceListParams expData;
       
  8857 	expData.iActionType = EAddEntries;
       
  8858 	expData.iServiceList = zeroEntry; // existing list
       
  8859 	expData.iListOfChanges = multipleEntries; // list to add
       
  8860     TMockLtsyData1<TMmMbmsMonitorServiceListParams> params(expData);
       
  8861     data.Close();
       
  8862     params.SerialiseL(data);
       
  8863 	
       
  8864  	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8865 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, data);
       
  8866 
       
  8867 	TRequestStatus reqStatus;
       
  8868 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries);	
       
  8869 	User::WaitForRequest(reqStatus);
       
  8870 	ASSERT_EQUALS(KErrOverflow, reqStatus.Int());
       
  8871 
       
  8872 	AssertMockLtsyStatusL();
       
  8873 	CleanupStack::PopAndDestroy(5, this); // zeroEntry, multipleEntries, data, packetService, this
       
  8874 	}
       
  8875 
       
  8876 /**
       
  8877 @SYMTestCaseID BA-CTSY-PKTS-PUMMSL-0005
       
  8878 @SYMPREQ 1551
       
  8879 @SYMComponent  telephony_ctsy
       
  8880 @SYMTestCaseDesc Test support in CTSY for RPacketService::UpdateMbmsMonitorServiceListL with timeout
       
  8881 @SYMTestPriority High
       
  8882 @SYMTestActions Invokes RPacketService::UpdateMbmsMonitorServiceListL and tests for timeout
       
  8883 @SYMTestExpectedResults Pass
       
  8884 @SYMTestType CT
       
  8885 */
       
  8886 void CCTsyPacketServiceFU::TestUpdateMbmsMonitorServiceList0005L()
       
  8887 	{
       
  8888 
       
  8889 	OpenEtelServerL( EUseExtendedError );
       
  8890 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  8891 	OpenPhoneL();
       
  8892 		
       
  8893 	RPacketService packetService;
       
  8894     OpenPacketServiceL( packetService );
       
  8895     CleanupClosePushL( packetService );
       
  8896 
       
  8897 	RBuf8 data;
       
  8898 	CleanupClosePushL(data);
       
  8899 
       
  8900 	//-------------------------------------------------------------------------
       
  8901 	// Test A: Test timeout of RPacketService::UpdateMbmsMonitorServiceListL
       
  8902  	//-------------------------------------------------------------------------
       
  8903     RPacketService::TMbmsServiceAvailabilityV1 existingParams;
       
  8904        
       
  8905     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  8906 	CleanupStack::PushL(multipleEntries);
       
  8907 	
       
  8908 	for(TInt i=0; i < MBMS_MONITORSERVICECOUNTMULTIPLE + 1 ;i++)
       
  8909 		{
       
  8910 		existingParams.iTmgi.SetServiceId(i); 
       
  8911 	    existingParams.iTmgi.SetMCC(i);
       
  8912 	    existingParams.iTmgi.SetMNC(i);
       
  8913 	    existingParams.iMbmsServiceMode = KBroadcast;
       
  8914 	    existingParams.iMbmsAccessBearer = E2GBearer;
       
  8915 	   	existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable;
       
  8916 		multipleEntries->AddEntryL( existingParams );
       
  8917 		}
       
  8918 
       
  8919 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  8920 	CleanupStack::PushL(zeroEntry);
       
  8921 	
       
  8922 	TMmMbmsMonitorServiceListParams expData;
       
  8923 	expData.iActionType = EAddEntries;
       
  8924 	expData.iServiceList = zeroEntry; // existing list
       
  8925 	expData.iListOfChanges = multipleEntries; // list to add
       
  8926     TMockLtsyData1<TMmMbmsMonitorServiceListParams> params(expData);
       
  8927     data.Close();
       
  8928     params.SerialiseL(data);
       
  8929     
       
  8930  	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  8931  	
       
  8932 	TRequestStatus reqStatus;
       
  8933 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries);	
       
  8934 	User::WaitForRequest(reqStatus);
       
  8935 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
  8936 
       
  8937 	AssertMockLtsyStatusL();
       
  8938 	CleanupStack::PopAndDestroy(5, this); // zeroEntry, multipleEntries, data, packetService, this
       
  8939 	}
       
  8940 
       
  8941 
       
  8942 /**
       
  8943 @SYMTestCaseID BA-CTSY-PKTS-RPMMSL-0001
       
  8944 @SYMPREQ 1551
       
  8945 @SYMComponent  telephony_ctsy
       
  8946 @SYMTestCaseDesc Test support in CTSY for CRetrievePcktMbmsMonitoredServices::Start 
       
  8947 @SYMTestPriority High
       
  8948 @SYMTestActions Invokes CRetrievePcktMbmsMonitoredServices::Start 
       
  8949 @SYMTestExpectedResults Pass
       
  8950 @SYMTestType CT
       
  8951 */
       
  8952 void CCTsyPacketServiceFU::TestStart0001L()
       
  8953 	{
       
  8954 
       
  8955 	OpenEtelServerL(EUseExtendedError);
       
  8956 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8957 	OpenPhoneL();
       
  8958 
       
  8959 	RPacketService packetService;
       
  8960     OpenPacketServiceL( packetService );
       
  8961     CleanupClosePushL( packetService );
       
  8962 
       
  8963 	RBuf8 data;
       
  8964 	CleanupClosePushL(data);
       
  8965 
       
  8966 	CFilteringActiveScheduler scheduler;
       
  8967 	CActiveScheduler::Install(&scheduler);
       
  8968 	
       
  8969 	CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService);	 
       
  8970 	CleanupStack::PushL(monitorList);
       
  8971 
       
  8972 	CActiveRetriever::ResetRequestsNumber();
       
  8973 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList);
       
  8974 	CleanupStack::PushL(activeRetriever);
       
  8975 	scheduler.AddRetrieverL(*activeRetriever);
       
  8976 
       
  8977 
       
  8978 	//-------------------------------------------------------------------------
       
  8979 	// TEST C: Successful completion request of
       
  8980 	// CRetrievePcktMbmsMonitoredServices::Start
       
  8981  	//-------------------------------------------------------------------------
       
  8982 	
       
  8983 	// Set the list
       
  8984 	TMmMbmsMonitorServiceListParams expData;
       
  8985 	expData.iActionType = EAddEntries;
       
  8986 	expData.iServiceList = CPcktMbmsMonitoredServiceList::NewL(); // existing list
       
  8987 	CleanupStack::PushL( expData.iServiceList );
       
  8988 	expData.iListOfChanges = CPcktMbmsMonitoredServiceList::NewL(); // list to add
       
  8989 	CleanupStack::PushL( expData.iListOfChanges );
       
  8990     RPacketService::TMbmsServiceAvailabilityV1 entry;
       
  8991     entry.iTmgi.SetServiceId(15);
       
  8992     entry.iTmgi.SetMCC(15);
       
  8993     entry.iTmgi.SetMNC(6);
       
  8994     entry.iMbmsServiceMode = KBroadcast;
       
  8995     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  8996     entry.iMbmsAccessBearer = E3GBearer;
       
  8997     expData.iListOfChanges->AddEntryL(entry);
       
  8998     entry.iTmgi.SetServiceId(5);
       
  8999     entry.iTmgi.SetMCC(12);
       
  9000     entry.iTmgi.SetMNC(7);
       
  9001     entry.iMbmsServiceMode = KSelectedBroadcast;
       
  9002     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9003     entry.iMbmsAccessBearer = E2GBearer;
       
  9004     expData.iListOfChanges->AddEntryL(entry);
       
  9005     entry.iTmgi.SetServiceId(8);
       
  9006     entry.iTmgi.SetMCC(115);
       
  9007     entry.iTmgi.SetMNC(36);
       
  9008     entry.iMbmsServiceMode = KBroadcast;
       
  9009     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9010     entry.iMbmsAccessBearer = E3GBearer;
       
  9011     expData.iListOfChanges->AddEntryL(entry);
       
  9012     entry.iTmgi.SetServiceId(115);
       
  9013     entry.iTmgi.SetMCC(1);
       
  9014     entry.iTmgi.SetMNC(46);
       
  9015     entry.iMbmsServiceMode = KSelectedBroadcast;
       
  9016     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9017     entry.iMbmsAccessBearer = E3GBearer;
       
  9018     expData.iListOfChanges->AddEntryL(entry);
       
  9019 
       
  9020     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  9021     expExpect1.SerialiseL(data);
       
  9022 
       
  9023     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  9024 	TRequestStatus reqStatus;
       
  9025 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, expData.iListOfChanges );	
       
  9026 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  9027 	
       
  9028 	User::WaitForRequest(reqStatus);
       
  9029 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  9030 	
       
  9031 	// Reading the list
       
  9032 	monitorList->Start(activeRetriever->Status());
       
  9033 	activeRetriever->Activate();
       
  9034 	scheduler.StartScheduler();
       
  9035 
       
  9036 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  9037 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  9038 	
       
  9039 	CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL();
       
  9040 	CleanupStack::PushL( list );
       
  9041 		
       
  9042 	ASSERT_TRUE( TComparator<CPcktMbmsMonitoredServiceList>::IsEqual(*expData.iListOfChanges, *list) );
       
  9043 
       
  9044 
       
  9045 	AssertMockLtsyStatusL();
       
  9046 	CleanupStack::PopAndDestroy(8, this); 
       
  9047 
       
  9048 	}
       
  9049 
       
  9050 
       
  9051 /**
       
  9052 @SYMTestCaseID BA-CTSY-PKTS-RPMMSL-0002
       
  9053 @SYMPREQ 1551
       
  9054 @SYMComponent  telephony_ctsy
       
  9055 @SYMTestCaseDesc Test support in CTSY for cancelling of CRetrievePcktMbmsMonitoredServices::Start 
       
  9056 @SYMTestPriority High
       
  9057 @SYMTestActions Invokes cancelling of CRetrievePcktMbmsMonitoredServices::Start 
       
  9058 @SYMTestExpectedResults Pass
       
  9059 @SYMTestType CT
       
  9060 */
       
  9061 void CCTsyPacketServiceFU::TestStart0002L()
       
  9062 	{
       
  9063 
       
  9064 	OpenEtelServerL(EUseExtendedError);
       
  9065 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9066 	OpenPhoneL();
       
  9067 
       
  9068 	RPacketService packetService;
       
  9069     OpenPacketServiceL( packetService );
       
  9070     CleanupClosePushL( packetService );
       
  9071 
       
  9072 	RBuf8 data;
       
  9073 	CleanupClosePushL(data);
       
  9074 
       
  9075 	CFilteringActiveScheduler scheduler;
       
  9076 	CActiveScheduler::Install(&scheduler);
       
  9077 	
       
  9078 	CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService);	 
       
  9079 	CleanupStack::PushL(monitorList);
       
  9080 
       
  9081 	CActiveRetriever::ResetRequestsNumber();
       
  9082 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList);
       
  9083 	CleanupStack::PushL(activeRetriever);
       
  9084 	scheduler.AddRetrieverL(*activeRetriever);
       
  9085 
       
  9086 	//-------------------------------------------------------------------------
       
  9087 	// Test cancelling of CRetrievePcktMbmsMonitoredServices::Start
       
  9088  	//-------------------------------------------------------------------------
       
  9089  	
       
  9090 	monitorList->Start(activeRetriever->Status());
       
  9091 	activeRetriever->Activate(CActiveRetriever::ECaseGeneralCancelCase);
       
  9092 	scheduler.StartScheduler();
       
  9093 
       
  9094 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  9095 	ASSERT_EQUALS(KErrCancel, activeRetriever->iStatus.Int());
       
  9096 	
       
  9097 	AssertMockLtsyStatusL();
       
  9098 	
       
  9099 	//-------------------------------------------------------------------------
       
  9100 	// Test cancelling of CRetrievePcktMbmsMonitoredServices::Start
       
  9101 	// this time cancel on 2nd phase
       
  9102  	//-------------------------------------------------------------------------
       
  9103 
       
  9104 	
       
  9105 	TRequestStatus reqStatus;
       
  9106     RPacketService::TMbmsServiceAvailabilityV1 existingParams;
       
  9107     
       
  9108     
       
  9109     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList::NewL();
       
  9110 	CleanupStack::PushL(multipleEntries);
       
  9111 	
       
  9112 	for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  9113 		{
       
  9114 		existingParams.iTmgi.SetServiceId(i); 
       
  9115 	    existingParams.iTmgi.SetMCC(i);
       
  9116 	    existingParams.iTmgi.SetMNC(i);
       
  9117 	    existingParams.iMbmsServiceMode = KBroadcast;
       
  9118 	    existingParams.iMbmsAccessBearer = E2GBearer;
       
  9119 	   	existingParams.iMbmsAvailabilityStatus = EMbmsUnavailable;
       
  9120 		multipleEntries->AddEntryL( existingParams );
       
  9121 		}
       
  9122 	
       
  9123 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  9124 	CleanupStack::PushL(zeroEntry);
       
  9125 	TMmMbmsMonitorServiceListParams expData;
       
  9126 	expData.iActionType = EAddEntries;
       
  9127 	expData.iServiceList = zeroEntry; // existing list
       
  9128 	expData.iListOfChanges = multipleEntries; // list to add
       
  9129     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  9130     data.Close();
       
  9131     expExpect1.SerialiseL(data);
       
  9132     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  9133 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, multipleEntries);
       
  9134 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  9135 	User::WaitForRequest(reqStatus);
       
  9136 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  9137 
       
  9138 	monitorList->Start(activeRetriever->iStatus);
       
  9139 	activeRetriever->Activate(CActiveRetriever::ECasePhase2Cancel);
       
  9140 	scheduler.StartScheduler();
       
  9141 
       
  9142 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  9143 	ASSERT_EQUALS(KErrCancel, activeRetriever->iStatus.Int());
       
  9144 	
       
  9145 	AssertMockLtsyStatusL();
       
  9146 	
       
  9147 	CActiveScheduler::Install(NULL);
       
  9148 	CleanupStack::PopAndDestroy(7, this); 
       
  9149 
       
  9150 	}
       
  9151 
       
  9152 /**
       
  9153 @SYMTestCaseID BA-CTSY-PKTS-PEMMSL-0001
       
  9154 @SYMPREQ 1551
       
  9155 @SYMComponent  telephony_ctsy
       
  9156 @SYMTestCaseDesc Test support in CTSY for RPacketService::EnumerateMbmsMonitorServiceList
       
  9157 @SYMTestPriority High
       
  9158 @SYMTestActions Invokes RPacketService::EnumerateMbmsMonitorServiceList
       
  9159 @SYMTestExpectedResults Pass
       
  9160 @SYMTestType CT
       
  9161 */
       
  9162 void CCTsyPacketServiceFU::TestEnumerateMbmsMonitorServiceList0001L()
       
  9163     {
       
  9164     OpenEtelServerL( EUseExtendedError );
       
  9165 	CleanupStack::PushL(TCleanupItem( Cleanup,this ) );
       
  9166 	OpenPhoneL();
       
  9167 
       
  9168 	RBuf8 data;
       
  9169 	CleanupClosePushL( data );
       
  9170 
       
  9171 	RPacketService packetService;		
       
  9172 	// Open PacketService
       
  9173 	OpenPacketServiceL( packetService );
       
  9174 	CleanupClosePushL( packetService ); 
       
  9175 	
       
  9176 	TRequestStatus requestStatus;
       
  9177 	TRequestStatus mockLtsyStatus;
       
  9178  	TInt count;
       
  9179  	TInt maxAllowed ; 	
       
  9180 	
       
  9181  	//-------------------------------------------------------------------------
       
  9182 	// TEST C: Successful completion request of
       
  9183 	// RPacketService::EnumerateMbmsMonitorServiceList during startup.
       
  9184  	//-------------------------------------------------------------------------
       
  9185 
       
  9186  	TInt maxvalue = 40;
       
  9187  	// set maximum monitored service value during TSY startup.
       
  9188  	TMockLtsyData1<TInt> ltsyData(maxvalue);
       
  9189  	data.Close();
       
  9190 	ltsyData.SerialiseL(data);
       
  9191  	// data for CompleteL
       
  9192  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  9193 	iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data);
       
  9194 	User::WaitForRequest(mockLtsyStatus);	
       
  9195 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  9196 		
       
  9197  	//-------------------------------------------------------------------------
       
  9198 	// TEST C: Successful completion request of
       
  9199 	// RPacketService::EnumerateMbmsMonitorServiceList when List is empty.
       
  9200  	//-------------------------------------------------------------------------
       
  9201  	
       
  9202     // send request
       
  9203 	packetService.EnumerateMbmsMonitorServiceList(requestStatus, count, maxAllowed);
       
  9204     User::WaitForRequest(requestStatus);
       
  9205     AssertMockLtsyStatusL();
       
  9206  	ASSERT_EQUALS( KErrNone, requestStatus.Int() ); 
       
  9207   	
       
  9208   	ASSERT_EQUALS( maxvalue, maxAllowed );  	
       
  9209   	ASSERT_EQUALS( 0, count );
       
  9210   	
       
  9211    	//-------------------------------------------------------------------------
       
  9212 	// TEST D: Successful completion request of
       
  9213 	// RPacketService::EnumerateMbmsMonitorServiceList when List is not empty.
       
  9214  	//-------------------------------------------------------------------------
       
  9215  
       
  9216 	// Set the list
       
  9217 	TMmMbmsMonitorServiceListParams expData;
       
  9218 	expData.iActionType = EAddEntries;
       
  9219 	expData.iServiceList = CPcktMbmsMonitoredServiceList::NewL(); // existing list
       
  9220 	CleanupStack::PushL( expData.iServiceList );
       
  9221 	expData.iListOfChanges = CPcktMbmsMonitoredServiceList::NewL(); // list to add
       
  9222 	CleanupStack::PushL( expData.iListOfChanges );
       
  9223     RPacketService::TMbmsServiceAvailabilityV1 entry;
       
  9224     entry.iTmgi.SetServiceId(15);
       
  9225     entry.iTmgi.SetMCC(15);
       
  9226     entry.iTmgi.SetMNC(6);
       
  9227     entry.iMbmsServiceMode = KBroadcast;
       
  9228     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9229     entry.iMbmsAccessBearer = E3GBearer;
       
  9230     expData.iListOfChanges->AddEntryL(entry);
       
  9231     entry.iTmgi.SetServiceId(5);
       
  9232     entry.iTmgi.SetMCC(12);
       
  9233     entry.iTmgi.SetMNC(7);
       
  9234     entry.iMbmsServiceMode = KSelectedBroadcast;
       
  9235     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9236     entry.iMbmsAccessBearer = E2GBearer;
       
  9237     expData.iListOfChanges->AddEntryL(entry);
       
  9238     entry.iTmgi.SetServiceId(8);
       
  9239     entry.iTmgi.SetMCC(115);
       
  9240     entry.iTmgi.SetMNC(36);
       
  9241     entry.iMbmsServiceMode = KBroadcast;
       
  9242     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9243     entry.iMbmsAccessBearer = E3GBearer;
       
  9244     expData.iListOfChanges->AddEntryL(entry);
       
  9245     entry.iTmgi.SetServiceId(115);
       
  9246     entry.iTmgi.SetMCC(1);
       
  9247     entry.iTmgi.SetMNC(46);
       
  9248     entry.iMbmsServiceMode = KSelectedBroadcast;
       
  9249     entry.iMbmsAvailabilityStatus = EMbmsAvailabilityUnknown;
       
  9250     entry.iMbmsAccessBearer = E3GBearer;
       
  9251     expData.iListOfChanges->AddEntryL(entry);
       
  9252 
       
  9253     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  9254     expExpect1.SerialiseL(data);
       
  9255 
       
  9256     iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  9257 	TRequestStatus reqStatus;
       
  9258 	packetService.UpdateMbmsMonitorServiceListL(reqStatus, EAddEntries, expData.iListOfChanges );	
       
  9259 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone);
       
  9260 	
       
  9261 	User::WaitForRequest(reqStatus);
       
  9262 	ASSERT_EQUALS( KErrNone, reqStatus.Int() );
       
  9263 	
       
  9264 		
       
  9265 	// send EnumerateMbmsMonitorServiceList request
       
  9266 	packetService.EnumerateMbmsMonitorServiceList(requestStatus, count, maxvalue);
       
  9267     User::WaitForRequest(requestStatus);
       
  9268     AssertMockLtsyStatusL();
       
  9269  	ASSERT_EQUALS( KErrNone, requestStatus.Int() ); 
       
  9270   	
       
  9271   	ASSERT_EQUALS( maxAllowed, maxvalue );  	
       
  9272   	ASSERT_EQUALS( expData.iListOfChanges->Enumerate(), count);
       
  9273   		
       
  9274  	AssertMockLtsyStatusL();
       
  9275 	CleanupStack::PopAndDestroy( 5, this ); 	
       
  9276     }
       
  9277 
       
  9278 /**
       
  9279 @SYMTestCaseID BA-CTSY-PKTS-PEMMSL-0002
       
  9280 @SYMPREQ 1551
       
  9281 @SYMComponent  telephony_ctsy
       
  9282 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::EnumerateMbmsMonitorServiceList
       
  9283 @SYMTestPriority High
       
  9284 @SYMTestActions Invokes cancelling of RPacketService::EnumerateMbmsMonitorServiceList
       
  9285 @SYMTestExpectedResults Pass
       
  9286 @SYMTestType CT
       
  9287 */
       
  9288 void CCTsyPacketServiceFU::TestEnumerateMbmsMonitorServiceList0002L()
       
  9289     {
       
  9290     OpenEtelServerL( EUseExtendedError );
       
  9291 	CleanupStack::PushL(TCleanupItem( Cleanup,this ) );
       
  9292 	OpenPhoneL();
       
  9293 
       
  9294 	RPacketService packetService;		
       
  9295 	// Open PacketService
       
  9296 	OpenPacketServiceL( packetService );
       
  9297 	CleanupClosePushL( packetService ); 
       
  9298 	
       
  9299 	TRequestStatus requestStatus;
       
  9300  	TInt count;
       
  9301  	TInt maxAllowed ; 	
       
  9302 	
       
  9303  	//-------------------------------------------------------------------------
       
  9304 	// Test cancelling of RPacketService::EnumerateMbmsMonitorServiceList
       
  9305  	//-------------------------------------------------------------------------
       
  9306 
       
  9307     // send request
       
  9308 	packetService.EnumerateMbmsMonitorServiceList(requestStatus, count, maxAllowed);
       
  9309 	packetService.CancelAsyncRequest(EPacketEnumerateMbmsMonitorServiceList);
       
  9310     User::WaitForRequest(requestStatus);
       
  9311  	ASSERT_TRUE(( KErrNone == requestStatus.Int()) || (KErrCancel == requestStatus.Int()) ); 
       
  9312  	AssertMockLtsyStatusL();
       
  9313 	CleanupStack::PopAndDestroy( 2, this ); 	
       
  9314     }
       
  9315 
       
  9316 
       
  9317 /**
       
  9318 @SYMTestCaseID BA-CTSY-PKTS-PEMMSL-0004
       
  9319 @SYMPREQ 1551
       
  9320 @SYMComponent  telephony_ctsy
       
  9321 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketService::EnumerateMbmsMonitorServiceList
       
  9322 @SYMTestPriority High
       
  9323 @SYMTestActions Invokes multiple client requests to RPacketService::EnumerateMbmsMonitorServiceList
       
  9324 @SYMTestExpectedResults Pass
       
  9325 @SYMTestType CT
       
  9326 */
       
  9327 void CCTsyPacketServiceFU::TestEnumerateMbmsMonitorServiceList0004L()
       
  9328     {
       
  9329 	OpenEtelServerL(EUseExtendedError);
       
  9330 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  9331 	OpenPhoneL();
       
  9332 	
       
  9333 	// Open second client
       
  9334 	RTelServer telServer2;
       
  9335 	TInt ret = telServer2.Connect();
       
  9336 	ASSERT_EQUALS(KErrNone, ret);
       
  9337 	CleanupClosePushL(telServer2);
       
  9338 
       
  9339 	RMobilePhone phone2;
       
  9340 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  9341 	ASSERT_EQUALS(KErrNone, ret);
       
  9342 	CleanupClosePushL(phone2);
       
  9343 	
       
  9344 	RPacketService packetService;
       
  9345 	OpenPacketServiceL(packetService);
       
  9346 	CleanupClosePushL(packetService);
       
  9347 	
       
  9348 	RPacketService packetService2;                
       
  9349 	ret = packetService2.Open(phone2);
       
  9350 	ASSERT_EQUALS(KErrNone, ret);
       
  9351 	CleanupClosePushL(packetService2);
       
  9352 	
       
  9353 	RBuf8 data;
       
  9354 	CleanupClosePushL( data );
       
  9355 
       
  9356 	TRequestStatus requestStatus;
       
  9357 	TRequestStatus requestStatus2;	
       
  9358 	TRequestStatus mockLtsyStatus;
       
  9359 
       
  9360  	TInt maxAllowed = 40; 
       
  9361 	TInt maxvalue = 40;
       
  9362 
       
  9363  	// check maximum monitored service value during TSY startup.
       
  9364  	TMockLtsyData1<TInt> ltsyData(maxvalue);
       
  9365  	data.Close();
       
  9366 	ltsyData.SerialiseL(data);
       
  9367  	// data for CompleteL
       
  9368  	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  9369 	iMockLTSY.CompleteL(EPacketEnumerateMbmsMonitorServiceList, KErrNone, data);
       
  9370 	User::WaitForRequest(mockLtsyStatus);	
       
  9371 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  9372 		
       
  9373 	ASSERT_EQUALS( maxvalue, maxAllowed );
       
  9374 	
       
  9375 	//-------------------------------------------------------------------------
       
  9376 	// Test A: Test multiple clients requesting RPacketService::EnumerateMbmsMonitorServiceList
       
  9377  	//-------------------------------------------------------------------------
       
  9378  	CFilteringActiveScheduler scheduler;
       
  9379 	CActiveScheduler::Install(&scheduler);
       
  9380 	
       
  9381 	//List retriever
       
  9382 	CRetrievePcktMbmsMonitoredServices* monitorList = CRetrievePcktMbmsMonitoredServices::NewL(packetService);	 
       
  9383 	CleanupStack::PushL(monitorList);
       
  9384 
       
  9385 	CActiveRetriever::ResetRequestsNumber();
       
  9386 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*monitorList);
       
  9387 	CleanupStack::PushL(activeRetriever);
       
  9388 	scheduler.AddRetrieverL(*activeRetriever);
       
  9389     
       
  9390 	RBuf8 completeData;
       
  9391 	CleanupClosePushL(completeData);
       
  9392 
       
  9393     RPacketService::TMbmsServiceAvailabilityV1 param2;
       
  9394     
       
  9395     CPcktMbmsMonitoredServiceList* multipleEntries = CPcktMbmsMonitoredServiceList ::NewL();
       
  9396 	CleanupStack::PushL(multipleEntries);
       
  9397 	
       
  9398 	for(TInt i=0;i < MBMS_MONITORSERVICECOUNTMULTIPLE ;i++)
       
  9399 		{
       
  9400 		param2.iTmgi.SetServiceId(i); 
       
  9401 	    param2.iTmgi.SetMCC(i);
       
  9402 	    param2.iTmgi.SetMNC(i);
       
  9403 	    param2.iMbmsServiceMode = KBroadcast;
       
  9404 	    param2.iMbmsAccessBearer = E2GBearer;
       
  9405 		multipleEntries->AddEntryL(param2);
       
  9406 		}
       
  9407     
       
  9408 	CPcktMbmsMonitoredServiceList* zeroEntry = CPcktMbmsMonitoredServiceList::NewL();
       
  9409 	CleanupStack::PushL(zeroEntry);
       
  9410 	
       
  9411 	TMmMbmsMonitorServiceListParams expData;
       
  9412 	expData.iActionType = EAddEntries;
       
  9413 	expData.iServiceList = zeroEntry; // existing list
       
  9414 	expData.iListOfChanges = multipleEntries; // list to add
       
  9415     TMockLtsyData1<TMmMbmsMonitorServiceListParams> expExpect1(expData);
       
  9416     data.Close();
       
  9417     expExpect1.SerialiseL(data);
       
  9418 	
       
  9419 	iMockLTSY.ExpectL(EPacketUpdateMbmsMonitorServiceList, data);
       
  9420 	iMockLTSY.CompleteL(EPacketUpdateMbmsMonitorServiceList, KErrNone, completeData);
       
  9421 	
       
  9422 	packetService.UpdateMbmsMonitorServiceListL(requestStatus, EAddEntries, multipleEntries);	
       
  9423 	User::WaitForRequest(requestStatus);
       
  9424 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  9425 		
       
  9426 	monitorList->Start(activeRetriever->Status());
       
  9427 	activeRetriever->Activate();
       
  9428 	scheduler.StartScheduler();
       
  9429 
       
  9430 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  9431 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
  9432 
       
  9433 	CPcktMbmsMonitoredServiceList* list = monitorList->RetrieveListL();
       
  9434 	CleanupStack::PushL(list);
       
  9435 	
       
  9436 	ASSERT_EQUALS(MBMS_MONITORSERVICECOUNTMULTIPLE, list->Enumerate());
       
  9437 	
       
  9438 	maxvalue = 40;
       
  9439 	TInt maxvalue2 = 40;
       
  9440 	TInt count1, count2;
       
  9441 	
       
  9442 	// send EnumerateMbmsMonitorServiceList request
       
  9443 	packetService.EnumerateMbmsMonitorServiceList(requestStatus, count1, maxvalue);
       
  9444 	
       
  9445 	// send EnumerateMbmsMonitorServiceList request
       
  9446 	packetService2.EnumerateMbmsMonitorServiceList(requestStatus2, count2, maxvalue2);
       
  9447 	
       
  9448 	// wait for first answer
       
  9449     User::WaitForRequest(requestStatus);
       
  9450     AssertMockLtsyStatusL();
       
  9451  	ASSERT_EQUALS(KErrNone, requestStatus.Int() ); 
       
  9452   	ASSERT_EQUALS(maxvalue, maxAllowed );  	
       
  9453   	ASSERT_EQUALS(count1, MBMS_MONITORSERVICECOUNTMULTIPLE);
       
  9454   	
       
  9455   	// wait for second answer
       
  9456     User::WaitForRequest(requestStatus2);
       
  9457 
       
  9458  	ASSERT_EQUALS(KErrNone, requestStatus2.Int()); 
       
  9459   	ASSERT_EQUALS(maxvalue2, maxAllowed);  	
       
  9460   	ASSERT_EQUALS(count2, MBMS_MONITORSERVICECOUNTMULTIPLE);		
       
  9461   	
       
  9462 	CleanupStack::PopAndDestroy( 12, this ); // list zeroEntry multipleEntries completeData
       
  9463 	// activeRetriever monitorList data packetService2 packetService phone2 telServer2 this
       
  9464 	}
       
  9465 
       
  9466 /**
       
  9467 @SYMTestCaseID BA-CTSY-PKTS-PEMASL-0001
       
  9468 @SYMPREQ 1551
       
  9469 @SYMComponent  telephony_ctsy
       
  9470 @SYMTestCaseDesc Test support in CTSY for RPacketService::EnumerateMbmsActiveServiceList
       
  9471 @SYMTestPriority High
       
  9472 @SYMTestActions Invokes RPacketService::EnumerateMbmsActiveServiceList
       
  9473 @SYMTestExpectedResults Pass
       
  9474 @SYMTestType CT
       
  9475 */
       
  9476 void CCTsyPacketServiceFU::TestEnumerateMbmsActiveServiceList0001L()
       
  9477     {
       
  9478     OpenEtelServerL( EUseExtendedError );
       
  9479 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  9480 	OpenPhoneL();	
       
  9481 	
       
  9482 	RPacketService packetService;
       
  9483     OpenPacketServiceL( packetService,
       
  9484                         RPacketService::EStatusUnattached,
       
  9485                         RPacketService::EAttachWhenNeeded, 123 );
       
  9486     CleanupClosePushL( packetService );
       
  9487         
       
  9488 	RBuf8 data;
       
  9489 	CleanupClosePushL( data );    
       
  9490 	
       
  9491 	RBuf8 expectData;
       
  9492 	CleanupClosePushL( expectData );  
       
  9493 	
       
  9494 	// TEST initialise
       
  9495 	
       
  9496 	// Open new context
       
  9497 	TInfoName contextId1;
       
  9498 	TInfoName contextId2;	
       
  9499 	RPacketMbmsContext mbmsContext1;	
       
  9500 	RPacketMbmsContext mbmsContext2;	
       
  9501 	mbmsContext1.OpenNewContext( packetService, contextId1 );	 
       
  9502 	mbmsContext2.OpenNewContext( packetService, contextId2 );	 
       
  9503 	CleanupClosePushL( mbmsContext1 );	
       
  9504 	CleanupClosePushL( mbmsContext2 );	
       
  9505 		                    
       
  9506 	// initialisation of the both context 
       
  9507 	TInt status = InitMbmsContextL(mbmsContext1, contextId1);
       
  9508 	ASSERT_EQUALS(KErrNone, status);
       
  9509     status = InitMbmsContextL(mbmsContext2, contextId2);
       
  9510 	ASSERT_EQUALS(KErrNone, status);
       
  9511 	
       
  9512 	TInt count(0);
       
  9513 	TInt maxAllowed(0);
       
  9514 	
       
  9515     TRequestStatus requestStatus;
       
  9516     
       
  9517  	// data to and from LTSY
       
  9518  	TMockLtsyData2 < TInt, TInt > expData( count, maxAllowed );
       
  9519 	expData.SerialiseL( expectData );
       
  9520 	
       
  9521  	TMockLtsyData2 < TInt, TInt > outData( count, maxAllowed );
       
  9522 	outData.SerialiseL( data );	
       
  9523 	
       
  9524     //-------------------------------------------------------------------------
       
  9525  	// TEST C, part a; no active and/or receiving contexts
       
  9526  	//-------------------------------------------------------------------------	 
       
  9527        	
       
  9528     packetService.EnumerateMbmsActiveServiceList(requestStatus, count, maxAllowed); 
       
  9529     		
       
  9530     User::WaitForRequest( requestStatus );	
       
  9531 	ASSERT_EQUALS(KErrNone, status);
       
  9532 	ASSERT_EQUALS(0, count);
       
  9533 	ASSERT_EQUALS(123, maxAllowed);
       
  9534 	
       
  9535     //-------------------------------------------------------------------------
       
  9536  	// TEST C, part b; active both contexts
       
  9537  	//------------------------------------------------------------------------- 		
       
  9538 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig1;
       
  9539 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig2;
       
  9540 		
       
  9541 	// activate context 
       
  9542 	status = SetMbmsActiveL(mbmsContext1, contextConfig1, contextId1);	 
       
  9543 	ASSERT_EQUALS(KErrNone, status); 
       
  9544 	
       
  9545 	status = SetMbmsActiveL(mbmsContext2, contextConfig2, contextId2);
       
  9546 	ASSERT_EQUALS(KErrNone, status);
       
  9547             
       
  9548     packetService.EnumerateMbmsActiveServiceList(requestStatus, count, maxAllowed); 
       
  9549        
       
  9550     User::WaitForRequest( requestStatus );	
       
  9551 	ASSERT_EQUALS(KErrNone, status);
       
  9552 	ASSERT_EQUALS(2, count);        
       
  9553 	ASSERT_EQUALS(123, maxAllowed);
       
  9554     //-------------------------------------------------------------------------
       
  9555  	// TEST C, part a; deactivate one context
       
  9556  	//-------------------------------------------------------------------------     	
       
  9557 	status = SetMbmsDeactiveL(mbmsContext2, contextId2);
       
  9558     ASSERT_EQUALS(KErrNone, status);
       
  9559        
       
  9560     packetService.EnumerateMbmsActiveServiceList(requestStatus, count, maxAllowed);  
       
  9561     User::WaitForRequest( requestStatus );
       
  9562       			
       
  9563 	ASSERT_EQUALS(1, count);  	        	   
       
  9564 	ASSERT_EQUALS(123, maxAllowed);
       
  9565  	ASSERT_EQUALS(KErrNone, requestStatus.Int() ); 	 
       
  9566  	
       
  9567     CleanupStack::PopAndDestroy(6); // data, this    
       
  9568     }
       
  9569 
       
  9570 /**
       
  9571 @SYMTestCaseID BA-CTSY-PKTS-PEMASL-0002
       
  9572 @SYMPREQ 1551
       
  9573 @SYMComponent  telephony_ctsy
       
  9574 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketService::EnumerateMbmsActiveServiceList
       
  9575 @SYMTestPriority High
       
  9576 @SYMTestActions Invokes cancelling of RPacketService::EnumerateMbmsActiveServiceList
       
  9577 @SYMTestExpectedResults Pass
       
  9578 @SYMTestType CT
       
  9579 */
       
  9580 void CCTsyPacketServiceFU::TestEnumerateMbmsActiveServiceList0002L()
       
  9581     {
       
  9582     OpenEtelServerL( EUseExtendedError );
       
  9583 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  9584 	OpenPhoneL();	
       
  9585 	
       
  9586 	RPacketService packetService;
       
  9587     OpenPacketServiceL( packetService,
       
  9588                         RPacketService::EStatusUnattached,
       
  9589                         RPacketService::EAttachWhenNeeded, 123 );
       
  9590     CleanupClosePushL( packetService );
       
  9591         
       
  9592 
       
  9593 	//-------------------------------------------------------------------------
       
  9594 	// Test cancelling of RPacketService::EnumerateMbmsActiveServiceList
       
  9595  	//-------------------------------------------------------------------------
       
  9596  	TInt count, maxAllowed;
       
  9597  	TRequestStatus requestStatus;
       
  9598     packetService.EnumerateMbmsActiveServiceList(requestStatus, count, maxAllowed); 
       
  9599 
       
  9600     packetService.CancelAsyncRequest(EPacketEnumerateMbmsActiveServiceList);
       
  9601 		
       
  9602     User::WaitForRequest(requestStatus);
       
  9603 	ASSERT_TRUE((KErrCancel == requestStatus.Int()) || ( KErrNone == requestStatus.Int()));
       
  9604 
       
  9605 	CleanupStack::PopAndDestroy(2); // packetService, this
       
  9606 	
       
  9607 	}
       
  9608     
       
  9609 
       
  9610 /**
       
  9611 @SYMTestCaseID BA-CTSY-MCF-PUMSL-0001
       
  9612 @SYMPREQ 1551
       
  9613 @SYMComponent  telephony_ctsy
       
  9614 @SYMTestCaseDesc Test support in CTSY for RPacketMbmsContext::UpdateMbmsSessionList
       
  9615 @SYMTestPriority High
       
  9616 @SYMTestActions Invokes RPacketMbmsContext::UpdateMbmsSessionList
       
  9617 @SYMTestExpectedResults Pass
       
  9618 @SYMTestType CT
       
  9619 */
       
  9620 void CCTsyPacketServiceFU::TestUpdateMbmsSessionList0001L()
       
  9621     {
       
  9622     OpenEtelServerL( EUseExtendedError );
       
  9623 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  9624 	OpenPhoneL();	
       
  9625 	
       
  9626 	RPacketService packetService;
       
  9627     OpenPacketServiceL( packetService );
       
  9628     CleanupClosePushL( packetService );
       
  9629         
       
  9630 	RBuf8 data;
       
  9631 	CleanupClosePushL( data );    
       
  9632 	
       
  9633 	RBuf8 expectData;
       
  9634 	CleanupClosePushL( expectData );  
       
  9635 	
       
  9636 	// TEST initialise
       
  9637 	
       
  9638 	// Open new context
       
  9639 	TInfoName contextId;	
       
  9640 	RPacketMbmsContext mbmsContext;	
       
  9641 	mbmsContext.OpenNewContext( packetService, contextId );	 
       
  9642 	CleanupClosePushL( mbmsContext );	
       
  9643 		                    
       
  9644 	// initialisation of the context 
       
  9645 	TInt status = InitMbmsContextL(mbmsContext, contextId);
       
  9646 	ASSERT_EQUALS(KErrNone, status);
       
  9647 	
       
  9648 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig;	
       
  9649 	// activate context 
       
  9650 	status = SetMbmsActiveL(mbmsContext, contextConfig, contextId);
       
  9651 	ASSERT_EQUALS(KErrNone, status);
       
  9652 	
       
  9653 	TInt maxSessions( 5 );		
       
  9654     TRequestStatus requestStatus;
       
  9655  
       
  9656     RPacketMbmsContext::CMbmsSession* aSession = RPacketMbmsContext::CMbmsSession::NewL();  
       
  9657     CleanupStack::PushL(aSession);
       
  9658       
       
  9659  	// data to and from LTSY
       
  9660     TMmMbmsActiveServiceListParams params;
       
  9661  
       
  9662  	TMockLtsyData1 <TInfoName> outData( contextId );
       
  9663 	outData.SerialiseL( data );	
       
  9664 	
       
  9665     //-------------------------------------------------------------------------
       
  9666  	// initialise session list
       
  9667  	//-------------------------------------------------------------------------
       
  9668     
       
  9669     for( TInt i = 0; i < maxSessions; i++ )
       
  9670         {
       
  9671         TMbmsSessionId session(i);  
       
  9672      
       
  9673         params.iActionType = EAddEntries;
       
  9674         params.iServiceList = aSession;
       
  9675         params.iChangedItem = session;
       
  9676         
       
  9677      	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams > expData( contextId, params );
       
  9678     	expData.SerialiseL( expectData );
       
  9679        
       
  9680         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);
       
  9681         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data);            
       
  9682         mbmsContext.UpdateMbmsSessionList(requestStatus, EAddEntries, session);    
       
  9683         
       
  9684         User::WaitForRequest( requestStatus );
       
  9685         TInt ret = requestStatus.Int();
       
  9686         ASSERT_EQUALS( KErrNone, ret ) ;
       
  9687         }
       
  9688         
       
  9689     //-------------------------------------------------------------------------
       
  9690  	// create retrievers
       
  9691  	//-------------------------------------------------------------------------        
       
  9692                             
       
  9693 	CFilteringActiveScheduler scheduler;
       
  9694 	CActiveScheduler::Install(&scheduler);    
       
  9695 	
       
  9696     RPacketMbmsContext::CMbmsSession* session = RPacketMbmsContext::CMbmsSession::NewL();  
       
  9697     CleanupStack::PushL(session);	
       
  9698     	
       
  9699 	CRetrievePcktMbmsSessionList* sessionList = CRetrievePcktMbmsSessionList::NewL(mbmsContext, *session);        
       
  9700     CleanupStack::PushL(sessionList);
       
  9701 
       
  9702     CActiveRetriever::ResetRequestsNumber();
       
  9703     CActiveRetriever retriever(*sessionList);
       
  9704     
       
  9705     scheduler.AddRetrieverL(retriever);
       
  9706  
       
  9707     sessionList->Start( retriever.Status() );	 	
       
  9708 	retriever.Activate();
       
  9709 	scheduler.StartScheduler();
       
  9710 
       
  9711 	TInt rstatus = retriever.iStatus.Int();	 
       
  9712 	ASSERT_EQUALS(KErrNone, rstatus);
       
  9713 	
       
  9714     //-------------------------------------------------------------------------
       
  9715  	// TEST C, part a; check existing items
       
  9716  	//-------------------------------------------------------------------------	
       
  9717 	
       
  9718 	for( TUint i = 0; i < session->iSessionIdList.Count(); i++)
       
  9719 	    {
       
  9720 	    TMbmsSessionId sessionId = session->iSessionIdList[i];
       
  9721 	    ASSERT_EQUALS( sessionId, i);	    
       
  9722 	    }
       
  9723 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());	 	
       
  9724  	AssertMockLtsyStatusL();
       
  9725 	
       
  9726     //-------------------------------------------------------------------------
       
  9727  	// TEST C, part b; remove existing items
       
  9728  	//-------------------------------------------------------------------------
       
  9729     
       
  9730     for( TInt i = maxSessions-1; i >= 0; i-- )
       
  9731         {
       
  9732         TMbmsSessionId session(i);  
       
  9733  
       
  9734    		params.iActionType = ERemoveEntries;
       
  9735         params.iServiceList = aSession;
       
  9736         params.iChangedItem = session;
       
  9737        
       
  9738         TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams > expData( contextId, params );
       
  9739    	   	expData.SerialiseL( expectData );
       
  9740               
       
  9741         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);
       
  9742         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data);            
       
  9743         mbmsContext.UpdateMbmsSessionList(requestStatus, ERemoveEntries, session);    
       
  9744         
       
  9745         User::WaitForRequest( requestStatus );
       
  9746         TInt ret = requestStatus.Int();
       
  9747         ASSERT_EQUALS( KErrNone, ret ) ;
       
  9748         } 	
       
  9749         
       
  9750  	sessionList->Start( retriever.Status() );
       
  9751 	retriever.Activate();
       
  9752 	scheduler.StartScheduler();
       
  9753 
       
  9754 	// check status for each retriever
       
  9755 	rstatus = retriever.iStatus.Int();	 
       
  9756 	ASSERT_EQUALS(KErrNotFound, rstatus);
       
  9757 
       
  9758 	
       
  9759     //-------------------------------------------------------------------------
       
  9760  	// TEST C, part c; add new items again
       
  9761  	//-------------------------------------------------------------------------
       
  9762     
       
  9763     for( TInt i = 0; i < maxSessions; i++ )
       
  9764         {
       
  9765         TMbmsSessionId session(i);  
       
  9766         
       
  9767         params.iActionType = EAddEntries;
       
  9768         params.iServiceList = aSession;
       
  9769         params.iChangedItem = session;
       
  9770        
       
  9771         TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams > expData( contextId, params );
       
  9772         expData.SerialiseL( expectData );
       
  9773       
       
  9774         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);
       
  9775         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data);            
       
  9776         mbmsContext.UpdateMbmsSessionList(requestStatus, EAddEntries, session);    
       
  9777         
       
  9778         User::WaitForRequest( requestStatus );
       
  9779         
       
  9780         AssertMockLtsyStatusL();
       
  9781         TInt ret = requestStatus.Int();
       
  9782         ASSERT_EQUALS( KErrNone, ret ) ;
       
  9783         }
       
  9784         
       
  9785     // verify that count is maxSessions        
       
  9786  	sessionList->Start( retriever.Status() );
       
  9787 	retriever.Activate();
       
  9788 	scheduler.StartScheduler();
       
  9789 			
       
  9790 	// there should be a max number of sessions now
       
  9791 	TInt maxCount = session->iSessionIdList.Count();
       
  9792 	ASSERT_EQUALS( maxSessions, maxCount );         
       
  9793         
       
  9794     //-------------------------------------------------------------------------
       
  9795  	// TEST C, part d; then remove all 
       
  9796  	//-------------------------------------------------------------------------        
       
  9797     
       
  9798 	params.iActionType = ERemoveAllEntries;
       
  9799 	params.iServiceList = aSession;
       
  9800 	params.iChangedItem = 0;
       
  9801 	  
       
  9802 	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams > expData( contextId, params );
       
  9803 	expData.SerialiseL( expectData );
       
  9804 	  
       
  9805     // then remove all        
       
  9806     iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);
       
  9807     iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data);            
       
  9808     mbmsContext.UpdateMbmsSessionList(requestStatus, ERemoveAllEntries, 0);    
       
  9809     
       
  9810     User::WaitForRequest( requestStatus );
       
  9811     TInt ret = requestStatus.Int();
       
  9812     ASSERT_EQUALS( KErrNone, ret ) ;  
       
  9813     
       
  9814  	sessionList->Start( retriever.Status() );
       
  9815 	retriever.Activate();
       
  9816 	scheduler.StartScheduler();
       
  9817 	
       
  9818 	// check status for each retriever
       
  9819 	rstatus = retriever.iStatus.Int();	 
       
  9820 	ASSERT_EQUALS(KErrNotFound, rstatus);
       
  9821 			
       
  9822     // Done !  
       
  9823     CActiveScheduler::Install(NULL);      
       
  9824 	CleanupStack::PopAndDestroy(8); //  session, sessionList, retriever     
       
  9825     } 	
       
  9826 
       
  9827 /**
       
  9828 @SYMTestCaseID BA-CTSY-MCF-PUMSL-0002
       
  9829 @SYMPREQ 1551
       
  9830 @SYMComponent  telephony_ctsy
       
  9831 @SYMTestCaseDesc Test support in CTSY for cancelling of RPacketMbmsContext::UpdateMbmsSessionList
       
  9832 @SYMTestPriority High
       
  9833 @SYMTestActions Invokes cancelling of RPacketMbmsContext::UpdateMbmsSessionList
       
  9834 @SYMTestExpectedResults Pass
       
  9835 @SYMTestType CT
       
  9836 */
       
  9837 void CCTsyPacketServiceFU::TestUpdateMbmsSessionList0002L()
       
  9838     {
       
  9839     OpenEtelServerL( EUseExtendedError );
       
  9840 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  9841 	OpenPhoneL();	
       
  9842 	
       
  9843 	RPacketService packetService;
       
  9844     OpenPacketServiceL( packetService );
       
  9845     CleanupClosePushL( packetService );
       
  9846         
       
  9847 	RBuf8 data;
       
  9848 	CleanupClosePushL( data );    
       
  9849 	
       
  9850 	RBuf8 expectData;
       
  9851 	CleanupClosePushL( expectData );  
       
  9852 	
       
  9853 	// TEST initialise
       
  9854 	
       
  9855 	// Open new context
       
  9856 	TInfoName contextId;	
       
  9857 	RPacketMbmsContext mbmsContext;	
       
  9858 	mbmsContext.OpenNewContext( packetService, contextId );	 
       
  9859 	CleanupClosePushL( mbmsContext );	
       
  9860 		                    
       
  9861 	// initialisation of the context 
       
  9862 	TInt status = InitMbmsContextL(mbmsContext, contextId);
       
  9863 	ASSERT_EQUALS(KErrNone, status);
       
  9864 	
       
  9865 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig;	
       
  9866 	contextConfig.iMbmsSessionFlag = ETrue;
       
  9867 	// activate context 
       
  9868 	status = SetMbmsActiveL(mbmsContext, contextConfig, contextId);
       
  9869 	ASSERT_EQUALS(KErrNone, status);
       
  9870 	
       
  9871 	TInt maxSessions( 5 );		
       
  9872     TRequestStatus requestStatus;
       
  9873     
       
  9874     RPacketMbmsContext::CMbmsSession* aSession = RPacketMbmsContext::CMbmsSession::NewL();  
       
  9875     CleanupStack::PushL(aSession);
       
  9876          
       
  9877     	// data to and from LTSY
       
  9878     TMmMbmsActiveServiceListParams params;
       
  9879     
       
  9880     TMockLtsyData1 <TInfoName> outData( contextId );
       
  9881    	outData.SerialiseL( data );	
       
  9882    	
       
  9883     //-------------------------------------------------------------------------
       
  9884 	// initialise session list
       
  9885 	//-------------------------------------------------------------------------
       
  9886    
       
  9887    for( TInt i = 0; i < maxSessions; i++ )
       
  9888        {
       
  9889        TMbmsSessionId session(i);  
       
  9890     
       
  9891        params.iActionType = EAddEntries;
       
  9892        params.iServiceList = aSession;
       
  9893        params.iChangedItem = session;
       
  9894        
       
  9895        TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams > expData( contextId, params );
       
  9896    	   expData.SerialiseL( expectData );
       
  9897       
       
  9898        iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);
       
  9899        iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data);            
       
  9900        mbmsContext.UpdateMbmsSessionList(requestStatus, EAddEntries, session);
       
  9901        // send canceling...
       
  9902        mbmsContext.CancelAsyncRequest(EPacketContextUpdateMbmsSessionList);
       
  9903        
       
  9904        User::WaitForRequest( requestStatus );
       
  9905        TInt ret = requestStatus.Int();
       
  9906        ASSERT_TRUE( ret== KErrCancel || ret == KErrNone ) ;
       
  9907        }
       
  9908         
       
  9909     //-------------------------------------------------------------------------
       
  9910  	// create retrievers
       
  9911  	//-------------------------------------------------------------------------        
       
  9912                             
       
  9913 	CFilteringActiveScheduler scheduler;
       
  9914 	CActiveScheduler::Install(&scheduler);    
       
  9915 	
       
  9916     RPacketMbmsContext::CMbmsSession* session = RPacketMbmsContext::CMbmsSession::NewL();  
       
  9917     CleanupStack::PushL(session);	
       
  9918     	
       
  9919 	CRetrievePcktMbmsSessionList* sessionList = CRetrievePcktMbmsSessionList::NewL(mbmsContext, *session);        
       
  9920     CleanupStack::PushL(sessionList);
       
  9921 
       
  9922     CActiveRetriever::ResetRequestsNumber();
       
  9923     CActiveRetriever retriever(*sessionList);
       
  9924     
       
  9925     scheduler.AddRetrieverL(retriever);		
       
  9926     //-------------------------------------------------------------------------
       
  9927  	// TEST C, part a; check existing items
       
  9928  	//-------------------------------------------------------------------------	
       
  9929 	TRequestStatus mockLtsyStatus;
       
  9930 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  9931 
       
  9932     iMockLTSY.ExpectL(EPacketGetMbmsSessionListCancel, KErrNone);
       
  9933     iMockLTSY.ExpectL(EPacketGetMbmsSessionListPhase1, KErrNone);
       
  9934     iMockLTSY.CompleteL(EPacketGetMbmsSessionListCancel, KErrNone);
       
  9935 
       
  9936     sessionList->Start( retriever.Status() );	 	
       
  9937 	retriever.Activate(CActiveRetriever::ECaseGeneralCancelCase);
       
  9938 	scheduler.StartScheduler();
       
  9939 
       
  9940 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
  9941 	ASSERT_EQUALS(KErrCancel, retriever.iStatus.Int());
       
  9942  	
       
  9943     // Done !  
       
  9944     CActiveScheduler::Install(NULL);      
       
  9945 	CleanupStack::PopAndDestroy(8); //  session, sessionList, retriever     
       
  9946     } 
       
  9947     	
       
  9948 
       
  9949 /**
       
  9950 @SYMTestCaseID BA-CTSY-MCF-PUMSL-0003
       
  9951 @SYMPREQ 1551
       
  9952 @SYMComponent  telephony_ctsy
       
  9953 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RPacketMbmsContext::UpdateMbmsSessionList
       
  9954 @SYMTestPriority High
       
  9955 @SYMTestActions Invokes multiple client requests to RPacketMbmsContext::UpdateMbmsSessionList
       
  9956 @SYMTestExpectedResults Pass
       
  9957 @SYMTestType CT
       
  9958 */
       
  9959 void CCTsyPacketServiceFU::TestUpdateMbmsSessionList0003L()
       
  9960     {
       
  9961     OpenEtelServerL( EUseExtendedError );
       
  9962 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
  9963 	OpenPhoneL();	
       
  9964 	
       
  9965 	RPacketService packetService;
       
  9966     OpenPacketServiceL( packetService,
       
  9967                         RPacketService::EStatusUnattached,
       
  9968                         RPacketService::EAttachWhenNeeded, 
       
  9969                         KMaxNumberMbmsContexts );
       
  9970     CleanupClosePushL( packetService );
       
  9971         
       
  9972     // general buffers 
       
  9973 	RBuf8 data, data1, data2, data3;
       
  9974 	CleanupClosePushL( data ); 	
       
  9975 	CleanupClosePushL( data1 );    
       
  9976 	CleanupClosePushL( data2 );    
       
  9977 	CleanupClosePushL( data3 );   
       
  9978 	
       
  9979 	RBuf8 expectData, expectData1, expectData2, expectData3;
       
  9980 	CleanupClosePushL( expectData ); 
       
  9981 	CleanupClosePushL( expectData1 );  
       
  9982 	CleanupClosePushL( expectData2 );  
       
  9983 	CleanupClosePushL( expectData3 );
       
  9984 	
       
  9985 	// TEST initialise
       
  9986 	
       
  9987 	// Opens and initiliases three contexts;
       
  9988 	// context 1; contains sessions between idStart1 - idEnd1
       
  9989 	// context 2; contains sessions between idStart2 - idEnd2
       
  9990 	// context 3; cannot have any services
       
  9991 	
       
  9992 	TInfoName contextId1, contextId2, contextId3;	
       
  9993 	RPacketMbmsContext mbmsContext1, mbmsContext2, mbmsContext3;	
       
  9994 	
       
  9995 	mbmsContext1.OpenNewContext( packetService, contextId1 );	 
       
  9996 	mbmsContext2.OpenNewContext( packetService, contextId2 );
       
  9997 	mbmsContext3.OpenNewContext( packetService, contextId3 );
       
  9998 	CleanupClosePushL( mbmsContext1 );	
       
  9999 	CleanupClosePushL( mbmsContext2 );	
       
 10000 	CleanupClosePushL( mbmsContext3 );	
       
 10001 		                    
       
 10002 	// initialisation of the contexts
       
 10003 	TInt status = InitMbmsContextL(mbmsContext1, contextId1);
       
 10004 	ASSERT_EQUALS(KErrNone, status);
       
 10005 	AssertMockLtsyStatusL(); 
       
 10006 	status = InitMbmsContextL(mbmsContext2, contextId2);
       
 10007 	ASSERT_EQUALS(KErrNone, status);
       
 10008 	AssertMockLtsyStatusL(); 
       
 10009 	status = InitMbmsContextL(mbmsContext3, contextId3);
       
 10010 	ASSERT_EQUALS(KErrNone, status);
       
 10011 	AssertMockLtsyStatusL(); 
       
 10012 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig1, contextConfig2, contextConfig3;	
       
 10013 	contextConfig1.iMbmsSessionFlag = ETrue;
       
 10014 	contextConfig2.iMbmsSessionFlag = ETrue;
       
 10015 	contextConfig3.iMbmsSessionFlag = EFalse;
       
 10016 	
       
 10017     // configure contexts			
       
 10018 	status = SetMbmsConfigL(mbmsContext1, contextId1, contextConfig1);
       
 10019 	ASSERT_EQUALS(KErrNone, status);
       
 10020 	AssertMockLtsyStatusL(); 			
       
 10021 	status = SetMbmsConfigL(mbmsContext2, contextId2, contextConfig2);
       
 10022 	ASSERT_EQUALS(KErrNone, status);
       
 10023 	AssertMockLtsyStatusL(); 		
       
 10024 	status = SetMbmsConfigL(mbmsContext3, contextId3, contextConfig3);
       
 10025 	ASSERT_EQUALS(KErrNone, status);
       
 10026 	AssertMockLtsyStatusL(); 
       
 10027 	
       
 10028 	// activate contexts 	
       
 10029 	status = SetMbmsActiveL(mbmsContext1, contextConfig1, contextId1);
       
 10030 	ASSERT_EQUALS(KErrNone, status);
       
 10031 	AssertMockLtsyStatusL(); 
       
 10032 	status = SetMbmsActiveL(mbmsContext2, contextConfig2, contextId2);
       
 10033 	ASSERT_EQUALS(KErrNone, status);
       
 10034 	AssertMockLtsyStatusL(); 
       
 10035 	status = SetMbmsActiveL(mbmsContext3, contextConfig3, contextId3);
       
 10036 	ASSERT_EQUALS(KErrNone, status);
       
 10037 	AssertMockLtsyStatusL(); 	
       
 10038 			
       
 10039 	TMbmsSessionId set1[KMaxSessionsInSet1], check1[KMaxSessionsInSet1];
       
 10040 	TMbmsSessionId set2[KMaxSessionsInSet2], check2[KMaxSessionsInSet2];
       
 10041 	TMbmsSessionId set3[KMaxSessionsInSet3];
       
 10042 	TInt tmp = 0;
       
 10043 	for( TInt i = 0; i < KMaxSessionsInSet1; i++ )
       
 10044 	    {
       
 10045 	    set1[i] = check1[i] = tmp;
       
 10046 	    tmp++;
       
 10047 	    }
       
 10048 	tmp = 0;	    
       
 10049 	for( TInt i = 0; i < KMaxSessionsInSet2; i++ )
       
 10050 	    {
       
 10051 	    set2[i] = check2[i] = tmp;
       
 10052 	    tmp++;
       
 10053 	    }
       
 10054 	tmp = 0;
       
 10055 	for( TInt i = 0; i < KMaxSessionsInSet3; i++ )
       
 10056 	    {
       
 10057 	    set3[i] = tmp;
       
 10058 	    tmp++;
       
 10059 	    }	    	    
       
 10060     TRequestStatus requestStatus;
       
 10061 
       
 10062  	TMockLtsyData1 <TInfoName> outData1( contextId1 );
       
 10063  	TMockLtsyData1 <TInfoName> outData2( contextId2 );
       
 10064  	TMockLtsyData1 <TInfoName> outData3( contextId3 );
       
 10065 	outData1.SerialiseL( data1 );	
       
 10066 	outData2.SerialiseL( data2 );	
       
 10067 	outData3.SerialiseL( data3 );	
       
 10068 	
       
 10069     //-------------------------------------------------------------------------
       
 10070  	// initialise session list
       
 10071  	//-------------------------------------------------------------------------
       
 10072     RPacketMbmsContext::CMbmsSession* mbmsSession = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10073     CleanupStack::PushL(mbmsSession);
       
 10074     
       
 10075     TMmMbmsActiveServiceListParams params;
       
 10076     params.iActionType = EAddEntries;
       
 10077  	params.iServiceList = mbmsSession;
       
 10078  	
       
 10079     for( TMbmsSessionId i = 0; i < KMaxSessionsInSet1; i++ )
       
 10080         {
       
 10081      	params.iChangedItem = set1[i];
       
 10082      	
       
 10083      	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams> expData1( contextId1, params );
       
 10084      	expData1.SerialiseL(expectData1); 
       
 10085     	
       
 10086         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData1);
       
 10087         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data1);            
       
 10088         mbmsContext1.UpdateMbmsSessionList(requestStatus, EAddEntries, set1[i]);    
       
 10089         
       
 10090         User::WaitForRequest( requestStatus );
       
 10091         ASSERT_EQUALS( KErrNone, requestStatus.Int() ) ;   
       
 10092         }
       
 10093     
       
 10094     for( TMbmsSessionId i = 0; i < KMaxSessionsInSet2; i++ )
       
 10095         {
       
 10096      	params.iChangedItem = set2[i];
       
 10097      	
       
 10098      	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams> expData2( contextId2, params );
       
 10099      	expData2.SerialiseL(expectData2); 
       
 10100      	
       
 10101         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData2);
       
 10102         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data2);            
       
 10103         mbmsContext2.UpdateMbmsSessionList(requestStatus, EAddEntries, set2[i]);    
       
 10104         
       
 10105         User::WaitForRequest( requestStatus );
       
 10106         ASSERT_EQUALS( KErrNone, requestStatus.Int() ) ;
       
 10107         }
       
 10108         
       
 10109     for( TMbmsSessionId i = 0; i < KMaxSessionsInSet3; i++ )
       
 10110         {
       
 10111      	params.iChangedItem = set3[i];
       
 10112      	
       
 10113      	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams> expData3( contextId3, params );
       
 10114      	expData3.SerialiseL(expectData3); 
       
 10115      	
       
 10116         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNotSupported/*, data3*/);            
       
 10117         mbmsContext3.UpdateMbmsSessionList(requestStatus, EAddEntries, set3[i]);    
       
 10118         
       
 10119         User::WaitForRequest( requestStatus );        
       
 10120         ASSERT_EQUALS( KErrNotSupported, requestStatus.Int() ) ;
       
 10121         }        
       
 10122                 
       
 10123     //-------------------------------------------------------------------------
       
 10124  	// create retrievers
       
 10125  	//-------------------------------------------------------------------------        
       
 10126                             
       
 10127 	CFilteringActiveScheduler scheduler;
       
 10128 	CActiveScheduler::Install(&scheduler);    
       
 10129 	
       
 10130     RPacketMbmsContext::CMbmsSession* aSession1 = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10131     RPacketMbmsContext::CMbmsSession* aSession2 = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10132     RPacketMbmsContext::CMbmsSession* aSession3 = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10133     CleanupStack::PushL(aSession1);	
       
 10134     CleanupStack::PushL(aSession2);
       
 10135     CleanupStack::PushL(aSession3);
       
 10136     	
       
 10137 	CRetrievePcktMbmsSessionList* aSessionlist1 = CRetrievePcktMbmsSessionList::NewL(mbmsContext1, *aSession1);        
       
 10138 	CRetrievePcktMbmsSessionList* aSessionlist2 = CRetrievePcktMbmsSessionList::NewL(mbmsContext2, *aSession2);
       
 10139 	CRetrievePcktMbmsSessionList* aSessionlist3 = CRetrievePcktMbmsSessionList::NewL(mbmsContext3, *aSession3);
       
 10140     CleanupStack::PushL(aSessionlist1);
       
 10141     CleanupStack::PushL(aSessionlist2);
       
 10142     CleanupStack::PushL(aSessionlist3);
       
 10143 
       
 10144     CActiveRetriever::ResetRequestsNumber();
       
 10145     CActiveRetriever retriever1(*aSessionlist1);
       
 10146     CActiveRetriever retriever2(*aSessionlist2);
       
 10147     CActiveRetriever retriever3(*aSessionlist3);
       
 10148     
       
 10149     scheduler.AddRetrieverL(retriever1);
       
 10150     scheduler.AddRetrieverL(retriever2);
       
 10151     scheduler.AddRetrieverL(retriever3);
       
 10152  
       
 10153     aSessionlist1->Start( retriever1.Status() );	 	
       
 10154 	retriever1.Activate();
       
 10155 	scheduler.StartScheduler();
       
 10156 
       
 10157     aSessionlist2->Start( retriever2.Status() );	 	
       
 10158 	retriever2.Activate();
       
 10159 	scheduler.StartScheduler();
       
 10160 	
       
 10161     aSessionlist3->Start( retriever3.Status() );	 	
       
 10162 	retriever3.Activate();
       
 10163 	scheduler.StartScheduler();	
       
 10164 	
       
 10165 	// check status for each retriever
       
 10166 	TInt rstatus = retriever1.iStatus.Int();	 
       
 10167 	ASSERT_EQUALS(KErrNone, rstatus);
       
 10168     rstatus = retriever2.iStatus.Int();	 
       
 10169 	ASSERT_EQUALS(KErrNone, rstatus);		
       
 10170 	rstatus = retriever3.iStatus.Int();	 
       
 10171 	ASSERT_EQUALS(KErrNotFound, rstatus);
       
 10172 
       
 10173     //-------------------------------------------------------------------------
       
 10174  	// TEST C, part a; check existing items for each contexts
       
 10175  	//-------------------------------------------------------------------------	
       
 10176     TBool passed(ETrue);
       
 10177     
       
 10178 	for( TUint i = 0; i < KMaxSessionsInSet1; i++)
       
 10179 	    {
       
 10180 	    passed &= contains(aSession1->iSessionIdList[i], check1);
       
 10181 	    }
       
 10182 	    
       
 10183 	for( TUint i = 0; i < KMaxSessionsInSet2; i++)
       
 10184 	    {
       
 10185 	    passed &= contains(aSession2->iSessionIdList[i], check2);
       
 10186 	    }	    
       
 10187 	    
       
 10188     // context 3 does not have any sessions
       
 10189     ASSERT_TRUE(passed);	    
       
 10190 	
       
 10191     //-------------------------------------------------------------------------
       
 10192  	// TEST C, part b; remove second items for each contexts
       
 10193  	//-------------------------------------------------------------------------	  	
       
 10194     TMbmsSessionId removedID1, removedID2;
       
 10195     
       
 10196     // update context 1
       
 10197     removedID1 = aSession1->iSessionIdList[1]; 
       
 10198 
       
 10199     params.iActionType = ERemoveEntries;
       
 10200  	params.iServiceList = aSession1;
       
 10201  	params.iChangedItem = removedID1;
       
 10202  	
       
 10203  	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams> expData1( contextId1, params );
       
 10204  	expectData1.Close();
       
 10205  	expData1.SerialiseL(expectData1); 
       
 10206 	
       
 10207     
       
 10208     iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData1);
       
 10209     iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data1);            
       
 10210     mbmsContext1.UpdateMbmsSessionList(requestStatus, ERemoveEntries, removedID1);    
       
 10211     
       
 10212     User::WaitForRequest( requestStatus );   
       
 10213     ASSERT_EQUALS( KErrNone, requestStatus.Int() );  
       
 10214     AssertMockLtsyStatusL();  
       
 10215     
       
 10216     removedID2 = aSession2->iSessionIdList[1];
       
 10217  
       
 10218     params.iActionType = ERemoveEntries;
       
 10219  	params.iServiceList = aSession2;
       
 10220  	params.iChangedItem = removedID2;
       
 10221  	
       
 10222  	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams> expData2( contextId2, params );
       
 10223  	expectData2.Close();
       
 10224  	expData2.SerialiseL(expectData2); 
       
 10225     
       
 10226     iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData2);
       
 10227     iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data2);            
       
 10228     mbmsContext2.UpdateMbmsSessionList(requestStatus, ERemoveEntries, removedID2);    
       
 10229     
       
 10230     User::WaitForRequest( requestStatus );    
       
 10231     ASSERT_EQUALS( KErrNone, requestStatus.Int() );  
       
 10232     AssertMockLtsyStatusL();      
       
 10233     
       
 10234     // calculate total number of session (should be total max -2)
       
 10235     aSessionlist1->Start( retriever1.Status() );	 	
       
 10236 	retriever1.Activate();
       
 10237 	scheduler.StartScheduler();
       
 10238 
       
 10239     aSessionlist2->Start( retriever2.Status() );	 	
       
 10240 	retriever2.Activate();
       
 10241 	scheduler.StartScheduler();    
       
 10242     
       
 10243     TInt diff = KMaxSessionsInSet1 + KMaxSessionsInSet2 - 2;
       
 10244     diff -= aSession1->iSessionIdList.Count();
       
 10245     diff -= aSession2->iSessionIdList.Count();
       
 10246     
       
 10247     ASSERT_EQUALS(KZero, diff);
       
 10248     
       
 10249     // and verify that removed items are not in session lists
       
 10250 	passed = ! contains(removedID1, aSession1->iSessionIdList);	    	    
       
 10251 	passed &= ! contains(removedID2, aSession2->iSessionIdList);	   	    
       
 10252 	    
       
 10253     // difference should be 0 right now
       
 10254     ASSERT_TRUE(passed); 
       
 10255     
       
 10256     //-------------------------------------------------------------------------
       
 10257  	// TEST C, part c; test max number of context/services
       
 10258  	//-------------------------------------------------------------------------	       
       
 10259     TInt fillRet = KErrNone, newContexts;
       
 10260     	    	
       
 10261     newContexts = 0;    	    	
       
 10262     while( KErrNone == fillRet )
       
 10263         {
       
 10264 	    TInfoName contextId;	
       
 10265 	    RPacketMbmsContext mbmsContext;	
       
 10266 	    
       
 10267 	
       
 10268 	    fillRet = mbmsContext.OpenNewContext( packetService, contextId );	 
       
 10269     	CleanupClosePushL( mbmsContext );
       
 10270     	newContexts++;
       
 10271     		
       
 10272         TMockLtsyData1 <TInfoName> outData( contextId );
       
 10273     	outData.SerialiseL( data );
       
 10274         
       
 10275     	if( KErrNone == fillRet )
       
 10276     	    {
       
 10277     	    // allow session
       
 10278 	        RPacketMbmsContext::TContextConfigMbmsV1 contextConfig;	
       
 10279 	        contextConfig.iMbmsSessionFlag = ETrue;
       
 10280 	            	    
       
 10281     	    // init a new context
       
 10282     	    status = InitMbmsContextL(mbmsContext, contextId);
       
 10283 	        ASSERT_EQUALS(KErrNone, status);
       
 10284 	        AssertMockLtsyStatusL(); 
       
 10285 	        
       
 10286         	// activate contexts 	
       
 10287         	status = SetMbmsActiveL(mbmsContext, contextConfig, contextId);
       
 10288         	if( KErrNone == status )
       
 10289         	    {        	            	    
       
 10290             	// insert one service for each context
       
 10291             	TMbmsSessionId session(1);
       
 10292             	
       
 10293                 params.iActionType = EAddEntries;
       
 10294                 params.iServiceList = mbmsSession;
       
 10295                 params.iChangedItem = session;
       
 10296                
       
 10297                 TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams > expData( contextId, params );
       
 10298                 expectData.Close();
       
 10299                 expData.SerialiseL( expectData );
       
 10300             	
       
 10301                 iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);
       
 10302                 iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, data);            
       
 10303                 mbmsContext.UpdateMbmsSessionList(requestStatus, EAddEntries, session);  
       
 10304                   
       
 10305                 User::WaitForRequest( requestStatus );          
       
 10306                 if (KErrNone != requestStatus.Int())
       
 10307                 	{
       
 10308                 	fillRet = requestStatus.Int();	
       
 10309                 	}
       
 10310         	    }
       
 10311         	else
       
 10312         	    {
       
 10313         	    fillRet = status; 
       
 10314         	    }
       
 10315     	    }        
       
 10316         }
       
 10317         
       
 10318     // now active context number should be equals as KMaxNumberMbmsContexts
       
 10319     TInt fullCount, maxAllowed;
       
 10320     packetService.EnumerateMbmsActiveServiceList(requestStatus, fullCount, maxAllowed); 
       
 10321        
       
 10322     User::WaitForRequest( requestStatus );	
       
 10323 	ASSERT_EQUALS(KErrNone, status);    
       
 10324 	ASSERT_EQUALS(KMaxNumberMbmsContexts, fullCount); 
       
 10325 	ASSERT_EQUALS(KMaxNumberMbmsContexts, maxAllowed); 
       
 10326     
       
 10327     CActiveScheduler::Install(NULL);      
       
 10328 	CleanupStack::PopAndDestroy(20 + newContexts); //  session, sessionList, retriever     
       
 10329     } 
       
 10330     
       
 10331 /**
       
 10332 @SYMTestCaseID BA-CTSY-MCF-PUMSL-0005
       
 10333 @SYMComponent  telephony_ctsy
       
 10334 @SYMTestCaseDesc Test support in CTSY for RPacketMbmsContext::UpdateMbmsSessionList with timeout
       
 10335 @SYMTestPriority High
       
 10336 @SYMTestActions Invokes RPacketMbmsContext::UpdateMbmsSessionList and tests for timeout
       
 10337 @SYMTestExpectedResults Pass
       
 10338 @SYMTestType CT
       
 10339 */
       
 10340 void CCTsyPacketServiceFU::TestUpdateMbmsSessionList0005L()
       
 10341     {
       
 10342     OpenEtelServerL( EUseExtendedError );
       
 10343 	CleanupStack::PushL( TCleanupItem( Cleanup, this ) );
       
 10344 	OpenPhoneL();	
       
 10345 	
       
 10346 	RPacketService packetService;
       
 10347     OpenPacketServiceL( packetService );
       
 10348     CleanupClosePushL( packetService );
       
 10349 	
       
 10350 	RBuf8 expectData;
       
 10351 	CleanupClosePushL( expectData );  
       
 10352 	
       
 10353 	// Open new context
       
 10354 	TInfoName contextId;	
       
 10355 	RPacketMbmsContext mbmsContext;	
       
 10356 	mbmsContext.OpenNewContext( packetService, contextId );	 
       
 10357 	CleanupClosePushL( mbmsContext );	
       
 10358 		                    
       
 10359 	
       
 10360 	// initialisation of the context 
       
 10361 	TInt status = InitMbmsContextL(mbmsContext, contextId);
       
 10362 	ASSERT_EQUALS(KErrNone, status);
       
 10363 	
       
 10364 	RPacketMbmsContext::TContextConfigMbmsV1 contextConfig;	
       
 10365 	contextConfig.iMbmsSessionFlag = ETrue;
       
 10366 	
       
 10367 	// activate context 
       
 10368 	status = SetMbmsActiveL(mbmsContext, contextConfig, contextId);
       
 10369 	ASSERT_EQUALS(KErrNone, status);
       
 10370 			
       
 10371     TRequestStatus requestStatus;
       
 10372 
       
 10373     RPacketMbmsContext::CMbmsSession* mbmsSession = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10374     CleanupStack::PushL(mbmsSession);
       
 10375 
       
 10376     TMbmsSessionId session(0);  
       
 10377      
       
 10378     TMmMbmsActiveServiceListParams params;
       
 10379     params.iActionType = EAddEntries;
       
 10380 	params.iServiceList = mbmsSession;
       
 10381 	params.iChangedItem = session;
       
 10382 	
       
 10383 	TMockLtsyData2 <TInfoName, TMmMbmsActiveServiceListParams> expData( contextId, params );
       
 10384 	expData.SerialiseL(expectData); 
       
 10385     
       
 10386     iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, expectData);            
       
 10387     mbmsContext.UpdateMbmsSessionList(requestStatus, EAddEntries, session);    
       
 10388     User::WaitForRequest(requestStatus);
       
 10389     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
 10390 
       
 10391 	AssertMockLtsyStatusL();
       
 10392 	CleanupStack::PopAndDestroy(5, this); // mbmsSession, mbmsContext, expactData, packetService, this   
       
 10393 	 
       
 10394     }
       
 10395 
       
 10396 /**
       
 10397 @SYMTestCaseID BA-CTSY-PKTS-PMSLS-0001
       
 10398 @SYMPREQ 1551
       
 10399 @SYMComponent  telephony_ctsy
       
 10400 @SYMTestCaseDesc Test support in CTSY for CRetrievePcktMbmsSessionList::Start
       
 10401 @SYMTestPriority High
       
 10402 @SYMTestActions Invokes CRetrievePcktMbmsSessionList::Start
       
 10403 @SYMTestExpectedResults Pass
       
 10404 @SYMTestType CT
       
 10405 */
       
 10406 void CCTsyPacketServiceFU::TestRetrievePcktMbmsSessionListStart0001L()
       
 10407 	{
       
 10408 
       
 10409 	OpenEtelServerL(EUseExtendedError);
       
 10410 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10411 	OpenPhoneL();
       
 10412 
       
 10413 	RBuf8 reqData;
       
 10414 	CleanupClosePushL(reqData);
       
 10415 
       
 10416 
       
 10417 	RPacketService packetService;
       
 10418     OpenPacketServiceL( packetService );
       
 10419     CleanupClosePushL( packetService );
       
 10420 
       
 10421     // Open new context
       
 10422 	TInfoName contextId;	
       
 10423 	RPacketMbmsContext mbmsContext;	
       
 10424 	mbmsContext.OpenNewContext( packetService, contextId );	 
       
 10425 	CleanupClosePushL( mbmsContext );	
       
 10426 
       
 10427     RPacketMbmsContext::CMbmsSession* session = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10428     CleanupStack::PushL(session);	
       
 10429 
       
 10430 	CFilteringActiveScheduler scheduler;
       
 10431 	CActiveScheduler::Install(&scheduler);
       
 10432 
       
 10433     CRetrievePcktMbmsSessionList* asyncRetrieveList = CRetrievePcktMbmsSessionList::NewL(mbmsContext, *session);    
       
 10434 	CleanupStack::PushL(asyncRetrieveList);
       
 10435 
       
 10436 	CActiveRetriever::ResetRequestsNumber();
       
 10437 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*asyncRetrieveList);
       
 10438 	CleanupStack::PushL(activeRetriever);
       
 10439 	
       
 10440 	scheduler.AddRetrieverL(*activeRetriever);
       
 10441 
       
 10442     // Set a list
       
 10443     TMbmsSessionIdList sessions;
       
 10444     CleanupClosePushL( sessions );
       
 10445     sessions.Append(20);
       
 10446     sessions.Append(4);
       
 10447     sessions.Append(13);
       
 10448     sessions.Append(17);
       
 10449     sessions.Append(5);
       
 10450     sessions.Append(1);
       
 10451     sessions.Append(112);
       
 10452 	TRequestStatus reqStatus;
       
 10453 	RPacketMbmsContext::CMbmsSession *serverSessions = RPacketMbmsContext::CMbmsSession::NewL();
       
 10454 	CleanupStack::PushL(serverSessions);
       
 10455     for(TInt i = 0; i < sessions.Count(); ++i)
       
 10456         {
       
 10457         TMmMbmsActiveServiceListParams expectedData;
       
 10458         expectedData.iActionType = EAddEntries;
       
 10459         expectedData.iServiceList = serverSessions;
       
 10460         expectedData.iChangedItem = sessions[i];
       
 10461         reqData.Close();
       
 10462         TMockLtsyData2<TInfoName, TMmMbmsActiveServiceListParams>  expLtsyData(contextId, expectedData);
       
 10463         expLtsyData.SerialiseL(reqData);
       
 10464         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, reqData);
       
 10465         mbmsContext.UpdateMbmsSessionList(reqStatus, EAddEntries, sessions[i]);
       
 10466         TMockLtsyData1<TInfoName>  completeLtsyData(contextId);
       
 10467         reqData.Close();
       
 10468         completeLtsyData.SerialiseL(reqData);
       
 10469         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, reqData);
       
 10470         User::WaitForRequest( reqStatus );
       
 10471         ASSERT_EQUALS( KErrNone, reqStatus.Int() ) ;
       
 10472         serverSessions->iSessionIdList.Append( sessions[i] );
       
 10473         }
       
 10474         
       
 10475 
       
 10476  	//-------------------------------------------------------------------------
       
 10477 	// TEST C: Successful completion request of
       
 10478 	// CRetrievePcktMbmsSessionList::Start
       
 10479  	//-------------------------------------------------------------------------
       
 10480 
       
 10481 	asyncRetrieveList->Start(activeRetriever->iStatus);
       
 10482 	activeRetriever->Activate();
       
 10483 	scheduler.StartScheduler();
       
 10484 
       
 10485 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
 10486 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
 10487 	//asyncRetrieveList->RestoreListL();
       
 10488     ASSERT_EQUALS(sessions.Count(), session->iSessionIdList.Count());
       
 10489     for(TInt i = 0; i < sessions.Count(); ++i)
       
 10490         {
       
 10491         ASSERT_EQUALS(sessions[i], session->iSessionIdList[i]);
       
 10492         }
       
 10493 
       
 10494     AssertMockLtsyStatusL();
       
 10495     CleanupStack::PopAndDestroy(9, this); // this, reqData, packetService, mbmsContext, session, asyncRetrieveList, activeRetriever, sessions, serverSessions
       
 10496 	}
       
 10497 /**
       
 10498 @SYMTestCaseID BA-CTSY-PKTS-PMSLS-0002
       
 10499 @SYMPREQ 1551
       
 10500 @SYMComponent  telephony_ctsy
       
 10501 @SYMTestCaseDesc Test support in CTSY for cancelling of CRetrievePcktMbmsSessionList::Start
       
 10502 @SYMTestPriority High
       
 10503 @SYMTestActions Invokes cancelling of CRetrievePcktMbmsSessionList::Start
       
 10504 @SYMTestExpectedResults Pass
       
 10505 @SYMTestType CT
       
 10506 */
       
 10507 void CCTsyPacketServiceFU::TestRetrievePcktMbmsSessionListStart0002L()
       
 10508 	{
       
 10509 
       
 10510 	OpenEtelServerL(EUseExtendedError);
       
 10511 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10512 	OpenPhoneL();
       
 10513 
       
 10514 	RBuf8 reqData;
       
 10515 	CleanupClosePushL(reqData);
       
 10516 
       
 10517 
       
 10518 	RPacketService packetService;
       
 10519     OpenPacketServiceL( packetService );
       
 10520     CleanupClosePushL( packetService );
       
 10521 
       
 10522     // Open new context
       
 10523 	TInfoName contextId;	
       
 10524 	RPacketMbmsContext mbmsContext;	
       
 10525 	mbmsContext.OpenNewContext( packetService, contextId );	 
       
 10526 	CleanupClosePushL( mbmsContext );	
       
 10527 
       
 10528     RPacketMbmsContext::CMbmsSession* session = RPacketMbmsContext::CMbmsSession::NewL();  
       
 10529     CleanupStack::PushL(session);	
       
 10530 
       
 10531 	CFilteringActiveScheduler scheduler;
       
 10532 	CActiveScheduler::Install(&scheduler);
       
 10533 
       
 10534     CRetrievePcktMbmsSessionList* asyncRetrieveList = CRetrievePcktMbmsSessionList::NewL(mbmsContext, *session);    
       
 10535 	CleanupStack::PushL(asyncRetrieveList);
       
 10536 
       
 10537 	CActiveRetriever::ResetRequestsNumber();
       
 10538 	CActiveRetriever* activeRetriever = CActiveRetriever::NewL(*asyncRetrieveList);
       
 10539 	CleanupStack::PushL(activeRetriever);
       
 10540 	
       
 10541 	scheduler.AddRetrieverL(*activeRetriever);
       
 10542 
       
 10543     // Set a list
       
 10544     TMbmsSessionIdList sessions;
       
 10545     CleanupClosePushL( sessions );
       
 10546     sessions.Append(20);
       
 10547     sessions.Append(4);
       
 10548     sessions.Append(13);
       
 10549     sessions.Append(17);
       
 10550     sessions.Append(5);
       
 10551     sessions.Append(1);
       
 10552     sessions.Append(112);
       
 10553 	TRequestStatus reqStatus;
       
 10554 	RPacketMbmsContext::CMbmsSession *serverSessions = RPacketMbmsContext::CMbmsSession::NewL();
       
 10555 	CleanupStack::PushL(serverSessions);
       
 10556     for(TInt i = 0; i < sessions.Count(); ++i)
       
 10557         {
       
 10558         TMmMbmsActiveServiceListParams expectedData;
       
 10559         expectedData.iActionType = EAddEntries;
       
 10560         expectedData.iServiceList = serverSessions;
       
 10561         expectedData.iChangedItem = sessions[i];
       
 10562         reqData.Close();
       
 10563         TMockLtsyData2<TInfoName, TMmMbmsActiveServiceListParams>  expLtsyData(contextId, expectedData);
       
 10564         expLtsyData.SerialiseL(reqData);
       
 10565         iMockLTSY.ExpectL(EPacketContextUpdateMbmsSessionList, reqData);
       
 10566         mbmsContext.UpdateMbmsSessionList(reqStatus, EAddEntries, sessions[i]);
       
 10567         TMockLtsyData1<TInfoName>  completeLtsyData(contextId);
       
 10568         reqData.Close();
       
 10569         completeLtsyData.SerialiseL(reqData);
       
 10570         iMockLTSY.CompleteL(EPacketContextUpdateMbmsSessionList, KErrNone, reqData);
       
 10571         User::WaitForRequest( reqStatus );
       
 10572         ASSERT_EQUALS( KErrNone, reqStatus.Int() ) ;
       
 10573         serverSessions->iSessionIdList.Append( sessions[i] );
       
 10574         }
       
 10575         
       
 10576 
       
 10577  	//-------------------------------------------------------------------------
       
 10578 	// Test cancelling of CRetrievePcktMbmsSessionList::Start
       
 10579  	//-------------------------------------------------------------------------
       
 10580 	asyncRetrieveList->Start(activeRetriever->iStatus);
       
 10581 	activeRetriever->Activate();
       
 10582 	asyncRetrieveList->Cancel();
       
 10583 	scheduler.StartScheduler();
       
 10584 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
 10585 	ASSERT_EQUALS(KErrCancel, activeRetriever->Status().Int())
       
 10586 	
       
 10587 	AssertMockLtsyStatusL();
       
 10588 	
       
 10589 	CActiveScheduler::Install(NULL);
       
 10590 	CleanupStack::PopAndDestroy(9); 
       
 10591 	
       
 10592 	}
       
 10593 
       
 10594 /**
       
 10595 A small helper class to check if SessionId is defined array
       
 10596 */    
       
 10597 TBool CCTsyPacketServiceFU::contains( TUint item, TUint* array)
       
 10598     {   
       
 10599     while( array )
       
 10600         {
       
 10601         if( item == *array )
       
 10602             {
       
 10603             return ETrue;            
       
 10604             }
       
 10605         array++;
       
 10606         }
       
 10607     return EFalse;
       
 10608     }
       
 10609 
       
 10610 TBool CCTsyPacketServiceFU::contains( TUint item, const RArray<TUint> &array )
       
 10611     {   
       
 10612     for( TInt i = 0; i < array.Count(); i++ )
       
 10613     if( item == array[i] )
       
 10614         {
       
 10615         return ETrue;            
       
 10616         }
       
 10617     return EFalse;
       
 10618     }