telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/cctsycallcontrolfu.cpp
changeset 0 3553901f7fa8
child 14 7ef16719d8cb
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The TEFUnit test suite for CallControlControl in the Common TSY.
       
    15 //
       
    16 
       
    17 
       
    18 
       
    19 #include "cctsycallcontrolfu.h"
       
    20 #include "isvao.h"
       
    21 
       
    22 #include <etel.h>
       
    23 #include <etelmm.h>
       
    24 #include <et_clsvr.h>
       
    25 #include <ctsy/mmtsy_names.h>
       
    26 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    27 #include <test/tmockltsydata.h>
       
    28 #include <ctsy/ltsy/mltsydispatchcallcontrolinterface.h>
       
    29 #include "testconstants.h"
       
    30 
       
    31 #include "mockltsyindicatorids.h"
       
    32 #include <sacls.h> // For phone power P&S key needed by Etel3rdParty testing
       
    33 #include <e32property.h>
       
    34 #include <ctsy/rmmcustomapi.h>
       
    35 #include <centralrepository.h>
       
    36 
       
    37 CTestSuite* CCTsyCallControlFU::CreateSuiteL(const TDesC& aName)
       
    38 	{
       
    39 	SUB_SUITE;
       
    40 
       
    41 	// Add use-case tests
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0001L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0002L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0003L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0004L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0005L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0006L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0007L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0008L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0009L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0010L);
       
    52 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0011L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0012L);
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0013L);
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0014L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0015L);
       
    57 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0016L);
       
    58 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0017L);
       
    59 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0018L);
       
    60 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0019L);
       
    61 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0020L);
       
    62 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0021L);
       
    63 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0022L);
       
    64 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0023L);
       
    65 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0024L);
       
    66 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUseCase0025L);
       
    67 
       
    68 	// Add other unit tests
       
    69 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0001L);
       
    70 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0002L);
       
    71 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0003L);
       
    72 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0004L);
       
    73 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0005L);
       
    74 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0006L);
       
    75 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0007L);
       
    76 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0008L);
       
    77 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0009L);
       
    78 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0010L);
       
    79 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0011L);
       
    80 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0012L);
       
    81 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0013L);
       
    82 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0014L);
       
    83 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0015L);
       
    84 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0016L);
       
    85 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0017L);
       
    86 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0018L);
       
    87 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0019L);
       
    88 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0020L);
       
    89 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUnit0021L);
       
    90 
       
    91 
       
    92 	END_SUITE;
       
    93 	}
       
    94 
       
    95 
       
    96 //
       
    97 // Use-case tests
       
    98 //
       
    99 
       
   100 /**
       
   101 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0001
       
   102 @SYMComponent telephony_ctsy
       
   103 @SYMTestCaseDesc Test support in CTSY for mobile originated voice call accepted and hang up
       
   104 @SYMTestPriority High
       
   105 @SYMTestActions Make a voice call, receive status change notifications, hang up
       
   106 @SYMTestExpectedResults Pass - Call reaches connected state and call is hung up
       
   107 @SYMTestType CT
       
   108 */
       
   109 void CCTsyCallControlFU::TestUseCase0001L()
       
   110 	{
       
   111 	OpenEtelServerL(EUseExtendedError);
       
   112 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   113 	OpenPhoneL();
       
   114 
       
   115 	TRequestStatus reqStatus;
       
   116 	iMockLTSY.NotifyTerminated(reqStatus); 
       
   117 	
       
   118 	TInt callId = 1;
       
   119 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   120 	DriverDialCallL(callId, mobileService);
       
   121 
       
   122 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
   123 	DriverHangUpCallL(callId, hangUpCause);
       
   124 
       
   125 	// Client Side Test
       
   126 
       
   127 	RMobileLine mobileLine;
       
   128 	CleanupClosePushL(mobileLine);
       
   129 	RMobileCall mobileCall;
       
   130 	CleanupClosePushL(mobileCall);
       
   131 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
   132 
       
   133 	ClientHangUpCallL(mobileCall);
       
   134 
       
   135 	mobileCall.Close();
       
   136 	mobileLine.Close();
       
   137 
       
   138 	User::WaitForRequest(reqStatus);
       
   139 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   140 	
       
   141 	AssertMockLtsyStatusL();
       
   142 	CleanupStack::PopAndDestroy(3, this); //mobileCall, mobileLine, this
       
   143 	} // CCTsyCallControlFU::TestUseCase0001L
       
   144 
       
   145 
       
   146 /**
       
   147 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0002
       
   148 @SYMComponent telephony_ctsy
       
   149 @SYMTestCaseDesc Test support in CTSY for failed dialling of a mobile originated call
       
   150 @SYMTestPriority High
       
   151 @SYMTestActions Dials a voice call, receives error from LTSY
       
   152 @SYMTestExpectedResults Pass - Dial request fails
       
   153 @SYMTestType CT
       
   154 */
       
   155 void CCTsyCallControlFU::TestUseCase0002L()
       
   156 	{
       
   157 	OpenEtelServerL(EUseExtendedError);
       
   158 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   159 	OpenPhoneL();
       
   160 
       
   161 	RBuf8 data;
       
   162 	CleanupClosePushL(data);
       
   163 
       
   164 	TInt callId = 1;
       
   165 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   166 	DriverExpectDialCallRequestL(callId, mobileService, KErrGeneral);
       
   167 
       
   168 	// Client Side Test
       
   169 
       
   170 	RMobileLine mobileLine;
       
   171 	CleanupClosePushL(mobileLine);
       
   172 	RMobileCall mobileCall;
       
   173 	CleanupClosePushL(mobileCall);
       
   174 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   175 
       
   176 	RMobileCall::TMobileCallParamsV1 callParams;
       
   177 	RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams);
       
   178 	callParams.iAutoRedial = ETrue;
       
   179 	callParams.iIdRestrict = RMobileCall::ESendMyId;
       
   180 	TRequestStatus dialStatus;
       
   181 	mobileCall.Dial(dialStatus, callParamsPckg, KPhoneNumber);
       
   182 	User::WaitForRequest(dialStatus);
       
   183 	ASSERT_EQUALS(KErrGeneral, dialStatus.Int());
       
   184 
       
   185 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown;
       
   186 	mobileCall.GetMobileCallStatus(callStatus);
       
   187 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
   188 
       
   189 	mobileCall.Close();
       
   190 	mobileLine.Close();
       
   191 	data.Close();
       
   192 
       
   193 	AssertMockLtsyStatusL();
       
   194 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
   195 	} // CCTsyCallControlFU::TestUseCase0002L
       
   196 
       
   197 
       
   198 /**
       
   199 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0003
       
   200 @SYMComponent telephony_ctsy
       
   201 @SYMTestCaseDesc Test support in CTSY for remote party rejecting a dialled call
       
   202 @SYMTestPriority High
       
   203 @SYMTestActions Dials a call, remote party rejects it, check call status and notifications are correct
       
   204 @SYMTestExpectedResults Pass
       
   205 @SYMTestType CT
       
   206 */
       
   207 void CCTsyCallControlFU::TestUseCase0003L()
       
   208 	{
       
   209 	OpenEtelServerL(EUseExtendedError);
       
   210 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   211 	OpenPhoneL();
       
   212 
       
   213 	RBuf8 data;
       
   214 	CleanupClosePushL(data);
       
   215 		
       
   216 	TInt callId = 1;
       
   217 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   218 	DriverExpectDialCallRequestL(callId, mobileService, KErrNone);
       
   219 
       
   220 	// Complete KLtsyDispatchCallControlNotifyCallStatusChangeApiId
       
   221 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusDialling;
       
   222 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData(
       
   223 			callId, RMobilePhone::EServiceUnspecified, callStatus);
       
   224     data.Close();
       
   225     mockCallData.SerialiseL(data);
       
   226     iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
   227 
       
   228     // Complete events expected when remote party rejects call
       
   229 
       
   230     // Complete KLtsyDispatchCallControlNotifyCallStatusChangeApiId
       
   231     DriverCompleteSuccessfulHangUpNotificationsL(callId, EFalse, KErrGsmCCCallRejected, EFalse);
       
   232 	
       
   233 	// Client Side Test
       
   234 
       
   235     RMobileLine mobileLine;
       
   236 	CleanupClosePushL(mobileLine);
       
   237 	RMobileCall mobileCall;
       
   238 	CleanupClosePushL(mobileCall);
       
   239 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   240 
       
   241 	TRequestStatus notifyCallStatus;
       
   242 	callStatus = RMobileCall::EStatusUnknown;
       
   243 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   244 
       
   245 	RMobileCall::TMobileCallParamsV1 callParams;
       
   246 	RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams);
       
   247 	callParams.iAutoRedial = ETrue;
       
   248 	callParams.iIdRestrict = RMobileCall::ESendMyId;
       
   249 	TRequestStatus dialStatus;
       
   250 	mobileCall.Dial(dialStatus, callParamsPckg, KPhoneNumber);
       
   251 	User::WaitForRequest(dialStatus);
       
   252 	ASSERT_EQUALS(KErrGsmCCCallRejected, dialStatus.Int());
       
   253 
       
   254 	RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
   255     CleanupClosePushL(expectedCallStatuses);
       
   256     expectedCallStatuses.AppendL(RMobileCall::EStatusDialling);
       
   257     expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnecting);
       
   258     expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
   259     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   260 
       
   261 	callStatus = RMobileCall::EStatusUnknown;
       
   262 	mobileCall.GetMobileCallStatus(callStatus);
       
   263 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
   264 
       
   265 	expectedCallStatuses.Close();
       
   266 	mobileCall.Close();
       
   267 	mobileLine.Close();
       
   268 	data.Close();
       
   269 
       
   270 	AssertMockLtsyStatusL();
       
   271 	CleanupStack::PopAndDestroy(5, this); // expectedCallStatuses, mobileCall, mobileLine, data, this
       
   272 	} // CCTsyCallControlFU::TestUseCase0003L
       
   273 
       
   274 
       
   275 /**
       
   276 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0004
       
   277 @SYMComponent telephony_ctsy
       
   278 @SYMTestCaseDesc Test support in CTSY for remote party hang up without inband info
       
   279 @SYMTestPriority High
       
   280 @SYMTestActions Invokes dialling voice call, receive remote party hang up
       
   281 @SYMTestExpectedResults Pass
       
   282 @SYMTestType CT
       
   283 */
       
   284 void CCTsyCallControlFU::TestUseCase0004L()
       
   285 	{
       
   286 	OpenEtelServerL(EUseExtendedError);
       
   287 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   288 	OpenPhoneL();
       
   289 
       
   290 	RBuf8 data;
       
   291 	CleanupClosePushL(data);
       
   292 
       
   293 	TInt callId = 1;
       
   294 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   295 	DriverDialCallL(callId, mobileService);
       
   296 
       
   297     RMobileLine mobileLine;
       
   298 	CleanupClosePushL(mobileLine);
       
   299 	RMobileCall mobileCall;
       
   300 	CleanupClosePushL(mobileCall);
       
   301 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
   302 
       
   303 	RMobileCall::TMobileCallEvent callEvent = RMobileCall::ERemoteTerminated;
       
   304 	TMockLtsyCallData1<RMobileCall::TMobileCallEvent> callEventData(callId, mobileService, callEvent);
       
   305 	callEventData.SerialiseL(data);
       
   306     iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallEventIndId, KErrNone, data);
       
   307 
       
   308     DriverCompleteSuccessfulHangUpNotificationsL(callId, EFalse, KErrGsmCCNormalCallClearing);
       
   309 
       
   310     TRequestStatus notifyCallEventStatus;
       
   311     RMobileCall::TMobileCallEvent receivedCallEvent;
       
   312     mobileCall.NotifyCallEvent(notifyCallEventStatus, receivedCallEvent);
       
   313 
       
   314 	TRequestStatus notifyCallStatus;
       
   315 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown;
       
   316 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   317 
       
   318 	RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
   319     CleanupClosePushL(expectedCallStatuses);
       
   320     expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnecting);
       
   321     expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
   322     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   323 
       
   324     User::WaitForRequest(notifyCallEventStatus);
       
   325     ASSERT_EQUALS(KErrNone, notifyCallEventStatus.Int());
       
   326     ASSERT_EQUALS(callEvent, receivedCallEvent);
       
   327 
       
   328     expectedCallStatuses.Close();
       
   329 	mobileCall.Close();
       
   330 	mobileLine.Close();
       
   331 	data.Close();
       
   332 
       
   333 	AssertMockLtsyStatusL();
       
   334 	CleanupStack::PopAndDestroy(5, this); // expectedCallStatuses, mobileCall, mobileLine, data, this
       
   335 	} // CCTsyCallControlFU::TestUseCase0004L
       
   336 
       
   337 
       
   338 /**
       
   339 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0005
       
   340 @SYMComponent telephony_ctsy
       
   341 @SYMTestCaseDesc Test support in CTSY for remote party hang up with inband info
       
   342 @SYMTestPriority High
       
   343 @SYMTestActions Dial a voice call, remote party hangs up with inband info
       
   344 @SYMTestExpectedResults Pass
       
   345 @SYMTestType CT
       
   346 */
       
   347 void CCTsyCallControlFU::TestUseCase0005L()
       
   348 	{
       
   349 	OpenEtelServerL(EUseExtendedError);
       
   350 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   351 	OpenPhoneL();
       
   352 
       
   353 	RBuf8 data;
       
   354 	CleanupClosePushL(data);
       
   355 
       
   356 	TInt callId = 1;
       
   357 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   358 	DriverDialCallL(callId, mobileService);
       
   359 
       
   360     RMobileLine mobileLine;
       
   361 	CleanupClosePushL(mobileLine);
       
   362 	RMobileCall mobileCall;
       
   363 	CleanupClosePushL(mobileCall);
       
   364 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
   365 
       
   366 	DriverCompleteSuccessfulHangUpNotificationsL(callId, ETrue, KErrGsmCCNormalCallClearing);
       
   367 
       
   368 	TRequestStatus notifyCallStatus;
       
   369 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown;
       
   370 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   371 
       
   372 	RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
   373     CleanupClosePushL(expectedCallStatuses);
       
   374     expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnectingWithInband);
       
   375     expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
   376     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   377 
       
   378     expectedCallStatuses.Close();
       
   379 	mobileCall.Close();
       
   380 	mobileLine.Close();
       
   381 	data.Close();
       
   382 
       
   383 	AssertMockLtsyStatusL();
       
   384 	CleanupStack::PopAndDestroy(5, this); // expectedCallStatuses, mobileCall, mobileLine, data, this
       
   385 	} // CCTsyCallControlFU::TestUseCase0005L
       
   386 
       
   387 
       
   388 /**
       
   389 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0006
       
   390 @SYMComponent telephony_ctsy
       
   391 @SYMTestCaseDesc Test support in CTSY for mobile originated data call
       
   392 @SYMTestPriority High
       
   393 @SYMTestActions Invokes Dials a data call, receives call status notifications, loan and recover the data port, hang up call.
       
   394 @SYMTestExpectedResults Pass
       
   395 @SYMTestType CT
       
   396 */
       
   397 void CCTsyCallControlFU::TestUseCase0006L()
       
   398 	{
       
   399 	OpenEtelServerL(EUseExtendedError);
       
   400 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   401 	OpenPhoneL();
       
   402 
       
   403 	RBuf8 data;
       
   404 	CleanupClosePushL(data);
       
   405 
       
   406 	TInt callId = 1;
       
   407 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
   408 
       
   409 	DriverDialCallL(callId, mobileService);
       
   410 
       
   411 	// KMockLtsyDispatchCallControlNotifyDataCallCapsChangeIndId
       
   412 	RMobileCall::TMobileCallDataCapsV1 completeCallCaps;
       
   413 	completeCallCaps.iSpeedCaps = RMobileCall::KCapsSpeed48000;
       
   414 	completeCallCaps.iProtocolCaps = RMobileCall::KCapsProtocolV34;
       
   415 	completeCallCaps.iServiceCaps = RMobileCall::KCapsPacketAccessSyncUDI;
       
   416 	completeCallCaps.iQoSCaps = RMobileCall::KCapsTransparentPreferred;
       
   417 	completeCallCaps.iHscsdSupport = ETrue;
       
   418 	completeCallCaps.iMClass = 2;
       
   419 	completeCallCaps.iMaxRxTimeSlots = 4;
       
   420 	completeCallCaps.iMaxTxTimeSlots = 8;
       
   421 	completeCallCaps.iTotalRxTxTimeSlots = 10;
       
   422 	completeCallCaps.iCodingCaps = RMobileCall::KCapsAiurCoding96;
       
   423 	completeCallCaps.iAsymmetryCaps = RMobileCall::KCapsAsymmetryDownlink;
       
   424 	completeCallCaps.iUserInitUpgrade = ETrue;
       
   425 	completeCallCaps.iRLPVersionCaps = RMobileCall::KCapsRLPSingleLinkVersion1;
       
   426 	completeCallCaps.iV42bisCaps = RMobileCall::KCapsV42bisRxDirection;
       
   427 	data.Close();
       
   428 	TMockLtsyCallData1<RMobileCall::TMobileCallDataCapsV1>
       
   429 		completeDataCapsData(callId, RMobilePhone::EServiceUnspecified, completeCallCaps);
       
   430 	completeDataCapsData.SerialiseL(data);
       
   431 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyDataCallCapsChangeIndId, KErrNone, data);
       
   432 
       
   433 
       
   434     _LIT(KDataPort, "DATAPORT::0");
       
   435     RCall::TCommPort commPort;
       
   436     commPort.iPort = KDataPort;
       
   437     data.Close();
       
   438     TMockLtsyData2<TInt,RCall::TCommPort> loanDataPortExpData(callId,commPort);
       
   439 	loanDataPortExpData.SerialiseL(data);
       
   440     iMockLTSY.ExpectL(MLtsyDispatchCallControlLoanDataPort::KLtsyDispatchCallControlLoanDataPortApiId, data);
       
   441     iMockLTSY.ExpectL(MLtsyDispatchCallControlRecoverDataPort::KLtsyDispatchCallControlRecoverDataPortApiId, data);
       
   442 
       
   443     		
       
   444 	// MLtsyDispatchCallControlSetDynamicHscsdParams::KLtsyDispatchCallControlSetDynamicHscsdParamsApiId
       
   445 	RMobileCall::TMobileHscsdCallParamsV8 hscsdParams;
       
   446 	hscsdParams.iWantedAiur = RMobileCall::EAiurBps38400;
       
   447 	hscsdParams.iWantedRxTimeSlots = 2;
       
   448 	data.Close();
       
   449 	TMockLtsyData2<TInt, RMobileCall::TMobileHscsdCallParamsV8> paramData(callId, hscsdParams);
       
   450 	paramData.SerialiseL(data);
       
   451 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSetDynamicHscsdParams::KLtsyDispatchCallControlSetDynamicHscsdParamsApiId, data);
       
   452 
       
   453     TMockLtsyData1<TInt> mockParamData(callId);
       
   454     data.Close();
       
   455     mockParamData.SerialiseL(data);
       
   456 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSetDynamicHscsdParams::KLtsyDispatchCallControlSetDynamicHscsdParamsApiId, KErrNone, data);
       
   457 
       
   458 	// KMockLtsyDispatchCallControlNotifyHscsdInfoChangeIndId
       
   459     RMobileCall::TMobileCallHscsdInfoV8 hscsdInfo;
       
   460     hscsdInfo.iCodings = RMobileCall::ETchCoding320;
       
   461     hscsdInfo.iAiur = RMobileCall::EAiurBps38400;
       
   462     hscsdInfo.iRxTimeSlots = 2;
       
   463     hscsdInfo.iTxTimeSlots = 2;
       
   464 
       
   465     RMobileCall::TMobileCallDataCapsV1 completeCallCaps2 = completeCallCaps;
       
   466     completeCallCaps2.iHscsdSupport = ETrue;
       
   467     completeCallCaps2.iSpeedCaps = RMobileCall::KCapsSpeed57600;
       
   468     completeCallCaps2.iMaxRxTimeSlots = 3;
       
   469     completeCallCaps2.iMaxTxTimeSlots = 5;
       
   470 
       
   471     TMockLtsyCallData2<RMobileCall::TMobileCallHscsdInfoV8, RMobileCall::TMobileCallDataCapsV1>
       
   472     		hscsdData(1, RMobilePhone::ECircuitDataService, hscsdInfo, completeCallCaps2);
       
   473     data.Close();
       
   474     hscsdData.SerialiseL(data);
       
   475 
       
   476 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyHscsdInfoChangeIndId, KErrNone, data);
       
   477 
       
   478 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
   479 	DriverHangUpCallL(callId, hangUpCause);
       
   480 
       
   481 	// Client Side Test
       
   482 
       
   483     RMobileLine mobileLine;
       
   484 	CleanupClosePushL(mobileLine);
       
   485 	RMobileCall mobileCall;
       
   486 	CleanupClosePushL(mobileCall);
       
   487 
       
   488 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
   489 
       
   490 	RCall::TCommPort dataPort;
       
   491 	TRequestStatus reqStatus;
       
   492 	mobileCall.LoanDataPort(reqStatus, dataPort);
       
   493 	User::WaitForRequest(reqStatus);
       
   494 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   495 	ASSERT_EQUALS(0, dataPort.iPort.Compare(KDataPort()));
       
   496 
       
   497 	TInt err = mobileCall.RecoverDataPort();
       
   498 	ASSERT_EQUALS(KErrNone, err);
       
   499 
       
   500 	RMobileCall::TMobileCallDataCapsV1 callCaps;
       
   501 	RMobileCall::TMobileCallDataCapsV1Pckg callCapsPckg(callCaps);
       
   502 	mobileCall.GetMobileDataCallCaps(callCapsPckg);
       
   503 	ASSERT_TRUE(TComparator<RMobileCall::TMobileCallDataCapsV1>::IsEqual(completeCallCaps, callCaps));
       
   504 
       
   505 	TRequestStatus hscsdInfoStatus;
       
   506 	RMobileCall::TMobileCallHscsdInfoV8 hscsdInfo2;
       
   507 	RMobileCall::TMobileCallHscsdInfoV8Pckg hscsdInfoPckg(hscsdInfo2);
       
   508 	mobileCall.NotifyHscsdInfoChange(hscsdInfoStatus, hscsdInfoPckg);
       
   509 
       
   510 	TRequestStatus dataCallCapsStatus;
       
   511 	RMobileCall::TMobileCallDataCapsV1 dataCallCaps2;
       
   512 	RMobileCall::TMobileCallDataCapsV1Pckg dataCallCapsPckg(dataCallCaps2);
       
   513 	mobileCall.NotifyMobileDataCallCapsChange(dataCallCapsStatus, dataCallCapsPckg);
       
   514 
       
   515 	TRequestStatus hscsdParamStatus;
       
   516 	mobileCall.SetDynamicHscsdParams(hscsdParamStatus, hscsdParams.iWantedAiur, hscsdParams.iWantedRxTimeSlots);
       
   517 	User::WaitForRequest(hscsdParamStatus);
       
   518 
       
   519 	User::WaitForRequest(hscsdInfoStatus);
       
   520 	ASSERT_EQUALS(KErrNone, hscsdInfoStatus.Int());
       
   521 	ASSERT_EQUALS(hscsdInfo2.iAiur, hscsdInfo.iAiur);
       
   522 	ASSERT_EQUALS(hscsdInfo2.iRxTimeSlots, hscsdInfo.iRxTimeSlots);
       
   523 	ASSERT_EQUALS(hscsdInfo2.iTxTimeSlots, hscsdInfo.iTxTimeSlots);
       
   524 	ASSERT_EQUALS(hscsdInfo2.iCodings, hscsdInfo.iCodings);
       
   525 
       
   526 	User::WaitForRequest(dataCallCapsStatus);
       
   527 	ASSERT_EQUALS(KErrNone, dataCallCapsStatus.Int());
       
   528 	ASSERT_EQUALS(completeCallCaps2.iSpeedCaps, dataCallCaps2.iSpeedCaps);
       
   529 	ASSERT_EQUALS(completeCallCaps2.iHscsdSupport, dataCallCaps2.iHscsdSupport);
       
   530 	ASSERT_EQUALS(completeCallCaps2.iMaxRxTimeSlots, dataCallCaps2.iMaxRxTimeSlots);
       
   531 	ASSERT_EQUALS(completeCallCaps2.iMaxTxTimeSlots, dataCallCaps2.iMaxTxTimeSlots);
       
   532 
       
   533 	TRequestStatus reqStatusTerminated;
       
   534 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 	
       
   535 	ClientHangUpCallL(mobileCall);
       
   536 
       
   537 	mobileCall.Close();
       
   538 	mobileLine.Close();
       
   539 	data.Close();
       
   540 
       
   541 	User::WaitForRequest(reqStatusTerminated);
       
   542 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
   543 
       
   544 	AssertMockLtsyStatusL();
       
   545 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
   546 	} // CCTsyCallControlFU::TestUseCase0006L
       
   547 
       
   548 /**
       
   549  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0007
       
   550  @SYMComponent telephony_ctsy
       
   551  @SYMTestCaseDesc Test support in CTSY for incoming voice call accepted
       
   552  @SYMTestPriority High
       
   553  @SYMTestActions Requests notification of an incoming call, incoming call arrives, answer the call, hang up
       
   554  @SYMTestExpectedResults Pass
       
   555  @SYMTestType CT
       
   556  */
       
   557 void CCTsyCallControlFU::TestUseCase0007L()
       
   558 	{
       
   559 	OpenEtelServerL(EUseExtendedError);
       
   560 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   561 	OpenPhoneL();
       
   562 
       
   563 	RBuf8 data;
       
   564 	CleanupClosePushL(data);
       
   565 
       
   566 	TInt callId = 1;
       
   567 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   568 	TName incomingCallName;
       
   569 
       
   570     RMobileLine mobileLine;
       
   571 	CleanupClosePushL(mobileLine);
       
   572 	RMobileCall mobileCall;
       
   573 	CleanupClosePushL(mobileCall);
       
   574 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   575 	mobileCall.Close();
       
   576 	CleanupStack::Pop(&mobileCall);
       
   577 
       
   578 	// Create an incoming call and answer it
       
   579 
       
   580 	DriverCreateIncomingCallL(callId, mobileService);
       
   581 
       
   582 	DriverCompleteGetMobileCallInfoL(callId, mobileService);
       
   583 
       
   584 	DriverAnswerIncomingCallL(callId, mobileService);
       
   585 
       
   586     TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
   587     DriverHangUpCallL(callId, hangUpCause);
       
   588 
       
   589     // Create another incoming call but fail to answer this one
       
   590 
       
   591 	DriverCreateIncomingCallL(callId, mobileService);
       
   592 
       
   593 	DriverCompleteGetMobileCallInfoL(callId, mobileService);
       
   594 
       
   595 	DriverAnswerIncomingCallL(callId, mobileService, EFalse, KErrGeneral);
       
   596 
       
   597     // Client side test
       
   598 
       
   599     ClientWaitForIncomingCallNotificationLC(mobileCall, mobileLine, incomingCallName);
       
   600 
       
   601     ClientAnswerIncomingCallL(mobileCall);
       
   602 
       
   603 	ClientHangUpCallL(mobileCall);
       
   604 
       
   605 	mobileCall.Close();
       
   606 	CleanupStack::Pop(&mobileCall);
       
   607 
       
   608 	ClientWaitForIncomingCallNotificationLC(mobileCall, mobileLine, incomingCallName);
       
   609 
       
   610 	ClientAnswerIncomingCallL(mobileCall, KErrGeneral);
       
   611 
       
   612 	mobileCall.Close();
       
   613 	mobileLine.Close();
       
   614 	data.Close();
       
   615 
       
   616 	AssertMockLtsyStatusL();
       
   617 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
   618 	} // CCTsyCallControlFU::TestUseCase0007L
       
   619 
       
   620 
       
   621 /**
       
   622  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0008
       
   623  @SYMComponent telephony_ctsy
       
   624  @SYMTestCaseDesc Test support in CTSY for incoming voice call rejected
       
   625  @SYMTestPriority High
       
   626  @SYMTestActions Invokes actions
       
   627  @SYMTestExpectedResults Pass
       
   628  @SYMTestType CT
       
   629  */
       
   630 void CCTsyCallControlFU::TestUseCase0008L()
       
   631 	{
       
   632 	OpenEtelServerL(EUseExtendedError);
       
   633 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   634 	OpenPhoneL();
       
   635 
       
   636 	RBuf8 data;
       
   637 	CleanupClosePushL(data);
       
   638 
       
   639 	TInt callId = 1;
       
   640 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   641 	TName incomingCallName;
       
   642 
       
   643     RMobileLine mobileLine;
       
   644 	CleanupClosePushL(mobileLine);
       
   645 	RMobileCall mobileCall;
       
   646 	CleanupClosePushL(mobileCall);
       
   647 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   648 	mobileCall.Close();
       
   649 	CleanupStack::Pop(&mobileCall);
       
   650 
       
   651 	DriverCreateIncomingCallL(callId, mobileService);
       
   652 
       
   653 	DriverCompleteGetMobileCallInfoL(callId, mobileService);
       
   654 
       
   655 	// KErrGsmBusyUserRequest hardcoded to be sent by CTSY to LTSY,
       
   656 	// mapped to KErrGsmCCUserBusy
       
   657 	TInt hangUpCause = KErrGsmCCUserBusy;
       
   658 	TMockLtsyData2<TInt, TInt> mockData2(callId, hangUpCause);
       
   659 	data.Close();
       
   660 	mockData2.SerialiseL(data);
       
   661 	iMockLTSY.ExpectL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, data);
       
   662 	DriverCompleteSuccessfulHangUpNotificationsL(callId, EFalse, KErrGsmCCCallRejected, EFalse);
       
   663 
       
   664 	// Client side test
       
   665 
       
   666 	ClientWaitForIncomingCallNotificationLC(mobileCall, mobileLine, incomingCallName);
       
   667 
       
   668 	ClientHangUpCallL(mobileCall);
       
   669 
       
   670 	AssertMockLtsyStatusL();
       
   671 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
   672 	} // CCTsyCallControlFU::TestUseCase0008L
       
   673 
       
   674 /**
       
   675  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0009
       
   676  @SYMComponent telephony_ctsy
       
   677  @SYMTestCaseDesc Test support in CTSY for cancel dialling a call when it is still in dialling state.
       
   678  @SYMTestPriority High
       
   679  @SYMTestActions Invokes dialling a call and then cancelling the dial during dialling process.
       
   680  @SYMTestExpectedResults Pass
       
   681  @SYMTestType CT
       
   682  */
       
   683 void CCTsyCallControlFU::TestUseCase0009L()
       
   684 	{
       
   685 	OpenEtelServerL(EUseExtendedError);
       
   686 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   687 	OpenPhoneL();
       
   688 
       
   689 	RBuf8 data;
       
   690 	CleanupClosePushL(data);
       
   691 
       
   692 	TInt callId = 1;
       
   693 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   694 
       
   695 	DriverExpectDialCallRequestL(callId, mobileService, KErrNone);
       
   696 
       
   697 	// Complete KLtsyDispatchCallControlNotifyCallStatusChangeApiId with dialling
       
   698 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusDialling;
       
   699 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData(
       
   700 			callId, RMobilePhone::EServiceUnspecified, callStatus);
       
   701     data.Close();
       
   702     mockCallData.SerialiseL(data);
       
   703     iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
   704 
       
   705 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // This cause always passed by CTSY in this situation
       
   706 	TMockLtsyData2<TInt, TInt> mockData2(callId, hangUpCause);
       
   707 	data.Close();
       
   708 	mockData2.SerialiseL(data);
       
   709 	iMockLTSY.ExpectL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, data);
       
   710 
       
   711 	DriverCompleteSuccessfulHangUpNotificationsL(callId, EFalse, KErrGsmCCNormalCallClearing, EFalse);
       
   712 
       
   713 	// Client side test
       
   714 
       
   715     RMobileLine mobileLine;
       
   716 	CleanupClosePushL(mobileLine);
       
   717 	RMobileCall mobileCall;
       
   718 	CleanupClosePushL(mobileCall);
       
   719 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   720 
       
   721 	TRequestStatus notifyCallStatus;
       
   722 	callStatus = RMobileCall::EStatusUnknown;
       
   723 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   724 
       
   725 	RMobileCall::TMobileCallParamsV1 callParams;
       
   726 	RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams);
       
   727 	callParams.iAutoRedial = ETrue;
       
   728 	callParams.iIdRestrict = RMobileCall::ESendMyId;
       
   729 	TRequestStatus dialStatus;
       
   730 	mobileCall.Dial(dialStatus, callParamsPckg, KPhoneNumber);
       
   731 
       
   732 	User::WaitForRequest(notifyCallStatus);
       
   733 	ASSERT_EQUALS(KErrNone, notifyCallStatus.Int());
       
   734 	ASSERT_EQUALS(RMobileCall::EStatusDialling, callStatus);
       
   735 
       
   736 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   737 
       
   738 	mobileCall.DialCancel();
       
   739 
       
   740 	RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
   741     CleanupClosePushL(expectedCallStatuses);
       
   742     expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnecting);
       
   743     expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
   744     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   745 	
       
   746 	User::WaitForRequest(dialStatus);
       
   747 	ASSERT_EQUALS(KErrCancel, dialStatus.Int());
       
   748 
       
   749 	expectedCallStatuses.Close();
       
   750 	mobileLine.Close();
       
   751 	mobileCall.Close();
       
   752 	
       
   753 	AssertMockLtsyStatusL();
       
   754 	CleanupStack::PopAndDestroy(5, this); // expectedCallStatuses, mobileCall, mobileLine, data, this
       
   755 	} // CCTsyCallControlFU::TestUseCase0009L
       
   756 
       
   757 /**
       
   758  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0010
       
   759  @SYMComponent telephony_ctsy
       
   760  @SYMTestCaseDesc Test support in CTSY for cancelling dial request when call is connecting
       
   761  @SYMTestPriority High
       
   762  @SYMTestActions Invokes dialling a call and cancelling the dial request when call reaches connecting state
       
   763  @SYMTestExpectedResults Pass
       
   764  @SYMTestType CT
       
   765  */
       
   766 void CCTsyCallControlFU::TestUseCase0010L()
       
   767 	{
       
   768 	OpenEtelServerL(EUseExtendedError);
       
   769 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   770 	OpenPhoneL();
       
   771 
       
   772 	RBuf8 data;
       
   773 	CleanupClosePushL(data);
       
   774 
       
   775 	TInt callId = 1;
       
   776 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   777 
       
   778 	DriverExpectDialCallRequestL(callId, mobileService, KErrNone);
       
   779 
       
   780 	// Complete KLtsyDispatchCallControlNotifyCallStatusChangeApiId with dialling
       
   781 	RArray<RMobileCall::TMobileCallStatus> arrayCallStatus;
       
   782 	CleanupClosePushL(arrayCallStatus);
       
   783 	arrayCallStatus.AppendL(RMobileCall::EStatusDialling);
       
   784 	arrayCallStatus.AppendL(RMobileCall::EStatusConnecting);
       
   785 	DriverCompleteCallStatusChangeNotificationsL(arrayCallStatus, callId, KErrNone);
       
   786 	arrayCallStatus.Close();
       
   787 
       
   788 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // This cause always passed by CTSY in this situation
       
   789 	TMockLtsyData2<TInt, TInt> mockData2(callId, hangUpCause);
       
   790 	data.Close();
       
   791 	mockData2.SerialiseL(data);
       
   792 	iMockLTSY.ExpectL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, data);
       
   793 
       
   794 	DriverCompleteSuccessfulHangUpNotificationsL(callId, EFalse, KErrGsmCCNormalCallClearing, EFalse);
       
   795 
       
   796 	// Client side test
       
   797 
       
   798     RMobileLine mobileLine;
       
   799 	CleanupClosePushL(mobileLine);
       
   800 	RMobileCall mobileCall;
       
   801 	CleanupClosePushL(mobileCall);
       
   802 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   803 
       
   804 	TRequestStatus notifyCallStatus;
       
   805 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown;
       
   806 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   807 
       
   808 	RMobileCall::TMobileCallParamsV1 callParams;
       
   809 	RMobileCall::TMobileCallParamsV1Pckg callParamsPckg(callParams);
       
   810 	callParams.iAutoRedial = ETrue;
       
   811 	callParams.iIdRestrict = RMobileCall::ESendMyId;
       
   812 	TRequestStatus dialStatus;
       
   813 	mobileCall.Dial(dialStatus, callParamsPckg, KPhoneNumber);
       
   814 
       
   815 	RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
   816     CleanupClosePushL(expectedCallStatuses);
       
   817     expectedCallStatuses.AppendL(RMobileCall::EStatusDialling);
       
   818     expectedCallStatuses.AppendL(RMobileCall::EStatusConnecting);
       
   819     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   820 
       
   821 	mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   822 
       
   823 	mobileCall.DialCancel();
       
   824 
       
   825 	expectedCallStatuses.Close();
       
   826     expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnecting);
       
   827     expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
   828     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   829 
       
   830 	User::WaitForRequest(dialStatus);
       
   831 	ASSERT_EQUALS(KErrCancel, dialStatus.Int());
       
   832 
       
   833 	expectedCallStatuses.Close();
       
   834 	arrayCallStatus.Close();
       
   835 	mobileLine.Close();
       
   836 	mobileCall.Close();
       
   837 
       
   838 	AssertMockLtsyStatusL();
       
   839 	CleanupStack::PopAndDestroy(6, this); // expectedCallStatuses, mobileCall, mobileLine, arrayCallStatus, data, this
       
   840 	} // CCTsyCallControlFU::TestUseCase0010L
       
   841 
       
   842 /**
       
   843  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0011
       
   844  @SYMComponent telephony_ctsy
       
   845  @SYMTestCaseDesc Test support in CTSY for missed incoming call
       
   846  @SYMTestPriority High
       
   847  @SYMTestActions Invokes requesting an incoming call, line rings, call is not answered, call disconnects
       
   848  @SYMTestExpectedResults Pass
       
   849  @SYMTestType CT
       
   850  */
       
   851 void CCTsyCallControlFU::TestUseCase0011L()
       
   852 	{
       
   853 	OpenEtelServerL(EUseExtendedError);
       
   854 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   855 	OpenPhoneL();
       
   856 
       
   857 	RBuf8 data;
       
   858 	CleanupClosePushL(data);
       
   859 
       
   860 	TInt callId = 1;
       
   861 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   862 	TName incomingCallName;
       
   863 
       
   864     RMobileLine mobileLine;
       
   865 	CleanupClosePushL(mobileLine);
       
   866 	RMobileCall mobileCall;
       
   867 	CleanupClosePushL(mobileCall);
       
   868 	ASSERT_EQUALS(KErrNone, OpenLineAndCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService));
       
   869 	mobileCall.Close();
       
   870 	CleanupStack::Pop(&mobileCall);
       
   871 
       
   872     DriverCreateIncomingCallL(callId, mobileService);
       
   873 
       
   874 	DriverCompleteGetMobileCallInfoL(callId, mobileService);
       
   875 
       
   876 	ClientWaitForIncomingCallNotificationLC(mobileCall, mobileLine, incomingCallName);
       
   877 
       
   878 	DriverCompleteSuccessfulHangUpNotificationsL(callId, EFalse, KErrGsmCCNormalCallClearing, EFalse);
       
   879 
       
   880     TRequestStatus notifyCallStatus;
       
   881     RMobileCall::TMobileCallStatus callStatus;
       
   882     mobileCall.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
   883 
       
   884     RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
   885     CleanupClosePushL(expectedCallStatuses);
       
   886     expectedCallStatuses.AppendL(RMobileCall::EStatusDisconnecting);
       
   887     expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
   888 
       
   889     ClientWaitForCallStatusNotifications(mobileCall, notifyCallStatus, callStatus, expectedCallStatuses, KErrNone);
       
   890 
       
   891 	expectedCallStatuses.Close();
       
   892 	mobileCall.Close();
       
   893 	mobileLine.Close();
       
   894 	data.Close();
       
   895 
       
   896 	AssertMockLtsyStatusL();
       
   897 	CleanupStack::PopAndDestroy(5, this); // expectedCallStatuses, mobileCall, mobileLine, data, this
       
   898 	} // CCTsyCallControlFU::TestUseCase0011L
       
   899 
       
   900 
       
   901 /**
       
   902  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0012
       
   903  @SYMComponent telephony_ctsy
       
   904  @SYMTestCaseDesc Test support in CTSY for holding, resuming a call
       
   905  @SYMTestPriority High
       
   906  @SYMTestActions Invokes dialling a call, holding it, then resuming it
       
   907  @SYMTestExpectedResults Pass
       
   908  @SYMTestType CT
       
   909  */
       
   910 void CCTsyCallControlFU::TestUseCase0012L()
       
   911 	{
       
   912 	OpenEtelServerL(EUseExtendedError);
       
   913 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   914 	OpenPhoneL();
       
   915 
       
   916 	RBuf8 data;
       
   917 	CleanupClosePushL(data);
       
   918 
       
   919 	TInt callId = 1;
       
   920 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   921 	DriverDialCallL(callId, mobileService);
       
   922 
       
   923 	// Hold call
       
   924     DriverHoldCallL(callId, KErrNone);
       
   925 
       
   926 	// Resume call
       
   927 	DriverResumeCallL(callId, KErrNone);
       
   928 
       
   929 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
   930 	DriverHangUpCallL(callId, hangUpCause);
       
   931 
       
   932 	// Client Side Test
       
   933 
       
   934     RMobileLine mobileLine;
       
   935 	CleanupClosePushL(mobileLine);
       
   936 	RMobileCall mobileCall;
       
   937 	CleanupClosePushL(mobileCall);
       
   938 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
   939 
       
   940 	TRequestStatus notifyStatus;
       
   941 	RMobileCall::TMobileCallStatus callStatus;
       
   942 	mobileCall.NotifyMobileCallStatusChange(notifyStatus, callStatus);
       
   943 
       
   944 	TRequestStatus holdStatus;
       
   945 	mobileCall.Hold(holdStatus);
       
   946 	User::WaitForRequest(holdStatus);
       
   947 	ASSERT_EQUALS(KErrNone, holdStatus.Int());
       
   948 
       
   949 	User::WaitForRequest(notifyStatus);
       
   950 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
   951 	ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus);
       
   952 
       
   953 	mobileCall.NotifyMobileCallStatusChange(notifyStatus, callStatus);
       
   954 
       
   955 	TRequestStatus resumeStatus;
       
   956 	mobileCall.Resume(resumeStatus);
       
   957 	User::WaitForRequest(resumeStatus);
       
   958 	ASSERT_EQUALS(KErrNone, resumeStatus.Int());
       
   959 
       
   960 	User::WaitForRequest(notifyStatus);
       
   961 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
   962 	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
       
   963 
       
   964 	// Attempt to swap it when it is the sole call (not supported by CTSY)
       
   965 	TRequestStatus swapStatus;
       
   966 	mobileCall.Swap(swapStatus);
       
   967 	User::WaitForRequest(swapStatus);
       
   968 	ASSERT_EQUALS(KErrNotSupported, swapStatus.Int());
       
   969 
       
   970 	TRequestStatus reqStatusTerminated;
       
   971 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
   972 	
       
   973 	ClientHangUpCallL(mobileCall);
       
   974 
       
   975 	mobileCall.Close();
       
   976 	mobileLine.Close();
       
   977 	data.Close();
       
   978 	
       
   979 	User::WaitForRequest(reqStatusTerminated);
       
   980 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
   981 
       
   982 	AssertMockLtsyStatusL();
       
   983 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
   984 	} // CCTsyCallControlFU::TestUseCase0012L
       
   985 
       
   986 /**
       
   987  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0013
       
   988  @SYMComponent telephony_ctsy
       
   989  @SYMTestCaseDesc Test support in CTSY for failure to hold a connected call
       
   990  @SYMTestPriority High
       
   991  @SYMTestActions Invokes dialling a call, attempting to hold it, receiving an error
       
   992  @SYMTestExpectedResults Pass
       
   993  @SYMTestType CT
       
   994  */
       
   995 void CCTsyCallControlFU::TestUseCase0013L()
       
   996 	{
       
   997 	OpenEtelServerL(EUseExtendedError);
       
   998 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   999 	OpenPhoneL();
       
  1000 
       
  1001 	RBuf8 data;
       
  1002 	CleanupClosePushL(data);
       
  1003 
       
  1004 	TInt callId = 1;
       
  1005 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1006 	DriverDialCallL(callId, mobileService);
       
  1007 
       
  1008 	DriverHoldCallL(callId, KErrGeneral);
       
  1009 
       
  1010 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
  1011 	DriverHangUpCallL(callId, hangUpCause);
       
  1012 
       
  1013 	// Client side test
       
  1014     RMobileLine mobileLine;
       
  1015 	CleanupClosePushL(mobileLine);
       
  1016 	RMobileCall mobileCall;
       
  1017 	CleanupClosePushL(mobileCall);
       
  1018 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  1019 
       
  1020 	TRequestStatus holdStatus;
       
  1021 	mobileCall.Hold(holdStatus);
       
  1022 	User::WaitForRequest(holdStatus);
       
  1023 	ASSERT_EQUALS(KErrGeneral, holdStatus.Int());
       
  1024 
       
  1025 	RMobileCall::TMobileCallStatus callStatus;
       
  1026 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallStatus(callStatus));
       
  1027 	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
       
  1028 
       
  1029 	TRequestStatus reqStatusTerminated;
       
  1030 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1031 	
       
  1032 	ClientHangUpCallL(mobileCall);
       
  1033 
       
  1034 	mobileCall.Close();
       
  1035 	mobileLine.Close();
       
  1036 	data.Close();
       
  1037 
       
  1038 	User::WaitForRequest(reqStatusTerminated);
       
  1039 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1040 	
       
  1041 	AssertMockLtsyStatusL();
       
  1042 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
  1043 	} // CCTsyCallControlFU::TestUseCase0013L
       
  1044 
       
  1045 /**
       
  1046  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0014
       
  1047  @SYMComponent telephony_ctsy
       
  1048  @SYMTestCaseDesc Test support in CTSY for failure to resume
       
  1049  @SYMTestPriority High
       
  1050  @SYMTestActions Invokes holding a call, attempting to resume it and receiving a failure.
       
  1051  @SYMTestExpectedResults Pass - Call still on hold
       
  1052  @SYMTestType CT
       
  1053  */
       
  1054 void CCTsyCallControlFU::TestUseCase0014L()
       
  1055 	{
       
  1056 	OpenEtelServerL(EUseExtendedError);
       
  1057 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1058 	OpenPhoneL();
       
  1059 
       
  1060 	RBuf8 data;
       
  1061 	CleanupClosePushL(data);
       
  1062 
       
  1063 	TInt callId = 1;
       
  1064 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1065 	DriverDialCallL(callId, mobileService);
       
  1066 
       
  1067 	DriverHoldCallL(callId, KErrNone);
       
  1068 
       
  1069 	DriverResumeCallL(callId, KErrGeneral);
       
  1070 
       
  1071 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
  1072 	TMockLtsyData2<TInt, TInt> mockData2(callId, hangUpCause);
       
  1073 	data.Close();
       
  1074 	mockData2.SerialiseL(data);
       
  1075 	iMockLTSY.ExpectL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, data);
       
  1076 
       
  1077 	// Client side test
       
  1078 
       
  1079     RMobileLine mobileLine;
       
  1080 	CleanupClosePushL(mobileLine);
       
  1081 	RMobileCall mobileCall;
       
  1082 	CleanupClosePushL(mobileCall);
       
  1083 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  1084 
       
  1085 	TRequestStatus holdStatus;
       
  1086 	mobileCall.Hold(holdStatus);
       
  1087 	User::WaitForRequest(holdStatus);
       
  1088 	ASSERT_EQUALS(KErrNone, holdStatus.Int());
       
  1089 
       
  1090 	TRequestStatus resumeStatus;
       
  1091 	mobileCall.Resume(resumeStatus);
       
  1092 	User::WaitForRequest(resumeStatus);
       
  1093 	ASSERT_EQUALS(KErrGeneral, resumeStatus.Int());
       
  1094 
       
  1095 	RMobileCall::TMobileCallStatus callStatus;
       
  1096 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallStatus(callStatus));
       
  1097 	ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus);
       
  1098 
       
  1099 	mobileCall.Close();
       
  1100 	mobileLine.Close();
       
  1101 	data.Close();
       
  1102 
       
  1103 	AssertMockLtsyStatusL();
       
  1104 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
  1105 	} // CCTsyCallControlFU::TestUseCase0014L
       
  1106 
       
  1107 /**
       
  1108  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0015
       
  1109  @SYMComponent telephony_ctsy
       
  1110  @SYMTestCaseDesc Test support in CTSY for failure to swap a call
       
  1111  @SYMTestPriority High
       
  1112  @SYMTestActions Invokes swapping a call and receiving error
       
  1113  @SYMTestExpectedResults Pass
       
  1114  @SYMTestType CT
       
  1115  */
       
  1116 void CCTsyCallControlFU::TestUseCase0015L()
       
  1117 	{
       
  1118 	OpenEtelServerL(EUseExtendedError);
       
  1119 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1120 	OpenPhoneL();
       
  1121 
       
  1122 	RBuf8 data;
       
  1123 	CleanupClosePushL(data);
       
  1124 
       
  1125 	TInt callId1 = 1;
       
  1126 	TInt callId2 = 2;
       
  1127 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1128 
       
  1129 	DriverDialAndHoldFirstCallDialSecondCallL(mobileService, callId1, callId2);
       
  1130 
       
  1131 	DriverSwapCallL(callId1, callId2, KErrGeneral, RMobileCall::EStatusConnected, RMobileCall::EStatusHold);
       
  1132 
       
  1133 	DriverSwapCallL(callId1, callId2, KErrGeneral, RMobileCall::EStatusConnected, RMobileCall::EStatusHold);
       
  1134 
       
  1135 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
  1136 	DriverHangUpCallL(callId1, hangUpCause, EFalse);
       
  1137 
       
  1138 	DriverHangUpCallL(callId2, hangUpCause, ETrue);
       
  1139 
       
  1140 	// Client side test
       
  1141 
       
  1142     RMobileLine mobileLine;
       
  1143 	CleanupClosePushL(mobileLine);
       
  1144 	RMobileCall mobileCall;
       
  1145 	CleanupClosePushL(mobileCall);
       
  1146 
       
  1147 	RMobileLine mobileLine2;
       
  1148 	CleanupClosePushL(mobileLine2);
       
  1149 	RMobileCall mobileCall2;
       
  1150 	CleanupClosePushL(mobileCall2);
       
  1151 
       
  1152 	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
       
  1153 			mobileCall2, mobileLine2);
       
  1154 
       
  1155 	TRequestStatus swapStatus;
       
  1156 	mobileCall.Swap(swapStatus);
       
  1157 	User::WaitForRequest(swapStatus);
       
  1158 	ASSERT_EQUALS(KErrGeneral, swapStatus.Int());
       
  1159 
       
  1160 	mobileCall2.Swap(swapStatus);
       
  1161 	User::WaitForRequest(swapStatus);
       
  1162 	ASSERT_EQUALS(KErrGeneral, swapStatus.Int());
       
  1163 
       
  1164 	RMobileCall::TMobileCallStatus callStatus;
       
  1165 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallStatus(callStatus));
       
  1166 	ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus);
       
  1167 
       
  1168 	ASSERT_EQUALS(KErrNone, mobileCall2.GetMobileCallStatus(callStatus));
       
  1169 	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
       
  1170 
       
  1171 	TRequestStatus reqStatusTerminated;
       
  1172 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1173 	
       
  1174 	ClientHangUpCallL(mobileCall);
       
  1175 	ClientHangUpCallL(mobileCall2);
       
  1176 
       
  1177 	mobileCall.Close();
       
  1178 	mobileLine.Close();
       
  1179 
       
  1180 	User::WaitForRequest(reqStatusTerminated);
       
  1181 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1182 	
       
  1183 	AssertMockLtsyStatusL();
       
  1184 	CleanupStack::PopAndDestroy(6, this); //mobileCall2, mobileLine2, mobileCall, mobileLine, data, this
       
  1185 	} // CCTsyCallControlFU::TestUseCase0015L
       
  1186 
       
  1187 
       
  1188 
       
  1189 /**
       
  1190  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0016
       
  1191  @SYMComponent telephony_ctsy
       
  1192  @SYMTestCaseDesc Test support in CTSY for holding a call then dialling a second and swapping them
       
  1193  @SYMTestPriority High
       
  1194  @SYMTestActions Invokes dialling then holding a call and dialling a second call and swapping them
       
  1195  @SYMTestExpectedResults Pass - Second call can be dialled
       
  1196  @SYMTestType CT
       
  1197  */
       
  1198 void CCTsyCallControlFU::TestUseCase0016L()
       
  1199 	{
       
  1200 	OpenEtelServerL(EUseExtendedError);
       
  1201 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1202 	OpenPhoneL();
       
  1203 
       
  1204 	RBuf8 data;
       
  1205 	CleanupClosePushL(data);
       
  1206 
       
  1207 	TInt callId1 = 1;
       
  1208 	TInt callId2 = 2;
       
  1209 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1210 
       
  1211 	DriverDialAndHoldFirstCallDialSecondCallL(mobileService, callId1, callId2);
       
  1212 
       
  1213 	DriverSwapCallL(callId1, callId2, KErrNone, RMobileCall::EStatusConnected, RMobileCall::EStatusHold);
       
  1214 
       
  1215 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
  1216 	DriverHangUpCallL(callId2, hangUpCause, EFalse);
       
  1217 
       
  1218 	hangUpCause = KErrGsmCCNormalCallClearing;
       
  1219 	DriverHangUpCallL(callId1, hangUpCause, ETrue);
       
  1220 
       
  1221 	// Client side test
       
  1222 
       
  1223     RMobileLine mobileLine;
       
  1224 	CleanupClosePushL(mobileLine);
       
  1225 	RMobileCall mobileCall;
       
  1226 	CleanupClosePushL(mobileCall);
       
  1227 
       
  1228 	RMobileLine mobileLine2;
       
  1229 	CleanupClosePushL(mobileLine2);
       
  1230 	RMobileCall mobileCall2;
       
  1231 	CleanupClosePushL(mobileCall2);
       
  1232 
       
  1233 	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
       
  1234 			mobileCall2, mobileLine2);
       
  1235 
       
  1236 	TRequestStatus notifyStatus;
       
  1237 	RMobileCall::TMobileCallStatus callStatus;
       
  1238 	mobileCall.NotifyMobileCallStatusChange(notifyStatus, callStatus);
       
  1239 
       
  1240 	TRequestStatus notifyStatus2;
       
  1241 	RMobileCall::TMobileCallStatus callStatus2;
       
  1242 	mobileCall2.NotifyMobileCallStatusChange(notifyStatus2, callStatus2);
       
  1243 
       
  1244 	TRequestStatus swapStatus;
       
  1245 	mobileCall.Swap(swapStatus);
       
  1246 	User::WaitForRequest(swapStatus);
       
  1247 	ASSERT_EQUALS(KErrNone, swapStatus.Int());
       
  1248 
       
  1249 	User::WaitForRequest(notifyStatus);
       
  1250 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
  1251 	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
       
  1252 
       
  1253 	User::WaitForRequest(notifyStatus2);
       
  1254 	ASSERT_EQUALS(KErrNone, notifyStatus2.Int());
       
  1255 	ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus2);
       
  1256 
       
  1257 	ClientHangUpCallL(mobileCall2);
       
  1258 
       
  1259 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallStatus(callStatus));
       
  1260 	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
       
  1261 
       
  1262 	TRequestStatus reqStatusTerminated;
       
  1263 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1264 	
       
  1265 	ClientHangUpCallL(mobileCall);
       
  1266 
       
  1267 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallStatus(callStatus));
       
  1268 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
  1269 
       
  1270 	mobileCall.Close();
       
  1271 	mobileLine.Close();
       
  1272 	data.Close();
       
  1273 
       
  1274 	User::WaitForRequest(reqStatusTerminated);
       
  1275 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1276 	
       
  1277 	AssertMockLtsyStatusL();
       
  1278 	CleanupStack::PopAndDestroy(6, this); // mobileCall2, mobileLine2, mobileCall, mobileLine, data, this
       
  1279 	} // CCTsyCallControlFU::TestUseCase0016L
       
  1280 
       
  1281 
       
  1282 
       
  1283 /**
       
  1284  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0017
       
  1285  @SYMComponent telephony_ctsy
       
  1286  @SYMTestCaseDesc Test support in CTSY for dialling and hanging up an ISV call
       
  1287  @SYMTestPriority High
       
  1288  @SYMTestActions Invokes dialling then hanging up a voice call using CTelephony
       
  1289  @SYMTestExpectedResults Pass
       
  1290  @SYMTestType CT
       
  1291  */
       
  1292 void CCTsyCallControlFU::TestUseCase0017L()
       
  1293 	{
       
  1294 	OpenEtelServerL(EUseExtendedError);
       
  1295 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1296 	OpenPhoneL();
       
  1297 
       
  1298 	RMmCustomAPI customApi;
       
  1299 	OpenCustomApiLC(customApi);
       
  1300 	
       
  1301 	RBuf8 data;
       
  1302 	CleanupClosePushL(data);
       
  1303 	
       
  1304 	TDesC* phoneNumberPtr = const_cast<TDesC*>(&KPhoneNumber);
       
  1305 	TBool isEmergency = EFalse;
       
  1306 	TMockLtsyData2<TDesC*, TBool> queryIsEmergencyNumberExpData(phoneNumberPtr,isEmergency);
       
  1307 	queryIsEmergencyNumberExpData.SerialiseL(data);
       
  1308 	iMockLTSY.ExpectL(MLtsyDispatchCallControlQueryIsEmergencyNumber::KLtsyDispatchCallControlQueryIsEmergencyNumberApiId, data);
       
  1309 	data.Close();
       
  1310 	
       
  1311 	TInt callId = 1;
       
  1312 	RMobilePhone::TMobileService mode = RMobilePhone::EVoiceService;
       
  1313 	DriverDialCallL(callId, mode, ETrue);
       
  1314 
       
  1315 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  1316 	DriverHangUpCallL(callId, hangUpCause);
       
  1317 
       
  1318 	ClientSetIsvPubSubKeyL();
       
  1319 
       
  1320 	TRequestStatus reqStatusTerminated;
       
  1321 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1322 	
       
  1323 	CIsvAO* isvAO = CIsvAO::NewL();
       
  1324 	CleanupStack::PushL(isvAO);
       
  1325 
       
  1326 	isvAO->DoOperation(CIsvAO::EIsvDial);
       
  1327 	ASSERT_EQUALS(KErrNone, isvAO->Status().Int());
       
  1328 
       
  1329 	isvAO->DoOperation(CIsvAO::EIsvHangUp);
       
  1330 	ASSERT_EQUALS(KErrNone, isvAO->Status().Int());
       
  1331 
       
  1332 	User::WaitForRequest(reqStatusTerminated);
       
  1333 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1334 	
       
  1335 	AssertMockLtsyStatusL();
       
  1336 	CleanupStack::PopAndDestroy(4, this); //isvAO, data, customApi, this
       
  1337 	} // CCTsyCallControlFU::TestUseCase0017L
       
  1338 
       
  1339 /**
       
  1340  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0018
       
  1341  @SYMComponent telephony_ctsy
       
  1342  @SYMTestCaseDesc Test support in CTSY for getting notification of and answering an incoming call using CTelephony
       
  1343  @SYMTestPriority High
       
  1344  @SYMTestActions Invokes CTelephony APIs to get notification of an incoming call, answer it.
       
  1345  @SYMTestExpectedResults Pass
       
  1346  @SYMTestType CT
       
  1347  */
       
  1348 void CCTsyCallControlFU::TestUseCase0018L()
       
  1349 	{
       
  1350 	OpenEtelServerL(EUseExtendedError);
       
  1351 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1352 	OpenPhoneL();
       
  1353 
       
  1354 	ClientSetIsvPubSubKeyL();
       
  1355 
       
  1356 	CIsvAO* isvAO = CIsvAO::NewL();
       
  1357 	CleanupStack::PushL(isvAO);
       
  1358 
       
  1359 	TInt callId = 1;
       
  1360 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1361 	DriverCreateIncomingCallL(callId, mobileService);
       
  1362 
       
  1363 	isvAO->DoOperation(CIsvAO::EIsvNotifyIncomingCall);
       
  1364 	ASSERT_EQUALS(KErrNone, isvAO->Status().Int());
       
  1365 
       
  1366 	DriverCompleteGetMobileCallInfoL(callId, mobileService);
       
  1367 
       
  1368 	DriverAnswerIncomingCallL(callId, mobileService, ETrue);
       
  1369 
       
  1370     TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
  1371     DriverHangUpCallL(callId, hangUpCause);
       
  1372 
       
  1373 	TRequestStatus reqStatusTerminated;
       
  1374 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1375     
       
  1376 	isvAO->DoOperation(CIsvAO::EIsvAnswer);
       
  1377 	ASSERT_EQUALS(KErrNone, isvAO->Status().Int());
       
  1378 
       
  1379 	isvAO->DoOperation(CIsvAO::EIsvHangUp);
       
  1380 	ASSERT_EQUALS(KErrNone, isvAO->Status().Int());
       
  1381 
       
  1382 	User::WaitForRequest(reqStatusTerminated);
       
  1383 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1384 	
       
  1385 	AssertMockLtsyStatusL();
       
  1386 	CleanupStack::PopAndDestroy(2, this); // isvAO, this
       
  1387 	} // CCTsyCallControlFU::TestUseCase0018L
       
  1388 
       
  1389 /**
       
  1390  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0019
       
  1391  @SYMComponent telephony_ctsy
       
  1392  @SYMTestCaseDesc Test support in CTSY for dialling an emergency call
       
  1393  @SYMTestPriority High
       
  1394  @SYMTestActions Invokes dialling of an emergency call
       
  1395  @SYMTestExpectedResults Pass
       
  1396  @SYMTestType CT
       
  1397  */
       
  1398 void CCTsyCallControlFU::TestUseCase0019L()
       
  1399 	{
       
  1400 	OpenEtelServerL(EUseExtendedError);
       
  1401 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1402 	OpenPhoneL();
       
  1403 
       
  1404 	RBuf8 data;
       
  1405 	CleanupClosePushL(data);
       
  1406 
       
  1407 	RMobileENStore::TEmergencyNumber emergencyNumber = _L("911");
       
  1408 	TMockLtsyData1<RMobileENStore::TEmergencyNumber> dialData(emergencyNumber);
       
  1409 	dialData.SerialiseL(data);
       
  1410 	iMockLTSY.ExpectL(MLtsyDispatchCallControlDialEmergency::KLtsyDispatchCallControlDialEmergencyApiId, data);
       
  1411 
       
  1412 	TInt callId = 1;
       
  1413 	TMockLtsyData1<TInt> dialData2(callId);
       
  1414 	data.Close();
       
  1415 	dialData2.SerialiseL(data);
       
  1416 	iMockLTSY.CompleteL(MLtsyDispatchCallControlDialEmergency::KLtsyDispatchCallControlDialEmergencyApiId, KErrNone, data);
       
  1417 
       
  1418 	RMobilePhone::TMobileService mode = RMobilePhone::EVoiceService;
       
  1419 	DriverCompleteGetMobileCallInfoL(callId, mode);
       
  1420 	DriverCompleteSuccessfulDialNotificationsL(callId);
       
  1421 
       
  1422 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  1423 	DriverHangUpCallL(callId, hangUpCause);
       
  1424 
       
  1425 	// Client side test
       
  1426 
       
  1427     RMobileLine mobileLine;
       
  1428 	CleanupClosePushL(mobileLine);
       
  1429 	RMobileCall mobileCall;
       
  1430 	CleanupClosePushL(mobileCall);
       
  1431 
       
  1432 	ClientDialCallL(mobileLine, mobileCall, mode, ETrue);
       
  1433 
       
  1434 	TRequestStatus reqStatusTerminated;
       
  1435 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1436 	
       
  1437 	ClientHangUpCallL(mobileCall);
       
  1438 
       
  1439 	mobileCall.Close();
       
  1440 	mobileLine.Close();
       
  1441 	data.Close();
       
  1442 
       
  1443 	User::WaitForRequest(reqStatusTerminated);
       
  1444 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1445 	
       
  1446 	AssertMockLtsyStatusL();
       
  1447 	CleanupStack::PopAndDestroy(4, this); // mobileLine, mobileCall, data, this
       
  1448 	} // CCTsyCallControlFU::TestUseCase0019L
       
  1449 
       
  1450 
       
  1451 /**
       
  1452  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0020
       
  1453  @SYMComponent telephony_ctsy
       
  1454  @SYMTestCaseDesc Test support in CTSY for failed dialling an emergency call
       
  1455  @SYMTestPriority High
       
  1456  @SYMTestActions Invokes dialling an emergency call
       
  1457  @SYMTestExpectedResults Pass
       
  1458  @SYMTestType CT
       
  1459  */
       
  1460 void CCTsyCallControlFU::TestUseCase0020L()
       
  1461 	{
       
  1462 	OpenEtelServerL(EUseExtendedError);
       
  1463 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1464 	OpenPhoneL();
       
  1465 
       
  1466 	RBuf8 data;
       
  1467 	CleanupClosePushL(data);
       
  1468 
       
  1469 	RMobileENStore::TEmergencyNumber emergencyNumber = _L("911");
       
  1470 	TMockLtsyData1<RMobileENStore::TEmergencyNumber> dialData(emergencyNumber);
       
  1471 	dialData.SerialiseL(data);
       
  1472 	iMockLTSY.ExpectL(MLtsyDispatchCallControlDialEmergency::KLtsyDispatchCallControlDialEmergencyApiId, data);
       
  1473 
       
  1474 	TInt callId = 1;
       
  1475 	RMobilePhone::TMobileService mode = RMobilePhone::EVoiceService;
       
  1476 	TMockLtsyCallData0 dialData2(callId, mode); // Mode not actually used
       
  1477 	data.Close();
       
  1478 	dialData2.SerialiseL(data);
       
  1479 	iMockLTSY.CompleteL(MLtsyDispatchCallControlDialEmergency::KLtsyDispatchCallControlDialEmergencyApiId, KErrGeneral, data);
       
  1480 
       
  1481 	// Client side test
       
  1482 
       
  1483     RMobileLine mobileLine;
       
  1484 	CleanupClosePushL(mobileLine);
       
  1485 	RMobileCall mobileCall;
       
  1486 	CleanupClosePushL(mobileCall);
       
  1487 
       
  1488 	OpenLineAndCallL(mobileLine, mobileCall, mode);
       
  1489 
       
  1490 	TRequestStatus dialStatus;
       
  1491 	mobileCall.DialEmergencyCall(dialStatus, emergencyNumber);
       
  1492 	User::WaitForRequest(dialStatus);
       
  1493 	ASSERT_EQUALS(KErrGeneral, dialStatus.Int());
       
  1494 
       
  1495 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown;
       
  1496 	mobileCall.GetMobileCallStatus(callStatus);
       
  1497 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
  1498 
       
  1499 	mobileCall.Close();
       
  1500 	mobileLine.Close();
       
  1501 	data.Close();
       
  1502 
       
  1503 	AssertMockLtsyStatusL();
       
  1504 	CleanupStack::PopAndDestroy(4, this); // mobileLine, mobileCall, data, this
       
  1505 	} // CCTsyCallControlFU::TestUseCase0020L
       
  1506 
       
  1507 /**
       
  1508  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0021
       
  1509  @SYMComponent telephony_ctsy
       
  1510  @SYMTestCaseDesc Test support in CTSY for transferring a call
       
  1511  @SYMTestPriority High
       
  1512  @SYMTestActions Invokes RMobileCall::Transfer
       
  1513  @SYMTestExpectedResults Pass
       
  1514  @SYMTestType CT
       
  1515  */
       
  1516 void CCTsyCallControlFU::TestUseCase0021L()
       
  1517 	{
       
  1518 	OpenEtelServerL(EUseExtendedError);
       
  1519 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1520 	OpenPhoneL();
       
  1521 
       
  1522 	RBuf8 data;
       
  1523 	CleanupClosePushL(data);
       
  1524 
       
  1525 	TInt callId = 1;
       
  1526 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1527 	DriverDialCallL(callId, mobileService);
       
  1528 
       
  1529 	DriverHoldCallL(callId, KErrNone);
       
  1530 
       
  1531 	TInt callId2 = 2;
       
  1532 	DriverDialCallL(callId2, mobileService);
       
  1533 
       
  1534 	TMockLtsyData2<TInt, TInt> mockData(callId, callId2);
       
  1535 	data.Close();
       
  1536 	mockData.SerialiseL(data);
       
  1537 	iMockLTSY.ExpectL(MLtsyDispatchCallControlTransfer::KLtsyDispatchCallControlTransferApiId, data);
       
  1538 
       
  1539     iMockLTSY.CompleteL(MLtsyDispatchCallControlTransfer::KLtsyDispatchCallControlTransferApiId, KErrNone);
       
  1540 
       
  1541     RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusIdle;
       
  1542     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData(
       
  1543   	    				callId, RMobilePhone::EServiceUnspecified, callStatus);
       
  1544     data.Close();
       
  1545     mockCallData.SerialiseL(data);
       
  1546     iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  1547 
       
  1548     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(
       
  1549       	    				callId2, RMobilePhone::EServiceUnspecified, callStatus);
       
  1550     data.Close();
       
  1551     mockCallData2.SerialiseL(data);
       
  1552     iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  1553     
       
  1554     data.Close();
       
  1555     
       
  1556 	TUint32 duration = 3; //this is the length of the call and its not possible to be certain of this due to
       
  1557 							//e.g. logging statements so this argument is not actually checked in the mockltsy
       
  1558 	TMockLtsyData1<TUint32> durationLtsyData(duration);
       
  1559 	durationLtsyData.SerialiseL(data);
       
  1560 	iMockLTSY.ExpectL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, data, KErrNone);
       
  1561 	data.Close();
       
  1562 
       
  1563 	TRequestStatus termiantedReqStatus;
       
  1564 	iMockLTSY.NotifyTerminated(termiantedReqStatus);
       
  1565 	iMockLTSY.CompleteL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, KErrNone);
       
  1566     
       
  1567 	// Client side test
       
  1568 
       
  1569     RMobileLine mobileLine;
       
  1570 	CleanupClosePushL(mobileLine);
       
  1571 	RMobileCall mobileCall;
       
  1572 	CleanupClosePushL(mobileCall);
       
  1573 
       
  1574 	RMobileLine mobileLine2;
       
  1575 	CleanupClosePushL(mobileLine2);
       
  1576 	RMobileCall mobileCall2;
       
  1577 	CleanupClosePushL(mobileCall2);
       
  1578 
       
  1579 	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
       
  1580 			mobileCall2, mobileLine2);
       
  1581 
       
  1582 	TRequestStatus notifyStatus;
       
  1583 	mobileCall.NotifyMobileCallStatusChange(notifyStatus, callStatus);
       
  1584 
       
  1585 	TRequestStatus notifyStatus2;
       
  1586 	RMobileCall::TMobileCallStatus callStatus2;
       
  1587 	mobileCall2.NotifyMobileCallStatusChange(notifyStatus2, callStatus2);
       
  1588 
       
  1589 	TRequestStatus transferStatus;
       
  1590 	mobileCall.Transfer(transferStatus);
       
  1591 	User::WaitForRequest(transferStatus);
       
  1592 	ASSERT_EQUALS(KErrNone, transferStatus.Int());
       
  1593 
       
  1594 	User::WaitForRequest(notifyStatus);
       
  1595 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
  1596 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
  1597 
       
  1598 	User::WaitForRequest(notifyStatus2);
       
  1599 	ASSERT_EQUALS(KErrNone, notifyStatus2.Int());
       
  1600 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus2);
       
  1601 
       
  1602 	User::WaitForRequest(termiantedReqStatus);
       
  1603 	ASSERT_EQUALS(KErrNone, termiantedReqStatus.Int());
       
  1604 
       
  1605 	AssertMockLtsyStatusL();
       
  1606 	CleanupStack::PopAndDestroy(6, this); //mobileCall2, mobileLine2, mobileCall, mobileLine, data, this
       
  1607 	} // CCTsyCallControlFU::TestUseCase0021L
       
  1608 
       
  1609 
       
  1610 /**
       
  1611  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0022
       
  1612  @SYMComponent telephony_ctsy
       
  1613  @SYMTestCaseDesc Test support in CTSY for failure to transfer a call
       
  1614  @SYMTestPriority High
       
  1615  @SYMTestActions Invokes RMobileCall::Transfer
       
  1616  @SYMTestExpectedResults Pass
       
  1617  @SYMTestType CT
       
  1618  */
       
  1619 void CCTsyCallControlFU::TestUseCase0022L()
       
  1620 	{
       
  1621 	OpenEtelServerL(EUseExtendedError);
       
  1622 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1623 	OpenPhoneL();
       
  1624 
       
  1625 	RBuf8 data;
       
  1626 	CleanupClosePushL(data);
       
  1627 
       
  1628 	TInt callId = 1;
       
  1629 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1630 	DriverDialCallL(callId, mobileService);
       
  1631 
       
  1632 	DriverHoldCallL(callId, KErrNone);
       
  1633 
       
  1634 	TInt callId2 = 2;
       
  1635 	DriverDialCallL(callId2, mobileService);
       
  1636 
       
  1637 	TMockLtsyData2<TInt, TInt> mockData(callId, callId2);
       
  1638 	data.Close();
       
  1639 	mockData.SerialiseL(data);
       
  1640 
       
  1641 	iMockLTSY.ExpectL(MLtsyDispatchCallControlTransfer::KLtsyDispatchCallControlTransferApiId, data);
       
  1642 
       
  1643     iMockLTSY.CompleteL(MLtsyDispatchCallControlTransfer::KLtsyDispatchCallControlTransferApiId, KErrGeneral);
       
  1644 
       
  1645 	// Client side test
       
  1646 
       
  1647     RMobileLine mobileLine;
       
  1648 	CleanupClosePushL(mobileLine);
       
  1649 	RMobileCall mobileCall;
       
  1650 	CleanupClosePushL(mobileCall);
       
  1651 
       
  1652 	RMobileLine mobileLine2;
       
  1653 	CleanupClosePushL(mobileLine2);
       
  1654 	RMobileCall mobileCall2;
       
  1655 	CleanupClosePushL(mobileCall2);
       
  1656 
       
  1657 	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
       
  1658 			mobileCall2, mobileLine2);
       
  1659 
       
  1660 	// Transfer call, which fails, check first call is still on hold and second
       
  1661 	// is still connected
       
  1662 	TRequestStatus notifyStatus;
       
  1663 	RMobileCall::TMobileCallStatus callStatus;
       
  1664 	mobileCall.NotifyMobileCallStatusChange(notifyStatus, callStatus);
       
  1665 
       
  1666 	TRequestStatus notifyStatus2;
       
  1667 	RMobileCall::TMobileCallStatus callStatus2;
       
  1668 	mobileCall2.NotifyMobileCallStatusChange(notifyStatus2, callStatus2);
       
  1669 
       
  1670 	TRequestStatus transferStatus;
       
  1671 	mobileCall.Transfer(transferStatus);
       
  1672 	User::WaitForRequest(transferStatus);
       
  1673 	ASSERT_EQUALS(KErrGeneral, transferStatus.Int());
       
  1674 
       
  1675 	ASSERT_EQUALS(KRequestPending, notifyStatus.Int());
       
  1676 	mobileCall.CancelAsyncRequest(EMobileCallNotifyMobileCallStatusChange);
       
  1677 	User::WaitForRequest(notifyStatus);
       
  1678 	ASSERT_EQUALS(KErrCancel, notifyStatus.Int());
       
  1679 
       
  1680 	mobileCall.GetMobileCallStatus(callStatus);
       
  1681 	ASSERT_EQUALS(RMobileCall::EStatusHold, callStatus);
       
  1682 
       
  1683 	ASSERT_EQUALS(KRequestPending, notifyStatus2.Int());
       
  1684 	mobileCall2.CancelAsyncRequest(EMobileCallNotifyMobileCallStatusChange);
       
  1685 	ASSERT_EQUALS(KErrCancel, notifyStatus2.Int());
       
  1686 
       
  1687 	mobileCall2.GetMobileCallStatus(callStatus2);
       
  1688 	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus2);
       
  1689 
       
  1690 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  1691 	
       
  1692 	DriverHangUpCallL(callId, hangUpCause, EFalse);
       
  1693 	ClientHangUpCallL(mobileCall);
       
  1694 	
       
  1695 	TRequestStatus reqStatusTerminated;
       
  1696 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1697 	
       
  1698 	DriverHangUpCallL(callId2, hangUpCause, ETrue);
       
  1699 	ClientHangUpCallL(mobileCall2);
       
  1700 
       
  1701 	User::WaitForRequest(reqStatusTerminated);
       
  1702 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1703 	
       
  1704 	AssertMockLtsyStatusL();
       
  1705 	
       
  1706 	CleanupStack::PopAndDestroy(6, this); //mobileCall2, mobileLine2, mobileCall, mobileLine, data, this
       
  1707 	} // CCTsyCallControlFU::TestUseCase0022L
       
  1708 
       
  1709 /**
       
  1710  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0023
       
  1711  @SYMComponent telephony_ctsy
       
  1712  @SYMTestCaseDesc Test support in CTSY for sending a DTMF string containing a 'w' and continuing after the 'w'
       
  1713  @SYMTestPriority High
       
  1714  @SYMTestActions Invokes RMobilePhone::SendDTMFTones with a 'w' in the string then RMobilePhone::ContinueDTMFStringSending
       
  1715  @SYMTestExpectedResults Pass
       
  1716  @SYMTestType CT
       
  1717  */
       
  1718 void CCTsyCallControlFU::TestUseCase0023L()
       
  1719 	{
       
  1720 	OpenEtelServerL(EUseExtendedError);
       
  1721 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1722 	OpenPhoneL();
       
  1723 
       
  1724 	RBuf8 data;
       
  1725 	CleanupClosePushL(data);
       
  1726 
       
  1727 	TInt callId = 1;
       
  1728 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1729 	DriverDialCallL(callId, mobileService);
       
  1730 
       
  1731 	TInfoName fullTonesString = _L("12345w67890wABCD");
       
  1732 	TBuf<5> tonesFirstPart;
       
  1733 	tonesFirstPart.Copy(fullTonesString.Left(5)); // 12345
       
  1734 	TMockLtsyData2<TInt, TBuf<5> > toneLtsyData(callId, tonesFirstPart);
       
  1735 	toneLtsyData.SerialiseL(data);
       
  1736 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  1737 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  1738 
       
  1739 	TBuf<5> tonesSecondPart;
       
  1740 	tonesSecondPart.Copy(fullTonesString.Mid(6, 5)); // 67890
       
  1741 	data.Close();
       
  1742 	TMockLtsyData2<TInt, TBuf<5> > toneLtsyData2(callId, tonesSecondPart);
       
  1743 	toneLtsyData2.SerialiseL(data);
       
  1744 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  1745 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  1746 
       
  1747 	TBuf<4> tonesThirdPart;
       
  1748 	tonesThirdPart.Copy(fullTonesString.Mid(12, 4)); // ABCD
       
  1749 	data.Close();
       
  1750 	TMockLtsyData2<TInt, TBuf<4> > toneLtsyData3(callId, tonesThirdPart);
       
  1751 	toneLtsyData3.SerialiseL(data);
       
  1752 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  1753 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  1754 
       
  1755 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  1756 	DriverHangUpCallL(callId, hangUpCause);
       
  1757 
       
  1758 	// Client side test
       
  1759 
       
  1760 	RMobileLine mobileLine;
       
  1761 	CleanupClosePushL(mobileLine);
       
  1762 	RMobileCall mobileCall;
       
  1763 	CleanupClosePushL(mobileCall);
       
  1764 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  1765 
       
  1766 	TRequestStatus notifyStopStatus;
       
  1767 	iPhone.NotifyStopInDTMFString(notifyStopStatus);
       
  1768 
       
  1769 	TRequestStatus sendStatus;
       
  1770 	iPhone.SendDTMFTones(sendStatus, fullTonesString);
       
  1771 
       
  1772 	User::WaitForRequest(notifyStopStatus);
       
  1773 	ASSERT_EQUALS(KErrNone, notifyStopStatus.Int());
       
  1774 	iPhone.NotifyStopInDTMFString(notifyStopStatus);
       
  1775 
       
  1776 	ASSERT_EQUALS(KErrNone, iPhone.ContinueDTMFStringSending(ETrue));
       
  1777 
       
  1778 	User::WaitForRequest(notifyStopStatus);
       
  1779 	ASSERT_EQUALS(KErrNone, notifyStopStatus.Int());
       
  1780 
       
  1781 	ASSERT_EQUALS(KErrNone, iPhone.ContinueDTMFStringSending(ETrue));
       
  1782 
       
  1783 	User::WaitForRequest(sendStatus);
       
  1784 	ASSERT_EQUALS(KErrNone, sendStatus.Int());
       
  1785 
       
  1786 	TRequestStatus reqStatusTerminated;
       
  1787 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1788 
       
  1789 	ClientHangUpCallL(mobileCall);
       
  1790 
       
  1791 	User::WaitForRequest(reqStatusTerminated);
       
  1792 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1793 	
       
  1794 	AssertMockLtsyStatusL();
       
  1795 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
  1796 	} // CCTsyCallControlFU::TestUseCase0023L
       
  1797 
       
  1798 /**
       
  1799  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0024
       
  1800  @SYMComponent telephony_ctsy
       
  1801  @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SendDTMFTones with 'w' and not continuing
       
  1802  @SYMTestPriority High
       
  1803  @SYMTestActions Invokes RMobilePhone::SendDTMFTones with 'w' and RMobilePhone::ContinueDTMFStringSending with EFalse
       
  1804  @SYMTestExpectedResults Pass
       
  1805  @SYMTestType CT
       
  1806  */
       
  1807 void CCTsyCallControlFU::TestUseCase0024L()
       
  1808 	{
       
  1809 	OpenEtelServerL(EUseExtendedError);
       
  1810 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1811 	OpenPhoneL();
       
  1812 
       
  1813 	RBuf8 data;
       
  1814 	CleanupClosePushL(data);
       
  1815 
       
  1816 	TInt callId = 1;
       
  1817 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1818 	DriverDialCallL(callId, mobileService);
       
  1819 
       
  1820 	TInfoName fullTonesString = _L("12345w67890");
       
  1821 	TBuf<5> tonesFirstPart;
       
  1822 	tonesFirstPart.Copy(fullTonesString.Left(5)); // 12345
       
  1823 	TMockLtsyData2<TInt, TBuf<5> > toneLtsyData(callId, tonesFirstPart);
       
  1824 	toneLtsyData.SerialiseL(data);
       
  1825 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  1826 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  1827 
       
  1828 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  1829 	DriverHangUpCallL(callId, hangUpCause);
       
  1830 
       
  1831 	// Client side test
       
  1832 
       
  1833 	RMobileLine mobileLine;
       
  1834 	CleanupClosePushL(mobileLine);
       
  1835 	RMobileCall mobileCall;
       
  1836 	CleanupClosePushL(mobileCall);
       
  1837 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  1838 
       
  1839 	TRequestStatus notifyStopStatus;
       
  1840 	iPhone.NotifyStopInDTMFString(notifyStopStatus);
       
  1841 
       
  1842 	TRequestStatus sendStatus;
       
  1843 	iPhone.SendDTMFTones(sendStatus, fullTonesString);
       
  1844 
       
  1845 	User::WaitForRequest(notifyStopStatus);
       
  1846 	ASSERT_EQUALS(KErrNone, notifyStopStatus.Int());
       
  1847 
       
  1848 	ASSERT_EQUALS(KErrNone, iPhone.ContinueDTMFStringSending(EFalse));
       
  1849 
       
  1850 	User::WaitForRequest(sendStatus);
       
  1851 	ASSERT_EQUALS(KErrAbort, sendStatus.Int());
       
  1852 
       
  1853 	TRequestStatus reqStatusTerminated;
       
  1854 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1855 	
       
  1856 	ClientHangUpCallL(mobileCall);
       
  1857 
       
  1858 	User::WaitForRequest(reqStatusTerminated);
       
  1859 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1860 	
       
  1861 	AssertMockLtsyStatusL();
       
  1862 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  1863 	} // CCTsyCallControlFU::TestUseCase0024L
       
  1864 
       
  1865 /**
       
  1866  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UC0025
       
  1867  @SYMComponent telephony_ctsy
       
  1868  @SYMTestCaseDesc Test support in CTSY for dialling a call using the alternate line
       
  1869  @SYMTestPriority High
       
  1870  @SYMTestActions Invokes dialling a call using the alternate line
       
  1871  @SYMTestExpectedResults Pass
       
  1872  @SYMTestType CT
       
  1873  */
       
  1874 void CCTsyCallControlFU::TestUseCase0025L()
       
  1875 	{
       
  1876 	OpenEtelServerL(EUseExtendedError);
       
  1877 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1878 	OpenPhoneL();
       
  1879 
       
  1880 	RBuf8 data;
       
  1881 	CleanupClosePushL(data);
       
  1882 
       
  1883 	TInt callId = 1;
       
  1884 	RMobilePhone::TMobileService mobileService = RMobilePhone::EAuxVoiceService;
       
  1885 	DriverDialCallL(callId, mobileService);
       
  1886 
       
  1887 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  1888 	DriverHangUpCallL(callId, hangUpCause);
       
  1889 
       
  1890 	// Client Side Test
       
  1891 
       
  1892 	RMobileLine mobileLine;
       
  1893 	CleanupClosePushL(mobileLine);
       
  1894 	RMobileCall mobileCall;
       
  1895 	CleanupClosePushL(mobileCall);
       
  1896 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  1897 	
       
  1898 	TRequestStatus reqStatusTerminated;
       
  1899 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  1900 	
       
  1901 	ClientHangUpCallL(mobileCall);
       
  1902 	
       
  1903 	User::WaitForRequest(reqStatusTerminated);
       
  1904 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  1905 		
       
  1906 	mobileCall.Close();
       
  1907 	mobileLine.Close();
       
  1908 	data.Close();
       
  1909 
       
  1910 	AssertMockLtsyStatusL();
       
  1911 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  1912 	} // CCTsyCallControlFU::TestUseCase0025L
       
  1913 
       
  1914 
       
  1915 //
       
  1916 // Other unit tests
       
  1917 //
       
  1918 
       
  1919 /**
       
  1920 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0001
       
  1921 @SYMComponent telephony_ctsy
       
  1922 @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobilePhone::GetIdentityServiceStatus
       
  1923 @SYMTestPriority High
       
  1924 @SYMTestActions Invokes RMobilePhone::GetIdentityServiceStatus
       
  1925 @SYMTestExpectedResults Pass
       
  1926 @SYMTestType UT
       
  1927 */
       
  1928 void CCTsyCallControlFU::TestUnit0001L()
       
  1929 	{
       
  1930 	OpenEtelServerL(EUseExtendedError);
       
  1931 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1932 	OpenPhoneL();
       
  1933 
       
  1934 	RBuf8 data;
       
  1935 	CleanupClosePushL(data);
       
  1936 
       
  1937 	RMobilePhone::TMobilePhoneIdService expService(RMobilePhone::EIdServiceCallerPresentation);
       
  1938 	TMockLtsyData1<RMobilePhone::TMobilePhoneIdService> expLtsyData(expService);
       
  1939 	data.Close();
       
  1940 	expLtsyData.SerialiseL(data);
       
  1941 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetIdentityServiceStatus::KLtsyDispatchCallControlGetIdentityServiceStatusApiId, data);
       
  1942 
       
  1943 	RMobilePhone::TMobilePhoneIdServiceStatus completeStatus(RMobilePhone::EIdServiceActivePermanent);
       
  1944 	TMockLtsyData1<RMobilePhone::TMobilePhoneIdServiceStatus> completeLtsyData(completeStatus);
       
  1945 	data.Close();
       
  1946 	completeLtsyData.SerialiseL(data);
       
  1947 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetIdentityServiceStatus::KLtsyDispatchCallControlGetIdentityServiceStatusApiId, KErrNone, data);
       
  1948 
       
  1949 	// Client Side Test
       
  1950 
       
  1951 	TRequestStatus reqStatus;
       
  1952 	RMobilePhone::TMobilePhoneIdServiceStatus status;
       
  1953 	iPhone.GetIdentityServiceStatus(reqStatus, expService, status);
       
  1954 	User::WaitForRequest(reqStatus);
       
  1955 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1956 	ASSERT_EQUALS(completeStatus, status);
       
  1957 
       
  1958 	AssertMockLtsyStatusL();
       
  1959 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1960 
       
  1961 	} // CCTsyCallControlFU::TestUnit0001L
       
  1962 
       
  1963 /**
       
  1964  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0002
       
  1965  @SYMComponent telephony_ctsy
       
  1966  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomApi::CheckEmergencyNumber to check emergency number querying
       
  1967  @SYMTestPriority High
       
  1968  @SYMTestActions Invokes RMmCustomApi::CheckEmergencyNumber to check emergency number querying
       
  1969  @SYMTestExpectedResults Pass
       
  1970  @SYMTestType UT
       
  1971  */
       
  1972 void CCTsyCallControlFU::TestUnit0002L()
       
  1973 	{
       
  1974 	OpenEtelServerL(EUseExtendedError);
       
  1975 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1976 	OpenPhoneL();
       
  1977 
       
  1978 	RMmCustomAPI customApi;
       
  1979 	OpenCustomApiLC(customApi);
       
  1980 
       
  1981 	RBuf8 data;
       
  1982 	CleanupClosePushL(data);
       
  1983 	
       
  1984 	TDesC* phoneNumberPtr = const_cast<TDesC*>(&KEmergencyPhoneNumber);
       
  1985 	TBool isEmergency = ETrue;
       
  1986 	TMockLtsyData2<TDesC*, TBool> queryIsEmergencyNumberExpData(phoneNumberPtr, isEmergency);
       
  1987 	queryIsEmergencyNumberExpData.SerialiseL(data);
       
  1988 	iMockLTSY.ExpectL(MLtsyDispatchCallControlQueryIsEmergencyNumber::KLtsyDispatchCallControlQueryIsEmergencyNumberApiId, data);
       
  1989 	data.Close();
       
  1990 	
       
  1991 	TRequestStatus reqStatus;
       
  1992 	RMmCustomAPI::TEmerNumberCheckMode numCheckMode;
       
  1993 	numCheckMode.iCheckMode = RMmCustomAPI::EEmerNumberCheckNormal;
       
  1994 	numCheckMode.iNumber = KEmergencyPhoneNumber;
       
  1995 	TBool emergencyNumCheckResult = EFalse;
       
  1996 	customApi.CheckEmergencyNumber(reqStatus, numCheckMode, emergencyNumCheckResult);
       
  1997 	User::WaitForRequest(reqStatus);
       
  1998 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1999 	ASSERT_EQUALS(emergencyNumCheckResult, isEmergency);
       
  2000 
       
  2001 	customApi.Close();
       
  2002 
       
  2003 	AssertMockLtsyStatusL();
       
  2004 	CleanupStack::PopAndDestroy(3, this); // customApi, data, this
       
  2005 
       
  2006 	} // CCTsyCallControlFU::TestUnit0002L
       
  2007 
       
  2008 
       
  2009 /**
       
  2010  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN003
       
  2011  @SYMComponent telephony_ctsy
       
  2012  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobilePhone::SetALSLine
       
  2013  @SYMTestPriority High
       
  2014  @SYMTestActions Invokes RMobilePhone::SetALSLine
       
  2015  @SYMTestExpectedResults Pass
       
  2016  @SYMTestType UT
       
  2017  */
       
  2018 void CCTsyCallControlFU::TestUnit0003L()
       
  2019 	{
       
  2020 	OpenEtelServerL(EUseExtendedError);
       
  2021 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2022 	OpenPhoneL();
       
  2023 
       
  2024 	RBuf8 data;
       
  2025 	CleanupClosePushL(data);
       
  2026 
       
  2027 	RMobilePhone::TMobilePhoneALSLine alsLine = RMobilePhone::EAlternateLineAuxiliary;
       
  2028 	TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> expLtsyData(alsLine);
       
  2029 	data.Close();
       
  2030 	expLtsyData.SerialiseL(data);
       
  2031 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSetActiveAlsLine::KLtsyDispatchCallControlSetActiveAlsLineApiId, data);
       
  2032 
       
  2033 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSetActiveAlsLine::KLtsyDispatchCallControlSetActiveAlsLineApiId, KErrNone);
       
  2034 
       
  2035 	// Client Side Test
       
  2036 
       
  2037 	const TUid KCRUidCtsyMEAlsLine = { 0x102029A2 };
       
  2038 	const TUint KCtsyMEAlsSupported = { 0x00000002 };
       
  2039 
       
  2040 	// Create centRep to change repository
       
  2041 	CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine );
       
  2042 	CleanupStack::PushL(centRep);
       
  2043 
       
  2044 	TInt ret = centRep->Set( KCtsyMEAlsSupported, ETrue );
       
  2045 	ASSERT_EQUALS(KErrNone, ret);
       
  2046 
       
  2047 	TRequestStatus notifyStatus;
       
  2048 	RMobilePhone::TMobilePhoneALSLine newAlsLine;
       
  2049 	iPhone.NotifyALSLineChange(notifyStatus, newAlsLine);
       
  2050 
       
  2051 	TRequestStatus requestStatus;
       
  2052 	iPhone.SetALSLine(requestStatus, alsLine);
       
  2053 	User::WaitForRequest(requestStatus);
       
  2054 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2055 
       
  2056 	User::WaitForRequest(notifyStatus);
       
  2057 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
  2058 	ASSERT_EQUALS(alsLine, newAlsLine);
       
  2059 
       
  2060 	AssertMockLtsyStatusL();
       
  2061 	CleanupStack::PopAndDestroy(3, this); // centRep, data, this
       
  2062 
       
  2063 	} // CCTsyCallControlFU::TestUnit0003L
       
  2064 
       
  2065 /**
       
  2066  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0004
       
  2067  @SYMComponent telephony_ctsy
       
  2068  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobilePhone::StartDTMFTone and RMobilePhone::StopDTMFTone
       
  2069  @SYMTestPriority High
       
  2070  @SYMTestActions Invokes RMobilePhone::StartDTMFTone and RMobilePhone::StopDTMFTone
       
  2071  @SYMTestExpectedResults Pass
       
  2072  @SYMTestType UT
       
  2073  */
       
  2074 void CCTsyCallControlFU::TestUnit0004L()
       
  2075 	{
       
  2076 	OpenEtelServerL(EUseExtendedError);
       
  2077 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2078 	OpenPhoneL();
       
  2079 
       
  2080 	RBuf8 data;
       
  2081 	CleanupClosePushL(data);
       
  2082 
       
  2083 	TInt callId = 1;
       
  2084 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2085 	DriverDialCallL(callId, mobileService);
       
  2086 
       
  2087 	TChar tone('1');
       
  2088 	TMockLtsyData2<TInt, TChar> toneLtsyData(callId, tone);
       
  2089 	toneLtsyData.SerialiseL(data);
       
  2090 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, data, KErrNone);
       
  2091 
       
  2092 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, KErrNone);
       
  2093 
       
  2094 	TMockLtsyData1<TInt> toneLtsyData2(callId);
       
  2095 	toneLtsyData2.SerialiseL(data);
       
  2096 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, data, KErrNone);
       
  2097 
       
  2098 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, KErrNone);
       
  2099 
       
  2100 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2101 	DriverHangUpCallL(callId, hangUpCause);
       
  2102 
       
  2103 	// Client Side Test
       
  2104 
       
  2105 	RMobileLine mobileLine;
       
  2106 	CleanupClosePushL(mobileLine);
       
  2107 	RMobileCall mobileCall;
       
  2108 	CleanupClosePushL(mobileCall);
       
  2109 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2110 
       
  2111 	ASSERT_EQUALS(KErrNone, iPhone.StartDTMFTone(tone));
       
  2112 
       
  2113 	ASSERT_EQUALS(KErrNone, iPhone.StopDTMFTone());
       
  2114 
       
  2115 	TRequestStatus reqStatusTerminated;
       
  2116 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2117 	
       
  2118 	ClientHangUpCallL(mobileCall);
       
  2119 
       
  2120 	User::WaitForRequest(reqStatusTerminated);
       
  2121 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2122 	
       
  2123 	AssertMockLtsyStatusL();
       
  2124 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2125 	} // CCTsyCallControlFU::TestUnit0004L
       
  2126 
       
  2127 /**
       
  2128  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0005
       
  2129  @SYMComponent telephony_ctsy
       
  2130  @SYMTestCaseDesc Test support in CTSY Dispatcher for cancelling sending of a DTMF string
       
  2131  @SYMTestPriority High
       
  2132  @SYMTestActions Invokes RMobilePhone::SendDTMFTones and cancels it
       
  2133  @SYMTestExpectedResults Pass
       
  2134  @SYMTestType UT
       
  2135  */
       
  2136 void CCTsyCallControlFU::TestUnit0005L()
       
  2137 	{
       
  2138 	OpenEtelServerL(EUseExtendedError);
       
  2139 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2140 	OpenPhoneL();
       
  2141 
       
  2142 	RBuf8 data;
       
  2143 	CleanupClosePushL(data);
       
  2144 
       
  2145 	TInt callId = 1;
       
  2146 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2147 	DriverDialCallL(callId, mobileService);
       
  2148 
       
  2149 	TInfoName tones(_L("123456789"));
       
  2150 	TMockLtsyData2<TInt, TInfoName> toneLtsyData(callId, tones);
       
  2151 	toneLtsyData.SerialiseL(data);
       
  2152 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  2153 
       
  2154 	TMockLtsyData1<TInt> cancelMockData(callId);
       
  2155 	cancelMockData.SerialiseL(data);
       
  2156 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTonesCancel::KLtsyDispatchCallControlSendDtmfTonesCancelApiId, data, KErrNone);
       
  2157 
       
  2158 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTonesCancel::KLtsyDispatchCallControlSendDtmfTonesCancelApiId, KErrNone);
       
  2159 
       
  2160 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2161 	DriverHangUpCallL(callId, hangUpCause);
       
  2162 
       
  2163 	// Client Side Test
       
  2164 
       
  2165 	RMobileLine mobileLine;
       
  2166 	CleanupClosePushL(mobileLine);
       
  2167 	RMobileCall mobileCall;
       
  2168 	CleanupClosePushL(mobileCall);
       
  2169 
       
  2170 	// First test sending cancel when there is no active call in progress
       
  2171 	iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
       
  2172 
       
  2173 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2174 
       
  2175 	// Test sending cancel when there is no SendDTMFTones in progress
       
  2176 	iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
       
  2177 
       
  2178 	// Test sending DTMF tones and then cancelling
       
  2179 
       
  2180 	TRequestStatus reqStatus;
       
  2181 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2182 	iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
       
  2183 	User::WaitForRequest(reqStatus);
       
  2184 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
  2185 
       
  2186 	// Test sending cancel when there is no SendDTMFTones in progress
       
  2187 	// after a cancel
       
  2188 	iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
       
  2189 
       
  2190 	TRequestStatus reqStatusTerminated;
       
  2191 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2192 	
       
  2193 	ClientHangUpCallL(mobileCall);
       
  2194 
       
  2195 	// Test sending cancel when there is no SendDTMFTones in progress
       
  2196 	// and no call in progress
       
  2197 	iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones);
       
  2198 
       
  2199 	User::WaitForRequest(reqStatusTerminated);
       
  2200 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2201 
       
  2202 	
       
  2203 	AssertMockLtsyStatusL();
       
  2204 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2205 
       
  2206 	} // CCTsyCallControlFU::TestUnit0005L
       
  2207 
       
  2208 
       
  2209 /**
       
  2210  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0006
       
  2211  @SYMComponent telephony_ctsy
       
  2212  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobilePhone::StartDTMFTone
       
  2213  @SYMTestPriority High
       
  2214  @SYMTestActions Invokes RMobilePhone::StartDTMFTone
       
  2215  @SYMTestExpectedResults Pass
       
  2216  @SYMTestType UT
       
  2217  */
       
  2218 void CCTsyCallControlFU::TestUnit0006L()
       
  2219 	{
       
  2220 	OpenEtelServerL(EUseExtendedError);
       
  2221 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2222 	OpenPhoneL();
       
  2223 
       
  2224 	RBuf8 data;
       
  2225 	CleanupClosePushL(data);
       
  2226 
       
  2227 	// Set up so that there is an active call for testing sending of DTMF
       
  2228 	TInt callId = 1;
       
  2229 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2230 	DriverDialCallL(callId, mobileService);
       
  2231 
       
  2232 	RMobileLine mobileLine;
       
  2233 	CleanupClosePushL(mobileLine);
       
  2234 	RMobileCall mobileCall;
       
  2235 	CleanupClosePushL(mobileCall);
       
  2236 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2237 
       
  2238  	//-------------------------------------------------------------------------
       
  2239 	// TEST A: failure to dispatch request to LTSY
       
  2240  	//-------------------------------------------------------------------------
       
  2241 
       
  2242 	TChar tone('1');
       
  2243 	TMockLtsyData2<TInt, TChar> toneLtsyData(callId, tone);
       
  2244 	toneLtsyData.SerialiseL(data);
       
  2245 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, data, KErrNotSupported);
       
  2246 
       
  2247 	ASSERT_EQUALS(KErrNotSupported, iPhone.StartDTMFTone(tone));
       
  2248 
       
  2249 	//-------------------------------------------------------------------------
       
  2250 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2251  	//-------------------------------------------------------------------------
       
  2252 
       
  2253 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, data, KErrNone);
       
  2254 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, KErrNotSupported);
       
  2255 
       
  2256 	ASSERT_EQUALS(KErrNotSupported, iPhone.StartDTMFTone(tone));
       
  2257 
       
  2258  	//-------------------------------------------------------------------------
       
  2259 	// TEST C: Successful completion request of
       
  2260 	// RMobilePhone::StartDTMFTone
       
  2261  	//-------------------------------------------------------------------------
       
  2262 
       
  2263 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, data, KErrNone);
       
  2264 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, KErrNone);
       
  2265 
       
  2266 	ASSERT_EQUALS(KErrNone, iPhone.StartDTMFTone(tone));
       
  2267 
       
  2268  	//-------------------------------------------------------------------------
       
  2269 	// TEST E: Unsolicited completion of RMobilePhone::StartDTMFTone
       
  2270 	// from LTSY.
       
  2271  	//-------------------------------------------------------------------------
       
  2272 
       
  2273 	TRequestStatus terminatedStatus;
       
  2274 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
  2275 
       
  2276 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, KErrNone);
       
  2277 
       
  2278 	User::WaitForRequest(terminatedStatus);
       
  2279 
       
  2280 	//-------------------------------------------------------------------------
       
  2281 	// TEST F: Extra coverage tests, extra scenarios
       
  2282  	//-------------------------------------------------------------------------
       
  2283 
       
  2284 	// Test StartDTMFTone when there is no active call
       
  2285 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2286 	DriverHangUpCallL(callId, hangUpCause);
       
  2287 
       
  2288 	TRequestStatus reqStatusTerminated;
       
  2289 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2290 	
       
  2291 	ClientHangUpCallL(mobileCall);
       
  2292 
       
  2293 	ASSERT_EQUALS(KErrEtelCallNotActive, iPhone.StartDTMFTone(tone));
       
  2294 
       
  2295 	User::WaitForRequest(reqStatusTerminated);
       
  2296 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2297 	
       
  2298 	AssertMockLtsyStatusL();
       
  2299 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2300 	} // CCTsyCallControlFU::TestUnit0006L
       
  2301 
       
  2302 /**
       
  2303  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0007
       
  2304  @SYMComponent telephony_ctsy
       
  2305  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobilePhone::StopDTMFTone
       
  2306  @SYMTestPriority High
       
  2307  @SYMTestActions Invokes RMobilePhone::StopDTMFTone
       
  2308  @SYMTestExpectedResults Pass
       
  2309  @SYMTestType UT
       
  2310  */
       
  2311 void CCTsyCallControlFU::TestUnit0007L()
       
  2312 	{
       
  2313 	OpenEtelServerL(EUseExtendedError);
       
  2314 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2315 	OpenPhoneL();
       
  2316 
       
  2317 	RBuf8 data;
       
  2318 	CleanupClosePushL(data);
       
  2319 
       
  2320 	// Set up so that there is an active call for testing stopping of DTMF
       
  2321 	TInt callId = 1;
       
  2322 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2323 	DriverDialCallL(callId, mobileService);
       
  2324 
       
  2325 	RMobileLine mobileLine;
       
  2326 	CleanupClosePushL(mobileLine);
       
  2327 	RMobileCall mobileCall;
       
  2328 	CleanupClosePushL(mobileCall);
       
  2329 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2330 
       
  2331  	//-------------------------------------------------------------------------
       
  2332 	// TEST A: failure to dispatch request to LTSY
       
  2333  	//-------------------------------------------------------------------------
       
  2334 
       
  2335 	TMockLtsyData1<TInt> toneLtsyData(callId);
       
  2336 	toneLtsyData.SerialiseL(data);
       
  2337 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, data, KErrNotSupported);
       
  2338 
       
  2339 	ASSERT_EQUALS(KErrNotSupported, iPhone.StopDTMFTone());
       
  2340 
       
  2341 	//-------------------------------------------------------------------------
       
  2342 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2343  	//-------------------------------------------------------------------------
       
  2344 
       
  2345 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, data, KErrNone);
       
  2346 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, KErrNotSupported);
       
  2347 
       
  2348 	ASSERT_EQUALS(KErrNotSupported, iPhone.StopDTMFTone());
       
  2349 
       
  2350  	//-------------------------------------------------------------------------
       
  2351 	// TEST C: Successful completion request of
       
  2352 	// RMobilePhone::StopDTMFTone
       
  2353  	//-------------------------------------------------------------------------
       
  2354 
       
  2355 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, data, KErrNone);
       
  2356 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, KErrNone);
       
  2357 
       
  2358 	ASSERT_EQUALS(KErrNone, iPhone.StopDTMFTone());
       
  2359 
       
  2360  	//-------------------------------------------------------------------------
       
  2361 	// TEST E: Unsolicited completion of RMobilePhone::StopDTMFTone
       
  2362 	// from LTSY.
       
  2363  	//-------------------------------------------------------------------------
       
  2364 
       
  2365 	TRequestStatus terminatedStatus;
       
  2366 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
  2367 
       
  2368 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, KErrNone);
       
  2369 
       
  2370 	User::WaitForRequest(terminatedStatus);
       
  2371 
       
  2372  	//-------------------------------------------------------------------------
       
  2373 	// TEST F: Coverage test(s) for RMobilePhone::StopDTMFTone
       
  2374  	//-------------------------------------------------------------------------
       
  2375 
       
  2376 	// Test StopDTMFTone when there is no active call
       
  2377 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2378 	DriverHangUpCallL(callId, hangUpCause);
       
  2379 
       
  2380 	TRequestStatus reqStatusTerminated;
       
  2381 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2382 	
       
  2383 	ClientHangUpCallL(mobileCall);
       
  2384 
       
  2385 	ASSERT_EQUALS(KErrEtelCallNotActive, iPhone.StopDTMFTone());
       
  2386 
       
  2387 	User::WaitForRequest(reqStatusTerminated);
       
  2388 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2389 	
       
  2390 	AssertMockLtsyStatusL();
       
  2391 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2392 
       
  2393 	} // CCTsyCallControlFU::TestUnit0007L
       
  2394 
       
  2395 /**
       
  2396  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0008
       
  2397  @SYMComponent telephony_ctsy
       
  2398  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobilePhone::SendDTMFTones
       
  2399  @SYMTestPriority High
       
  2400  @SYMTestActions Invokes RMobilePhone::SendDTMFTones
       
  2401  @SYMTestExpectedResults Pass
       
  2402  @SYMTestType UT
       
  2403  */
       
  2404 void CCTsyCallControlFU::TestUnit0008L()
       
  2405 	{
       
  2406 	OpenEtelServerL(EUseExtendedError);
       
  2407 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2408 	OpenPhoneL();
       
  2409 
       
  2410 	RBuf8 data;
       
  2411 	CleanupClosePushL(data);
       
  2412 
       
  2413 	// Set up so that there is an active call for testing sending of DTMF
       
  2414 	TInt callId = 1;
       
  2415 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2416 	DriverDialCallL(callId, mobileService);
       
  2417 
       
  2418 	RMobileLine mobileLine;
       
  2419 	CleanupClosePushL(mobileLine);
       
  2420 	RMobileCall mobileCall;
       
  2421 	CleanupClosePushL(mobileCall);
       
  2422 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2423 
       
  2424  	//-------------------------------------------------------------------------
       
  2425 	// TEST A: failure to dispatch request to LTSY
       
  2426  	//-------------------------------------------------------------------------
       
  2427 
       
  2428 	TInfoName tones = _L("12345");
       
  2429 	TMockLtsyData2<TInt, TInfoName> toneLtsyData(callId, tones);
       
  2430 	toneLtsyData.SerialiseL(data);
       
  2431 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNotSupported);
       
  2432 
       
  2433 	TRequestStatus reqStatus;
       
  2434 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2435 	User::WaitForRequest(reqStatus);
       
  2436 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  2437 
       
  2438 	//-------------------------------------------------------------------------
       
  2439 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2440  	//-------------------------------------------------------------------------
       
  2441 
       
  2442 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  2443 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNotSupported);
       
  2444 
       
  2445 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2446 	User::WaitForRequest(reqStatus);
       
  2447 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  2448 
       
  2449  	//-------------------------------------------------------------------------
       
  2450 	// TEST C: Successful completion request of
       
  2451 	// RMobilePhone::SendDTMFTones
       
  2452  	//-------------------------------------------------------------------------
       
  2453 
       
  2454 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  2455 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  2456 
       
  2457 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2458 	User::WaitForRequest(reqStatus);
       
  2459 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  2460 
       
  2461  	//-------------------------------------------------------------------------
       
  2462 	// TEST E: Unsolicited completion of RMobilePhone::SendDTMFTones
       
  2463 	// from LTSY.
       
  2464  	//-------------------------------------------------------------------------
       
  2465 
       
  2466 	TRequestStatus terminatedStatus;
       
  2467 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
  2468 
       
  2469 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  2470 
       
  2471 	User::WaitForRequest(terminatedStatus);
       
  2472 
       
  2473  	//-------------------------------------------------------------------------
       
  2474 	// TEST F: Coverage test(s) for RMobilePhone::SendDTMFTones
       
  2475  	//-------------------------------------------------------------------------
       
  2476 
       
  2477 	// Test second clients requesting to send DTMF tones when one request is still
       
  2478 	// pending returns KErrServerBusy
       
  2479 
       
  2480 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  2481 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, KErrNone);
       
  2482 
       
  2483 	// Open second client
       
  2484 	RTelServer telServer2;
       
  2485 	TInt ret = telServer2.Connect();
       
  2486 	ASSERT_EQUALS(KErrNone, ret);
       
  2487 	CleanupClosePushL(telServer2);
       
  2488 
       
  2489 	RMobilePhone phone2;
       
  2490 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  2491 	ASSERT_EQUALS(KErrNone, ret);
       
  2492 	CleanupClosePushL(phone2);
       
  2493 
       
  2494 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2495 	TRequestStatus reqStatus2;
       
  2496 	phone2.SendDTMFTones(reqStatus2, tones);
       
  2497 
       
  2498 	User::WaitForRequest(reqStatus2);
       
  2499 	ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int());
       
  2500 
       
  2501 	User::WaitForRequest(reqStatus);
       
  2502 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  2503 
       
  2504 	// Test SendDtmfTone when there is no active call
       
  2505 
       
  2506 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2507 	DriverHangUpCallL(callId, hangUpCause);
       
  2508 
       
  2509 	TRequestStatus reqStatusTerminated;
       
  2510 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2511 	
       
  2512 	ClientHangUpCallL(mobileCall);
       
  2513 
       
  2514 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2515 	User::WaitForRequest(reqStatus);
       
  2516 	ASSERT_EQUALS(KErrEtelCallNotActive, reqStatus.Int());
       
  2517 
       
  2518 	User::WaitForRequest(reqStatusTerminated);
       
  2519 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2520 	
       
  2521 	AssertMockLtsyStatusL();
       
  2522 	CleanupStack::PopAndDestroy(6, this);//phone2, telserver2, mobileCall, mobileLine, data, this
       
  2523 
       
  2524 	} // CCTsyCallControlFU::TestUnit0008L
       
  2525 
       
  2526 /**
       
  2527  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0009
       
  2528  @SYMComponent telephony_ctsy
       
  2529  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMobileCall::ReceiveUUI
       
  2530  @SYMTestPriority High
       
  2531  @SYMTestActions Invokes RMobileCall::ReceiveUUI
       
  2532  @SYMTestExpectedResults Pass - client receives data from LTSY
       
  2533  @SYMTestType UT
       
  2534  */
       
  2535 void CCTsyCallControlFU::TestUnit0009L()
       
  2536 	{
       
  2537 	OpenEtelServerL(EUseExtendedError);
       
  2538 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2539 	OpenPhoneL();
       
  2540 
       
  2541 	RBuf8 data;
       
  2542 	CleanupClosePushL(data);
       
  2543 	
       
  2544 	TInt callId = 1;
       
  2545 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2546 	DriverDialCallL(callId, mobileService);
       
  2547 	
       
  2548 	RMobileLine mobileLine;
       
  2549 	CleanupClosePushL(mobileLine);
       
  2550 	RMobileCall mobileCall;
       
  2551 	CleanupClosePushL(mobileCall);
       
  2552 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2553 
       
  2554 	_LIT(KUUI, "important");
       
  2555 	RMobileCall::TMobileCallUUI receiveUui;
       
  2556 	receiveUui.Append(KUUI);
       
  2557 	data.Close();
       
  2558 	TMockLtsyCallData1<RMobileCall::TMobileCallUUI> mockData(callId, mobileService, receiveUui);
       
  2559 	mockData.SerialiseL(data);
       
  2560 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlReceiveUuiIndId, KErrNone, data);
       
  2561 
       
  2562 	TRequestStatus uuiStatus;
       
  2563 	RMobileCall::TMobileCallUUI receivedUui;
       
  2564 	mobileCall.ReceiveUUI(uuiStatus, receivedUui);
       
  2565 	User::WaitForRequest(uuiStatus);
       
  2566 	ASSERT_EQUALS(KErrNone, uuiStatus.Int());
       
  2567 	ASSERT_EQUALS(0, receivedUui.Compare(receiveUui));
       
  2568 	
       
  2569 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2570 	
       
  2571 	DriverHangUpCallL(callId, hangUpCause);
       
  2572 	
       
  2573 	TRequestStatus reqStatusTerminated;
       
  2574 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2575 
       
  2576 	ClientHangUpCallL(mobileCall);
       
  2577 	
       
  2578 	User::WaitForRequest(reqStatusTerminated);
       
  2579 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2580 	
       
  2581 	AssertMockLtsyStatusL();
       
  2582 
       
  2583 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2584 	} // CCTsyCallControlFU::TestUnit0009L
       
  2585 
       
  2586 /**
       
  2587  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0010
       
  2588  @SYMComponent telephony_ctsy
       
  2589  @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SendDTMFTones and waits for it to timeout
       
  2590  @SYMTestPriority High
       
  2591  @SYMTestActions Invokes RMobilePhone::SendDTMFTones and waits for it to timeout
       
  2592  @SYMTestExpectedResults Pass
       
  2593  @SYMTestType UT
       
  2594  */
       
  2595 void CCTsyCallControlFU::TestUnit0010L()
       
  2596 	{
       
  2597 	OpenEtelServerL(EUseExtendedError);
       
  2598 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2599 	OpenPhoneL();
       
  2600 
       
  2601 	RBuf8 data;
       
  2602 	CleanupClosePushL(data);
       
  2603 
       
  2604 	TInt callId = 1;
       
  2605 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2606 	DriverDialCallL(callId, mobileService);
       
  2607 
       
  2608 	RMobileLine mobileLine;
       
  2609 	CleanupClosePushL(mobileLine);
       
  2610 	RMobileCall mobileCall;
       
  2611 	CleanupClosePushL(mobileCall);
       
  2612 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2613 	
       
  2614 	
       
  2615 	TBuf<5> tones = _L("12345");
       
  2616 	TMockLtsyData2<TInt, TBuf<5> > toneLtsyData(callId, tones);
       
  2617 	toneLtsyData.SerialiseL(data);
       
  2618 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSendDtmfTones::KLtsyDispatchCallControlSendDtmfTonesApiId, data, KErrNone);
       
  2619 	data.Close();
       
  2620 	
       
  2621 	TRequestStatus reqStatus;
       
  2622 	iPhone.SendDTMFTones(reqStatus, tones);
       
  2623 
       
  2624 	//KMmPhoneSendDTMFTonesTimeOut = 125, 
       
  2625 	//Life timers come every 10s thus 125s / 10s = 12 expects to queue.
       
  2626 	TUint32 duration = 10; //this is the length of the call and its not possible to be certain of this due to
       
  2627 							//e.g. logging statements so this argument is not actually checked in the mockltsy
       
  2628 	TMockLtsyData1<TUint32> durationLtsyData(duration);
       
  2629 	durationLtsyData.SerialiseL(data);
       
  2630 
       
  2631 	for(TInt i = 0; i < 12; ++i)
       
  2632 		{
       
  2633 		iMockLTSY.ExpectL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, data, KErrNone);
       
  2634 		iMockLTSY.CompleteL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, KErrNone);
       
  2635 		}
       
  2636 	data.Close();	
       
  2637 	
       
  2638 	User::WaitForRequest(reqStatus);
       
  2639 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
  2640 	AssertMockLtsyStatusL();
       
  2641 
       
  2642 	
       
  2643 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2644 	DriverHangUpCallL(callId, hangUpCause);
       
  2645 
       
  2646 	TRequestStatus reqStatusTerminated;
       
  2647 	iMockLTSY.NotifyTerminated(reqStatusTerminated);
       
  2648 	
       
  2649 	ClientHangUpCallL(mobileCall);
       
  2650 
       
  2651 	User::WaitForRequest(reqStatusTerminated);
       
  2652 	ASSERT_EQUALS(reqStatusTerminated.Int(),KErrNone);
       
  2653 	
       
  2654 	AssertMockLtsyStatusL();
       
  2655 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2656 	} // CCTsyCallControlFU::TestUnit0010L
       
  2657 
       
  2658 /**
       
  2659  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0011
       
  2660  @SYMComponent telephony_ctsy
       
  2661  @SYMTestCaseDesc Test support in CTSY for RMobilePhone::StartDTMFTone and RMobilePhone::StopDTMFTone timeout
       
  2662  @SYMTestPriority High
       
  2663  @SYMTestActions Invokes RMobilePhone::StartDTMFTone and RMobilePhone::StopDTMFTone waits for it to timeout
       
  2664  @SYMTestExpectedResults Pass
       
  2665  @SYMTestType UT
       
  2666  */
       
  2667 void CCTsyCallControlFU::TestUnit0011L()
       
  2668 	{
       
  2669 	OpenEtelServerL(EUseExtendedError);
       
  2670 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2671 	OpenPhoneL();
       
  2672 
       
  2673 	RBuf8 data;
       
  2674 	CleanupClosePushL(data);
       
  2675 
       
  2676 	TInt callId = 1;
       
  2677 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2678 	DriverDialCallL(callId, mobileService);
       
  2679 
       
  2680 	TChar tone('1');
       
  2681 	TMockLtsyData2<TInt, TChar> toneLtsyData(callId, tone);
       
  2682 	toneLtsyData.SerialiseL(data);
       
  2683 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, data, KErrNone);
       
  2684 
       
  2685 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, data, KErrNone);
       
  2686 
       
  2687 	iMockLTSY.CompleteL(MLtsyDispatchCallControlStartDtmfTone::KLtsyDispatchCallControlStartDtmfToneApiId, KErrNone);
       
  2688 
       
  2689 	TMockLtsyData1<TInt> toneLtsyData2(callId);
       
  2690 	toneLtsyData2.SerialiseL(data);
       
  2691 	iMockLTSY.ExpectL(MLtsyDispatchCallControlStopDtmfTone::KLtsyDispatchCallControlStopDtmfToneApiId, data, KErrNone);
       
  2692 
       
  2693 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2694 	DriverHangUpCallL(callId, hangUpCause);
       
  2695 
       
  2696 	// Client Side Test
       
  2697 
       
  2698 	RMobileLine mobileLine;
       
  2699 	CleanupClosePushL(mobileLine);
       
  2700 	RMobileCall mobileCall;
       
  2701 	CleanupClosePushL(mobileCall);
       
  2702 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2703 
       
  2704 	ASSERT_EQUALS(KErrTimedOut, iPhone.StartDTMFTone(tone));
       
  2705 
       
  2706 	// Now test timeout of stop
       
  2707 	ASSERT_EQUALS(KErrNone, iPhone.StartDTMFTone(tone));
       
  2708 	ASSERT_EQUALS(KErrTimedOut, iPhone.StopDTMFTone());
       
  2709 
       
  2710 	TRequestStatus reqStatusTerminated;
       
  2711 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2712 
       
  2713 	ClientHangUpCallL(mobileCall);
       
  2714 	
       
  2715 	User::WaitForRequest(reqStatusTerminated);
       
  2716 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());	
       
  2717 	
       
  2718 	AssertMockLtsyStatusL();
       
  2719 	CleanupStack::PopAndDestroy(4, this); //mobileCall, mobileLine, data, this
       
  2720 	} // CCTsyCallControlFU::TestUnit0011L
       
  2721 
       
  2722 
       
  2723 /**
       
  2724 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0012
       
  2725 @SYMComponent telephony_ctsy
       
  2726 @SYMTestCaseDesc Test support in CTSYDispatch for ICC Call Forwarding Status Change Indicator
       
  2727 @SYMTestPriority High
       
  2728 @SYMTestActions Invokes RMmCustomAPI::NotifyIccCallForwardingStatusChange()
       
  2729 @SYMTestExpectedResults Pass
       
  2730 @SYMTestType UT
       
  2731  */
       
  2732 void CCTsyCallControlFU::TestUnit0012L()
       
  2733 	{
       
  2734 	OpenEtelServerL(EUseExtendedError);
       
  2735 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2736 		
       
  2737 	OpenPhoneL();
       
  2738 		
       
  2739 	RMmCustomAPI customApi;
       
  2740 	OpenCustomApiLC(customApi);
       
  2741 
       
  2742 	TRequestStatus reqStatus;
       
  2743 	
       
  2744 	TInt error = KErrNone;
       
  2745 	
       
  2746 	RBuf8 data;
       
  2747 	CleanupClosePushL(data);
       
  2748 	RMmCustomAPI::TCFIndicators cfIndicators;
       
  2749 	TPckg<RMmCustomAPI::TCFIndicators> cfIndicatorsPckg(cfIndicators);
       
  2750 	
       
  2751 	
       
  2752 	RMobilePhone::TMobileAddress phoneNumber;
       
  2753 	phoneNumber.iTelNumber = _L("012345");
       
  2754 	RMobilePhone::TCFUIndicatorStatusFlags indicators = RMobilePhone::KCFUIndicatorFax | RMobilePhone::KCFUIndicatorData;
       
  2755 	RMmCustomAPI::TMultipleSubscriberProfileID subscriberId (RMmCustomAPI::KProfileIdentityThree);
       
  2756 	
       
  2757 	TMockLtsyData3<RMobilePhone::TMobileAddress,
       
  2758     	RMobilePhone::TCFUIndicatorStatusFlags,
       
  2759     	RMmCustomAPI::TMultipleSubscriberProfileID> mockLtsyData(phoneNumber, indicators, subscriberId);
       
  2760 
       
  2761 	mockLtsyData.SerialiseL(data);
       
  2762 	
       
  2763 	customApi.NotifyIccCallForwardingStatusChange(reqStatus,cfIndicatorsPckg);
       
  2764 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyIccCallForwardingStatusChangeIndId,error,data);
       
  2765 	User::WaitForRequest(reqStatus);
       
  2766 	ASSERT_EQUALS(reqStatus.Int(),error);
       
  2767 	ASSERT_EQUALS(cfIndicators.iIndicator,indicators);
       
  2768 	ASSERT_EQUALS(cfIndicators.iMultipleSubscriberProfileID, subscriberId);
       
  2769 	ASSERT_TRUE(cfIndicators.iCFNumber.iTelNumber.Compare(phoneNumber.iTelNumber) == 0);
       
  2770 	AssertMockLtsyStatusL();
       
  2771 	
       
  2772 	
       
  2773 	CleanupStack::PopAndDestroy(&data);
       
  2774 	CleanupStack::PopAndDestroy(&customApi);
       
  2775 	CleanupStack::PopAndDestroy(this);
       
  2776 	}
       
  2777 
       
  2778 
       
  2779 /**
       
  2780  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0013
       
  2781  @SYMComponent telephony_ctsy
       
  2782  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomAPI::GetAlsBlocked and RMmCustomAPI::SetAlsBlocked
       
  2783  @SYMTestPriority High
       
  2784  @SYMTestActions Invokes RMmCustomAPI::GetAlsBlocked and RMmCustomAPI::SetAlsBlocked
       
  2785  @SYMTestExpectedResults Pass
       
  2786  @SYMTestType UT
       
  2787  */
       
  2788 void CCTsyCallControlFU::TestUnit0013L()
       
  2789 	{
       
  2790 	OpenEtelServerL(EUseExtendedError);
       
  2791 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2792 	OpenPhoneL();
       
  2793 
       
  2794 	RBuf8 data;
       
  2795 	CleanupClosePushL(data);
       
  2796 	
       
  2797 	RMmCustomAPI customApi;
       
  2798 	OpenCustomApiLC(customApi);
       
  2799 
       
  2800     // A. Get Status
       
  2801 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetAlsBlockedStatus::KLtsyDispatchCallControlGetAlsBlockedStatusApiId, KErrNone);
       
  2802 	RMmCustomAPI::TGetAlsBlockStatus compData = RMmCustomAPI::EBlockStatusInactive;
       
  2803 	TMockLtsyData1<RMmCustomAPI::TGetAlsBlockStatus> alsLtsyData1(compData);
       
  2804 	alsLtsyData1.SerialiseL(data);
       
  2805 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetAlsBlockedStatus::KLtsyDispatchCallControlGetAlsBlockedStatusApiId, KErrNone, data);
       
  2806 
       
  2807 	RMmCustomAPI::TGetAlsBlockStatus status;
       
  2808 	ASSERT_EQUALS(KErrNone, customApi.GetAlsBlocked(status));
       
  2809 	ASSERT_EQUALS(compData, status);
       
  2810 
       
  2811     // B. Set blocked
       
  2812     data.Close();
       
  2813     RMmCustomAPI::TSetAlsBlock setData = RMmCustomAPI::EActivateBlock;
       
  2814 	TMockLtsyData1<RMmCustomAPI::TSetAlsBlock> alsLtsyData2(setData);
       
  2815 	alsLtsyData2.SerialiseL(data);
       
  2816 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSetAlsBlocked::KLtsyDispatchCallControlSetAlsBlockedApiId, data, KErrNone);
       
  2817 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSetAlsBlocked::KLtsyDispatchCallControlSetAlsBlockedApiId, KErrNone);
       
  2818 
       
  2819 	ASSERT_EQUALS(KErrNone, customApi.SetAlsBlocked(setData));
       
  2820 
       
  2821 	AssertMockLtsyStatusL();
       
  2822 	CleanupStack::PopAndDestroy(3, this); // customApi, data, this
       
  2823 	} // CCTsyCallControlFU::TestUnit0013L
       
  2824 
       
  2825 
       
  2826 /**
       
  2827  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0014
       
  2828  @SYMComponent telephony_ctsy
       
  2829  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomAPI::GetLifeTime
       
  2830  @SYMTestPriority High
       
  2831  @SYMTestActions Invokes RMmCustomAPI::GetLifeTime 
       
  2832  @SYMTestExpectedResults Pass
       
  2833  @SYMTestType UT
       
  2834  */
       
  2835 void CCTsyCallControlFU::TestUnit0014L()
       
  2836 	{
       
  2837 	OpenEtelServerL(EUseExtendedError);
       
  2838 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2839 	OpenPhoneL();
       
  2840 
       
  2841 	RBuf8 data;
       
  2842 	CleanupClosePushL(data);
       
  2843 	
       
  2844 	RMmCustomAPI customApi;
       
  2845 	OpenCustomApiLC(customApi);
       
  2846 
       
  2847     // A. Test when there is no life time data
       
  2848 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone);
       
  2849     
       
  2850 	RMmCustomAPI::TLifeTimeData compData;
       
  2851     compData.iCaps = 0;
       
  2852 	TMockLtsyData1<RMmCustomAPI::TLifeTimeData> ltLtsyData1(compData);
       
  2853 	ltLtsyData1.SerialiseL(data);
       
  2854 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone, data);
       
  2855 
       
  2856 	RMmCustomAPI::TLifeTimeData lifeTime;
       
  2857 	RMmCustomAPI::TLifeTimeDataPckg lifeTimePckg(lifeTime);
       
  2858 	ASSERT_EQUALS(KErrNone, customApi.GetLifeTime(lifeTimePckg));
       
  2859 	ASSERT_EQUALS(compData.iCaps, lifeTime.iCaps);
       
  2860 
       
  2861 
       
  2862     // B. Test when there is only life time data
       
  2863 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone);
       
  2864     
       
  2865     compData.iCaps = RMmCustomAPI::TLifeTimeData::ELifeTimeDataCapsLifeTime;
       
  2866     compData.iHours = 12234;
       
  2867     compData.iMinutes = 14;
       
  2868     data.Close();
       
  2869 	TMockLtsyData1<RMmCustomAPI::TLifeTimeData> ltLtsyData2(compData);
       
  2870 	ltLtsyData2.SerialiseL(data);
       
  2871 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone, data);
       
  2872 
       
  2873 	ASSERT_EQUALS(KErrNone, customApi.GetLifeTime(lifeTimePckg));
       
  2874 	ASSERT_EQUALS(compData.iHours, lifeTime.iHours);
       
  2875 	ASSERT_EQUALS(compData.iMinutes, lifeTime.iMinutes);
       
  2876 
       
  2877     // C. Test when there is only manufacturing date data
       
  2878 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone);
       
  2879     
       
  2880     compData.iCaps = RMmCustomAPI::TLifeTimeData::ELifeTimeDataCapsManufacturerDate;
       
  2881     compData.iManufacturingDate.SetYear(1995);
       
  2882     compData.iManufacturingDate.SetMonth(EAugust);
       
  2883     compData.iManufacturingDate.SetDay(21);
       
  2884     data.Close();
       
  2885 	TMockLtsyData1<RMmCustomAPI::TLifeTimeData> ltLtsyData3(compData);
       
  2886 	ltLtsyData3.SerialiseL(data);
       
  2887 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone, data);
       
  2888 
       
  2889 	ASSERT_EQUALS(KErrNone, customApi.GetLifeTime(lifeTimePckg));
       
  2890 	ASSERT_EQUALS(compData.iManufacturingDate.Year(), lifeTime.iManufacturingDate.Year());
       
  2891 	ASSERT_EQUALS(compData.iManufacturingDate.Month(), lifeTime.iManufacturingDate.Month());
       
  2892 	ASSERT_EQUALS(compData.iManufacturingDate.Day(), lifeTime.iManufacturingDate.Day());
       
  2893 
       
  2894     // D. Test when there is manufacturing date data and lifetime data
       
  2895 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone);
       
  2896     
       
  2897     compData.iCaps = RMmCustomAPI::TLifeTimeData::ELifeTimeDataCapsManufacturerDate | RMmCustomAPI::TLifeTimeData::ELifeTimeDataCapsLifeTime;
       
  2898     compData.iManufacturingDate.SetYear(2000);
       
  2899     compData.iManufacturingDate.SetMonth(EJune);
       
  2900     compData.iManufacturingDate.SetDay(12);
       
  2901     compData.iHours = 31234;
       
  2902     compData.iMinutes = 43;
       
  2903     data.Close();
       
  2904 	TMockLtsyData1<RMmCustomAPI::TLifeTimeData> ltLtsyData4(compData);
       
  2905 	ltLtsyData3.SerialiseL(data);
       
  2906 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetLifeTime::KLtsyDispatchCallControlGetLifeTimeApiId, KErrNone, data);
       
  2907 
       
  2908 	ASSERT_EQUALS(KErrNone, customApi.GetLifeTime(lifeTimePckg));
       
  2909 	ASSERT_EQUALS(compData.iHours, lifeTime.iHours);
       
  2910 	ASSERT_EQUALS(compData.iMinutes, lifeTime.iMinutes);
       
  2911 	ASSERT_EQUALS(compData.iManufacturingDate.Year(), lifeTime.iManufacturingDate.Year());
       
  2912 	ASSERT_EQUALS(compData.iManufacturingDate.Month(), lifeTime.iManufacturingDate.Month());
       
  2913 	ASSERT_EQUALS(compData.iManufacturingDate.Day(), lifeTime.iManufacturingDate.Day());
       
  2914 
       
  2915 	AssertMockLtsyStatusL();
       
  2916 	CleanupStack::PopAndDestroy(3, this); //customApi, data, this
       
  2917 	} // CCTsyCallControlFU::TestUnit0014L
       
  2918 
       
  2919 
       
  2920 /**
       
  2921  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0015
       
  2922  @SYMComponent telephony_ctsy
       
  2923  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomAPI::TerminateCall
       
  2924  @SYMTestPriority High
       
  2925  @SYMTestActions Invokes RMmCustomAPI::TerminateCall 
       
  2926  @SYMTestExpectedResults Pass
       
  2927  @SYMTestType UT
       
  2928  */
       
  2929 void CCTsyCallControlFU::TestUnit0015L()
       
  2930 	{
       
  2931 	OpenEtelServerL(EUseExtendedError);
       
  2932 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  2933 	OpenPhoneL();
       
  2934 
       
  2935 	RBuf8 data;
       
  2936 	CleanupClosePushL(data);
       
  2937 	
       
  2938 	RMmCustomAPI customApi;
       
  2939 	OpenCustomApiLC(customApi);
       
  2940 
       
  2941     // A. Terminate a specific call
       
  2942     // Create an active call
       
  2943 	TInt callId = 1;
       
  2944 	DriverDialCallL(callId, RMobilePhone::EVoiceService);
       
  2945     RMobileLine mobileLine;
       
  2946 	CleanupClosePushL(mobileLine);
       
  2947 	RMobileCall mobileCall;
       
  2948 	CleanupClosePushL(mobileCall);
       
  2949 	ClientDialCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService);
       
  2950 
       
  2951 	// Getting the call information
       
  2952 	RMobileCall::TMobileCallInfoV1 callInfo;
       
  2953 	RMobileCall::TMobileCallInfoV1Pckg callInfoPckg(callInfo);
       
  2954 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallInfo(callInfoPckg));
       
  2955 	ASSERT_EQUALS(callId , callInfo.iCallId);
       
  2956 
       
  2957     // Getting mock ltsy ready
       
  2958     data.Close();
       
  2959 	TMockLtsyData1<TInt> termLtsyData1(callId);
       
  2960 	termLtsyData1.SerialiseL(data);
       
  2961 	iMockLTSY.ExpectL(MLtsyDispatchCallControlTerminateErrorCall::KLtsyDispatchCallControlTerminateErrorCallApiId, data, KErrNone);
       
  2962 	iMockLTSY.CompleteL(MLtsyDispatchCallControlTerminateErrorCall::KLtsyDispatchCallControlTerminateErrorCallApiId, KErrNone, data);
       
  2963 
       
  2964     // Activate the API
       
  2965 	ASSERT_EQUALS(KErrNone, customApi.TerminateCall(callInfo.iCallName));
       
  2966 
       
  2967     // Hang up the call
       
  2968 	DriverHangUpCallL(callId, KErrGsmCCNormalCallClearing);
       
  2969     ClientHangUpCallL(mobileCall);
       
  2970 
       
  2971     // B. All calls
       
  2972     // Create an active call
       
  2973     callId = 71;
       
  2974 	DriverDialCallL(callId, RMobilePhone::EVoiceService);
       
  2975     RMobileLine mobileLine2;
       
  2976 	CleanupClosePushL(mobileLine2);
       
  2977 	RMobileCall mobileCall2;
       
  2978 	CleanupClosePushL(mobileCall2);
       
  2979 	ClientDialCallL(mobileLine2, mobileCall2, RMobilePhone::EVoiceService);
       
  2980 
       
  2981     // Getting mock ltsy ready
       
  2982 	iMockLTSY.ExpectL(MLtsyDispatchCallControlTerminateAllCalls::KLtsyDispatchCallControlTerminateAllCallsApiId, KErrNone);
       
  2983 	iMockLTSY.CompleteL(MLtsyDispatchCallControlTerminateAllCalls::KLtsyDispatchCallControlTerminateAllCallsApiId, KErrNone);
       
  2984 
       
  2985     // Activate the API
       
  2986 	TName terminateAll(KTerminateAllCalls);
       
  2987 	ASSERT_EQUALS(KErrNone, customApi.TerminateCall(terminateAll));
       
  2988 
       
  2989     // Hang up the call
       
  2990 	DriverHangUpCallL(callId, KErrGsmCCNormalCallClearing);
       
  2991     
       
  2992 	
       
  2993 	TRequestStatus reqStatusTerminated;
       
  2994 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2995 	
       
  2996 	ClientHangUpCallL(mobileCall2);
       
  2997 
       
  2998 	User::WaitForRequest(reqStatusTerminated);
       
  2999 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());		
       
  3000 	
       
  3001 	AssertMockLtsyStatusL();
       
  3002 	CleanupStack::PopAndDestroy(7, this); //mobileCall2, mobileLine2, mobileCall, mobileLine, customApi, data, this
       
  3003 	} // CCTsyCallControlFU::TestUnit0015L
       
  3004 
       
  3005 
       
  3006 /**
       
  3007  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0016
       
  3008  @SYMComponent telephony_ctsy
       
  3009  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomAPI::GetRemoteAlertingToneStatus and RMmCustomAPI::NotifyRemoteAlertingToneStatusChange
       
  3010  @SYMTestPriority High
       
  3011  @SYMTestActions Invokes RMmCustomAPI::GetRemoteAlertingToneStatus and RMmCustomAPI::NotifyRemoteAlertingToneStatusChange
       
  3012  @SYMTestExpectedResults Pass
       
  3013  @SYMTestType UT
       
  3014  */
       
  3015 void CCTsyCallControlFU::TestUnit0016L()
       
  3016 	{
       
  3017 	OpenEtelServerL(EUseExtendedError);
       
  3018 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  3019 	OpenPhoneL();
       
  3020 
       
  3021 	RBuf8 data;
       
  3022 	CleanupClosePushL(data);
       
  3023 	
       
  3024 	RMmCustomAPI customApi;
       
  3025 	OpenCustomApiLC(customApi);
       
  3026 
       
  3027     // A. Test without notification from the LTSY
       
  3028     RMmCustomAPI::TRemoteAlertingToneStatus status;
       
  3029 	ASSERT_EQUALS(KErrNone, customApi.GetRemoteAlertingToneStatus(status));
       
  3030     ASSERT_EQUALS(RMmCustomAPI::EUiNoTone, status);
       
  3031 
       
  3032     // B. LTSY notify that the status was set
       
  3033 	TRequestStatus terminatedStatus;
       
  3034 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
  3035     RMmCustomAPI::TRemoteAlertingToneStatus compStatus = RMmCustomAPI::EUiRbtTone;
       
  3036 	TMockLtsyData1<RMmCustomAPI::TRemoteAlertingToneStatus> compData1(compStatus);
       
  3037     data.Close();
       
  3038     compData1.SerialiseL(data);
       
  3039 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlRemoteAlertingToneChangeIndId, KErrNone, data);
       
  3040 	User::WaitForRequest(terminatedStatus);
       
  3041 
       
  3042     // Activate the API
       
  3043 	ASSERT_EQUALS(KErrNone, customApi.GetRemoteAlertingToneStatus(status));
       
  3044     ASSERT_EQUALS(compStatus, status);
       
  3045 
       
  3046 
       
  3047     // C. Check the change notification
       
  3048     TRequestStatus notifyStatus;
       
  3049     customApi.NotifyRemoteAlertingToneStatusChange(notifyStatus, status);
       
  3050     compStatus =  RMmCustomAPI::EUiStopTone;
       
  3051 	TMockLtsyData1<RMmCustomAPI::TRemoteAlertingToneStatus> compData2(compStatus);
       
  3052     data.Close();
       
  3053     compData1.SerialiseL(data);
       
  3054 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlRemoteAlertingToneChangeIndId, KErrNone, data);
       
  3055 	User::WaitForRequest(notifyStatus);
       
  3056     ASSERT_EQUALS(compStatus, status);
       
  3057     
       
  3058 	AssertMockLtsyStatusL();
       
  3059 	CleanupStack::PopAndDestroy(3, this); //customApi, data, this
       
  3060 	} // CCTsyCallControlFU::TestUnit0016L
       
  3061 
       
  3062 
       
  3063 /**
       
  3064  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0017
       
  3065  @SYMComponent telephony_ctsy
       
  3066  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomAPI::GetIccCallForwardingIndicatorStatus
       
  3067  @SYMTestPriority High
       
  3068  @SYMTestActions Invokes RMmCustomAPI::GetIccCallForwardingIndicatorStatus
       
  3069  @SYMTestExpectedResults Pass
       
  3070  @SYMTestType UT
       
  3071  */
       
  3072 void CCTsyCallControlFU::TestUnit0017L()
       
  3073 	{
       
  3074 	OpenEtelServerL(EUseExtendedError);
       
  3075 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  3076 	OpenPhoneL();
       
  3077 
       
  3078 	RBuf8 data;
       
  3079 	CleanupClosePushL(data);
       
  3080 	
       
  3081 	RMmCustomAPI customApi;
       
  3082 	OpenCustomApiLC(customApi);
       
  3083     // Getting mock ltsy ready
       
  3084     data.Close();
       
  3085     iMockLTSY.ExpectL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId);
       
  3086 	RMobilePhone::TMobilePhoneCFUIndicatorV6 compIndicator;
       
  3087 	compIndicator.iMultipleSubscriberProfileID = RMobilePhone::KProfileIdentityThree;
       
  3088 	compIndicator.iIndicator = RMobilePhone::KCFUIndicatorVoice | RMobilePhone::KCFUIndicatorData;
       
  3089 	compIndicator.iCFNumber.iNumberPlan = RMobilePhone::ENationalNumberPlan;
       
  3090 	compIndicator.iCFNumber.iTypeOfNumber = RMobilePhone::EAlphanumericNumber;
       
  3091 	_LIT(KTelNumber, "020102010201");
       
  3092 	compIndicator.iCFNumber.iTelNumber = KTelNumber; 
       
  3093 	TMockLtsyData1<RMobilePhone::TMobilePhoneCFUIndicatorV6> indicatorData(compIndicator);
       
  3094 	data.Close();
       
  3095 	indicatorData.SerialiseL(data);
       
  3096 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetCallForwardingIndicator::KLtsyDispatchCallControlGetCallForwardingIndicatorApiId,KErrNone,data,0);
       
  3097 
       
  3098     // Activate the API
       
  3099     RMmCustomAPI::TCFIndicators indicator;
       
  3100     RMmCustomAPI::TCFIndicatorsPckg indicatorPckg(indicator);
       
  3101 	TRequestStatus apiStatus;
       
  3102 	customApi.GetIccCallForwardingIndicatorStatus(apiStatus, indicatorPckg);
       
  3103 	User::WaitForRequest(apiStatus);
       
  3104 	ASSERT_EQUALS(KErrNone, apiStatus.Int());
       
  3105 	ASSERT_EQUALS(compIndicator.iCFNumber.iTelNumber, indicator.iCFNumber.iTelNumber);
       
  3106 	ASSERT_EQUALS(compIndicator.iCFNumber.iTypeOfNumber, indicator.iCFNumber.iTypeOfNumber);
       
  3107 	ASSERT_EQUALS(compIndicator.iCFNumber.iNumberPlan, indicator.iCFNumber.iNumberPlan);
       
  3108 	ASSERT_EQUALS(compIndicator.iIndicator, indicator.iIndicator);
       
  3109 	// CTSY sets the value of iMultipleSubscriberProfileID into a private repository, but not to the API struct.
       
  3110     // ASSERT_EQUALS(RMmCustomAPI::KProfileIdentityThree, indicator.iMultipleSubscriberProfileID);
       
  3111     
       
  3112 
       
  3113 	AssertMockLtsyStatusL();
       
  3114 	CleanupStack::PopAndDestroy(3, this); //customApi, data, this
       
  3115 	} // CCTsyCallControlFU::TestUnit0017L
       
  3116 
       
  3117 
       
  3118 /**
       
  3119  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0018
       
  3120  @SYMComponent telephony_ctsy
       
  3121  @SYMTestCaseDesc Test support in CTSY Dispatcher for RMmCustomAPI::CheckAlsPpSupport 
       
  3122  @SYMTestPriority High
       
  3123  @SYMTestActions Invokes RMmCustomAPI::CheckAlsPpSupport 
       
  3124  @SYMTestExpectedResults Pass
       
  3125  @SYMTestType UT
       
  3126  */
       
  3127 void CCTsyCallControlFU::TestUnit0018L()
       
  3128 	{
       
  3129 	OpenEtelServerL(EUseExtendedError);
       
  3130 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  3131 	OpenPhoneL();
       
  3132 
       
  3133 	RBuf8 data;
       
  3134 	CleanupClosePushL(data);
       
  3135 	
       
  3136 	RMmCustomAPI customApi;
       
  3137 	OpenCustomApiLC(customApi);
       
  3138 	
       
  3139 	iMockLTSY.ExpectL(MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId, KErrNone);
       
  3140 
       
  3141 
       
  3142 	RMmCustomAPI::TAlsSupport compData = RMmCustomAPI::EAlsSupportOff;
       
  3143 	TMockLtsyData1<RMmCustomAPI::TAlsSupport> alsLtsyData1(compData);
       
  3144 	alsLtsyData1.SerialiseL(data);
       
  3145 	iMockLTSY.CompleteL(MLtsyDispatchCallControlGetAlsPpSupport::KLtsyDispatchCallControlGetAlsPpSupportApiId, KErrNone, data);
       
  3146 
       
  3147 	RMmCustomAPI::TAlsSupport support;
       
  3148 	ASSERT_EQUALS(KErrNone, customApi.CheckAlsPpSupport(support));
       
  3149 	ASSERT_EQUALS(compData, support);
       
  3150 
       
  3151 	AssertMockLtsyStatusL();
       
  3152 	CleanupStack::PopAndDestroy(3, this); //customApi, data, this
       
  3153 	} // CCTsyCallControlFU::TestUnit0018L
       
  3154 
       
  3155 /**
       
  3156  @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0019
       
  3157  @SYMComponent telephony_ctsy
       
  3158  @SYMTestCaseDesc Test support in CTSY for ECtsyUpdateLifeTimeReq/ECtsyUpdateLifeTimeComp IPCs by keeping a call open for longer than 10s
       
  3159  @SYMTestPriority High
       
  3160  @SYMTestActions Invokes ECtsyUpdateLifeTimeReq/ECtsyUpdateLifeTimeComp
       
  3161  @SYMTestExpectedResults Pass
       
  3162  @SYMTestType UT
       
  3163  */
       
  3164 void CCTsyCallControlFU::TestUnit0019L()
       
  3165 	{
       
  3166 	OpenEtelServerL(EUseExtendedError);
       
  3167 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  3168 	OpenPhoneL();
       
  3169 
       
  3170 	RBuf8 data;
       
  3171 	CleanupClosePushL(data);
       
  3172 
       
  3173 	TInt callId = 1;
       
  3174 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  3175 	DriverDialCallL(callId, mobileService);
       
  3176 
       
  3177 
       
  3178 
       
  3179 
       
  3180 	// Client Side Test
       
  3181 
       
  3182 	RMobileLine mobileLine;
       
  3183 	CleanupClosePushL(mobileLine);
       
  3184 	RMobileCall mobileCall;
       
  3185 	CleanupClosePushL(mobileCall);
       
  3186 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  3187 
       
  3188 
       
  3189 	AssertMockLtsyStatusL();
       
  3190 	
       
  3191 	//expect the lifetimer call to come through
       
  3192 	
       
  3193 	TUint32 duration = 10;
       
  3194 	TMockLtsyData1<TUint32> durationLtsyData(duration);
       
  3195 	durationLtsyData.SerialiseL(data);
       
  3196 	iMockLTSY.ExpectL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, data, KErrNone);
       
  3197 	data.Close();
       
  3198 	iMockLTSY.CompleteL(MLtsyDispatchCallControlUpdateLifeTimer::KLtsyDispatchCallControlUpdateLifeTimerApiId, KErrNone);
       
  3199 	
       
  3200 	User::After(12500000);
       
  3201 	
       
  3202 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  3203 	DriverHangUpCallL(callId, hangUpCause);
       
  3204 	
       
  3205 	TRequestStatus reqStatusTerminated;
       
  3206 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  3207 	
       
  3208 	ClientHangUpCallL(mobileCall);
       
  3209 
       
  3210 	User::WaitForRequest(reqStatusTerminated);
       
  3211 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  3212 	
       
  3213 	AssertMockLtsyStatusL();
       
  3214 	
       
  3215 	CleanupStack::PopAndDestroy(3, &data); //mobileCall, mobileLine, data
       
  3216 	AssertMockLtsyStatusL();
       
  3217 	CleanupStack::PopAndDestroy(this);
       
  3218 	} // CCTsyCallControlFU::TestUnit0019L
       
  3219 
       
  3220 
       
  3221 /**
       
  3222 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UN0020
       
  3223 @SYMComponent telephony_ctsy
       
  3224 @SYMTestCaseDesc Test support in CTSY for mobile originated voice call with no FDN check
       
  3225 @SYMTestPriority High
       
  3226 @SYMTestActions RMobileCall::DialNoFdnCheck() for a voice call
       
  3227 @SYMTestExpectedResults Pass - Call reaches connected state and call is hung up
       
  3228 @SYMTestType CT
       
  3229 */
       
  3230 void CCTsyCallControlFU::TestUnit0020L()
       
  3231 	{
       
  3232 	OpenEtelServerL(EUseExtendedError);
       
  3233 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3234 	OpenPhoneL();
       
  3235 
       
  3236 	TRequestStatus reqStatus;
       
  3237 	
       
  3238 	//Test voice call
       
  3239 	
       
  3240 	iMockLTSY.NotifyTerminated(reqStatus); 
       
  3241 	
       
  3242 	TInt callId = 1;
       
  3243 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  3244 	DriverDialCallL(callId, mobileService, EFalse, EFalse, EFalse);
       
  3245 
       
  3246 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  3247 	DriverHangUpCallL(callId, hangUpCause);
       
  3248 
       
  3249 	// Client Side Test
       
  3250 
       
  3251 	RMobileLine mobileLine;
       
  3252 	CleanupClosePushL(mobileLine);
       
  3253 	RMobileCall mobileCall;
       
  3254 	CleanupClosePushL(mobileCall);
       
  3255 	ClientDialCallL(mobileLine, mobileCall, mobileService, EFalse, EFalse);
       
  3256 
       
  3257 	ClientHangUpCallL(mobileCall);
       
  3258 	
       
  3259 
       
  3260 	mobileCall.Close();
       
  3261 	mobileLine.Close();
       
  3262 
       
  3263 	User::WaitForRequest(reqStatus);
       
  3264 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3265 	
       
  3266 	AssertMockLtsyStatusL();
       
  3267 	CleanupStack::PopAndDestroy(3, this); //mobileCall, mobileLine, this
       
  3268 	} // CCTsyCallControlFU::TestUnit0020L
       
  3269 
       
  3270 
       
  3271 /**
       
  3272 @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROL-UT0021
       
  3273 @SYMComponent telephony_ctsy
       
  3274 @SYMTestCaseDesc Test support in CTSY for mobile originated data call with no FDN check
       
  3275 @SYMTestPriority High
       
  3276 @SYMTestActions Invokes RMobileCall::DialNoFdnCheck() for a data call
       
  3277 @SYMTestExpectedResults Pass
       
  3278 @SYMTestType CT
       
  3279 */
       
  3280 void CCTsyCallControlFU::TestUnit0021L()
       
  3281 	{
       
  3282 	OpenEtelServerL(EUseExtendedError);
       
  3283 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  3284 	OpenPhoneL();
       
  3285 
       
  3286 	RBuf8 data;
       
  3287 	CleanupClosePushL(data);
       
  3288 
       
  3289 	TInt callId = 1;
       
  3290 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3291 
       
  3292 	DriverDialCallL(callId, mobileService, EFalse, EFalse, EFalse);
       
  3293 
       
  3294 	// KMockLtsyDispatchCallControlNotifyDataCallCapsChangeIndId
       
  3295 	RMobileCall::TMobileCallDataCapsV1 completeCallCaps;
       
  3296 	completeCallCaps.iSpeedCaps = RMobileCall::KCapsSpeed48000;
       
  3297 	completeCallCaps.iProtocolCaps = RMobileCall::KCapsProtocolV34;
       
  3298 	completeCallCaps.iServiceCaps = RMobileCall::KCapsPacketAccessSyncUDI;
       
  3299 	completeCallCaps.iQoSCaps = RMobileCall::KCapsTransparentPreferred;
       
  3300 	completeCallCaps.iHscsdSupport = ETrue;
       
  3301 	completeCallCaps.iMClass = 2;
       
  3302 	completeCallCaps.iMaxRxTimeSlots = 4;
       
  3303 	completeCallCaps.iMaxTxTimeSlots = 8;
       
  3304 	completeCallCaps.iTotalRxTxTimeSlots = 10;
       
  3305 	completeCallCaps.iCodingCaps = RMobileCall::KCapsAiurCoding96;
       
  3306 	completeCallCaps.iAsymmetryCaps = RMobileCall::KCapsAsymmetryDownlink;
       
  3307 	completeCallCaps.iUserInitUpgrade = ETrue;
       
  3308 	completeCallCaps.iRLPVersionCaps = RMobileCall::KCapsRLPSingleLinkVersion1;
       
  3309 	completeCallCaps.iV42bisCaps = RMobileCall::KCapsV42bisRxDirection;
       
  3310 	data.Close();
       
  3311 	TMockLtsyCallData1<RMobileCall::TMobileCallDataCapsV1>
       
  3312 		completeDataCapsData(callId, RMobilePhone::EServiceUnspecified, completeCallCaps);
       
  3313 	completeDataCapsData.SerialiseL(data);
       
  3314 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyDataCallCapsChangeIndId, KErrNone, data);
       
  3315 
       
  3316     _LIT(KDataPort, "DATAPORT::0");
       
  3317     RCall::TCommPort commPort;
       
  3318     commPort.iPort = KDataPort;
       
  3319     data.Close();
       
  3320     TMockLtsyData2<TInt,RCall::TCommPort> loanDataPortExpData(callId,commPort);
       
  3321 	loanDataPortExpData.SerialiseL(data);
       
  3322     iMockLTSY.ExpectL(MLtsyDispatchCallControlLoanDataPort::KLtsyDispatchCallControlLoanDataPortApiId, data);
       
  3323     iMockLTSY.ExpectL(MLtsyDispatchCallControlRecoverDataPort::KLtsyDispatchCallControlRecoverDataPortApiId, data);
       
  3324 
       
  3325     
       
  3326 	// MLtsyDispatchCallControlSetDynamicHscsdParams::KLtsyDispatchCallControlSetDynamicHscsdParamsApiId
       
  3327 	RMobileCall::TMobileHscsdCallParamsV8 hscsdParams;
       
  3328 	hscsdParams.iWantedAiur = RMobileCall::EAiurBps38400;
       
  3329 	hscsdParams.iWantedRxTimeSlots = 2;
       
  3330 	data.Close();
       
  3331 	TMockLtsyData2<TInt, RMobileCall::TMobileHscsdCallParamsV8> paramData(callId, hscsdParams);
       
  3332 	paramData.SerialiseL(data);
       
  3333 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSetDynamicHscsdParams::KLtsyDispatchCallControlSetDynamicHscsdParamsApiId, data);
       
  3334 	
       
  3335     TMockLtsyData1<TInt> mockParamData(callId);
       
  3336     data.Close();
       
  3337     mockParamData.SerialiseL(data);
       
  3338 	iMockLTSY.CompleteL(MLtsyDispatchCallControlSetDynamicHscsdParams::KLtsyDispatchCallControlSetDynamicHscsdParamsApiId, KErrNone, data);
       
  3339 
       
  3340 	// KMockLtsyDispatchCallControlNotifyHscsdInfoChangeIndId
       
  3341     RMobileCall::TMobileCallHscsdInfoV8 hscsdInfo;
       
  3342     hscsdInfo.iCodings = RMobileCall::ETchCoding320;
       
  3343     hscsdInfo.iAiur = RMobileCall::EAiurBps38400;
       
  3344     hscsdInfo.iRxTimeSlots = 2;
       
  3345     hscsdInfo.iTxTimeSlots = 2;
       
  3346 
       
  3347     RMobileCall::TMobileCallDataCapsV1 completeCallCaps2 = completeCallCaps;
       
  3348     completeCallCaps2.iHscsdSupport = ETrue;
       
  3349     completeCallCaps2.iSpeedCaps = RMobileCall::KCapsSpeed57600;
       
  3350     completeCallCaps2.iMaxRxTimeSlots = 3;
       
  3351     completeCallCaps2.iMaxTxTimeSlots = 5;
       
  3352 
       
  3353     TMockLtsyCallData2<RMobileCall::TMobileCallHscsdInfoV8, RMobileCall::TMobileCallDataCapsV1>
       
  3354     		hscsdData(1, RMobilePhone::ECircuitDataService, hscsdInfo, completeCallCaps2);
       
  3355     data.Close();
       
  3356     hscsdData.SerialiseL(data);
       
  3357 
       
  3358 	iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyHscsdInfoChangeIndId, KErrNone, data);
       
  3359 
       
  3360 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
  3361 	DriverHangUpCallL(callId, hangUpCause);
       
  3362 
       
  3363 	// Client Side Test
       
  3364 
       
  3365     RMobileLine mobileLine;
       
  3366 	CleanupClosePushL(mobileLine);
       
  3367 	RMobileCall mobileCall;
       
  3368 	CleanupClosePushL(mobileCall);
       
  3369 
       
  3370 	ClientDialCallL(mobileLine, mobileCall, mobileService, EFalse, EFalse);
       
  3371 
       
  3372 	RCall::TCommPort dataPort;
       
  3373 	TRequestStatus reqStatus;
       
  3374 	mobileCall.LoanDataPort(reqStatus, dataPort);
       
  3375 	User::WaitForRequest(reqStatus);
       
  3376 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3377 	ASSERT_EQUALS(0, dataPort.iPort.Compare(KDataPort()));
       
  3378 
       
  3379 	TInt err = mobileCall.RecoverDataPort();
       
  3380 	ASSERT_EQUALS(KErrNone, err);
       
  3381 
       
  3382 	RMobileCall::TMobileCallDataCapsV1 callCaps;
       
  3383 	RMobileCall::TMobileCallDataCapsV1Pckg callCapsPckg(callCaps);
       
  3384 	mobileCall.GetMobileDataCallCaps(callCapsPckg);
       
  3385 	ASSERT_TRUE(TComparator<RMobileCall::TMobileCallDataCapsV1>::IsEqual(completeCallCaps, callCaps));
       
  3386 
       
  3387 	TRequestStatus hscsdInfoStatus;
       
  3388 	RMobileCall::TMobileCallHscsdInfoV8 hscsdInfo2;
       
  3389 	RMobileCall::TMobileCallHscsdInfoV8Pckg hscsdInfoPckg(hscsdInfo2);
       
  3390 	mobileCall.NotifyHscsdInfoChange(hscsdInfoStatus, hscsdInfoPckg);
       
  3391 
       
  3392 	TRequestStatus dataCallCapsStatus;
       
  3393 	RMobileCall::TMobileCallDataCapsV1 dataCallCaps2;
       
  3394 	RMobileCall::TMobileCallDataCapsV1Pckg dataCallCapsPckg(dataCallCaps2);
       
  3395 	mobileCall.NotifyMobileDataCallCapsChange(dataCallCapsStatus, dataCallCapsPckg);
       
  3396 
       
  3397 	TRequestStatus hscsdParamStatus;
       
  3398 	mobileCall.SetDynamicHscsdParams(hscsdParamStatus, hscsdParams.iWantedAiur, hscsdParams.iWantedRxTimeSlots);
       
  3399 	User::WaitForRequest(hscsdParamStatus);
       
  3400 
       
  3401 	User::WaitForRequest(hscsdInfoStatus);
       
  3402 	ASSERT_EQUALS(KErrNone, hscsdInfoStatus.Int());
       
  3403 	ASSERT_EQUALS(hscsdInfo2.iAiur, hscsdInfo.iAiur);
       
  3404 	ASSERT_EQUALS(hscsdInfo2.iRxTimeSlots, hscsdInfo.iRxTimeSlots);
       
  3405 	ASSERT_EQUALS(hscsdInfo2.iTxTimeSlots, hscsdInfo.iTxTimeSlots);
       
  3406 	ASSERT_EQUALS(hscsdInfo2.iCodings, hscsdInfo.iCodings);
       
  3407 
       
  3408 	User::WaitForRequest(dataCallCapsStatus);
       
  3409 	ASSERT_EQUALS(KErrNone, dataCallCapsStatus.Int());
       
  3410 	ASSERT_EQUALS(completeCallCaps2.iSpeedCaps, dataCallCaps2.iSpeedCaps);
       
  3411 	ASSERT_EQUALS(completeCallCaps2.iHscsdSupport, dataCallCaps2.iHscsdSupport);
       
  3412 	ASSERT_EQUALS(completeCallCaps2.iMaxRxTimeSlots, dataCallCaps2.iMaxRxTimeSlots);
       
  3413 	ASSERT_EQUALS(completeCallCaps2.iMaxTxTimeSlots, dataCallCaps2.iMaxTxTimeSlots);
       
  3414 
       
  3415 	TRequestStatus reqStatusTerminated;
       
  3416 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 	
       
  3417 	ClientHangUpCallL(mobileCall);
       
  3418 
       
  3419 	mobileCall.Close();
       
  3420 	mobileLine.Close();
       
  3421 	data.Close();
       
  3422 
       
  3423 	User::WaitForRequest(reqStatusTerminated);
       
  3424 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  3425 
       
  3426 	AssertMockLtsyStatusL();
       
  3427 	CleanupStack::PopAndDestroy(4, this); // mobileCall, mobileLine, data, this
       
  3428 	} // CCTsyCallControlFU::TestUnit0021L
       
  3429 
       
  3430 
       
  3431 //
       
  3432 // Other helper functions
       
  3433 //
       
  3434 
       
  3435 
       
  3436 void CCTsyCallControlFU::ClientSetIsvPubSubKeyL()
       
  3437 	{
       
  3438 	// CTelephony requires property to be set otherwise it thinks flight mode
       
  3439 	// is on.
       
  3440 	TInt err = RProperty::Set(KUidSystemCategory, KUidPhonePwr.iUid, ESAPhoneOn);
       
  3441 	User::LeaveIfError(err);
       
  3442 	} // CCTsyCallControlFU::ClientSetIsvPubSubKeyL
       
  3443 
       
  3444 
       
  3445 
       
  3446 void CCTsyCallControlFU::DriverCreateIncomingCallL(TInt aCallId, RMobilePhone::TMobileService aMode)
       
  3447 	{
       
  3448 	RBuf8 data;
       
  3449 	CleanupClosePushL(data);
       
  3450 
       
  3451 	RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
  3452     mobileCallInfo.iService = aMode;
       
  3453     mobileCallInfo.iCallId = aCallId;
       
  3454     TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> mockCallData1(aCallId, aMode, mobileCallInfo);
       
  3455     mockCallData1.SerialiseL(data);
       
  3456     iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyIncomingCallIndId, KErrNone, data);
       
  3457 
       
  3458     data.Close();
       
  3459     CleanupStack::PopAndDestroy(1, &data);
       
  3460 	} // CCTsyCallControlFU::DriverCreateIncomingCallL
       
  3461 
       
  3462 void CCTsyCallControlFU::DriverAnswerIncomingCallL(TInt aCallId, RMobilePhone::TMobileService aMode, TBool aIsIsvCall,TInt aAnswerError)
       
  3463 	{
       
  3464 	RBuf8 data;
       
  3465 	CleanupClosePushL(data);
       
  3466 
       
  3467     TMockLtsyData2<TInt, TInt> data1(aCallId, aIsIsvCall);
       
  3468     data.Close();
       
  3469     data1.SerialiseL(data);
       
  3470     iMockLTSY.ExpectL(MLtsyDispatchCallControlAnswer::KLtsyDispatchCallControlAnswerApiId, data);
       
  3471 
       
  3472     TMockLtsyData1<TInt> data2(aCallId);
       
  3473     data.Close();
       
  3474     data2.SerialiseL(data);
       
  3475     iMockLTSY.CompleteL(MLtsyDispatchCallControlAnswer::KLtsyDispatchCallControlAnswerApiId, aAnswerError, data);
       
  3476 
       
  3477     if (aAnswerError == KErrNone)
       
  3478     	{
       
  3479 	    RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusAnswering;
       
  3480 	    TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData3(aCallId, aMode, callStatus);
       
  3481 	    data.Close();
       
  3482 	    mockCallData3.SerialiseL(data);
       
  3483 	    iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  3484 
       
  3485 	    callStatus = RMobileCall::EStatusConnected;
       
  3486 	    TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData4(aCallId, aMode, callStatus);
       
  3487 	    data.Close();
       
  3488 	    mockCallData4.SerialiseL(data);
       
  3489 	    iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  3490     	}
       
  3491     else
       
  3492     	{
       
  3493     	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusIdle;
       
  3494 	    TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData3(aCallId, aMode, callStatus);
       
  3495 	    data.Close();
       
  3496 	    mockCallData3.SerialiseL(data);
       
  3497 	    iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId , KErrNone, data);
       
  3498     	}
       
  3499 
       
  3500     data.Close();
       
  3501     CleanupStack::PopAndDestroy(1, &data);
       
  3502 	} // CCTsyCallControlFU::DriverAnswerIncomingCallL
       
  3503 
       
  3504 
       
  3505 void CCTsyCallControlFU::DriverResumeCallL(TInt aCallId, TInt aResumeError)
       
  3506 	{
       
  3507 	RBuf8 data;
       
  3508 	CleanupClosePushL(data);
       
  3509 
       
  3510 	TMockLtsyData1<TInt> mockData2(aCallId);
       
  3511 	data.Close();
       
  3512 	mockData2.SerialiseL(data);
       
  3513 	iMockLTSY.ExpectL(MLtsyDispatchCallControlResume::KLtsyDispatchCallControlResumeApiId, data);
       
  3514 
       
  3515 	TMockLtsyData1<TInt> resumeData(aCallId);
       
  3516 	data.Close();
       
  3517 	resumeData.SerialiseL(data);
       
  3518     iMockLTSY.CompleteL(MLtsyDispatchCallControlResume::KLtsyDispatchCallControlResumeApiId, aResumeError, data);
       
  3519 
       
  3520     if (aResumeError == KErrNone)
       
  3521     	{
       
  3522 		RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusConnected;
       
  3523 	    TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(
       
  3524 	    		aCallId, RMobilePhone::EServiceUnspecified, callStatus);
       
  3525 	    data.Close();
       
  3526 	    mockCallData2.SerialiseL(data);
       
  3527 	    iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  3528     	}
       
  3529 
       
  3530     data.Close();
       
  3531     CleanupStack::PopAndDestroy(1, &data);
       
  3532 	} // CCTsyCallControlFU::DriverResumeCallL
       
  3533 
       
  3534 /**
       
  3535  * Swap the call.
       
  3536  *
       
  3537  * @param aCallId1 Call ID of held call to swap.
       
  3538  * @param aCallId2 Call ID of connected call to swap.
       
  3539  * @param aSwapError Error returned by LTSY in response to the swap request.
       
  3540  * @param aNewCall1Status New status of the call 1 if aSwapError = KErrNone
       
  3541  * @param aNewCall2Status New status of the call 2 if aSwapError = KErrNone
       
  3542  *
       
  3543  * In the case where aSwapError passed is not KErrNone, the new call statuses
       
  3544  * are irrelevant as the calls don't change state.
       
  3545  */
       
  3546 void CCTsyCallControlFU::DriverSwapCallL(TInt aCallId1, TInt aCallId2,
       
  3547 	TInt aSwapError, RMobileCall::TMobileCallStatus aNewCall1Status,
       
  3548 	RMobileCall::TMobileCallStatus aNewCall2Status)
       
  3549 	{
       
  3550 	RBuf8 data;
       
  3551 	CleanupClosePushL(data);
       
  3552 
       
  3553 	TMockLtsyData2<TInt, TInt> mockData2(aCallId1, aCallId2);
       
  3554 	data.Close();
       
  3555 	mockData2.SerialiseL(data);
       
  3556 	iMockLTSY.ExpectL(MLtsyDispatchCallControlSwap::KLtsyDispatchCallControlSwapApiId, data);
       
  3557 
       
  3558     iMockLTSY.CompleteL(MLtsyDispatchCallControlSwap::KLtsyDispatchCallControlSwapApiId, aSwapError);
       
  3559 
       
  3560     if (aSwapError == KErrNone)
       
  3561     	{
       
  3562 	    TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(
       
  3563 	    		aCallId1, RMobilePhone::EServiceUnspecified, aNewCall1Status);
       
  3564 	    data.Close();
       
  3565 	    mockCallData2.SerialiseL(data);
       
  3566 	    iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  3567 
       
  3568 	    TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData3(
       
  3569 	    		aCallId2, RMobilePhone::EServiceUnspecified, aNewCall2Status);
       
  3570 	    data.Close();
       
  3571 	    mockCallData3.SerialiseL(data);
       
  3572 	    iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
       
  3573     	}
       
  3574 
       
  3575     data.Close();
       
  3576     CleanupStack::PopAndDestroy(1, &data);
       
  3577 	} // CCTsyCallControlFU::DriverSwapCallL
       
  3578 
       
  3579 
       
  3580 
       
  3581 
       
  3582 /**
       
  3583  * Waits for an incoming call notification and opens the call.
       
  3584  *
       
  3585  * @param aMobileCall RMobileCall subsession, should not be open before calling this function.
       
  3586  * Pushed on CleanupStack in this function.
       
  3587  *
       
  3588  * @param aMobileLine Line that will ring.
       
  3589  * @param aCallName Populated with the call name when incoming call arrives.
       
  3590  */
       
  3591 void CCTsyCallControlFU::ClientWaitForIncomingCallNotificationLC(
       
  3592 		RMobileCall& aMobileCall, RMobileLine& aMobileLine, TName& aCallName)
       
  3593 	{
       
  3594     TRequestStatus notifyStatus;
       
  3595     aMobileLine.NotifyIncomingCall(notifyStatus, aCallName);
       
  3596     User::WaitForRequest(notifyStatus);
       
  3597     ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
  3598 
       
  3599     TInt err = aMobileCall.OpenExistingCall(aMobileLine, aCallName);
       
  3600     CleanupClosePushL(aMobileCall);
       
  3601     ASSERT_EQUALS(KErrNone, err);
       
  3602 
       
  3603     RMobileCall::TMobileCallStatus callStatus;
       
  3604     aMobileCall.GetMobileCallStatus(callStatus);
       
  3605     ASSERT_EQUALS(RMobileCall::EStatusRinging, callStatus);
       
  3606 	} // CCTsyCallControlFU::ClientWaitForIncomingCallNotificationLC
       
  3607 
       
  3608 void CCTsyCallControlFU::ClientAnswerIncomingCallL(RMobileCall& aMobileCall, TInt aExpectedAnswerError)
       
  3609 	{
       
  3610 	TRequestStatus notifyStatus;
       
  3611 	RMobileCall::TMobileCallStatus callStatus;
       
  3612 	aMobileCall.NotifyMobileCallStatusChange(notifyStatus, callStatus);
       
  3613 
       
  3614     TRequestStatus ansStatus;
       
  3615     aMobileCall.AnswerIncomingCall(ansStatus);
       
  3616 
       
  3617     RArray<RMobileCall::TMobileCallStatus> expectedCallStatuses;
       
  3618     CleanupClosePushL(expectedCallStatuses);
       
  3619 
       
  3620     if (aExpectedAnswerError == KErrNone)
       
  3621     	{
       
  3622 	    expectedCallStatuses.AppendL(RMobileCall::EStatusAnswering);
       
  3623 	    expectedCallStatuses.AppendL(RMobileCall::EStatusConnected);
       
  3624     	}
       
  3625     else
       
  3626     	{
       
  3627     	expectedCallStatuses.AppendL(RMobileCall::EStatusIdle);
       
  3628     	}
       
  3629 
       
  3630     ClientWaitForCallStatusNotifications(aMobileCall, notifyStatus, callStatus, expectedCallStatuses, KErrNone);
       
  3631 
       
  3632     User::WaitForRequest(ansStatus);
       
  3633 	ASSERT_EQUALS(aExpectedAnswerError, ansStatus.Int());
       
  3634 
       
  3635 	aMobileCall.GetMobileCallStatus(callStatus);
       
  3636 
       
  3637 	if (aExpectedAnswerError == KErrNone)
       
  3638 		{
       
  3639 		ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
       
  3640 		}
       
  3641 	else
       
  3642 		{
       
  3643 		ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
  3644 		}
       
  3645 
       
  3646 	expectedCallStatuses.Close();
       
  3647 	CleanupStack::PopAndDestroy(1, &expectedCallStatuses);
       
  3648 	} // CCTsyCallControlFU::ClientAnswerIncomingCallL
       
  3649