telephonyserverplugins/common_tsy/test/component/src/cctsycallcontrolfu.cpp
changeset 0 3553901f7fa8
child 17 3f227a47ad75
child 20 244d7c5f118e
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The TEFUnit test suite for CallControl in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsycallcontrolfu.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include "tmockltsydata.h"
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 #include <etelmmerr.h>
       
    31 #include "MmTsy_timeoutdefs.h"
       
    32 
       
    33 CTestSuite* CCTsyCallControlFU::CreateSuiteL(const TDesC& aName)
       
    34 	{
       
    35 	SUB_SUITE;
       
    36 
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0001L);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0002L);
       
    39 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0004L);
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0005L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0006L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0007L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0008L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall0009L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall00010L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCall00011L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0001L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0001bL);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0002L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0003L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0004L);
       
    52 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0005L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006L);
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006bL);
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006cL);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006dL);
       
    57 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006eL);
       
    58 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006fL);
       
    59 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006gL);
       
    60 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006hL);
       
    61 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0006iL);
       
    62 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0007L);
       
    63 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0008L);
       
    64 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0009L);
       
    65 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0009bL);
       
    66 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial0009cL);
       
    67 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial00010L);
       
    68 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDial00011L);
       
    69 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0001L);
       
    70 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0002L);
       
    71 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0004L);
       
    72 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0005L);
       
    73 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0006L);
       
    74 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0007L);
       
    75 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp0009L);
       
    76 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00010L);
       
    77 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00011L);
       
    78 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00011bL);
       
    79 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00011cL);
       
    80 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00012L);
       
    81 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00014L);
       
    82 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHangUp00015L);
       
    83 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold0001L);
       
    84 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold0002L);
       
    85 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold0004L);
       
    86 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold0005L);
       
    87 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold0006L);
       
    88 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold00011L);
       
    89 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestHold0001aL);
       
    90 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSwap0001L);
       
    91 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSwap0002L);
       
    92 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSwap0004L);
       
    93 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSwap0005L);
       
    94 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSwap0006L);
       
    95 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSwap00011L);
       
    96 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestResume0001L);
       
    97 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestResume0002L);
       
    98 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestResume0004L);
       
    99 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestResume0005L);
       
   100 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestResume0006L);
       
   101 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestResume00011L);
       
   102 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDeflect0001L);
       
   103 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDeflect0002L);
       
   104 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDeflect0003L);
       
   105 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer0001L);
       
   106 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer0002L);
       
   107 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer0004L);
       
   108 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer0005L);
       
   109 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer0006L);
       
   110 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer0009L);
       
   111 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTransfer00011L);
       
   112 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTerminateAllCalls0001L);
       
   113 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTerminateAllCalls0002L);
       
   114 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTerminateAllCalls0004L);
       
   115 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestTerminateAllCalls0005L);	
       
   116 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestSetIncomingCallType0001L);
       
   117 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCallISV0001L);
       
   118 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCallISV0002L);
       
   119 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCallISV0004L);
       
   120 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCallISV0005L);
       
   121 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCallISV0006L);
       
   122 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestAnswerIncomingCallISV00011L);
       
   123 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDialISV0001L);
       
   124 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDialISV0006L);
       
   125 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDialISV00011L);
       
   126 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDialCallControl0001L);
       
   127 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDialCallControl0006L);
       
   128 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestDialCallControl00011L);
       
   129 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestEnumerateCall0001L);
       
   130 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestEnumerateCall0006L);
       
   131 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestEnumerateCall00011L);
       
   132 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestNotifyHookChange0001L);
       
   133 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestNotifyHookChange0006L);
       
   134 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestNotifyHookChange00011L);
       
   135 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestCompleteNotifyStatusChange0001L);
       
   136 	ADD_TEST_STEP_ISO_CPP(CCTsyCallControlFU, TestUpdateLifeTime0001L);	
       
   137 
       
   138 	END_SUITE;
       
   139 	}
       
   140 
       
   141 
       
   142 //
       
   143 // Actual test cases
       
   144 //
       
   145 
       
   146 
       
   147 /**
       
   148 @SYMTestCaseID BA-CTSY-CCON-CAIC-0001
       
   149 @SYMComponent  telephony_ctsy
       
   150 @SYMTestCaseDesc Test support in CTSY for RCall::AnswerIncomingCall for voice calls
       
   151 @SYMTestPriority High
       
   152 @SYMTestActions Invokes RCall::AnswerIncomingCall for voice calls
       
   153 @SYMTestExpectedResults Pass
       
   154 @SYMTestType CT
       
   155 */
       
   156 void CCTsyCallControlFU::TestAnswerIncomingCall0001L()
       
   157 	{
       
   158 
       
   159 	OpenEtelServerL(EUseExtendedError);
       
   160 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   161 	OpenPhoneL();
       
   162 
       
   163     RBuf8 expectData;
       
   164     CleanupClosePushL(expectData);
       
   165 
       
   166     RBuf8 completeData;
       
   167     CleanupClosePushL(completeData);
       
   168 
       
   169 	RLine line;
       
   170 	RCall call;
       
   171 	CleanupClosePushL(call);
       
   172 	
       
   173 	TInt errorCode = KErrNone;
       
   174 	TInt callId = 1;
       
   175 	TName incomingCallName;
       
   176     TRequestStatus requestStatus;
       
   177     TRequestStatus requestNotify;
       
   178 	
       
   179 	// open new line and call for KMmTsyVoice1LineName
       
   180 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
   181 	ASSERT_EQUALS(KErrNone, errorCode);
       
   182 		
       
   183     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
   184     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   185 
       
   186  	//-------------------------------------------------------------------------
       
   187 	// TEST A: failure to dispatch request to LTSY
       
   188  	//-------------------------------------------------------------------------
       
   189 
       
   190  	//-------------------------------------------------------------------------
       
   191 	// create new incoming call
       
   192 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
   193 	                               mobileService, mobileCallStatus);	
       
   194 	ASSERT_EQUALS(KErrNone, errorCode);
       
   195 		
       
   196     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   197     ASSERT_EQUALS(KErrNone, errorCode);
       
   198  	//-------------------------------------------------------------------------
       
   199 
       
   200     TMockLtsyCallData0 mockData0(callId, mobileService);
       
   201    
       
   202     expectData.Close();
       
   203     mockData0.SerialiseL(expectData);
       
   204     iMockLTSY.ExpectL(EEtelCallAnswer, expectData, KErrNotSupported);
       
   205 
       
   206 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
   207 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
   208     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   209 
       
   210     User::WaitForRequest(requestStatus);
       
   211     AssertMockLtsyStatusL();
       
   212     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
   213 
       
   214 	// close incoming call
       
   215  	CloseIncomingCallL(call, callId, mobileService);
       
   216 
       
   217 	//-------------------------------------------------------------------------
       
   218 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   219  	//-------------------------------------------------------------------------
       
   220 
       
   221  	//-------------------------------------------------------------------------
       
   222 	// create new incoming call
       
   223 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
   224 	                               mobileService, mobileCallStatus);	
       
   225 	ASSERT_EQUALS(KErrNone, errorCode);
       
   226     AssertMockLtsyStatusL();
       
   227 		
       
   228     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   229     ASSERT_EQUALS(KErrNone, errorCode);
       
   230     AssertMockLtsyStatusL();
       
   231  	//-------------------------------------------------------------------------
       
   232 
       
   233     expectData.Close();
       
   234     mockData0.SerialiseL(expectData);
       
   235     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   236     iMockLTSY.CompleteL(EEtelCallAnswer, KErrGeneral, expectData);
       
   237     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   238 
       
   239     User::WaitForRequest(requestStatus);
       
   240     AssertMockLtsyStatusL();
       
   241     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
   242 
       
   243 	// close incoming call
       
   244     CloseIncomingCallL(call, callId, mobileService);
       
   245 
       
   246  	//-------------------------------------------------------------------------
       
   247 	// TEST C: Successful completion request of
       
   248 	// RCall::AnswerIncomingCall when result is not cached.
       
   249  	//-------------------------------------------------------------------------
       
   250 
       
   251  	//-------------------------------------------------------------------------
       
   252 	// create new incoming call
       
   253 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
   254 	                               mobileService, mobileCallStatus);	
       
   255 	ASSERT_EQUALS(KErrNone, errorCode);
       
   256     AssertMockLtsyStatusL();
       
   257 		
       
   258     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   259     ASSERT_EQUALS(KErrNone, errorCode);
       
   260     AssertMockLtsyStatusL();
       
   261  	//-------------------------------------------------------------------------
       
   262 
       
   263     expectData.Close();
       
   264     mockData0.SerialiseL(expectData);
       
   265     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   266     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   267     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   268 
       
   269     User::WaitForRequest(requestStatus);
       
   270     AssertMockLtsyStatusL();
       
   271     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   272 
       
   273 	// close incoming call
       
   274     CloseIncomingCallL(call, callId, mobileService);
       
   275 
       
   276  	//-------------------------------------------------------------------------
       
   277 	// TEST E: Unsolicited completion of RCall::AnswerIncomingCall
       
   278 	// from LTSY.
       
   279  	//-------------------------------------------------------------------------
       
   280 
       
   281     TRequestStatus mockLtsyStatus;
       
   282 
       
   283 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   284 	expectData.Close();
       
   285     mockData0.SerialiseL(expectData);
       
   286 	iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   287 	User::WaitForRequest(mockLtsyStatus);
       
   288 	AssertMockLtsyStatusL();
       
   289 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   290 
       
   291  	//-------------------------------------------------------------------------
       
   292 	// TEST : Call AnswerIncomingCall with null description
       
   293  	//-------------------------------------------------------------------------
       
   294 
       
   295  	//-------------------------------------------------------------------------
       
   296 	// create new incoming call
       
   297 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
   298 	                               mobileService, mobileCallStatus);	
       
   299 	ASSERT_EQUALS(KErrNone, errorCode);
       
   300     AssertMockLtsyStatusL();
       
   301 		
       
   302     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   303     ASSERT_EQUALS(KErrNone, errorCode);
       
   304     AssertMockLtsyStatusL();
       
   305  	//-------------------------------------------------------------------------
       
   306 
       
   307     expectData.Close();
       
   308     mockData0.SerialiseL(expectData);
       
   309     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   310     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   311     
       
   312     TPtr8 null(NULL,0);
       
   313     call.AnswerIncomingCall(requestStatus, null);
       
   314 
       
   315     User::WaitForRequest(requestStatus);
       
   316     AssertMockLtsyStatusL();
       
   317     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   318 
       
   319 	// close incoming call
       
   320     CloseIncomingCallL(call, callId, mobileService);
       
   321 
       
   322  	//-------------------------------------------------------------------------
       
   323 	// TEST : to increase CMmVoiceCallTsy::AnswerIncomingCall coverage
       
   324 	// covers "if ( 0 < answerCallHandle )" condition
       
   325  	//-------------------------------------------------------------------------
       
   326 
       
   327 	RCall call2;
       
   328 	CleanupClosePushL(call2);
       
   329     TRequestStatus requestStatus2;
       
   330 
       
   331  	//-------------------------------------------------------------------------
       
   332 	// create new incoming call
       
   333 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
   334 	                               mobileService, mobileCallStatus);	
       
   335 	ASSERT_EQUALS(KErrNone, errorCode);
       
   336     AssertMockLtsyStatusL();
       
   337 		
       
   338     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   339     ASSERT_EQUALS(KErrNone, errorCode);
       
   340     AssertMockLtsyStatusL();
       
   341  	//-------------------------------------------------------------------------
       
   342 
       
   343  	//-------------------------------------------------------------------------
       
   344     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
   345     ASSERT_EQUALS(KErrNone, errorCode);
       
   346     AssertMockLtsyStatusL();
       
   347  	//-------------------------------------------------------------------------
       
   348 
       
   349     expectData.Close();
       
   350     mockData0.SerialiseL(expectData);
       
   351     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   352     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   353     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   354 
       
   355     call2.AnswerIncomingCall(requestStatus2, mmParamsPckgV1);
       
   356 
       
   357     User::WaitForRequest(requestStatus);
       
   358     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   359 
       
   360     User::WaitForRequest(requestStatus2);
       
   361     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
   362 
       
   363 	call.Close();
       
   364 
       
   365 	CloseIncomingCallL(call2, callId, mobileService);
       
   366 	AssertMockLtsyStatusL();
       
   367 
       
   368  	//-------------------------------------------------------------------------
       
   369 	// TEST : to increase CMmVoiceCallTsy::AnswerIncomingCall coverage
       
   370 	// covers "else if( activeCall && 
       
   371 	//                ( !( KETelExt3rdPartyV1 == activeCall->GetExtensionId() ) &&
       
   372 	//                ( KETelExt3rdPartyV1 == extensionId ) ) )" condition
       
   373  	//-------------------------------------------------------------------------
       
   374 
       
   375 	mobileCallStatus = RMobileCall::EStatusRinging;
       
   376 
       
   377 	// create new incoming call1
       
   378 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
   379 	                               mobileService, mobileCallStatus);	
       
   380 	ASSERT_EQUALS(KErrNone, errorCode);
       
   381 	AssertMockLtsyStatusL();
       
   382 		
       
   383 	RMobileCall call1;
       
   384 	CleanupClosePushL(call1);
       
   385     errorCode = call1.OpenExistingCall(line, incomingCallName);
       
   386     ASSERT_EQUALS(KErrNone, errorCode);
       
   387 	AssertMockLtsyStatusL();
       
   388 
       
   389  	//-------------------------------------------------------------------------
       
   390 
       
   391  	TName incomingCallName2;
       
   392  	TInt callId2 = 2;
       
   393 	mobileCallStatus = RMobileCall::EStatusConnected;
       
   394  	
       
   395 	// create new incoming call2
       
   396 	errorCode = CreateIncomingCallL(line, callId2, incomingCallName2,
       
   397 	                               mobileService, mobileCallStatus);	
       
   398 	ASSERT_EQUALS(KErrNone, errorCode);
       
   399 	AssertMockLtsyStatusL();
       
   400 		
       
   401     errorCode = call2.OpenExistingCall(line, incomingCallName2);
       
   402     ASSERT_EQUALS(KErrNone, errorCode);
       
   403 	AssertMockLtsyStatusL();
       
   404  	//-------------------------------------------------------------------------
       
   405 
       
   406 	call2.AnswerIncomingCall(requestStatus2, mmParamsPckgV1);
       
   407 
       
   408 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParams;
       
   409 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> callParamsPckg(callParams);
       
   410 	call1.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
   411 
       
   412 	User::WaitForRequest(requestStatus);
       
   413 	ASSERT_EQUALS(KErrGsmNotAllowed, requestStatus.Int());
       
   414 
       
   415 	User::WaitForRequest(requestStatus2);
       
   416 	ASSERT_EQUALS(KErrNotSupported, requestStatus2.Int());
       
   417 
       
   418 	AssertMockLtsyStatusL();
       
   419 	CleanupStack::PopAndDestroy(7, this); // expectData, completeData, call, line, call2
       
   420 										  // this, call1 
       
   421 	
       
   422 	}
       
   423 
       
   424 
       
   425 /**
       
   426 @SYMTestCaseID BA-CTSY-CCON-CAIC-0002
       
   427 @SYMComponent  telephony_ctsy
       
   428 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::AnswerIncomingCall for voice calls
       
   429 @SYMTestPriority High
       
   430 @SYMTestActions Invokes cancelling of RCall::AnswerIncomingCall for voice calls
       
   431 @SYMTestExpectedResults Pass
       
   432 @SYMTestType CT
       
   433 */
       
   434 void CCTsyCallControlFU::TestAnswerIncomingCall0002L()
       
   435 	{
       
   436 
       
   437 	OpenEtelServerL(EUseExtendedError);
       
   438 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   439 	OpenPhoneL();
       
   440 
       
   441 	RBuf8 expectData;
       
   442 	CleanupClosePushL(expectData);
       
   443 
       
   444 	RLine line;
       
   445 	RCall call;
       
   446 	CleanupClosePushL(call);
       
   447 	
       
   448 	TInt errorCode = KErrNone;
       
   449 	TInt callId = 1;
       
   450 	TName incomingCallName;
       
   451 
       
   452     TRequestStatus requestStatus;
       
   453 	TRequestStatus mockLtsyStatus;
       
   454 	
       
   455     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
   456     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   457 	
       
   458  	//-------------------------------------------------------------------------
       
   459 	// Test cancelling of RCall::AnswerIncomingCall
       
   460  	//-------------------------------------------------------------------------
       
   461  	
       
   462 	// open new line for KMmTsyVoice1LineName
       
   463 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
   464 	ASSERT_EQUALS(KErrNone, errorCode);
       
   465 		
       
   466  	//-------------------------------------------------------------------------
       
   467 	// create new incoming call
       
   468 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
   469 	                               mobileService, mobileCallStatus);	
       
   470 	ASSERT_EQUALS(KErrNone, errorCode);
       
   471 	AssertMockLtsyStatusL();
       
   472 		
       
   473     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   474     ASSERT_EQUALS(KErrNone, errorCode);
       
   475 	AssertMockLtsyStatusL();
       
   476  	//-------------------------------------------------------------------------
       
   477 
       
   478 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   479     TMockLtsyCallData0 mockData0(callId, mobileService);
       
   480 
       
   481     expectData.Close();
       
   482     mockData0.SerialiseL(expectData);
       
   483 
       
   484     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   485     iMockLTSY.CompleteL(EEtelCallAnswer, KErrCancel, expectData);
       
   486 
       
   487 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
   488 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
   489     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   490 
       
   491 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
   492 	TBool autoStChangeDisable = ETrue;
       
   493     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
   494                                              hangUpCause, 
       
   495                                              autoStChangeDisable);
       
   496     expectData.Close();                                             
       
   497     mockData2.SerialiseL(expectData);
       
   498     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
   499 
       
   500     call.CancelAsyncRequest(EEtelCallAnswer);
       
   501 
       
   502     User::WaitForRequest(requestStatus);
       
   503     AssertMockLtsyStatusL();
       
   504     ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
   505 
       
   506 	User::WaitForRequest(mockLtsyStatus);
       
   507 	
       
   508 	CleanupStack::PopAndDestroy(4); // this, expectData, call, line
       
   509 	
       
   510 	}
       
   511 
       
   512 /**
       
   513 @SYMTestCaseID BA-CTSY-CCON-CAIC-0004
       
   514 @SYMComponent  telephony_ctsy
       
   515 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::AnswerIncomingCall for voice calls
       
   516 @SYMTestPriority High
       
   517 @SYMTestActions Invokes multiple client requests to RCall::AnswerIncomingCall for voice calls
       
   518 @SYMTestExpectedResults Pass
       
   519 @SYMTestType CT
       
   520 */
       
   521 void CCTsyCallControlFU::TestAnswerIncomingCall0004L()
       
   522 	{
       
   523 	OpenEtelServerL(EUseExtendedError);
       
   524 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   525 	OpenPhoneL();
       
   526 
       
   527 	RBuf8 expectData;
       
   528 	CleanupClosePushL(expectData);
       
   529 	
       
   530 	RBuf8 completeData;
       
   531 	CleanupClosePushL(completeData);
       
   532 
       
   533 	// Open second client
       
   534 	RTelServer telServer2;
       
   535 	TInt ret = telServer2.Connect();
       
   536 	ASSERT_EQUALS(KErrNone, ret);
       
   537 	CleanupClosePushL(telServer2);
       
   538 
       
   539 	RMobilePhone phone2;
       
   540 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
   541 	ASSERT_EQUALS(KErrNone, ret);
       
   542 	CleanupClosePushL(phone2);
       
   543 
       
   544 	RLine line1;
       
   545 	RLine line2;
       
   546 	
       
   547 	RCall call1;
       
   548 	CleanupClosePushL(call1);
       
   549 
       
   550 	RCall call2;
       
   551 	CleanupClosePushL(call2);
       
   552 
       
   553 	TInt errorCode = KErrNone;
       
   554 
       
   555 	TInt callId1 = 1;
       
   556 	TName incomingCallName1;
       
   557 
       
   558 	TInt callId2 = 2;
       
   559 	TName incomingCallName2;
       
   560 
       
   561 	TRequestStatus requestStatus1;
       
   562 	TRequestStatus requestStatus2;
       
   563 
       
   564 	// open new line1 for KMmTsyVoice1LineName
       
   565 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
   566 	ASSERT_EQUALS(KErrNone, errorCode);
       
   567 
       
   568 	// open new line2 for KMmTsyVoice1LineName
       
   569 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
   570 	ASSERT_EQUALS(KErrNone, errorCode);
       
   571 
       
   572     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
   573     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   574 
       
   575 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
   576 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
   577 
       
   578 	//-------------------------------------------------------------------------
       
   579 	// Test A: Test multiple clients requesting RCall::AnswerIncomingCall
       
   580  	//-------------------------------------------------------------------------
       
   581 
       
   582  	//-------------------------------------------------------------------------
       
   583 	// create new incoming call1
       
   584 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
   585 	                               mobileService, mobileCallStatus);	
       
   586 	ASSERT_EQUALS(KErrNone, errorCode);
       
   587 	AssertMockLtsyStatusL();
       
   588 		
       
   589     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
   590     ASSERT_EQUALS(KErrNone, errorCode);
       
   591 	AssertMockLtsyStatusL();
       
   592  	//-------------------------------------------------------------------------
       
   593 	
       
   594  	//-------------------------------------------------------------------------
       
   595 	// create new incoming call2
       
   596 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
   597 	                               mobileService, mobileCallStatus);	
       
   598 	ASSERT_EQUALS(KErrNone, errorCode);
       
   599 	AssertMockLtsyStatusL();
       
   600 		
       
   601     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
   602     ASSERT_EQUALS(KErrNone, errorCode);
       
   603 	AssertMockLtsyStatusL();
       
   604  	//-------------------------------------------------------------------------
       
   605 
       
   606     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
   607   
       
   608     expectData.Close();
       
   609     mockData01.SerialiseL(expectData);
       
   610     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   611     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   612     call1.AnswerIncomingCall(requestStatus1, mmParamsPckgV1);
       
   613 
       
   614     TMockLtsyCallData0 mockData02(callId2, mobileService);
       
   615     expectData.Close();
       
   616     mockData02.SerialiseL(expectData);
       
   617     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   618     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   619     call2.AnswerIncomingCall(requestStatus2, mmParamsPckgV1);
       
   620 
       
   621     User::WaitForRequest(requestStatus1);
       
   622     AssertMockLtsyStatusL();
       
   623     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
   624 
       
   625     User::WaitForRequest(requestStatus2);
       
   626     AssertMockLtsyStatusL();
       
   627     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   628 
       
   629 	// close incoming call1
       
   630     CloseIncomingCallL(call1, callId1, mobileService);
       
   631 	AssertMockLtsyStatusL();
       
   632 
       
   633 	// close incoming call2
       
   634     CloseIncomingCallL(call2, callId2, mobileService);
       
   635 	AssertMockLtsyStatusL();
       
   636 
       
   637 	//-------------------------------------------------------------------------
       
   638 	// Test for increase coverage
       
   639  	//-------------------------------------------------------------------------
       
   640 
       
   641 	line1.NotifyIncomingCall(requestStatus1, incomingCallName1);   
       
   642     User::WaitForRequest(requestStatus1);
       
   643     AssertMockLtsyStatusL();
       
   644     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
   645 	
       
   646 	mobileCallStatus = RMobileCall::EStatusConnected;
       
   647 	
       
   648  	//-------------------------------------------------------------------------
       
   649 	// create new incoming call1
       
   650 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
   651 	                               mobileService, mobileCallStatus);	
       
   652 	ASSERT_EQUALS(KErrNone, errorCode);
       
   653 	AssertMockLtsyStatusL();
       
   654 		
       
   655     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
   656     ASSERT_EQUALS(KErrNone, errorCode);
       
   657 	AssertMockLtsyStatusL();
       
   658  	//-------------------------------------------------------------------------
       
   659 
       
   660 	mobileCallStatus = RMobileCall::EStatusHold;
       
   661  	//-------------------------------------------------------------------------
       
   662 	// create new incoming call2
       
   663 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
   664 	                               mobileService, mobileCallStatus);	
       
   665 	ASSERT_EQUALS(KErrNone, errorCode);
       
   666 	AssertMockLtsyStatusL();
       
   667 		
       
   668     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
   669     ASSERT_EQUALS(KErrNone, errorCode);
       
   670 	AssertMockLtsyStatusL();
       
   671  	//-------------------------------------------------------------------------
       
   672 
       
   673     call1.AnswerIncomingCall(requestStatus1, mmParamsPckgV1);
       
   674 
       
   675     User::WaitForRequest(requestStatus1);
       
   676     AssertMockLtsyStatusL();
       
   677     ASSERT_EQUALS(KErrGsmNotAllowed, requestStatus1.Int());
       
   678 
       
   679  	//-------------------------------------------------------------------------
       
   680 
       
   681 	// Done !
       
   682 	CleanupStack::PopAndDestroy(4); // line1, line2, call1, call2
       
   683 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, expectData, this, completeData
       
   684 
       
   685 	}
       
   686 
       
   687 
       
   688 /**
       
   689 @SYMTestCaseID BA-CTSY-CCON-CAIC-0005
       
   690 @SYMComponent  telephony_ctsy
       
   691 @SYMTestCaseDesc Test support in CTSY for RCall::AnswerIncomingCall with timeout for voice calls
       
   692 @SYMTestPriority High
       
   693 @SYMTestActions Invokes RCall::AnswerIncomingCall and tests for timeout for voice calls
       
   694 @SYMTestExpectedResults Pass
       
   695 @SYMTestType CT
       
   696 */
       
   697 void CCTsyCallControlFU::TestAnswerIncomingCall0005L()
       
   698 	{
       
   699 	OpenEtelServerL(EUseExtendedError);
       
   700 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   701 	OpenPhoneL();
       
   702 
       
   703 	RBuf8 expectData;
       
   704 	CleanupClosePushL(expectData);
       
   705 
       
   706 	RLine line;
       
   707 	RCall call;
       
   708 	CleanupClosePushL(call);
       
   709 	
       
   710 	TInt errorCode = KErrNone;
       
   711 	TInt callId = 1;
       
   712 	TName incomingCallName;
       
   713 
       
   714     TRequestStatus requestStatus;
       
   715 	TRequestStatus mockLtsyStatus;
       
   716 
       
   717 	// open new line for KMmTsyVoice1LineName
       
   718 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
   719 	ASSERT_EQUALS(KErrNone, errorCode);
       
   720 	
       
   721     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
   722     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
   723 
       
   724 	//-------------------------------------------------------------------------
       
   725 	// Test A: Test timeout of RCall::AnswerIncomingCall
       
   726  	//-------------------------------------------------------------------------
       
   727 		
       
   728  	//-------------------------------------------------------------------------
       
   729 	// create new incoming call
       
   730 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
   731 	                               mobileService, mobileCallStatus);	
       
   732 	ASSERT_EQUALS(KErrNone, errorCode);
       
   733 	AssertMockLtsyStatusL();
       
   734 		
       
   735     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   736     ASSERT_EQUALS(KErrNone, errorCode);
       
   737 	AssertMockLtsyStatusL();
       
   738  	//-------------------------------------------------------------------------
       
   739 
       
   740     TMockLtsyCallData0 mockData0(callId, mobileService);
       
   741 
       
   742     expectData.Close();
       
   743     mockData0.SerialiseL(expectData);
       
   744     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   745 
       
   746 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
   747 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
   748     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   749 
       
   750     User::WaitForRequest(requestStatus);
       
   751     AssertMockLtsyStatusL();
       
   752     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
   753 
       
   754 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
   755 
       
   756 	}
       
   757 
       
   758 
       
   759 /**
       
   760 @SYMTestCaseID BA-CTSY-CCON-CAIC-0006
       
   761 @SYMComponent  telephony_ctsy
       
   762 @SYMTestCaseDesc Test support in CTSY for RCall::AnswerIncomingCall for data calls
       
   763 @SYMTestPriority High
       
   764 @SYMTestActions Invokes RCall::AnswerIncomingCall for data calls
       
   765 @SYMTestExpectedResults Pass
       
   766 @SYMTestType CT
       
   767 */
       
   768 void CCTsyCallControlFU::TestAnswerIncomingCall0006L()
       
   769 	{
       
   770 
       
   771 	OpenEtelServerL(EUseExtendedError);
       
   772 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   773 	OpenPhoneL();
       
   774 
       
   775 	RBuf8 expectData;
       
   776 	CleanupClosePushL(expectData);
       
   777 
       
   778 	RBuf8 completeData;
       
   779 	CleanupClosePushL(completeData);
       
   780 
       
   781 	RLine line;
       
   782 	RCall call;
       
   783 	CleanupClosePushL(call);
       
   784 	
       
   785 	TInt errorCode = KErrNone;
       
   786 	TInt callId = 1;
       
   787 	TName incomingCallName;
       
   788 
       
   789     TRequestStatus requestStatus;
       
   790 	TRequestStatus mockLtsyStatus;
       
   791 
       
   792 	// open new line for KMmTsyVoice1LineName
       
   793 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
   794 	ASSERT_EQUALS(KErrNone, errorCode);
       
   795 
       
   796     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
   797     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
   798 
       
   799  	//-------------------------------------------------------------------------
       
   800 	// TEST A: failure to dispatch request to LTSY
       
   801  	//-------------------------------------------------------------------------
       
   802 
       
   803  	//-------------------------------------------------------------------------
       
   804 	// create new incoming call
       
   805 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
   806 	                               mobileService, mobileCallStatus);	
       
   807 	ASSERT_EQUALS(KErrNone, errorCode);
       
   808 		
       
   809     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   810     ASSERT_EQUALS(KErrNone, errorCode);
       
   811  	//-------------------------------------------------------------------------
       
   812 
       
   813     TMockLtsyCallData0 mockData0(callId, mobileService);
       
   814 
       
   815     expectData.Close();
       
   816     mockData0.SerialiseL(expectData);
       
   817     iMockLTSY.ExpectL(EEtelCallAnswer, expectData, KErrNotSupported);
       
   818 
       
   819 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
   820 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
   821     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   822 
       
   823     User::WaitForRequest(requestStatus);
       
   824     AssertMockLtsyStatusL();
       
   825     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
   826 
       
   827 	//-------------------------------------------------------------------------
       
   828 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   829  	//-------------------------------------------------------------------------
       
   830 
       
   831     expectData.Close();
       
   832     mockData0.SerialiseL(expectData);
       
   833     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   834     iMockLTSY.CompleteL(EEtelCallAnswer, KErrGeneral, expectData);
       
   835     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   836 
       
   837     User::WaitForRequest(requestStatus);
       
   838     AssertMockLtsyStatusL();
       
   839     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
   840 
       
   841  	//-------------------------------------------------------------------------
       
   842 	// TEST C: Successful completion request of
       
   843 	// RCall::AnswerIncomingCall when result is not cached.
       
   844  	//-------------------------------------------------------------------------
       
   845 
       
   846     expectData.Close();
       
   847     mockData0.SerialiseL(expectData);
       
   848     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
   849     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   850     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   851 
       
   852     User::WaitForRequest(requestStatus);
       
   853     AssertMockLtsyStatusL();
       
   854     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   855 
       
   856  	//-------------------------------------------------------------------------
       
   857 	// TEST E: Unsolicited completion of RCall::AnswerIncomingCall
       
   858 	// from LTSY.
       
   859  	//-------------------------------------------------------------------------
       
   860 
       
   861 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   862 	expectData.Close();
       
   863     mockData0.SerialiseL(expectData);
       
   864 	iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   865 	User::WaitForRequest(mockLtsyStatus);
       
   866 	AssertMockLtsyStatusL();
       
   867 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   868 
       
   869 	//-------------------------------------------------------------------------
       
   870 	// TEST : to increase CMmDataCallTsy::AnswerIncomingCall coverage
       
   871 	// covers "if ( 0 < iAnswerCallHandle )" condition
       
   872  	//-------------------------------------------------------------------------
       
   873 
       
   874 	RCall call2;
       
   875 	CleanupClosePushL(call2);
       
   876     TRequestStatus requestStatus2;
       
   877 
       
   878  	//-------------------------------------------------------------------------
       
   879     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
   880     ASSERT_EQUALS(KErrNone, errorCode);
       
   881     AssertMockLtsyStatusL();
       
   882  	//-------------------------------------------------------------------------
       
   883 
       
   884     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   885 
       
   886     RMobileCall::TMobileCallParamsV1 callParamsV2;
       
   887 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV2(callParamsV2);
       
   888 	call2.AnswerIncomingCall(requestStatus2, mmParamsPckgV2);
       
   889 
       
   890 	iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
   891 	
       
   892 	User::WaitForRequest(requestStatus);
       
   893 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   894 
       
   895 	User::WaitForRequest(requestStatus2);
       
   896 	AssertMockLtsyStatusL();
       
   897 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
   898 
       
   899 	//-------------------------------------------------------------------------
       
   900 	// TEST : to increase CMmDataCallTsy::AnswerIncomingCall coverage
       
   901 	// covers "if ( iCallCaps.iFlags & RCall::KCapsAnswer || 
       
   902 	//              RCall::EStatusIdle == iCallStatus )" condition
       
   903  	//-------------------------------------------------------------------------
       
   904 
       
   905  	//-------------------------------------------------------------------------
       
   906     // call CMmDataCallTsy::CompleteNotifyStatusChange for set 
       
   907     // iCallCaps.iFlags &= ~( RCall::KCapsAnswer );
       
   908     
       
   909     mobileCallStatus = RMobileCall::EStatusIdle;
       
   910     
       
   911     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(callId, mobileService, mobileCallStatus);
       
   912     mockCallData2.SerialiseL(completeData);
       
   913 
       
   914     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   915     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
   916     User::WaitForRequest(mockLtsyStatus);
       
   917     AssertMockLtsyStatusL();
       
   918     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   919 
       
   920  	//-------------------------------------------------------------------------
       
   921     // call CMmVoiceLineTsy::CompleteNotifyIncomingCall for set iCallId = 1.
       
   922     RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
   923     TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> mockCallData1(callId, mobileService, mobileCallInfo);
       
   924     completeData.Close();
       
   925     mockCallData1.SerialiseL(completeData);
       
   926 	
       
   927     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   928     iMockLTSY.CompleteL(EEtelLineNotifyIncomingCall, KErrNone, completeData);
       
   929     User::WaitForRequest(mockLtsyStatus);
       
   930     AssertMockLtsyStatusL();
       
   931     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   932  	//-------------------------------------------------------------------------
       
   933 
       
   934     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
   935 
       
   936     User::WaitForRequest(requestStatus);
       
   937     AssertMockLtsyStatusL();
       
   938     ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
   939 
       
   940 	CleanupStack::PopAndDestroy(2); // call2, line
       
   941 	
       
   942 	CloseIncomingCallL(call, callId, mobileService);
       
   943 	CleanupStack::PopAndDestroy(3); // expectData, call, completeData
       
   944 
       
   945 	CleanupStack::PopAndDestroy(1, this);
       
   946 	}
       
   947 
       
   948 
       
   949 /**
       
   950 @SYMTestCaseID BA-CTSY-CCON-CAIC-0007
       
   951 @SYMComponent  telephony_ctsy
       
   952 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::AnswerIncomingCall for data calls
       
   953 @SYMTestPriority High
       
   954 @SYMTestActions Invokes cancelling of RCall::AnswerIncomingCall for data calls
       
   955 @SYMTestExpectedResults Pass
       
   956 @SYMTestType CT
       
   957 */
       
   958 void CCTsyCallControlFU::TestAnswerIncomingCall0007L()
       
   959 	{
       
   960 
       
   961 	OpenEtelServerL(EUseExtendedError);
       
   962 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   963 	OpenPhoneL();
       
   964 
       
   965 	RBuf8 expectData;
       
   966 	CleanupClosePushL(expectData);
       
   967 
       
   968 	RLine line;
       
   969 	RCall call;
       
   970 	CleanupClosePushL(call);
       
   971 	
       
   972 	TInt errorCode = KErrNone;
       
   973 	TInt callId = 1;
       
   974 	TName incomingCallName;
       
   975 
       
   976     TRequestStatus requestStatus;
       
   977 	TRequestStatus mockLtsyStatus;
       
   978 	
       
   979     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
   980     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
   981 	
       
   982  	//-------------------------------------------------------------------------
       
   983 	// Test cancelling of RCall::AnswerIncomingCall
       
   984  	//-------------------------------------------------------------------------
       
   985  	
       
   986 	// open new line for KMmTsyVoice1LineName
       
   987 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
   988 	ASSERT_EQUALS(KErrNone, errorCode);
       
   989 		
       
   990  	//-------------------------------------------------------------------------
       
   991 	// create new incoming call
       
   992 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
   993 	                               mobileService, mobileCallStatus);	
       
   994 	ASSERT_EQUALS(KErrNone, errorCode);
       
   995 	AssertMockLtsyStatusL();
       
   996 		
       
   997     errorCode = call.OpenExistingCall(line, incomingCallName);
       
   998     ASSERT_EQUALS(KErrNone, errorCode);
       
   999 	AssertMockLtsyStatusL();
       
  1000  	//-------------------------------------------------------------------------
       
  1001 
       
  1002 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1003     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  1004   
       
  1005     expectData.Close();
       
  1006     mockData0.SerialiseL(expectData);
       
  1007 
       
  1008     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
  1009     iMockLTSY.CompleteL(EEtelCallAnswer, KErrCancel, expectData);
       
  1010 
       
  1011 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
  1012 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
  1013     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
  1014 
       
  1015 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  1016 	TBool autoStChangeDisable = EFalse;
       
  1017     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  1018                                              hangUpCause, 
       
  1019                                              autoStChangeDisable);
       
  1020     expectData.Close();
       
  1021     mockData2.SerialiseL(expectData);
       
  1022     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  1023 
       
  1024     call.CancelAsyncRequest(EEtelCallAnswer);
       
  1025 
       
  1026     User::WaitForRequest(requestStatus);
       
  1027     AssertMockLtsyStatusL();
       
  1028     ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  1029 
       
  1030 	User::WaitForRequest(mockLtsyStatus);
       
  1031 	
       
  1032 	CleanupStack::PopAndDestroy(4); // this, expectData, call, line
       
  1033 	
       
  1034 	}
       
  1035 
       
  1036 /**
       
  1037 @SYMTestCaseID BA-CTSY-CCON-CAIC-0008
       
  1038 @SYMComponent  telephony_ctsy
       
  1039 @SYMTestCaseDesc Test support in CTSY for RCall::AnswerIncomingCall with bad parameter data for data calls
       
  1040 @SYMTestPriority High
       
  1041 @SYMTestActions Invokes RCall::AnswerIncomingCall with bad parameter data for data calls
       
  1042 @SYMTestExpectedResults Pass
       
  1043 @SYMTestType CT
       
  1044 */
       
  1045 void CCTsyCallControlFU::TestAnswerIncomingCall0008L()
       
  1046 	{
       
  1047 	OpenEtelServerL(EUseExtendedError);
       
  1048 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1049 	OpenPhoneL();
       
  1050 
       
  1051 	RBuf8 expectData;
       
  1052 	CleanupClosePushL(expectData);
       
  1053 
       
  1054 	TInt errorCode = KErrNone;
       
  1055 	TInt callId = 1;
       
  1056 	TName incomingCallName;
       
  1057 
       
  1058     TRequestStatus requestStatus;
       
  1059 	TRequestStatus mockLtsyStatus;
       
  1060 
       
  1061 	RCall call;
       
  1062 	CleanupClosePushL(call);
       
  1063 	
       
  1064 	// open new line for KMmTsyVoice1LineName
       
  1065 	RLine line;
       
  1066 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  1067 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1068 	
       
  1069     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  1070     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  1071 
       
  1072 	//-------------------------------------------------------------------------
       
  1073 	// Test B: Test passing wrong descriptor size to parameter in
       
  1074 	// RCall::Dial
       
  1075  	//-------------------------------------------------------------------------
       
  1076 		
       
  1077  	//-------------------------------------------------------------------------
       
  1078 	// create new incoming call
       
  1079 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  1080 	                               mobileService, mobileCallStatus);	
       
  1081 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1082 	AssertMockLtsyStatusL();
       
  1083 		
       
  1084     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  1085     ASSERT_EQUALS(KErrNone, errorCode);
       
  1086 	AssertMockLtsyStatusL();
       
  1087  	//-------------------------------------------------------------------------
       
  1088 
       
  1089     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  1090    
       
  1091     expectData.Close();
       
  1092     mockData0.SerialiseL(expectData);
       
  1093     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
  1094     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
  1095     
       
  1096     TPtr8 null(NULL,0);
       
  1097     call.AnswerIncomingCall(requestStatus, null);
       
  1098 
       
  1099     User::WaitForRequest(requestStatus);
       
  1100     AssertMockLtsyStatusL();
       
  1101     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1102 
       
  1103 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
  1104 	}
       
  1105 
       
  1106 
       
  1107 /**
       
  1108 @SYMTestCaseID BA-CTSY-CCON-CAIC-0009
       
  1109 @SYMComponent  telephony_ctsy
       
  1110 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::AnswerIncomingCall for data calls
       
  1111 @SYMTestPriority High
       
  1112 @SYMTestActions Invokes multiple client requests to RCall::AnswerIncomingCall for data calls
       
  1113 @SYMTestExpectedResults Pass
       
  1114 @SYMTestType CT
       
  1115 */
       
  1116 void CCTsyCallControlFU::TestAnswerIncomingCall0009L()
       
  1117 	{
       
  1118 	OpenEtelServerL(EUseExtendedError);
       
  1119 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1120 	OpenPhoneL();
       
  1121 
       
  1122 	RBuf8 expectData;
       
  1123 	CleanupClosePushL(expectData);
       
  1124 
       
  1125 	// Open second client
       
  1126 	RTelServer telServer2;
       
  1127 	TInt ret = telServer2.Connect();
       
  1128 	ASSERT_EQUALS(KErrNone, ret);
       
  1129 	CleanupClosePushL(telServer2);
       
  1130 
       
  1131 	RMobilePhone phone2;
       
  1132 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  1133 	ASSERT_EQUALS(KErrNone, ret);
       
  1134 	CleanupClosePushL(phone2);
       
  1135 
       
  1136 	RLine line1;
       
  1137 	RLine line2;
       
  1138 	
       
  1139 	RCall call1;
       
  1140 	CleanupClosePushL(call1);
       
  1141 
       
  1142 	RCall call2;
       
  1143 	CleanupClosePushL(call2);
       
  1144 	
       
  1145 	TInt errorCode = KErrNone;
       
  1146 
       
  1147 	TInt callId1 = 1;
       
  1148 	TName incomingCallName1;
       
  1149 
       
  1150 	TInt callId2 = 2;
       
  1151 	TName incomingCallName2;
       
  1152 
       
  1153 	TRequestStatus requestStatus1;
       
  1154 	TRequestStatus requestStatus2;
       
  1155 
       
  1156 	// open new line1 for KMmTsyVoice1LineName
       
  1157 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyDataLineName);
       
  1158 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1159 
       
  1160 	// open new line2 for KMmTsyVoice1LineName
       
  1161 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyDataLineName);
       
  1162 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1163 
       
  1164     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  1165     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  1166 
       
  1167 	//-------------------------------------------------------------------------
       
  1168 	// Test A: Test multiple clients requesting RCall::AnswerIncomingCall
       
  1169  	//-------------------------------------------------------------------------
       
  1170 
       
  1171  	//-------------------------------------------------------------------------
       
  1172 	// create new incoming call1
       
  1173 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
  1174 	                               mobileService, mobileCallStatus);	
       
  1175 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1176 	AssertMockLtsyStatusL();
       
  1177 		
       
  1178     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  1179     ASSERT_EQUALS(KErrNone, errorCode);
       
  1180 	AssertMockLtsyStatusL();
       
  1181  	//-------------------------------------------------------------------------
       
  1182 	
       
  1183  	//-------------------------------------------------------------------------
       
  1184 	// create new incoming call2
       
  1185 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
  1186 	                               mobileService, mobileCallStatus);	
       
  1187 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1188 	AssertMockLtsyStatusL();
       
  1189 		
       
  1190     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  1191     ASSERT_EQUALS(KErrNone, errorCode);
       
  1192 	AssertMockLtsyStatusL();
       
  1193  	//-------------------------------------------------------------------------
       
  1194 
       
  1195     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  1196   
       
  1197     expectData.Close();
       
  1198     mockData01.SerialiseL(expectData);
       
  1199     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
  1200     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
  1201 
       
  1202 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
  1203 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
  1204     call1.AnswerIncomingCall(requestStatus1, mmParamsPckgV1);
       
  1205 
       
  1206     TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  1207     expectData.Close();
       
  1208     mockData02.SerialiseL(expectData);
       
  1209     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
  1210     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
  1211 
       
  1212 	RMobileCall::TMobileCallParamsV1 callParamsV2;
       
  1213 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV2(callParamsV2);
       
  1214     call2.AnswerIncomingCall(requestStatus2, mmParamsPckgV2);
       
  1215 
       
  1216     User::WaitForRequest(requestStatus1);
       
  1217     AssertMockLtsyStatusL();
       
  1218     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  1219 
       
  1220     User::WaitForRequest(requestStatus2);
       
  1221     AssertMockLtsyStatusL();
       
  1222     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  1223 
       
  1224 	// Done !
       
  1225 	CleanupStack::PopAndDestroy(4); // line1, line2, call1, call2
       
  1226 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, expectData, this
       
  1227 	}
       
  1228 
       
  1229 
       
  1230 /**
       
  1231 @SYMTestCaseID BA-CTSY-CCON-CAIC-00010
       
  1232 @SYMComponent  telephony_ctsy
       
  1233 @SYMTestCaseDesc Test support in CTSY for RCall::AnswerIncomingCall with timeout for data calls
       
  1234 @SYMTestPriority High
       
  1235 @SYMTestActions Invokes RCall::AnswerIncomingCall and tests for timeout for data calls
       
  1236 @SYMTestExpectedResults Pass
       
  1237 @SYMTestType CT
       
  1238 */
       
  1239 void CCTsyCallControlFU::TestAnswerIncomingCall00010L()
       
  1240 	{
       
  1241 	OpenEtelServerL(EUseExtendedError);
       
  1242 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1243 	OpenPhoneL();
       
  1244 
       
  1245 	RBuf8 expectData;
       
  1246 	CleanupClosePushL(expectData);
       
  1247 
       
  1248 	RLine line;
       
  1249 	RCall call;
       
  1250 	CleanupClosePushL(call);
       
  1251 	
       
  1252 	TInt errorCode = KErrNone;
       
  1253 	TInt callId = 1;
       
  1254 	TName incomingCallName;
       
  1255 
       
  1256     TRequestStatus requestStatus;
       
  1257 	TRequestStatus mockLtsyStatus;
       
  1258 
       
  1259 	// open new line for KMmTsyVoice1LineName
       
  1260 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  1261 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1262 	
       
  1263     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  1264     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  1265 
       
  1266 	//-------------------------------------------------------------------------
       
  1267 	// Test A: Test timeout of RCall::AnswerIncomingCall
       
  1268  	//-------------------------------------------------------------------------
       
  1269 		
       
  1270  	//-------------------------------------------------------------------------
       
  1271 	// create new incoming call
       
  1272 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  1273 	                               mobileService, mobileCallStatus);	
       
  1274 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1275 	AssertMockLtsyStatusL();
       
  1276 		
       
  1277     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  1278     ASSERT_EQUALS(KErrNone, errorCode);
       
  1279 	AssertMockLtsyStatusL();
       
  1280  	//-------------------------------------------------------------------------
       
  1281 
       
  1282     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  1283  
       
  1284     expectData.Close();
       
  1285     mockData0.SerialiseL(expectData);
       
  1286     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
  1287 
       
  1288 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
  1289 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
  1290     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
  1291 
       
  1292     User::WaitForRequest(requestStatus);
       
  1293     AssertMockLtsyStatusL();
       
  1294     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  1295 
       
  1296  	//-------------------------------------------------------------------------
       
  1297 	// TEST : Call AnswerIncomingCall with null description
       
  1298  	//-------------------------------------------------------------------------
       
  1299 
       
  1300     expectData.Close();
       
  1301     mockData0.SerialiseL(expectData);
       
  1302     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);
       
  1303     iMockLTSY.CompleteL(EEtelCallAnswer, KErrNone, expectData);
       
  1304     
       
  1305     TPtr8 null(NULL,0);
       
  1306     call.AnswerIncomingCall(requestStatus, null);
       
  1307 
       
  1308     User::WaitForRequest(requestStatus);
       
  1309     AssertMockLtsyStatusL();
       
  1310     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1311 
       
  1312 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
  1313 	}
       
  1314 
       
  1315 
       
  1316 /**
       
  1317 @SYMTestCaseID BA-CTSY-CCON-CAIC-00011
       
  1318 @SYMComponent  telephony_ctsy
       
  1319 @SYMTestCaseDesc Test support in CTSY for RCall::AnswerIncomingCall for fax calls
       
  1320 @SYMTestPriority High
       
  1321 @SYMTestActions Invokes RCall::AnswerIncomingCall for fax calls
       
  1322 @SYMTestExpectedResults Pass
       
  1323 @SYMTestType CT
       
  1324 */
       
  1325 void CCTsyCallControlFU::TestAnswerIncomingCall00011L()
       
  1326 	{
       
  1327 
       
  1328 	OpenEtelServerL(EUseExtendedError);
       
  1329 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1330 	OpenPhoneL();
       
  1331 
       
  1332 	RBuf8 expectData;
       
  1333 	CleanupClosePushL(expectData);
       
  1334 
       
  1335 	RLine line;
       
  1336 	RCall call;
       
  1337 	CleanupClosePushL(call);
       
  1338 	
       
  1339 	TInt errorCode = KErrNone;
       
  1340 	TInt callId = 1;
       
  1341 	TName incomingCallName;
       
  1342 
       
  1343     TRequestStatus requestStatus;
       
  1344 	TRequestStatus mockLtsyStatus;
       
  1345 
       
  1346 	// open new line for KMmTsyFaxLineName
       
  1347 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  1348 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1349 
       
  1350     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  1351     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  1352 
       
  1353  	//-------------------------------------------------------------------------
       
  1354 	// TEST A: failure to dispatch request to LTSY
       
  1355  	//-------------------------------------------------------------------------
       
  1356 
       
  1357  	//-------------------------------------------------------------------------
       
  1358 	// create new incoming call
       
  1359 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  1360 	                               mobileService, mobileCallStatus);	
       
  1361 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1362 		
       
  1363     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  1364     ASSERT_EQUALS(KErrNone, errorCode);
       
  1365  	//-------------------------------------------------------------------------
       
  1366 
       
  1367     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  1368    
       
  1369     expectData.Close();
       
  1370     mockData0.SerialiseL(expectData);
       
  1371 
       
  1372 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
  1373 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
  1374     call.AnswerIncomingCall(requestStatus, mmParamsPckgV1);
       
  1375 
       
  1376     User::WaitForRequest(requestStatus);
       
  1377     AssertMockLtsyStatusL();
       
  1378     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  1379 
       
  1380 	AssertMockLtsyStatusL();
       
  1381 	CleanupStack::PopAndDestroy(4, this); // expectData, call, line
       
  1382 	}
       
  1383 
       
  1384 
       
  1385 /**
       
  1386 @SYMTestCaseID BA-CTSY-CCON-CD-0001
       
  1387 @SYMComponent  telephony_ctsy
       
  1388 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for voice calls
       
  1389 @SYMTestPriority High
       
  1390 @SYMTestActions Invokes RCall::Dial for voice calls
       
  1391 @SYMTestExpectedResults Pass
       
  1392 @SYMTestType CT
       
  1393 */
       
  1394 void CCTsyCallControlFU::TestDial0001L()
       
  1395 	{
       
  1396 
       
  1397 	OpenEtelServerL(EUseExtendedError);
       
  1398 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1399 	OpenPhoneL();
       
  1400 
       
  1401     RBuf8 expectData;
       
  1402     CleanupClosePushL(expectData);
       
  1403 
       
  1404     RBuf8 completeData;
       
  1405     CleanupClosePushL(completeData);
       
  1406 
       
  1407 	RLine line;
       
  1408 	RCall call;
       
  1409 	
       
  1410 	TInt errorCode = KErrNone;
       
  1411     TRequestStatus requestStatus;
       
  1412     TRequestStatus requestStatus2;
       
  1413 	TRequestStatus mockLtsyStatus;
       
  1414 	
       
  1415 	// open new line and call for KMmTsyVoice1LineName
       
  1416 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  1417 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1418 		
       
  1419     TName name;
       
  1420 	
       
  1421 	_LIT(KPhoneNumber, "101632960000");   	
       
  1422    	
       
  1423 	TInt callId = 1;
       
  1424     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1425 			
       
  1426 	RMobileCall::TMobileCallParamsV1 callParams;
       
  1427     callParams.iInterval = 4;
       
  1428     callParams.iCug.iCugIndex = 0xFFFF;
       
  1429     
       
  1430 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  1431 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  1432 	callInfo.iService = mobileService;
       
  1433 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  1434 	
       
  1435 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  1436 		mockData2(0, mobileService, callParams, callInfo);
       
  1437 
       
  1438 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  1439 
       
  1440 	RCall::TCallParams callParamsX;
       
  1441 	TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX);
       
  1442 	callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  1443 	callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  1444 	callParamsX.iInterval        = 100;
       
  1445 	callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  1446 
       
  1447  	//-------------------------------------------------------------------------
       
  1448 	// TEST A: failure to dispatch request to LTSY
       
  1449  	//-------------------------------------------------------------------------
       
  1450 
       
  1451 	// open new call
       
  1452 	CleanupClosePushL(call);
       
  1453    	errorCode = call.OpenNewCall(line, name);
       
  1454     ASSERT_EQUALS(KErrNone, errorCode);
       
  1455 
       
  1456    
       
  1457     expectData.Close();
       
  1458 	mockData2.SerialiseL(expectData);
       
  1459 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  1460 
       
  1461 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1462 	User::WaitForRequest(requestStatus);
       
  1463 	AssertMockLtsyStatusL();
       
  1464 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  1465 
       
  1466 	call.Close();
       
  1467 	AssertMockLtsyStatusL();
       
  1468 	CleanupStack::PopAndDestroy(1);
       
  1469 
       
  1470 	//-------------------------------------------------------------------------
       
  1471 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  1472  	//-------------------------------------------------------------------------
       
  1473 
       
  1474 	// open new call
       
  1475    	CleanupClosePushL(call);
       
  1476    	errorCode = call.OpenNewCall(line, name);
       
  1477     ASSERT_EQUALS(KErrNone, errorCode);
       
  1478 
       
  1479 	expectData.Close();
       
  1480 	mockData2.SerialiseL(expectData);
       
  1481 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  1482 
       
  1483 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  1484 	
       
  1485 	mockData0.SerialiseL(completeData);
       
  1486 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  1487 
       
  1488 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1489 	User::WaitForRequest(requestStatus);
       
  1490 	AssertMockLtsyStatusL();
       
  1491 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  1492 
       
  1493 	call.Close();
       
  1494 	AssertMockLtsyStatusL();
       
  1495 	CleanupStack::PopAndDestroy(1);
       
  1496 
       
  1497 	// Checking that we can return a specific error - KErrGsmCSConnectionBarred 
       
  1498    	CleanupClosePushL(call);
       
  1499    	errorCode = call.OpenNewCall(line, name);
       
  1500     ASSERT_EQUALS(KErrNone, errorCode);
       
  1501 
       
  1502 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  1503 
       
  1504 	expectData.Close();
       
  1505 	mockData2.SerialiseL(expectData);
       
  1506 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  1507 
       
  1508 	mockData0.SerialiseL(completeData);
       
  1509 	iMockLTSY.CompleteL(EEtelCallDial, KErrGsmCSConnectionBarred, completeData);
       
  1510 
       
  1511 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1512 	User::WaitForRequest(requestStatus);
       
  1513 	AssertMockLtsyStatusL();
       
  1514 	ASSERT_EQUALS(KErrGsmCSConnectionBarred, requestStatus.Int());
       
  1515 	
       
  1516 	call.Close();
       
  1517 	AssertMockLtsyStatusL();
       
  1518 	CleanupStack::PopAndDestroy(1);
       
  1519 
       
  1520 	
       
  1521  	//-------------------------------------------------------------------------
       
  1522 	// TEST C: Successful completion request of
       
  1523 	// RCall::Dial when result is not cached.
       
  1524  	//-------------------------------------------------------------------------
       
  1525 
       
  1526 	// open new call
       
  1527    	CleanupClosePushL(call);
       
  1528    	errorCode = call.OpenNewCall(line, name);
       
  1529     ASSERT_EQUALS(KErrNone, errorCode);
       
  1530 
       
  1531 	expectData.Close();
       
  1532 	mockData2.SerialiseL(expectData);
       
  1533 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  1534 	
       
  1535 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  1536 	
       
  1537 	completeData.Close();
       
  1538 	mockData0.SerialiseL(completeData);
       
  1539 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  1540 
       
  1541 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1542 	User::WaitForRequest(requestStatus);
       
  1543 	AssertMockLtsyStatusL();
       
  1544 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1545 
       
  1546 	call.Close();
       
  1547 	AssertMockLtsyStatusL();
       
  1548 	CleanupStack::PopAndDestroy(1);
       
  1549 
       
  1550  	//-------------------------------------------------------------------------
       
  1551 	// TEST E: Unsolicited completion of RCall::Dial
       
  1552 	// from LTSY.
       
  1553  	//-------------------------------------------------------------------------
       
  1554 
       
  1555 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1556 	expectData.Close();
       
  1557     mockData0.SerialiseL(expectData);
       
  1558 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, expectData);
       
  1559 	User::WaitForRequest(mockLtsyStatus);
       
  1560 	AssertMockLtsyStatusL();
       
  1561 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1562 
       
  1563 	//-------------------------------------------------------------------------
       
  1564 	// TEST : to check that RCall::Dial works fine with RMobileCall::TMobileCallParamsV1
       
  1565  	//-------------------------------------------------------------------------
       
  1566 	// open new call
       
  1567 	CleanupClosePushL(call);
       
  1568 	errorCode = call.OpenNewCall(line, name);
       
  1569 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1570 
       
  1571 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
  1572 	RMobileCall::TMobileCallParamsV1Pckg callParamsV1Pkg(callParamsV1);
       
  1573 	callParamsV1.iCug.iCugIndex = 0xFFFF;
       
  1574 	callParamsV1.iSpeakerControl  = RCall::EMonitorSpeakerControlOnExceptDuringDialling;
       
  1575 	callParamsV1.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeOff;
       
  1576 	callParamsV1.iInterval        = 100;
       
  1577 	callParamsV1.iWaitForDialTone = RCall::EDialToneNoWait;
       
  1578 	
       
  1579 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  1580 		mockDataV1(0, mobileService, callParamsV1, callInfo);
       
  1581 
       
  1582 	expectData.Close();
       
  1583 	mockDataV1.SerialiseL(expectData);
       
  1584 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  1585 		
       
  1586 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  1587 		
       
  1588 	completeData.Close();
       
  1589 	mockData0.SerialiseL(completeData);
       
  1590 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  1591 
       
  1592 	call.Dial(requestStatus, callParamsV1Pkg, KPhoneNumber);
       
  1593 	User::WaitForRequest(requestStatus);
       
  1594 	AssertMockLtsyStatusL();
       
  1595 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1596 	
       
  1597 	RMobileCall::TMobileCallParamsV1 checkParams;
       
  1598 	RMobileCall::TMobileCallParamsV1Pckg checkParamsPkg(checkParams);
       
  1599 	call.GetCallParams(checkParamsPkg);
       
  1600 	
       
  1601 	TInt compareResult = ((checkParams.iSpeakerControl !=  callParamsV1.iSpeakerControl) ||
       
  1602 			(checkParams.iSpeakerVolume != callParamsV1.iSpeakerVolume) ||
       
  1603 			(checkParams.iInterval != callParamsV1.iInterval) ||
       
  1604 			(checkParams.iWaitForDialTone != callParamsV1.iWaitForDialTone) ||
       
  1605 			(checkParams.iCug.iCugIndex != callParamsV1.iCug.iCugIndex)); 
       
  1606 	
       
  1607 	if(KErrNone != compareResult)	
       
  1608 		{
       
  1609 		ERR_PRINTF1(_L("RCall::GetCallParams did not return the same params as that used for Dial"));
       
  1610 		ASSERT_EQUALS(KErrNone, compareResult);
       
  1611 		}
       
  1612 	
       
  1613 	call.Close();
       
  1614 	AssertMockLtsyStatusL();
       
  1615 	CleanupStack::PopAndDestroy(1);
       
  1616 	
       
  1617 	//-------------------------------------------------------------------------
       
  1618 	// TEST : to check that RCall::Dial works fine with RMobileCall::TMobileCallParamsV2
       
  1619 	//-------------------------------------------------------------------------
       
  1620 	// open new call
       
  1621 	CleanupClosePushL(call);
       
  1622 	errorCode = call.OpenNewCall(line, name);
       
  1623 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1624 
       
  1625 	RMobileCall::TMobileCallParamsV2 callParamsV2;
       
  1626 	RMobileCall::TMobileCallParamsV2Pckg callParamsV2Pkg(callParamsV2);
       
  1627 	callParamsV2.iBearerMode =  RMobileCall::EMulticallNewBearer;
       
  1628 	
       
  1629 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  1630 			mockDataV2(0, mobileService, callParamsV2, callInfo);
       
  1631 
       
  1632 	expectData.Close();
       
  1633 	mockDataV2.SerialiseL(expectData);
       
  1634 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  1635 			
       
  1636 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  1637 			
       
  1638 	completeData.Close();
       
  1639 	mockData0.SerialiseL(completeData);
       
  1640 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  1641 
       
  1642 	call.Dial(requestStatus, callParamsV2Pkg, KPhoneNumber);
       
  1643 	User::WaitForRequest(requestStatus);
       
  1644 	AssertMockLtsyStatusL();
       
  1645 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1646 		
       
  1647 	RMobileCall::TMobileCallParamsV2 checkParamsV2;
       
  1648 	RMobileCall::TMobileCallParamsV2Pckg checkParamsV2Pkg(checkParamsV2);
       
  1649 	call.GetCallParams(checkParamsV2Pkg);
       
  1650 		
       
  1651 	if(KErrNone != compareResult)	
       
  1652 		{
       
  1653 		ERR_PRINTF1(_L("RCall::GetCallParams did not return the same V2 params as that used for Dial"));
       
  1654 		ASSERT_EQUALS(KErrNone, compareResult);
       
  1655 		}
       
  1656 		
       
  1657 	call.Close();
       
  1658 	AssertMockLtsyStatusL();
       
  1659 	CleanupStack::PopAndDestroy(1);
       
  1660 
       
  1661 	//-------------------------------------------------------------------------
       
  1662 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  1663 	// covers "else if ( RMobileCall::EStatusIdle != iMobileCallStatus )" condition
       
  1664  	//-------------------------------------------------------------------------
       
  1665 
       
  1666 	TName incomingCallName;
       
  1667     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  1668 
       
  1669  	//-------------------------------------------------------------------------
       
  1670 	// create new incoming call
       
  1671 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  1672 	                               mobileService, mobileCallStatus);	
       
  1673 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1674     AssertMockLtsyStatusL();
       
  1675  	//-------------------------------------------------------------------------
       
  1676 
       
  1677 	// open new call
       
  1678    	CleanupClosePushL(call);
       
  1679    	errorCode = call.OpenExistingCall(line, incomingCallName);
       
  1680     ASSERT_EQUALS(KErrNone, errorCode);
       
  1681 
       
  1682 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1683 
       
  1684 	User::WaitForRequest(requestStatus);
       
  1685 	AssertMockLtsyStatusL();
       
  1686 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  1687 
       
  1688     CloseIncomingCallL(call, callId, mobileService);
       
  1689 	CleanupStack::PopAndDestroy(1);
       
  1690 
       
  1691 	//-------------------------------------------------------------------------
       
  1692 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  1693 	// covers "else if ( ( activeCall ) && ( KETelExt3rdPartyV1 == extensionId ) &&
       
  1694 	//         ( KETelExt3rdPartyV1 != activeCall->GetExtensionId() ) )" condition
       
  1695  	//-------------------------------------------------------------------------
       
  1696 
       
  1697 	RMobileCall mobileCall;
       
  1698     mobileCallStatus = RMobileCall::EStatusConnected;
       
  1699 
       
  1700  	//-------------------------------------------------------------------------
       
  1701 	// create new incoming call
       
  1702 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  1703 	                               mobileService, mobileCallStatus);	
       
  1704 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1705     AssertMockLtsyStatusL();
       
  1706  	//-------------------------------------------------------------------------
       
  1707 
       
  1708 	// open new call
       
  1709    	CleanupClosePushL(mobileCall);
       
  1710    	errorCode = mobileCall.OpenNewCall(line, name);
       
  1711     ASSERT_EQUALS(KErrNone, errorCode);
       
  1712 
       
  1713 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParamsXX;
       
  1714 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> pckgCallParamsXX(callParamsXX);
       
  1715 	mobileCall.DialISV(requestStatus, pckgCallParamsXX, KPhoneNumber);
       
  1716 
       
  1717 	User::WaitForRequest(requestStatus);
       
  1718 	AssertMockLtsyStatusL();
       
  1719 	ASSERT_EQUALS(KErrServerBusy, requestStatus.Int());
       
  1720 
       
  1721     call.Close();
       
  1722 	AssertMockLtsyStatusL();
       
  1723     mobileCall.Close();
       
  1724 	AssertMockLtsyStatusL();
       
  1725 	CleanupStack::PopAndDestroy(1);
       
  1726 
       
  1727 	//-------------------------------------------------------------------------
       
  1728 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  1729 	// covers "else" condition in case of 
       
  1730 	// impossible of conditions "if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )",
       
  1731 	// "else if ( RMobileCall::EStatusIdle != iMobileCallStatus )",
       
  1732 	// "else if ( ( 0 < dialHandle ) || ( ( KETelExt3rdPartyV1 == extensionId )
       
  1733 	// && ( 0 < dialHandleISV ) && !i3rdPartyEmergencyNumberCheckDone  ) )",
       
  1734 	// "else if ( ( activeCall ) && ( KETelExt3rdPartyV1 == extensionId )
       
  1735 	// && ( KETelExt3rdPartyV1 != activeCall->GetExtensionId() ) )" and
       
  1736 	// "else if( extensionId == KETelExt3rdPartyV1 && 
       
  1737 	// !i3rdPartyEmergencyNumberCheckDone )".
       
  1738  	//-------------------------------------------------------------------------
       
  1739 
       
  1740 	RCall call2;
       
  1741     mobileCallStatus = RMobileCall::EStatusConnected;
       
  1742 
       
  1743  	//-------------------------------------------------------------------------
       
  1744 	// create new incoming call
       
  1745 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  1746 	                               mobileService, mobileCallStatus);	
       
  1747 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1748     AssertMockLtsyStatusL();
       
  1749  	//-------------------------------------------------------------------------
       
  1750 
       
  1751 	// open new call
       
  1752    	CleanupClosePushL(call2);
       
  1753    	errorCode = call2.OpenNewCall(line, name);
       
  1754     ASSERT_EQUALS(KErrNone, errorCode);
       
  1755 
       
  1756     expectData.Close();
       
  1757 	mockData2.SerialiseL(expectData);
       
  1758 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  1759 	call2.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1760 
       
  1761 	User::WaitForRequest(requestStatus);
       
  1762 	AssertMockLtsyStatusL();
       
  1763 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  1764 
       
  1765     call.Close();
       
  1766 	AssertMockLtsyStatusL();
       
  1767     call2.Close();
       
  1768 	AssertMockLtsyStatusL();
       
  1769 	CleanupStack::PopAndDestroy(1);
       
  1770 
       
  1771 	//-------------------------------------------------------------------------
       
  1772 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  1773 	// covers "if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )" condition
       
  1774  	//-------------------------------------------------------------------------
       
  1775 
       
  1776 	// open new call
       
  1777    	CleanupClosePushL(call);
       
  1778    	errorCode = call.OpenNewCall(line, name);
       
  1779     ASSERT_EQUALS(KErrNone, errorCode);
       
  1780 
       
  1781 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1782 	TRfStateInfo rfInfo = ERfsStateInfoInactive;
       
  1783 	TMockLtsyData1<TRfStateInfo> mockData1(rfInfo);
       
  1784 	
       
  1785     expectData.Close();
       
  1786     mockData1.SerialiseL(expectData);
       
  1787     
       
  1788 	iMockLTSY.CompleteL(EMmTsyBootGetRFStatusIPC, KErrNone, expectData);
       
  1789 	User::WaitForRequest(mockLtsyStatus);
       
  1790 	AssertMockLtsyStatusL();
       
  1791 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1792 
       
  1793 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  1794 	User::WaitForRequest(requestStatus);
       
  1795 	AssertMockLtsyStatusL();
       
  1796 	ASSERT_EQUALS(KErrGsmOfflineOpNotAllowed, requestStatus.Int());
       
  1797 
       
  1798 	call.Close();
       
  1799 	AssertMockLtsyStatusL();
       
  1800 	CleanupStack::PopAndDestroy(1);
       
  1801 
       
  1802 	AssertMockLtsyStatusL();
       
  1803 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line
       
  1804 	}
       
  1805 
       
  1806 /**
       
  1807 @SYMTestCaseID BA-CTSY-CCON-CD-0001b
       
  1808 @SYMComponent  telephony_ctsy
       
  1809 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for voice calls with minimal parameters (RCall::TCallParams)
       
  1810 @SYMTestPriority High
       
  1811 @SYMTestActions Invokes RCall::Dial for voice calls
       
  1812 @SYMTestExpectedResults Pass
       
  1813 @SYMTestType CT
       
  1814 */
       
  1815 void CCTsyCallControlFU::TestDial0001bL()
       
  1816     {
       
  1817     
       
  1818     OpenEtelServerL(EUseExtendedError);
       
  1819     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1820     OpenPhoneL();
       
  1821 
       
  1822     RBuf8 expectData;
       
  1823     CleanupClosePushL(expectData);
       
  1824 
       
  1825     RBuf8 completeData;
       
  1826     CleanupClosePushL(completeData);
       
  1827 
       
  1828     TInt errorCode = KErrNone;    
       
  1829 
       
  1830     //-- For Voice1 -------------------------
       
  1831 
       
  1832     TBuf<256> lineName(KMmTsyVoice1LineName);    
       
  1833     // Open new line
       
  1834     RLine line;
       
  1835     errorCode = line.Open(iPhone, lineName);
       
  1836     ASSERT_EQUALS(KErrNone, errorCode);
       
  1837     CleanupClosePushL(line);      
       
  1838     // open call
       
  1839     _LIT(KDoubleColon, "::");    
       
  1840     TBuf<256> name;
       
  1841     name = KMmTsyPhoneName;
       
  1842     name.Append(KDoubleColon);
       
  1843     name.Append(lineName);
       
  1844     name.Append(KDoubleColon);
       
  1845 
       
  1846     RMobileCall call;
       
  1847     errorCode = call.OpenNewCall(line, name);
       
  1848     ASSERT_EQUALS(KErrNone, errorCode);
       
  1849     CleanupClosePushL(call);   
       
  1850 
       
  1851     TRequestStatus requestStatus;    
       
  1852     _LIT(KSomeNumber, "123456789");   
       
  1853 
       
  1854     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;    
       
  1855     TInt expecteCallId = 0;
       
  1856 
       
  1857     RMobileCall::TMobileCallParamsV7 callParams; 
       
  1858     RMobileCall::TMobileCallParamsV7Pckg    pckgCallParams(callParams);
       
  1859     RMobileCall::TMobileCallInfoV8 callInfo;   
       
  1860     callParams.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  1861     callParams.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  1862     callParams.iInterval        = 100;
       
  1863     callParams.iWaitForDialTone = RCall::EDialToneWait;
       
  1864     callParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  1865     callParams.iCug.iExplicitInvoke = EFalse;
       
  1866     callParams.iCug.iCugIndex = 0xFFFF;
       
  1867     callParams.iCug.iSuppressPrefCug = EFalse;
       
  1868     callParams.iCug.iSuppressOA = EFalse;
       
  1869     callParams.iAutoRedial = EFalse;
       
  1870     callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;    
       
  1871     callInfo.iService   = mobileService;
       
  1872     callInfo.iStatus    = RMobileCall::EStatusUnknown;
       
  1873     callInfo.iCallId    =-1;
       
  1874     callInfo.iExitCode  =0; 
       
  1875     callInfo.iEmergency =0;
       
  1876     callInfo.iForwarded =0; 
       
  1877     callInfo.iPrivacy               = RMobilePhone::EPrivacyUnspecified;
       
  1878     callInfo.iAlternatingCall       = RMobilePhone::EAlternatingModeUnspecified;    
       
  1879     
       
  1880 
       
  1881     callInfo.iDialledParty.iTelNumber.Copy( KSomeNumber );
       
  1882     callInfo.iDialledParty.iNumberPlan = RMobilePhone::EUnknownNumberingPlan;
       
  1883     callInfo.iDialledParty.iTypeOfNumber = RMobilePhone::EUnknownNumber;   
       
  1884 
       
  1885     TMockLtsyCallData2< RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV8 >
       
  1886     mockCallData(expecteCallId, mobileService, callParams, callInfo);
       
  1887     mockCallData.SerialiseL(expectData);
       
  1888     
       
  1889     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  1890 
       
  1891     TInt callId = 1;
       
  1892     
       
  1893     completeData.Close();
       
  1894     TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> callInfoData(callId, mobileService, callInfo);
       
  1895     callInfoData.SerialiseL(completeData);
       
  1896     //Complete Mobile Call Info in order to set the call ID 
       
  1897     iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, completeData);
       
  1898     
       
  1899     TMockLtsyCallData0 mockDataComplete(callId, mobileService);
       
  1900     completeData.Close();
       
  1901     mockDataComplete.SerialiseL(completeData);
       
  1902     // Complete the Dial
       
  1903     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  1904 
       
  1905     RCall::TCallParams callParamsX;
       
  1906     callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  1907     callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  1908     callParamsX.iInterval        = 100;
       
  1909     callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  1910     TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX);
       
  1911         
       
  1912     call.Dial(requestStatus, pckgCallParamsX, KSomeNumber);   
       
  1913         
       
  1914     User::WaitForRequest(requestStatus);          
       
  1915     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1916     AssertMockLtsyStatusL();   
       
  1917     
       
  1918     CleanupStack::PopAndDestroy(5,this);
       
  1919     
       
  1920     }
       
  1921 
       
  1922 
       
  1923 /**
       
  1924 @SYMTestCaseID BA-CTSY-CCON-CD-0002
       
  1925 @SYMComponent  telephony_ctsy
       
  1926 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::Dial for voice calls
       
  1927 @SYMTestPriority High
       
  1928 @SYMTestActions Invokes cancelling of RCall::Dial for voice calls
       
  1929 @SYMTestExpectedResults Pass
       
  1930 @SYMTestType CT
       
  1931 */
       
  1932 void CCTsyCallControlFU::TestDial0002L()
       
  1933 	{
       
  1934 
       
  1935 	OpenEtelServerL(EUseExtendedError);
       
  1936 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1937 	OpenPhoneL();
       
  1938 
       
  1939     RBuf8 expectData;
       
  1940     CleanupClosePushL(expectData);
       
  1941 
       
  1942     RBuf8 completeData;
       
  1943     CleanupClosePushL(completeData);
       
  1944 
       
  1945 	RLine line;
       
  1946 	RCall call;
       
  1947 	
       
  1948 	TInt errorCode = KErrNone;
       
  1949     TRequestStatus requestStatus;
       
  1950     TRequestStatus mockLtsyStatus;
       
  1951 
       
  1952 	// open new line and call for KMmTsyVoice1LineName
       
  1953 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  1954 	ASSERT_EQUALS(KErrNone, errorCode);
       
  1955 
       
  1956 	TName name;
       
  1957 	   	
       
  1958 	_LIT(KPhoneNumber, "101632960000");   	
       
  1959    	
       
  1960 	TInt callId = 1;
       
  1961     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  1962 
       
  1963 	RMobileCall::TMobileCallParamsV7 callParams;
       
  1964     callParams.iInterval = 100;
       
  1965     callParams.iCug.iCugIndex = 0xFFFF;
       
  1966     callParams.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  1967     callParams.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  1968     callParams.iWaitForDialTone = RCall::EDialToneWait;
       
  1969     callParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  1970     callParams.iCug.iExplicitInvoke = EFalse;
       
  1971     callParams.iCug.iSuppressPrefCug = EFalse;
       
  1972     callParams.iCug.iSuppressOA = EFalse;
       
  1973     callParams.iAutoRedial = EFalse;
       
  1974     
       
  1975 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  1976 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  1977 	callInfo.iService = mobileService;
       
  1978 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  1979 	callInfo.iStatus    = RMobileCall::EStatusUnknown;
       
  1980 	callInfo.iCallId    =-1;
       
  1981 	callInfo.iExitCode  =0; 
       
  1982 	callInfo.iEmergency =0;
       
  1983 	callInfo.iForwarded =0; 
       
  1984 	callInfo.iPrivacy               = RMobilePhone::EPrivacyUnspecified;
       
  1985 	callInfo.iAlternatingCall       = RMobilePhone::EAlternatingModeUnspecified;    
       
  1986 
       
  1987 	
       
  1988 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
  1989 		mockData2(0, mobileService, callParams, callInfo);
       
  1990 
       
  1991 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  1992 
       
  1993 	TInt hangUpCause = KErrGsmReleaseByUser;
       
  1994 	TBool autoStChangeDisable = ETrue;
       
  1995 	TMockLtsyCallData2<TInt, TBool> mockCallData2(callId, mobileService, 
       
  1996 												  hangUpCause, 
       
  1997 												  autoStChangeDisable);
       
  1998 
       
  1999 	RCall::TCallParams callParamsX;
       
  2000 	TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX);
       
  2001 	callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  2002 	callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  2003 	callParamsX.iInterval        = 100;
       
  2004 	callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  2005 
       
  2006    //-------------------------------------------------------------------------
       
  2007     // Test cancelling of RCall::Dial
       
  2008     // before than LTSY sends any completions
       
  2009     //-------------------------------------------------------------------------
       
  2010     
       
  2011     // open new call
       
  2012     CleanupClosePushL(call);
       
  2013     errorCode = call.OpenNewCall(line, name);
       
  2014     ASSERT_EQUALS(KErrNone, errorCode);
       
  2015 
       
  2016     expectData.Close();
       
  2017     mockData2.SerialiseL(expectData);
       
  2018     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2019 
       
  2020        
       
  2021     call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  2022     call.CancelAsyncRequest(EEtelCallDial);
       
  2023     
       
  2024     CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2025     
       
  2026     RMobileCall::TMobileCallStatus  mobileCallStatus = RMobileCall::EStatusDialling; 
       
  2027     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallDataStatus(callId, mobileService, mobileCallStatus);
       
  2028     completeData.Close();
       
  2029     mockCallDataStatus.SerialiseL(completeData);
       
  2030 
       
  2031     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2032     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
  2033 
       
  2034     expectData.Close();
       
  2035     mockCallData2.SerialiseL(expectData);
       
  2036     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  2037     
       
  2038     User::WaitForRequest(mockLtsyStatus);
       
  2039 
       
  2040     // Cancelled Dial request. After this CTSY hangs up the call and it goes to idle state.
       
  2041    
       
  2042     RMobileCall::TMobileCallStatus  mobileCallStatus2 = RMobileCall::EStatusIdle; 
       
  2043     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallDataStatus2(callId, mobileService, mobileCallStatus2);
       
  2044     completeData.Close();
       
  2045     mockCallDataStatus2.SerialiseL(completeData);
       
  2046     
       
  2047     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2048     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrGsmReleaseByUser, completeData);
       
  2049         
       
  2050     User::WaitForRequest(requestStatus);
       
  2051     AssertMockLtsyStatusL();
       
  2052     ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  2053 
       
  2054     call.Close();
       
  2055     AssertMockLtsyStatusL();
       
  2056     CleanupStack::PopAndDestroy(1);
       
  2057  	//-------------------------------------------------------------------------
       
  2058 	// Test cancelling of RCall::Dial
       
  2059  	//-------------------------------------------------------------------------
       
  2060  	
       
  2061 	// open new call
       
  2062    	CleanupClosePushL(call);
       
  2063    	errorCode = call.OpenNewCall(line, name);
       
  2064     ASSERT_EQUALS(KErrNone, errorCode);
       
  2065 
       
  2066 		
       
  2067 	expectData.Close();
       
  2068 	mockData2.SerialiseL(expectData);
       
  2069 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2070 
       
  2071 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2072 	
       
  2073 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  2074 	completeData.Close();
       
  2075 	mockCallDataStatus.SerialiseL(completeData);
       
  2076 
       
  2077 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2078 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
  2079 
       
  2080 	User::WaitForRequest(mockLtsyStatus);
       
  2081 
       
  2082     expectData.Close();
       
  2083     mockCallData2.SerialiseL(expectData);
       
  2084     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  2085 
       
  2086     // Cancelled Dial request. After this CTSY hangs up the call and it goes to idle state.
       
  2087     call.CancelAsyncRequest(EEtelCallDial);
       
  2088 	completeData.Close();
       
  2089 	mockCallDataStatus2.SerialiseL(completeData);
       
  2090 	
       
  2091 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2092 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrGsmReleaseByUser, completeData);
       
  2093 		
       
  2094     User::WaitForRequest(requestStatus);
       
  2095     AssertMockLtsyStatusL();
       
  2096     ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  2097 
       
  2098 	call.Close();
       
  2099 	AssertMockLtsyStatusL();
       
  2100 	CleanupStack::PopAndDestroy(1);
       
  2101 	CleanupStack::PopAndDestroy(4); // expectData, completeData, this, this
       
  2102 	
       
  2103 	}
       
  2104 
       
  2105 
       
  2106 /**
       
  2107 @SYMTestCaseID BA-CTSY-CCON-CD-0003
       
  2108 @SYMComponent  telephony_ctsy
       
  2109 @SYMTestCaseDesc Test support in CTSY for RCall::Dial with bad parameter data for voice calls
       
  2110 @SYMTestPriority High
       
  2111 @SYMTestActions Invokes RCall::Dial with bad parameter data for voice calls
       
  2112 @SYMTestExpectedResults Pass
       
  2113 @SYMTestType CT
       
  2114 */
       
  2115 void CCTsyCallControlFU::TestDial0003L()
       
  2116 	{
       
  2117 
       
  2118 	OpenEtelServerL(EUseExtendedError);
       
  2119 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2120 	OpenPhoneL();
       
  2121 
       
  2122     RBuf8 expectData;
       
  2123     CleanupClosePushL(expectData);
       
  2124 
       
  2125     RBuf8 completeData;
       
  2126     CleanupClosePushL(completeData);
       
  2127 
       
  2128 	RLine line;
       
  2129 	RCall call;
       
  2130 	
       
  2131 	TInt errorCode = KErrNone;
       
  2132     TRequestStatus requestStatus;
       
  2133     TRequestStatus mockLtsyStatus;
       
  2134 
       
  2135 	// open new line and call for KMmTsyVoice1LineName
       
  2136 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  2137 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2138 		
       
  2139     TName name;
       
  2140 	   	
       
  2141 	_LIT(KPhoneNumber, "101632960000");   	
       
  2142    	
       
  2143 	TInt callId = 1;
       
  2144     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2145 
       
  2146 	RMobileCall::TMobileCallParamsV1 callParams;
       
  2147     callParams.iInterval = 4;
       
  2148     callParams.iCug.iCugIndex = 0xFFFF;
       
  2149     
       
  2150 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  2151 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  2152 	callInfo.iService = mobileService;
       
  2153 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  2154 	
       
  2155 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  2156 		mockData2(0, mobileService, callParams, callInfo);
       
  2157 
       
  2158 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  2159 
       
  2160 	//-------------------------------------------------------------------------
       
  2161 	// Test A: Test passing wrong version of parameters to
       
  2162 	// RCall::Dial
       
  2163  	//-------------------------------------------------------------------------
       
  2164 
       
  2165 	// open new call
       
  2166    	CleanupClosePushL(call);
       
  2167    	errorCode = call.OpenNewCall(line, name);
       
  2168     ASSERT_EQUALS(KErrNone, errorCode);
       
  2169 
       
  2170    	RMobileCall::TEtel3rdPartyMobileCallParamsV1 paramsV1;
       
  2171    	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> pckgParamsV1(paramsV1);
       
  2172 
       
  2173    	call.Dial(requestStatus, pckgParamsV1, KPhoneNumber);
       
  2174 
       
  2175     User::WaitForRequest(requestStatus);
       
  2176     ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  2177 
       
  2178 	call.Close();
       
  2179 	CleanupStack::PopAndDestroy(&call);
       
  2180 
       
  2181 	//-------------------------------------------------------------------------
       
  2182 	// Test B: Test passing wrong descriptor size to parameter in
       
  2183 	// RCall::Dial
       
  2184  	//-------------------------------------------------------------------------
       
  2185 
       
  2186 	// open new call
       
  2187    	CleanupClosePushL(call);
       
  2188    	errorCode = call.OpenNewCall(line, name);
       
  2189     ASSERT_EQUALS(KErrNone, errorCode);
       
  2190 
       
  2191 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2192 
       
  2193     _LIT8(KTempDesC8,"A");
       
  2194 	TBuf8<1> tempDes(KTempDesC8);
       
  2195    	
       
  2196    	call.Dial(requestStatus, tempDes, KPhoneNumber);
       
  2197 
       
  2198     User::WaitForRequest(requestStatus);
       
  2199     ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  2200 
       
  2201 	call.Close();
       
  2202 	CleanupStack::PopAndDestroy(&call);
       
  2203 
       
  2204 	//-------------------------------------------------------------------------
       
  2205 	// Test C: Test passing empty descriptor size to parameter in
       
  2206 	// RCall::Dial
       
  2207  	//-------------------------------------------------------------------------
       
  2208 
       
  2209 	// open new call
       
  2210    	CleanupClosePushL(call);
       
  2211    	errorCode = call.OpenNewCall(line, name);
       
  2212     ASSERT_EQUALS(KErrNone, errorCode);
       
  2213 
       
  2214 	expectData.Close();
       
  2215 	mockData2.SerialiseL(expectData);
       
  2216 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2217 	
       
  2218 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2219 	
       
  2220 	completeData.Close();
       
  2221 	mockData0.SerialiseL(completeData);
       
  2222 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  2223 
       
  2224 	TBuf8<1> nullDes(KNullDesC8);
       
  2225 
       
  2226     // If aCallParams is empty it is handled as there are no call parameters
       
  2227     // and CTSY uses default values
       
  2228    	call.Dial(requestStatus, nullDes, KPhoneNumber);
       
  2229 
       
  2230     User::WaitForRequest(requestStatus);
       
  2231     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2232 
       
  2233 	call.Close();
       
  2234     AssertMockLtsyStatusL();
       
  2235 	CleanupStack::PopAndDestroy(&call);
       
  2236 	CleanupStack::PopAndDestroy(4); // completeData, expectData, line, this
       
  2237 
       
  2238 	}
       
  2239 
       
  2240 
       
  2241 /**
       
  2242 @SYMTestCaseID BA-CTSY-CCON-CD-0004
       
  2243 @SYMComponent  telephony_ctsy
       
  2244 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::Dial for voice calls
       
  2245 @SYMTestPriority High
       
  2246 @SYMTestActions Invokes multiple client requests to RCall::Dial for voice calls
       
  2247 @SYMTestExpectedResults Pass
       
  2248 @SYMTestType CT
       
  2249 */
       
  2250 void CCTsyCallControlFU::TestDial0004L()
       
  2251 	{
       
  2252 	OpenEtelServerL(EUseExtendedError);
       
  2253 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2254 	OpenPhoneL();
       
  2255 
       
  2256     RBuf8 expectData;
       
  2257     CleanupClosePushL(expectData);
       
  2258 
       
  2259     RBuf8 completeData;
       
  2260     CleanupClosePushL(completeData);
       
  2261 
       
  2262 	// Open second client
       
  2263 	RTelServer telServer2;
       
  2264 	TInt ret = telServer2.Connect();
       
  2265 	ASSERT_EQUALS(KErrNone, ret);
       
  2266 	CleanupClosePushL(telServer2);
       
  2267 
       
  2268 	RMobilePhone phone2;
       
  2269 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  2270 	ASSERT_EQUALS(KErrNone, ret);
       
  2271 	CleanupClosePushL(phone2);
       
  2272 
       
  2273 	RLine line1;
       
  2274 	RLine line2;
       
  2275 	
       
  2276 	RCall call1;
       
  2277 	RCall call2;
       
  2278 	
       
  2279 	TInt errorCode = KErrNone;
       
  2280     TRequestStatus requestStatus1;
       
  2281     TRequestStatus requestStatus2;
       
  2282 
       
  2283 	// open new line1 and call for KMmTsyVoice1LineName
       
  2284 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
  2285 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2286 
       
  2287 	// open new line2 and call for KMmTsyVoice1LineName
       
  2288 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
  2289 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2290 		
       
  2291 	TName name;
       
  2292 
       
  2293 	_LIT(KPhoneNumber1, "101632960000");   	
       
  2294 	_LIT(KPhoneNumber2, "654654864531");   	
       
  2295    	
       
  2296 	TInt callId1 = 1;
       
  2297 	TInt callId2 = 2;
       
  2298     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2299 
       
  2300 	RMobileCall::TMobileCallParamsV7 callParams1;
       
  2301 	callParams1.iInterval = 100;
       
  2302 	callParams1.iCug.iCugIndex = 0xFFFF;
       
  2303 	callParams1.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  2304 	callParams1.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  2305 	callParams1.iWaitForDialTone = RCall::EDialToneWait;
       
  2306 	callParams1.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  2307 	callParams1.iCug.iExplicitInvoke = EFalse;
       
  2308 	callParams1.iCug.iSuppressPrefCug = EFalse;
       
  2309 	callParams1.iCug.iSuppressOA = EFalse;
       
  2310 	callParams1.iAutoRedial = EFalse;
       
  2311 	
       
  2312 	RMobileCall::TMobileCallParamsV7 callParams2;
       
  2313 	callParams2.iInterval = 200;
       
  2314 	callParams2.iCug.iCugIndex = 0xFFFF;
       
  2315 	callParams2.iSpeakerControl  = RCall::EMonitorSpeakerControlAlwaysOn;
       
  2316 	callParams2.iSpeakerVolume   =RCall::EMonitorSpeakerVolumeMedium;
       
  2317 	callParams2.iWaitForDialTone = RCall::EDialToneWait;
       
  2318 	callParams2.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  2319 	callParams2.iCug.iExplicitInvoke = EFalse;
       
  2320 	callParams2.iCug.iSuppressPrefCug = EFalse;
       
  2321 	callParams2.iCug.iSuppressOA = EFalse;
       
  2322 	callParams2.iAutoRedial = EFalse;
       
  2323     
       
  2324     
       
  2325     
       
  2326 	RMobileCall::TMobileCallInfoV8 callInfo1;
       
  2327 	callInfo1.iDialledParty.iTelNumber.Copy(KPhoneNumber1);
       
  2328 	callInfo1.iService = mobileService;
       
  2329 	callInfo1.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  2330 	callInfo1.iStatus    = RMobileCall::EStatusUnknown;
       
  2331 	callInfo1.iCallId    =-1;
       
  2332 	callInfo1.iExitCode  =0; 
       
  2333 	callInfo1.iEmergency =0;
       
  2334 	callInfo1.iForwarded =0; 
       
  2335 	callInfo1.iPrivacy               = RMobilePhone::EPrivacyUnspecified;
       
  2336 	callInfo1.iAlternatingCall       = RMobilePhone::EAlternatingModeUnspecified;    
       
  2337 
       
  2338 
       
  2339 	RMobileCall::TMobileCallInfoV8 callInfo2;
       
  2340 	callInfo2.iDialledParty.iTelNumber.Copy(KPhoneNumber2);
       
  2341 	callInfo2.iService = mobileService;
       
  2342 	callInfo2.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  2343 	callInfo2.iStatus    = RMobileCall::EStatusUnknown;
       
  2344 	callInfo2.iCallId    =-1;
       
  2345 	callInfo2.iExitCode  =0; 
       
  2346 	callInfo2.iEmergency =0;
       
  2347 	callInfo2.iForwarded =0; 
       
  2348 	callInfo2.iPrivacy               = RMobilePhone::EPrivacyUnspecified;
       
  2349 	callInfo2.iAlternatingCall       = RMobilePhone::EAlternatingModeUnspecified;    
       
  2350 
       
  2351 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
  2352 		mockData21(0, mobileService, callParams1, callInfo1);
       
  2353 
       
  2354 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
  2355 		mockData22(0, mobileService, callParams2, callInfo2);
       
  2356 
       
  2357 	TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  2358 	TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  2359 
       
  2360 	RCall::TCallParams callParamsX1;
       
  2361 	TPckg<RCall::TCallParams> pckgCallParamsX1(callParamsX1);
       
  2362 	callParamsX1.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  2363 	callParamsX1.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  2364 	callParamsX1.iInterval        = 100;
       
  2365 	callParamsX1.iWaitForDialTone = RCall::EDialToneWait;
       
  2366 
       
  2367 	RCall::TCallParams callParamsX2;
       
  2368 	TPckg<RCall::TCallParams> pckgCallParamsX2(callParamsX2);
       
  2369 	callParamsX2.iSpeakerControl  = RCall::EMonitorSpeakerControlAlwaysOn;
       
  2370 	callParamsX2.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeMedium;
       
  2371 	callParamsX2.iInterval        = 200;
       
  2372 	callParamsX2.iWaitForDialTone = RCall::EDialToneNoWait;
       
  2373 
       
  2374 	//-------------------------------------------------------------------------
       
  2375 	// Test A: Test multiple clients requesting RCall::Dial
       
  2376  	//-------------------------------------------------------------------------
       
  2377 
       
  2378 	// call first clinet
       
  2379 	// open new call1
       
  2380    	CleanupClosePushL(call1);
       
  2381    	errorCode = call1.OpenNewCall(line1, name);
       
  2382     ASSERT_EQUALS(KErrNone, errorCode);
       
  2383 
       
  2384 	expectData.Close();
       
  2385 	mockData21.SerialiseL(expectData);
       
  2386     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2387 
       
  2388     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  2389     call1.Dial(requestStatus1, pckgCallParamsX1, KPhoneNumber1);
       
  2390     User::After(1000);
       
  2391     
       
  2392     mockData01.SerialiseL(completeData);
       
  2393     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  2394    	
       
  2395    	// call second clinet
       
  2396 	// open new call
       
  2397    	CleanupClosePushL(call2);
       
  2398    	errorCode = call2.OpenNewCall(line2, name);
       
  2399     ASSERT_EQUALS(KErrNone, errorCode);
       
  2400 
       
  2401    	call2.Dial(requestStatus2, pckgCallParamsX2, KPhoneNumber2);
       
  2402 
       
  2403     User::WaitForRequest(requestStatus1);
       
  2404     AssertMockLtsyStatusL();
       
  2405     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  2406 
       
  2407     User::WaitForRequest(requestStatus2);
       
  2408     AssertMockLtsyStatusL();
       
  2409     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  2410 
       
  2411 	call1.Close();
       
  2412 	AssertMockLtsyStatusL();
       
  2413 	CleanupStack::PopAndDestroy(1);
       
  2414 
       
  2415 	call2.Close();
       
  2416 	AssertMockLtsyStatusL();
       
  2417 	CleanupStack::PopAndDestroy(1);
       
  2418 
       
  2419 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, expectData, completeData, this
       
  2420 	                                      // line1, line2
       
  2421 	}
       
  2422 
       
  2423 
       
  2424 /**
       
  2425 @SYMTestCaseID BA-CTSY-CCON-CD-0005
       
  2426 @SYMComponent  telephony_ctsy
       
  2427 @SYMTestCaseDesc Test support in CTSY for RCall::Dial with timeout for voice calls
       
  2428 @SYMTestPriority High
       
  2429 @SYMTestActions Invokes RCall::Dial and tests for timeout for voice calls
       
  2430 @SYMTestExpectedResults Pass
       
  2431 @SYMTestType CT
       
  2432 */
       
  2433 void CCTsyCallControlFU::TestDial0005L()
       
  2434 	{
       
  2435 	OpenEtelServerL(EUseExtendedError);
       
  2436 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2437 	OpenPhoneL();
       
  2438 
       
  2439     RBuf8 expectData;
       
  2440     CleanupClosePushL(expectData);
       
  2441 
       
  2442     RBuf8 completeData;
       
  2443     CleanupClosePushL(completeData);
       
  2444 
       
  2445 	RLine line;
       
  2446 	RCall call;
       
  2447 	
       
  2448 	TInt errorCode = KErrNone;
       
  2449     TRequestStatus requestStatus;
       
  2450 
       
  2451 	// open new line and call for KMmTsyVoice1LineName
       
  2452 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  2453 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2454 
       
  2455 	
       
  2456 	TName name;
       
  2457 
       
  2458 	_LIT(KPhoneNumber, "101632960000");   	
       
  2459    	
       
  2460 	TInt callId = 1;
       
  2461     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2462 
       
  2463 	RMobileCall::TMobileCallParamsV1 callParams;
       
  2464     callParams.iInterval = 4;
       
  2465     callParams.iCug.iCugIndex = 0xFFFF;
       
  2466     
       
  2467 	RMobileCall::TMobileCallInfoV1 callInfo;
       
  2468 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  2469 	callInfo.iService = mobileService;
       
  2470 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  2471 	
       
  2472 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
  2473 		mockData2(0, mobileService, callParams, callInfo);
       
  2474 
       
  2475 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  2476 
       
  2477 	RCall::TCallParams callParamsX;
       
  2478 	TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX);
       
  2479 	callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  2480 	callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  2481 	callParamsX.iInterval        = 100;
       
  2482 	callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  2483 
       
  2484 	//-------------------------------------------------------------------------
       
  2485 	// Test A: Test timeout of RCall::Dial
       
  2486  	//-------------------------------------------------------------------------
       
  2487  	
       
  2488 	// open new call
       
  2489    	CleanupClosePushL(call);
       
  2490    	errorCode = call.OpenNewCall(line, name);
       
  2491     ASSERT_EQUALS(KErrNone, errorCode);
       
  2492 
       
  2493 	expectData.Close();
       
  2494 	mockData2.SerialiseL(expectData);
       
  2495     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2496 
       
  2497     CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2498     
       
  2499    	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  2500 
       
  2501     User::WaitForRequest(requestStatus);
       
  2502     AssertMockLtsyStatusL();
       
  2503     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  2504 
       
  2505 	call.Close();
       
  2506 	AssertMockLtsyStatusL();
       
  2507 	CleanupStack::PopAndDestroy(1);
       
  2508 	CleanupStack::PopAndDestroy(4); // expectData, completeData, this, this
       
  2509 	}
       
  2510 
       
  2511 /**
       
  2512 @SYMTestCaseID BA-CTSY-CCON-CD-0006
       
  2513 @SYMDEF DEF127552
       
  2514 @SYMREQ	7745
       
  2515 @SYMComponent  telephony_ctsy
       
  2516 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls
       
  2517 @SYMTestPriority High
       
  2518 @SYMTestActions Invokes RCall::Dial for data calls
       
  2519 @SYMTestExpectedResults Pass
       
  2520 @SYMTestType CT
       
  2521 
       
  2522 N.B. As the test case BA-CTSY-CCON-CD-0006 has a very long running time, it is split into sub-test cases.
       
  2523 The rationale for that is as following: When the call duration of a test case exceeds 10sec, CTYS sends
       
  2524 a life time update to LTSY. If a test case duration is at the border of ~10sec, the life time update
       
  2525 notification is completed depending on the speed of working environment. It varies machine to machine 
       
  2526 or board to board. Therefore, BA-CTSY-CCON-CD-0006 is divided into smaller parts where each part takes
       
  2527 far less than 10sec.
       
  2528 */
       
  2529 void CCTsyCallControlFU::TestDial0006L()
       
  2530 	{
       
  2531 	OpenEtelServerL(EUseExtendedError);
       
  2532 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2533 	OpenPhoneL();
       
  2534 
       
  2535     RBuf8 expectData;
       
  2536     CleanupClosePushL(expectData);
       
  2537 
       
  2538     RBuf8 completeData;
       
  2539     CleanupClosePushL(completeData);
       
  2540 
       
  2541 	RLine line;
       
  2542 	RCall call;
       
  2543 	
       
  2544 	TInt errorCode = KErrNone;
       
  2545     TRequestStatus requestStatus;
       
  2546 	TRequestStatus mockLtsyStatus;
       
  2547 	
       
  2548 	// open new line and call for KMmTsyDataLineName
       
  2549 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  2550 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2551 
       
  2552 	TName name;
       
  2553 
       
  2554 	_LIT(KPhoneNumber, "101632960000");   	
       
  2555    	
       
  2556 	TInt callId = 1;
       
  2557     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  2558 			
       
  2559 	RMobileCall::TMobileDataCallParamsV1 callParams;
       
  2560     callParams.iInterval = 4;
       
  2561     callParams.iCug.iCugIndex = 0xFFFF;
       
  2562     callParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  2563     callParams.iCug.iExplicitInvoke = EFalse;
       
  2564     callParams.iCug.iSuppressPrefCug = EFalse;
       
  2565     callParams.iCug.iSuppressOA = EFalse;
       
  2566     callParams.iAutoRedial = EFalse;
       
  2567     
       
  2568 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  2569 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  2570 	callInfo.iService = mobileService;
       
  2571 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  2572 	
       
  2573 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  2574 		mockData2(0, mobileService, callParams, callInfo);
       
  2575 
       
  2576 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  2577 
       
  2578 	TPckg<RMobileCall::TMobileDataCallParamsV1> pckgMockParams1(callParams);
       
  2579 	
       
  2580 	RCall::TCallParams callParamsX;
       
  2581 	
       
  2582 	callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  2583 	callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  2584 	callParamsX.iInterval        = 100;
       
  2585 	callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  2586 
       
  2587 
       
  2588  	//-------------------------------------------------------------------------
       
  2589 	// TEST A: failure to dispatch request to LTSY
       
  2590  	//-------------------------------------------------------------------------
       
  2591 
       
  2592 	// open new call
       
  2593 	CleanupClosePushL(call);
       
  2594    	errorCode = call.OpenNewCall(line, name);
       
  2595     ASSERT_EQUALS(KErrNone, errorCode);
       
  2596 
       
  2597     expectData.Close();
       
  2598 	mockData2.SerialiseL(expectData);
       
  2599 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  2600 
       
  2601 	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  2602 	User::WaitForRequest(requestStatus);
       
  2603 	AssertMockLtsyStatusL();
       
  2604 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2605 
       
  2606 	call.Close();
       
  2607 	AssertMockLtsyStatusL();
       
  2608 	CleanupStack::PopAndDestroy(1);
       
  2609 
       
  2610 	//-------------------------------------------------------------------------
       
  2611 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  2612  	//-------------------------------------------------------------------------
       
  2613 
       
  2614 	// open new call
       
  2615    	CleanupClosePushL(call);
       
  2616    	errorCode = call.OpenNewCall(line, name);
       
  2617     ASSERT_EQUALS(KErrNone, errorCode);
       
  2618 
       
  2619     expectData.Close();
       
  2620 	mockData2.SerialiseL(expectData);
       
  2621 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2622 
       
  2623 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2624 	
       
  2625 	mockData0.SerialiseL(completeData);
       
  2626 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  2627 
       
  2628 	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  2629 	User::WaitForRequest(requestStatus);
       
  2630 	AssertMockLtsyStatusL();
       
  2631 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  2632 	
       
  2633 	call.Close();
       
  2634 	AssertMockLtsyStatusL();
       
  2635 	CleanupStack::PopAndDestroy(1);
       
  2636 	
       
  2637  	//-------------------------------------------------------------------------
       
  2638 	// TEST C: Successful completion request of
       
  2639 	// RCall::Dial when result is not cached.
       
  2640  	//-------------------------------------------------------------------------
       
  2641 
       
  2642 	// open new call
       
  2643    	CleanupClosePushL(call);
       
  2644    	errorCode = call.OpenNewCall(line, name);
       
  2645     ASSERT_EQUALS(KErrNone, errorCode);
       
  2646 
       
  2647     expectData.Close();
       
  2648 	mockData2.SerialiseL(expectData);
       
  2649 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2650 	
       
  2651 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2652 
       
  2653 	completeData.Close();
       
  2654 	mockData0.SerialiseL(completeData);
       
  2655 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  2656 
       
  2657     // we are dialing the call:
       
  2658     call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  2659 		
       
  2660     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  2661     
       
  2662 	// completion of the Dial() request:
       
  2663     User::WaitForRequest(requestStatus);
       
  2664     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2665       
       
  2666     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  2667     
       
  2668   	call.Close();
       
  2669 	CleanupStack::PopAndDestroy(1);
       
  2670 
       
  2671 	//-------------------------------------------------------------------------
       
  2672 	// TEST D (Reloaded): Successful completion request of
       
  2673 	// RCall::Dial with TCallParams when result is not cached.
       
  2674  	//-------------------------------------------------------------------------
       
  2675 
       
  2676 	// open new call
       
  2677    	CleanupClosePushL(call);
       
  2678    	errorCode = call.OpenNewCall(line, name);
       
  2679     ASSERT_EQUALS(KErrNone, errorCode);
       
  2680 
       
  2681     RMobileCall::TMobileDataCallParamsV8 callParamsDefault;
       
  2682     callParamsDefault.iInterval = 4;
       
  2683     callParamsDefault.iCug.iCugIndex = 0xFFFF;
       
  2684     callParamsDefault.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  2685     callParamsDefault.iCug.iExplicitInvoke = EFalse;
       
  2686     callParamsDefault.iCug.iSuppressPrefCug = EFalse;
       
  2687     callParamsDefault.iCug.iSuppressOA = EFalse;
       
  2688     callParamsDefault.iAutoRedial = EFalse;
       
  2689        
       
  2690     TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  2691     mockData3(0, mobileService, callParamsDefault, callInfo);
       
  2692     
       
  2693     expectData.Close();
       
  2694 	mockData3.SerialiseL(expectData);
       
  2695 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2696 	
       
  2697 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2698 
       
  2699 	completeData.Close();
       
  2700 	mockData0.SerialiseL(completeData);
       
  2701 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  2702 
       
  2703 	TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX); // passing TCallParams
       
  2704 	
       
  2705     // we are dialing the call:
       
  2706     call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  2707 		
       
  2708     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  2709     
       
  2710 	// completion of the Dial() request:
       
  2711     User::WaitForRequest(requestStatus);
       
  2712     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2713       
       
  2714     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  2715     
       
  2716   	call.Close();
       
  2717 	CleanupStack::PopAndDestroy(1);
       
  2718 	
       
  2719 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  2720 	}
       
  2721 
       
  2722 /**
       
  2723 @SYMTestCaseID BA-CTSY-CCON-CD-0006b
       
  2724 @SYMDEF DEF127552
       
  2725 @SYMREQ	7745
       
  2726 @SYMComponent  telephony_ctsy
       
  2727 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls. It is in connection to BA-CTSY-CCON-CD-0006.
       
  2728 @SYMTestPriority High
       
  2729 @SYMTestActions Invokes RCall::Dial for data calls
       
  2730 @SYMTestExpectedResults Pass
       
  2731 @SYMTestType CT
       
  2732 */
       
  2733 void CCTsyCallControlFU::TestDial0006bL()
       
  2734 	{
       
  2735 	OpenEtelServerL(EUseExtendedError);
       
  2736 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2737 	OpenPhoneL();
       
  2738 
       
  2739     RBuf8 expectData;
       
  2740     CleanupClosePushL(expectData);
       
  2741 
       
  2742     RBuf8 completeData;
       
  2743     CleanupClosePushL(completeData);
       
  2744 
       
  2745 	RLine line;
       
  2746 	RCall call;
       
  2747 	
       
  2748 	TInt errorCode = KErrNone;
       
  2749     TRequestStatus requestStatus;
       
  2750 	TRequestStatus mockLtsyStatus;
       
  2751 	
       
  2752 	// open new line and call for KMmTsyDataLineName
       
  2753 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  2754 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2755 
       
  2756 	TName name;
       
  2757 
       
  2758 	_LIT(KPhoneNumber, "101632960000");   	
       
  2759    	
       
  2760 	TInt callId = 1;
       
  2761     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  2762 			
       
  2763 	RMobileCall::TMobileDataCallParamsV1 callParams;
       
  2764     callParams.iInterval = 4;
       
  2765     callParams.iCug.iCugIndex = 0xFFFF;
       
  2766     
       
  2767 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  2768 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  2769 	callInfo.iService = mobileService;
       
  2770 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  2771 	
       
  2772 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  2773 		mockData2(0, mobileService, callParams, callInfo);
       
  2774 
       
  2775 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  2776 	TPckg<RMobileCall::TMobileDataCallParamsV1> pckgMockParams1(callParams);
       
  2777 	
       
  2778 	//-------------------------------------------------------------------------
       
  2779 	// TEST E: Unsolicited completion of RCall::Dial
       
  2780 	// from LTSY.
       
  2781  	//-------------------------------------------------------------------------
       
  2782 
       
  2783 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2784     expectData.Close();
       
  2785     mockData0.SerialiseL(expectData);
       
  2786 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, expectData);
       
  2787 	User::WaitForRequest(mockLtsyStatus);
       
  2788 	AssertMockLtsyStatusL();
       
  2789 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2790 
       
  2791 	//-------------------------------------------------------------------------
       
  2792 	// TEST : to increase CMmDataCallTsy::Dial coverage
       
  2793 	// covers "else if ( RMobileCall::EStatusIdle != iMobileCallStatus )" condition
       
  2794  	//-------------------------------------------------------------------------
       
  2795 
       
  2796 	TName incomingCallName;
       
  2797 	RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  2798 
       
  2799  	//-------------------------------------------------------------------------
       
  2800 	// create new incoming call
       
  2801 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  2802 	                               mobileService, mobileCallStatus);	
       
  2803 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2804 	
       
  2805 	//-------------------------------------------------------------------------
       
  2806 
       
  2807  	//-------------------------------------------------------------------------
       
  2808 	// open new call
       
  2809    	CleanupClosePushL(call);
       
  2810    	errorCode = call.OpenExistingCall(line, incomingCallName);
       
  2811     ASSERT_EQUALS(KErrNone, errorCode);
       
  2812  	//-------------------------------------------------------------------------
       
  2813 
       
  2814 	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  2815 
       
  2816 	User::WaitForRequest(requestStatus);
       
  2817 	AssertMockLtsyStatusL();
       
  2818 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  2819 
       
  2820  	//-------------------------------------------------------------------------
       
  2821 	// close incoming call
       
  2822 	TInt hangUpCause = KErrGsmReleaseByUser;
       
  2823 	TBool autoStChangeDisable = EFalse;
       
  2824 	RMobilePhone::TMobileService mobileServiceX = RMobilePhone::ECircuitDataService;
       
  2825     TMockLtsyCallData2<TInt, TBool> mockData2x(callId, mobileServiceX, 
       
  2826                                              hangUpCause, 
       
  2827                                              autoStChangeDisable);
       
  2828     expectData.Close();
       
  2829     mockData2x.SerialiseL(expectData);
       
  2830     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  2831     
       
  2832 	call.Close();
       
  2833 	AssertMockLtsyStatusL();
       
  2834 	CleanupStack::PopAndDestroy(1);
       
  2835 
       
  2836 	//-------------------------------------------------------------------------
       
  2837 	// TEST : to increase CMmDataCallTsy::Dial coverage
       
  2838 	// covers "else" condition in case of impossible of conditions
       
  2839 	// "if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )",
       
  2840 	// "else if ( RMobileCall::EStatusIdle != iMobileCallStatus )" and
       
  2841 	// "else if ( 0 < dialHandle )"
       
  2842  	//-------------------------------------------------------------------------
       
  2843 
       
  2844 	mobileCallStatus = RMobileCall::EStatusDisconnectingWithInband;
       
  2845     TInt callId3 = 3;
       
  2846     TName incomingCallName3;
       
  2847     
       
  2848  	//-------------------------------------------------------------------------
       
  2849 	// create new incoming call
       
  2850 	errorCode = CreateIncomingCallL(line, callId3, incomingCallName3, 
       
  2851 	                               mobileService, mobileCallStatus);	
       
  2852 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2853     AssertMockLtsyStatusL();
       
  2854  	//-------------------------------------------------------------------------
       
  2855 
       
  2856     mobileCallStatus = RMobileCall::EStatusDisconnecting;
       
  2857     TInt callId2 = 2;
       
  2858     TName incomingCallName2;
       
  2859     
       
  2860  	//-------------------------------------------------------------------------
       
  2861 	// create new incoming call
       
  2862 	errorCode = CreateIncomingCallL(line, callId2, incomingCallName2, 
       
  2863 	                               mobileService, mobileCallStatus);	
       
  2864 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2865     AssertMockLtsyStatusL();
       
  2866  	//-------------------------------------------------------------------------
       
  2867 
       
  2868     mobileCallStatus = RMobileCall::EStatusRinging;
       
  2869     //-------------------------------------------------------------------------
       
  2870 	// create new incoming call
       
  2871 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  2872 	                               mobileService, mobileCallStatus);	
       
  2873 	ASSERT_EQUALS(KErrNone, errorCode);
       
  2874     AssertMockLtsyStatusL();
       
  2875  	//-------------------------------------------------------------------------
       
  2876    
       
  2877   	// open new call
       
  2878  	CleanupClosePushL(call);
       
  2879    	errorCode = call.OpenNewCall(line, name);
       
  2880     ASSERT_EQUALS(KErrNone, errorCode);
       
  2881     
       
  2882 	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  2883 
       
  2884 	User::WaitForRequest(requestStatus);
       
  2885 	ASSERT_EQUALS(KErrEtelCallAlreadyActive, requestStatus.Int());
       
  2886 
       
  2887 	call.Close();
       
  2888 	AssertMockLtsyStatusL();
       
  2889 	CleanupStack::PopAndDestroy(1);
       
  2890       	
       
  2891 	//-------------------------------------------------------------------------
       
  2892 	// TEST : to increase CMmDataCallTsy::Dial coverage
       
  2893 	// covers "if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )" condition
       
  2894  	//-------------------------------------------------------------------------
       
  2895 
       
  2896 	// open new call
       
  2897    	CleanupClosePushL(call);
       
  2898    	errorCode = call.OpenNewCall(line, name);
       
  2899     ASSERT_EQUALS(KErrNone, errorCode);
       
  2900 
       
  2901 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2902 	TRfStateInfo rfInfo = ERfsStateInfoInactive;
       
  2903 	TMockLtsyData1<TRfStateInfo> mockData1(rfInfo);
       
  2904     expectData.Close();
       
  2905     mockData1.SerialiseL(expectData);
       
  2906 	iMockLTSY.CompleteL(EMmTsyBootGetRFStatusIPC, KErrNone, expectData);
       
  2907 	User::WaitForRequest(mockLtsyStatus);
       
  2908 	AssertMockLtsyStatusL();
       
  2909 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2910 
       
  2911 	call.Close();
       
  2912 	AssertMockLtsyStatusL();
       
  2913 	CleanupStack::PopAndDestroy(1);
       
  2914 	
       
  2915 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2916 	rfInfo = (TRfStateInfo) 0;
       
  2917 	TMockLtsyData1<TRfStateInfo> mockDataRf(rfInfo);
       
  2918 	expectData.Close();
       
  2919 	mockDataRf.SerialiseL(expectData);
       
  2920 	iMockLTSY.CompleteL(EMmTsyBootGetRFStatusIPC, KErrNone, expectData);
       
  2921 	User::WaitForRequest(mockLtsyStatus);
       
  2922 	AssertMockLtsyStatusL();
       
  2923 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());		 
       
  2924 			 		 
       
  2925 	// call CMmVoiceCallTsy::CompleteNotifyStatusChange for setting 
       
  2926 	// iMobileCallStatus = RMobileCall::EStatusIdle.
       
  2927 	RMobileCall::TMobileCallStatus mobileCallSt = RMobileCall::EStatusIdle; 
       
  2928 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallDataStatus2(callId, mobileService, mobileCallSt);
       
  2929 	completeData.Close();
       
  2930 	mockCallDataStatus2.SerialiseL(completeData);
       
  2931 
       
  2932 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  2933 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
  2934 		
       
  2935 	User::WaitForRequest(mockLtsyStatus);
       
  2936 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  2937 	
       
  2938 	//-------------------------------------------------------------------------
       
  2939 	// Tests for TMobileDataCallParamsV2
       
  2940 	
       
  2941 	RMobileCall::TMobileDataCallParamsV2 dataCallParams2;
       
  2942 	dataCallParams2.iInterval = 4;
       
  2943 	dataCallParams2.iCug.iCugIndex = 0xFFFF;
       
  2944 	dataCallParams2.iQoS = RMobileCall::EQosTransparentPreferred;
       
  2945 	dataCallParams2.iBearerMode = RMobileCall::EMulticallShareBearer;
       
  2946 	
       
  2947 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  2948 		mockDataCallParams2(0, mobileService, dataCallParams2, callInfo);
       
  2949 
       
  2950 	TPckg<RMobileCall::TMobileDataCallParamsV2> pckgMockDataCallParams2(dataCallParams2);
       
  2951 
       
  2952  	//-------------------------------------------------------------------------
       
  2953 	// TEST A2: failure to dispatch request to LTSY 
       
  2954  	//-------------------------------------------------------------------------
       
  2955 
       
  2956 	// open new call
       
  2957 	CleanupClosePushL(call);
       
  2958    	errorCode = call.OpenNewCall(line, name);
       
  2959     ASSERT_EQUALS(KErrNone, errorCode);
       
  2960     
       
  2961    // expectData.Close();
       
  2962     mockDataCallParams2.SerialiseL(expectData);
       
  2963 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  2964 
       
  2965 	call.Dial(requestStatus, pckgMockDataCallParams2, KPhoneNumber);
       
  2966 	User::WaitForRequest(requestStatus);
       
  2967 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  2968 
       
  2969 	call.Close();
       
  2970 	AssertMockLtsyStatusL();
       
  2971 	CleanupStack::PopAndDestroy(1);
       
  2972 	
       
  2973 	//-------------------------------------------------------------------------
       
  2974 	// TEST B2: failure on completion of pending request from LTSY->CTSY 
       
  2975  	//-------------------------------------------------------------------------
       
  2976 	
       
  2977 	// open new call
       
  2978    	CleanupClosePushL(call);
       
  2979    	errorCode = call.OpenNewCall(line, name);
       
  2980     ASSERT_EQUALS(KErrNone, errorCode);
       
  2981 
       
  2982 	expectData.Close();
       
  2983     mockDataCallParams2.SerialiseL(expectData);
       
  2984 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  2985 	
       
  2986 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  2987 
       
  2988 	mockData0.SerialiseL(completeData);
       
  2989 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  2990 
       
  2991 	call.Dial(requestStatus, pckgMockDataCallParams2, KPhoneNumber);
       
  2992 	User::WaitForRequest(requestStatus);
       
  2993 	AssertMockLtsyStatusL();
       
  2994 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  2995 
       
  2996 	call.Close();
       
  2997 	AssertMockLtsyStatusL();
       
  2998 	CleanupStack::PopAndDestroy(1);
       
  2999 	
       
  3000 	//-------------------------------------------------------------------------
       
  3001 	// TEST C2: Successful completion request of
       
  3002 	// RCall::Dial when result is not cached
       
  3003  	//-------------------------------------------------------------------------
       
  3004 	
       
  3005 	// open new call
       
  3006    	CleanupClosePushL(call);
       
  3007    	errorCode = call.OpenNewCall(line, name);
       
  3008     ASSERT_EQUALS(KErrNone, errorCode);
       
  3009 
       
  3010 	expectData.Close();
       
  3011     mockDataCallParams2.SerialiseL(expectData);
       
  3012 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3013 
       
  3014 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3015 	
       
  3016 	completeData.Close();
       
  3017 	mockData0.SerialiseL(completeData);
       
  3018 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3019 
       
  3020 	// we are dialing the call:
       
  3021     call.Dial(requestStatus, pckgMockDataCallParams2, KPhoneNumber);
       
  3022     
       
  3023     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3024 	
       
  3025     // completion of the Dial() request:
       
  3026     User::WaitForRequest(requestStatus);
       
  3027     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3028      
       
  3029     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3030   
       
  3031 	call.Close();
       
  3032 	CleanupStack::PopAndDestroy(1);
       
  3033 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3034 	}
       
  3035 
       
  3036 // Returns sample call information variable
       
  3037 void GetCallInformation8(RMobileCall::TMobileCallInfoV8& aCallInformation, const TDesC& aPhoneNumber, RMobilePhone::TMobileService aMobileService)
       
  3038 	{
       
  3039 	aCallInformation.iDialledParty.iTelNumber.Copy(aPhoneNumber);
       
  3040 	aCallInformation.iService = aMobileService;
       
  3041 	aCallInformation.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  3042 	aCallInformation.iAlphaId.Copy(_L("Alpha Id"));
       
  3043 	aCallInformation.iValid |= RMobileCall::KCallAlphaId;
       
  3044 	aCallInformation.iCallParamOrigin = RMobileCall::EOriginatorSIM;;
       
  3045 	aCallInformation.iValid |= RMobileCall::KCallParamOrigin;
       
  3046 	}
       
  3047 
       
  3048 // Returns sample call params variable
       
  3049 void GetCallParams8(RMobileCall::TMobileDataCallParamsV8& aDataCallParams)
       
  3050 	{
       
  3051 	aDataCallParams.iInterval = 4;
       
  3052 	aDataCallParams.iCug.iCugIndex = 0xFFFF;
       
  3053 	aDataCallParams.iQoS = RMobileCall::EQosTransparentPreferred;
       
  3054 	aDataCallParams.iBearerMode = RMobileCall::EMulticallShareBearer;
       
  3055 	aDataCallParams.iSubAddress.Copy(_L("An Unknown SubAddress"));
       
  3056 	aDataCallParams.iAlphaId.Copy(_L("Alpha Id"));
       
  3057 	aDataCallParams.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  3058 	}
       
  3059 
       
  3060 /**
       
  3061 @SYMTestCaseID BA-CTSY-CCON-CD-0006c
       
  3062 @SYMDEF DEF127552
       
  3063 @SYMREQ	7745
       
  3064 @SYMComponent  telephony_ctsy
       
  3065 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls. It is in connection to BA-CTSY-CCON-CD-0006.
       
  3066 @SYMTestPriority High
       
  3067 @SYMTestActions Invokes RCall::Dial for data calls
       
  3068 @SYMTestExpectedResults Pass
       
  3069 @SYMTestType CT
       
  3070 */
       
  3071 void CCTsyCallControlFU::TestDial0006cL()
       
  3072 	{
       
  3073 	OpenEtelServerL(EUseExtendedError);
       
  3074 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3075 	OpenPhoneL();
       
  3076 
       
  3077 	RBuf8 expectData;
       
  3078 	CleanupClosePushL(expectData);
       
  3079 
       
  3080 	RBuf8 completeData;
       
  3081 	CleanupClosePushL(completeData);
       
  3082 
       
  3083 	RLine line;
       
  3084 	RCall call;
       
  3085 		
       
  3086 	TInt errorCode = KErrNone;
       
  3087 	TRequestStatus requestStatus;
       
  3088 	TRequestStatus mockLtsyStatus;
       
  3089 		
       
  3090 	// open new line and call for KMmTsyDataLineName
       
  3091 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  3092 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3093 
       
  3094 	TName name;
       
  3095 
       
  3096 	_LIT(KPhoneNumber, "135468456456");   	
       
  3097 	   	
       
  3098 	TInt callId = 1;
       
  3099     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3100     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  3101     
       
  3102 	//-------------------------------------------------------------------------
       
  3103 	// Tests for TMobileDataCallParamsV8
       
  3104 	
       
  3105 	RMobileCall::TMobileCallInfoV8 callInformation;
       
  3106 	GetCallInformation8(callInformation, KPhoneNumber(), mobileService);
       
  3107 	
       
  3108 	RMobileCall::TMobileDataCallParamsV8 dataCallParams8;
       
  3109 	GetCallParams8(dataCallParams8);
       
  3110 		
       
  3111 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  3112 		mockDataCallParams8(0, mobileService, dataCallParams8, callInformation);
       
  3113 
       
  3114 	TPckg<RMobileCall::TMobileDataCallParamsV8> pckgMockDataCallParams8(dataCallParams8);
       
  3115 
       
  3116  	//-------------------------------------------------------------------------
       
  3117 	// TEST A3: failure to dispatch request to LTSY 
       
  3118  	//-------------------------------------------------------------------------
       
  3119 	
       
  3120 	// open new call
       
  3121 	CleanupClosePushL(call);
       
  3122    	errorCode = call.OpenNewCall(line, name);
       
  3123     ASSERT_EQUALS(KErrNone, errorCode);
       
  3124 
       
  3125     expectData.Close();
       
  3126     mockDataCallParams8.SerialiseL(expectData);
       
  3127 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  3128 
       
  3129 	call.Dial(requestStatus, pckgMockDataCallParams8, KPhoneNumber);
       
  3130 	User::WaitForRequest(requestStatus);
       
  3131 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3132 
       
  3133 	call.Close();
       
  3134 	AssertMockLtsyStatusL();
       
  3135 	CleanupStack::PopAndDestroy(1);
       
  3136 	
       
  3137 	//-------------------------------------------------------------------------
       
  3138 	// TEST B3: failure on completion of pending request from LTSY->CTSY 
       
  3139  	//-------------------------------------------------------------------------
       
  3140 	
       
  3141 	// open new call
       
  3142    	CleanupClosePushL(call);
       
  3143    	errorCode = call.OpenNewCall(line, name);
       
  3144     ASSERT_EQUALS(KErrNone, errorCode);
       
  3145 
       
  3146 	expectData.Close();
       
  3147     mockDataCallParams8.SerialiseL(expectData);
       
  3148 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3149 
       
  3150 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3151 	
       
  3152 	mockData0.SerialiseL(completeData);
       
  3153 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  3154 
       
  3155 	call.Dial(requestStatus, pckgMockDataCallParams8, KPhoneNumber);
       
  3156 	User::WaitForRequest(requestStatus);
       
  3157 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3158 
       
  3159 	call.Close();
       
  3160 	AssertMockLtsyStatusL();
       
  3161 	CleanupStack::PopAndDestroy(1);
       
  3162 	
       
  3163 	//-------------------------------------------------------------------------
       
  3164 	// TEST C3: Successful completion request of
       
  3165 	// RCall::Dial when result is not cached
       
  3166  	//-------------------------------------------------------------------------
       
  3167 	
       
  3168 	// open new call
       
  3169    	CleanupClosePushL(call);
       
  3170    	errorCode = call.OpenNewCall(line, name);
       
  3171     ASSERT_EQUALS(KErrNone, errorCode);
       
  3172 
       
  3173 	expectData.Close();
       
  3174     mockDataCallParams8.SerialiseL(expectData);
       
  3175 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3176 	
       
  3177 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3178 
       
  3179 	completeData.Close();
       
  3180 	mockData0.SerialiseL(completeData);
       
  3181 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3182 
       
  3183 	// we are dialing the call:
       
  3184     call.Dial(requestStatus, pckgMockDataCallParams8, KPhoneNumber);
       
  3185 		
       
  3186     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3187     
       
  3188 	// completion of the Dial() request:
       
  3189     User::WaitForRequest(requestStatus);
       
  3190     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3191       
       
  3192     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3193     
       
  3194 	call.Close();
       
  3195 	CleanupStack::PopAndDestroy(1); // call
       
  3196 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3197 	}
       
  3198 
       
  3199 /**
       
  3200 @SYMTestCaseID BA-CTSY-CCON-CD-0006d
       
  3201 @SYMDEF DEF127552
       
  3202 @SYMREQ	7745
       
  3203 @SYMComponent  telephony_ctsy
       
  3204 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls. It is in connection to BA-CTSY-CCON-CD-0006.
       
  3205 @SYMTestPriority High
       
  3206 @SYMTestActions Invokes RCall::Dial for data calls
       
  3207 @SYMTestExpectedResults Pass
       
  3208 @SYMTestType CT
       
  3209 */
       
  3210 void CCTsyCallControlFU::TestDial0006dL()
       
  3211 	{
       
  3212 	OpenEtelServerL(EUseExtendedError);
       
  3213 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3214 	OpenPhoneL();
       
  3215 
       
  3216 	RBuf8 expectData;
       
  3217 	CleanupClosePushL(expectData);
       
  3218 
       
  3219 	RBuf8 completeData;
       
  3220 	CleanupClosePushL(completeData);
       
  3221 
       
  3222 	RLine line;
       
  3223 	RCall call;
       
  3224 			
       
  3225 	TInt errorCode = KErrNone;
       
  3226 	TRequestStatus requestStatus;
       
  3227 	TRequestStatus mockLtsyStatus;
       
  3228 			
       
  3229 	// open new line and call for KMmTsyDataLineName
       
  3230 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  3231 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3232 
       
  3233 	TName name;
       
  3234 	_LIT(KPhoneNumber, "135468456456"); 
       
  3235 	
       
  3236 	TInt callId = 1;
       
  3237 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3238 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  3239 	
       
  3240 	RMobileCall::TMobileCallInfoV8 callInformation;
       
  3241 	GetCallInformation8(callInformation, KPhoneNumber(), mobileService);
       
  3242 	
       
  3243 	RMobileCall::TMobileDataCallParamsV8 dataCallParams8;
       
  3244 	GetCallParams8(dataCallParams8);
       
  3245 			
       
  3246 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  3247 			mockDataCallParams8(0, mobileService, dataCallParams8, callInformation);
       
  3248 
       
  3249 	TPckg<RMobileCall::TMobileDataCallParamsV8> pckgMockDataCallParams8(dataCallParams8);
       
  3250 	
       
  3251 	//-------------------------------------------------------------------------
       
  3252 	// Tests for default parameters
       
  3253 	
       
  3254  	//-------------------------------------------------------------------------
       
  3255 	// TEST A4: failure to dispatch request to LTSY 
       
  3256  	//-------------------------------------------------------------------------
       
  3257 	
       
  3258 	// open new call
       
  3259 	CleanupClosePushL(call);
       
  3260    	errorCode = call.OpenNewCall(line, name);
       
  3261     ASSERT_EQUALS(KErrNone, errorCode);
       
  3262 
       
  3263     expectData.Close();
       
  3264     mockDataCallParams8.SerialiseL(expectData);
       
  3265 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  3266 
       
  3267 	call.Dial(requestStatus, KPhoneNumber);
       
  3268 	User::WaitForRequest(requestStatus);
       
  3269 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3270 
       
  3271 	call.Close();
       
  3272 	AssertMockLtsyStatusL();
       
  3273 	CleanupStack::PopAndDestroy(1);
       
  3274 	
       
  3275 	//-------------------------------------------------------------------------
       
  3276 	// TEST B4: failure on completion of pending request from LTSY->CTSY 
       
  3277  	//-------------------------------------------------------------------------
       
  3278 	
       
  3279 	// open new call
       
  3280    	CleanupClosePushL(call);
       
  3281    	errorCode = call.OpenNewCall(line, name);
       
  3282     ASSERT_EQUALS(KErrNone, errorCode);
       
  3283 
       
  3284 	expectData.Close();
       
  3285     mockDataCallParams8.SerialiseL(expectData);
       
  3286 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3287 
       
  3288 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3289 	
       
  3290 	mockData0.SerialiseL(completeData);
       
  3291 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  3292 
       
  3293 	call.Dial(requestStatus, KPhoneNumber);
       
  3294 	User::WaitForRequest(requestStatus);
       
  3295 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3296 
       
  3297 	call.Close();
       
  3298 	AssertMockLtsyStatusL();
       
  3299 	CleanupStack::PopAndDestroy(1);
       
  3300 	
       
  3301 	//-------------------------------------------------------------------------
       
  3302 	// TEST C4: Successful completion request of
       
  3303 	// RCall::Dial when result is not cached
       
  3304  	//-------------------------------------------------------------------------
       
  3305 	
       
  3306 	// open new call
       
  3307    	CleanupClosePushL(call);
       
  3308    	errorCode = call.OpenNewCall(line, name);
       
  3309     ASSERT_EQUALS(KErrNone, errorCode);
       
  3310 
       
  3311 	expectData.Close();
       
  3312     mockDataCallParams8.SerialiseL(expectData);
       
  3313 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3314 	
       
  3315 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3316 
       
  3317 	completeData.Close();
       
  3318 	mockData0.SerialiseL(completeData);
       
  3319 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3320 
       
  3321 	// we are dialing the call:
       
  3322     call.Dial(requestStatus, KPhoneNumber);
       
  3323 		
       
  3324     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3325     
       
  3326 	// completion of the Dial() request:
       
  3327     User::WaitForRequest(requestStatus);
       
  3328     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3329       
       
  3330     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3331     
       
  3332 	call.Close();
       
  3333 	CleanupStack::PopAndDestroy(1); // call
       
  3334 	
       
  3335 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3336 	}
       
  3337 
       
  3338 /**
       
  3339 @SYMTestCaseID BA-CTSY-CCON-CD-0006e
       
  3340 @SYMComponent  telephony_ctsy
       
  3341 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls with HscsdCallParams. It is in connection to BA-CTSY-CCON-CD-0006
       
  3342 @SYMTestPriority High
       
  3343 @SYMTestActions Invokes RCall::Dial for data calls
       
  3344 @SYMTestExpectedResults Pass
       
  3345 @SYMTestType CT
       
  3346 */
       
  3347 void CCTsyCallControlFU::TestDial0006eL()
       
  3348 	{
       
  3349 	OpenEtelServerL(EUseExtendedError);
       
  3350 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3351 	OpenPhoneL();
       
  3352 
       
  3353     RBuf8 expectData;
       
  3354     CleanupClosePushL(expectData);
       
  3355 
       
  3356     RBuf8 completeData;
       
  3357     CleanupClosePushL(completeData);
       
  3358 
       
  3359 	RLine line;
       
  3360 	RCall call;
       
  3361 	
       
  3362 	TInt errorCode = KErrNone;
       
  3363     TRequestStatus requestStatus;
       
  3364 	TRequestStatus mockLtsyStatus;
       
  3365 	
       
  3366 	// open new line and call for KMmTsyDataLineName
       
  3367 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  3368 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3369 
       
  3370 	TName name;
       
  3371 
       
  3372 	_LIT(KPhoneNumber, "101632960000");   	
       
  3373    	
       
  3374 	TInt callId = 1;
       
  3375     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3376 			
       
  3377 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  3378 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  3379 	callInfo.iService = mobileService;
       
  3380 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  3381 	
       
  3382 	//-------------------------------------------------------------------------
       
  3383 	// Test: Test passing RMobileCall::TMobileHscsdCallParamsV1 to
       
  3384 	// RCall::Dial
       
  3385  	//-------------------------------------------------------------------------
       
  3386 
       
  3387 	RMobileCall::TMobileHscsdCallParamsV1 hscsdCallParams;
       
  3388 
       
  3389 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  3390 		mockHscsdData(0, mobileService, hscsdCallParams, callInfo);
       
  3391 
       
  3392 	TPckg<RMobileCall::TMobileHscsdCallParamsV1> pckgMockHscsdParams1(hscsdCallParams);
       
  3393 
       
  3394 	//-------------------------------------------------------------------------
       
  3395 	// TEST A4: failure to dispatch request to LTSY 
       
  3396  	//-------------------------------------------------------------------------
       
  3397 	
       
  3398 	// open new call
       
  3399 	CleanupClosePushL(call);
       
  3400    	errorCode = call.OpenNewCall(line, name);
       
  3401     ASSERT_EQUALS(KErrNone, errorCode);
       
  3402 
       
  3403     expectData.Close();
       
  3404     mockHscsdData.SerialiseL(expectData);
       
  3405 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  3406 
       
  3407 	call.Dial(requestStatus, pckgMockHscsdParams1, KPhoneNumber);
       
  3408 	User::WaitForRequest(requestStatus);
       
  3409 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3410 
       
  3411 	call.Close();
       
  3412 	AssertMockLtsyStatusL();
       
  3413 	CleanupStack::PopAndDestroy(1);
       
  3414 	
       
  3415 	//-------------------------------------------------------------------------
       
  3416 	// TEST B4: failure on completion of pending request from LTSY->CTSY 
       
  3417  	//-------------------------------------------------------------------------
       
  3418 	
       
  3419 	// open new call
       
  3420    	CleanupClosePushL(call);
       
  3421    	errorCode = call.OpenNewCall(line, name);
       
  3422     ASSERT_EQUALS(KErrNone, errorCode);
       
  3423 
       
  3424 	expectData.Close();
       
  3425 	mockHscsdData.SerialiseL(expectData);
       
  3426 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3427 
       
  3428 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3429 	
       
  3430 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  3431 	mockData0.SerialiseL(completeData);
       
  3432 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  3433 
       
  3434 	call.Dial(requestStatus, pckgMockHscsdParams1, KPhoneNumber);
       
  3435 	User::WaitForRequest(requestStatus);
       
  3436 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3437 
       
  3438 	call.Close();
       
  3439 	AssertMockLtsyStatusL();
       
  3440 	CleanupStack::PopAndDestroy(1);
       
  3441 	
       
  3442 	//-------------------------------------------------------------------------
       
  3443 	// TEST C4: Successful completion request of
       
  3444 	// RCall::Dial when result is not cached
       
  3445  	//-------------------------------------------------------------------------
       
  3446 	
       
  3447 	// open new call   	
       
  3448 	CleanupClosePushL(call);
       
  3449    	errorCode = call.OpenNewCall(line, name);
       
  3450     ASSERT_EQUALS(KErrNone, errorCode);
       
  3451 
       
  3452 	expectData.Close();
       
  3453 	mockHscsdData.SerialiseL(expectData);
       
  3454 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3455 
       
  3456 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3457 	
       
  3458 	mockData0.SerialiseL(completeData);
       
  3459 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3460 
       
  3461 	// we are dialing the call:
       
  3462     call.Dial(requestStatus, pckgMockHscsdParams1, KPhoneNumber);
       
  3463 		
       
  3464     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3465     
       
  3466 	// completion of the Dial() request:
       
  3467     User::WaitForRequest(requestStatus);
       
  3468     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3469       
       
  3470     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3471     
       
  3472 	call.Close();
       
  3473 	CleanupStack::PopAndDestroy(1);
       
  3474 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3475 	}
       
  3476 
       
  3477 /**
       
  3478 @SYMTestCaseID BA-CTSY-CCON-CD-0006f
       
  3479 @SYMComponent  telephony_ctsy
       
  3480 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls with HscsdCallParams. It is in connection to BA-CTSY-CCON-CD-0006
       
  3481 @SYMTestPriority High
       
  3482 @SYMTestActions Invokes RCall::Dial for data calls
       
  3483 @SYMTestExpectedResults Pass
       
  3484 @SYMTestType CT
       
  3485 */
       
  3486 void CCTsyCallControlFU::TestDial0006fL()
       
  3487 	{
       
  3488 	OpenEtelServerL(EUseExtendedError);
       
  3489 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3490 	OpenPhoneL();
       
  3491 
       
  3492     RBuf8 expectData;
       
  3493     CleanupClosePushL(expectData);
       
  3494 
       
  3495     RBuf8 completeData;
       
  3496     CleanupClosePushL(completeData);
       
  3497 
       
  3498 	RLine line;
       
  3499 	RCall call;
       
  3500 	
       
  3501 	TInt errorCode = KErrNone;
       
  3502     TRequestStatus requestStatus;
       
  3503 	TRequestStatus mockLtsyStatus;
       
  3504 	
       
  3505 	// open new line and call for KMmTsyDataLineName
       
  3506 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  3507 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3508 
       
  3509 	TName name;
       
  3510 
       
  3511 	_LIT(KPhoneNumber, "135468456456");   	
       
  3512    	
       
  3513 	TInt callId = 1;
       
  3514     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3515     
       
  3516     RMobileCall::TMobileCallInfoV8 callInfo;
       
  3517     callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  3518     callInfo.iService = mobileService;
       
  3519     callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  3520     	
       
  3521 	//-------------------------------------------------------------------------
       
  3522     // Test: Test passing RMobileCall::TMobileHscsdCallParamsV2 to
       
  3523 	// RCall::Dial
       
  3524 	//-------------------------------------------------------------------------
       
  3525 
       
  3526 	RMobileCall::TMobileHscsdCallParamsV2 hscsdCallParams2;
       
  3527 
       
  3528 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  3529 		mockHscsdData2(0, mobileService, hscsdCallParams2, callInfo);
       
  3530 
       
  3531 	TPckg<RMobileCall::TMobileHscsdCallParamsV2> pckgMockHscsdParams2(hscsdCallParams2);
       
  3532 
       
  3533 	//-------------------------------------------------------------------------
       
  3534 	// TEST A5: failure to dispatch request to LTSY 
       
  3535  	//-------------------------------------------------------------------------
       
  3536 	
       
  3537 	// open new call
       
  3538 	CleanupClosePushL(call);
       
  3539    	errorCode = call.OpenNewCall(line, name);
       
  3540     ASSERT_EQUALS(KErrNone, errorCode);
       
  3541 
       
  3542     expectData.Close();
       
  3543     mockHscsdData2.SerialiseL(expectData);
       
  3544 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  3545 
       
  3546 	call.Dial(requestStatus, pckgMockHscsdParams2, KPhoneNumber);
       
  3547 	User::WaitForRequest(requestStatus);
       
  3548 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3549 
       
  3550 	call.Close();
       
  3551 	AssertMockLtsyStatusL();
       
  3552 	CleanupStack::PopAndDestroy(1);
       
  3553 	
       
  3554 	//-------------------------------------------------------------------------
       
  3555 	// TEST B5: failure on completion of pending request from LTSY->CTSY 
       
  3556  	//-------------------------------------------------------------------------
       
  3557 	
       
  3558 	// open new call
       
  3559    	CleanupClosePushL(call);
       
  3560    	errorCode = call.OpenNewCall(line, name);
       
  3561     ASSERT_EQUALS(KErrNone, errorCode);
       
  3562 
       
  3563 	expectData.Close();
       
  3564 	mockHscsdData2.SerialiseL(expectData);
       
  3565 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3566 
       
  3567 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3568 	
       
  3569 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  3570 	mockData0.SerialiseL(completeData);
       
  3571 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  3572 
       
  3573 	call.Dial(requestStatus, pckgMockHscsdParams2, KPhoneNumber);
       
  3574 	User::WaitForRequest(requestStatus);
       
  3575 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3576 
       
  3577 	call.Close();
       
  3578 	AssertMockLtsyStatusL();
       
  3579 	CleanupStack::PopAndDestroy(1);
       
  3580 	
       
  3581 	//-------------------------------------------------------------------------
       
  3582 	// TEST C5: Successful completion request of
       
  3583 	// RCall::Dial when result is not cached
       
  3584  	//-------------------------------------------------------------------------
       
  3585 
       
  3586 	// open new call   	
       
  3587 	CleanupClosePushL(call);
       
  3588 	errorCode = call.OpenNewCall(line, name);
       
  3589 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3590 
       
  3591 	expectData.Close();
       
  3592 	mockHscsdData2.SerialiseL(expectData);
       
  3593 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3594 
       
  3595 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3596 	
       
  3597 	mockData0.SerialiseL(completeData);
       
  3598 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3599 
       
  3600     // we are dialing the call:
       
  3601     call.Dial(requestStatus, pckgMockHscsdParams2, KPhoneNumber);
       
  3602 		
       
  3603     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3604     
       
  3605 	// completion of the Dial() request:
       
  3606     User::WaitForRequest(requestStatus);
       
  3607     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3608       
       
  3609     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3610     
       
  3611 	call.Close();
       
  3612 	CleanupStack::PopAndDestroy(1);
       
  3613 	
       
  3614 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3615 	}
       
  3616 
       
  3617 /**
       
  3618 @SYMTestCaseID BA-CTSY-CCON-CD-0006g
       
  3619 @SYMComponent  telephony_ctsy
       
  3620 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls with HscsdCallParams.It is in connection to BA-CTSY-CCON-CD-0006
       
  3621 @SYMTestPriority High
       
  3622 @SYMTestActions Invokes RCall::Dial for data calls
       
  3623 @SYMTestExpectedResults Pass
       
  3624 @SYMTestType CT
       
  3625 */
       
  3626 void CCTsyCallControlFU::TestDial0006gL()
       
  3627 	{
       
  3628 	OpenEtelServerL(EUseExtendedError);
       
  3629 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3630 	OpenPhoneL();
       
  3631 
       
  3632     RBuf8 expectData;
       
  3633     CleanupClosePushL(expectData);
       
  3634 
       
  3635     RBuf8 completeData;
       
  3636     CleanupClosePushL(completeData);
       
  3637 
       
  3638 	RLine line;
       
  3639 	RCall call;
       
  3640 	
       
  3641 	TInt errorCode = KErrNone;
       
  3642     TRequestStatus requestStatus;
       
  3643 	TRequestStatus mockLtsyStatus;
       
  3644 	
       
  3645 	// open new line and call for KMmTsyDataLineName
       
  3646 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  3647 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3648 
       
  3649 	TName name;
       
  3650 
       
  3651 	_LIT(KPhoneNumber, "101632960000");   	
       
  3652    	
       
  3653 	TInt callId = 1;
       
  3654     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3655 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  3656 	
       
  3657 	//-------------------------------------------------------------------------
       
  3658     // Test: Test passing RMobileCall::TMobileHscsdCallParamsV7 to
       
  3659 	// RCall::Dial
       
  3660 	//-------------------------------------------------------------------------
       
  3661 
       
  3662 	RMobileCall::TMobileHscsdCallParamsV7 hscsdCallParams7;
       
  3663 	
       
  3664 	// TMobileHscsdCallParamsV7 params for Dial
       
  3665     hscsdCallParams7.iInterval = 4;
       
  3666     hscsdCallParams7.iCug.iCugIndex = 0xFFFF;
       
  3667     hscsdCallParams7.iSpeakerControl = RCall::EMonitorSpeakerControlAlwaysOff;
       
  3668     hscsdCallParams7.iSpeakerVolume = RCall::EMonitorSpeakerVolumeMedium;
       
  3669     hscsdCallParams7.iWaitForDialTone = RCall::EDialToneWait;
       
  3670     hscsdCallParams7.iQoS = RMobileCall::EQosTransparentPreferred;
       
  3671     hscsdCallParams7.iV42bisReq = RMobileCall::EV42bisTxDirection;
       
  3672     hscsdCallParams7.iWantedRxTimeSlots = 2; 
       
  3673     hscsdCallParams7.iCodings = 3;
       
  3674     hscsdCallParams7.iBearerMode = RMobileCall::EMulticallShareBearer;
       
  3675     hscsdCallParams7.iAlphaId.Copy(_L("Alpha Id"));
       
  3676     hscsdCallParams7.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  3677     
       
  3678 	RMobileCall::TMobileCallInfoV8 callInformation;
       
  3679 	GetCallInformation8(callInformation, KPhoneNumber(), mobileService);
       
  3680 
       
  3681 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
  3682 		mockHscsdData7(0, mobileService, hscsdCallParams7, callInformation);
       
  3683 
       
  3684 	TPckg<RMobileCall::TMobileHscsdCallParamsV7> pckgMockHscsdParams7(hscsdCallParams7);
       
  3685 
       
  3686 	//-------------------------------------------------------------------------
       
  3687 	// TEST A6: failure to dispatch request to LTSY 
       
  3688  	//-------------------------------------------------------------------------
       
  3689 	
       
  3690 	// open new call
       
  3691 	CleanupClosePushL(call);
       
  3692    	errorCode = call.OpenNewCall(line, name);
       
  3693     ASSERT_EQUALS(KErrNone, errorCode);
       
  3694 
       
  3695     expectData.Close();
       
  3696     mockHscsdData7.SerialiseL(expectData);
       
  3697 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  3698 
       
  3699 	call.Dial(requestStatus, pckgMockHscsdParams7, KPhoneNumber);
       
  3700 	User::WaitForRequest(requestStatus);
       
  3701 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3702 
       
  3703 	call.Close();
       
  3704 	AssertMockLtsyStatusL();
       
  3705 	CleanupStack::PopAndDestroy(1);
       
  3706 	
       
  3707 	//-------------------------------------------------------------------------
       
  3708 	// TEST B6: failure on completion of pending request from LTSY->CTSY 
       
  3709  	//-------------------------------------------------------------------------
       
  3710 	
       
  3711 	// open new call
       
  3712    	CleanupClosePushL(call);
       
  3713    	errorCode = call.OpenNewCall(line, name);
       
  3714     ASSERT_EQUALS(KErrNone, errorCode);
       
  3715 
       
  3716 	expectData.Close();
       
  3717 	mockHscsdData7.SerialiseL(expectData);
       
  3718 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3719 
       
  3720 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3721 	
       
  3722 	mockData0.SerialiseL(completeData);
       
  3723 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  3724 
       
  3725 	call.Dial(requestStatus, pckgMockHscsdParams7, KPhoneNumber);
       
  3726 	User::WaitForRequest(requestStatus);
       
  3727 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3728 
       
  3729 	call.Close();
       
  3730 	AssertMockLtsyStatusL();
       
  3731 	CleanupStack::PopAndDestroy(1);
       
  3732 	
       
  3733 	//-------------------------------------------------------------------------
       
  3734 	// TEST C6: Successful completion request of
       
  3735 	// RCall::Dial when result is not cached
       
  3736  	//-------------------------------------------------------------------------
       
  3737 
       
  3738 	// open new call   	
       
  3739 	CleanupClosePushL(call);
       
  3740 	errorCode = call.OpenNewCall(line, name);
       
  3741 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3742 
       
  3743 	expectData.Close();
       
  3744 	mockHscsdData7.SerialiseL(expectData);
       
  3745 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3746 
       
  3747 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3748 	
       
  3749 	mockData0.SerialiseL(completeData);
       
  3750 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3751 
       
  3752     // we are dialing the call:
       
  3753     call.Dial(requestStatus, pckgMockHscsdParams7, KPhoneNumber);
       
  3754 	
       
  3755     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3756     
       
  3757 	// completion of the Dial() request:
       
  3758     User::WaitForRequest(requestStatus);
       
  3759     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3760       
       
  3761     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3762     
       
  3763 	call.Close();
       
  3764 	CleanupStack::PopAndDestroy(1);
       
  3765 	
       
  3766 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3767 	}
       
  3768 
       
  3769 /**
       
  3770 @SYMTestCaseID BA-CTSY-CCON-CD-0006h
       
  3771 @SYMComponent  telephony_ctsy
       
  3772 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls with HscsdCallParams.It is in connection to BA-CTSY-CCON-CD-0006
       
  3773 @SYMTestPriority High
       
  3774 @SYMTestActions Invokes RCall::Dial for data calls
       
  3775 @SYMTestExpectedResults Pass
       
  3776 @SYMTestType CT
       
  3777 */
       
  3778 void CCTsyCallControlFU::TestDial0006hL()
       
  3779 	{
       
  3780 	OpenEtelServerL(EUseExtendedError);
       
  3781 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3782 	OpenPhoneL();
       
  3783 
       
  3784     RBuf8 expectData;
       
  3785     CleanupClosePushL(expectData);
       
  3786 
       
  3787     RBuf8 completeData;
       
  3788     CleanupClosePushL(completeData);
       
  3789 
       
  3790 	RLine line;
       
  3791 	RCall call;
       
  3792 	
       
  3793 	TInt errorCode = KErrNone;
       
  3794     TRequestStatus requestStatus;
       
  3795 	TRequestStatus mockLtsyStatus;
       
  3796 	
       
  3797 	// open new line and call for KMmTsyDataLineName
       
  3798 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  3799 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3800 
       
  3801 	TName name;
       
  3802 	_LIT(KPhoneNumber, "135468456456");   	
       
  3803    	
       
  3804 	TInt callId = 1;
       
  3805     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  3806 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  3807 	
       
  3808 	//-------------------------------------------------------------------------
       
  3809     // Test: Test passing RMobileCall::TMobileHscsdCallParamsV8 to
       
  3810 	// RCall::Dial
       
  3811 	//-------------------------------------------------------------------------
       
  3812 
       
  3813 	RMobileCall::TMobileHscsdCallParamsV8 hscsdCallParams8;
       
  3814 	
       
  3815 	// TMobileHscsdCallParamsV8 params for Dial
       
  3816     hscsdCallParams8.iInterval = 2;
       
  3817     hscsdCallParams8.iCug.iCugIndex = 0xFFFF;
       
  3818     hscsdCallParams8.iSpeakerControl = RCall::EMonitorSpeakerControlAlwaysOff;
       
  3819     hscsdCallParams8.iSpeakerVolume = RCall::EMonitorSpeakerVolumeMedium;
       
  3820     hscsdCallParams8.iWaitForDialTone = RCall::EDialToneWait;
       
  3821     hscsdCallParams8.iQoS = RMobileCall::EQosTransparentPreferred;
       
  3822     hscsdCallParams8.iV42bisReq = RMobileCall::EV42bisTxDirection;
       
  3823     hscsdCallParams8.iWantedRxTimeSlots = 2; 
       
  3824     hscsdCallParams8.iCodings = 3;
       
  3825     hscsdCallParams8.iBearerMode = RMobileCall::EMulticallShareBearer;
       
  3826     hscsdCallParams8.iAlphaId.Copy(_L("Alpha Id"));
       
  3827     hscsdCallParams8.iSubAddress.Copy(_L("An Unknown SubAddress"));
       
  3828     hscsdCallParams8.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  3829 
       
  3830 	RMobileCall::TMobileCallInfoV8 callInformation;
       
  3831 	GetCallInformation8(callInformation, KPhoneNumber(), mobileService);
       
  3832 	
       
  3833 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  3834 		mockHscsdData8(0, mobileService, hscsdCallParams8, callInformation);
       
  3835 
       
  3836 	TPckg<RMobileCall::TMobileHscsdCallParamsV8> pckgMockHscsdParams8(hscsdCallParams8);
       
  3837 
       
  3838 	//-------------------------------------------------------------------------
       
  3839 	// TEST A7: failure to dispatch request to LTSY 
       
  3840  	//-------------------------------------------------------------------------
       
  3841 	
       
  3842 	// open new call
       
  3843 	CleanupClosePushL(call);
       
  3844    	errorCode = call.OpenNewCall(line, name);
       
  3845     ASSERT_EQUALS(KErrNone, errorCode);
       
  3846 
       
  3847     expectData.Close();
       
  3848     mockHscsdData8.SerialiseL(expectData);
       
  3849 	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNotSupported);
       
  3850 
       
  3851 	call.Dial(requestStatus, pckgMockHscsdParams8, KPhoneNumber);
       
  3852 	User::WaitForRequest(requestStatus);
       
  3853 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  3854 
       
  3855 	call.Close();
       
  3856 	AssertMockLtsyStatusL();
       
  3857 	CleanupStack::PopAndDestroy(1);
       
  3858 	
       
  3859 	//-------------------------------------------------------------------------
       
  3860 	// TEST B7: failure on completion of pending request from LTSY->CTSY 
       
  3861  	//-------------------------------------------------------------------------
       
  3862 	
       
  3863 	// open new call
       
  3864    	CleanupClosePushL(call);
       
  3865    	errorCode = call.OpenNewCall(line, name);
       
  3866     ASSERT_EQUALS(KErrNone, errorCode);
       
  3867 
       
  3868 	expectData.Close();
       
  3869 	mockHscsdData8.SerialiseL(expectData);
       
  3870 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3871 
       
  3872 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3873 	
       
  3874 	mockData0.SerialiseL(completeData);
       
  3875 	iMockLTSY.CompleteL(EEtelCallDial, KErrGeneral, completeData);
       
  3876 
       
  3877 	call.Dial(requestStatus, pckgMockHscsdParams8, KPhoneNumber);
       
  3878 	User::WaitForRequest(requestStatus);
       
  3879 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  3880 
       
  3881 	call.Close();
       
  3882 	AssertMockLtsyStatusL();
       
  3883 	CleanupStack::PopAndDestroy(1);
       
  3884 	
       
  3885 	//-------------------------------------------------------------------------
       
  3886 	// TEST C6: Successful completion request of
       
  3887 	// RCall::Dial when result is not cached
       
  3888  	//-------------------------------------------------------------------------
       
  3889 	
       
  3890 	// open new call   	
       
  3891 	CleanupClosePushL(call);
       
  3892 	errorCode = call.OpenNewCall(line, name);
       
  3893 	ASSERT_EQUALS(KErrNone, errorCode);
       
  3894 
       
  3895 	expectData.Close();
       
  3896 	mockHscsdData8.SerialiseL(expectData);
       
  3897 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  3898 
       
  3899 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  3900 	
       
  3901 	mockData0.SerialiseL(completeData);
       
  3902 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  3903 
       
  3904 	// we are dialing the call:
       
  3905     call.Dial(requestStatus, pckgMockHscsdParams8, KPhoneNumber);
       
  3906 		
       
  3907     CompleteDialStatusNotificationsL(call, callId, mobileService );
       
  3908     
       
  3909 	// completion of the Dial() request:
       
  3910     User::WaitForRequest(requestStatus);
       
  3911     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  3912       
       
  3913     CompleteCallDisconnectNotificationsL(callId, mobileService);
       
  3914 	
       
  3915 	call.Close();
       
  3916 	CleanupStack::PopAndDestroy(1);
       
  3917 
       
  3918 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  3919 	}
       
  3920 
       
  3921 /**
       
  3922 @SYMTestCaseID BA-CTSY-CCON-CD-0006i
       
  3923 @SYMComponent  telephony_ctsy
       
  3924 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for data calls with minimal parameters (RCall::TCallParams)
       
  3925 @SYMTestPriority High
       
  3926 @SYMTestActions Invokes RCall::Dial for data calls
       
  3927 @SYMTestExpectedResults Pass
       
  3928 @SYMTestType CT
       
  3929 */
       
  3930 void CCTsyCallControlFU::TestDial0006iL()
       
  3931     {
       
  3932     
       
  3933     OpenEtelServerL(EUseExtendedError);
       
  3934     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  3935     OpenPhoneL();
       
  3936 
       
  3937     RBuf8 expectData;
       
  3938     CleanupClosePushL(expectData);
       
  3939 
       
  3940     RBuf8 completeData;
       
  3941     CleanupClosePushL(completeData);
       
  3942 
       
  3943     TInt errorCode = KErrNone;    
       
  3944 
       
  3945     //-- For Voice1 -------------------------
       
  3946 
       
  3947     TBuf<256> lineName(KMmTsyDataLineName);    
       
  3948     // Open new line
       
  3949     RLine line;
       
  3950     errorCode = line.Open(iPhone, lineName);
       
  3951     ASSERT_EQUALS(KErrNone, errorCode);
       
  3952     CleanupClosePushL(line);      
       
  3953     // open call
       
  3954     _LIT(KDoubleColon, "::");    
       
  3955     TBuf<256> name;
       
  3956     name = KMmTsyPhoneName;
       
  3957     name.Append(KDoubleColon);
       
  3958     name.Append(lineName);
       
  3959     name.Append(KDoubleColon);
       
  3960 
       
  3961     RMobileCall call;
       
  3962     errorCode = call.OpenNewCall(line, name);
       
  3963     ASSERT_EQUALS(KErrNone, errorCode);
       
  3964     CleanupClosePushL(call);   
       
  3965 
       
  3966     TRequestStatus requestStatus;    
       
  3967     _LIT(KSomeNumber, "123456789");   
       
  3968 
       
  3969     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;    
       
  3970     TInt expecteCallId = 0;
       
  3971 
       
  3972     RMobileCall::TMobileDataCallParamsV8 callParams; 
       
  3973     RMobileCall::TMobileDataCallParamsV8Pckg    pckgCallParams(callParams);
       
  3974     RMobileCall::TMobileCallInfoV8 callInfo;   
       
  3975     callParams.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  3976     callParams.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  3977     callParams.iInterval        = 100;
       
  3978     callParams.iWaitForDialTone = RCall::EDialToneWait;
       
  3979     callParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
  3980     callParams.iCug.iExplicitInvoke = EFalse;
       
  3981     callParams.iCug.iCugIndex = 0xFFFF;
       
  3982     callParams.iCug.iSuppressPrefCug = EFalse;
       
  3983     callParams.iCug.iSuppressOA = EFalse;
       
  3984     callParams.iAutoRedial = EFalse;
       
  3985     callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;    
       
  3986     callInfo.iService   = mobileService;
       
  3987     callInfo.iStatus    = RMobileCall::EStatusUnknown;
       
  3988     callInfo.iCallId    =-1;
       
  3989     callInfo.iExitCode  =0; 
       
  3990     callInfo.iEmergency =0;
       
  3991     callInfo.iForwarded =0; 
       
  3992     callInfo.iPrivacy               = RMobilePhone::EPrivacyUnspecified;
       
  3993     callInfo.iAlternatingCall       = RMobilePhone::EAlternatingModeUnspecified;    
       
  3994     
       
  3995 
       
  3996     callInfo.iDialledParty.iTelNumber.Copy( KSomeNumber );
       
  3997     callInfo.iDialledParty.iNumberPlan = RMobilePhone::EUnknownNumberingPlan;
       
  3998     callInfo.iDialledParty.iTypeOfNumber = RMobilePhone::EUnknownNumber;   
       
  3999 
       
  4000     TMockLtsyCallData2< RMobileCall::TMobileDataCallParamsV8, RMobileCall::TMobileCallInfoV8 >
       
  4001     mockCallData(expecteCallId, mobileService, callParams, callInfo);
       
  4002     mockCallData.SerialiseL(expectData);
       
  4003     
       
  4004     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4005 
       
  4006     TInt callId = 1;
       
  4007     
       
  4008     completeData.Close();
       
  4009     TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> callInfoData(callId, mobileService, callInfo);
       
  4010     callInfoData.SerialiseL(completeData);
       
  4011     //Complete Mobile Call Info in order to set the call ID 
       
  4012     iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, completeData);
       
  4013     
       
  4014     TMockLtsyCallData0 mockDataComplete(callId, mobileService);
       
  4015     completeData.Close();
       
  4016     mockDataComplete.SerialiseL(completeData);
       
  4017     // Complete the Dial
       
  4018     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4019 
       
  4020     RCall::TCallParams callParamsX;
       
  4021     callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  4022     callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  4023     callParamsX.iInterval        = 100;
       
  4024     callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  4025     TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX);
       
  4026         
       
  4027     call.Dial(requestStatus, pckgCallParamsX, KSomeNumber);   
       
  4028         
       
  4029     User::WaitForRequest(requestStatus);          
       
  4030     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  4031     AssertMockLtsyStatusL();   
       
  4032     
       
  4033     CleanupStack::PopAndDestroy(5,this);
       
  4034     
       
  4035     }
       
  4036 
       
  4037 
       
  4038 /**
       
  4039 @SYMTestCaseID BA-CTSY-CCON-CD-0007
       
  4040 @SYMComponent  telephony_ctsy
       
  4041 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::Dial for data calls
       
  4042 @SYMTestPriority High
       
  4043 @SYMTestActions Invokes cancelling of RCall::Dial for data calls
       
  4044 @SYMTestExpectedResults Pass
       
  4045 @SYMTestType CT
       
  4046 */
       
  4047 void CCTsyCallControlFU::TestDial0007L()
       
  4048 	{
       
  4049 
       
  4050 	OpenEtelServerL(EUseExtendedError);
       
  4051 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4052 	OpenPhoneL();
       
  4053 
       
  4054     RBuf8 expectData;
       
  4055     CleanupClosePushL(expectData);
       
  4056 
       
  4057     RBuf8 completeData;
       
  4058     CleanupClosePushL(completeData);
       
  4059 
       
  4060 	RLine line;
       
  4061 	RCall call;
       
  4062 	
       
  4063 	TInt errorCode = KErrNone;
       
  4064 	TRequestStatus requestStatus;
       
  4065     TRequestStatus mockLtsyStatus;
       
  4066 
       
  4067 	// open new line and call for KMmTsyDataLineName
       
  4068 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  4069 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4070 
       
  4071 	TName name;
       
  4072 
       
  4073 	_LIT(KPhoneNumber, "135468456456");   	
       
  4074    	
       
  4075 	TInt callId = 1;
       
  4076     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  4077 
       
  4078 	RMobileCall::TMobileDataCallParamsV1 callParams;
       
  4079     callParams.iInterval = 4;
       
  4080     callParams.iCug.iCugIndex = 0xFFFF;
       
  4081     
       
  4082 	RMobileCall::TMobileCallInfoV8 callInfo;
       
  4083 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  4084 	callInfo.iService = mobileService;
       
  4085 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  4086 	
       
  4087 	
       
  4088     RMobileCall::TMobileCallStatus  mobileCallStatus2 = RMobileCall::EStatusIdle; 
       
  4089     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallDataStatus2(callId, mobileService, mobileCallStatus2);
       
  4090     completeData.Close();
       
  4091     mockCallDataStatus2.SerialiseL(completeData);
       
  4092 		
       
  4093 	
       
  4094     // Call Specific data
       
  4095 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  4096 		mockData2(0, mobileService, callParams, callInfo);
       
  4097 
       
  4098 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  4099 	TPckg<RMobileCall::TMobileDataCallParamsV1> pckgMockParams1(callParams);
       
  4100 	
       
  4101     expectData.Close();
       
  4102     mockData2.SerialiseL(expectData);
       
  4103 	
       
  4104     DialDataCallAndCancelL(line,pckgMockParams1,expectData,completeData);
       
  4105 	
       
  4106 	//------------------------------------------------------------------
       
  4107 	// TMobileDataCallParamsV2
       
  4108 	
       
  4109 	RMobileCall::TMobileDataCallParamsV2 dataCallParams2;
       
  4110     dataCallParams2.iInterval = 4;
       
  4111     dataCallParams2.iCug.iCugIndex = 0xFFFF;
       
  4112     
       
  4113 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  4114 		mockDataCall2(0, mobileService, dataCallParams2, callInfo);
       
  4115 
       
  4116 	TPckg<RMobileCall::TMobileDataCallParamsV2> pckgMockDataCallParams2(dataCallParams2);
       
  4117 	
       
  4118     expectData.Close();
       
  4119     mockDataCall2.SerialiseL(expectData);
       
  4120     
       
  4121     DialDataCallAndCancelL(line,pckgMockDataCallParams2,expectData,completeData);
       
  4122 	
       
  4123 	//------------------------------------------------------------------
       
  4124 	// TMobileDataCallParamsV8
       
  4125 	
       
  4126 	RMobileCall::TMobileDataCallParamsV8 dataCallParams8;
       
  4127     dataCallParams8.iInterval = 4;
       
  4128     dataCallParams8.iCug.iCugIndex = 0xFFFF;
       
  4129     
       
  4130 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  4131 		mockDataCall8(0, mobileService, dataCallParams8, callInfo);
       
  4132 
       
  4133 	TPckg<RMobileCall::TMobileDataCallParamsV8> pckgMockDataCallParams8(dataCallParams8);
       
  4134 	
       
  4135     expectData.Close();
       
  4136     mockDataCall8.SerialiseL(expectData);
       
  4137 
       
  4138     DialDataCallAndCancelL(line,pckgMockDataCallParams8,expectData,completeData);
       
  4139     
       
  4140 	//------------------------------------------------------------------
       
  4141 	// TMobileHscsdCallParamsV1
       
  4142 		
       
  4143 	RMobileCall::TMobileHscsdCallParamsV1 hscsdCallParams;
       
  4144 	hscsdCallParams.iInterval = 4;
       
  4145 	hscsdCallParams.iCug.iCugIndex = 0xFFFF;
       
  4146     
       
  4147 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  4148 		mockHscsdCall(0, mobileService, hscsdCallParams, callInfo);
       
  4149 
       
  4150 	TPckg<RMobileCall::TMobileHscsdCallParamsV1> pckgMockHscsdCallParams(hscsdCallParams);
       
  4151 	
       
  4152     expectData.Close();
       
  4153     mockHscsdCall.SerialiseL(expectData);
       
  4154 
       
  4155     DialDataCallAndCancelL(line,pckgMockHscsdCallParams,expectData,completeData);
       
  4156 	
       
  4157 	//------------------------------------------------------------------
       
  4158 	// TMobileHscsdCallParamsV2
       
  4159 		
       
  4160 	RMobileCall::TMobileHscsdCallParamsV2 hscsdCallParams2;
       
  4161 	hscsdCallParams2.iInterval = 4;
       
  4162 	hscsdCallParams2.iCug.iCugIndex = 0xFFFF;
       
  4163     
       
  4164 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  4165 		mockHscsdCall2(0, mobileService, hscsdCallParams2, callInfo);
       
  4166 
       
  4167 	TPckg<RMobileCall::TMobileHscsdCallParamsV2> pckgMockHscsdCallParams2(hscsdCallParams2);
       
  4168 	
       
  4169     expectData.Close();
       
  4170     mockHscsdCall2.SerialiseL(expectData);
       
  4171 
       
  4172     DialDataCallAndCancelL(line,pckgMockHscsdCallParams2,expectData,completeData);
       
  4173 	
       
  4174 	//------------------------------------------------------------------
       
  4175 	// TMobileHscsdCallParamsV7
       
  4176 		
       
  4177 	RMobileCall::TMobileHscsdCallParamsV7 hscsdCallParams7;
       
  4178 	hscsdCallParams7.iInterval = 4;
       
  4179 	hscsdCallParams7.iCug.iCugIndex = 0xFFFF;
       
  4180     
       
  4181 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
  4182 		mockHscsdCall7(0, mobileService, hscsdCallParams7, callInfo);
       
  4183 
       
  4184 	TPckg<RMobileCall::TMobileHscsdCallParamsV7> pckgMockHscsdCallParams7(hscsdCallParams7);
       
  4185 	
       
  4186     expectData.Close();
       
  4187     mockHscsdCall7.SerialiseL(expectData);
       
  4188     
       
  4189     DialDataCallAndCancelL(line,pckgMockHscsdCallParams7,expectData,completeData);
       
  4190 	
       
  4191 		
       
  4192 	//------------------------------------------------------------------
       
  4193 	// TMobileHscsdCallParamsV8
       
  4194 		
       
  4195 	RMobileCall::TMobileHscsdCallParamsV8 hscsdCallParams8;
       
  4196 	hscsdCallParams8.iInterval = 4;
       
  4197 	hscsdCallParams8.iCug.iCugIndex = 0xFFFF;
       
  4198     
       
  4199 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  4200 		mockHscsdCall8(0, mobileService, hscsdCallParams8, callInfo);
       
  4201 
       
  4202 	TPckg<RMobileCall::TMobileHscsdCallParamsV8> pckgMockHscsdCallParams8(hscsdCallParams8);
       
  4203 	
       
  4204     expectData.Close();
       
  4205     mockHscsdCall8.SerialiseL(expectData);
       
  4206 
       
  4207     DialDataCallAndCancelL(line,pckgMockHscsdCallParams8,expectData,completeData);
       
  4208 	CleanupStack::PopAndDestroy(4); // expectData, completeData, this, this
       
  4209 	}
       
  4210 
       
  4211 void
       
  4212 CCTsyCallControlFU::DialDataCallAndCancelL(RLine& aLine,const TDesC8& aCallData,RBuf8& expectData,RBuf8& completeData)
       
  4213 	{
       
  4214 	// open new call
       
  4215 	
       
  4216 	TInt errorCode = KErrNone;
       
  4217 	TRequestStatus requestStatus;
       
  4218     TRequestStatus mockLtsyStatus;
       
  4219 	_LIT(KPhoneNumber, "135468456456");   	
       
  4220    	
       
  4221 	TInt callId = 1;
       
  4222     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  4223 	
       
  4224 	TName  name; 
       
  4225 	RCall call;
       
  4226 	CleanupClosePushL(call);
       
  4227 	errorCode = call.OpenNewCall(aLine, name);
       
  4228 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4229 
       
  4230 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4231 
       
  4232 
       
  4233 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4234 
       
  4235 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  4236 
       
  4237 	call.Dial(requestStatus, aCallData, KPhoneNumber);
       
  4238 
       
  4239 	User::WaitForRequest(mockLtsyStatus);
       
  4240 
       
  4241 	TInt hangUpCause = KErrGsmReleaseByUser;
       
  4242 	TBool autoStChangeDisable = EFalse;
       
  4243 	TMockLtsyCallData2<TInt, TBool> mockHangupData(callId, mobileService, 
       
  4244                                        hangUpCause, 
       
  4245                                        autoStChangeDisable);
       
  4246 	expectData.Close();
       
  4247 	mockHangupData.SerialiseL(expectData);
       
  4248 	iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  4249 
       
  4250 	call.CancelAsyncRequest(EEtelCallDial);
       
  4251 
       
  4252 
       
  4253 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  4254 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrGsmReleaseByUser, completeData);
       
  4255       
       
  4256 	User::WaitForRequest(requestStatus);
       
  4257 	User::WaitForRequest(requestStatus);
       
  4258 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
  4259 
       
  4260 	call.Close();
       
  4261 	AssertMockLtsyStatusL();
       
  4262 	CleanupStack::PopAndDestroy(1);
       
  4263 	}
       
  4264 
       
  4265 
       
  4266 
       
  4267 
       
  4268 /**
       
  4269 @SYMTestCaseID BA-CTSY-CCON-CD-0008
       
  4270 @SYMComponent  telephony_ctsy
       
  4271 @SYMTestCaseDesc Test support in CTSY for RCall::Dial with bad parameter data for data calls
       
  4272 @SYMTestPriority High
       
  4273 @SYMTestActions Invokes RCall::Dial with bad parameter data for data calls
       
  4274 @SYMTestExpectedResults Pass
       
  4275 @SYMTestType CT
       
  4276 */
       
  4277 void CCTsyCallControlFU::TestDial0008L()
       
  4278 	{
       
  4279 
       
  4280 // This test should test sending bad parameter data for Dial
       
  4281 // If this API does not have any parameters, then remove this test completely.
       
  4282 
       
  4283 	OpenEtelServerL(EUseExtendedError);
       
  4284 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4285 	OpenPhoneL();
       
  4286 
       
  4287     RBuf8 expectData;
       
  4288     CleanupClosePushL(expectData);
       
  4289 
       
  4290     RBuf8 completeData;
       
  4291     CleanupClosePushL(completeData);
       
  4292 
       
  4293 	RLine line;
       
  4294 	RCall call;
       
  4295 	
       
  4296 	TInt errorCode = KErrNone;
       
  4297     TRequestStatus requestStatus;
       
  4298 	TRequestStatus mockLtsyStatus;
       
  4299 	
       
  4300 	// open new line and call for KMmTsyDataLineName
       
  4301 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  4302 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4303 
       
  4304 	TName name;
       
  4305 
       
  4306 	_LIT(KPhoneNumber, "101632960000");   	
       
  4307    	
       
  4308 	TInt callId = 1;
       
  4309     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  4310 	
       
  4311 	TInt8 callParams;    // bad param
       
  4312 	TPckg<TInt8> paramPckg(callParams);
       
  4313 	
       
  4314 	//-------------------------------------------------------------------------
       
  4315 	// Test A: Test passing wrong version of parameters to
       
  4316 	// RCall::Dial
       
  4317  	//-------------------------------------------------------------------------
       
  4318 	
       
  4319 	// open new call   	
       
  4320 	CleanupClosePushL(call);
       
  4321    	errorCode = call.OpenNewCall(line, name);
       
  4322     ASSERT_EQUALS(KErrNone, errorCode);
       
  4323 
       
  4324 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  4325 		
       
  4326 	call.Dial(requestStatus, paramPckg, KPhoneNumber);
       
  4327 	User::WaitForRequest(requestStatus);
       
  4328 	ASSERT_EQUALS(KErrArgument, requestStatus.Int());
       
  4329 	
       
  4330 	call.Close();
       
  4331 	CleanupStack::PopAndDestroy(1);
       
  4332 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line
       
  4333 	
       
  4334 	}
       
  4335 
       
  4336 
       
  4337 /**
       
  4338 @SYMTestCaseID BA-CTSY-CCON-CD-0009
       
  4339 @SYMComponent  telephony_ctsy
       
  4340 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::Dial for data calls
       
  4341 @SYMTestPriority High
       
  4342 @SYMTestActions Invokes multiple client requests to RCall::Dial for data calls
       
  4343 @SYMTestExpectedResults Pass
       
  4344 @SYMTestType CT
       
  4345 */
       
  4346 void CCTsyCallControlFU::TestDial0009L()
       
  4347 	{
       
  4348 
       
  4349 					
       
  4350 	OpenEtelServerL(EUseExtendedError);
       
  4351 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4352 	OpenPhoneL();
       
  4353 
       
  4354     RBuf8 expectData;
       
  4355     CleanupClosePushL(expectData);
       
  4356 
       
  4357     RBuf8 completeData;
       
  4358     CleanupClosePushL(completeData);
       
  4359 
       
  4360 	// Open second client
       
  4361 	RTelServer telServer2;
       
  4362 	TInt ret = telServer2.Connect();
       
  4363 	ASSERT_EQUALS(KErrNone, ret);
       
  4364 	CleanupClosePushL(telServer2);
       
  4365 
       
  4366 	RMobilePhone phone2;
       
  4367 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4368 	ASSERT_EQUALS(KErrNone, ret);
       
  4369 	CleanupClosePushL(phone2);
       
  4370 
       
  4371 	RLine line1;
       
  4372 	RLine line2;
       
  4373 	
       
  4374 	RCall call1;
       
  4375 	RCall call2;
       
  4376 	
       
  4377 	TInt errorCode = KErrNone;
       
  4378     TRequestStatus requestStatus1;
       
  4379     TRequestStatus requestStatus2;
       
  4380 
       
  4381 	// open new line1 and call for KMmTsyDataLineName
       
  4382 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyDataLineName);
       
  4383 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4384 
       
  4385 	// open new line2 and call for KMmTsyDataLineName
       
  4386 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyDataLineName);
       
  4387 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4388 
       
  4389 	TName name;
       
  4390 
       
  4391 	_LIT(KPhoneNumber1, "101632960000");   	
       
  4392 	_LIT(KPhoneNumber2, "654654864531");   	
       
  4393    	
       
  4394 	TInt callId1 = 1;
       
  4395 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  4396 
       
  4397 	RMobileCall::TMobileDataCallParamsV1 callParams;
       
  4398     callParams.iInterval = 4;
       
  4399     callParams.iCug.iCugIndex = 0xFFFF;
       
  4400     
       
  4401 	RMobileCall::TMobileCallInfoV8 callInfo1;
       
  4402 	callInfo1.iDialledParty.iTelNumber.Copy(KPhoneNumber1);
       
  4403 	callInfo1.iService = mobileService;
       
  4404 	callInfo1.iValid = RMobileCall::KCallDialledParty |RMobileCall::KCallAlternating;
       
  4405 
       
  4406 	RMobileCall::TMobileCallInfoV8 callInfo2;
       
  4407 	callInfo2.iDialledParty.iTelNumber.Copy(KPhoneNumber2);
       
  4408 	callInfo2.iService = mobileService;
       
  4409 	callInfo2.iValid = RMobileCall::KCallDialledParty |RMobileCall::KCallAlternating;
       
  4410 	
       
  4411 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  4412 		mockData21(0, mobileService, callParams, callInfo1);
       
  4413 
       
  4414 	TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  4415 	
       
  4416 	TPckg<RMobileCall::TMobileDataCallParamsV1> pckgMockParams1(callParams);
       
  4417 
       
  4418 	//-------------------------------------------------------------------------
       
  4419 	// Test A: Test multiple clients requesting RCall::Dial
       
  4420  	//-------------------------------------------------------------------------
       
  4421 
       
  4422 	// call first clinet
       
  4423 	// open new call1
       
  4424    	CleanupClosePushL(call1);
       
  4425    	errorCode = call1.OpenNewCall(line1, name);
       
  4426     ASSERT_EQUALS(KErrNone, errorCode);
       
  4427 
       
  4428 	expectData.Close();
       
  4429 	mockData21.SerialiseL(expectData);
       
  4430     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4431 
       
  4432     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4433     
       
  4434     mockData01.SerialiseL(completeData);
       
  4435     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4436    	
       
  4437    	call1.Dial(requestStatus1, pckgMockParams1, KPhoneNumber1);
       
  4438 
       
  4439 	// call second clinet
       
  4440 	// open new call
       
  4441    	CleanupClosePushL(call2);
       
  4442    	errorCode = call2.OpenNewCall(line2, name);
       
  4443     ASSERT_EQUALS(KErrNone, errorCode);
       
  4444 
       
  4445    	call2.Dial(requestStatus2, pckgMockParams1, KPhoneNumber2);
       
  4446    	
       
  4447     User::WaitForRequest(requestStatus1);
       
  4448     AssertMockLtsyStatusL();
       
  4449     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4450    
       
  4451     User::WaitForRequest(requestStatus2);
       
  4452     AssertMockLtsyStatusL();
       
  4453     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4454         
       
  4455 	call1.Close();
       
  4456 	AssertMockLtsyStatusL();
       
  4457 	CleanupStack::PopAndDestroy(1);
       
  4458 
       
  4459 	call2.Close();
       
  4460 	AssertMockLtsyStatusL();
       
  4461 	CleanupStack::PopAndDestroy(1);
       
  4462 	
       
  4463 	//-----------------------------------------------------------------------
       
  4464 	// TMobileDataCallParamsV2
       
  4465 	RMobileCall::TMobileDataCallParamsV2 dataCallParams2;
       
  4466     dataCallParams2.iInterval = 4;
       
  4467     dataCallParams2.iCug.iCugIndex = 0xFFFF;
       
  4468     
       
  4469 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  4470 		mockDataCall21(0, mobileService, dataCallParams2, callInfo1);
       
  4471 
       
  4472 	TPckg<RMobileCall::TMobileDataCallParamsV2> pckgMockDataCallParams2(dataCallParams2);
       
  4473 
       
  4474 	//-------------------------------------------------------------------------
       
  4475 	// Test A2: Test multiple clients requesting RCall::Dial
       
  4476  	//-------------------------------------------------------------------------
       
  4477 
       
  4478 	// call first clinet
       
  4479 	// open new call1
       
  4480    	CleanupClosePushL(call1);
       
  4481    	errorCode = call1.OpenNewCall(line1, name);
       
  4482     ASSERT_EQUALS(KErrNone, errorCode);
       
  4483 
       
  4484 	expectData.Close();
       
  4485 	mockDataCall21.SerialiseL(expectData);
       
  4486     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4487 
       
  4488     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4489     
       
  4490     mockData01.SerialiseL(completeData);
       
  4491     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4492    	
       
  4493    	call1.Dial(requestStatus1, pckgMockDataCallParams2, KPhoneNumber1);
       
  4494 
       
  4495 	// call second clinet
       
  4496 	// open new call
       
  4497    	CleanupClosePushL(call2);
       
  4498    	errorCode = call2.OpenNewCall(line2, name);
       
  4499     ASSERT_EQUALS(KErrNone, errorCode);
       
  4500 
       
  4501    	call2.Dial(requestStatus2, pckgMockDataCallParams2, KPhoneNumber2);
       
  4502 
       
  4503     User::WaitForRequest(requestStatus1);
       
  4504     AssertMockLtsyStatusL();
       
  4505     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4506 
       
  4507     User::WaitForRequest(requestStatus2);
       
  4508     AssertMockLtsyStatusL();
       
  4509     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4510 
       
  4511 	call1.Close();
       
  4512 	AssertMockLtsyStatusL();
       
  4513 	CleanupStack::PopAndDestroy(1);
       
  4514 
       
  4515 	call2.Close();
       
  4516 	AssertMockLtsyStatusL();
       
  4517 	CleanupStack::PopAndDestroy(1);
       
  4518 
       
  4519 	//-----------------------------------------------------------------------
       
  4520 	// TMobileDataCallParamsV8
       
  4521 	
       
  4522 	RMobileCall::TMobileDataCallParamsV8 dataCallParams8;
       
  4523 	dataCallParams8.iInterval = 2;
       
  4524     dataCallParams8.iCug.iCugIndex = 0xFFFF;
       
  4525     dataCallParams8.iSpeakerControl = RCall::EMonitorSpeakerControlAlwaysOff;
       
  4526     dataCallParams8.iSpeakerVolume = RCall::EMonitorSpeakerVolumeMedium;
       
  4527     dataCallParams8.iWaitForDialTone = RCall::EDialToneWait;
       
  4528     dataCallParams8.iQoS = RMobileCall::EQosTransparentPreferred;
       
  4529     dataCallParams8.iV42bisReq = RMobileCall::EV42bisTxDirection;
       
  4530     dataCallParams8.iBearerMode = RMobileCall::EMulticallShareBearer;
       
  4531     dataCallParams8.iSubAddress.Copy(_L("An Unknown SubAddress"));
       
  4532     dataCallParams8.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  4533     dataCallParams8.iAlphaId.Copy(_L("Alpha Id"));
       
  4534     
       
  4535     RMobileCall::TMobileCallInfoV8 callInformation;
       
  4536     callInformation.iDialledParty.iTelNumber.Copy(KPhoneNumber1);
       
  4537     callInformation.iService = mobileService;
       
  4538     callInformation.iValid |= RMobileCall::KCallDialledParty;
       
  4539     callInformation.iValid |= RMobileCall::KCallAlternating;
       
  4540     callInformation.iAlphaId.Copy(_L("Alpha Id"));
       
  4541     callInformation.iValid |= RMobileCall::KCallAlphaId;
       
  4542     callInformation.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  4543     callInformation.iValid |= RMobileCall::KCallParamOrigin;
       
  4544 
       
  4545 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  4546 		mockDataCall81(0, mobileService, dataCallParams8, callInformation);
       
  4547 
       
  4548 	TPckg<RMobileCall::TMobileDataCallParamsV8> pckgMockDataCallParams8(dataCallParams8);
       
  4549 
       
  4550 	//-------------------------------------------------------------------------
       
  4551 	// Test A3: Test multiple clients requesting RCall::Dial
       
  4552  	//-------------------------------------------------------------------------
       
  4553 
       
  4554 	// call first clinet
       
  4555 	// open new call1
       
  4556    	CleanupClosePushL(call1);
       
  4557    	errorCode = call1.OpenNewCall(line1, name);
       
  4558     ASSERT_EQUALS(KErrNone, errorCode);
       
  4559 
       
  4560 	expectData.Close();
       
  4561 	mockDataCall81.SerialiseL(expectData);
       
  4562     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4563     
       
  4564     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4565 
       
  4566     mockData01.SerialiseL(completeData);
       
  4567     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4568    	
       
  4569    	call1.Dial(requestStatus1, pckgMockDataCallParams8, KPhoneNumber1);
       
  4570 
       
  4571 	// call second clinet
       
  4572 	// open new call
       
  4573    	CleanupClosePushL(call2);
       
  4574    	errorCode = call2.OpenNewCall(line2, name);
       
  4575     ASSERT_EQUALS(KErrNone, errorCode);
       
  4576 
       
  4577    	call2.Dial(requestStatus2, pckgMockDataCallParams8, KPhoneNumber2);
       
  4578 
       
  4579     User::WaitForRequest(requestStatus1);
       
  4580     AssertMockLtsyStatusL();
       
  4581     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4582 
       
  4583     User::WaitForRequest(requestStatus2);
       
  4584     AssertMockLtsyStatusL();
       
  4585     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4586 
       
  4587 	call1.Close();
       
  4588 	AssertMockLtsyStatusL();
       
  4589 	CleanupStack::PopAndDestroy(1);
       
  4590 
       
  4591 	call2.Close();
       
  4592 	AssertMockLtsyStatusL();
       
  4593 	CleanupStack::PopAndDestroy(1);
       
  4594 		
       
  4595 	// Done !
       
  4596 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, expectData, completeData, this
       
  4597 	                                      // line1, line2
       
  4598 	}
       
  4599 
       
  4600 
       
  4601 /**
       
  4602 @SYMTestCaseID BA-CTSY-CCON-CD-0009b
       
  4603 @SYMComponent  telephony_ctsy
       
  4604 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::Dial for data calls with HscsdCallParams. It is in connection to BA-CTSY-CCON-CD-0009 
       
  4605 @SYMTestPriority High
       
  4606 @SYMTestActions Invokes multiple client requests to RCall::Dial for data calls
       
  4607 @SYMTestExpectedResults Pass
       
  4608 @SYMTestType CT
       
  4609 */
       
  4610 void CCTsyCallControlFU::TestDial0009bL()
       
  4611 	{
       
  4612 
       
  4613 					
       
  4614 	OpenEtelServerL(EUseExtendedError);
       
  4615 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4616 	OpenPhoneL();
       
  4617 
       
  4618     RBuf8 expectData;
       
  4619     CleanupClosePushL(expectData);
       
  4620 
       
  4621     RBuf8 completeData;
       
  4622     CleanupClosePushL(completeData);
       
  4623 
       
  4624 	// Open second client
       
  4625 	RTelServer telServer2;
       
  4626 	TInt ret = telServer2.Connect();
       
  4627 	ASSERT_EQUALS(KErrNone, ret);
       
  4628 	CleanupClosePushL(telServer2);
       
  4629 
       
  4630 	RMobilePhone phone2;
       
  4631 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4632 	ASSERT_EQUALS(KErrNone, ret);
       
  4633 	CleanupClosePushL(phone2);
       
  4634 
       
  4635 	RLine line1;
       
  4636 	RLine line2;
       
  4637 	
       
  4638 	RCall call1;
       
  4639 	RCall call2;
       
  4640 	
       
  4641 	TInt errorCode = KErrNone;
       
  4642     TRequestStatus requestStatus1;
       
  4643     TRequestStatus requestStatus2;
       
  4644 
       
  4645 	// open new line1 and call for KMmTsyDataLineName
       
  4646 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyDataLineName);
       
  4647 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4648 
       
  4649 	// open new line2 and call for KMmTsyDataLineName
       
  4650 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyDataLineName);
       
  4651 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4652 
       
  4653 	TName name;
       
  4654 
       
  4655 	_LIT(KPhoneNumber1, "101632960000");   	
       
  4656 	_LIT(KPhoneNumber2, "654654864531");   	
       
  4657    	
       
  4658 	TInt callId1 = 1;
       
  4659 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  4660 
       
  4661 	RMobileCall::TMobileCallInfoV8 callInfo1;
       
  4662 	callInfo1.iDialledParty.iTelNumber.Copy(KPhoneNumber1);
       
  4663 	callInfo1.iService = mobileService;
       
  4664 	callInfo1.iValid = RMobileCall::KCallDialledParty |RMobileCall::KCallAlternating;
       
  4665 
       
  4666 	RMobileCall::TMobileCallInfoV8 callInfo2;
       
  4667 	callInfo2.iDialledParty.iTelNumber.Copy(KPhoneNumber2);
       
  4668 	callInfo2.iService = mobileService;
       
  4669 	callInfo2.iValid = RMobileCall::KCallDialledParty |RMobileCall::KCallAlternating;
       
  4670 	
       
  4671 	//-----------------------------------------------------------------------
       
  4672 	// TMobileHscsdCallParamsV1
       
  4673 	RMobileCall::TMobileHscsdCallParamsV1 hscsdCallParams1;
       
  4674 	hscsdCallParams1.iInterval = 4;
       
  4675 	hscsdCallParams1.iCug.iCugIndex = 0xFFFF;
       
  4676     
       
  4677 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
  4678 		mockHscsdCall11(0, mobileService, hscsdCallParams1, callInfo1);
       
  4679 
       
  4680 	TPckg<RMobileCall::TMobileHscsdCallParamsV1> pckgMockHscsdCallParams1(hscsdCallParams1);
       
  4681 	TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  4682 	//-------------------------------------------------------------------------
       
  4683 	// Test A4: Test multiple clients requesting RCall::Dial
       
  4684  	//-------------------------------------------------------------------------
       
  4685 
       
  4686 	// call first clinet
       
  4687 	// open new call1
       
  4688    	CleanupClosePushL(call1);
       
  4689    	errorCode = call1.OpenNewCall(line1, name);
       
  4690     ASSERT_EQUALS(KErrNone, errorCode);
       
  4691 
       
  4692 	expectData.Close();
       
  4693 	mockHscsdCall11.SerialiseL(expectData);
       
  4694     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4695 
       
  4696     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4697     
       
  4698     mockData01.SerialiseL(completeData);
       
  4699     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4700    	
       
  4701    	call1.Dial(requestStatus1, pckgMockHscsdCallParams1, KPhoneNumber1);
       
  4702 
       
  4703 	// call second clinet
       
  4704 	// open new call
       
  4705    	CleanupClosePushL(call2);
       
  4706    	errorCode = call2.OpenNewCall(line2, name);
       
  4707     ASSERT_EQUALS(KErrNone, errorCode);
       
  4708 
       
  4709    	call2.Dial(requestStatus2, pckgMockHscsdCallParams1, KPhoneNumber2);
       
  4710 
       
  4711     User::WaitForRequest(requestStatus1);
       
  4712     AssertMockLtsyStatusL();
       
  4713     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4714 
       
  4715     User::WaitForRequest(requestStatus2);
       
  4716     AssertMockLtsyStatusL();
       
  4717     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4718 
       
  4719 	call1.Close();
       
  4720 	AssertMockLtsyStatusL();
       
  4721 	CleanupStack::PopAndDestroy(1);
       
  4722 	
       
  4723 	call2.Close();
       
  4724 	AssertMockLtsyStatusL();
       
  4725 	CleanupStack::PopAndDestroy(1);
       
  4726 
       
  4727 	//-----------------------------------------------------------------------
       
  4728 	// TMobileHscsdCallParamsV2
       
  4729 	RMobileCall::TMobileHscsdCallParamsV2 hscsdCallParams2;
       
  4730 	hscsdCallParams2.iInterval = 4;
       
  4731 	hscsdCallParams2.iCug.iCugIndex = 0xFFFF;
       
  4732     
       
  4733 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV2, RMobileCall::TMobileCallInfoV8> 
       
  4734 		mockHscsdCall21(0, mobileService, hscsdCallParams2, callInfo1);
       
  4735 
       
  4736 	TPckg<RMobileCall::TMobileHscsdCallParamsV2> pckgMockHscsdCallParams2(hscsdCallParams2);
       
  4737 
       
  4738 	//-------------------------------------------------------------------------
       
  4739 	// Test A5: Test multiple clients requesting RCall::Dial
       
  4740  	//-------------------------------------------------------------------------
       
  4741 
       
  4742 	// call first clinet
       
  4743 	// open new call1
       
  4744    	CleanupClosePushL(call1);
       
  4745    	errorCode = call1.OpenNewCall(line1, name);
       
  4746     ASSERT_EQUALS(KErrNone, errorCode);
       
  4747 
       
  4748 	expectData.Close();
       
  4749 	mockHscsdCall21.SerialiseL(expectData);
       
  4750     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4751 
       
  4752     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4753     
       
  4754     mockData01.SerialiseL(completeData);
       
  4755     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4756    	
       
  4757    	call1.Dial(requestStatus1, pckgMockHscsdCallParams2, KPhoneNumber1);
       
  4758 
       
  4759 	// call second clinet
       
  4760 	// open new call
       
  4761    	CleanupClosePushL(call2);
       
  4762    	errorCode = call2.OpenNewCall(line2, name);
       
  4763     ASSERT_EQUALS(KErrNone, errorCode);
       
  4764 
       
  4765    	call2.Dial(requestStatus2, pckgMockHscsdCallParams2, KPhoneNumber2);
       
  4766 
       
  4767     User::WaitForRequest(requestStatus1);
       
  4768     AssertMockLtsyStatusL();
       
  4769     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4770 
       
  4771     User::WaitForRequest(requestStatus2);
       
  4772     AssertMockLtsyStatusL();
       
  4773     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4774 
       
  4775 	call1.Close();
       
  4776 	AssertMockLtsyStatusL();
       
  4777 	CleanupStack::PopAndDestroy(1);
       
  4778 	
       
  4779 	call2.Close();
       
  4780 	AssertMockLtsyStatusL();
       
  4781 	CleanupStack::PopAndDestroy(1);
       
  4782 
       
  4783 	//-----------------------------------------------------------------------
       
  4784 	// TMobileHscsdCallParamsV7
       
  4785 	RMobileCall::TMobileHscsdCallParamsV7 hscsdCallParams7;
       
  4786 	hscsdCallParams7.iInterval = 4;
       
  4787 	hscsdCallParams7.iCug.iCugIndex = 0xFFFF;
       
  4788 	hscsdCallParams7.iAlphaId.Copy(_L("Alpha Id"));
       
  4789     hscsdCallParams7.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  4790     
       
  4791     RMobileCall::TMobileCallInfoV8 callInformation;
       
  4792     callInformation.iDialledParty.iTelNumber.Copy(KPhoneNumber1);
       
  4793     callInformation.iService = mobileService;
       
  4794     callInformation.iValid |= RMobileCall::KCallDialledParty;
       
  4795     callInformation.iValid |= RMobileCall::KCallAlternating;
       
  4796     callInformation.iAlphaId.Copy(_L("Alpha Id"));
       
  4797     callInformation.iValid |= RMobileCall::KCallAlphaId;
       
  4798     callInformation.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  4799     callInformation.iValid |= RMobileCall::KCallParamOrigin;
       
  4800     
       
  4801 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
  4802 		mockHscsdCall71(0, mobileService, hscsdCallParams7, callInformation);
       
  4803 
       
  4804 	TPckg<RMobileCall::TMobileHscsdCallParamsV7> pckgMockHscsdCallParams7(hscsdCallParams7);
       
  4805 
       
  4806 	//-------------------------------------------------------------------------
       
  4807 	// Test A6: Test multiple clients requesting RCall::Dial
       
  4808  	//-------------------------------------------------------------------------
       
  4809 
       
  4810 	// call first clinet
       
  4811 	// open new call1
       
  4812    	CleanupClosePushL(call1);
       
  4813    	errorCode = call1.OpenNewCall(line1, name);
       
  4814     ASSERT_EQUALS(KErrNone, errorCode);
       
  4815 
       
  4816 	expectData.Close();
       
  4817 	mockHscsdCall71.SerialiseL(expectData);
       
  4818     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4819 
       
  4820     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4821     
       
  4822     mockData01.SerialiseL(completeData);
       
  4823     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4824    	
       
  4825    	call1.Dial(requestStatus1, pckgMockHscsdCallParams7, KPhoneNumber1);
       
  4826 
       
  4827 	// call second clinet
       
  4828 	// open new call
       
  4829    	CleanupClosePushL(call2);
       
  4830    	errorCode = call2.OpenNewCall(line2, name);
       
  4831     ASSERT_EQUALS(KErrNone, errorCode);
       
  4832 
       
  4833    	call2.Dial(requestStatus2, pckgMockHscsdCallParams7, KPhoneNumber2);
       
  4834 
       
  4835     User::WaitForRequest(requestStatus1);
       
  4836     AssertMockLtsyStatusL();
       
  4837     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4838 
       
  4839     User::WaitForRequest(requestStatus2);
       
  4840     AssertMockLtsyStatusL();
       
  4841     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4842 
       
  4843 	call1.Close();
       
  4844 	AssertMockLtsyStatusL();
       
  4845 	CleanupStack::PopAndDestroy(1);
       
  4846 	
       
  4847 	call2.Close();
       
  4848 	AssertMockLtsyStatusL();
       
  4849 	CleanupStack::PopAndDestroy(1);
       
  4850 
       
  4851 	// Done !
       
  4852 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, expectData, completeData, this
       
  4853 	                                      // line1, line2
       
  4854 	}
       
  4855 
       
  4856 
       
  4857 /**
       
  4858 @SYMTestCaseID BA-CTSY-CCON-CD-0009c
       
  4859 @SYMComponent  telephony_ctsy
       
  4860 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::Dial for data calls with HscsdCallParamsV8. It is in connection to Test support in CTSY for multiple client requests to RCall::Dial for data calls with HscsdCallParamsV8. It is in connection to BA-CTSY-CCON-CD-0009b
       
  4861 @SYMTestPriority High
       
  4862 @SYMTestActions Invokes multiple client requests to RCall::Dial for data calls
       
  4863 @SYMTestExpectedResults Pass
       
  4864 @SYMTestType CT
       
  4865 */
       
  4866 void CCTsyCallControlFU::TestDial0009cL()
       
  4867 	{
       
  4868 					
       
  4869 	OpenEtelServerL(EUseExtendedError);
       
  4870 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  4871 	OpenPhoneL();
       
  4872 
       
  4873     RBuf8 expectData;
       
  4874     CleanupClosePushL(expectData);
       
  4875 
       
  4876     RBuf8 completeData;
       
  4877     CleanupClosePushL(completeData);
       
  4878 
       
  4879 	// Open second client
       
  4880 	RTelServer telServer2;
       
  4881 	TInt ret = telServer2.Connect();
       
  4882 	ASSERT_EQUALS(KErrNone, ret);
       
  4883 	CleanupClosePushL(telServer2);
       
  4884 
       
  4885 	RMobilePhone phone2;
       
  4886 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  4887 	ASSERT_EQUALS(KErrNone, ret);
       
  4888 	CleanupClosePushL(phone2);
       
  4889 
       
  4890 	RLine line1;
       
  4891 	RLine line2;
       
  4892 	
       
  4893 	RCall call1;
       
  4894 	RCall call2;
       
  4895 	
       
  4896 	TInt errorCode = KErrNone;
       
  4897     TRequestStatus requestStatus1;
       
  4898     TRequestStatus requestStatus2;
       
  4899 
       
  4900 	// open new line1 and call for KMmTsyDataLineName
       
  4901 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyDataLineName);
       
  4902 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4903 
       
  4904 	// open new line2 and call for KMmTsyDataLineName
       
  4905 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyDataLineName);
       
  4906 	ASSERT_EQUALS(KErrNone, errorCode);
       
  4907 
       
  4908 	TName name;
       
  4909 
       
  4910 	_LIT(KPhoneNumber1, "101632960000");   	
       
  4911 	_LIT(KPhoneNumber2, "654654864531");   	
       
  4912    	
       
  4913 	TInt callId1 = 1;
       
  4914 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  4915 
       
  4916 	RMobileCall::TMobileCallInfoV8 callInformation;
       
  4917     callInformation.iDialledParty.iTelNumber.Copy(KPhoneNumber1);
       
  4918     callInformation.iService = mobileService;
       
  4919     callInformation.iValid |= RMobileCall::KCallDialledParty;
       
  4920     callInformation.iValid |= RMobileCall::KCallAlternating;
       
  4921     callInformation.iAlphaId.Copy(_L("Alpha Id"));
       
  4922     callInformation.iValid |= RMobileCall::KCallAlphaId;
       
  4923     callInformation.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  4924     callInformation.iValid |= RMobileCall::KCallParamOrigin;
       
  4925 
       
  4926 		//-----------------------------------------------------------------------
       
  4927 	// TMobileHscsdCallParamsV8
       
  4928 	RMobileCall::TMobileHscsdCallParamsV8 hscsdCallParams8;
       
  4929 	hscsdCallParams8.iInterval = 4;
       
  4930 	hscsdCallParams8.iCug.iCugIndex = 0xFFFF;
       
  4931 	hscsdCallParams8.iAlphaId.Copy(_L("Alpha Id"));
       
  4932 	hscsdCallParams8.iCallParamOrigin = RMobileCall::EOriginatorSIM;
       
  4933     
       
  4934 	TMockLtsyCallData2<RMobileCall::TMobileHscsdCallParamsV8, RMobileCall::TMobileCallInfoV8> 
       
  4935 		mockHscsdCall81(0, mobileService, hscsdCallParams8, callInformation);
       
  4936 
       
  4937 	TPckg<RMobileCall::TMobileHscsdCallParamsV8> pckgMockHscsdCallParams8(hscsdCallParams8);
       
  4938 
       
  4939 	//-------------------------------------------------------------------------
       
  4940 	// Test A7: Test multiple clients requesting RCall::Dial
       
  4941  	//-------------------------------------------------------------------------
       
  4942 
       
  4943 	// call first clinet
       
  4944 	// open new call1
       
  4945    	CleanupClosePushL(call1);
       
  4946    	errorCode = call1.OpenNewCall(line1, name);
       
  4947     ASSERT_EQUALS(KErrNone, errorCode);
       
  4948 
       
  4949 	expectData.Close();
       
  4950 	mockHscsdCall81.SerialiseL(expectData);
       
  4951     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  4952 
       
  4953     CallGetMobileCallInfoL(callId1, mobileService, KPhoneNumber1);
       
  4954     call1.Dial(requestStatus1, pckgMockHscsdCallParams8, KPhoneNumber1);
       
  4955     
       
  4956     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  4957     mockData01.SerialiseL(completeData);
       
  4958     iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
  4959    	
       
  4960    	// call second clinet
       
  4961 	// open new call
       
  4962    	CleanupClosePushL(call2);
       
  4963    	errorCode = call2.OpenNewCall(line2, name);
       
  4964     ASSERT_EQUALS(KErrNone, errorCode);
       
  4965 
       
  4966    	call2.Dial(requestStatus2, pckgMockHscsdCallParams8, KPhoneNumber2);
       
  4967 
       
  4968     User::WaitForRequest(requestStatus1);
       
  4969     AssertMockLtsyStatusL();
       
  4970     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  4971 
       
  4972     User::WaitForRequest(requestStatus2);
       
  4973     AssertMockLtsyStatusL();
       
  4974     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  4975 
       
  4976 	call1.Close();
       
  4977 	AssertMockLtsyStatusL();
       
  4978 	CleanupStack::PopAndDestroy(1);
       
  4979 	
       
  4980 	call2.Close();
       
  4981 	AssertMockLtsyStatusL();
       
  4982 	CleanupStack::PopAndDestroy(1);
       
  4983 
       
  4984 	// Done !
       
  4985 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, expectData, completeData, this
       
  4986 	                                      // line1, line2
       
  4987 	}
       
  4988 
       
  4989 
       
  4990 
       
  4991 /**
       
  4992 @SYMTestCaseID BA-CTSY-CCON-CD-00010
       
  4993 @SYMComponent  telephony_ctsy
       
  4994 @SYMTestCaseDesc Test support in CTSY for RCall::Dial with timeout for data calls
       
  4995 @SYMTestPriority High
       
  4996 @SYMTestActions Invokes RCall::Dial and tests for timeout for data calls
       
  4997 @SYMTestExpectedResults Pass
       
  4998 @SYMTestType CT
       
  4999 */
       
  5000 void CCTsyCallControlFU::TestDial00010L()
       
  5001 	{
       
  5002 	OpenEtelServerL(EUseExtendedError);
       
  5003 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5004 	OpenPhoneL();
       
  5005 
       
  5006     RBuf8 expectData;
       
  5007     CleanupClosePushL(expectData);
       
  5008 
       
  5009     RBuf8 completeData;
       
  5010     CleanupClosePushL(completeData);
       
  5011 
       
  5012 	RLine line;
       
  5013 	RCall call;
       
  5014 	
       
  5015 	TInt errorCode = KErrNone;
       
  5016     TRequestStatus requestStatus;
       
  5017 
       
  5018 	// open new line and call for KMmTsyDataLineName
       
  5019 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  5020 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5021 
       
  5022 	TName name;
       
  5023 
       
  5024 	_LIT(KPhoneNumber, "101632960000");   	
       
  5025    	
       
  5026 	TInt callId = 1;
       
  5027     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  5028 
       
  5029 	RMobileCall::TMobileDataCallParamsV1 callParams;
       
  5030     callParams.iInterval = 4;
       
  5031     callParams.iCug.iCugIndex = 0xFFFF;
       
  5032     
       
  5033 	RMobileCall::TMobileCallInfoV1 callInfo;
       
  5034 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  5035 	callInfo.iService = mobileService;
       
  5036 	callInfo.iValid = RMobileCall::KCallDialledParty;
       
  5037 	
       
  5038 	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
  5039 		mockData2(0, mobileService, callParams, callInfo);
       
  5040 
       
  5041 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  5042 	TPckg<RMobileCall::TMobileDataCallParamsV1> pckgMockParams1(callParams);
       
  5043 
       
  5044 	//-------------------------------------------------------------------------
       
  5045 	// Test A: Test timeout of RCall::Dial
       
  5046  	//-------------------------------------------------------------------------
       
  5047  	
       
  5048 	// open new call
       
  5049    	CleanupClosePushL(call);
       
  5050    	errorCode = call.OpenNewCall(line, name);
       
  5051     ASSERT_EQUALS(KErrNone, errorCode);
       
  5052 
       
  5053 	expectData.Close();
       
  5054 	mockData2.SerialiseL(expectData);
       
  5055     iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
  5056     
       
  5057     CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
  5058 
       
  5059    	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  5060 
       
  5061     User::WaitForRequest(requestStatus);
       
  5062     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  5063 
       
  5064 	call.Close();
       
  5065 	AssertMockLtsyStatusL();
       
  5066 	CleanupStack::PopAndDestroy(1);
       
  5067 
       
  5068 	CleanupStack::PopAndDestroy(4); // expectData, completeData, this, this
       
  5069 	}
       
  5070 
       
  5071 
       
  5072 /**
       
  5073 @SYMTestCaseID BA-CTSY-CCON-CD-00011
       
  5074 @SYMComponent  telephony_ctsy
       
  5075 @SYMTestCaseDesc Test support in CTSY for RCall::Dial for fax calls
       
  5076 @SYMTestPriority High
       
  5077 @SYMTestActions Invokes RCall::Dial for fax calls
       
  5078 @SYMTestExpectedResults Pass
       
  5079 @SYMTestType CT
       
  5080 */
       
  5081 void CCTsyCallControlFU::TestDial00011L()
       
  5082 	{
       
  5083 
       
  5084 	OpenEtelServerL(EUseExtendedError);
       
  5085 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5086 	OpenPhoneL();
       
  5087 
       
  5088     RBuf8 expectData;
       
  5089     CleanupClosePushL(expectData);
       
  5090 
       
  5091     RBuf8 completeData;
       
  5092     CleanupClosePushL(completeData);
       
  5093 
       
  5094 	RLine line;
       
  5095 	RCall call;
       
  5096 	
       
  5097 	TInt errorCode = KErrNone;
       
  5098     TRequestStatus requestStatus;
       
  5099     TRequestStatus requestStatus2;
       
  5100 	TRequestStatus mockLtsyStatus;
       
  5101 	
       
  5102 	// open new line and call for KMmTsyVoice1LineName
       
  5103 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  5104 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5105 
       
  5106 	TName name;
       
  5107 
       
  5108 	_LIT(KPhoneNumber, "101632960000");   	
       
  5109    	
       
  5110 	TInt callId = 1;
       
  5111     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  5112 			
       
  5113 	RMobileCall::TMobileCallParamsV1 callParams;
       
  5114     callParams.iInterval = 4;
       
  5115     callParams.iCug.iCugIndex = 0xFFFF;
       
  5116     
       
  5117 	RMobileCall::TMobileCallInfoV1 callInfo;
       
  5118 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
  5119 	callInfo.iService = mobileService;
       
  5120 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
  5121 	
       
  5122 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
  5123 		mockData2(0, mobileService, callParams, callInfo);
       
  5124 
       
  5125 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  5126 	TPckg<RMobileCall::TMobileCallParamsV1> pckgMockParams1(callParams);
       
  5127 	
       
  5128  	//-------------------------------------------------------------------------
       
  5129 	// TEST A: failure to dispatch request to LTSY
       
  5130  	//-------------------------------------------------------------------------
       
  5131 
       
  5132 	// open new call
       
  5133    	CleanupClosePushL(call);
       
  5134    	errorCode = call.OpenNewCall(line, name);
       
  5135     ASSERT_EQUALS(KErrNone, errorCode);
       
  5136 
       
  5137 	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  5138 	User::WaitForRequest(requestStatus);
       
  5139 	AssertMockLtsyStatusL();
       
  5140 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5141 
       
  5142 	call.Close();
       
  5143 	AssertMockLtsyStatusL();
       
  5144 	CleanupStack::PopAndDestroy(1);
       
  5145 
       
  5146  	//-------------------------------------------------------------------------
       
  5147 	// TEST E: Unsolicited completion of RCall::Dial
       
  5148 	// from LTSY.
       
  5149  	//-------------------------------------------------------------------------
       
  5150 
       
  5151 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5152 	expectData.Close();
       
  5153     mockData0.SerialiseL(expectData);
       
  5154 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, expectData);
       
  5155 	User::WaitForRequest(mockLtsyStatus);
       
  5156 	AssertMockLtsyStatusL();
       
  5157 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5158 
       
  5159 	//-------------------------------------------------------------------------
       
  5160 	// TEST : to increase CMmFaxCallTsy::Dial coverage
       
  5161 	// covers "if( call->GetDialFlag() )" condition
       
  5162  	//-------------------------------------------------------------------------
       
  5163 
       
  5164 	// open new call
       
  5165    	CleanupClosePushL(call);
       
  5166    	errorCode = call.OpenNewCall(line, name);
       
  5167     ASSERT_EQUALS(KErrNone, errorCode);
       
  5168 
       
  5169 	// open new call
       
  5170 	RCall call2;
       
  5171    	CleanupClosePushL(call2);
       
  5172    	errorCode = call2.OpenNewCall(line, name);
       
  5173     ASSERT_EQUALS(KErrNone, errorCode);
       
  5174 
       
  5175 	call.Dial(requestStatus, pckgMockParams1, KPhoneNumber);
       
  5176 
       
  5177 	call2.Dial(requestStatus2, pckgMockParams1, KPhoneNumber);
       
  5178 
       
  5179 	User::WaitForRequest(requestStatus);
       
  5180 	AssertMockLtsyStatusL();
       
  5181 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5182 
       
  5183 	User::WaitForRequest(requestStatus2);
       
  5184 	AssertMockLtsyStatusL();
       
  5185 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  5186 
       
  5187 	call.Close();
       
  5188 	AssertMockLtsyStatusL();
       
  5189 	CleanupStack::PopAndDestroy(1);
       
  5190 
       
  5191 	call2.Close();
       
  5192 	AssertMockLtsyStatusL();
       
  5193 	CleanupStack::PopAndDestroy(1);
       
  5194 
       
  5195 	//-------------------------------------------------------------------------
       
  5196 	// TEST : to increase CMmFaxCallTsy::Dial coverage
       
  5197 	// covers "if ( ERfsStateInfoInactive == iMmPhone->GetRfStateInfo() )" condition
       
  5198  	//-------------------------------------------------------------------------
       
  5199 
       
  5200 	// open new call
       
  5201    	CleanupClosePushL(call);
       
  5202    	errorCode = call.OpenNewCall(line, name);
       
  5203     ASSERT_EQUALS(KErrNone, errorCode);
       
  5204 
       
  5205 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5206 	TRfStateInfo rfInfo = ERfsStateInfoInactive;
       
  5207 	TMockLtsyData1<TRfStateInfo> mockData1(rfInfo);
       
  5208     expectData.Close();
       
  5209     mockData1.SerialiseL(expectData);
       
  5210 	iMockLTSY.CompleteL(EMmTsyBootGetRFStatusIPC, KErrNone, expectData);
       
  5211 	User::WaitForRequest(mockLtsyStatus);
       
  5212 	AssertMockLtsyStatusL();
       
  5213 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5214 
       
  5215 	RCall::TCallParams callParamsX;
       
  5216 	TPckg<RCall::TCallParams> pckgCallParamsX(callParamsX);
       
  5217 	callParamsX.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
  5218 	callParamsX.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
  5219 	callParamsX.iInterval        = 100;
       
  5220 	callParamsX.iWaitForDialTone = RCall::EDialToneWait;
       
  5221 	
       
  5222 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  5223 	User::WaitForRequest(requestStatus);
       
  5224 	AssertMockLtsyStatusL();
       
  5225 	ASSERT_EQUALS(KErrGsmOfflineOpNotAllowed, requestStatus.Int());
       
  5226 
       
  5227 	call.Close();
       
  5228 	AssertMockLtsyStatusL();
       
  5229 	CleanupStack::PopAndDestroy(1);
       
  5230 
       
  5231 	//-------------------------------------------------------------------------
       
  5232 	// TEST : to increase CMmFaxCallTsy::Dial coverage
       
  5233 	// covers "else if ( RMobileCall::EStatusIdle != iMobileCallStatus )" condition
       
  5234  	//-------------------------------------------------------------------------
       
  5235 
       
  5236 	TName incomingCallName;
       
  5237     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  5238 
       
  5239  	//-------------------------------------------------------------------------
       
  5240 	// create new incoming call
       
  5241 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5242 	                               mobileService, mobileCallStatus);	
       
  5243 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5244     AssertMockLtsyStatusL();
       
  5245  	//-------------------------------------------------------------------------
       
  5246 
       
  5247 	// open new call
       
  5248    	CleanupClosePushL(call);
       
  5249    	errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5250     ASSERT_EQUALS(KErrNone, errorCode);
       
  5251 
       
  5252 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5253 	rfInfo = ERfsStateInfoNormal;
       
  5254 	TMockLtsyData1<TRfStateInfo> mockData1X(rfInfo);
       
  5255     expectData.Close();
       
  5256     mockData1X.SerialiseL(expectData);
       
  5257 	iMockLTSY.CompleteL(EMmTsyBootGetRFStatusIPC, KErrNone, expectData);
       
  5258 	User::WaitForRequest(mockLtsyStatus);
       
  5259 	AssertMockLtsyStatusL();
       
  5260 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5261 
       
  5262 	call.Dial(requestStatus, pckgCallParamsX, KPhoneNumber);
       
  5263 
       
  5264 	User::WaitForRequest(requestStatus);
       
  5265 	AssertMockLtsyStatusL();
       
  5266 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  5267 
       
  5268  	//-------------------------------------------------------------------------
       
  5269 	// close incoming call
       
  5270 	TInt hangUpCause = KErrGsmReleaseByUser;
       
  5271 	TBool autoStChangeDisable = EFalse;
       
  5272 	RMobilePhone::TMobileService mobileServiceX = RMobilePhone::EFaxService;
       
  5273     TMockLtsyCallData2<TInt, TBool> mockData2x(callId, mobileServiceX, 
       
  5274                                              hangUpCause, 
       
  5275                                              autoStChangeDisable);
       
  5276     expectData.Close();
       
  5277     mockData2x.SerialiseL(expectData);
       
  5278     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5279     
       
  5280 	call.Close();
       
  5281 	AssertMockLtsyStatusL();
       
  5282 	CleanupStack::PopAndDestroy(1);
       
  5283 
       
  5284 	AssertMockLtsyStatusL();
       
  5285 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  5286 	}
       
  5287 
       
  5288 /**
       
  5289 @SYMTestCaseID BA-CTSY-CCON-CHU-0001
       
  5290 @SYMComponent  telephony_ctsy
       
  5291 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp for voice calls
       
  5292 @SYMTestPriority High
       
  5293 @SYMTestActions Invokes RCall::HangUp for voice calls
       
  5294 @SYMTestExpectedResults Pass
       
  5295 @SYMTestType CT
       
  5296 */
       
  5297 void CCTsyCallControlFU::TestHangUp0001L()
       
  5298 	{
       
  5299 
       
  5300 	OpenEtelServerL(EUseExtendedError);
       
  5301 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5302 	OpenPhoneL();
       
  5303 
       
  5304     RBuf8 expectData;
       
  5305     CleanupClosePushL(expectData);
       
  5306 
       
  5307     RBuf8 completeData;
       
  5308     CleanupClosePushL(completeData);
       
  5309 
       
  5310 	RLine line;
       
  5311 	RCall call;
       
  5312 	
       
  5313 	TInt errorCode = KErrNone;
       
  5314     TRequestStatus requestStatus;
       
  5315 	TRequestStatus mockLtsyStatus;
       
  5316 	
       
  5317 	// open new line and call for KMmTsyVoice1LineName
       
  5318 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  5319 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5320 		
       
  5321 	TName incomingCallName;
       
  5322 	TInt callId = 1;
       
  5323 	TInt callId2 = 2;
       
  5324     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  5325     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  5326 			
       
  5327 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  5328 	TBool autoStChangeDisable = ETrue;
       
  5329     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  5330                                               hangUpCause, 
       
  5331                                               autoStChangeDisable);
       
  5332 	
       
  5333 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  5334 	TMockLtsyCallData0 mockData1(callId2, mobileService);
       
  5335 
       
  5336  	//-------------------------------------------------------------------------
       
  5337 	// TEST A: failure to dispatch request to LTSY
       
  5338  	//-------------------------------------------------------------------------
       
  5339 
       
  5340  	//-------------------------------------------------------------------------
       
  5341 	// create new incoming call
       
  5342 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5343 	                               mobileService, mobileCallStatus);	
       
  5344 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5345 		
       
  5346 	CleanupClosePushL(call);
       
  5347     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5348     ASSERT_EQUALS(KErrNone, errorCode);
       
  5349  	//-------------------------------------------------------------------------
       
  5350 
       
  5351     expectData.Close();
       
  5352     mockData2.SerialiseL(expectData);
       
  5353     iMockLTSY.ExpectL(EEtelCallHangUp, expectData, KErrNotSupported);
       
  5354 
       
  5355 	call.HangUp(requestStatus);
       
  5356 	User::WaitForRequest(requestStatus);
       
  5357 	AssertMockLtsyStatusL();
       
  5358 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  5359 	
       
  5360 	// close incoming call
       
  5361  	CloseIncomingCallL(call, callId, mobileService);
       
  5362 	AssertMockLtsyStatusL();
       
  5363 	CleanupStack::PopAndDestroy(1); // call
       
  5364 
       
  5365  	//-------------------------------------------------------------------------
       
  5366 	// TEST C: Successful completion request of
       
  5367 	// RCall::HangUp when result is not cached.
       
  5368  	//-------------------------------------------------------------------------
       
  5369 
       
  5370  	//-------------------------------------------------------------------------
       
  5371 	// create new incoming call
       
  5372 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5373 	                               mobileService, mobileCallStatus);	
       
  5374 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5375 		
       
  5376 	CleanupClosePushL(call);
       
  5377     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5378     ASSERT_EQUALS(KErrNone, errorCode);
       
  5379  	//-------------------------------------------------------------------------
       
  5380 
       
  5381     expectData.Close();
       
  5382     mockData2.SerialiseL(expectData);
       
  5383     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5384 
       
  5385 	mockData0.SerialiseL(completeData);
       
  5386 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  5387 
       
  5388 	call.HangUp(requestStatus);
       
  5389 	User::WaitForRequest(requestStatus);
       
  5390 	AssertMockLtsyStatusL();
       
  5391 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5392 	
       
  5393 	// close incoming call
       
  5394  	CloseIncomingCallL(call, callId, mobileService);
       
  5395 	CleanupStack::PopAndDestroy(1); // call
       
  5396 
       
  5397  	//-------------------------------------------------------------------------
       
  5398 	// TEST E: Unsolicited completion of RCall::HangUp
       
  5399 	// from LTSY.
       
  5400  	//-------------------------------------------------------------------------
       
  5401 
       
  5402 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5403     completeData.Close();
       
  5404     mockData0.SerialiseL(completeData);
       
  5405 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  5406 	User::WaitForRequest(mockLtsyStatus);
       
  5407 	AssertMockLtsyStatusL();
       
  5408 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  5409 
       
  5410 	//-------------------------------------------------------------------------
       
  5411 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  5412 	// covers "if ( 0 < hangUpHandle || iHangUpFlag )" condition
       
  5413  	//-------------------------------------------------------------------------
       
  5414 
       
  5415 	RCall call2;
       
  5416 	CleanupClosePushL(call2);
       
  5417     TRequestStatus requestStatus2;
       
  5418 
       
  5419  	//-------------------------------------------------------------------------
       
  5420 	// create new incoming call
       
  5421 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  5422 	                               mobileService, mobileCallStatus);	
       
  5423 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5424     AssertMockLtsyStatusL();
       
  5425 		
       
  5426     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5427     ASSERT_EQUALS(KErrNone, errorCode);
       
  5428     AssertMockLtsyStatusL();
       
  5429  	//-------------------------------------------------------------------------
       
  5430 
       
  5431  	//-------------------------------------------------------------------------
       
  5432     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  5433     ASSERT_EQUALS(KErrNone, errorCode);
       
  5434     AssertMockLtsyStatusL();
       
  5435  	//-------------------------------------------------------------------------
       
  5436 
       
  5437     expectData.Close();
       
  5438     mockData2.SerialiseL(expectData);
       
  5439     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5440 	completeData.Close();
       
  5441 	mockData0.SerialiseL(completeData);
       
  5442 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrGeneral, completeData);
       
  5443 	call.HangUp(requestStatus);
       
  5444 
       
  5445 	call2.HangUp(requestStatus2);
       
  5446 
       
  5447 	User::WaitForRequest(requestStatus);
       
  5448 	AssertMockLtsyStatusL();
       
  5449 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  5450 
       
  5451 	User::WaitForRequest(requestStatus2);
       
  5452 	AssertMockLtsyStatusL();
       
  5453 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  5454 
       
  5455 	// close incoming call
       
  5456 	call.Close();
       
  5457 	AssertMockLtsyStatusL();
       
  5458 
       
  5459 	// close incoming call2
       
  5460  	CloseIncomingCallL(call2, callId, mobileService);
       
  5461 	CleanupStack::PopAndDestroy(1); // call2
       
  5462 	
       
  5463 	//-------------------------------------------------------------------------
       
  5464 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  5465 	// covers "if ( ( NULL != callList->GetMmCallByStatus(
       
  5466 	//                RMobileCall::EStatusConnected ) ) &&
       
  5467 	//              ( NULL != callList->GetMmCallByStatus(
       
  5468 	//                RMobileCall::EStatusHold ) ) &&
       
  5469 	//              ( NULL != callList->GetMmCallByStatus(
       
  5470 	//                RMobileCall::EStatusRinging ) ) )" condition
       
  5471  	//-------------------------------------------------------------------------
       
  5472 
       
  5473     mobileCallStatus = RMobileCall::EStatusConnected;
       
  5474     callId = 3;
       
  5475 
       
  5476  	//-------------------------------------------------------------------------
       
  5477 	// create new incoming call
       
  5478 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5479 	                               mobileService, mobileCallStatus);	
       
  5480 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5481     AssertMockLtsyStatusL();
       
  5482  	//-------------------------------------------------------------------------
       
  5483 
       
  5484 	mobileCallStatus = RMobileCall::EStatusRinging;
       
  5485     callId = 2;
       
  5486 
       
  5487  	//-------------------------------------------------------------------------
       
  5488 	// create new incoming call
       
  5489 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  5490 	                               mobileService, mobileCallStatus);	
       
  5491 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5492     AssertMockLtsyStatusL();
       
  5493 		
       
  5494     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5495     ASSERT_EQUALS(KErrNone, errorCode);
       
  5496     AssertMockLtsyStatusL();
       
  5497  	//-------------------------------------------------------------------------
       
  5498 
       
  5499     mobileCallStatus = RMobileCall::EStatusHold;
       
  5500     callId = 1;
       
  5501 
       
  5502  	//-------------------------------------------------------------------------
       
  5503 	// create new incoming call
       
  5504 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5505 	                               mobileService, mobileCallStatus);	
       
  5506 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5507     AssertMockLtsyStatusL();
       
  5508  	//-------------------------------------------------------------------------
       
  5509 
       
  5510 	callId = 2;
       
  5511 	hangUpCause = KErrGsmBusyUserRequest;
       
  5512 	autoStChangeDisable = ETrue;
       
  5513     TMockLtsyCallData2<TInt, TBool> mockData2xx(callId, mobileService, 
       
  5514                                               hangUpCause, 
       
  5515                                               autoStChangeDisable);
       
  5516     expectData.Close();
       
  5517     mockData2xx.SerialiseL(expectData);
       
  5518     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5519 	completeData.Close();
       
  5520 	mockData1.SerialiseL(completeData);
       
  5521 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  5522 	call.HangUp(requestStatus);
       
  5523 	
       
  5524 	User::WaitForRequest(requestStatus);
       
  5525 	AssertMockLtsyStatusL();
       
  5526 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5527 	
       
  5528 	// close incoming call for RMobileCall::EStatusRinging
       
  5529     callId = 2;
       
  5530  	CloseIncomingCallL(call, callId, mobileService);
       
  5531 
       
  5532 	// open call for RMobileCall::EStatusHold
       
  5533     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5534     ASSERT_EQUALS(KErrNone, errorCode);
       
  5535 
       
  5536 	// close incoming call for RMobileCall::EStatusHold
       
  5537     callId = 1;
       
  5538  	CloseIncomingCallL(call, callId, mobileService);
       
  5539 
       
  5540 	//-------------------------------------------------------------------------
       
  5541 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  5542  	//-------------------------------------------------------------------------
       
  5543 
       
  5544 	callId = 1;
       
  5545 	mobileCallStatus = RMobileCall::EStatusRinging;
       
  5546 
       
  5547  	//-------------------------------------------------------------------------
       
  5548 	// create new incoming call
       
  5549 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5550 	                               mobileService, mobileCallStatus);	
       
  5551 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5552 		
       
  5553 	CleanupClosePushL(call);
       
  5554     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5555     ASSERT_EQUALS(KErrNone, errorCode);
       
  5556  	//-------------------------------------------------------------------------
       
  5557 
       
  5558 	hangUpCause = KErrGsmBusyUserRequest;
       
  5559 	autoStChangeDisable = ETrue;
       
  5560     TMockLtsyCallData2<TInt, TBool> mockData2xxx(callId, mobileService, 
       
  5561                                               hangUpCause, 
       
  5562                                               autoStChangeDisable);
       
  5563 
       
  5564     expectData.Close();
       
  5565     mockData2xxx.SerialiseL(expectData);
       
  5566     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5567 
       
  5568 	completeData.Close();
       
  5569 	mockData0.SerialiseL(completeData);
       
  5570 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrGeneral, completeData);
       
  5571 
       
  5572 	call.HangUp(requestStatus);
       
  5573 	User::WaitForRequest(requestStatus);
       
  5574 	AssertMockLtsyStatusL();
       
  5575 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  5576 	
       
  5577 	// close incoming call
       
  5578  	CloseIncomingCallL(call, callId, mobileService);
       
  5579 	AssertMockLtsyStatusL();
       
  5580 	CleanupStack::PopAndDestroy(1); // call
       
  5581 
       
  5582 	//
       
  5583 	// Added for DEF139341 (Unexpected error note pops up after creating emergency call)
       
  5584 	// Tests that CTSY treats KErrGsmReleaseByUser as a normal return code, not as an error
       
  5585 	// (the client request should complete with KErrNone).
       
  5586 	//
       
  5587 	
       
  5588 	//-------------------------------------------------------------------------
       
  5589     // create new incoming call
       
  5590     errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5591                                    mobileService, mobileCallStatus);    
       
  5592     ASSERT_EQUALS(KErrNone, errorCode);
       
  5593         
       
  5594     CleanupClosePushL(call);
       
  5595     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5596     ASSERT_EQUALS(KErrNone, errorCode);
       
  5597     //-------------------------------------------------------------------------
       
  5598 
       
  5599     hangUpCause = KErrGsmBusyUserRequest;
       
  5600     autoStChangeDisable = ETrue;
       
  5601     TMockLtsyCallData2<TInt, TBool> mockData3xxx(callId, mobileService, 
       
  5602                                               hangUpCause, 
       
  5603                                               autoStChangeDisable);
       
  5604 
       
  5605     expectData.Close();
       
  5606     mockData3xxx.SerialiseL(expectData);
       
  5607     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5608 
       
  5609     completeData.Close();
       
  5610     mockData0.SerialiseL(completeData);
       
  5611     iMockLTSY.CompleteL(EEtelCallHangUp, KErrGsmReleaseByUser, completeData);
       
  5612 
       
  5613     call.HangUp(requestStatus);
       
  5614     User::WaitForRequest(requestStatus);
       
  5615     AssertMockLtsyStatusL();
       
  5616     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5617     
       
  5618     // close incoming call
       
  5619     CloseIncomingCallL(call, callId, mobileService);
       
  5620     AssertMockLtsyStatusL();
       
  5621     CleanupStack::PopAndDestroy(1); // call
       
  5622 	//
       
  5623 	
       
  5624 	AssertMockLtsyStatusL();
       
  5625 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  5626 	
       
  5627 	}
       
  5628 
       
  5629 
       
  5630 /**
       
  5631 @SYMTestCaseID BA-CTSY-CCON-CHU-0002
       
  5632 @SYMComponent  telephony_ctsy
       
  5633 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::HangUp for voice calls
       
  5634 @SYMTestPriority High
       
  5635 @SYMTestActions Invokes cancelling of RCall::HangUp for voice calls
       
  5636 @SYMTestExpectedResults Pass
       
  5637 @SYMTestType CT
       
  5638 */
       
  5639 void CCTsyCallControlFU::TestHangUp0002L()
       
  5640 	{
       
  5641 
       
  5642 	OpenEtelServerL(EUseExtendedError);
       
  5643 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5644 	OpenPhoneL();
       
  5645 
       
  5646     RBuf8 expectData;
       
  5647     CleanupClosePushL(expectData);
       
  5648 
       
  5649     RBuf8 completeData;
       
  5650     CleanupClosePushL(completeData);
       
  5651 
       
  5652 	RLine line;
       
  5653 	RCall call;
       
  5654 	
       
  5655 	TInt errorCode = KErrNone;
       
  5656     TRequestStatus requestStatus;
       
  5657 	TRequestStatus mockLtsyStatus;
       
  5658 	
       
  5659 	// open new line and call for KMmTsyVoice1LineName
       
  5660 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  5661 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5662 		
       
  5663 	TName incomingCallName;
       
  5664 	TInt callId = 1;
       
  5665     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  5666     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  5667 			
       
  5668 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  5669 	TBool autoStChangeDisable = ETrue;
       
  5670     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  5671                                               hangUpCause, 
       
  5672                                               autoStChangeDisable);
       
  5673 	
       
  5674 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  5675 
       
  5676  	//-------------------------------------------------------------------------
       
  5677 	// Test cancelling of RCall::HangUp
       
  5678  	//-------------------------------------------------------------------------
       
  5679  	
       
  5680  	//-------------------------------------------------------------------------
       
  5681 	// create new incoming call
       
  5682 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5683 	                               mobileService, mobileCallStatus);	
       
  5684 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5685 		
       
  5686 	CleanupClosePushL(call);
       
  5687     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5688     ASSERT_EQUALS(KErrNone, errorCode);
       
  5689  	//-------------------------------------------------------------------------
       
  5690 
       
  5691 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  5692 
       
  5693     expectData.Close();
       
  5694     mockData2.SerialiseL(expectData);
       
  5695     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5696 
       
  5697 	mockData0.SerialiseL(completeData);
       
  5698 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  5699 
       
  5700 	call.HangUp(requestStatus);
       
  5701 	
       
  5702     call.CancelAsyncRequest(EEtelCallHangUp);
       
  5703 	
       
  5704 	User::WaitForRequest(requestStatus);
       
  5705 	AssertMockLtsyStatusL();
       
  5706 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  5707 	
       
  5708 	// close incoming call
       
  5709  	CloseIncomingCallL(call, callId, mobileService);
       
  5710 	AssertMockLtsyStatusL();
       
  5711 	CleanupStack::PopAndDestroy(1);
       
  5712  	
       
  5713 	User::WaitForRequest(mockLtsyStatus);
       
  5714  	
       
  5715 	AssertMockLtsyStatusL();
       
  5716 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  5717 	}
       
  5718 
       
  5719 /**
       
  5720 @SYMTestCaseID BA-CTSY-CCON-CHU-0004
       
  5721 @SYMComponent  telephony_ctsy
       
  5722 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::HangUp for voice calls
       
  5723 @SYMTestPriority High
       
  5724 @SYMTestActions Invokes multiple client requests to RCall::HangUp for voice calls
       
  5725 @SYMTestExpectedResults Pass
       
  5726 @SYMTestType CT
       
  5727 */
       
  5728 void CCTsyCallControlFU::TestHangUp0004L()
       
  5729 	{
       
  5730 	OpenEtelServerL(EUseExtendedError);
       
  5731 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5732 	OpenPhoneL();
       
  5733 
       
  5734     RBuf8 expectData;
       
  5735     CleanupClosePushL(expectData);
       
  5736 
       
  5737     RBuf8 completeData;
       
  5738     CleanupClosePushL(completeData);
       
  5739 
       
  5740 	// Open second client
       
  5741 	RTelServer telServer2;
       
  5742 	TInt ret = telServer2.Connect();
       
  5743 	ASSERT_EQUALS(KErrNone, ret);
       
  5744 	CleanupClosePushL(telServer2);
       
  5745 
       
  5746 	RMobilePhone phone2;
       
  5747 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  5748 	ASSERT_EQUALS(KErrNone, ret);
       
  5749 	CleanupClosePushL(phone2);
       
  5750 
       
  5751 	RCall call1;
       
  5752 	RCall call2;
       
  5753 	RLine line1;
       
  5754 	RLine line2;
       
  5755 	
       
  5756 	TInt errorCode = KErrNone;
       
  5757     TRequestStatus requestStatus1;
       
  5758     TRequestStatus requestStatus2;
       
  5759 	
       
  5760 	// open new line1
       
  5761 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
  5762 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5763 
       
  5764 	// open new line2
       
  5765 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
  5766 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5767     
       
  5768 	TName incomingCallName1;
       
  5769 	TName incomingCallName2;
       
  5770 	   	
       
  5771 	TInt callId1 = 1;
       
  5772 	TInt callId2 = 2;
       
  5773     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  5774     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  5775 			
       
  5776 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  5777 	TBool autoStChangeDisable = ETrue;
       
  5778     TMockLtsyCallData2<TInt, TBool> mockData21(callId1, mobileService, 
       
  5779                                               hangUpCause, 
       
  5780                                               autoStChangeDisable);
       
  5781     TMockLtsyCallData2<TInt, TBool> mockData22(callId2, mobileService, 
       
  5782                                               hangUpCause, 
       
  5783                                               autoStChangeDisable);
       
  5784 	
       
  5785 	TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  5786 	TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  5787 
       
  5788 	//-------------------------------------------------------------------------
       
  5789 	// Test A: Test multiple clients requesting RCall::HangUp
       
  5790  	//-------------------------------------------------------------------------
       
  5791 
       
  5792  	//-------------------------------------------------------------------------
       
  5793 	// create new incoming call1
       
  5794 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1, 
       
  5795 	                               mobileService, mobileCallStatus);	
       
  5796 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5797 		
       
  5798 	CleanupClosePushL(call1);
       
  5799     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  5800     ASSERT_EQUALS(KErrNone, errorCode);
       
  5801  	//-------------------------------------------------------------------------
       
  5802 
       
  5803  	//-------------------------------------------------------------------------
       
  5804 	// create new incoming call2
       
  5805 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2, 
       
  5806 	                               mobileService, mobileCallStatus);	
       
  5807 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5808 		
       
  5809 	CleanupClosePushL(call2);
       
  5810     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  5811     ASSERT_EQUALS(KErrNone, errorCode);
       
  5812  	//-------------------------------------------------------------------------
       
  5813 
       
  5814     expectData.Close();
       
  5815     mockData21.SerialiseL(expectData);
       
  5816     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5817 	mockData01.SerialiseL(completeData);
       
  5818 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  5819 
       
  5820 	call1.HangUp(requestStatus1);
       
  5821 
       
  5822     expectData.Close();
       
  5823     mockData22.SerialiseL(expectData);
       
  5824     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5825 	completeData.Close();
       
  5826 	mockData02.SerialiseL(completeData);
       
  5827 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  5828 
       
  5829 	call2.HangUp(requestStatus2);
       
  5830 	
       
  5831 	User::WaitForRequest(requestStatus1);
       
  5832 	AssertMockLtsyStatusL();
       
  5833 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  5834 
       
  5835 	User::WaitForRequest(requestStatus2);
       
  5836 	AssertMockLtsyStatusL();
       
  5837 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  5838 	
       
  5839 	// close incoming call1
       
  5840  	CloseIncomingCallL(call1, callId1, mobileService);
       
  5841 	AssertMockLtsyStatusL();
       
  5842 
       
  5843 	// close incoming call2
       
  5844  	CloseIncomingCallL(call2, callId2, mobileService);
       
  5845 	AssertMockLtsyStatusL();
       
  5846 	
       
  5847 	CleanupStack::PopAndDestroy(2); // call1, call2
       
  5848 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, expectData, completeData, this
       
  5849 	                                      // line1, line2
       
  5850 
       
  5851 	}
       
  5852 
       
  5853 
       
  5854 /**
       
  5855 @SYMTestCaseID BA-CTSY-CCON-CHU-0005
       
  5856 @SYMComponent  telephony_ctsy
       
  5857 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp with timeout for voice calls
       
  5858 @SYMTestPriority High
       
  5859 @SYMTestActions Invokes RCall::HangUp and tests for timeout for voice calls
       
  5860 @SYMTestExpectedResults Pass
       
  5861 @SYMTestType CT
       
  5862 */
       
  5863 void CCTsyCallControlFU::TestHangUp0005L()
       
  5864 	{
       
  5865 	OpenEtelServerL(EUseExtendedError);
       
  5866 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5867 	OpenPhoneL();
       
  5868 
       
  5869     RBuf8 expectData;
       
  5870     CleanupClosePushL(expectData);
       
  5871 
       
  5872     RBuf8 completeData;
       
  5873     CleanupClosePushL(completeData);
       
  5874 
       
  5875 	RLine line;
       
  5876 	RCall call;
       
  5877 	
       
  5878 	TInt errorCode = KErrNone;
       
  5879     TRequestStatus requestStatus;
       
  5880 	TRequestStatus mockLtsyStatus;
       
  5881 	
       
  5882 	// open new line
       
  5883 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  5884 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5885 		
       
  5886 	TName incomingCallName;
       
  5887 	TInt callId = 1;
       
  5888     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  5889     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  5890 			
       
  5891 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  5892 	TBool autoStChangeDisable = ETrue;
       
  5893     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  5894                                               hangUpCause, 
       
  5895                                               autoStChangeDisable);
       
  5896 	
       
  5897 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  5898 
       
  5899 	//-------------------------------------------------------------------------
       
  5900 	// Test A: Test timeout of RCall::HangUp
       
  5901  	//-------------------------------------------------------------------------
       
  5902 
       
  5903  	//-------------------------------------------------------------------------
       
  5904 	// create new incoming call
       
  5905 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  5906 	                               mobileService, mobileCallStatus);	
       
  5907 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5908 		
       
  5909 	CleanupClosePushL(call);
       
  5910     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  5911     ASSERT_EQUALS(KErrNone, errorCode);
       
  5912  	//-------------------------------------------------------------------------
       
  5913 
       
  5914     expectData.Close();
       
  5915     mockData2.SerialiseL(expectData);
       
  5916     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  5917 
       
  5918     TTime t1,t2; //time stamps for measuring the Time Out
       
  5919   
       
  5920     
       
  5921     t1.HomeTime(); // time stamp before request
       
  5922 	call.HangUp(requestStatus);
       
  5923 	User::WaitForRequest(requestStatus);
       
  5924 	t2.HomeTime(); // timestamp after request
       
  5925 	
       
  5926 	AssertMockLtsyStatusL();
       
  5927 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  5928 	TTimeIntervalSeconds diff;
       
  5929 	TInt res = t2.SecondsFrom(t1,diff);
       
  5930 	ASSERT_EQUALS(KErrNone, res);
       
  5931 	if(diff.Int() < KMmCallHangUpTimeOut)
       
  5932 	{
       
  5933         ERR_PRINTF3(_L("RCall::Hangup time out too short. Expected: %d Actual: %d "),KMmCallHangUpTimeOut, diff.Int());
       
  5934         ASSERT(false);
       
  5935 	}
       
  5936 	// close incoming call
       
  5937  	CloseIncomingCallL(call, callId, mobileService);
       
  5938 	AssertMockLtsyStatusL();
       
  5939 	CleanupStack::PopAndDestroy(1);
       
  5940 
       
  5941 	AssertMockLtsyStatusL();
       
  5942 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  5943 
       
  5944 	}
       
  5945 
       
  5946 
       
  5947 /**
       
  5948 @SYMTestCaseID BA-CTSY-CCON-CHU-0006
       
  5949 @SYMComponent  telephony_ctsy
       
  5950 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp for data calls
       
  5951 @SYMTestPriority High
       
  5952 @SYMTestActions Invokes RCall::HangUp for data calls
       
  5953 @SYMTestExpectedResults Pass
       
  5954 @SYMTestType CT
       
  5955 */
       
  5956 void CCTsyCallControlFU::TestHangUp0006L()
       
  5957 	{
       
  5958 
       
  5959 	OpenEtelServerL(EUseExtendedError);
       
  5960 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  5961 	OpenPhoneL();
       
  5962 
       
  5963     RBuf8 expectData;
       
  5964     CleanupClosePushL(expectData);
       
  5965 
       
  5966     RBuf8 completeData;
       
  5967     CleanupClosePushL(completeData);
       
  5968 
       
  5969 	RLine line;
       
  5970 	RCall call;
       
  5971 	
       
  5972 	TInt errorCode = KErrNone;
       
  5973     TRequestStatus requestStatus;
       
  5974 	TRequestStatus mockLtsyStatus;
       
  5975 	
       
  5976 	// open new line
       
  5977 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  5978 	ASSERT_EQUALS(KErrNone, errorCode);
       
  5979 		
       
  5980 	TName incomingCallName;
       
  5981 	TInt callId = 1;
       
  5982     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  5983     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  5984 			
       
  5985 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  5986 	TBool autoStChangeDisable = EFalse;
       
  5987     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  5988                                               hangUpCause, 
       
  5989                                               autoStChangeDisable);
       
  5990 	
       
  5991 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  5992 	
       
  5993  	//-------------------------------------------------------------------------
       
  5994 	// TEST A: failure to dispatch request to LTSY
       
  5995  	//-------------------------------------------------------------------------
       
  5996 
       
  5997  	//-------------------------------------------------------------------------
       
  5998 	// create new incoming call
       
  5999 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6000 	                               mobileService, mobileCallStatus);	
       
  6001 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6002 		
       
  6003 	CleanupClosePushL(call);
       
  6004     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6005     ASSERT_EQUALS(KErrNone, errorCode);
       
  6006  	//-------------------------------------------------------------------------
       
  6007 
       
  6008     expectData.Close();
       
  6009     mockData2.SerialiseL(expectData);
       
  6010     iMockLTSY.ExpectL(EEtelCallHangUp, expectData, KErrNotSupported);
       
  6011 
       
  6012 	call.HangUp(requestStatus);
       
  6013 	User::WaitForRequest(requestStatus);
       
  6014 	AssertMockLtsyStatusL();
       
  6015 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  6016 		
       
  6017  	//-------------------------------------------------------------------------
       
  6018 	// TEST C: Successful completion request of
       
  6019 	// RCall::HangUp when result is not cached.
       
  6020  	//-------------------------------------------------------------------------
       
  6021 
       
  6022     expectData.Close();
       
  6023     mockData2.SerialiseL(expectData);
       
  6024     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6025 	mockData0.SerialiseL(completeData);
       
  6026 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6027 
       
  6028 	call.HangUp(requestStatus);
       
  6029 	User::WaitForRequest(requestStatus);
       
  6030 	AssertMockLtsyStatusL();
       
  6031 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6032 	
       
  6033  	//-------------------------------------------------------------------------
       
  6034 	// TEST E: Unsolicited completion of RCall::HangUp
       
  6035 	// from LTSY.
       
  6036  	//-------------------------------------------------------------------------
       
  6037 
       
  6038 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6039     completeData.Close();
       
  6040     mockData0.SerialiseL(completeData);
       
  6041 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6042 	User::WaitForRequest(mockLtsyStatus);
       
  6043 	AssertMockLtsyStatusL();
       
  6044 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  6045 
       
  6046 	//-------------------------------------------------------------------------
       
  6047 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  6048 	// covers "if ( 0 < hangUpHandle || iHangUpFlag )" condition
       
  6049  	//-------------------------------------------------------------------------
       
  6050 
       
  6051 	RCall call2;
       
  6052 	CleanupClosePushL(call2);
       
  6053     TRequestStatus requestStatus2;
       
  6054 
       
  6055  	//-------------------------------------------------------------------------
       
  6056     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  6057     ASSERT_EQUALS(KErrNone, errorCode);
       
  6058     AssertMockLtsyStatusL();
       
  6059  	//-------------------------------------------------------------------------
       
  6060 
       
  6061     expectData.Close();
       
  6062     mockData2.SerialiseL(expectData);
       
  6063     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6064 	completeData.Close();
       
  6065 	mockData0.SerialiseL(completeData);
       
  6066 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrGeneral, completeData);
       
  6067 	call.HangUp(requestStatus);
       
  6068 
       
  6069 	call2.HangUp(requestStatus2);
       
  6070 
       
  6071 	User::WaitForRequest(requestStatus);
       
  6072 	AssertMockLtsyStatusL();
       
  6073 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  6074 
       
  6075 	User::WaitForRequest(requestStatus2);
       
  6076 	AssertMockLtsyStatusL();
       
  6077 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  6078 
       
  6079 	// close incoming call2
       
  6080 	call2.Close();
       
  6081  	AssertMockLtsyStatusL();
       
  6082 	CleanupStack::PopAndDestroy(1);
       
  6083 
       
  6084 	//-------------------------------------------------------------------------
       
  6085 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  6086 	// covers "else if ( RCall::EStatusIdle == iCallStatus &&
       
  6087 	//                   EMultimodeCallReqHandleUnknown == dialHandle )" condition
       
  6088  	//-------------------------------------------------------------------------
       
  6089 
       
  6090 	TInt  callId2 = 2;
       
  6091 	mobileCallStatus = RMobileCall::EStatusIdle;
       
  6092 
       
  6093  	//-------------------------------------------------------------------------
       
  6094 	// create new incoming call
       
  6095 	errorCode = CreateIncomingCallL(line, callId2, incomingCallName, 
       
  6096 	                               mobileService, mobileCallStatus);	
       
  6097 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6098 	
       
  6099     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  6100     ASSERT_EQUALS(KErrNone, errorCode);
       
  6101     AssertMockLtsyStatusL();
       
  6102  	//-------------------------------------------------------------------------
       
  6103 
       
  6104 	call2.HangUp(requestStatus);
       
  6105 
       
  6106 	User::WaitForRequest(requestStatus);
       
  6107 	AssertMockLtsyStatusL();
       
  6108 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  6109 
       
  6110 	// close incoming call2
       
  6111 	call2.Close();
       
  6112  	AssertMockLtsyStatusL();
       
  6113 
       
  6114 	//-------------------------------------------------------------------------
       
  6115 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  6116  	//-------------------------------------------------------------------------
       
  6117 
       
  6118     expectData.Close();
       
  6119     mockData2.SerialiseL(expectData);
       
  6120     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6121 	completeData.Close();
       
  6122 	mockData0.SerialiseL(completeData);
       
  6123 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrGeneral, completeData);
       
  6124 
       
  6125 	call.HangUp(requestStatus);
       
  6126 	User::WaitForRequest(requestStatus);
       
  6127 	AssertMockLtsyStatusL();
       
  6128 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  6129 
       
  6130 	
       
  6131 	
       
  6132 	//
       
  6133     // Added for DEF139341 (Unexpected error note pops up after creating emergency call)
       
  6134     // Tests that CTSY treats KErrGsmReleaseByUser as a normal return code, not as an error
       
  6135     // (the client request should complete with KErrNone).
       
  6136     //
       
  6137     
       
  6138     //-------------------------------------------------------------------------
       
  6139     // create new incoming call
       
  6140     TInt callId3 = 3;
       
  6141     mobileCallStatus = RMobileCall::EStatusRinging;
       
  6142     errorCode = CreateIncomingCallL(line, callId3, incomingCallName, 
       
  6143                                    mobileService, mobileCallStatus);    
       
  6144     ASSERT_EQUALS(KErrNone, errorCode);
       
  6145     
       
  6146     RCall call3;
       
  6147     CleanupClosePushL(call3);
       
  6148     errorCode = call3.OpenExistingCall(line, incomingCallName);
       
  6149     ASSERT_EQUALS(KErrNone, errorCode);
       
  6150     //-------------------------------------------------------------------------
       
  6151 
       
  6152     TMockLtsyCallData2<TInt, TBool> mockData23(callId3, mobileService, 
       
  6153                                               hangUpCause, 
       
  6154                                               autoStChangeDisable);
       
  6155     
       
  6156     TMockLtsyCallData0 mockData03(callId3, mobileService);
       
  6157     
       
  6158     expectData.Close();
       
  6159     mockData23.SerialiseL(expectData);
       
  6160     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6161     completeData.Close();
       
  6162     mockData03.SerialiseL(completeData);
       
  6163     iMockLTSY.CompleteL(EEtelCallHangUp, KErrGsmReleaseByUser, completeData);
       
  6164     
       
  6165     call3.HangUp(requestStatus);
       
  6166     User::WaitForRequest(requestStatus);
       
  6167     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6168 	//
       
  6169     
       
  6170 	AssertMockLtsyStatusL();
       
  6171 	CleanupStack::PopAndDestroy(6, this); // call3, call, line, completeData, expectData, this
       
  6172 	
       
  6173 	}
       
  6174 
       
  6175 
       
  6176 /**
       
  6177 @SYMTestCaseID BA-CTSY-CCON-CHU-0007
       
  6178 @SYMComponent  telephony_ctsy
       
  6179 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::HangUp for data calls
       
  6180 @SYMTestPriority High
       
  6181 @SYMTestActions Invokes cancelling of RCall::HangUp for data calls
       
  6182 @SYMTestExpectedResults Pass
       
  6183 @SYMTestType CT
       
  6184 */
       
  6185 void CCTsyCallControlFU::TestHangUp0007L()
       
  6186 	{
       
  6187 
       
  6188 	OpenEtelServerL(EUseExtendedError);
       
  6189 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6190 	OpenPhoneL();
       
  6191 
       
  6192     RBuf8 expectData;
       
  6193     CleanupClosePushL(expectData);
       
  6194 
       
  6195     RBuf8 completeData;
       
  6196     CleanupClosePushL(completeData);
       
  6197 
       
  6198 	RLine line;
       
  6199 	RCall call;
       
  6200 	
       
  6201 	TInt errorCode = KErrNone;
       
  6202     TRequestStatus requestStatus;
       
  6203 	TRequestStatus mockLtsyStatus;
       
  6204 	
       
  6205 	// open new line and call for KMmTsyDataLineName
       
  6206 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  6207 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6208 		
       
  6209 	TName incomingCallName;
       
  6210 	TInt callId = 1;
       
  6211     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  6212     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  6213 			
       
  6214 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  6215 	TBool autoStChangeDisable = EFalse;
       
  6216     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  6217                                               hangUpCause, 
       
  6218                                               autoStChangeDisable);
       
  6219 
       
  6220  	//-------------------------------------------------------------------------
       
  6221 	// Test cancelling of RCall::HangUp
       
  6222  	//-------------------------------------------------------------------------
       
  6223  	
       
  6224  	//-------------------------------------------------------------------------
       
  6225 	// create new incoming call
       
  6226 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6227 	                               mobileService, mobileCallStatus);	
       
  6228 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6229 		
       
  6230 	CleanupClosePushL(call);
       
  6231     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6232     ASSERT_EQUALS(KErrNone, errorCode);
       
  6233  	//-------------------------------------------------------------------------
       
  6234 
       
  6235     expectData.Close();
       
  6236     mockData2.SerialiseL(expectData);
       
  6237     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6238 
       
  6239 	call.HangUp(requestStatus);
       
  6240 	
       
  6241 	// cancel hang-up
       
  6242     // TSY has started a HangUp request and it is not possible to cancel this request
       
  6243     call.CancelAsyncRequest(EEtelCallHangUp);
       
  6244 	
       
  6245 	// CTSY hangs up the call and it goes to idle state
       
  6246     mobileCallStatus = RMobileCall::EStatusIdle;
       
  6247     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(callId, mobileService, mobileCallStatus);
       
  6248     mockCallData2.SerialiseL(completeData);
       
  6249     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6250     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrGsmBusyUserRequest, completeData);
       
  6251 	User::WaitForRequest(mockLtsyStatus);
       
  6252 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  6253 	
       
  6254 	User::WaitForRequest(requestStatus);
       
  6255 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6256 	AssertMockLtsyStatusL();
       
  6257 
       
  6258 	CleanupStack::PopAndDestroy(5, this); // call, line, expectData, completeData, this
       
  6259 	}
       
  6260 
       
  6261 /**
       
  6262 @SYMTestCaseID BA-CTSY-CCON-CHU-0009
       
  6263 @SYMComponent  telephony_ctsy
       
  6264 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::HangUp for data calls
       
  6265 @SYMTestPriority High
       
  6266 @SYMTestActions Invokes multiple client requests to RCall::HangUp for data calls
       
  6267 @SYMTestExpectedResults Pass
       
  6268 @SYMTestType CT
       
  6269 */
       
  6270 void CCTsyCallControlFU::TestHangUp0009L()
       
  6271 	{
       
  6272 	OpenEtelServerL(EUseExtendedError);
       
  6273 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6274 	OpenPhoneL();
       
  6275 
       
  6276     RBuf8 expectData;
       
  6277     CleanupClosePushL(expectData);
       
  6278 
       
  6279     RBuf8 completeData;
       
  6280     CleanupClosePushL(completeData);
       
  6281 
       
  6282 	// Open second client
       
  6283 	RTelServer telServer2;
       
  6284 	TInt ret = telServer2.Connect();
       
  6285 	ASSERT_EQUALS(KErrNone, ret);
       
  6286 	CleanupClosePushL(telServer2);
       
  6287 
       
  6288 	RMobilePhone phone2;
       
  6289 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  6290 	ASSERT_EQUALS(KErrNone, ret);
       
  6291 	CleanupClosePushL(phone2);
       
  6292 
       
  6293 	// Open third client
       
  6294 	RTelServer telServer3;
       
  6295 	ret = telServer3.Connect();
       
  6296 	ASSERT_EQUALS(KErrNone, ret);
       
  6297 	CleanupClosePushL(telServer3);
       
  6298 
       
  6299 	RMobilePhone phone3;
       
  6300 	ret = phone3.Open(iTelServer,KMmTsyPhoneName);
       
  6301 	ASSERT_EQUALS(KErrNone, ret);
       
  6302 	CleanupClosePushL(phone3);
       
  6303 
       
  6304 	RCall call1;
       
  6305 	RCall call2;
       
  6306 	RCall call3;
       
  6307 	RLine line1;
       
  6308 	RLine line2;
       
  6309 	RLine line3;
       
  6310 	
       
  6311 	TInt errorCode = KErrNone;
       
  6312     TRequestStatus requestStatus1;
       
  6313     TRequestStatus requestStatus2;
       
  6314     TRequestStatus requestStatus3;
       
  6315 	
       
  6316 	// open new line1
       
  6317 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyDataLineName);
       
  6318 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6319 
       
  6320 	// open new line2
       
  6321 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyDataLineName);
       
  6322 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6323 
       
  6324 	// open new line3
       
  6325 	errorCode = OpenNewLineLC(phone3, line3, KMmTsyDataLineName);
       
  6326 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6327 		
       
  6328 	TName incomingCallName1;
       
  6329 	TName incomingCallName2;
       
  6330 	TName incomingCallName3;
       
  6331 	   	
       
  6332 	TInt callId1 = 1;
       
  6333 	TInt callId2 = 2;
       
  6334 	TInt callId3 = 3;
       
  6335     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  6336     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  6337 			
       
  6338 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  6339 	TBool autoStChangeDisable = EFalse;
       
  6340     TMockLtsyCallData2<TInt, TBool> mockData21(callId1, mobileService, 
       
  6341                                               hangUpCause, 
       
  6342                                               autoStChangeDisable);
       
  6343     TMockLtsyCallData2<TInt, TBool> mockData22(callId2, mobileService, 
       
  6344                                               hangUpCause, 
       
  6345                                               autoStChangeDisable);
       
  6346 	
       
  6347 	TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  6348 	TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  6349 
       
  6350 	//-------------------------------------------------------------------------
       
  6351 	// Test A: Test multiple clients requesting RCall::HangUp
       
  6352  	//-------------------------------------------------------------------------
       
  6353 
       
  6354  	//-------------------------------------------------------------------------
       
  6355 	// create new incoming call1
       
  6356 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1, 
       
  6357 	                               mobileService, mobileCallStatus);	
       
  6358 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6359 		
       
  6360 	CleanupClosePushL(call1);
       
  6361     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  6362     ASSERT_EQUALS(KErrNone, errorCode);
       
  6363  	//-------------------------------------------------------------------------
       
  6364 
       
  6365  	//-------------------------------------------------------------------------
       
  6366 	// create new incoming call2
       
  6367 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2, 
       
  6368 	                               mobileService, mobileCallStatus);	
       
  6369 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6370 		
       
  6371 	CleanupClosePushL(call2);
       
  6372     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  6373     ASSERT_EQUALS(KErrNone, errorCode);
       
  6374  	//-------------------------------------------------------------------------
       
  6375 
       
  6376  	//-------------------------------------------------------------------------
       
  6377 	// create new incoming call3
       
  6378 	
       
  6379 	mobileCallStatus = RMobileCall::EStatusConnected;
       
  6380 	errorCode = CreateIncomingCallL(line3, callId3, incomingCallName3, 
       
  6381 	                               mobileService, mobileCallStatus);	
       
  6382 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6383 		
       
  6384 	CleanupClosePushL(call3);
       
  6385     errorCode = call3.OpenExistingCall(line3, incomingCallName3);
       
  6386     ASSERT_EQUALS(KErrNone, errorCode);
       
  6387  	//-------------------------------------------------------------------------
       
  6388 
       
  6389     expectData.Close();
       
  6390     mockData21.SerialiseL(expectData);
       
  6391     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6392 	mockData01.SerialiseL(completeData);
       
  6393 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6394 
       
  6395 	call1.HangUp(requestStatus1);
       
  6396 
       
  6397     expectData.Close();
       
  6398     mockData22.SerialiseL(expectData);
       
  6399     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6400 	completeData.Close();
       
  6401 	mockData02.SerialiseL(completeData);
       
  6402 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6403 
       
  6404 	call2.HangUp(requestStatus2);
       
  6405 
       
  6406 	hangUpCause = KErrGsmReleaseByUser;	                                              
       
  6407     TMockLtsyCallData2<TInt, TBool> mockData23(callId3, mobileService, 
       
  6408                                               hangUpCause, 
       
  6409                                               autoStChangeDisable);
       
  6410 	TMockLtsyCallData0 mockData03(callId3, mobileService);
       
  6411 
       
  6412     expectData.Close();
       
  6413     mockData23.SerialiseL(expectData);
       
  6414     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6415 	completeData.Close();
       
  6416 	mockData03.SerialiseL(completeData);
       
  6417 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6418 
       
  6419 	call3.HangUp(requestStatus3);
       
  6420 	
       
  6421 	User::WaitForRequest(requestStatus1);
       
  6422 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  6423 
       
  6424 	User::WaitForRequest(requestStatus2);
       
  6425 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  6426 
       
  6427 	User::WaitForRequest(requestStatus3);
       
  6428 	AssertMockLtsyStatusL();
       
  6429 	ASSERT_EQUALS(KErrNone, requestStatus3.Int());
       
  6430 	
       
  6431 	CleanupStack::PopAndDestroy(3); // call1, call2, call3
       
  6432 	CleanupStack::PopAndDestroy(10, this); // phone2, telServer2, phone3, telServer3, 
       
  6433 	                                      // expectData, completeData, this
       
  6434 	                                      // line1, line2, line3
       
  6435 	}
       
  6436 
       
  6437 
       
  6438 /**
       
  6439 @SYMTestCaseID BA-CTSY-CCON-CHU-00010
       
  6440 @SYMComponent  telephony_ctsy
       
  6441 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp with timeout for data calls
       
  6442 @SYMTestPriority High
       
  6443 @SYMTestActions Invokes RCall::HangUp and tests for timeout for data calls
       
  6444 @SYMTestExpectedResults Pass
       
  6445 @SYMTestType CT
       
  6446 */
       
  6447 void CCTsyCallControlFU::TestHangUp00010L()
       
  6448 	{
       
  6449 	OpenEtelServerL(EUseExtendedError);
       
  6450 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6451 	OpenPhoneL();
       
  6452 
       
  6453     RBuf8 expectData;
       
  6454     CleanupClosePushL(expectData);
       
  6455 
       
  6456     RBuf8 completeData;
       
  6457     CleanupClosePushL(completeData);
       
  6458 
       
  6459 	RLine line;
       
  6460 	RCall call;
       
  6461 	
       
  6462 	TInt errorCode = KErrNone;
       
  6463     TRequestStatus requestStatus;
       
  6464 	TRequestStatus mockLtsyStatus;
       
  6465 	
       
  6466 	// open new line
       
  6467 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  6468 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6469 		
       
  6470 	TName incomingCallName;
       
  6471 	TInt callId = 1;
       
  6472     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  6473     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  6474 			
       
  6475 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  6476 	TBool autoStChangeDisable = EFalse;
       
  6477     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  6478                                               hangUpCause, 
       
  6479                                               autoStChangeDisable);
       
  6480 	
       
  6481 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  6482 
       
  6483 	//-------------------------------------------------------------------------
       
  6484 	// Test A: Test timeout of RCall::HangUp
       
  6485  	//-------------------------------------------------------------------------
       
  6486 
       
  6487  	//-------------------------------------------------------------------------
       
  6488 	// create new incoming call
       
  6489 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6490 	                               mobileService, mobileCallStatus);	
       
  6491 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6492 		
       
  6493 	CleanupClosePushL(call);
       
  6494     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6495     ASSERT_EQUALS(KErrNone, errorCode);
       
  6496  	//-------------------------------------------------------------------------
       
  6497 
       
  6498     expectData.Close();
       
  6499     mockData2.SerialiseL(expectData);
       
  6500     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6501 
       
  6502 	call.HangUp(requestStatus);
       
  6503 	User::WaitForRequest(requestStatus);
       
  6504 	AssertMockLtsyStatusL();
       
  6505 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 100303);
       
  6506 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  6507 	
       
  6508 	// close incoming call
       
  6509  	CloseIncomingCallL(call, callId, mobileService);
       
  6510 	AssertMockLtsyStatusL();
       
  6511 	CleanupStack::PopAndDestroy(1);
       
  6512 
       
  6513 	AssertMockLtsyStatusL();
       
  6514 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  6515 	}
       
  6516 
       
  6517 
       
  6518 /**
       
  6519 @SYMTestCaseID BA-CTSY-CCON-CHU-00011
       
  6520 @SYMComponent  telephony_ctsy
       
  6521 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp for fax calls
       
  6522 @SYMTestPriority High
       
  6523 @SYMTestActions Invokes RCall::HangUp for fax calls
       
  6524 @SYMTestExpectedResults Pass
       
  6525 @SYMTestType CT
       
  6526 */
       
  6527 void CCTsyCallControlFU::TestHangUp00011L()
       
  6528 	{
       
  6529 
       
  6530 	OpenEtelServerL(EUseExtendedError);
       
  6531 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6532 	OpenPhoneL();
       
  6533 
       
  6534 	RBuf8 expectData;
       
  6535 	CleanupClosePushL(expectData);
       
  6536 
       
  6537 	RBuf8 completeData;
       
  6538 	CleanupClosePushL(completeData);
       
  6539 
       
  6540 	RLine line;
       
  6541 	RCall call;
       
  6542 	
       
  6543 	TInt errorCode = KErrNone;
       
  6544 	TInt callId = 1;
       
  6545 	TName incomingCallName;
       
  6546 
       
  6547     TRequestStatus requestStatus;
       
  6548 	TRequestStatus mockLtsyStatus;
       
  6549 
       
  6550 	// open new line for KMmTsyVoice1LineName
       
  6551 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  6552 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6553 
       
  6554     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  6555     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  6556 
       
  6557 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  6558 	TBool autoStChangeDisable = EFalse;
       
  6559     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  6560                                               hangUpCause, 
       
  6561                                               autoStChangeDisable);
       
  6562 	
       
  6563 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  6564 
       
  6565  	//-------------------------------------------------------------------------
       
  6566 	// TEST A: failure to dispatch request to LTSY
       
  6567  	//-------------------------------------------------------------------------
       
  6568 
       
  6569  	//-------------------------------------------------------------------------
       
  6570 	// create new incoming call
       
  6571 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6572 	                               mobileService, mobileCallStatus);	
       
  6573 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6574 		
       
  6575     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6576 	CleanupClosePushL(call);
       
  6577     ASSERT_EQUALS(KErrNone, errorCode);
       
  6578  	//-------------------------------------------------------------------------
       
  6579 
       
  6580     expectData.Close();
       
  6581     mockData2.SerialiseL(expectData);
       
  6582     iMockLTSY.ExpectL(EEtelCallHangUp, expectData, KErrNotSupported);
       
  6583 
       
  6584 	call.HangUp(requestStatus);
       
  6585 	User::WaitForRequest(requestStatus);
       
  6586 	AssertMockLtsyStatusL();
       
  6587 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  6588 
       
  6589  	//-------------------------------------------------------------------------
       
  6590 	// TEST C: Successful completion request of
       
  6591 	// RCall::HangUp when result is not cached.
       
  6592  	//-------------------------------------------------------------------------
       
  6593 
       
  6594     expectData.Close();
       
  6595     mockData2.SerialiseL(expectData);
       
  6596     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6597 
       
  6598 	mockData0.SerialiseL(completeData);
       
  6599 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6600 
       
  6601 	call.HangUp(requestStatus);
       
  6602 	User::WaitForRequest(requestStatus);
       
  6603 	AssertMockLtsyStatusL();
       
  6604 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6605 	
       
  6606  	//-------------------------------------------------------------------------
       
  6607 	// TEST E: Unsolicited completion of RCall::HangUp
       
  6608 	// from LTSY.
       
  6609  	//-------------------------------------------------------------------------
       
  6610 
       
  6611 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6612     completeData.Close();
       
  6613     mockData0.SerialiseL(completeData);
       
  6614 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6615 	User::WaitForRequest(mockLtsyStatus);
       
  6616 	AssertMockLtsyStatusL();
       
  6617 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  6618 
       
  6619 	//-------------------------------------------------------------------------
       
  6620 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  6621 	// covers "if ( 0 < hangUpHandle )" condition
       
  6622  	//-------------------------------------------------------------------------
       
  6623 
       
  6624 	RCall call2;
       
  6625     TRequestStatus requestStatus2;
       
  6626 
       
  6627  	//-------------------------------------------------------------------------
       
  6628     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  6629 	CleanupClosePushL(call2);
       
  6630     ASSERT_EQUALS(KErrNone, errorCode);
       
  6631     AssertMockLtsyStatusL();
       
  6632  	//-------------------------------------------------------------------------
       
  6633 
       
  6634     expectData.Close();
       
  6635     mockData2.SerialiseL(expectData);
       
  6636     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6637 	completeData.Close();
       
  6638 	mockData0.SerialiseL(completeData);
       
  6639 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrGeneral, completeData);
       
  6640 	call.HangUp(requestStatus);
       
  6641 
       
  6642 	call2.HangUp(requestStatus2);
       
  6643 
       
  6644 	User::WaitForRequest(requestStatus);
       
  6645 	AssertMockLtsyStatusL();
       
  6646 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  6647 
       
  6648 	User::WaitForRequest(requestStatus2);
       
  6649 	AssertMockLtsyStatusL();
       
  6650 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  6651 
       
  6652 	// close incoming call2
       
  6653 	call2.Close();
       
  6654  	AssertMockLtsyStatusL();	
       
  6655 
       
  6656 	//-------------------------------------------------------------------------
       
  6657 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  6658  	//-------------------------------------------------------------------------
       
  6659 
       
  6660     expectData.Close();
       
  6661     mockData2.SerialiseL(expectData);
       
  6662     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6663 
       
  6664 	completeData.Close();
       
  6665 	mockData0.SerialiseL(completeData);
       
  6666 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrGeneral, completeData);
       
  6667 
       
  6668 	call.HangUp(requestStatus);
       
  6669 	User::WaitForRequest(requestStatus);
       
  6670 	AssertMockLtsyStatusL();
       
  6671 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());	
       
  6672 
       
  6673 	
       
  6674 	//
       
  6675     // Added for DEF139341 (Unexpected error note pops up after creating emergency call)
       
  6676     // Tests that CTSY treats KErrGsmReleaseByUser as a normal return code, not as an error
       
  6677     // (the client request should complete with KErrNone).
       
  6678     //
       
  6679     
       
  6680     //-------------------------------------------------------------------------
       
  6681     // create new incoming call
       
  6682     TInt callId3 = 3;
       
  6683     mobileCallStatus = RMobileCall::EStatusRinging;
       
  6684     errorCode = CreateIncomingCallL(line, callId3, incomingCallName, 
       
  6685                                    mobileService, mobileCallStatus);    
       
  6686     ASSERT_EQUALS(KErrNone, errorCode);
       
  6687     
       
  6688     RCall call3;
       
  6689     CleanupClosePushL(call3);
       
  6690     errorCode = call3.OpenExistingCall(line, incomingCallName);
       
  6691     ASSERT_EQUALS(KErrNone, errorCode);
       
  6692     //-------------------------------------------------------------------------
       
  6693 
       
  6694     TMockLtsyCallData2<TInt, TBool> mockData23(callId3, mobileService, 
       
  6695                                               hangUpCause, 
       
  6696                                               autoStChangeDisable);
       
  6697     
       
  6698     TMockLtsyCallData0 mockData03(callId3, mobileService);
       
  6699     
       
  6700     expectData.Close();
       
  6701     mockData23.SerialiseL(expectData);
       
  6702     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6703     completeData.Close();
       
  6704     mockData03.SerialiseL(completeData);
       
  6705     iMockLTSY.CompleteL(EEtelCallHangUp, KErrGsmReleaseByUser, completeData);
       
  6706     
       
  6707     call3.HangUp(requestStatus);
       
  6708     User::WaitForRequest(requestStatus);
       
  6709     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6710 	//
       
  6711 	
       
  6712 	AssertMockLtsyStatusL();
       
  6713 	CleanupStack::PopAndDestroy(7, this); // expectData, completeData, this, line, call, call2, call3
       
  6714 	
       
  6715 	}
       
  6716 
       
  6717 /**
       
  6718 @SYMTestCaseID BA-CTSY-CCON-CHU-00011b
       
  6719 @SYMComponent  telephony_ctsy
       
  6720 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp for fax calls
       
  6721 @SYMTestPriority High
       
  6722 @SYMTestActions Invokes RCall::HangUp for fax calls
       
  6723 @SYMTestExpectedResults Pass
       
  6724 @SYMTestType CT
       
  6725 */
       
  6726 void CCTsyCallControlFU::TestHangUp00011bL()
       
  6727 	{
       
  6728 	OpenEtelServerL(EUseExtendedError);
       
  6729 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6730 	OpenPhoneL();
       
  6731 
       
  6732 	RBuf8 expectData;
       
  6733 	CleanupClosePushL(expectData);
       
  6734 
       
  6735 	RBuf8 completeData;
       
  6736 	CleanupClosePushL(completeData);
       
  6737 
       
  6738 	RLine line;
       
  6739 	RCall call;
       
  6740 	
       
  6741 	TInt errorCode = KErrNone;
       
  6742 	TInt callId = 1;
       
  6743 	TName incomingCallName;
       
  6744 
       
  6745     TRequestStatus requestStatus;
       
  6746 	TRequestStatus mockLtsyStatus;
       
  6747 
       
  6748 	// open new line for KMmTsyVoice1LineName
       
  6749 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  6750 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6751 
       
  6752     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  6753     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusIdle;
       
  6754 
       
  6755 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  6756 	TBool autoStChangeDisable = EFalse;
       
  6757     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  6758                                               hangUpCause, 
       
  6759                                               autoStChangeDisable);
       
  6760 	
       
  6761 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  6762 	
       
  6763 	
       
  6764 	//-------------------------------------------------------------------------
       
  6765 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  6766 	// covers "else if ( RCall::EStatusIdle == iCallStatus && 
       
  6767 	//                   EMultimodeCallReqHandleUnknown == dialHandle )" condition
       
  6768  	//-------------------------------------------------------------------------
       
  6769 
       
  6770  	//-------------------------------------------------------------------------
       
  6771 	// create new incoming call
       
  6772 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6773 	                               mobileService, mobileCallStatus);	
       
  6774 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6775 	
       
  6776 		
       
  6777     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6778 	CleanupClosePushL(call);
       
  6779 	AssertMockLtsyStatusL();
       
  6780     ASSERT_EQUALS(KErrNone, errorCode);
       
  6781  	//-------------------------------------------------------------------------
       
  6782 
       
  6783 	call.HangUp(requestStatus);
       
  6784 
       
  6785 	User::WaitForRequest(requestStatus);
       
  6786 	AssertMockLtsyStatusL();
       
  6787 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  6788 	
       
  6789 	CleanupStack::PopAndDestroy(5, this); // expectData, completeData, this, line, call
       
  6790 	}
       
  6791 
       
  6792 /**
       
  6793 @SYMTestCaseID BA-CTSY-CCON-CHU-00011c
       
  6794 @SYMComponent  telephony_ctsy
       
  6795 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp for fax calls
       
  6796 @SYMTestPriority High
       
  6797 @SYMTestActions Invokes RCall::HangUp for fax calls
       
  6798 @SYMTestExpectedResults Pass
       
  6799 @SYMTestType CT
       
  6800 */
       
  6801 void CCTsyCallControlFU::TestHangUp00011cL()
       
  6802 	{
       
  6803 	OpenEtelServerL(EUseExtendedError);
       
  6804 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6805 	OpenPhoneL();
       
  6806 
       
  6807 	RBuf8 expectData;
       
  6808 	CleanupClosePushL(expectData);
       
  6809 
       
  6810 	RBuf8 completeData;
       
  6811 	CleanupClosePushL(completeData);
       
  6812 
       
  6813 	RLine line;
       
  6814 	RCall call;
       
  6815 	
       
  6816 	TInt errorCode = KErrNone;
       
  6817 	TInt callId = 1;
       
  6818 	TName incomingCallName;
       
  6819 
       
  6820     TRequestStatus requestStatus;
       
  6821 	TRequestStatus mockLtsyStatus;
       
  6822 
       
  6823 	// open new line for KMmTsyFaxLineName
       
  6824 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  6825 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6826 
       
  6827     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  6828     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusConnected;
       
  6829 
       
  6830 	TInt hangUpCause = KErrGsmReleaseByUser;
       
  6831 	TBool autoStChangeDisable = EFalse;
       
  6832     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  6833                                               hangUpCause, 
       
  6834                                               autoStChangeDisable);
       
  6835 	
       
  6836 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  6837 	
       
  6838 	
       
  6839 	//-------------------------------------------------------------------------
       
  6840 	// TEST : to increase CMmVoiceCallTsy::Dial coverage
       
  6841 	// covers "if ( RCall::EStatusRinging == iCallStatus )" condition
       
  6842  	//-------------------------------------------------------------------------
       
  6843 
       
  6844 	// create new incoming call
       
  6845 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6846 	                               mobileService, mobileCallStatus);	
       
  6847 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6848 	
       
  6849 		
       
  6850     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6851 	CleanupClosePushL(call);
       
  6852 	AssertMockLtsyStatusL();
       
  6853     ASSERT_EQUALS(KErrNone, errorCode);
       
  6854  	//-------------------------------------------------------------------------
       
  6855 
       
  6856     expectData.Close();
       
  6857     mockData2.SerialiseL(expectData);
       
  6858     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6859 
       
  6860 	mockData0.SerialiseL(completeData);
       
  6861 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  6862 
       
  6863 	call.HangUp(requestStatus);
       
  6864 
       
  6865 	User::WaitForRequest(requestStatus);
       
  6866 	AssertMockLtsyStatusL();
       
  6867 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6868 
       
  6869 	CleanupStack::PopAndDestroy(5, this); // expectData, completeData, this, line, call
       
  6870 	}
       
  6871 
       
  6872 
       
  6873 /**
       
  6874 @SYMTestCaseID BA-CTSY-CCON-CHU-00012
       
  6875 @SYMComponent  telephony_ctsy
       
  6876 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::HangUp for fax calls
       
  6877 @SYMTestPriority High
       
  6878 @SYMTestActions Invokes cancelling of RCall::HangUp for fax calls
       
  6879 @SYMTestExpectedResults Pass
       
  6880 @SYMTestType CT
       
  6881 */
       
  6882 void CCTsyCallControlFU::TestHangUp00012L()
       
  6883 	{
       
  6884 
       
  6885 	OpenEtelServerL(EUseExtendedError);
       
  6886 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6887 	OpenPhoneL();
       
  6888 
       
  6889     RBuf8 expectData;
       
  6890     CleanupClosePushL(expectData);
       
  6891 
       
  6892     RBuf8 completeData;
       
  6893     CleanupClosePushL(completeData);
       
  6894 
       
  6895 	RLine line;
       
  6896 	RCall call;
       
  6897 	
       
  6898 	TInt errorCode = KErrNone;
       
  6899     TRequestStatus requestStatus;
       
  6900 	TRequestStatus mockLtsyStatus;
       
  6901 	
       
  6902 	// open new line and call for KMmTsyFaxLineName
       
  6903 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  6904 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6905 		
       
  6906 	TName incomingCallName;
       
  6907 	TInt callId = 1;
       
  6908     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  6909     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  6910 			
       
  6911 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  6912 	TBool autoStChangeDisable = EFalse;
       
  6913     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  6914                                               hangUpCause, 
       
  6915                                               autoStChangeDisable);
       
  6916 
       
  6917  	//-------------------------------------------------------------------------
       
  6918 	// Test cancelling of RCall::HangUp
       
  6919  	//-------------------------------------------------------------------------
       
  6920  	
       
  6921  	//-------------------------------------------------------------------------
       
  6922 	// create new incoming call
       
  6923 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  6924 	                               mobileService, mobileCallStatus);	
       
  6925 	ASSERT_EQUALS(KErrNone, errorCode);
       
  6926 		
       
  6927 	CleanupClosePushL(call);
       
  6928     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  6929     ASSERT_EQUALS(KErrNone, errorCode);
       
  6930  	//-------------------------------------------------------------------------
       
  6931 
       
  6932     expectData.Close();
       
  6933     mockData2.SerialiseL(expectData);
       
  6934     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  6935 
       
  6936 	call.HangUp(requestStatus);
       
  6937 	
       
  6938 	// cancel hang-up
       
  6939     // TSY has started a HangUp request and it is not possible to cancel this request
       
  6940     call.CancelAsyncRequest(EEtelCallHangUp);
       
  6941 	
       
  6942 	// CTSY hangs up the call and it goes to idle state
       
  6943     mobileCallStatus = RMobileCall::EStatusIdle;
       
  6944     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(callId, mobileService, mobileCallStatus);
       
  6945     mockCallData2.SerialiseL(completeData);
       
  6946     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  6947     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrGsmBusyUserRequest, completeData);
       
  6948 	User::WaitForRequest(mockLtsyStatus);
       
  6949 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  6950 
       
  6951 	User::WaitForRequest(requestStatus);
       
  6952 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  6953 	AssertMockLtsyStatusL();
       
  6954 	
       
  6955 	CleanupStack::PopAndDestroy(5, this); // call, line, expectData, completeData, this
       
  6956 	}
       
  6957 
       
  6958 /**
       
  6959 @SYMTestCaseID BA-CTSY-CCON-CHU-00014
       
  6960 @SYMComponent  telephony_ctsy
       
  6961 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::HangUp for fax calls
       
  6962 @SYMTestPriority High
       
  6963 @SYMTestActions Invokes multiple client requests to RCall::HangUp for fax calls
       
  6964 @SYMTestExpectedResults Pass
       
  6965 @SYMTestType CT
       
  6966 */
       
  6967 void CCTsyCallControlFU::TestHangUp00014L()
       
  6968 	{
       
  6969 
       
  6970 					
       
  6971 	OpenEtelServerL(EUseExtendedError);
       
  6972 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  6973 	OpenPhoneL();
       
  6974 
       
  6975     RBuf8 expectData;
       
  6976     CleanupClosePushL(expectData);
       
  6977 
       
  6978     RBuf8 completeData;
       
  6979     CleanupClosePushL(completeData);
       
  6980 
       
  6981 	// Open second client
       
  6982 	RTelServer telServer2;
       
  6983 	TInt ret = telServer2.Connect();
       
  6984 	ASSERT_EQUALS(KErrNone, ret);
       
  6985 	CleanupClosePushL(telServer2);
       
  6986 
       
  6987 	RMobilePhone phone2;
       
  6988 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  6989 	ASSERT_EQUALS(KErrNone, ret);
       
  6990 	CleanupClosePushL(phone2);
       
  6991 
       
  6992 	RCall call1;
       
  6993 	RCall call2;
       
  6994 	RLine line1;
       
  6995 	RLine line2;
       
  6996 	
       
  6997 	TInt errorCode = KErrNone;
       
  6998     TRequestStatus requestStatus1;
       
  6999     TRequestStatus requestStatus2;
       
  7000 	
       
  7001 	// open new line1
       
  7002 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyFaxLineName);
       
  7003 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7004 
       
  7005 	// open new line2
       
  7006 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyFaxLineName);
       
  7007 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7008 
       
  7009 	TName incomingCallName1;
       
  7010 	TName incomingCallName2;
       
  7011 	   	
       
  7012 	TInt callId1 = 1;
       
  7013 	TInt callId2 = 2;
       
  7014     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  7015     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7016 			
       
  7017 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  7018 	TBool autoStChangeDisable = EFalse;
       
  7019     TMockLtsyCallData2<TInt, TBool> mockData21(callId1, mobileService, 
       
  7020                                               hangUpCause, 
       
  7021                                               autoStChangeDisable);
       
  7022     TMockLtsyCallData2<TInt, TBool> mockData22(callId2, mobileService, 
       
  7023                                               hangUpCause, 
       
  7024                                               autoStChangeDisable);
       
  7025 	
       
  7026 	TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  7027 	TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  7028 
       
  7029 	//-------------------------------------------------------------------------
       
  7030 	// Test A: Test multiple clients requesting RCall::HangUp
       
  7031  	//-------------------------------------------------------------------------
       
  7032 
       
  7033 	// create new incoming call1
       
  7034 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1, 
       
  7035 	                               mobileService, mobileCallStatus);	
       
  7036 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7037 		
       
  7038 	CleanupClosePushL(call1);
       
  7039     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  7040     ASSERT_EQUALS(KErrNone, errorCode);
       
  7041     
       
  7042 	// create new incoming call2
       
  7043 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2, 
       
  7044 	                               mobileService, mobileCallStatus);	
       
  7045 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7046 		
       
  7047 	CleanupClosePushL(call2);
       
  7048     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  7049     ASSERT_EQUALS(KErrNone, errorCode);
       
  7050 
       
  7051     expectData.Close();
       
  7052     mockData21.SerialiseL(expectData);
       
  7053     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  7054 	mockData01.SerialiseL(completeData);
       
  7055 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  7056 
       
  7057 	call1.HangUp(requestStatus1);
       
  7058 
       
  7059     expectData.Close();
       
  7060     mockData22.SerialiseL(expectData);
       
  7061     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  7062 	completeData.Close();
       
  7063 	mockData02.SerialiseL(completeData);
       
  7064 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
  7065 
       
  7066 	call2.HangUp(requestStatus2);
       
  7067 	
       
  7068 	User::WaitForRequest(requestStatus1);
       
  7069 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  7070 
       
  7071 	User::WaitForRequest(requestStatus2);
       
  7072 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  7073 
       
  7074 	CleanupStack::PopAndDestroy(2); // call1, call2
       
  7075 	CleanupStack::PopAndDestroy(7, this); // phone2, telServer2, expectData, completeData, this
       
  7076 	                                      // line1, line2
       
  7077 	}
       
  7078 
       
  7079 
       
  7080 /**
       
  7081 @SYMTestCaseID BA-CTSY-CCON-CHU-00015
       
  7082 @SYMComponent  telephony_ctsy
       
  7083 @SYMTestCaseDesc Test support in CTSY for RCall::HangUp with timeout for fax calls
       
  7084 @SYMTestPriority High
       
  7085 @SYMTestActions Invokes RCall::HangUp and tests for timeout for fax calls
       
  7086 @SYMTestExpectedResults Pass
       
  7087 @SYMTestType CT
       
  7088 */
       
  7089 void CCTsyCallControlFU::TestHangUp00015L()
       
  7090 	{
       
  7091 	OpenEtelServerL(EUseExtendedError);
       
  7092 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7093 	OpenPhoneL();
       
  7094 
       
  7095     RBuf8 expectData;
       
  7096     CleanupClosePushL(expectData);
       
  7097 
       
  7098     RBuf8 completeData;
       
  7099     CleanupClosePushL(completeData);
       
  7100 
       
  7101 	RLine line;
       
  7102 	RCall call;
       
  7103 	
       
  7104 	TInt errorCode = KErrNone;
       
  7105     TRequestStatus requestStatus;
       
  7106 	TRequestStatus mockLtsyStatus;
       
  7107 	
       
  7108 	// open new line
       
  7109 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  7110 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7111 		
       
  7112 	TName incomingCallName;
       
  7113 	TInt callId = 1;
       
  7114     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  7115     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7116 			
       
  7117 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
  7118 	TBool autoStChangeDisable = EFalse;
       
  7119     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
  7120                                               hangUpCause, 
       
  7121                                               autoStChangeDisable);
       
  7122 	
       
  7123 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7124 
       
  7125 	//-------------------------------------------------------------------------
       
  7126 	// Test A: Test timeout of RCall::HangUp
       
  7127  	//-------------------------------------------------------------------------
       
  7128 
       
  7129  	//-------------------------------------------------------------------------
       
  7130 	// create new incoming call
       
  7131 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7132 	                               mobileService, mobileCallStatus);	
       
  7133 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7134 		
       
  7135 	CleanupClosePushL(call);
       
  7136     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7137     ASSERT_EQUALS(KErrNone, errorCode);
       
  7138  	//-------------------------------------------------------------------------
       
  7139 
       
  7140     expectData.Close();
       
  7141     mockData2.SerialiseL(expectData);
       
  7142     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
  7143 
       
  7144 	call.HangUp(requestStatus);
       
  7145 	User::WaitForRequest(requestStatus);
       
  7146 	AssertMockLtsyStatusL();
       
  7147 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 100303);
       
  7148 	ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  7149 	
       
  7150 	// close incoming call
       
  7151  	CloseIncomingCallL(call, callId, mobileService);
       
  7152 	AssertMockLtsyStatusL();
       
  7153 	CleanupStack::PopAndDestroy(1);
       
  7154 
       
  7155 	AssertMockLtsyStatusL();
       
  7156 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
  7157 	}
       
  7158 
       
  7159 
       
  7160 /**
       
  7161 @SYMTestCaseID BA-CTSY-CCON-CH-0001
       
  7162 @SYMComponent  telephony_ctsy
       
  7163 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Hold for voice calls
       
  7164 @SYMTestPriority High
       
  7165 @SYMTestActions Invokes RMobileCall::Hold for voice calls
       
  7166 @SYMTestExpectedResults Pass
       
  7167 @SYMTestType CT
       
  7168 */
       
  7169 void CCTsyCallControlFU::TestHold0001L()
       
  7170 	{
       
  7171 
       
  7172 	OpenEtelServerL(EUseExtendedError);
       
  7173 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7174 	OpenPhoneL();
       
  7175 
       
  7176     RBuf8 expectData;
       
  7177     CleanupClosePushL(expectData);
       
  7178 
       
  7179     RBuf8 completeData;
       
  7180     CleanupClosePushL(completeData);
       
  7181 
       
  7182 	RLine line;
       
  7183 	RMobileCall call;
       
  7184 	CleanupClosePushL(call);
       
  7185 	
       
  7186 	TInt errorCode = KErrNone;
       
  7187 	TInt callId = 1;
       
  7188 	TName incomingCallName;
       
  7189     TRequestStatus requestStatus;
       
  7190     TRequestStatus mockLtsyStatus;
       
  7191 
       
  7192 	// open new line and call for KMmTsyVoice1LineName
       
  7193 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  7194 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7195 		
       
  7196     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7197     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  7198 	
       
  7199     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7200 	
       
  7201  	//-------------------------------------------------------------------------
       
  7202 	// TEST A: failure to dispatch request to LTSY
       
  7203  	//-------------------------------------------------------------------------
       
  7204 
       
  7205  	//-------------------------------------------------------------------------
       
  7206 	// create new incoming call
       
  7207 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7208 	                               mobileService, mobileCallStatus);	
       
  7209 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7210     AssertMockLtsyStatusL();
       
  7211 		
       
  7212     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7213     ASSERT_EQUALS(KErrNone, errorCode);
       
  7214     AssertMockLtsyStatusL();
       
  7215  	//-------------------------------------------------------------------------
       
  7216 
       
  7217     expectData.Close();
       
  7218     mockData0.SerialiseL(expectData);
       
  7219     iMockLTSY.ExpectL(EMobileCallHold, expectData, KErrNotSupported);
       
  7220     call.Hold(requestStatus);
       
  7221 
       
  7222     User::WaitForRequest(requestStatus);
       
  7223     AssertMockLtsyStatusL();
       
  7224     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  7225 
       
  7226 	// close incoming call
       
  7227     CloseIncomingCallL(call, callId, mobileService);
       
  7228 
       
  7229 	//-------------------------------------------------------------------------
       
  7230 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  7231  	//-------------------------------------------------------------------------
       
  7232 
       
  7233  	//-------------------------------------------------------------------------
       
  7234 	// create new incoming call
       
  7235 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7236 	                               mobileService, mobileCallStatus);	
       
  7237 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7238     AssertMockLtsyStatusL();
       
  7239 		
       
  7240     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7241     ASSERT_EQUALS(KErrNone, errorCode);
       
  7242     AssertMockLtsyStatusL();
       
  7243  	//-------------------------------------------------------------------------
       
  7244 
       
  7245     expectData.Close();
       
  7246     mockData0.SerialiseL(expectData);
       
  7247     iMockLTSY.ExpectL(EMobileCallHold, expectData);
       
  7248     iMockLTSY.CompleteL(EMobileCallHold, KErrGeneral, expectData);
       
  7249     call.Hold(requestStatus);
       
  7250 
       
  7251     User::WaitForRequest(requestStatus);
       
  7252     AssertMockLtsyStatusL();
       
  7253     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  7254 
       
  7255 	// close incoming call
       
  7256     CloseIncomingCallL(call, callId, mobileService);
       
  7257 
       
  7258  	//-------------------------------------------------------------------------
       
  7259 	// TEST C: Successful completion request of
       
  7260 	// RMobileCall::Hold when result is not cached.
       
  7261  	//-------------------------------------------------------------------------
       
  7262 
       
  7263  	//-------------------------------------------------------------------------
       
  7264 	// create new incoming call
       
  7265 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7266 	                               mobileService, mobileCallStatus);	
       
  7267 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7268     AssertMockLtsyStatusL();
       
  7269 		
       
  7270     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7271     ASSERT_EQUALS(KErrNone, errorCode);
       
  7272     AssertMockLtsyStatusL();
       
  7273  	//-------------------------------------------------------------------------
       
  7274 
       
  7275     expectData.Close();
       
  7276     mockData0.SerialiseL(expectData);
       
  7277     iMockLTSY.ExpectL(EMobileCallHold, expectData);
       
  7278     iMockLTSY.CompleteL(EMobileCallHold, KErrNone, expectData);
       
  7279     call.Hold(requestStatus);
       
  7280 
       
  7281     User::WaitForRequest(requestStatus);
       
  7282     AssertMockLtsyStatusL();
       
  7283     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  7284 
       
  7285 	// close incoming call
       
  7286     CloseIncomingCallL(call, callId, mobileService);
       
  7287 
       
  7288  	//-------------------------------------------------------------------------
       
  7289 	// TEST E: Unsolicited completion of RMobileCall::Hold
       
  7290 	// from LTSY.
       
  7291  	//-------------------------------------------------------------------------
       
  7292 
       
  7293 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7294     expectData.Close();
       
  7295     mockData0.SerialiseL(expectData);
       
  7296 	iMockLTSY.CompleteL(EMobileCallHold, KErrNone, expectData);
       
  7297 	User::WaitForRequest(mockLtsyStatus);
       
  7298 	AssertMockLtsyStatusL();
       
  7299 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  7300 
       
  7301 	AssertMockLtsyStatusL();
       
  7302 	CleanupStack::PopAndDestroy(5, this); // expectData, completeData, call, line
       
  7303 	
       
  7304 	}
       
  7305 
       
  7306 
       
  7307 /**
       
  7308 @SYMTestCaseID BA-CTSY-CCON-CH-0002
       
  7309 @SYMComponent  telephony_ctsy
       
  7310 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobileCall::Hold for voice calls
       
  7311 @SYMTestPriority High
       
  7312 @SYMTestActions Invokes cancelling of RMobileCall::Hold for voice calls
       
  7313 @SYMTestExpectedResults Pass
       
  7314 @SYMTestType CT
       
  7315 */
       
  7316 void CCTsyCallControlFU::TestHold0002L()
       
  7317 	{
       
  7318 
       
  7319 	OpenEtelServerL(EUseExtendedError);
       
  7320 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7321 	OpenPhoneL();
       
  7322 
       
  7323 	RBuf8 expectData;
       
  7324 	CleanupClosePushL(expectData);
       
  7325 
       
  7326 	RLine line;
       
  7327 	RMobileCall call;
       
  7328 	CleanupClosePushL(call);
       
  7329 	
       
  7330 	TInt errorCode = KErrNone;
       
  7331 	TInt callId = 1;
       
  7332 	TName incomingCallName;
       
  7333 
       
  7334     TRequestStatus requestStatus;
       
  7335 	TRequestStatus mockLtsyStatus;
       
  7336 	
       
  7337     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7338     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  7339 
       
  7340     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7341 	
       
  7342  	//-------------------------------------------------------------------------
       
  7343 	// Test cancelling of RCall::AnswerIncomingCall
       
  7344  	//-------------------------------------------------------------------------
       
  7345  	
       
  7346 	// open new line for KMmTsyVoice1LineName
       
  7347 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  7348 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7349 		
       
  7350  	//-------------------------------------------------------------------------
       
  7351 	// create new incoming call
       
  7352 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  7353 	                               mobileService, mobileCallStatus);	
       
  7354 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7355 	AssertMockLtsyStatusL();
       
  7356 		
       
  7357     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7358     ASSERT_EQUALS(KErrNone, errorCode);
       
  7359 	AssertMockLtsyStatusL();
       
  7360  	//-------------------------------------------------------------------------
       
  7361 
       
  7362 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7363 	
       
  7364 	
       
  7365     expectData.Close();
       
  7366     mockData0.SerialiseL(expectData);
       
  7367     iMockLTSY.ExpectL(EMobileCallHold, expectData);
       
  7368     iMockLTSY.CompleteL(EMobileCallHold, KErrNone, expectData);
       
  7369 
       
  7370     call.Hold(requestStatus);
       
  7371 
       
  7372     call.CancelAsyncRequest(EMobileCallHold);
       
  7373 
       
  7374     User::WaitForRequest(requestStatus);
       
  7375     AssertMockLtsyStatusL();
       
  7376     
       
  7377     //TSY has started a request and it is not possible to then cancel this
       
  7378     //request. The best thing for the TSY to do in this case is to proceed
       
  7379     //as though the Cancel never happened. The server's call to the TSY
       
  7380     //cancel function will return synchronously. The TSY then continues to
       
  7381     //wait for the original acknowledgement and when it receives it,
       
  7382     //the TSY will complete the original request.
       
  7383     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  7384 
       
  7385 	User::WaitForRequest(mockLtsyStatus);
       
  7386 	
       
  7387 	CleanupStack::PopAndDestroy(4); // expectData, this, call, line
       
  7388 	}
       
  7389 
       
  7390 /**
       
  7391 @SYMTestCaseID BA-CTSY-CCON-CH-0004
       
  7392 @SYMComponent  telephony_ctsy
       
  7393 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileCall::Hold for voice calls
       
  7394 @SYMTestPriority High
       
  7395 @SYMTestActions Invokes multiple client requests to RMobileCall::Hold for voice calls
       
  7396 @SYMTestExpectedResults Pass
       
  7397 @SYMTestType CT
       
  7398 */
       
  7399 void CCTsyCallControlFU::TestHold0004L()
       
  7400 	{
       
  7401 
       
  7402 					
       
  7403 	OpenEtelServerL(EUseExtendedError);
       
  7404 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7405 	OpenPhoneL();
       
  7406 
       
  7407 	RBuf8 expectData;
       
  7408 	CleanupClosePushL(expectData);
       
  7409 
       
  7410 	// Open second client
       
  7411 	RTelServer telServer2;
       
  7412 	TInt ret = telServer2.Connect();
       
  7413 	ASSERT_EQUALS(KErrNone, ret);
       
  7414 	CleanupClosePushL(telServer2);
       
  7415 
       
  7416 	RMobilePhone phone2;
       
  7417 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  7418 	ASSERT_EQUALS(KErrNone, ret);
       
  7419 	CleanupClosePushL(phone2);
       
  7420 
       
  7421 	RLine line1;
       
  7422 	RLine line2;
       
  7423 	
       
  7424 	RMobileCall call1;
       
  7425 	CleanupClosePushL(call1);
       
  7426 
       
  7427 	RMobileCall call2;
       
  7428 	CleanupClosePushL(call2);
       
  7429 	
       
  7430 	TInt errorCode = KErrNone;
       
  7431 
       
  7432 	TInt callId1 = 1;
       
  7433 	TName incomingCallName1;
       
  7434 
       
  7435 	TInt callId2 = 2;
       
  7436 	TName incomingCallName2;
       
  7437 
       
  7438 	TRequestStatus requestStatus1;
       
  7439 	TRequestStatus requestStatus2;
       
  7440 
       
  7441 	// open new line1 for KMmTsyVoice1LineName
       
  7442 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
  7443 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7444 
       
  7445 	// open new line2 for KMmTsyVoice1LineName
       
  7446 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
  7447 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7448 
       
  7449     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7450     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  7451 
       
  7452     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  7453     TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  7454 
       
  7455 	//-------------------------------------------------------------------------
       
  7456 	// Test A: Test multiple clients requesting RCall::AnswerIncomingCall
       
  7457  	//-------------------------------------------------------------------------
       
  7458 
       
  7459  	//-------------------------------------------------------------------------
       
  7460 	// create new incoming call1
       
  7461 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
  7462 	                               mobileService, mobileCallStatus);	
       
  7463 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7464 	AssertMockLtsyStatusL();
       
  7465 		
       
  7466     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  7467     ASSERT_EQUALS(KErrNone, errorCode);
       
  7468 	AssertMockLtsyStatusL();
       
  7469  	//-------------------------------------------------------------------------
       
  7470 	
       
  7471  	//-------------------------------------------------------------------------
       
  7472 	// create new incoming call2
       
  7473 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
  7474 	                               mobileService, mobileCallStatus);	
       
  7475 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7476 	AssertMockLtsyStatusL();
       
  7477 		
       
  7478     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  7479     ASSERT_EQUALS(KErrNone, errorCode);
       
  7480 	AssertMockLtsyStatusL();
       
  7481  	//-------------------------------------------------------------------------
       
  7482 
       
  7483     expectData.Close();
       
  7484     mockData01.SerialiseL(expectData);
       
  7485     iMockLTSY.ExpectL(EMobileCallHold, expectData);
       
  7486     iMockLTSY.CompleteL(EMobileCallHold, KErrNone, expectData);
       
  7487 
       
  7488     call1.Hold(requestStatus1);
       
  7489 
       
  7490     expectData.Close();
       
  7491     mockData02.SerialiseL(expectData);
       
  7492     iMockLTSY.ExpectL(EMobileCallHold, expectData);
       
  7493     iMockLTSY.CompleteL(EMobileCallHold, KErrNone, expectData);
       
  7494 
       
  7495     call2.Hold(requestStatus2);
       
  7496 
       
  7497     User::WaitForRequest(requestStatus1);
       
  7498     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  7499 
       
  7500     User::WaitForRequest(requestStatus2);
       
  7501     AssertMockLtsyStatusL();
       
  7502     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  7503 
       
  7504 	// Done !
       
  7505 	CleanupStack::PopAndDestroy(4); // line1, line2, call1, call2
       
  7506 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, expectData, this
       
  7507 	}
       
  7508 
       
  7509 
       
  7510 /**
       
  7511 @SYMTestCaseID BA-CTSY-CCON-CH-0005
       
  7512 @SYMComponent  telephony_ctsy
       
  7513 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Hold with timeout for voice calls
       
  7514 @SYMTestPriority High
       
  7515 @SYMTestActions Invokes RMobileCall::Hold and tests for timeout for voice calls
       
  7516 @SYMTestExpectedResults Pass
       
  7517 @SYMTestType CT
       
  7518 */
       
  7519 void CCTsyCallControlFU::TestHold0005L()
       
  7520 	{
       
  7521 	OpenEtelServerL(EUseExtendedError);
       
  7522 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7523 	OpenPhoneL();
       
  7524 
       
  7525 	RBuf8 expectData;
       
  7526 	CleanupClosePushL(expectData);
       
  7527 
       
  7528 	RLine line;
       
  7529 	RMobileCall call;
       
  7530 	CleanupClosePushL(call);
       
  7531 	
       
  7532 	TInt errorCode = KErrNone;
       
  7533 	TInt callId = 1;
       
  7534 	TName incomingCallName;
       
  7535 
       
  7536     TRequestStatus requestStatus;
       
  7537 	TRequestStatus mockLtsyStatus;
       
  7538 
       
  7539 	// open new line for KMmTsyVoice1LineName
       
  7540 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  7541 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7542 	
       
  7543     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7544     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  7545 
       
  7546     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7547 
       
  7548 	//-------------------------------------------------------------------------
       
  7549 	// Test A: Test timeout of RCall::AnswerIncomingCall
       
  7550  	//-------------------------------------------------------------------------
       
  7551 		
       
  7552  	//-------------------------------------------------------------------------
       
  7553 	// create new incoming call
       
  7554 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  7555 	                               mobileService, mobileCallStatus);	
       
  7556 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7557 	AssertMockLtsyStatusL();
       
  7558 		
       
  7559     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7560     ASSERT_EQUALS(KErrNone, errorCode);
       
  7561 	AssertMockLtsyStatusL();
       
  7562  	//-------------------------------------------------------------------------
       
  7563 
       
  7564     expectData.Close();
       
  7565     mockData0.SerialiseL(expectData);
       
  7566     iMockLTSY.ExpectL(EMobileCallHold, expectData);
       
  7567     call.Hold(requestStatus);
       
  7568 
       
  7569     User::WaitForRequest(requestStatus);
       
  7570     AssertMockLtsyStatusL();
       
  7571     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  7572 
       
  7573 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
  7574 	}
       
  7575 
       
  7576 
       
  7577 /**
       
  7578 @SYMTestCaseID BA-CTSY-CCON-CH-0006
       
  7579 @SYMComponent  telephony_ctsy
       
  7580 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Hold for data calls
       
  7581 @SYMTestPriority High
       
  7582 @SYMTestActions Invokes RMobileCall::Hold for data calls
       
  7583 @SYMTestExpectedResults Pass
       
  7584 @SYMTestType CT
       
  7585 */
       
  7586 void CCTsyCallControlFU::TestHold0006L()
       
  7587 	{
       
  7588 
       
  7589 	OpenEtelServerL(EUseExtendedError);
       
  7590 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7591 	OpenPhoneL();
       
  7592 
       
  7593 	RBuf8 expectData;
       
  7594 	CleanupClosePushL(expectData);
       
  7595 
       
  7596 	RLine line;
       
  7597 	RMobileCall call;
       
  7598 	CleanupClosePushL(call);
       
  7599 	
       
  7600 	TInt errorCode = KErrNone;
       
  7601 	TInt callId = 1;
       
  7602 	TName incomingCallName;
       
  7603 
       
  7604     TRequestStatus requestStatus;
       
  7605 	TRequestStatus mockLtsyStatus;
       
  7606 
       
  7607 	// open new line for KMmTsyVoice1LineName
       
  7608 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  7609 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7610 
       
  7611     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  7612     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7613 
       
  7614     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7615 
       
  7616  	//-------------------------------------------------------------------------
       
  7617 	// TEST A: failure to dispatch request to LTSY
       
  7618  	//-------------------------------------------------------------------------
       
  7619 
       
  7620  	//-------------------------------------------------------------------------
       
  7621 	// create new incoming call
       
  7622 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7623 	                               mobileService, mobileCallStatus);	
       
  7624 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7625 		
       
  7626     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7627     ASSERT_EQUALS(KErrNone, errorCode);
       
  7628  	//-------------------------------------------------------------------------
       
  7629 
       
  7630     call.Hold(requestStatus);
       
  7631 
       
  7632     User::WaitForRequest(requestStatus);
       
  7633     AssertMockLtsyStatusL();
       
  7634     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  7635 
       
  7636 	AssertMockLtsyStatusL();
       
  7637 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  7638 	}
       
  7639 
       
  7640 /**
       
  7641 @SYMTestCaseID BA-CTSY-CCON-CH-00011
       
  7642 @SYMComponent  telephony_ctsy
       
  7643 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Hold for fax calls
       
  7644 @SYMTestPriority High
       
  7645 @SYMTestActions Invokes RMobileCall::Hold for fax calls
       
  7646 @SYMTestExpectedResults Pass
       
  7647 @SYMTestType CT
       
  7648 */
       
  7649 void CCTsyCallControlFU::TestHold00011L()
       
  7650 	{
       
  7651 
       
  7652 	OpenEtelServerL(EUseExtendedError);
       
  7653 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7654 	OpenPhoneL();
       
  7655 
       
  7656 	RBuf8 expectData;
       
  7657 	CleanupClosePushL(expectData);
       
  7658 
       
  7659 	RLine line;
       
  7660 	RMobileCall call;
       
  7661 	CleanupClosePushL(call);
       
  7662 	
       
  7663 	TInt errorCode = KErrNone;
       
  7664 	TInt callId = 1;
       
  7665 	TName incomingCallName;
       
  7666 
       
  7667     TRequestStatus requestStatus;
       
  7668 	TRequestStatus mockLtsyStatus;
       
  7669 
       
  7670 	// open new line for KMmTsyVoice1LineName
       
  7671 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  7672 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7673 
       
  7674     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  7675     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7676 
       
  7677     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7678 
       
  7679  	//-------------------------------------------------------------------------
       
  7680 	// TEST A: failure to dispatch request to LTSY
       
  7681  	//-------------------------------------------------------------------------
       
  7682 
       
  7683  	//-------------------------------------------------------------------------
       
  7684 	// create new incoming call
       
  7685 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7686 	                               mobileService, mobileCallStatus);	
       
  7687 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7688 		
       
  7689     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7690     ASSERT_EQUALS(KErrNone, errorCode);
       
  7691  	//-------------------------------------------------------------------------
       
  7692 
       
  7693     call.Hold(requestStatus);
       
  7694 
       
  7695     User::WaitForRequest(requestStatus);
       
  7696     AssertMockLtsyStatusL();
       
  7697     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  7698 
       
  7699 	AssertMockLtsyStatusL();
       
  7700 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  7701 	}
       
  7702 
       
  7703 /**
       
  7704 @SYMTestCaseID BA-CTSY-CCON-CH-0001a
       
  7705 @SYMComponent  telephony_ctsy
       
  7706 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Hold and RMobileCall::AnswerIncomingCall fails because call waiting is disabled
       
  7707 @SYMTestPriority High
       
  7708 @SYMTestActions Invokes RMobileCall::Hold for voice and data calls
       
  7709 @SYMTestExpectedResults Pass
       
  7710 @SYMTestType CT
       
  7711 */
       
  7712 void CCTsyCallControlFU::TestHold0001aL()
       
  7713 	{
       
  7714 	//Test voice call functionality
       
  7715     TInt ret = TestAnsweringFailsBecauseHoldDoesNotWorkL( KMmTsyVoice1LineName );
       
  7716     ASSERT_EQUALS(KErrNone, ret);
       
  7717     
       
  7718     //Test data call functionality
       
  7719 	ret = TestAnsweringFailsBecauseHoldDoesNotWorkL( KMmTsyDataLineName );
       
  7720     ASSERT_EQUALS(KErrNone, ret);        
       
  7721 	}
       
  7722 
       
  7723 /**
       
  7724 @SYMTestCaseID BA-CTSY-CCON-CS-0001
       
  7725 @SYMComponent  telephony_ctsy
       
  7726 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Swap for voice calls
       
  7727 @SYMTestPriority High
       
  7728 @SYMTestActions Invokes RMobileCall::Swap for voice calls
       
  7729 @SYMTestExpectedResults Pass
       
  7730 @SYMTestType CT
       
  7731 */
       
  7732 void CCTsyCallControlFU::TestSwap0001L()
       
  7733 	{
       
  7734 
       
  7735 	OpenEtelServerL(EUseExtendedError);
       
  7736 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7737 	OpenPhoneL();
       
  7738 
       
  7739     RBuf8 expectData;
       
  7740     CleanupClosePushL(expectData);
       
  7741 
       
  7742     RBuf8 completeData;
       
  7743     CleanupClosePushL(completeData);
       
  7744 
       
  7745 	RLine line;
       
  7746 	RMobileCall call;
       
  7747 	CleanupClosePushL(call);
       
  7748 	
       
  7749 	TInt errorCode = KErrNone;
       
  7750 	TInt callId = 1;
       
  7751 	TName incomingCallName;
       
  7752     TRequestStatus requestStatus;
       
  7753     TRequestStatus mockLtsyStatus;
       
  7754 	
       
  7755 	// open new line and call for KMmTsyVoice1LineName
       
  7756 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  7757 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7758 		
       
  7759     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7760     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  7761 	
       
  7762     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7763 	
       
  7764  	//-------------------------------------------------------------------------
       
  7765 	// TEST A: failure to dispatch request to LTSY
       
  7766  	//-------------------------------------------------------------------------
       
  7767 
       
  7768  	//-------------------------------------------------------------------------
       
  7769 	// create new incoming call
       
  7770 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7771 	                               mobileService, mobileCallStatus);	
       
  7772 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7773     AssertMockLtsyStatusL();
       
  7774 		
       
  7775     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7776     ASSERT_EQUALS(KErrNone, errorCode);
       
  7777     AssertMockLtsyStatusL();
       
  7778  	//-------------------------------------------------------------------------
       
  7779 
       
  7780     expectData.Close();
       
  7781     mockData0.SerialiseL(expectData);
       
  7782     iMockLTSY.ExpectL(EMobileCallSwap, expectData, KErrNotSupported);
       
  7783     call.Swap(requestStatus);
       
  7784 
       
  7785     User::WaitForRequest(requestStatus);
       
  7786     AssertMockLtsyStatusL();
       
  7787     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  7788 
       
  7789 	// close incoming call
       
  7790     CloseIncomingCallL(call, callId, mobileService);
       
  7791 
       
  7792 	//-------------------------------------------------------------------------
       
  7793 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  7794  	//-------------------------------------------------------------------------
       
  7795 
       
  7796  	//-------------------------------------------------------------------------
       
  7797 	// create new incoming call
       
  7798 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7799 	                               mobileService, mobileCallStatus);	
       
  7800 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7801     AssertMockLtsyStatusL();
       
  7802 		
       
  7803     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7804     ASSERT_EQUALS(KErrNone, errorCode);
       
  7805     AssertMockLtsyStatusL();
       
  7806  	//-------------------------------------------------------------------------
       
  7807 
       
  7808     expectData.Close();
       
  7809     mockData0.SerialiseL(expectData);
       
  7810     iMockLTSY.ExpectL(EMobileCallSwap, expectData);
       
  7811     iMockLTSY.CompleteL(EMobileCallSwap, KErrGeneral, expectData);
       
  7812     call.Swap(requestStatus);
       
  7813 
       
  7814     User::WaitForRequest(requestStatus);
       
  7815     AssertMockLtsyStatusL();
       
  7816     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  7817 
       
  7818 	// close incoming call
       
  7819     CloseIncomingCallL(call, callId, mobileService);
       
  7820 
       
  7821  	//-------------------------------------------------------------------------
       
  7822 	// TEST C: Successful completion request of
       
  7823 	// RMobileCall::Swap when result is not cached.
       
  7824  	//-------------------------------------------------------------------------
       
  7825 
       
  7826  	//-------------------------------------------------------------------------
       
  7827 	// create new incoming call
       
  7828 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  7829 	                               mobileService, mobileCallStatus);	
       
  7830 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7831     AssertMockLtsyStatusL();
       
  7832 		
       
  7833     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7834     ASSERT_EQUALS(KErrNone, errorCode);
       
  7835     AssertMockLtsyStatusL();
       
  7836  	//-------------------------------------------------------------------------
       
  7837 
       
  7838     expectData.Close();
       
  7839     mockData0.SerialiseL(expectData);
       
  7840     iMockLTSY.ExpectL(EMobileCallSwap, expectData);
       
  7841     iMockLTSY.CompleteL(EMobileCallSwap, KErrNone, expectData);
       
  7842     call.Swap(requestStatus);
       
  7843 
       
  7844     User::WaitForRequest(requestStatus);
       
  7845     AssertMockLtsyStatusL();
       
  7846     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  7847 
       
  7848 	// close incoming call
       
  7849     CloseIncomingCallL(call, callId, mobileService);
       
  7850 
       
  7851  	//-------------------------------------------------------------------------
       
  7852 	// TEST E: Unsolicited completion of RMobileCall::Swap
       
  7853 	// from LTSY.
       
  7854  	//-------------------------------------------------------------------------
       
  7855 
       
  7856 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7857     expectData.Close();
       
  7858     mockData0.SerialiseL(expectData);
       
  7859 	iMockLTSY.CompleteL(EMobileCallSwap, KErrNone, expectData);
       
  7860 	User::WaitForRequest(mockLtsyStatus);
       
  7861 	AssertMockLtsyStatusL();
       
  7862 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  7863 
       
  7864 	AssertMockLtsyStatusL();
       
  7865 	CleanupStack::PopAndDestroy(5, this); // expectData, completeData, call, line
       
  7866 	
       
  7867 	}
       
  7868 
       
  7869 
       
  7870 /**
       
  7871 @SYMTestCaseID BA-CTSY-CCON-CS-0002
       
  7872 @SYMComponent  telephony_ctsy
       
  7873 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobileCall::Swap for voice calls
       
  7874 @SYMTestPriority High
       
  7875 @SYMTestActions Invokes cancelling of RMobileCall::Swap for voice calls
       
  7876 @SYMTestExpectedResults Pass
       
  7877 @SYMTestType CT
       
  7878 */
       
  7879 void CCTsyCallControlFU::TestSwap0002L()
       
  7880 	{
       
  7881 
       
  7882 // This test should test cancellation of Swap
       
  7883 // If this API does not have a cancel, the test step should be completely removed.
       
  7884 
       
  7885 	OpenEtelServerL(EUseExtendedError);
       
  7886 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7887 	OpenPhoneL();
       
  7888 
       
  7889 	RBuf8 expectData;
       
  7890 	CleanupClosePushL(expectData);
       
  7891 
       
  7892 	RLine line;
       
  7893 	RMobileCall call;
       
  7894 	CleanupClosePushL(call);
       
  7895 	
       
  7896 	TInt errorCode = KErrNone;
       
  7897 	TInt callId = 1;
       
  7898 	TName incomingCallName;
       
  7899 
       
  7900     TRequestStatus requestStatus;
       
  7901 	TRequestStatus mockLtsyStatus;
       
  7902 	
       
  7903     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  7904     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  7905 	
       
  7906  	//-------------------------------------------------------------------------
       
  7907 	// Test cancelling of RCall::AnswerIncomingCall
       
  7908  	//-------------------------------------------------------------------------
       
  7909  	
       
  7910 	// open new line for KMmTsyVoice1LineName
       
  7911 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  7912 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7913 		
       
  7914  	//-------------------------------------------------------------------------
       
  7915 	// create new incoming call
       
  7916 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  7917 	                               mobileService, mobileCallStatus);	
       
  7918 	ASSERT_EQUALS(KErrNone, errorCode);
       
  7919 	AssertMockLtsyStatusL();
       
  7920 		
       
  7921     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  7922     ASSERT_EQUALS(KErrNone, errorCode);
       
  7923 	AssertMockLtsyStatusL();
       
  7924  	//-------------------------------------------------------------------------
       
  7925 
       
  7926 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  7927     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  7928     expectData.Close();
       
  7929     mockData0.SerialiseL(expectData);
       
  7930 
       
  7931     iMockLTSY.ExpectL(EMobileCallSwap, expectData);
       
  7932     iMockLTSY.CompleteL(EMobileCallSwap, KErrNone, expectData);
       
  7933 
       
  7934     call.Swap(requestStatus);
       
  7935 
       
  7936     call.CancelAsyncRequest(EMobileCallSwap);
       
  7937 
       
  7938     User::WaitForRequest(requestStatus);
       
  7939     AssertMockLtsyStatusL();
       
  7940     // see CMmVoiceCallTsy::CancelService in line 508 in file CMmVoiceCallTsy.cpp
       
  7941     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  7942 
       
  7943 	User::WaitForRequest(mockLtsyStatus);
       
  7944 	
       
  7945 	CleanupStack::PopAndDestroy(4); // expectData, this, call, line
       
  7946 	
       
  7947 	}
       
  7948 
       
  7949 /**
       
  7950 @SYMTestCaseID BA-CTSY-CCON-CS-0004
       
  7951 @SYMComponent  telephony_ctsy
       
  7952 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileCall::Swap for voice calls
       
  7953 @SYMTestPriority High
       
  7954 @SYMTestActions Invokes multiple client requests to RMobileCall::Swap for voice calls
       
  7955 @SYMTestExpectedResults Pass
       
  7956 @SYMTestType CT
       
  7957 */
       
  7958 void CCTsyCallControlFU::TestSwap0004L()
       
  7959 	{
       
  7960 	OpenEtelServerL(EUseExtendedError);
       
  7961 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  7962 	OpenPhoneL();
       
  7963 
       
  7964 	RBuf8 expectData;
       
  7965 	CleanupClosePushL(expectData);
       
  7966 
       
  7967 	// Open second client
       
  7968 	RTelServer telServer2;
       
  7969 	TInt ret = telServer2.Connect();
       
  7970 	ASSERT_EQUALS(KErrNone, ret);
       
  7971 	CleanupClosePushL(telServer2);
       
  7972 
       
  7973 	RMobilePhone phone2;
       
  7974 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  7975 	ASSERT_EQUALS(KErrNone, ret);
       
  7976 	CleanupClosePushL(phone2);
       
  7977 
       
  7978 	RLine line1;
       
  7979 	RLine line2;
       
  7980 	
       
  7981 	RMobileCall call1;
       
  7982 	CleanupClosePushL(call1);
       
  7983 
       
  7984 	RMobileCall call2;
       
  7985 	CleanupClosePushL(call2);
       
  7986 	
       
  7987 	TInt errorCode = KErrNone;
       
  7988 
       
  7989 	TInt callId1 = 1;
       
  7990 	TName incomingCallName1;
       
  7991 
       
  7992 	TInt callId2 = 2;
       
  7993 	TName incomingCallName2;
       
  7994 
       
  7995 	TRequestStatus requestStatus1;
       
  7996 	TRequestStatus requestStatus2;
       
  7997 
       
  7998 	// open new line1 for KMmTsyVoice1LineName
       
  7999 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
  8000 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8001 
       
  8002 	// open new line2 for KMmTsyVoice1LineName
       
  8003 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
  8004 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8005 
       
  8006     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8007     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8008 
       
  8009 	//-------------------------------------------------------------------------
       
  8010 	// Test A: Test multiple clients requesting RCall::AnswerIncomingCall
       
  8011  	//-------------------------------------------------------------------------
       
  8012 
       
  8013  	//-------------------------------------------------------------------------
       
  8014 	// create new incoming call1
       
  8015 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
  8016 	                               mobileService, mobileCallStatus);	
       
  8017 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8018 	AssertMockLtsyStatusL();
       
  8019 		
       
  8020     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  8021     ASSERT_EQUALS(KErrNone, errorCode);
       
  8022 	AssertMockLtsyStatusL();
       
  8023  	//-------------------------------------------------------------------------
       
  8024 	
       
  8025  	//-------------------------------------------------------------------------
       
  8026 	// create new incoming call2
       
  8027 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
  8028 	                               mobileService, mobileCallStatus);	
       
  8029 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8030 	AssertMockLtsyStatusL();
       
  8031 		
       
  8032     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  8033     ASSERT_EQUALS(KErrNone, errorCode);
       
  8034 	AssertMockLtsyStatusL();
       
  8035  	//-------------------------------------------------------------------------
       
  8036 
       
  8037     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  8038     expectData.Close();
       
  8039     mockData01.SerialiseL(expectData);
       
  8040     iMockLTSY.ExpectL(EMobileCallSwap, expectData);
       
  8041     iMockLTSY.CompleteL(EMobileCallSwap, KErrNone, expectData);
       
  8042 
       
  8043     call1.Swap(requestStatus1);
       
  8044 
       
  8045     TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  8046     expectData.Close();
       
  8047     mockData02.SerialiseL(expectData);
       
  8048     iMockLTSY.ExpectL(EMobileCallSwap, expectData);
       
  8049     iMockLTSY.CompleteL(EMobileCallSwap, KErrNone, expectData);
       
  8050 
       
  8051     call2.Swap(requestStatus2);
       
  8052 
       
  8053     User::WaitForRequest(requestStatus1);
       
  8054     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  8055 
       
  8056     User::WaitForRequest(requestStatus2);
       
  8057     AssertMockLtsyStatusL();
       
  8058     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  8059 
       
  8060 	// Done !
       
  8061 	CleanupStack::PopAndDestroy(4); // line1, line2, call1, call2
       
  8062 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, expectData, this
       
  8063 	}
       
  8064 
       
  8065 
       
  8066 /**
       
  8067 @SYMTestCaseID BA-CTSY-CCON-CS-0005
       
  8068 @SYMComponent  telephony_ctsy
       
  8069 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Swap with timeout for voice calls
       
  8070 @SYMTestPriority High
       
  8071 @SYMTestActions Invokes RMobileCall::Swap and tests for timeout for voice calls
       
  8072 @SYMTestExpectedResults Pass
       
  8073 @SYMTestType CT
       
  8074 */
       
  8075 void CCTsyCallControlFU::TestSwap0005L()
       
  8076 	{
       
  8077 	OpenEtelServerL(EUseExtendedError);
       
  8078 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8079 	OpenPhoneL();
       
  8080 
       
  8081 	RBuf8 expectData;
       
  8082 	CleanupClosePushL(expectData);
       
  8083 
       
  8084 	RLine line;
       
  8085 	RMobileCall call;
       
  8086 	CleanupClosePushL(call);
       
  8087 	
       
  8088 	TInt errorCode = KErrNone;
       
  8089 	TInt callId = 1;
       
  8090 	TName incomingCallName;
       
  8091 
       
  8092     TRequestStatus requestStatus;
       
  8093 	TRequestStatus mockLtsyStatus;
       
  8094 
       
  8095 	// open new line for KMmTsyVoice1LineName
       
  8096 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  8097 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8098 	
       
  8099     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8100     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8101 
       
  8102 	//-------------------------------------------------------------------------
       
  8103 	// Test A: Test timeout of RMobileCall::Swap
       
  8104  	//-------------------------------------------------------------------------
       
  8105 		
       
  8106  	//-------------------------------------------------------------------------
       
  8107 	// create new incoming call
       
  8108 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  8109 	                               mobileService, mobileCallStatus);	
       
  8110 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8111 	AssertMockLtsyStatusL();
       
  8112 		
       
  8113     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8114     ASSERT_EQUALS(KErrNone, errorCode);
       
  8115 	AssertMockLtsyStatusL();
       
  8116  	//-------------------------------------------------------------------------
       
  8117 
       
  8118     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8119     expectData.Close();
       
  8120     mockData0.SerialiseL(expectData);
       
  8121     iMockLTSY.ExpectL(EMobileCallSwap, expectData);
       
  8122 
       
  8123     call.Swap(requestStatus);
       
  8124 
       
  8125     User::WaitForRequest(requestStatus);
       
  8126     AssertMockLtsyStatusL();
       
  8127     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  8128 
       
  8129 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
  8130 	}
       
  8131 
       
  8132 
       
  8133 /**
       
  8134 @SYMTestCaseID BA-CTSY-CCON-CS-0006
       
  8135 @SYMComponent  telephony_ctsy
       
  8136 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Swap for data calls
       
  8137 @SYMTestPriority High
       
  8138 @SYMTestActions Invokes RMobileCall::Swap for data calls
       
  8139 @SYMTestExpectedResults Pass
       
  8140 @SYMTestType CT
       
  8141 */
       
  8142 void CCTsyCallControlFU::TestSwap0006L()
       
  8143 	{
       
  8144 	OpenEtelServerL(EUseExtendedError);
       
  8145 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8146 	OpenPhoneL();
       
  8147 
       
  8148 	RBuf8 expectData;
       
  8149 	CleanupClosePushL(expectData);
       
  8150 
       
  8151 	RLine line;
       
  8152 	RMobileCall call;
       
  8153 	CleanupClosePushL(call);
       
  8154 	
       
  8155 	TInt errorCode = KErrNone;
       
  8156 	TInt callId = 1;
       
  8157 	TName incomingCallName;
       
  8158 
       
  8159     TRequestStatus requestStatus;
       
  8160 	TRequestStatus mockLtsyStatus;
       
  8161 
       
  8162 	// open new line for data
       
  8163 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  8164 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8165 
       
  8166     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  8167     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8168 
       
  8169     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8170 
       
  8171  	//-------------------------------------------------------------------------
       
  8172 	// TEST A: failure to dispatch request to LTSY
       
  8173  	//-------------------------------------------------------------------------
       
  8174 
       
  8175  	//-------------------------------------------------------------------------
       
  8176 	// create new incoming call
       
  8177 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8178 	                               mobileService, mobileCallStatus);	
       
  8179 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8180 		
       
  8181     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8182     ASSERT_EQUALS(KErrNone, errorCode);
       
  8183  	//-------------------------------------------------------------------------
       
  8184 
       
  8185 	// see line 252 in function CMmDataCallTsy::DoExtFuncL in file CMmDataCallTsy.cpp
       
  8186     call.Swap(requestStatus);
       
  8187 
       
  8188     User::WaitForRequest(requestStatus);
       
  8189     AssertMockLtsyStatusL();
       
  8190     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8191 
       
  8192 	AssertMockLtsyStatusL();
       
  8193 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8194 	}
       
  8195 
       
  8196 /**
       
  8197 @SYMTestCaseID BA-CTSY-CCON-CS-00011
       
  8198 @SYMComponent  telephony_ctsy
       
  8199 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Swap for fax calls
       
  8200 @SYMTestPriority High
       
  8201 @SYMTestActions Invokes RMobileCall::Swap for fax calls
       
  8202 @SYMTestExpectedResults Pass
       
  8203 @SYMTestType CT
       
  8204 */
       
  8205 void CCTsyCallControlFU::TestSwap00011L()
       
  8206 	{
       
  8207 	OpenEtelServerL(EUseExtendedError);
       
  8208 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8209 	OpenPhoneL();
       
  8210 
       
  8211 	RBuf8 expectData;
       
  8212 	CleanupClosePushL(expectData);
       
  8213 
       
  8214 	RLine line;
       
  8215 	RMobileCall call;
       
  8216 	CleanupClosePushL(call);
       
  8217 	
       
  8218 	TInt errorCode = KErrNone;
       
  8219 	TInt callId = 1;
       
  8220 	TName incomingCallName;
       
  8221 
       
  8222     TRequestStatus requestStatus;
       
  8223 	TRequestStatus mockLtsyStatus;
       
  8224 
       
  8225 	// open new line for data
       
  8226 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  8227 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8228 
       
  8229     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  8230     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8231 
       
  8232     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8233 
       
  8234  	//-------------------------------------------------------------------------
       
  8235 	// TEST A: failure to dispatch request to LTSY
       
  8236  	//-------------------------------------------------------------------------
       
  8237 
       
  8238  	//-------------------------------------------------------------------------
       
  8239 	// create new incoming call
       
  8240 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8241 	                               mobileService, mobileCallStatus);	
       
  8242 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8243 		
       
  8244     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8245     ASSERT_EQUALS(KErrNone, errorCode);
       
  8246  	//-------------------------------------------------------------------------
       
  8247 
       
  8248 	// see line 265 in function CMmFaxCallTsy::DoExtFuncL in file CMmFaxCallTsy.cpp
       
  8249     call.Swap(requestStatus);
       
  8250 
       
  8251     User::WaitForRequest(requestStatus);
       
  8252     AssertMockLtsyStatusL();
       
  8253     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8254 
       
  8255 	AssertMockLtsyStatusL();
       
  8256 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8257 	}
       
  8258 
       
  8259 /**
       
  8260 @SYMTestCaseID BA-CTSY-CCON-CR-0001
       
  8261 @SYMComponent  telephony_ctsy
       
  8262 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Resume for voice calls
       
  8263 @SYMTestPriority High
       
  8264 @SYMTestActions Invokes RMobileCall::Resume for voice calls
       
  8265 @SYMTestExpectedResults Pass
       
  8266 @SYMTestType CT
       
  8267 */
       
  8268 void CCTsyCallControlFU::TestResume0001L()
       
  8269 	{
       
  8270 
       
  8271 	OpenEtelServerL(EUseExtendedError);
       
  8272 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8273 	OpenPhoneL();
       
  8274 
       
  8275     RBuf8 expectData;
       
  8276     CleanupClosePushL(expectData);
       
  8277 
       
  8278     RBuf8 completeData;
       
  8279     CleanupClosePushL(completeData);
       
  8280 
       
  8281 	RLine line;
       
  8282 	RMobileCall call;
       
  8283 	CleanupClosePushL(call);
       
  8284 	
       
  8285 	TInt errorCode = KErrNone;
       
  8286 	TInt callId = 1;
       
  8287 	TName incomingCallName;
       
  8288     TRequestStatus requestStatus;
       
  8289     TRequestStatus mockLtsyStatus;
       
  8290 
       
  8291 	// open new line and call for KMmTsyVoice1LineName
       
  8292 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  8293 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8294 		
       
  8295     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8296     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8297 	
       
  8298     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8299 	
       
  8300 	
       
  8301  	//-------------------------------------------------------------------------
       
  8302 	// TEST A: failure to dispatch request to LTSY
       
  8303  	//-------------------------------------------------------------------------
       
  8304 
       
  8305  	//-------------------------------------------------------------------------
       
  8306 	// create new incoming call
       
  8307 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8308 	                               mobileService, mobileCallStatus);	
       
  8309 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8310     AssertMockLtsyStatusL();
       
  8311 		
       
  8312     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8313     ASSERT_EQUALS(KErrNone, errorCode);
       
  8314     AssertMockLtsyStatusL();
       
  8315  	//-------------------------------------------------------------------------
       
  8316 
       
  8317     expectData.Close();
       
  8318     mockData0.SerialiseL(expectData);
       
  8319     iMockLTSY.ExpectL(EMobileCallResume, expectData, KErrNotSupported);
       
  8320     call.Resume(requestStatus);
       
  8321 
       
  8322     User::WaitForRequest(requestStatus);
       
  8323     AssertMockLtsyStatusL();
       
  8324     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8325 
       
  8326 	// close incoming call
       
  8327     CloseIncomingCallL(call, callId, mobileService);
       
  8328 
       
  8329 	//-------------------------------------------------------------------------
       
  8330 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  8331  	//-------------------------------------------------------------------------
       
  8332 
       
  8333  	//-------------------------------------------------------------------------
       
  8334 	// create new incoming call
       
  8335 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8336 	                               mobileService, mobileCallStatus);	
       
  8337 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8338     AssertMockLtsyStatusL();
       
  8339 		
       
  8340     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8341     ASSERT_EQUALS(KErrNone, errorCode);
       
  8342     AssertMockLtsyStatusL();
       
  8343  	//-------------------------------------------------------------------------
       
  8344 
       
  8345     expectData.Close();
       
  8346     mockData0.SerialiseL(expectData);
       
  8347     iMockLTSY.ExpectL(EMobileCallResume, expectData);
       
  8348     iMockLTSY.CompleteL(EMobileCallResume, KErrGeneral, expectData);
       
  8349     call.Resume(requestStatus);
       
  8350 
       
  8351     User::WaitForRequest(requestStatus);
       
  8352     AssertMockLtsyStatusL();
       
  8353     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  8354 
       
  8355 	// close incoming call
       
  8356     CloseIncomingCallL(call, callId, mobileService);
       
  8357 
       
  8358  	//-------------------------------------------------------------------------
       
  8359 	// TEST C: Successful completion request of
       
  8360 	// RMobileCall::Resume when result is not cached.
       
  8361  	//-------------------------------------------------------------------------
       
  8362 
       
  8363  	//-------------------------------------------------------------------------
       
  8364 	// create new incoming call
       
  8365 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8366 	                               mobileService, mobileCallStatus);	
       
  8367 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8368     AssertMockLtsyStatusL();
       
  8369 		
       
  8370     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8371     ASSERT_EQUALS(KErrNone, errorCode);
       
  8372     AssertMockLtsyStatusL();
       
  8373  	//-------------------------------------------------------------------------
       
  8374 
       
  8375     expectData.Close();
       
  8376     mockData0.SerialiseL(expectData);
       
  8377     iMockLTSY.ExpectL(EMobileCallResume, expectData);
       
  8378     iMockLTSY.CompleteL(EMobileCallResume, KErrNone, expectData);
       
  8379     call.Resume(requestStatus);
       
  8380 
       
  8381     User::WaitForRequest(requestStatus);
       
  8382     AssertMockLtsyStatusL();
       
  8383     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  8384 
       
  8385 	// close incoming call
       
  8386     CloseIncomingCallL(call, callId, mobileService);
       
  8387 
       
  8388  	//-------------------------------------------------------------------------
       
  8389 	// TEST E: Unsolicited completion of RMobileCall::Resume
       
  8390 	// from LTSY.
       
  8391  	//-------------------------------------------------------------------------
       
  8392 
       
  8393 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  8394     expectData.Close();
       
  8395     mockData0.SerialiseL(expectData);
       
  8396 	iMockLTSY.CompleteL(EMobileCallResume, KErrNone, expectData);
       
  8397 	User::WaitForRequest(mockLtsyStatus);
       
  8398 	AssertMockLtsyStatusL();
       
  8399 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  8400 
       
  8401 	AssertMockLtsyStatusL();
       
  8402 	CleanupStack::PopAndDestroy(5, this); // expectData, completeData, line, this, call
       
  8403 	
       
  8404 	}
       
  8405 
       
  8406 
       
  8407 /**
       
  8408 @SYMTestCaseID BA-CTSY-CCON-CR-0002
       
  8409 @SYMComponent  telephony_ctsy
       
  8410 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobileCall::Resume for voice calls
       
  8411 @SYMTestPriority High
       
  8412 @SYMTestActions Invokes cancelling of RMobileCall::Resume for voice calls
       
  8413 @SYMTestExpectedResults Pass
       
  8414 @SYMTestType CT
       
  8415 */
       
  8416 void CCTsyCallControlFU::TestResume0002L()
       
  8417 	{
       
  8418 
       
  8419 	OpenEtelServerL(EUseExtendedError);
       
  8420 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8421 	OpenPhoneL();
       
  8422 
       
  8423 	RBuf8 expectData;
       
  8424 	CleanupClosePushL(expectData);
       
  8425 
       
  8426 	RLine line;
       
  8427 	RMobileCall call;
       
  8428 	CleanupClosePushL(call);
       
  8429 	
       
  8430 	TInt errorCode = KErrNone;
       
  8431 	TInt callId = 1;
       
  8432 	TName incomingCallName;
       
  8433 
       
  8434     TRequestStatus requestStatus;
       
  8435 	TRequestStatus mockLtsyStatus;
       
  8436 	
       
  8437     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8438     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8439 	
       
  8440  	//-------------------------------------------------------------------------
       
  8441 	// Test cancelling of RCall::AnswerIncomingCall
       
  8442  	//-------------------------------------------------------------------------
       
  8443  	
       
  8444 	// open new line for KMmTsyVoice1LineName
       
  8445 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  8446 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8447 		
       
  8448  	//-------------------------------------------------------------------------
       
  8449 	// create new incoming call
       
  8450 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  8451 	                               mobileService, mobileCallStatus);	
       
  8452 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8453 	AssertMockLtsyStatusL();
       
  8454 		
       
  8455     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8456     ASSERT_EQUALS(KErrNone, errorCode);
       
  8457 	AssertMockLtsyStatusL();
       
  8458  	//-------------------------------------------------------------------------
       
  8459 
       
  8460 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  8461     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8462     expectData.Close();
       
  8463     mockData0.SerialiseL(expectData);
       
  8464 
       
  8465     iMockLTSY.ExpectL(EMobileCallResume, expectData);
       
  8466     iMockLTSY.CompleteL(EMobileCallResume, KErrNone, expectData);
       
  8467 
       
  8468     call.Resume(requestStatus);
       
  8469 
       
  8470     call.CancelAsyncRequest(EMobileCallResume);
       
  8471 
       
  8472     User::WaitForRequest(requestStatus);
       
  8473     AssertMockLtsyStatusL();
       
  8474     // see CMmVoiceCallTsy::CancelService in line 507 in file CMmVoiceCallTsy.cpp
       
  8475     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  8476 
       
  8477 	User::WaitForRequest(mockLtsyStatus);
       
  8478 	
       
  8479 	CleanupStack::PopAndDestroy(4); // expectData, this, call, line
       
  8480 	}
       
  8481 
       
  8482 /**
       
  8483 @SYMTestCaseID BA-CTSY-CCON-CR-0004
       
  8484 @SYMComponent  telephony_ctsy
       
  8485 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileCall::Resume for voice calls
       
  8486 @SYMTestPriority High
       
  8487 @SYMTestActions Invokes multiple client requests to RMobileCall::Resume for voice calls
       
  8488 @SYMTestExpectedResults Pass
       
  8489 @SYMTestType CT
       
  8490 */
       
  8491 void CCTsyCallControlFU::TestResume0004L()
       
  8492 	{
       
  8493 	OpenEtelServerL(EUseExtendedError);
       
  8494 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8495 	OpenPhoneL();
       
  8496 
       
  8497 	RBuf8 expectData;
       
  8498 	CleanupClosePushL(expectData);
       
  8499 
       
  8500 	// Open second client
       
  8501 	RTelServer telServer2;
       
  8502 	TInt ret = telServer2.Connect();
       
  8503 	ASSERT_EQUALS(KErrNone, ret);
       
  8504 	CleanupClosePushL(telServer2);
       
  8505 
       
  8506 	RMobilePhone phone2;
       
  8507 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  8508 	ASSERT_EQUALS(KErrNone, ret);
       
  8509 	CleanupClosePushL(phone2);
       
  8510 
       
  8511 	RLine line1;
       
  8512 	RLine line2;
       
  8513 	
       
  8514 	RMobileCall call1;
       
  8515 	CleanupClosePushL(call1);
       
  8516 
       
  8517 	RMobileCall call2;
       
  8518 	CleanupClosePushL(call2);
       
  8519 	
       
  8520 	TInt errorCode = KErrNone;
       
  8521 
       
  8522 	TInt callId1 = 1;
       
  8523 	TName incomingCallName1;
       
  8524 
       
  8525 	TInt callId2 = 2;
       
  8526 	TName incomingCallName2;
       
  8527 
       
  8528 	TRequestStatus requestStatus1;
       
  8529 	TRequestStatus requestStatus2;
       
  8530 
       
  8531 	// open new line1 for KMmTsyVoice1LineName
       
  8532 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
  8533 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8534 
       
  8535 	// open new line2 for KMmTsyVoice1LineName
       
  8536 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
  8537 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8538 
       
  8539     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8540     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8541 
       
  8542 	//-------------------------------------------------------------------------
       
  8543 	// Test A: Test multiple clients requesting RCall::AnswerIncomingCall
       
  8544  	//-------------------------------------------------------------------------
       
  8545 
       
  8546  	//-------------------------------------------------------------------------
       
  8547 	// create new incoming call1
       
  8548 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
  8549 	                               mobileService, mobileCallStatus);	
       
  8550 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8551 	AssertMockLtsyStatusL();
       
  8552 		
       
  8553     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  8554     ASSERT_EQUALS(KErrNone, errorCode);
       
  8555 	AssertMockLtsyStatusL();
       
  8556  	//-------------------------------------------------------------------------
       
  8557 	
       
  8558  	//-------------------------------------------------------------------------
       
  8559 	// create new incoming call2
       
  8560 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
  8561 	                               mobileService, mobileCallStatus);	
       
  8562 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8563 	AssertMockLtsyStatusL();
       
  8564 		
       
  8565     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  8566     ASSERT_EQUALS(KErrNone, errorCode);
       
  8567 	AssertMockLtsyStatusL();
       
  8568  	//-------------------------------------------------------------------------
       
  8569 
       
  8570     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
  8571     expectData.Close();
       
  8572     mockData01.SerialiseL(expectData);
       
  8573     iMockLTSY.ExpectL(EMobileCallResume, expectData);
       
  8574     iMockLTSY.CompleteL(EMobileCallResume, KErrNone, expectData);
       
  8575 
       
  8576     call1.Resume(requestStatus1);
       
  8577 
       
  8578     TMockLtsyCallData0 mockData02(callId2, mobileService);
       
  8579     expectData.Close();
       
  8580     mockData02.SerialiseL(expectData);
       
  8581     iMockLTSY.ExpectL(EMobileCallResume, expectData);
       
  8582     iMockLTSY.CompleteL(EMobileCallResume, KErrNone, expectData);
       
  8583 
       
  8584     call2.Resume(requestStatus2);
       
  8585 
       
  8586     User::WaitForRequest(requestStatus1);
       
  8587     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  8588 
       
  8589     User::WaitForRequest(requestStatus2);
       
  8590     AssertMockLtsyStatusL();
       
  8591     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
  8592 
       
  8593 	// Done !
       
  8594 	CleanupStack::PopAndDestroy(4); // line1, line2, call1, call2
       
  8595 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, expectData, this
       
  8596 	}
       
  8597 
       
  8598 
       
  8599 /**
       
  8600 @SYMTestCaseID BA-CTSY-CCON-CR-0005
       
  8601 @SYMComponent  telephony_ctsy
       
  8602 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Resume with timeout for voice calls
       
  8603 @SYMTestPriority High
       
  8604 @SYMTestActions Invokes RMobileCall::Resume and tests for timeout for voice calls
       
  8605 @SYMTestExpectedResults Pass
       
  8606 @SYMTestType CT
       
  8607 */
       
  8608 void CCTsyCallControlFU::TestResume0005L()
       
  8609 	{
       
  8610 	OpenEtelServerL(EUseExtendedError);
       
  8611 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8612 	OpenPhoneL();
       
  8613 
       
  8614 	RBuf8 expectData;
       
  8615 	CleanupClosePushL(expectData);
       
  8616 
       
  8617 	RLine line;
       
  8618 	RMobileCall call;
       
  8619 	CleanupClosePushL(call);
       
  8620 	
       
  8621 	TInt errorCode = KErrNone;
       
  8622 	TInt callId = 1;
       
  8623 	TName incomingCallName;
       
  8624 
       
  8625     TRequestStatus requestStatus;
       
  8626 	TRequestStatus mockLtsyStatus;
       
  8627 
       
  8628 	// open new line for KMmTsyVoice1LineName
       
  8629 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  8630 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8631 	
       
  8632     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8633     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8634 
       
  8635 	//-------------------------------------------------------------------------
       
  8636 	// Test A: Test timeout of RCall::AnswerIncomingCall
       
  8637  	//-------------------------------------------------------------------------
       
  8638 		
       
  8639  	//-------------------------------------------------------------------------
       
  8640 	// create new incoming call
       
  8641 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  8642 	                               mobileService, mobileCallStatus);	
       
  8643 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8644 	AssertMockLtsyStatusL();
       
  8645 		
       
  8646     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8647     ASSERT_EQUALS(KErrNone, errorCode);
       
  8648 	AssertMockLtsyStatusL();
       
  8649  	//-------------------------------------------------------------------------
       
  8650 
       
  8651     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8652     expectData.Close();
       
  8653     mockData0.SerialiseL(expectData);
       
  8654     iMockLTSY.ExpectL(EMobileCallResume, expectData);
       
  8655 
       
  8656     call.Resume(requestStatus);
       
  8657 
       
  8658     User::WaitForRequest(requestStatus);
       
  8659     AssertMockLtsyStatusL();
       
  8660     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  8661 
       
  8662 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
  8663 	}
       
  8664 
       
  8665 
       
  8666 /**
       
  8667 @SYMTestCaseID BA-CTSY-CCON-CR-0006
       
  8668 @SYMComponent  telephony_ctsy
       
  8669 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Resume for data calls
       
  8670 @SYMTestPriority High
       
  8671 @SYMTestActions Invokes RMobileCall::Resume for data calls
       
  8672 @SYMTestExpectedResults Pass
       
  8673 @SYMTestType CT
       
  8674 */
       
  8675 void CCTsyCallControlFU::TestResume0006L()
       
  8676 	{
       
  8677 
       
  8678 	OpenEtelServerL(EUseExtendedError);
       
  8679 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8680 	OpenPhoneL();
       
  8681 
       
  8682 	RBuf8 expectData;
       
  8683 	CleanupClosePushL(expectData);
       
  8684 
       
  8685 	RLine line;
       
  8686 	RMobileCall call;
       
  8687 	CleanupClosePushL(call);
       
  8688 	
       
  8689 	TInt errorCode = KErrNone;
       
  8690 	TInt callId = 1;
       
  8691 	TName incomingCallName;
       
  8692 
       
  8693     TRequestStatus requestStatus;
       
  8694 	TRequestStatus mockLtsyStatus;
       
  8695 
       
  8696 	// open new line for data
       
  8697 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  8698 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8699 
       
  8700     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  8701     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8702 
       
  8703     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8704 
       
  8705  	//-------------------------------------------------------------------------
       
  8706 	// TEST A: failure to dispatch request to LTSY
       
  8707  	//-------------------------------------------------------------------------
       
  8708 
       
  8709  	//-------------------------------------------------------------------------
       
  8710 	// create new incoming call
       
  8711 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8712 	                               mobileService, mobileCallStatus);	
       
  8713 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8714 		
       
  8715     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8716     ASSERT_EQUALS(KErrNone, errorCode);
       
  8717  	//-------------------------------------------------------------------------
       
  8718 
       
  8719 	// see EMobileCallResume case in function CMmDataCallTsy::DoExtFuncL in file CMmDataCallTsy.cpp
       
  8720     call.Resume(requestStatus);
       
  8721 
       
  8722     User::WaitForRequest(requestStatus);
       
  8723     AssertMockLtsyStatusL();
       
  8724     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8725 
       
  8726 	AssertMockLtsyStatusL();
       
  8727 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8728 	}
       
  8729 
       
  8730 /**
       
  8731 @SYMTestCaseID BA-CTSY-CCON-CR-00011
       
  8732 @SYMComponent  telephony_ctsy
       
  8733 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Resume for fax calls
       
  8734 @SYMTestPriority High
       
  8735 @SYMTestActions Invokes RMobileCall::Resume for fax calls
       
  8736 @SYMTestExpectedResults Pass
       
  8737 @SYMTestType CT
       
  8738 */
       
  8739 void CCTsyCallControlFU::TestResume00011L()
       
  8740 	{
       
  8741 
       
  8742 	OpenEtelServerL(EUseExtendedError);
       
  8743 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8744 	OpenPhoneL();
       
  8745 
       
  8746 	RBuf8 expectData;
       
  8747 	CleanupClosePushL(expectData);
       
  8748 
       
  8749 	RLine line;
       
  8750 	RMobileCall call;
       
  8751 	CleanupClosePushL(call);
       
  8752 	
       
  8753 	TInt errorCode = KErrNone;
       
  8754 	TInt callId = 1;
       
  8755 	TName incomingCallName;
       
  8756 
       
  8757     TRequestStatus requestStatus;
       
  8758 	TRequestStatus mockLtsyStatus;
       
  8759 
       
  8760 	// open new line for data
       
  8761 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  8762 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8763 
       
  8764     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  8765     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8766 
       
  8767     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8768 
       
  8769  	//-------------------------------------------------------------------------
       
  8770 	// TEST A: failure to dispatch request to LTSY
       
  8771  	//-------------------------------------------------------------------------
       
  8772 
       
  8773  	//-------------------------------------------------------------------------
       
  8774 	// create new incoming call
       
  8775 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8776 	                               mobileService, mobileCallStatus);	
       
  8777 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8778 		
       
  8779     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8780     ASSERT_EQUALS(KErrNone, errorCode);
       
  8781  	//-------------------------------------------------------------------------
       
  8782 
       
  8783 	// see EMobileCallResume case in function CMmFaxCallTsy::DoExtFuncL in file CMmFaxCallTsy.cpp
       
  8784     call.Resume(requestStatus);
       
  8785 
       
  8786     User::WaitForRequest(requestStatus);
       
  8787     AssertMockLtsyStatusL();
       
  8788     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8789 
       
  8790 	AssertMockLtsyStatusL();
       
  8791 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8792 	}
       
  8793 
       
  8794 /**
       
  8795 @SYMTestCaseID BA-CTSY-CCON-CDF-0001
       
  8796 @SYMComponent  telephony_ctsy
       
  8797 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Deflect for voice calls
       
  8798 @SYMTestPriority High
       
  8799 @SYMTestActions Invokes RMobileCall::Deflect for voice calls
       
  8800 @SYMTestExpectedResults Pass
       
  8801 @SYMTestType CT
       
  8802 */
       
  8803 void CCTsyCallControlFU::TestDeflect0001L()
       
  8804 	{
       
  8805 
       
  8806 	OpenEtelServerL(EUseExtendedError);
       
  8807 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8808 	OpenPhoneL();
       
  8809 
       
  8810 	RBuf8 expectData;
       
  8811 	CleanupClosePushL(expectData);
       
  8812 
       
  8813 	RLine line;
       
  8814 	RMobileCall call;
       
  8815 	CleanupClosePushL(call);
       
  8816 	
       
  8817 	TInt errorCode = KErrNone;
       
  8818 	TInt callId = 1;
       
  8819 	TName incomingCallName;
       
  8820 
       
  8821     TRequestStatus requestStatus;
       
  8822 	TRequestStatus mockLtsyStatus;
       
  8823 
       
  8824 	// open new line for data
       
  8825 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  8826 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8827 
       
  8828     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  8829     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8830 
       
  8831     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8832 
       
  8833  	//-------------------------------------------------------------------------
       
  8834 	// Test API is not supported
       
  8835  	//-------------------------------------------------------------------------
       
  8836 
       
  8837  	//-------------------------------------------------------------------------
       
  8838 	// create new incoming call
       
  8839 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8840 	                               mobileService, mobileCallStatus);	
       
  8841 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8842 		
       
  8843     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8844     ASSERT_EQUALS(KErrNone, errorCode);
       
  8845  	//-------------------------------------------------------------------------
       
  8846 
       
  8847 	RMobileCall::TMobileCallDeflect deflectType = RMobileCall::EDeflectUnspecified;
       
  8848 	RMobilePhone::TMobileAddress destination;
       
  8849     call.Deflect(requestStatus, deflectType, destination);
       
  8850 
       
  8851     User::WaitForRequest(requestStatus);
       
  8852     AssertMockLtsyStatusL();
       
  8853     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8854 
       
  8855 	AssertMockLtsyStatusL();
       
  8856 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8857 	}
       
  8858 
       
  8859 
       
  8860 /**
       
  8861 @SYMTestCaseID BA-CTSY-CCON-CDF-0002
       
  8862 @SYMComponent  telephony_ctsy
       
  8863 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Deflect for data calls
       
  8864 @SYMTestPriority High
       
  8865 @SYMTestActions Invokes RMobileCall::Deflect for data calls
       
  8866 @SYMTestExpectedResults Pass
       
  8867 @SYMTestType CT
       
  8868 */
       
  8869 void CCTsyCallControlFU::TestDeflect0002L()
       
  8870 	{
       
  8871 
       
  8872 	OpenEtelServerL(EUseExtendedError);
       
  8873 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8874 	OpenPhoneL();
       
  8875 
       
  8876 	RBuf8 expectData;
       
  8877 	CleanupClosePushL(expectData);
       
  8878 
       
  8879 	RLine line;
       
  8880 	RMobileCall call;
       
  8881 	CleanupClosePushL(call);
       
  8882 	
       
  8883 	TInt errorCode = KErrNone;
       
  8884 	TInt callId = 1;
       
  8885 	TName incomingCallName;
       
  8886 
       
  8887     TRequestStatus requestStatus;
       
  8888 	TRequestStatus mockLtsyStatus;
       
  8889 
       
  8890 	// open new line for data
       
  8891 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  8892 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8893 
       
  8894     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  8895     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8896 
       
  8897     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8898 
       
  8899  	//-------------------------------------------------------------------------
       
  8900 	// Test API is not supported
       
  8901  	//-------------------------------------------------------------------------
       
  8902 
       
  8903  	//-------------------------------------------------------------------------
       
  8904 	// create new incoming call
       
  8905 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8906 	                               mobileService, mobileCallStatus);	
       
  8907 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8908 		
       
  8909     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8910     ASSERT_EQUALS(KErrNone, errorCode);
       
  8911  	//-------------------------------------------------------------------------
       
  8912 
       
  8913 	RMobileCall::TMobileCallDeflect deflectType = RMobileCall::EDeflectUnspecified;
       
  8914 	RMobilePhone::TMobileAddress destination;
       
  8915     call.Deflect(requestStatus, deflectType, destination);
       
  8916 
       
  8917     User::WaitForRequest(requestStatus);
       
  8918     AssertMockLtsyStatusL();
       
  8919     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8920 
       
  8921 	AssertMockLtsyStatusL();
       
  8922 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8923 	}
       
  8924 
       
  8925 
       
  8926 /**
       
  8927 @SYMTestCaseID BA-CTSY-CCON-CDF-0003
       
  8928 @SYMComponent  telephony_ctsy
       
  8929 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Deflect for fax calls
       
  8930 @SYMTestPriority High
       
  8931 @SYMTestActions Invokes RMobileCall::Deflect for fax calls
       
  8932 @SYMTestExpectedResults Pass
       
  8933 @SYMTestType CT
       
  8934 */
       
  8935 void CCTsyCallControlFU::TestDeflect0003L()
       
  8936 	{
       
  8937 
       
  8938 	OpenEtelServerL(EUseExtendedError);
       
  8939 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  8940 	OpenPhoneL();
       
  8941 
       
  8942 	RBuf8 expectData;
       
  8943 	CleanupClosePushL(expectData);
       
  8944 
       
  8945 	RLine line;
       
  8946 	RMobileCall call;
       
  8947 	CleanupClosePushL(call);
       
  8948 	
       
  8949 	TInt errorCode = KErrNone;
       
  8950 	TInt callId = 1;
       
  8951 	TName incomingCallName;
       
  8952 
       
  8953     TRequestStatus requestStatus;
       
  8954 	TRequestStatus mockLtsyStatus;
       
  8955 
       
  8956 	// open new line for data
       
  8957 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  8958 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8959 
       
  8960     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  8961     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  8962 
       
  8963     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  8964 
       
  8965  	//-------------------------------------------------------------------------
       
  8966 	// Test API is not supported
       
  8967  	//-------------------------------------------------------------------------
       
  8968 
       
  8969  	//-------------------------------------------------------------------------
       
  8970 	// create new incoming call
       
  8971 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  8972 	                               mobileService, mobileCallStatus);	
       
  8973 	ASSERT_EQUALS(KErrNone, errorCode);
       
  8974 		
       
  8975     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  8976     ASSERT_EQUALS(KErrNone, errorCode);
       
  8977  	//-------------------------------------------------------------------------
       
  8978 
       
  8979 	RMobileCall::TMobileCallDeflect deflectType = RMobileCall::EDeflectUnspecified;
       
  8980 	RMobilePhone::TMobileAddress destination;
       
  8981     call.Deflect(requestStatus, deflectType, destination);
       
  8982 
       
  8983     User::WaitForRequest(requestStatus);
       
  8984     AssertMockLtsyStatusL();
       
  8985     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  8986 
       
  8987 	AssertMockLtsyStatusL();
       
  8988 	CleanupStack::PopAndDestroy(4); // expectData, call, line
       
  8989 	}
       
  8990 
       
  8991 
       
  8992 /**
       
  8993 @SYMTestCaseID BA-CTSY-CCON-CT-0001
       
  8994 @SYMComponent  telephony_ctsy
       
  8995 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Transfer for voice calls
       
  8996 @SYMTestPriority High
       
  8997 @SYMTestActions Invokes RMobileCall::Transfer for voice calls
       
  8998 @SYMTestExpectedResults Pass
       
  8999 @SYMTestType CT
       
  9000 */
       
  9001 void CCTsyCallControlFU::TestTransfer0001L()
       
  9002 	{
       
  9003 
       
  9004 	OpenEtelServerL(EUseExtendedError);
       
  9005 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9006 	OpenPhoneL();
       
  9007 
       
  9008     RBuf8 expectData;
       
  9009     CleanupClosePushL(expectData);
       
  9010 
       
  9011     RBuf8 completeData;
       
  9012     CleanupClosePushL(completeData);
       
  9013 
       
  9014 	RLine line;
       
  9015 	RMobileCall call;
       
  9016 	CleanupClosePushL(call);
       
  9017 	RMobileCall call2;
       
  9018 	CleanupClosePushL(call2);
       
  9019 	
       
  9020 	TInt errorCode = KErrNone;
       
  9021 	TInt callId(1);
       
  9022 	TName incomingCallName;
       
  9023     TRequestStatus requestStatus;
       
  9024     TRequestStatus requestNotify;
       
  9025 	
       
  9026 	// open new line and call for KMmTsyVoice1LineName
       
  9027 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  9028 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9029 		
       
  9030     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging; //RMobileCall::EStatusRinging;
       
  9031     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  9032 
       
  9033  	//-------------------------------------------------------------------------
       
  9034 	// create new incoming call
       
  9035 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9036 	                               mobileService, mobileCallStatus);	
       
  9037 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9038 		
       
  9039     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  9040     ASSERT_EQUALS(KErrNone, errorCode);
       
  9041  	//-------------------------------------------------------------------------
       
  9042 
       
  9043     mobileCallStatus = RMobileCall::EStatusHold;
       
  9044     callId = 2;
       
  9045 
       
  9046  	//-------------------------------------------------------------------------
       
  9047 	// TEST A: failure to dispatch request to LTSY
       
  9048  	//-------------------------------------------------------------------------
       
  9049 
       
  9050 	//-------------------------------------------------------------------------
       
  9051 	// create new incoming call
       
  9052     errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9053 	                               mobileService, mobileCallStatus);	
       
  9054 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9055 		
       
  9056     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9057     ASSERT_EQUALS(KErrNone, errorCode);
       
  9058  	//-------------------------------------------------------------------------
       
  9059 
       
  9060     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  9061     expectData.Close();
       
  9062     mockData0.SerialiseL(expectData);
       
  9063     iMockLTSY.ExpectL(EMobileCallTransfer, expectData, KErrNotSupported);
       
  9064 
       
  9065     call.Transfer(requestStatus);
       
  9066 
       
  9067     User::WaitForRequest(requestStatus);
       
  9068     AssertMockLtsyStatusL();
       
  9069     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  9070 
       
  9071 	// close incoming call
       
  9072  	CloseIncomingCallL(call, callId, mobileService);
       
  9073 
       
  9074 	//-------------------------------------------------------------------------
       
  9075 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  9076  	//-------------------------------------------------------------------------
       
  9077 
       
  9078  	//-------------------------------------------------------------------------
       
  9079 	// create new incoming call
       
  9080 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9081 	                               mobileService, mobileCallStatus);	
       
  9082 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9083     AssertMockLtsyStatusL();
       
  9084 		
       
  9085     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9086     ASSERT_EQUALS(KErrNone, errorCode);
       
  9087     AssertMockLtsyStatusL();
       
  9088  	//-------------------------------------------------------------------------
       
  9089 
       
  9090     expectData.Close();
       
  9091     mockData0.SerialiseL(expectData);
       
  9092     iMockLTSY.ExpectL(EMobileCallTransfer, expectData);
       
  9093     iMockLTSY.CompleteL(EMobileCallTransfer, KErrGeneral, expectData);
       
  9094     call.Transfer(requestStatus);
       
  9095 
       
  9096     User::WaitForRequest(requestStatus);
       
  9097     AssertMockLtsyStatusL();
       
  9098     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  9099 
       
  9100 	// close incoming call
       
  9101     CloseIncomingCallL(call, callId, mobileService);
       
  9102 
       
  9103  	//-------------------------------------------------------------------------
       
  9104 	// TEST C: Successful completion request of
       
  9105 	// RMobileCall::Transfer when result is not cached.
       
  9106  	//-------------------------------------------------------------------------
       
  9107 
       
  9108  	//-------------------------------------------------------------------------
       
  9109 	// create new incoming call
       
  9110 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9111 	                               mobileService, mobileCallStatus);	
       
  9112 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9113     AssertMockLtsyStatusL();
       
  9114 		
       
  9115     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9116     ASSERT_EQUALS(KErrNone, errorCode);
       
  9117     AssertMockLtsyStatusL();
       
  9118  	//-------------------------------------------------------------------------
       
  9119 
       
  9120     expectData.Close();
       
  9121     mockData0.SerialiseL(expectData);
       
  9122     iMockLTSY.ExpectL(EMobileCallTransfer, expectData);
       
  9123     iMockLTSY.CompleteL(EMobileCallTransfer, KErrNone, expectData);
       
  9124     call.Transfer(requestStatus);
       
  9125 
       
  9126     User::WaitForRequest(requestStatus);
       
  9127     AssertMockLtsyStatusL();
       
  9128     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  9129 
       
  9130 	// close incoming call
       
  9131     CloseIncomingCallL(call, callId, mobileService);
       
  9132 
       
  9133  	//-------------------------------------------------------------------------
       
  9134 	// TEST E: Unsolicited completion of RMobileCall::Transfer
       
  9135 	// from LTSY.
       
  9136  	//-------------------------------------------------------------------------
       
  9137 
       
  9138     TRequestStatus mockLtsyStatus;
       
  9139 
       
  9140 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  9141     expectData.Close();
       
  9142     mockData0.SerialiseL(expectData);
       
  9143 	iMockLTSY.CompleteL(EMobileCallTransfer, KErrNone, expectData);
       
  9144 	User::WaitForRequest(mockLtsyStatus);
       
  9145 	AssertMockLtsyStatusL();
       
  9146 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  9147 
       
  9148 	AssertMockLtsyStatusL();
       
  9149 	CleanupStack::PopAndDestroy(6, this); // expectData, completeData, call, line, call2
       
  9150 	}
       
  9151 
       
  9152 
       
  9153 /**
       
  9154 @SYMTestCaseID BA-CTSY-CCON-CT-0002
       
  9155 @SYMComponent  telephony_ctsy
       
  9156 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobileCall::Transfer for voice calls
       
  9157 @SYMTestPriority High
       
  9158 @SYMTestActions Invokes cancelling of RMobileCall::Transfer for voice calls
       
  9159 @SYMTestExpectedResults Pass
       
  9160 @SYMTestType CT
       
  9161 */
       
  9162 void CCTsyCallControlFU::TestTransfer0002L()
       
  9163 	{
       
  9164 
       
  9165 	OpenEtelServerL(EUseExtendedError);
       
  9166 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9167 	OpenPhoneL();
       
  9168 
       
  9169 	RBuf8 expectData;
       
  9170 	CleanupClosePushL(expectData);
       
  9171 
       
  9172 	RLine line;
       
  9173 	RMobileCall call;
       
  9174 	CleanupClosePushL(call);
       
  9175 	RMobileCall call2;
       
  9176 	CleanupClosePushL(call2);
       
  9177 	
       
  9178 	TInt errorCode = KErrNone;
       
  9179 	TInt callId = 1;
       
  9180 	TName incomingCallName;
       
  9181 
       
  9182     TRequestStatus requestStatus;
       
  9183 	TRequestStatus mockLtsyStatus;
       
  9184 	
       
  9185     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  9186     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  9187 
       
  9188     // open new line for KMmTsyVoice1LineName
       
  9189 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  9190 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9191 
       
  9192  	//-------------------------------------------------------------------------
       
  9193 	// create new incoming call
       
  9194 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9195 	                               mobileService, mobileCallStatus);	
       
  9196 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9197 		
       
  9198     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  9199     ASSERT_EQUALS(KErrNone, errorCode);
       
  9200  	//-------------------------------------------------------------------------
       
  9201 
       
  9202     mobileCallStatus = RMobileCall::EStatusHold;
       
  9203     callId = 2;
       
  9204 
       
  9205  	//-------------------------------------------------------------------------
       
  9206 	// Test cancelling of RMobileCall::Transfer
       
  9207  	//-------------------------------------------------------------------------
       
  9208  	
       
  9209  	//-------------------------------------------------------------------------
       
  9210 	// create new incoming call
       
  9211 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  9212 	                               mobileService, mobileCallStatus);	
       
  9213 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9214 	AssertMockLtsyStatusL();
       
  9215 		
       
  9216     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9217     ASSERT_EQUALS(KErrNone, errorCode);
       
  9218 	AssertMockLtsyStatusL();
       
  9219  	//-------------------------------------------------------------------------
       
  9220 
       
  9221 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  9222     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  9223     expectData.Close();
       
  9224     mockData0.SerialiseL(expectData);
       
  9225 
       
  9226     iMockLTSY.ExpectL(EMobileCallTransfer, expectData);
       
  9227     iMockLTSY.CompleteL(EMobileCallTransfer, KErrNone, expectData);
       
  9228 
       
  9229     call.Transfer(requestStatus);
       
  9230 
       
  9231     call.CancelAsyncRequest(EMobileCallTransfer);
       
  9232 
       
  9233     User::WaitForRequest(requestStatus);
       
  9234     AssertMockLtsyStatusL();
       
  9235     // see CMmVoiceCallTsy::CancelService in file CMmVoiceCallTsy.cpp
       
  9236     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  9237 
       
  9238 	User::WaitForRequest(mockLtsyStatus);
       
  9239 	
       
  9240 	CleanupStack::PopAndDestroy(5); // expectData, this, call, line, call2
       
  9241 	}
       
  9242 
       
  9243 /**
       
  9244 @SYMTestCaseID BA-CTSY-CCON-CT-0004
       
  9245 @SYMComponent  telephony_ctsy
       
  9246 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileCall::Transfer for voice calls
       
  9247 @SYMTestPriority High
       
  9248 @SYMTestActions Invokes multiple client requests to RMobileCall::Transfer for voice calls
       
  9249 @SYMTestExpectedResults Pass
       
  9250 @SYMTestType CT
       
  9251 */
       
  9252 void CCTsyCallControlFU::TestTransfer0004L()
       
  9253 	{
       
  9254 	OpenEtelServerL(EUseExtendedError);
       
  9255 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9256 	OpenPhoneL();
       
  9257 
       
  9258 	RBuf8 expectData;
       
  9259 	CleanupClosePushL(expectData);
       
  9260 
       
  9261 	RBuf8 completeData;
       
  9262 	CleanupClosePushL(completeData);
       
  9263 
       
  9264 	// Open second client
       
  9265 	RTelServer telServer2;
       
  9266 	TInt ret = telServer2.Connect();
       
  9267 	ASSERT_EQUALS(KErrNone, ret);
       
  9268 	CleanupClosePushL(telServer2);
       
  9269 
       
  9270 	RMobilePhone phone2;
       
  9271 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  9272 	ASSERT_EQUALS(KErrNone, ret);
       
  9273 	CleanupClosePushL(phone2);
       
  9274 
       
  9275 	RLine line11;
       
  9276 	RLine line12;
       
  9277 	RLine line22;
       
  9278 	
       
  9279 	RMobileCall call11;
       
  9280 	CleanupClosePushL(call11);
       
  9281 	
       
  9282 	RMobileCall call12;
       
  9283 	CleanupClosePushL(call12);
       
  9284 	
       
  9285 	RMobileCall call22;
       
  9286 	CleanupClosePushL(call22);
       
  9287 
       
  9288 	TInt errorCode = KErrNone;
       
  9289 
       
  9290 	TInt callId1 = 1;
       
  9291 	TInt callId2 = 2;
       
  9292 	TName incomingCallName1;
       
  9293 	TName incomingCallName2;
       
  9294 
       
  9295 	TRequestStatus requestStatus1;
       
  9296 	TRequestStatus requestStatus2;
       
  9297 	TRequestStatus mockLtsyStatus;
       
  9298 
       
  9299 	// open new line11 for KMmTsyVoice1LineName
       
  9300 	errorCode = OpenNewLineLC(iPhone, line11, KMmTsyVoice1LineName);
       
  9301 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9302 
       
  9303 	// open new line12 for KMmTsyVoice2LineName
       
  9304 	errorCode = OpenNewLineLC(iPhone, line12, KMmTsyVoice2LineName);
       
  9305 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9306 
       
  9307 	// open new line22 for KMmTsyVoice2LineName
       
  9308 	errorCode = OpenNewLineLC(phone2, line22, KMmTsyVoice2LineName);
       
  9309 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9310 
       
  9311     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  9312     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  9313 
       
  9314  	//-------------------------------------------------------------------------
       
  9315 	// create new incoming call
       
  9316 	errorCode = CreateIncomingCallL(line11, callId1, incomingCallName1, 
       
  9317 	                               mobileService, mobileCallStatus);	
       
  9318 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9319 		
       
  9320 	errorCode = call11.OpenExistingCall(line11, incomingCallName1);
       
  9321 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9322  	//-------------------------------------------------------------------------
       
  9323 
       
  9324 	mobileCallStatus = RMobileCall::EStatusHold;
       
  9325     mobileService = RMobilePhone::EAuxVoiceService;
       
  9326  	//-------------------------------------------------------------------------
       
  9327 	// create new incoming call12 for iPhone
       
  9328 	errorCode = CreateIncomingCallL(line12, callId2, incomingCallName2,
       
  9329 	                               mobileService, mobileCallStatus);	
       
  9330 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9331 	AssertMockLtsyStatusL();
       
  9332 
       
  9333 	errorCode = call12.OpenExistingCall(line12, incomingCallName2);
       
  9334 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9335 	AssertMockLtsyStatusL();
       
  9336  	//-------------------------------------------------------------------------
       
  9337 
       
  9338 	RLine::TCallInfo callInfo22;
       
  9339 	errorCode = line22.GetCallInfo(0, callInfo22);
       
  9340 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9341 
       
  9342 	errorCode = call22.OpenExistingCall(line22, callInfo22.iCallName);
       
  9343 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9344 	AssertMockLtsyStatusL();
       
  9345 
       
  9346 	//-------------------------------------------------------------------------
       
  9347 	// Test A: Test multiple clients requesting RMobileCall::Transfer
       
  9348  	//-------------------------------------------------------------------------
       
  9349 
       
  9350 	TMockLtsyCallData0 mockData(callId2, mobileService);
       
  9351     expectData.Close();
       
  9352 	mockData.SerialiseL(expectData);
       
  9353 	iMockLTSY.ExpectL(EMobileCallTransfer, expectData);
       
  9354 	iMockLTSY.CompleteL(EMobileCallTransfer, KErrNone, expectData, 10);
       
  9355 
       
  9356 	call12.Transfer(requestStatus1);
       
  9357     call22.Transfer(requestStatus2);
       
  9358 
       
  9359     User::WaitForRequest(requestStatus1);
       
  9360     User::WaitForRequest(requestStatus2);
       
  9361 
       
  9362     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
  9363     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
  9364 
       
  9365     AssertMockLtsyStatusL();
       
  9366 
       
  9367 	CleanupStack::PopAndDestroy(6); // line11, line12, line22, call11, call12, call22
       
  9368 	CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, expectData, this, completeData
       
  9369 	}
       
  9370 
       
  9371 
       
  9372 /**
       
  9373 @SYMTestCaseID BA-CTSY-CCON-CT-0005
       
  9374 @SYMComponent  telephony_ctsy
       
  9375 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Transfer with timeout for voice calls
       
  9376 @SYMTestPriority High
       
  9377 @SYMTestActions Invokes RMobileCall::Transfer and tests for timeout for voice calls
       
  9378 @SYMTestExpectedResults Pass
       
  9379 @SYMTestType CT
       
  9380 */
       
  9381 void CCTsyCallControlFU::TestTransfer0005L()
       
  9382 	{
       
  9383 	OpenEtelServerL(EUseExtendedError);
       
  9384 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9385 	OpenPhoneL();
       
  9386 
       
  9387 	RBuf8 expectData;
       
  9388 	CleanupClosePushL(expectData);
       
  9389 
       
  9390 	RLine line;
       
  9391 	
       
  9392 	RMobileCall call;
       
  9393 	CleanupClosePushL(call);
       
  9394 	
       
  9395 	RMobileCall call2;
       
  9396 	CleanupClosePushL(call2);
       
  9397 	
       
  9398 	TInt errorCode = KErrNone;
       
  9399 	TInt callId = 1;
       
  9400 	TName incomingCallName;
       
  9401 
       
  9402     TRequestStatus requestStatus;
       
  9403 	TRequestStatus mockLtsyStatus;
       
  9404 
       
  9405 	// open new line for KMmTsyVoice1LineName
       
  9406 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
  9407 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9408 
       
  9409 	RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  9410 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  9411 
       
  9412  	//-------------------------------------------------------------------------
       
  9413 	// create new incoming call
       
  9414 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  9415 	                               mobileService, mobileCallStatus);	
       
  9416 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9417 	AssertMockLtsyStatusL();
       
  9418 		
       
  9419 	errorCode = call2.OpenExistingCall(line, incomingCallName);
       
  9420 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9421 	AssertMockLtsyStatusL();
       
  9422  	//-------------------------------------------------------------------------
       
  9423 
       
  9424 	//-------------------------------------------------------------------------
       
  9425 	// Test A: Test timeout of RMobileCall::Transfer
       
  9426  	//-------------------------------------------------------------------------
       
  9427 
       
  9428 	mobileCallStatus = RMobileCall::EStatusHold;
       
  9429 	callId = 2;
       
  9430 
       
  9431  	//-------------------------------------------------------------------------
       
  9432 	// create new incoming call
       
  9433 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
  9434 	                               mobileService, mobileCallStatus);	
       
  9435 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9436 	AssertMockLtsyStatusL();
       
  9437 		
       
  9438     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9439     ASSERT_EQUALS(KErrNone, errorCode);
       
  9440 	AssertMockLtsyStatusL();
       
  9441  	//-------------------------------------------------------------------------
       
  9442 
       
  9443     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  9444     expectData.Close();
       
  9445     mockData0.SerialiseL(expectData);
       
  9446     iMockLTSY.ExpectL(EMobileCallTransfer, expectData);
       
  9447 
       
  9448     call.Transfer(requestStatus);
       
  9449 
       
  9450     User::WaitForRequest(requestStatus);
       
  9451     AssertMockLtsyStatusL();
       
  9452     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
  9453 
       
  9454 	CleanupStack::PopAndDestroy(5, this); // expectData, this, line, call, call2
       
  9455 	}
       
  9456 
       
  9457 
       
  9458 /**
       
  9459 @SYMTestCaseID BA-CTSY-CCON-CT-0006
       
  9460 @SYMComponent  telephony_ctsy
       
  9461 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Transfer for data calls
       
  9462 @SYMTestPriority High
       
  9463 @SYMTestActions Invokes RMobileCall::Transfer for data calls
       
  9464 @SYMTestExpectedResults Pass
       
  9465 @SYMTestType CT
       
  9466 */
       
  9467 void CCTsyCallControlFU::TestTransfer0006L()
       
  9468 	{
       
  9469 	OpenEtelServerL(EUseExtendedError);
       
  9470 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9471 	OpenPhoneL();
       
  9472 
       
  9473     RBuf8 expectData;
       
  9474     CleanupClosePushL(expectData);
       
  9475 
       
  9476     RBuf8 completeData;
       
  9477     CleanupClosePushL(completeData);
       
  9478 
       
  9479 	RLine line;
       
  9480 	RMobileCall call;
       
  9481 	CleanupClosePushL(call);
       
  9482 
       
  9483 	RMobileCall ringingCall;
       
  9484 	CleanupClosePushL(ringingCall);
       
  9485 
       
  9486 	TInt errorCode = KErrNone;
       
  9487 	TInt callId = 1;
       
  9488 	TName incomingCallName;
       
  9489     TRequestStatus requestStatus;
       
  9490     TRequestStatus requestNotify;
       
  9491 	
       
  9492 	// open new line and call for KMmTsyDataLineName
       
  9493 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
  9494 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9495 		
       
  9496     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  9497     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  9498 
       
  9499  	//-------------------------------------------------------------------------
       
  9500 	// create new incoming call
       
  9501 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9502 	                               mobileService, mobileCallStatus);	
       
  9503 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9504 		
       
  9505     errorCode = ringingCall.OpenExistingCall(line, incomingCallName);
       
  9506     ASSERT_EQUALS(KErrNone, errorCode);
       
  9507  	//-------------------------------------------------------------------------
       
  9508 
       
  9509     callId = 2;
       
  9510     mobileCallStatus = RMobileCall::EStatusHold;
       
  9511     
       
  9512  	//-------------------------------------------------------------------------
       
  9513 	// TEST A: failure to dispatch request to LTSY
       
  9514  	//-------------------------------------------------------------------------
       
  9515 
       
  9516  	//-------------------------------------------------------------------------
       
  9517 	// create new incoming call
       
  9518 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9519 	                               mobileService, mobileCallStatus);	
       
  9520 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9521 		
       
  9522     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9523     ASSERT_EQUALS(KErrNone, errorCode);
       
  9524  	//-------------------------------------------------------------------------
       
  9525 
       
  9526     call.Transfer(requestStatus);
       
  9527 
       
  9528     User::WaitForRequest(requestStatus);
       
  9529     AssertMockLtsyStatusL();
       
  9530     ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
  9531 
       
  9532 	// close incoming call
       
  9533  	CloseIncomingCallL(call, callId, RMobilePhone::ECircuitDataService);
       
  9534 
       
  9535  	//-------------------------------------------------------------------------
       
  9536 	// TEST E: Unsolicited completion of RMobileCall::Transfer
       
  9537 	// from LTSY.
       
  9538  	//-------------------------------------------------------------------------
       
  9539 
       
  9540     TRequestStatus mockLtsyStatus;
       
  9541 
       
  9542 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  9543     TMockLtsyCallData0 mockData0(callId, mobileService);
       
  9544     expectData.Close();
       
  9545     mockData0.SerialiseL(expectData);
       
  9546 	iMockLTSY.CompleteL(EMobileCallTransfer, KErrNone, expectData);
       
  9547 	User::WaitForRequest(mockLtsyStatus);
       
  9548 	AssertMockLtsyStatusL();
       
  9549 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  9550 
       
  9551 	CleanupStack::PopAndDestroy(6, this); // expectData, completeData, call, line, ringingCall
       
  9552 	}
       
  9553 
       
  9554 
       
  9555 /**
       
  9556 @SYMTestCaseID BA-CTSY-CCON-CT-0009
       
  9557 @SYMComponent  telephony_ctsy
       
  9558 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileCall::Transfer for data calls
       
  9559 @SYMTestPriority High
       
  9560 @SYMTestActions Invokes multiple client requests to RMobileCall::Transfer for data calls
       
  9561 @SYMTestExpectedResults Pass
       
  9562 @SYMTestType CT
       
  9563 */
       
  9564 void CCTsyCallControlFU::TestTransfer0009L()
       
  9565 	{
       
  9566 
       
  9567 					
       
  9568 	OpenEtelServerL(EUseExtendedError);
       
  9569 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9570 	OpenPhoneL();
       
  9571 
       
  9572 	RBuf8 expectData;
       
  9573 	CleanupClosePushL(expectData);
       
  9574 
       
  9575 	// Open second client
       
  9576 	RTelServer telServer2;
       
  9577 	TInt ret = telServer2.Connect();
       
  9578 	ASSERT_EQUALS(KErrNone, ret);
       
  9579 	CleanupClosePushL(telServer2);
       
  9580 
       
  9581 	RMobilePhone phone2;
       
  9582 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  9583 	ASSERT_EQUALS(KErrNone, ret);
       
  9584 	CleanupClosePushL(phone2);
       
  9585 
       
  9586 	RLine line1;
       
  9587 	RLine line2;
       
  9588 	
       
  9589 	RMobileCall call1;
       
  9590 	CleanupClosePushL(call1);
       
  9591 	RMobileCall call2;
       
  9592 	CleanupClosePushL(call2);
       
  9593 	RMobileCall call3;
       
  9594 	CleanupClosePushL(call3);
       
  9595 	RMobileCall call4;
       
  9596 	CleanupClosePushL(call4);
       
  9597 	
       
  9598 	TInt errorCode = KErrNone;
       
  9599 
       
  9600 	TInt callId1 = 1;
       
  9601 	TInt callId2 = 2;
       
  9602 	TInt callId3 = 3;
       
  9603 	TInt callId4 = 4;
       
  9604 	TName incomingCallName1;
       
  9605 	TName incomingCallName2;
       
  9606 	TName incomingCallName3;
       
  9607 	TName incomingCallName4;
       
  9608 
       
  9609 	TRequestStatus requestStatus1;
       
  9610 	TRequestStatus requestStatus2;
       
  9611 
       
  9612 	// open new line1 for KMmTsyDataLineName
       
  9613 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyDataLineName);
       
  9614 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9615 
       
  9616 	// open new line2 for KMmTsyDataLineName
       
  9617 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyDataLineName);
       
  9618 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9619 
       
  9620     RMobileCall::TMobileCallStatus mobileCallStatusHold = RMobileCall::EStatusRinging;
       
  9621     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  9622 
       
  9623  	//-------------------------------------------------------------------------
       
  9624 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
  9625 	                               mobileService, mobileCallStatusHold);	
       
  9626 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9627 	AssertMockLtsyStatusL();
       
  9628 		
       
  9629     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
  9630     ASSERT_EQUALS(KErrNone, errorCode);
       
  9631 	AssertMockLtsyStatusL();
       
  9632  	//-------------------------------------------------------------------------
       
  9633 
       
  9634  	//-------------------------------------------------------------------------
       
  9635 	// create new incoming call2 for phone2
       
  9636 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
  9637 	                               mobileService, mobileCallStatusHold);	
       
  9638 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9639 	AssertMockLtsyStatusL();
       
  9640 		
       
  9641     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
  9642     ASSERT_EQUALS(KErrNone, errorCode);
       
  9643 	AssertMockLtsyStatusL();
       
  9644  	//-------------------------------------------------------------------------
       
  9645 
       
  9646 	//-------------------------------------------------------------------------
       
  9647 	// Test A: Test multiple clients requesting RMobileCall::Transfer
       
  9648  	//-------------------------------------------------------------------------
       
  9649 
       
  9650 	mobileCallStatusHold = RMobileCall::EStatusHold;
       
  9651 
       
  9652  	//-------------------------------------------------------------------------
       
  9653 	// create new incoming call1 for iPhone
       
  9654 	errorCode = CreateIncomingCallL(line1, callId3, incomingCallName3,
       
  9655 	                               mobileService, mobileCallStatusHold);	
       
  9656 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9657 	AssertMockLtsyStatusL();
       
  9658 		
       
  9659     errorCode = call3.OpenExistingCall(line1, incomingCallName3);
       
  9660     ASSERT_EQUALS(KErrNone, errorCode);
       
  9661 	AssertMockLtsyStatusL();
       
  9662  	//-------------------------------------------------------------------------
       
  9663 
       
  9664  	//-------------------------------------------------------------------------
       
  9665 	errorCode = CreateIncomingCallL(line2, callId4, incomingCallName4,
       
  9666 	                               mobileService, mobileCallStatusHold);	
       
  9667 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9668 	AssertMockLtsyStatusL();
       
  9669 		
       
  9670     errorCode = call4.OpenExistingCall(line2, incomingCallName4);
       
  9671     ASSERT_EQUALS(KErrNone, errorCode);
       
  9672 	AssertMockLtsyStatusL();
       
  9673  	//-------------------------------------------------------------------------
       
  9674 
       
  9675     call3.Transfer(requestStatus1);
       
  9676     call4.Transfer(requestStatus2);
       
  9677 
       
  9678     User::WaitForRequest(requestStatus1);
       
  9679     AssertMockLtsyStatusL();
       
  9680     ASSERT_EQUALS(KErrNotReady, requestStatus1.Int());
       
  9681 
       
  9682     User::WaitForRequest(requestStatus2);
       
  9683     AssertMockLtsyStatusL();
       
  9684     ASSERT_EQUALS(KErrNotReady, requestStatus2.Int());
       
  9685 
       
  9686 	// Done !
       
  9687 	CleanupStack::PopAndDestroy(6); // line1, line2, call1, call2, call3, call4
       
  9688 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, expectData, this
       
  9689 	}
       
  9690 
       
  9691 /**
       
  9692 @SYMTestCaseID BA-CTSY-CCON-CT-00011
       
  9693 @SYMComponent  telephony_ctsy
       
  9694 @SYMTestCaseDesc Test support in CTSY for RMobileCall::Transfer for fax calls
       
  9695 @SYMTestPriority High
       
  9696 @SYMTestActions Invokes RMobileCall::Transfer for fax calls
       
  9697 @SYMTestExpectedResults Pass
       
  9698 @SYMTestType CT
       
  9699 */
       
  9700 void CCTsyCallControlFU::TestTransfer00011L()
       
  9701 	{
       
  9702 
       
  9703 	OpenEtelServerL(EUseExtendedError);
       
  9704 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9705 	OpenPhoneL();
       
  9706 
       
  9707     RBuf8 expectData;
       
  9708     CleanupClosePushL(expectData);
       
  9709 
       
  9710     RBuf8 completeData;
       
  9711     CleanupClosePushL(completeData);
       
  9712 
       
  9713 	RLine line;
       
  9714 	RMobileCall call;
       
  9715 	CleanupClosePushL(call);
       
  9716 	RMobileCall ringingCall;
       
  9717 	CleanupClosePushL(ringingCall);
       
  9718 	
       
  9719 	TInt errorCode = KErrNone;
       
  9720 	TInt callId = 1;
       
  9721 	TName incomingCallName;
       
  9722     TRequestStatus requestStatus;
       
  9723     TRequestStatus requestNotify;
       
  9724 	
       
  9725 	// open new line and call for KMmTsyFaxLineName
       
  9726 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
  9727 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9728 		
       
  9729     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
  9730     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
  9731 
       
  9732  	//-------------------------------------------------------------------------
       
  9733 	// create new incoming call
       
  9734 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9735 	                               mobileService, mobileCallStatus);	
       
  9736 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9737 
       
  9738 	errorCode = ringingCall.OpenExistingCall(line, incomingCallName);
       
  9739 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9740  	//-------------------------------------------------------------------------
       
  9741 
       
  9742  	//-------------------------------------------------------------------------
       
  9743 	// TEST A: failure to dispatch request to LTSY
       
  9744  	//-------------------------------------------------------------------------
       
  9745 
       
  9746 	mobileCallStatus = RMobileCall::EStatusHold;
       
  9747 	callId = 2;
       
  9748 
       
  9749 	/*
       
  9750 	 * Can't create incoming call with call status equal RMobileCall::EStatusHold.
       
  9751 	 * Destructor of CMmCallTsy is called for inclomming call (callId = 1)
       
  9752 	 * with call status equal RMobileCall::EStatusRinging by call of RCall::Close().
       
  9753 	 */
       
  9754 
       
  9755 //	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 100804);
       
  9756 
       
  9757 	//ASSERT_TRUE(false);
       
  9758 
       
  9759  	//-------------------------------------------------------------------------
       
  9760 	// create new incoming call
       
  9761 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9762 	                               mobileService, mobileCallStatus);	
       
  9763 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9764 		
       
  9765     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9766     ASSERT_EQUALS(KErrNone, errorCode);
       
  9767  	//-------------------------------------------------------------------------
       
  9768 
       
  9769     call.Transfer(requestStatus);
       
  9770 
       
  9771     User::WaitForRequest(requestStatus);
       
  9772     AssertMockLtsyStatusL();
       
  9773     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  9774 
       
  9775 	AssertMockLtsyStatusL();
       
  9776 	CleanupStack::PopAndDestroy(6, this); // expectData, completeData, call, line, ringingCall
       
  9777 	}
       
  9778 
       
  9779 
       
  9780 /**
       
  9781 @SYMTestCaseID BA-CTSY-CCON-MTAC-0001
       
  9782 @SYMComponent  telephony_ctsy
       
  9783 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::TerminateAllCalls
       
  9784 @SYMTestPriority High
       
  9785 @SYMTestActions Invokes RMobilePhone::TerminateAllCalls
       
  9786 @SYMTestExpectedResults Pass
       
  9787 @SYMTestType CT
       
  9788 */
       
  9789 void CCTsyCallControlFU::TestTerminateAllCalls0001L()
       
  9790 	{
       
  9791 	OpenEtelServerL(EUseExtendedError);
       
  9792 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9793 	OpenPhoneL();
       
  9794 
       
  9795     RBuf8 expectData;
       
  9796     CleanupClosePushL(expectData); // PUSH
       
  9797     
       
  9798 	TRequestStatus requestStatus;
       
  9799     
       
  9800 	//-----------------------------------------------------------------------
       
  9801 	// TEST 0: with no active calls (request should not reach the LTSY)
       
  9802 	//----------------------------------------------------------------------
       
  9803 	
       
  9804 	iPhone.TerminateAllCalls(requestStatus);
       
  9805 	User::WaitForRequest(requestStatus);
       
  9806 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  9807 	AssertMockLtsyStatusL();
       
  9808 	
       
  9809  	//-------------------------------------------------------------------------
       
  9810 	// TEST A: failure to dispatch request to LTSY
       
  9811  	//-------------------------------------------------------------------------
       
  9812 
       
  9813 	// open new line and call for KMmTsyVoice1LineName
       
  9814 	RLine line;
       
  9815 	RCall call;
       
  9816 	TInt errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName); // PUSH
       
  9817 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9818 
       
  9819 	// create new incoming call
       
  9820 	TName incomingCallName;
       
  9821 	TInt callId = 1;
       
  9822 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9823 			RMobilePhone::EVoiceService, RMobileCall::EStatusConnecting);	
       
  9824 	
       
  9825 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9826 		
       
  9827 	CleanupClosePushL(call); // PUSH
       
  9828     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9829     ASSERT_EQUALS(KErrNone, errorCode);
       
  9830  	//-------------------------------------------------------------------------
       
  9831 
       
  9832     TMockLtsyData1<TInt> mockData(callId);
       
  9833 	mockData.SerialiseL(expectData);
       
  9834 	iMockLTSY.ExpectL(ECtsyPhoneTerminateAllCallsReq, expectData, KErrNotSupported);
       
  9835 	iPhone.TerminateAllCalls(requestStatus);
       
  9836 
       
  9837 	User::WaitForRequest(requestStatus);
       
  9838 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
  9839 	AssertMockLtsyStatusL();
       
  9840 
       
  9841 	
       
  9842 	
       
  9843 	//-------------------------------------------------------------------------
       
  9844 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
  9845  	//-------------------------------------------------------------------------
       
  9846 	iMockLTSY.ExpectL(ECtsyPhoneTerminateAllCallsReq, expectData);
       
  9847 	iMockLTSY.CompleteL(ECtsyPhoneTerminateAllCallsComp, KErrGeneral);
       
  9848 
       
  9849 	iPhone.TerminateAllCalls(requestStatus);
       
  9850 
       
  9851 	User::WaitForRequest(requestStatus);
       
  9852 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
  9853 	AssertMockLtsyStatusL();
       
  9854 	
       
  9855 	//-------------------------------------------------------------------------
       
  9856 	// TEST C: Successful completion request of
       
  9857 	// RMobilePhone::TerminateAllCalls.
       
  9858  	//-------------------------------------------------------------------------
       
  9859 	
       
  9860     iMockLTSY.ExpectL(ECtsyPhoneTerminateAllCallsReq, expectData);
       
  9861     iMockLTSY.CompleteL(ECtsyPhoneTerminateAllCallsComp, KErrNone);
       
  9862     
       
  9863 	iPhone.TerminateAllCalls(requestStatus);
       
  9864     User::WaitForRequest(requestStatus);
       
  9865     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  9866     AssertMockLtsyStatusL();
       
  9867     
       
  9868  	//-------------------------------------------------------------------------
       
  9869 	// TEST E: Unsolicited completion of RMobilePhone::TerminateAllCalls
       
  9870 	// from LTSY.
       
  9871  	//-------------------------------------------------------------------------
       
  9872 
       
  9873 	TRequestStatus mockLtsyStatus;
       
  9874 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  9875 	iMockLTSY.CompleteL(ECtsyPhoneTerminateAllCallsComp, KErrNone);
       
  9876 	User::WaitForRequest(mockLtsyStatus);
       
  9877 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  9878 	AssertMockLtsyStatusL();
       
  9879 		
       
  9880 	CleanupStack::PopAndDestroy(4, this); // call, line, expectData, this
       
  9881 	}
       
  9882 
       
  9883 /**
       
  9884 @SYMTestCaseID BA-CTSY-CCON-MTAC-0002
       
  9885 @SYMComponent  telephony_ctsy
       
  9886 @SYMTestCaseDesc Test support in CTSY for cancelling RMobilePhone::TerminateAllCalls
       
  9887 @SYMTestPriority High
       
  9888 @SYMTestActions Invokes RMobilePhone::TerminateAllCalls and cancels it
       
  9889 @SYMTestExpectedResults Pass
       
  9890 @SYMTestType CT
       
  9891 */
       
  9892 void CCTsyCallControlFU::TestTerminateAllCalls0002L()
       
  9893 	{
       
  9894 	OpenEtelServerL(EUseExtendedError);
       
  9895 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9896 	OpenPhoneL();
       
  9897 	
       
  9898     RBuf8 expectData;
       
  9899     CleanupClosePushL(expectData); // PUSH
       
  9900     
       
  9901 	//-------------------------------------------------------------------------
       
  9902 	
       
  9903 	// open new line and call for KMmTsyVoice1LineName
       
  9904 	RLine line;
       
  9905 	RCall call;
       
  9906 	TInt errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName); // PUSH
       
  9907 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9908 
       
  9909 	// create new incoming call
       
  9910 	TName incomingCallName;
       
  9911 	TInt callId = 1;
       
  9912 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9913 			RMobilePhone::EVoiceService, RMobileCall::EStatusConnecting);	
       
  9914 	
       
  9915 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9916 		
       
  9917 	CleanupClosePushL(call); // PUSH
       
  9918     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9919     ASSERT_EQUALS(KErrNone, errorCode);
       
  9920  	//-------------------------------------------------------------------------
       
  9921     
       
  9922 	//-------------------------------------------------------------------------
       
  9923 	// Test A: cancelling of RMobilePhone::TerminateAllCalls
       
  9924  	//-------------------------------------------------------------------------
       
  9925 
       
  9926     TMockLtsyData1<TInt> mockData(callId);
       
  9927 	mockData.SerialiseL(expectData);
       
  9928 	
       
  9929 	TRequestStatus mockLtsyStatus;
       
  9930 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  9931 	
       
  9932 	// Expect call down to LTSY for this IPC
       
  9933 	iMockLTSY.ExpectL(ECtsyPhoneTerminateAllCallsReq, expectData);
       
  9934 
       
  9935 	// Queue response to be delayed to give time for cancel to come through
       
  9936 	iMockLTSY.CompleteL(ECtsyPhoneTerminateAllCallsComp, KErrNone, 10);
       
  9937 
       
  9938 	TRequestStatus requestStatus;
       
  9939 	iPhone.TerminateAllCalls(requestStatus);
       
  9940 	iPhone.CancelAsyncRequest(EMobilePhoneTerminateAllCalls);
       
  9941 	User::WaitForRequest(requestStatus);
       
  9942 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  9943 	AssertMockLtsyStatusL();
       
  9944 	
       
  9945 	User::WaitForRequest(mockLtsyStatus);
       
  9946 	AssertMockLtsyStatusL();
       
  9947 	
       
  9948 	CleanupStack::PopAndDestroy(4, this); // call, line, expectData, this
       
  9949 	}
       
  9950 
       
  9951 /**
       
  9952 @SYMTestCaseID BA-CTSY-CCON-MTAC-0004
       
  9953 @SYMComponent  telephony_ctsy
       
  9954 @SYMTestCaseDesc Test support in CTSY for multiple client requests of RMobilePhone::TerminateAllCalls
       
  9955 @SYMTestPriority High
       
  9956 @SYMTestActions Invokes RMobilePhone::TerminateAllCalls on multiple clients
       
  9957 @SYMTestExpectedResults Pass
       
  9958 @SYMTestType CT
       
  9959 */
       
  9960 void CCTsyCallControlFU::TestTerminateAllCalls0004L()
       
  9961 	{
       
  9962 
       
  9963 	OpenEtelServerL(EUseExtendedError);
       
  9964 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  9965 	OpenPhoneL();
       
  9966 		
       
  9967 	// Open second client
       
  9968 	RTelServer telServer2;
       
  9969 	TInt ret = telServer2.Connect();
       
  9970 	ASSERT_EQUALS(KErrNone, ret);
       
  9971 	CleanupClosePushL(telServer2);
       
  9972 
       
  9973 	RMobilePhone phone2;
       
  9974 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
  9975 	ASSERT_EQUALS(KErrNone, ret);
       
  9976 	CleanupClosePushL(phone2);
       
  9977 
       
  9978 	//
       
  9979 	// set up line and call for first client
       
  9980 	
       
  9981 	RLine line;
       
  9982 	RCall call;
       
  9983 	TInt errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName); // PUSH
       
  9984 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9985 
       
  9986 	// create new incoming call
       
  9987 	TName incomingCallName;
       
  9988 	TInt callId = 1;
       
  9989 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
  9990 			RMobilePhone::EVoiceService, RMobileCall::EStatusConnecting);	
       
  9991 	
       
  9992 	ASSERT_EQUALS(KErrNone, errorCode);
       
  9993 		
       
  9994 	CleanupClosePushL(call); // PUSH
       
  9995     errorCode = call.OpenExistingCall(line, incomingCallName);
       
  9996     ASSERT_EQUALS(KErrNone, errorCode);
       
  9997     
       
  9998     //
       
  9999     // set up call for second client
       
 10000     
       
 10001 	RLine line2;
       
 10002 	RCall call2;
       
 10003 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName); // PUSH
       
 10004 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10005 
       
 10006 	// create new incoming call
       
 10007 	TName incomingCallName2;
       
 10008 	TInt callId2 = 2;
       
 10009 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2, 
       
 10010 			RMobilePhone::EVoiceService, RMobileCall::EStatusConnecting);	
       
 10011 	
       
 10012 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10013 		
       
 10014 	CleanupClosePushL(call2); // PUSH
       
 10015     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
 10016     ASSERT_EQUALS(KErrNone, errorCode);
       
 10017 	
       
 10018     // let's start testing...
       
 10019     
       
 10020     RBuf8 expectData;
       
 10021     CleanupClosePushL(expectData); // PUSH
       
 10022     TMockLtsyData1<TInt> mockData(callId);
       
 10023 	mockData.SerialiseL(expectData);
       
 10024 	
       
 10025     //RBuf8 expectData2;
       
 10026     //CleanupClosePushL(expectData2); // PUSH
       
 10027     //TMockLtsyData1<TInt> mockData2(callId2);
       
 10028 	//mockData2.SerialiseL(expectData2);
       
 10029 
       
 10030 	iMockLTSY.ExpectL(ECtsyPhoneTerminateAllCallsReq, expectData);
       
 10031     iMockLTSY.CompleteL(ECtsyPhoneTerminateAllCallsComp, KErrNone, 20);
       
 10032     TRequestStatus requestStatus;
       
 10033     TRequestStatus requestStatus2;
       
 10034     iPhone.TerminateAllCalls(requestStatus);
       
 10035     phone2.TerminateAllCalls(requestStatus2);
       
 10036     
       
 10037 	User::WaitForRequest(requestStatus);
       
 10038 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
 10039 	
       
 10040 	User::WaitForRequest(requestStatus2);
       
 10041 	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
 10042 	
       
 10043 	AssertMockLtsyStatusL();
       
 10044 	
       
 10045 	CleanupStack::PopAndDestroy(8, this); 	// expectData,
       
 10046 											// call2, line2, call, line,
       
 10047 											// phone2, telServer2, this
       
 10048 	}
       
 10049 
       
 10050 /**
       
 10051 @SYMTestCaseID BA-CTSY-CCON-MTAC-0005
       
 10052 @SYMComponent  telephony_ctsy
       
 10053 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::TerminateAllCalls with timeout.
       
 10054 @SYMTestPriority High
       
 10055 @SYMTestActions Invokes RMobilePhone::TerminateAllCalls and tests for timeout.
       
 10056 @SYMTestExpectedResults Pass
       
 10057 @SYMTestType CT
       
 10058 */
       
 10059 void CCTsyCallControlFU::TestTerminateAllCalls0005L()
       
 10060 	{
       
 10061 	OpenEtelServerL(EUseExtendedError);
       
 10062 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10063 	OpenPhoneL();
       
 10064 
       
 10065     RBuf8 expectData;
       
 10066     CleanupClosePushL(expectData); // PUSH
       
 10067    
       
 10068     
       
 10069 	// open new line and call for KMmTsyVoice1LineName
       
 10070 	RLine line;
       
 10071 	RCall call;
       
 10072 	TInt errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName); // PUSH
       
 10073 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10074 
       
 10075 	
       
 10076 	// create new incoming call
       
 10077 	TName incomingCallName;
       
 10078 	TInt callId = 1;
       
 10079 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
 10080 			RMobilePhone::EVoiceService, RMobileCall::EStatusConnecting);	
       
 10081 	
       
 10082 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10083 		
       
 10084 	CleanupClosePushL(call); // PUSH
       
 10085     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10086     ASSERT_EQUALS(KErrNone, errorCode);
       
 10087  	//-------------------------------------------------------------------------
       
 10088 
       
 10089     TMockLtsyData1<TInt> mockData(callId);
       
 10090 	mockData.SerialiseL(expectData);    
       
 10091 	//-------------------------------------------------------------------------
       
 10092 	// Test A: Test timeout of RMobilePhone::TerminateAllCalls
       
 10093  	//-------------------------------------------------------------------------
       
 10094     
       
 10095 	TRequestStatus requestStatus;
       
 10096     iMockLTSY.ExpectL(ECtsyPhoneTerminateAllCallsReq, expectData);
       
 10097 	iPhone.TerminateAllCalls(requestStatus);
       
 10098     User::WaitForRequest(requestStatus);
       
 10099     AssertMockLtsyStatusL();
       
 10100     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
 10101 
       
 10102 	CleanupStack::PopAndDestroy(4, this); // call, line, expectData, this
       
 10103 	}
       
 10104 
       
 10105 
       
 10106 /**
       
 10107 @SYMTestCaseID BA-CTSY-CCON-MSICT-0001
       
 10108 @SYMComponent  telephony_ctsy
       
 10109 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetIncomingCallType
       
 10110 @SYMTestPriority High
       
 10111 @SYMTestActions Invokes RMobilePhone::SetIncomingCallType
       
 10112 @SYMTestExpectedResults Pass
       
 10113 @SYMTestType CT
       
 10114 */
       
 10115 void CCTsyCallControlFU::TestSetIncomingCallType0001L()
       
 10116 	{
       
 10117 
       
 10118 	OpenEtelServerL(EUseExtendedError);
       
 10119 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10120 	OpenPhoneL();
       
 10121 
       
 10122 	TRequestStatus requestStatus;
       
 10123 
       
 10124 	RMobilePhone::TMobilePhoneIncomingCallType callType = RMobilePhone::EIncomingTypeNotSpecified;
       
 10125 	
       
 10126 	RMobileCall::TMobileDataCallParamsV1 dataCallParamsV1;
       
 10127 	TPckg<RMobileCall::TMobileDataCallParamsV1> dataCallParamsV1Pckg(dataCallParamsV1);
       
 10128 	
       
 10129  	//-------------------------------------------------------------------------
       
 10130 	// Test API is not supported
       
 10131  	//-------------------------------------------------------------------------
       
 10132 
       
 10133 	iPhone.SetIncomingCallType(requestStatus, callType, dataCallParamsV1Pckg);
       
 10134 
       
 10135     User::WaitForRequest(requestStatus);
       
 10136     AssertMockLtsyStatusL();
       
 10137     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 10138 
       
 10139 	AssertMockLtsyStatusL();
       
 10140 	CleanupStack::PopAndDestroy(1, this); // this
       
 10141 	
       
 10142 	}
       
 10143 
       
 10144 
       
 10145 /**
       
 10146 @SYMTestCaseID BA-CTSY-CCON-CAICI-0001
       
 10147 @SYMComponent  telephony_ctsy
       
 10148 @SYMTestCaseDesc Test support in CTSY for RMobileCall::AnswerIncomingCallISV for voice calls
       
 10149 @SYMTestPriority High
       
 10150 @SYMTestActions Invokes RMobileCall::AnswerIncomingCallISV for voice calls
       
 10151 @SYMTestExpectedResults Pass
       
 10152 @SYMTestType CT
       
 10153 */
       
 10154 void CCTsyCallControlFU::TestAnswerIncomingCallISV0001L()
       
 10155 	{
       
 10156 
       
 10157 	OpenEtelServerL(EUseExtendedError);
       
 10158 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10159 	OpenPhoneL();
       
 10160 
       
 10161     RBuf8 expectData;
       
 10162     CleanupClosePushL(expectData);
       
 10163 
       
 10164     RBuf8 completeData;
       
 10165     CleanupClosePushL(completeData);
       
 10166 
       
 10167 	RLine line;
       
 10168 	RMobileCall call;
       
 10169 	CleanupClosePushL(call);
       
 10170 	
       
 10171 	TInt errorCode = KErrNone;
       
 10172 	TInt callId = 1;
       
 10173 	TName incomingCallName;
       
 10174     TRequestStatus requestStatus;
       
 10175     TRequestStatus requestNotify;
       
 10176 	
       
 10177 	// open new line and call for KMmTsyVoice1LineName
       
 10178 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
 10179 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10180 		
       
 10181     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 10182     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 10183 
       
 10184     TMockLtsyCallData0 mockData0(callId, mobileService);
       
 10185     
       
 10186 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParams;
       
 10187 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> callParamsPckg(callParams);
       
 10188 
       
 10189  	//-------------------------------------------------------------------------
       
 10190 	// TEST A: failure to dispatch request to LTSY
       
 10191  	//-------------------------------------------------------------------------
       
 10192 
       
 10193  	//-------------------------------------------------------------------------
       
 10194 	// create new incoming call
       
 10195 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
 10196 	                               mobileService, mobileCallStatus);	
       
 10197 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10198     AssertMockLtsyStatusL();
       
 10199 		
       
 10200     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10201     ASSERT_EQUALS(KErrNone, errorCode);
       
 10202     AssertMockLtsyStatusL();
       
 10203  	//-------------------------------------------------------------------------
       
 10204 
       
 10205     expectData.Close();
       
 10206     mockData0.SerialiseL(expectData);
       
 10207     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData, KErrNotSupported);
       
 10208     call.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
 10209 
       
 10210     User::WaitForRequest(requestStatus);
       
 10211     AssertMockLtsyStatusL();
       
 10212     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 10213 
       
 10214 	// close incoming call
       
 10215     CloseIncomingCallL(call, callId, mobileService);
       
 10216 
       
 10217 	//-------------------------------------------------------------------------
       
 10218 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
 10219  	//-------------------------------------------------------------------------
       
 10220 
       
 10221  	//-------------------------------------------------------------------------
       
 10222 	// create new incoming call
       
 10223 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
 10224 	                               mobileService, mobileCallStatus);	
       
 10225 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10226     AssertMockLtsyStatusL();
       
 10227 		
       
 10228     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10229     ASSERT_EQUALS(KErrNone, errorCode);
       
 10230     AssertMockLtsyStatusL();
       
 10231  	//-------------------------------------------------------------------------
       
 10232 
       
 10233     expectData.Close();
       
 10234     mockData0.SerialiseL(expectData);
       
 10235     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10236     iMockLTSY.CompleteL(EMobileCallAnswerISV, KErrGeneral, expectData);
       
 10237     call.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
 10238 
       
 10239     User::WaitForRequest(requestStatus);
       
 10240     AssertMockLtsyStatusL();
       
 10241     ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
 10242 
       
 10243 	// close incoming call
       
 10244     CloseIncomingCallL(call, callId, mobileService);
       
 10245 
       
 10246  	//-------------------------------------------------------------------------
       
 10247 	// TEST C: Successful completion request of
       
 10248 	// RMobileCall::AnswerIncomingCallISV when result is not cached.
       
 10249  	//-------------------------------------------------------------------------
       
 10250 
       
 10251  	//-------------------------------------------------------------------------
       
 10252 	// create new incoming call
       
 10253 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
 10254 	                               mobileService, mobileCallStatus);	
       
 10255 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10256     AssertMockLtsyStatusL();
       
 10257 		
       
 10258     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10259     ASSERT_EQUALS(KErrNone, errorCode);
       
 10260     AssertMockLtsyStatusL();
       
 10261  	//-------------------------------------------------------------------------
       
 10262 
       
 10263     expectData.Close();
       
 10264     mockData0.SerialiseL(expectData);
       
 10265     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10266     iMockLTSY.CompleteL(EMobileCallAnswerISV, KErrNone, expectData);
       
 10267     call.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
 10268 
       
 10269     User::WaitForRequest(requestStatus);
       
 10270     AssertMockLtsyStatusL();
       
 10271     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
 10272 
       
 10273 	// close incoming call
       
 10274     CloseIncomingCallL(call, callId, mobileService);
       
 10275 
       
 10276  	//-------------------------------------------------------------------------
       
 10277 	// TEST E: Unsolicited completion of RMobileCall::AnswerIncomingCallISV
       
 10278 	// from LTSY.
       
 10279  	//-------------------------------------------------------------------------
       
 10280 
       
 10281     TRequestStatus mockLtsyStatus;
       
 10282 
       
 10283 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 10284     expectData.Close();
       
 10285     mockData0.SerialiseL(expectData);
       
 10286 	iMockLTSY.CompleteL(EMobileCallAnswerISV, KErrNone, expectData);
       
 10287 	User::WaitForRequest(mockLtsyStatus);
       
 10288 	AssertMockLtsyStatusL();
       
 10289 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 10290 	
       
 10291  	//-------------------------------------------------------------------------
       
 10292 	// TEST to increase coverage 
       
 10293  	//-------------------------------------------------------------------------
       
 10294 
       
 10295 	RMobileCall call2;
       
 10296 	CleanupClosePushL(call2);
       
 10297     TRequestStatus requestStatus2;
       
 10298 
       
 10299  	//-------------------------------------------------------------------------
       
 10300 	// create new incoming call
       
 10301 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
 10302 	                               mobileService, mobileCallStatus);	
       
 10303 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10304     AssertMockLtsyStatusL();
       
 10305 		
       
 10306     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10307     ASSERT_EQUALS(KErrNone, errorCode);
       
 10308     AssertMockLtsyStatusL();
       
 10309  	//-------------------------------------------------------------------------
       
 10310 
       
 10311  	//-------------------------------------------------------------------------
       
 10312     errorCode = call2.OpenExistingCall(line, incomingCallName);
       
 10313     ASSERT_EQUALS(KErrNone, errorCode);
       
 10314     AssertMockLtsyStatusL();
       
 10315  	//-------------------------------------------------------------------------
       
 10316 
       
 10317     expectData.Close();
       
 10318     mockData0.SerialiseL(expectData);
       
 10319     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10320     iMockLTSY.CompleteL(EMobileCallAnswerISV, KErrNone, expectData);
       
 10321     call.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
 10322 
       
 10323     call2.AnswerIncomingCallISV(requestStatus2, callParamsPckg);
       
 10324 
       
 10325     User::WaitForRequest(requestStatus);
       
 10326     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
 10327 
       
 10328     User::WaitForRequest(requestStatus2);
       
 10329     AssertMockLtsyStatusL();
       
 10330     ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
       
 10331 
       
 10332 	call.Close();
       
 10333 	CloseIncomingCallL(call2, callId, mobileService);
       
 10334 	
       
 10335  	//-------------------------------------------------------------------------
       
 10336 	// TEST : to increase CMmVoiceCallTsy::AnswerIncomingCall coverage
       
 10337 	// covers "else if( activeCall && 
       
 10338 	//                  ( !( KETelExt3rdPartyV1 == activeCall->GetExtensionId() ) &&
       
 10339 	//                  ( KETelExt3rdPartyV1 == extensionId ) ) )" condition
       
 10340  	//-------------------------------------------------------------------------
       
 10341 
       
 10342 	mobileCallStatus = RMobileCall::EStatusConnected;
       
 10343 
       
 10344  	//-------------------------------------------------------------------------
       
 10345 	// create new incoming call1
       
 10346 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
 10347 	                               mobileService, mobileCallStatus);	
       
 10348 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10349 	AssertMockLtsyStatusL();
       
 10350 		
       
 10351     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10352     ASSERT_EQUALS(KErrNone, errorCode);
       
 10353 	AssertMockLtsyStatusL();
       
 10354  	//-------------------------------------------------------------------------
       
 10355 	
       
 10356     call.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
 10357 
       
 10358     User::WaitForRequest(requestStatus);
       
 10359     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 10360 
       
 10361 	AssertMockLtsyStatusL();
       
 10362 	CleanupStack::PopAndDestroy(6, this); // expectData, completeData, call, line, call2
       
 10363 	
       
 10364 	}
       
 10365 
       
 10366 
       
 10367 /**
       
 10368 @SYMTestCaseID BA-CTSY-CCON-CAICI-0002
       
 10369 @SYMComponent  telephony_ctsy
       
 10370 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobileCall::AnswerIncomingCallISV for voice calls
       
 10371 @SYMTestPriority High
       
 10372 @SYMTestActions Invokes cancelling of RMobileCall::AnswerIncomingCallISV for voice calls
       
 10373 @SYMTestExpectedResults Pass
       
 10374 @SYMTestType CT
       
 10375 */
       
 10376 void CCTsyCallControlFU::TestAnswerIncomingCallISV0002L()
       
 10377 	{
       
 10378 	OpenEtelServerL(EUseExtendedError);
       
 10379 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10380 	OpenPhoneL();
       
 10381 
       
 10382 	RBuf8 expectData;
       
 10383 	CleanupClosePushL(expectData);
       
 10384 	
       
 10385 	RBuf8 completeData;
       
 10386     CleanupClosePushL(completeData);
       
 10387 
       
 10388 	RLine line;
       
 10389 	RMobileCall call;
       
 10390 	CleanupClosePushL(call);
       
 10391 	
       
 10392 	TInt errorCode = KErrNone;
       
 10393 	TInt callId = 1;
       
 10394 	TName incomingCallName;
       
 10395 
       
 10396     TRequestStatus requestStatus;
       
 10397 	TRequestStatus mockLtsyStatus;
       
 10398 	
       
 10399     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 10400     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 10401 
       
 10402     TMockLtsyCallData0 mockData0(callId, mobileService);
       
 10403 	
       
 10404 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParams;
       
 10405 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> callParamsPckg(callParams);
       
 10406 	
       
 10407  	//-------------------------------------------------------------------------
       
 10408 	// Test cancelling of RCall::AnswerIncomingCallISV
       
 10409  	//-------------------------------------------------------------------------
       
 10410  	
       
 10411 	// open new line for KMmTsyVoice1LineName
       
 10412 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
 10413 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10414 		
       
 10415  	//-------------------------------------------------------------------------
       
 10416 	// create new incoming call
       
 10417 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
 10418 	                               mobileService, mobileCallStatus);	
       
 10419 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10420 	AssertMockLtsyStatusL();
       
 10421 		
       
 10422     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10423     ASSERT_EQUALS(KErrNone, errorCode);
       
 10424 	AssertMockLtsyStatusL();
       
 10425  	//-------------------------------------------------------------------------
       
 10426 
       
 10427 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 10428 
       
 10429     expectData.Close();
       
 10430     mockData0.SerialiseL(expectData);
       
 10431     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10432 
       
 10433     call.AnswerIncomingCallISV(requestStatus, callParamsPckg);
       
 10434 
       
 10435 	TInt hangUpCause = KErrGsmBusyUserRequest;
       
 10436 	TBool autoStChangeDisable = ETrue;
       
 10437     TMockLtsyCallData2<TInt, TBool> mockData2(callId, mobileService, 
       
 10438                                              hangUpCause, 
       
 10439                                              autoStChangeDisable);
       
 10440 
       
 10441 	expectData.Close();
       
 10442 	mockData2.SerialiseL(expectData);
       
 10443 	iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
 10444 	
       
 10445 	mockData0.SerialiseL(completeData);
       
 10446 	iMockLTSY.CompleteL(EEtelCallHangUp, KErrNone, completeData);
       
 10447 	
       
 10448     call.CancelAsyncRequest(EMobileCallAnswerISV);
       
 10449 
       
 10450     User::WaitForRequest(requestStatus);
       
 10451     AssertMockLtsyStatusL();
       
 10452     ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
 10453 
       
 10454 	User::WaitForRequest(mockLtsyStatus);
       
 10455 	
       
 10456 	CleanupStack::PopAndDestroy(5); // expectData, completeData, this, call, line
       
 10457 	}
       
 10458 
       
 10459 
       
 10460 /**
       
 10461 @SYMTestCaseID BA-CTSY-CCON-CAICI-0004
       
 10462 @SYMComponent  telephony_ctsy
       
 10463 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobileCall::AnswerIncomingCallISV for voice calls
       
 10464 @SYMTestPriority High
       
 10465 @SYMTestActions Invokes multiple client requests to RMobileCall::AnswerIncomingCallISV for voice calls
       
 10466 @SYMTestExpectedResults Pass
       
 10467 @SYMTestType CT
       
 10468 */
       
 10469 void CCTsyCallControlFU::TestAnswerIncomingCallISV0004L()
       
 10470 	{
       
 10471 	OpenEtelServerL(EUseExtendedError);
       
 10472 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10473 	OpenPhoneL();
       
 10474 
       
 10475 	RBuf8 expectData;
       
 10476 	CleanupClosePushL(expectData);
       
 10477 
       
 10478 	// Open second client
       
 10479 	RTelServer telServer2;
       
 10480 	TInt ret = telServer2.Connect();
       
 10481 	ASSERT_EQUALS(KErrNone, ret);
       
 10482 	CleanupClosePushL(telServer2);
       
 10483 
       
 10484 	RMobilePhone phone2;
       
 10485 	ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
 10486 	ASSERT_EQUALS(KErrNone, ret);
       
 10487 	CleanupClosePushL(phone2);
       
 10488 
       
 10489 	RLine line1;
       
 10490 	RLine line2;
       
 10491 	
       
 10492 	RMobileCall call1;
       
 10493 	CleanupClosePushL(call1);
       
 10494 
       
 10495 	RMobileCall call2;
       
 10496 	CleanupClosePushL(call2);
       
 10497 	
       
 10498 	TInt errorCode = KErrNone;
       
 10499 
       
 10500 	TInt callId1 = 1;
       
 10501 	TName incomingCallName1;
       
 10502 
       
 10503 	TInt callId2 = 2;
       
 10504 	TName incomingCallName2;
       
 10505 
       
 10506 	TRequestStatus requestStatus1;
       
 10507 	TRequestStatus requestStatus2;
       
 10508 
       
 10509 	// open new line1 for KMmTsyVoice1LineName
       
 10510 	errorCode = OpenNewLineLC(iPhone, line1, KMmTsyVoice1LineName);
       
 10511 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10512 
       
 10513 	// open new line2 for KMmTsyVoice1LineName
       
 10514 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
 10515 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10516 
       
 10517     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 10518     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 10519 
       
 10520 	//-------------------------------------------------------------------------
       
 10521 	// Test A: Test multiple clients requesting RCall::AnswerIncomingCall
       
 10522  	//-------------------------------------------------------------------------
       
 10523 
       
 10524  	//-------------------------------------------------------------------------
       
 10525 	// create new incoming call1
       
 10526 	errorCode = CreateIncomingCallL(line1, callId1, incomingCallName1,
       
 10527 	                               mobileService, mobileCallStatus);	
       
 10528 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10529 	AssertMockLtsyStatusL();
       
 10530 		
       
 10531     errorCode = call1.OpenExistingCall(line1, incomingCallName1);
       
 10532     ASSERT_EQUALS(KErrNone, errorCode);
       
 10533 	AssertMockLtsyStatusL();
       
 10534  	//-------------------------------------------------------------------------
       
 10535 	
       
 10536  	//-------------------------------------------------------------------------
       
 10537 	// create new incoming call2
       
 10538 	errorCode = CreateIncomingCallL(line2, callId2, incomingCallName2,
       
 10539 	                               mobileService, mobileCallStatus);	
       
 10540 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10541 	AssertMockLtsyStatusL();
       
 10542 		
       
 10543     errorCode = call2.OpenExistingCall(line2, incomingCallName2);
       
 10544     ASSERT_EQUALS(KErrNone, errorCode);
       
 10545 	AssertMockLtsyStatusL();
       
 10546  	//-------------------------------------------------------------------------
       
 10547 
       
 10548     TMockLtsyCallData0 mockData01(callId1, mobileService);
       
 10549     expectData.Close();
       
 10550     mockData01.SerialiseL(expectData);
       
 10551     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10552     iMockLTSY.CompleteL(EMobileCallAnswerISV, KErrNone, expectData);
       
 10553 
       
 10554 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParamsV1;
       
 10555 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
 10556     call1.AnswerIncomingCallISV(requestStatus1, mmParamsPckgV1);
       
 10557 
       
 10558     TMockLtsyCallData0 mockData02(callId2, mobileService);
       
 10559     expectData.Close();
       
 10560     mockData02.SerialiseL(expectData);
       
 10561     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10562     iMockLTSY.CompleteL(EMobileCallAnswerISV, KErrNone, expectData);
       
 10563 
       
 10564     call2.AnswerIncomingCallISV(requestStatus2, mmParamsPckgV1);
       
 10565 
       
 10566     User::WaitForRequest(requestStatus1);
       
 10567     AssertMockLtsyStatusL();
       
 10568     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
 10569 
       
 10570     User::WaitForRequest(requestStatus2);
       
 10571     AssertMockLtsyStatusL();
       
 10572     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
 10573 
       
 10574 	// Done !
       
 10575 	CleanupStack::PopAndDestroy(4); // line1, line2, call1, call2
       
 10576 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, expectData, this
       
 10577 	}
       
 10578 
       
 10579 
       
 10580 /**
       
 10581 @SYMTestCaseID BA-CTSY-CCON-CAICI-0005
       
 10582 @SYMComponent  telephony_ctsy
       
 10583 @SYMTestCaseDesc Test support in CTSY for RMobileCall::AnswerIncomingCallISV with timeout for voice calls
       
 10584 @SYMTestPriority High
       
 10585 @SYMTestActions Invokes RMobileCall::AnswerIncomingCallISV and tests for timeout for voice calls
       
 10586 @SYMTestExpectedResults Pass
       
 10587 @SYMTestType CT
       
 10588 */
       
 10589 void CCTsyCallControlFU::TestAnswerIncomingCallISV0005L()
       
 10590 	{
       
 10591 	OpenEtelServerL(EUseExtendedError);
       
 10592 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10593 	OpenPhoneL();
       
 10594 
       
 10595 	RBuf8 expectData;
       
 10596 	CleanupClosePushL(expectData);
       
 10597 
       
 10598 	RLine line;
       
 10599 	RMobileCall call;
       
 10600 	CleanupClosePushL(call);
       
 10601 	
       
 10602 	TInt errorCode = KErrNone;
       
 10603 	TInt callId = 1;
       
 10604 	TName incomingCallName;
       
 10605 
       
 10606     TRequestStatus requestStatus;
       
 10607 	TRequestStatus mockLtsyStatus;
       
 10608 
       
 10609 	// open new line for KMmTsyVoice1LineName
       
 10610 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
 10611 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10612 	
       
 10613     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 10614     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 10615 
       
 10616 	//-------------------------------------------------------------------------
       
 10617 	// Test A: Test timeout of RMobileCall::AnswerIncomingCallISV
       
 10618  	//-------------------------------------------------------------------------
       
 10619 		
       
 10620  	//-------------------------------------------------------------------------
       
 10621 	// create new incoming call
       
 10622 	errorCode = CreateIncomingCallL(line, callId, incomingCallName,
       
 10623 	                               mobileService, mobileCallStatus);	
       
 10624 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10625 	AssertMockLtsyStatusL();
       
 10626 		
       
 10627     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10628     ASSERT_EQUALS(KErrNone, errorCode);
       
 10629 	AssertMockLtsyStatusL();
       
 10630  	//-------------------------------------------------------------------------
       
 10631 
       
 10632     TMockLtsyCallData0 mockData0(callId, mobileService);
       
 10633     expectData.Close();
       
 10634     mockData0.SerialiseL(expectData);
       
 10635     iMockLTSY.ExpectL(EMobileCallAnswerISV, expectData);
       
 10636 
       
 10637 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParamsV1;
       
 10638 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
 10639     call.AnswerIncomingCallISV(requestStatus, mmParamsPckgV1);
       
 10640 
       
 10641     User::WaitForRequest(requestStatus);
       
 10642     AssertMockLtsyStatusL();
       
 10643     ASSERT_EQUALS(KErrTimedOut, requestStatus.Int());
       
 10644 
       
 10645 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
 10646 	}
       
 10647 
       
 10648 
       
 10649 /**
       
 10650 @SYMTestCaseID BA-CTSY-CCON-CAICI-0006
       
 10651 @SYMComponent  telephony_ctsy
       
 10652 @SYMTestCaseDesc Test support in CTSY for RMobileCall::AnswerIncomingCallISV for data calls
       
 10653 @SYMTestPriority High
       
 10654 @SYMTestActions Invokes RMobileCall::AnswerIncomingCallISV for data calls
       
 10655 @SYMTestExpectedResults Pass
       
 10656 @SYMTestType CT
       
 10657 */
       
 10658 void CCTsyCallControlFU::TestAnswerIncomingCallISV0006L()
       
 10659 	{
       
 10660 	OpenEtelServerL(EUseExtendedError);
       
 10661 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10662 	OpenPhoneL();
       
 10663 
       
 10664 	RBuf8 expectData;
       
 10665 	CleanupClosePushL(expectData);
       
 10666 
       
 10667 	RLine line;
       
 10668 	RMobileCall call;
       
 10669 	CleanupClosePushL(call);
       
 10670 	
       
 10671 	TInt errorCode = KErrNone;
       
 10672 	TInt callId = 1;
       
 10673 	TName incomingCallName;
       
 10674 
       
 10675     TRequestStatus requestStatus;
       
 10676 	TRequestStatus mockLtsyStatus;
       
 10677 
       
 10678 	// open new line for KMmTsyDataLineName
       
 10679 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyDataLineName);
       
 10680 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10681 
       
 10682     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
 10683     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 10684 	
       
 10685  	//-------------------------------------------------------------------------
       
 10686 	// TEST A: failure to dispatch request to LTSY
       
 10687  	//-------------------------------------------------------------------------
       
 10688 
       
 10689  	//-------------------------------------------------------------------------
       
 10690 	// create new incoming call
       
 10691 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
 10692 	                               mobileService, mobileCallStatus);	
       
 10693 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10694 		
       
 10695     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10696     ASSERT_EQUALS(KErrNone, errorCode);
       
 10697  	//-------------------------------------------------------------------------
       
 10698 
       
 10699 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParamsV1;
       
 10700 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
 10701     call.AnswerIncomingCallISV(requestStatus, mmParamsPckgV1);
       
 10702 
       
 10703     User::WaitForRequest(requestStatus);
       
 10704     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 10705 
       
 10706 	AssertMockLtsyStatusL();
       
 10707 	CleanupStack::PopAndDestroy(4, this); // expectData, this, line, call
       
 10708 	
       
 10709 	}
       
 10710 
       
 10711 /**
       
 10712 @SYMTestCaseID BA-CTSY-CCON-CAICI-00011
       
 10713 @SYMComponent  telephony_ctsy
       
 10714 @SYMTestCaseDesc Test support in CTSY for RMobileCall::AnswerIncomingCallISV for fax calls
       
 10715 @SYMTestPriority High
       
 10716 @SYMTestActions Invokes RMobileCall::AnswerIncomingCallISV for fax calls
       
 10717 @SYMTestExpectedResults Pass
       
 10718 @SYMTestType CT
       
 10719 */
       
 10720 void CCTsyCallControlFU::TestAnswerIncomingCallISV00011L()
       
 10721 	{
       
 10722 
       
 10723 	OpenEtelServerL(EUseExtendedError);
       
 10724 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10725 	OpenPhoneL();
       
 10726 
       
 10727 	RBuf8 expectData;
       
 10728 	CleanupClosePushL(expectData);
       
 10729 
       
 10730 	RLine line;
       
 10731 	RMobileCall call;
       
 10732 	CleanupClosePushL(call);
       
 10733 	
       
 10734 	TInt errorCode = KErrNone;
       
 10735 	TInt callId = 1;
       
 10736 	TName incomingCallName;
       
 10737 
       
 10738     TRequestStatus requestStatus;
       
 10739 	TRequestStatus mockLtsyStatus;
       
 10740 
       
 10741 	// open new line for KMmTsyFaxLineName
       
 10742 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyFaxLineName);
       
 10743 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10744 
       
 10745     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
 10746     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 10747 	
       
 10748 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParamsV1;
       
 10749 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> mmParamsPckgV1(callParamsV1);
       
 10750     TMockLtsyCallData0 mockData0(callId, mobileService);
       
 10751 
       
 10752  	//-------------------------------------------------------------------------
       
 10753 	// TEST A: failure to dispatch request to LTSY
       
 10754  	//-------------------------------------------------------------------------
       
 10755 
       
 10756  	//-------------------------------------------------------------------------
       
 10757 	// create new incoming call
       
 10758 	errorCode = CreateIncomingCallL(line, callId, incomingCallName, 
       
 10759 	                               mobileService, mobileCallStatus);	
       
 10760 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10761 		
       
 10762     errorCode = call.OpenExistingCall(line, incomingCallName);
       
 10763     ASSERT_EQUALS(KErrNone, errorCode);
       
 10764  	//-------------------------------------------------------------------------
       
 10765     expectData.Close();
       
 10766     mockData0.SerialiseL(expectData);
       
 10767     call.AnswerIncomingCallISV(requestStatus, mmParamsPckgV1);
       
 10768 
       
 10769     User::WaitForRequest(requestStatus);
       
 10770     ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 10771 
       
 10772 	AssertMockLtsyStatusL();
       
 10773 	CleanupStack::PopAndDestroy(4, this); // expectData, this, call, line
       
 10774 	
       
 10775 	}
       
 10776 
       
 10777 /**
       
 10778 @SYMTestCaseID BA-CTSY-CCON-CDI-0001
       
 10779 @SYMComponent  telephony_ctsy
       
 10780 @SYMTestCaseDesc Test support in CTSY for RMobileCall::DialISV for voice calls
       
 10781 @SYMTestPriority High
       
 10782 @SYMTestActions Invokes RMobileCall::DialISV for voice calls
       
 10783 @SYMTestExpectedResults Pass
       
 10784 @SYMTestType CT
       
 10785 */
       
 10786 void CCTsyCallControlFU::TestDialISV0001L()
       
 10787 	{
       
 10788 	OpenEtelServerL(EUseExtendedError);
       
 10789 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10790 	OpenPhoneL();
       
 10791 
       
 10792     RBuf8 expectData;
       
 10793     CleanupClosePushL(expectData);
       
 10794 
       
 10795     RBuf8 completeData;
       
 10796     CleanupClosePushL(completeData);
       
 10797 
       
 10798 	RMobileLine line;
       
 10799 	RMobileCall call;
       
 10800 	
       
 10801 	TInt errorCode = KErrNone;
       
 10802     TRequestStatus requestStatus;
       
 10803 	TRequestStatus mockLtsyStatus;
       
 10804 	
       
 10805 	// open new line for KMmTsyVoice1LineName
       
 10806     errorCode = line.Open(iPhone, KMmTsyVoice1LineName);
       
 10807     CleanupClosePushL(line);
       
 10808 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10809 		
       
 10810     _LIT(KDoubleColon, "::");
       
 10811     
       
 10812     TName name;
       
 10813     name = KMmTsyPhoneName;
       
 10814     name.Append(KDoubleColon);
       
 10815     name.Append(KMmTsyVoice1LineName);
       
 10816     name.Append(KDoubleColon);
       
 10817 	   	
       
 10818 	_LIT(KPhoneNumber, "101632960000");   	
       
 10819    	
       
 10820 	TInt callId = 1;
       
 10821     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 10822 			
       
 10823 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParams;
       
 10824 	callParams.iIdRestrict = RMobileCall::ESendMyId;
       
 10825 	callParams.iAutoRedial = ETrue;
       
 10826 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> pckgCallParams(callParams);
       
 10827     
       
 10828 	RMobileCall::TMobileCallInfoV1 callInfo;
       
 10829 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 10830 	callInfo.iService = mobileService;
       
 10831 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
 10832 	
       
 10833 	RMmCustomAPI::TEmerNumberCheckMode emerNumberCheckMode;
       
 10834 	emerNumberCheckMode.iCheckMode = RMmCustomAPI::EEmerNumberCheckNormal;
       
 10835     emerNumberCheckMode.iNumber.Copy(KPhoneNumber);	
       
 10836 	
       
 10837 	RMmCustomAPI::TMobileTelNumber* telNumberPtr = NULL;
       
 10838 	
       
 10839     TMockLtsyData1<RMmCustomAPI::TEmerNumberCheckMode> expectLtsyData1(emerNumberCheckMode);
       
 10840     
       
 10841 	TMockLtsyCallData2<RMobileCall::TEtel3rdPartyMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
 10842 		expectLtsyData2(0, mobileService, callParams, callInfo);  
       
 10843 			
       
 10844 	TMockLtsyCallData0 completeLtsyData1(callId, mobileService);	  
       
 10845     
       
 10846 	TMockLtsyData1< RMmCustomAPI::TMobileTelNumber* > completeLtsyData2(telNumberPtr);	   
       
 10847 	
       
 10848  	//-------------------------------------------------------------------------
       
 10849 	// TEST E: Unsolicited completion of RCall::Dial
       
 10850 	// from LTSY.
       
 10851  	//-------------------------------------------------------------------------
       
 10852 
       
 10853 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 10854     expectData.Close();
       
 10855     completeLtsyData1.SerialiseL(expectData);
       
 10856 	iMockLTSY.CompleteL(EMobileCallDialISV, KErrNone, expectData);
       
 10857 	User::WaitForRequest(mockLtsyStatus);
       
 10858 	AssertMockLtsyStatusL();
       
 10859 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 10860 	
       
 10861  	//-------------------------------------------------------------------------
       
 10862 	// TEST A: Try to make RMobileCall::DialISV request in case where
       
 10863 	// CustomTSY is not opened. This should fail because in DialISV case TSY 	
       
 10864 	// checks dialling number type using CustomTSY.
       
 10865  	//-------------------------------------------------------------------------
       
 10866 
       
 10867 	// open new call
       
 10868    	CleanupClosePushL(call);
       
 10869    	errorCode = call.OpenNewCall(line, name);
       
 10870     ASSERT_EQUALS(KErrNone, errorCode);
       
 10871 
       
 10872 	call.DialISV(requestStatus, pckgCallParams, KPhoneNumber);
       
 10873 	User::WaitForRequest(requestStatus);
       
 10874 	AssertMockLtsyStatusL();
       
 10875 	ASSERT_EQUALS(KErrNotReady, requestStatus.Int());
       
 10876 
       
 10877  	//-------------------------------------------------------------------------
       
 10878 	// TEST C: Successful completion request of
       
 10879 	// RMobileCall::DialISV when result is not cached.
       
 10880  	//-------------------------------------------------------------------------
       
 10881 
       
 10882  	//-------------------------------------------------------------------------
       
 10883 	// CustomTSY must be open before DialISV is requested
       
 10884 	iMockLTSY.ExpectL(ECustomGetIccCallForwardingStatusIPC);
       
 10885 		
       
 10886     RMmCustomAPI::TViagCacheRecordId currentlyRetrievedCache;		
       
 10887     currentlyRetrievedCache.iCacheId	= 1;
       
 10888     currentlyRetrievedCache.iRecordId	= 0;
       
 10889     TMockLtsyData1 <RMmCustomAPI::TViagCacheRecordId> ltsyData2(currentlyRetrievedCache);
       
 10890     expectData.Close();
       
 10891     ltsyData2.SerialiseL(expectData);			
       
 10892     iMockLTSY.ExpectL(EReadViagHomeZoneCacheIPC, expectData);	
       
 10893 			
       
 10894 	RMmCustomAPI customAPI;
       
 10895 	customAPI.Open(iPhone);
       
 10896 	CleanupClosePushL(customAPI);
       
 10897 	AssertMockLtsyStatusL();
       
 10898     //-------------------------------------------------------------------------	
       
 10899 
       
 10900     completeData.Close();
       
 10901 	completeLtsyData2.SerialiseL(completeData);    
       
 10902     iMockLTSY.CompleteL(ECustomCheckEmergencyNumberIPC, KErrNone, completeData); 
       
 10903     
       
 10904     expectData.Close();
       
 10905     expectLtsyData1.SerialiseL(expectData);
       
 10906     iMockLTSY.ExpectL(ECustomCheckEmergencyNumberIPC, expectData);
       
 10907 
       
 10908 	expectData.Close();
       
 10909 	expectLtsyData1.SerialiseL(expectData);
       
 10910 	iMockLTSY.ExpectL(EMobileCallDialISV, expectData);
       
 10911 
       
 10912 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);	
       
 10913 	
       
 10914 	completeData.Close();
       
 10915 	completeLtsyData1.SerialiseL(completeData);
       
 10916 	iMockLTSY.CompleteL(EMobileCallDialISV, KErrNone, completeData);
       
 10917 	
       
 10918 	call.DialISV(requestStatus, pckgCallParams, KPhoneNumber);
       
 10919 	User::WaitForRequest(requestStatus);
       
 10920 	AssertMockLtsyStatusL();
       
 10921 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
 10922 
       
 10923 	call.Close();
       
 10924 
       
 10925 	AssertMockLtsyStatusL();
       
 10926 	CleanupStack::PopAndDestroy(6, this); // this, expectData, completeData, line, call, customAPI
       
 10927 	
       
 10928 	}
       
 10929 
       
 10930 /**
       
 10931 @SYMTestCaseID BA-CTSY-CCON-CDI-0006
       
 10932 @SYMComponent  telephony_ctsy
       
 10933 @SYMTestCaseDesc Test support in CTSY for RMobileCall::DialISV for data calls
       
 10934 @SYMTestPriority High
       
 10935 @SYMTestActions Invokes RMobileCall::DialISV for data calls
       
 10936 @SYMTestExpectedResults Pass
       
 10937 @SYMTestType CT
       
 10938 */
       
 10939 void CCTsyCallControlFU::TestDialISV0006L()
       
 10940 	{
       
 10941 
       
 10942 	OpenEtelServerL(EUseExtendedError);
       
 10943 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 10944 	OpenPhoneL();
       
 10945 
       
 10946     RBuf8 expectData;
       
 10947     CleanupClosePushL(expectData);
       
 10948 
       
 10949     RBuf8 completeData;
       
 10950     CleanupClosePushL(completeData);
       
 10951 
       
 10952 	RMobileLine line;
       
 10953 	RMobileCall call;
       
 10954 	
       
 10955 	TInt errorCode = KErrNone;
       
 10956     TRequestStatus requestStatus;
       
 10957 	TRequestStatus mockLtsyStatus;
       
 10958 	
       
 10959 	// open new line for KMmTsyDataLineName
       
 10960     errorCode = line.Open(iPhone, KMmTsyDataLineName);
       
 10961     CleanupClosePushL(line);
       
 10962 	ASSERT_EQUALS(KErrNone, errorCode);
       
 10963 		
       
 10964     _LIT(KDoubleColon, "::");
       
 10965     
       
 10966     TName name;
       
 10967     name = KMmTsyPhoneName;
       
 10968     name.Append(KDoubleColon);
       
 10969     name.Append(KMmTsyDataLineName);
       
 10970     name.Append(KDoubleColon);
       
 10971 	   	
       
 10972 	_LIT(KPhoneNumber, "101632960000");   	
       
 10973    	
       
 10974 	TInt callId = 1;
       
 10975     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
 10976 			
       
 10977 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParams;
       
 10978     
       
 10979 	RMobileCall::TMobileCallInfoV1 callInfo;
       
 10980 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 10981 	callInfo.iService = mobileService;
       
 10982 	callInfo.iValid = RMobileCall::KCallDialledParty;
       
 10983 	
       
 10984 	TMockLtsyCallData2<RMobileCall::TEtel3rdPartyMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
 10985 		mockData2(0, mobileService, callParams, callInfo);
       
 10986 
       
 10987 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
 10988 	
       
 10989 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> pckgCallParams(callParams);
       
 10990 	
       
 10991  	//-------------------------------------------------------------------------
       
 10992 	// TEST A: failure to dispatch request to LTSY
       
 10993  	//-------------------------------------------------------------------------
       
 10994 
       
 10995 	// open new call
       
 10996    	CleanupClosePushL(call);
       
 10997    	errorCode = call.OpenNewCall(line, name);
       
 10998     ASSERT_EQUALS(KErrNone, errorCode);
       
 10999 
       
 11000 	call.DialISV(requestStatus, pckgCallParams, KPhoneNumber);
       
 11001 	User::WaitForRequest(requestStatus);
       
 11002 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 11003 
       
 11004 	call.Close();
       
 11005 	AssertMockLtsyStatusL();
       
 11006 	CleanupStack::PopAndDestroy(1);
       
 11007 
       
 11008  	//-------------------------------------------------------------------------
       
 11009 	// TEST E: Unsolicited completion of RMobileCall::DialISV
       
 11010 	// from LTSY.
       
 11011  	//-------------------------------------------------------------------------
       
 11012 
       
 11013 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11014     expectData.Close();
       
 11015     mockData0.SerialiseL(expectData);
       
 11016 	iMockLTSY.CompleteL(EMobileCallDialISV, KErrNone, expectData);
       
 11017 	User::WaitForRequest(mockLtsyStatus);
       
 11018 	AssertMockLtsyStatusL();
       
 11019 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11020 
       
 11021 	AssertMockLtsyStatusL();
       
 11022 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line
       
 11023 	
       
 11024 	}
       
 11025 
       
 11026 /**
       
 11027 @SYMTestCaseID BA-CTSY-CCON-CDI-00011
       
 11028 @SYMComponent  telephony_ctsy
       
 11029 @SYMTestCaseDesc Test support in CTSY for RMobileCall::DialISV for fax calls
       
 11030 @SYMTestPriority High
       
 11031 @SYMTestActions Invokes RMobileCall::DialISV for fax calls
       
 11032 @SYMTestExpectedResults Pass
       
 11033 @SYMTestType CT
       
 11034 */
       
 11035 void CCTsyCallControlFU::TestDialISV00011L()
       
 11036 	{
       
 11037 
       
 11038 	OpenEtelServerL(EUseExtendedError);
       
 11039 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 11040 	OpenPhoneL();
       
 11041 
       
 11042     RBuf8 expectData;
       
 11043     CleanupClosePushL(expectData);
       
 11044 
       
 11045     RBuf8 completeData;
       
 11046     CleanupClosePushL(completeData);
       
 11047 
       
 11048 	RMobileLine line;
       
 11049 	RMobileCall call;
       
 11050 	
       
 11051 	TInt errorCode = KErrNone;
       
 11052     TRequestStatus requestStatus;
       
 11053 	TRequestStatus mockLtsyStatus;
       
 11054 	
       
 11055 	// open new line for KMmTsyDataLineName
       
 11056     errorCode = line.Open(iPhone, KMmTsyFaxLineName);
       
 11057     CleanupClosePushL(line);
       
 11058 	ASSERT_EQUALS(KErrNone, errorCode);
       
 11059 		
       
 11060     _LIT(KDoubleColon, "::");
       
 11061     
       
 11062     TName name;
       
 11063     name = KMmTsyPhoneName;
       
 11064     name.Append(KDoubleColon);
       
 11065     name.Append(KMmTsyFaxLineName);
       
 11066     name.Append(KDoubleColon);
       
 11067 	   	
       
 11068 	_LIT(KPhoneNumber, "101632960000");   	
       
 11069    	
       
 11070 	TInt callId = 1;
       
 11071     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
 11072 			
       
 11073 	RMobileCall::TEtel3rdPartyMobileCallParamsV1 callParams;
       
 11074     
       
 11075 	RMobileCall::TMobileCallInfoV1 callInfo;
       
 11076 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 11077 	callInfo.iService = mobileService;
       
 11078 	callInfo.iValid = RMobileCall::KCallDialledParty;
       
 11079 	
       
 11080 	TMockLtsyCallData2<RMobileCall::TEtel3rdPartyMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
 11081 		mockData2(0, mobileService, callParams, callInfo);
       
 11082 
       
 11083 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
 11084 	
       
 11085 	TPckg<RMobileCall::TEtel3rdPartyMobileCallParamsV1> pckgCallParams(callParams);
       
 11086 
       
 11087  	//-------------------------------------------------------------------------
       
 11088 	// TEST A: failure to dispatch request to LTSY
       
 11089  	//-------------------------------------------------------------------------
       
 11090 
       
 11091 	// open new call
       
 11092    	CleanupClosePushL(call);
       
 11093    	errorCode = call.OpenNewCall(line, name);
       
 11094     ASSERT_EQUALS(KErrNone, errorCode);
       
 11095 
       
 11096 	call.DialISV(requestStatus, pckgCallParams, KPhoneNumber);
       
 11097 	User::WaitForRequest(requestStatus);
       
 11098 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 11099 
       
 11100 	call.Close();
       
 11101 	AssertMockLtsyStatusL();
       
 11102 	CleanupStack::PopAndDestroy(1);
       
 11103 
       
 11104  	//-------------------------------------------------------------------------
       
 11105 	// TEST E: Unsolicited completion of RMobileCall::DialISV
       
 11106 	// from LTSY.
       
 11107  	//-------------------------------------------------------------------------
       
 11108 
       
 11109 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11110     expectData.Close();
       
 11111     mockData0.SerialiseL(expectData);
       
 11112 	iMockLTSY.CompleteL(EMobileCallDialISV, KErrNone, expectData);
       
 11113 	User::WaitForRequest(mockLtsyStatus);
       
 11114 	AssertMockLtsyStatusL();
       
 11115 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11116 
       
 11117 	AssertMockLtsyStatusL();
       
 11118 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line
       
 11119 	
       
 11120 	}
       
 11121 
       
 11122 
       
 11123 /**
       
 11124 @SYMTestCaseID BA-CTSY-CCON-CDCC-0001
       
 11125 @SYMComponent  telephony_ctsy
       
 11126 @SYMTestCaseDesc Test support in CTSY for RMobileCall::DialCallControl for voice calls
       
 11127 @SYMTestPriority High
       
 11128 @SYMTestActions Invokes RMobileCall::DialCallControl for voice calls
       
 11129 @SYMTestExpectedResults Pass
       
 11130 @SYMTestType CT
       
 11131 */
       
 11132 void CCTsyCallControlFU::TestDialCallControl0001L()
       
 11133 	{
       
 11134 
       
 11135 	OpenEtelServerL(EUseExtendedError);
       
 11136 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 11137 	OpenPhoneL();
       
 11138 
       
 11139     RBuf8 expectData;
       
 11140     CleanupClosePushL(expectData);
       
 11141 
       
 11142     RBuf8 completeData;
       
 11143     CleanupClosePushL(completeData);
       
 11144 
       
 11145 	RMobileLine line;
       
 11146 	RMobileCall call;
       
 11147 	
       
 11148 	TInt errorCode = KErrNone;
       
 11149     TRequestStatus requestStatus;
       
 11150 	TRequestStatus mockLtsyStatus;
       
 11151 	
       
 11152 	// Open new line for KMmTsyVoice1LineName
       
 11153     errorCode = line.Open(iPhone, KMmTsyVoice1LineName);
       
 11154     CleanupClosePushL(line);
       
 11155 	ASSERT_EQUALS(KErrNone, errorCode);
       
 11156 		
       
 11157     _LIT(KDoubleColon, "::");
       
 11158     
       
 11159     TName name;
       
 11160     name = KMmTsyPhoneName;
       
 11161     name.Append(KDoubleColon);
       
 11162     name.Append(KMmTsyVoice1LineName);
       
 11163     name.Append(KDoubleColon);
       
 11164 	   	
       
 11165 	_LIT(KPhoneNumber, "101632960000");   	
       
 11166    	
       
 11167 	TInt callId = 1;
       
 11168     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 11169 			
       
 11170 	RMobileCall::TMobileCallParamsV7 callParams;
       
 11171     
       
 11172 	RMobileCall::TMobileCallInfoV8 callInfo;
       
 11173 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 11174 	callInfo.iService = mobileService;
       
 11175 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
 11176 	
       
 11177 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
 11178 		mockData2(0, mobileService, callParams, callInfo);
       
 11179 
       
 11180 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
 11181 	
       
 11182 	TPckg<RMobileCall::TMobileCallParamsV7> pckgCallParams(callParams);
       
 11183 
       
 11184  	//-------------------------------------------------------------------------
       
 11185 	// TEST A: failure to dispatch request to LTSY
       
 11186  	//-------------------------------------------------------------------------
       
 11187 
       
 11188 	// Open new call
       
 11189    	CleanupClosePushL(call);
       
 11190    	errorCode = call.OpenNewCall(line, name);
       
 11191     ASSERT_EQUALS(KErrNone, errorCode);
       
 11192         
       
 11193     call.DialCallControl(requestStatus, pckgCallParams, KPhoneNumber);
       
 11194 	User::WaitForRequest(requestStatus);
       
 11195 	
       
 11196 	// This is not a defect. DialCallControl fails because feature is not 
       
 11197 	// supported by CTSY.
       
 11198 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 11199 	
       
 11200 	
       
 11201 	call.Close();
       
 11202 	AssertMockLtsyStatusL();
       
 11203 	CleanupStack::PopAndDestroy(1); // call
       
 11204 
       
 11205  	//-------------------------------------------------------------------------
       
 11206 	// TEST E: Unsolicited completion of RMobileCall::DialCallControl
       
 11207 	// from LTSY.
       
 11208  	//-------------------------------------------------------------------------
       
 11209 
       
 11210 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11211     expectData.Close();
       
 11212     mockData0.SerialiseL(expectData);
       
 11213 	iMockLTSY.CompleteL(EMobileCallDialCallControl, KErrNone, expectData);
       
 11214 	User::WaitForRequest(mockLtsyStatus);
       
 11215 	AssertMockLtsyStatusL();
       
 11216 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11217 
       
 11218 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
 11219 	
       
 11220 	}
       
 11221 
       
 11222 /**
       
 11223 @SYMTestCaseID BA-CTSY-CCON-CDCC-0006
       
 11224 @SYMComponent  telephony_ctsy
       
 11225 @SYMTestCaseDesc Test support in CTSY for RMobileCall::DialCallControl for data calls
       
 11226 @SYMTestPriority High
       
 11227 @SYMTestActions Invokes RMobileCall::DialCallControl for data calls
       
 11228 @SYMTestExpectedResults Pass
       
 11229 @SYMTestType CT
       
 11230 */
       
 11231 void CCTsyCallControlFU::TestDialCallControl0006L()
       
 11232 	{
       
 11233 
       
 11234 	OpenEtelServerL(EUseExtendedError);
       
 11235 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 11236 	OpenPhoneL();
       
 11237 
       
 11238     RBuf8 expectData;
       
 11239     CleanupClosePushL(expectData);
       
 11240 
       
 11241     RBuf8 completeData;
       
 11242     CleanupClosePushL(completeData);
       
 11243 
       
 11244 	RMobileLine line;
       
 11245 	RMobileCall call;
       
 11246 	
       
 11247 	TInt errorCode = KErrNone;
       
 11248     TRequestStatus requestStatus;
       
 11249 	TRequestStatus mockLtsyStatus;
       
 11250 	
       
 11251 	// Open new line for KMmTsyDataLineName
       
 11252     errorCode = line.Open(iPhone, KMmTsyDataLineName);
       
 11253     CleanupClosePushL(line);
       
 11254 	ASSERT_EQUALS(KErrNone, errorCode);
       
 11255 		
       
 11256     _LIT(KDoubleColon, "::");
       
 11257     
       
 11258     TName name;
       
 11259     name = KMmTsyPhoneName;
       
 11260     name.Append(KDoubleColon);
       
 11261     name.Append(KMmTsyDataLineName);
       
 11262     name.Append(KDoubleColon);
       
 11263 	   	
       
 11264 	_LIT(KPhoneNumber, "101632960000");   	
       
 11265    	
       
 11266 	TInt callId = 1;
       
 11267     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
 11268 			
       
 11269 	RMobileCall::TMobileCallParamsV7 callParams;
       
 11270     
       
 11271 	RMobileCall::TMobileCallInfoV8 callInfo;
       
 11272 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 11273 	callInfo.iService = mobileService;
       
 11274 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
 11275 	
       
 11276 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
 11277 		mockData2(0, mobileService, callParams, callInfo);
       
 11278 
       
 11279 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
 11280 	
       
 11281 	TPckg<RMobileCall::TMobileCallParamsV7> pckgCallParams(callParams);
       
 11282 	
       
 11283  	//-------------------------------------------------------------------------
       
 11284 	// TEST A: failure to dispatch request to LTSY
       
 11285  	//-------------------------------------------------------------------------
       
 11286 
       
 11287 	// Open new call
       
 11288    	CleanupClosePushL(call);
       
 11289    	errorCode = call.OpenNewCall(line, name);
       
 11290     ASSERT_EQUALS(KErrNone, errorCode);
       
 11291 
       
 11292 	call.DialCallControl(requestStatus, pckgCallParams, KPhoneNumber);
       
 11293 	User::WaitForRequest(requestStatus);
       
 11294 	
       
 11295 	// This is not a defect. DialCallControl fails because feature is not 
       
 11296 	// supported by CTSY.	
       
 11297 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 11298 
       
 11299 	call.Close();
       
 11300 	AssertMockLtsyStatusL();
       
 11301 	CleanupStack::PopAndDestroy(1); // call
       
 11302 
       
 11303  	//-------------------------------------------------------------------------
       
 11304 	// TEST E: Unsolicited completion of RMobileCall::DialISV
       
 11305 	// from LTSY.
       
 11306  	//-------------------------------------------------------------------------
       
 11307 
       
 11308 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11309     expectData.Close();
       
 11310     mockData0.SerialiseL(expectData);
       
 11311 	iMockLTSY.CompleteL(EMobileCallDialCallControl, KErrNone, expectData);
       
 11312 	User::WaitForRequest(mockLtsyStatus);
       
 11313 	AssertMockLtsyStatusL();
       
 11314 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11315 
       
 11316 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, call
       
 11317 	
       
 11318 	}
       
 11319 
       
 11320 /**
       
 11321 @SYMTestCaseID BA-CTSY-CCON-CDCC-00011
       
 11322 @SYMComponent  telephony_ctsy
       
 11323 @SYMTestCaseDesc Test support in CTSY for RMobileCall::DialCallControl for fax calls
       
 11324 @SYMTestPriority High
       
 11325 @SYMTestActions Invokes RMobileCall::DialCallControl for fax calls
       
 11326 @SYMTestExpectedResults Pass
       
 11327 @SYMTestType CT
       
 11328 */
       
 11329 void CCTsyCallControlFU::TestDialCallControl00011L()
       
 11330 	{
       
 11331 
       
 11332 	OpenEtelServerL(EUseExtendedError);
       
 11333 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 11334 	OpenPhoneL();
       
 11335 
       
 11336     RBuf8 expectData;
       
 11337     CleanupClosePushL(expectData);
       
 11338 
       
 11339     RBuf8 completeData;
       
 11340     CleanupClosePushL(completeData);
       
 11341 
       
 11342 	RMobileLine line;
       
 11343 	RMobileCall call;
       
 11344 	
       
 11345 	TInt errorCode = KErrNone;
       
 11346     TRequestStatus requestStatus;
       
 11347 	TRequestStatus mockLtsyStatus;
       
 11348 	
       
 11349 	// Open new line for KMmTsyFaxLineName
       
 11350     errorCode = line.Open(iPhone, KMmTsyFaxLineName);
       
 11351     CleanupClosePushL(line);
       
 11352 	ASSERT_EQUALS(KErrNone, errorCode);
       
 11353 		
       
 11354     _LIT(KDoubleColon, "::");
       
 11355     
       
 11356     TName name;
       
 11357     name = KMmTsyPhoneName;
       
 11358     name.Append(KDoubleColon);
       
 11359     name.Append(KMmTsyFaxLineName);
       
 11360     name.Append(KDoubleColon);
       
 11361 	   	
       
 11362 	_LIT(KPhoneNumber, "101632960000");   	
       
 11363    	
       
 11364 	TInt callId = 1;
       
 11365     RMobilePhone::TMobileService mobileService = RMobilePhone::EFaxService;
       
 11366 			
       
 11367 	RMobileCall::TMobileCallParamsV7 callParams;
       
 11368     
       
 11369 	RMobileCall::TMobileCallInfoV8 callInfo;
       
 11370 	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 11371 	callInfo.iService = mobileService;
       
 11372 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
 11373 	
       
 11374 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV7, RMobileCall::TMobileCallInfoV8> 
       
 11375 		mockData2(0, mobileService, callParams, callInfo);
       
 11376 
       
 11377 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
 11378 	
       
 11379 	TPckg<RMobileCall::TMobileCallParamsV7> pckgCallParams(callParams);
       
 11380 
       
 11381  	//-------------------------------------------------------------------------
       
 11382 	// TEST A: failure to dispatch request to LTSY
       
 11383  	//-------------------------------------------------------------------------
       
 11384 
       
 11385 	// Open new call
       
 11386    	CleanupClosePushL(call);
       
 11387    	errorCode = call.OpenNewCall(line, name);
       
 11388     ASSERT_EQUALS(KErrNone, errorCode);
       
 11389     
       
 11390 	call.DialCallControl(requestStatus, pckgCallParams, KPhoneNumber);
       
 11391 	User::WaitForRequest(requestStatus);
       
 11392 	
       
 11393 	// This is not a defect. DialCallControl fails because feature is not 
       
 11394 	// supported by CTSY.	
       
 11395 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 11396 
       
 11397 	call.Close();
       
 11398 	AssertMockLtsyStatusL();
       
 11399 	CleanupStack::PopAndDestroy(1); //call
       
 11400 
       
 11401  	//-------------------------------------------------------------------------
       
 11402 	// TEST E: Unsolicited completion of RMobileCall::DialISV
       
 11403 	// from LTSY.
       
 11404  	//-------------------------------------------------------------------------
       
 11405 
       
 11406 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11407     expectData.Close();
       
 11408     mockData0.SerialiseL(expectData);
       
 11409 	iMockLTSY.CompleteL(EMobileCallDialCallControl, KErrNone, expectData);
       
 11410 	User::WaitForRequest(mockLtsyStatus);
       
 11411 	AssertMockLtsyStatusL();
       
 11412 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11413 
       
 11414 	CleanupStack::PopAndDestroy(4, this); // expectData, completeData, line, this
       
 11415 	}
       
 11416 
       
 11417 /*
       
 11418  * Test case where answering fails because automatic hold does not work.
       
 11419  * 
       
 11420  * @param aLineName Line name
       
 11421  * @return KErrNone if successful, otherwise another of the system-wide error 
       
 11422  */
       
 11423 TInt CCTsyCallControlFU::TestAnsweringFailsBecauseHoldDoesNotWorkL( const TDesC& aLineName )
       
 11424 	{ 
       
 11425 	OpenEtelServerL(EUseExtendedError);
       
 11426 	CleanupStack::PushL(TCleanupItem(Cleanup,this));	    
       
 11427 	OpenPhoneL();
       
 11428 
       
 11429 	RBuf8 expectData;
       
 11430 	CleanupClosePushL(expectData);
       
 11431 
       
 11432 	RBuf8 completeData;
       
 11433 	CleanupClosePushL(completeData);
       
 11434 
       
 11435 	RMobilePhone phone2;
       
 11436 	TInt ret = phone2.Open(iTelServer,KMmTsyPhoneName);
       
 11437 	ASSERT_EQUALS(KErrNone, ret);
       
 11438 	CleanupClosePushL(phone2);
       
 11439 
       
 11440 	RLine line1;
       
 11441 	RLine line2;
       
 11442 	
       
 11443 	//Open new line1 for aLineName
       
 11444 	TInt errorCode = OpenNewLineLC(iPhone, line1, aLineName);
       
 11445 	ASSERT_EQUALS(KErrNone, errorCode);
       
 11446 
       
 11447 	//Open new line2 for KMmTsyVoice1LineName
       
 11448 	errorCode = OpenNewLineLC(phone2, line2, KMmTsyVoice1LineName);
       
 11449 	ASSERT_EQUALS(KErrNone, errorCode);	
       
 11450 	
       
 11451 	RMobileCall call1;
       
 11452 	CleanupClosePushL(call1);
       
 11453 
       
 11454 	RMobileCall call2;
       
 11455 	CleanupClosePushL(call2);
       
 11456 	
       
 11457 	_LIT(KPhoneNumber, "101632960000"); 
       
 11458 	
       
 11459     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusRinging;
       
 11460     RMobilePhone::TMobileService mobileService1;	
       
 11461     RMobilePhone::TMobileService mobileService2 = RMobilePhone::EVoiceService;
       
 11462 
       
 11463 	TInt callId1 = 1;
       
 11464 	TName callName1;
       
 11465 
       
 11466 	TInt callId2 = 2;
       
 11467 	TName callName2;
       
 11468 
       
 11469 	TRequestStatus requestStatus;
       
 11470 	TRequestStatus mockLtsyStatus;
       
 11471 
       
 11472  	//-------------------------------------------------------------------------
       
 11473  	// Create first call outgoing voice or data call
       
 11474 	
       
 11475    	errorCode = call1.OpenNewCall(line1, callName1);
       
 11476     ASSERT_EQUALS(KErrNone, errorCode);	
       
 11477     
       
 11478 	if ( !aLineName.Compare( KMmTsyDataLineName ) )
       
 11479         { 
       
 11480         //Dial data call
       
 11481         mobileService1 = RMobilePhone::ECircuitDataService;
       
 11482                     
       
 11483         CallGetMobileCallInfoL(callId1, mobileService1, KPhoneNumber);    
       
 11484 
       
 11485     	RMobileCall::TMobileDataCallParamsV1 callParams;
       
 11486         callParams.iInterval = 4;
       
 11487         callParams.iCug.iCugIndex = 0xFFFF;
       
 11488         
       
 11489     	RMobileCall::TMobileCallInfoV8 callInfo;
       
 11490     	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 11491     	callInfo.iService = mobileService1;
       
 11492     	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating ;
       
 11493     	
       
 11494     	TMockLtsyCallData2<RMobileCall::TMobileDataCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
 11495     		mockData0(0, mobileService1, callParams, callInfo);
       
 11496     
       
 11497     	TPckg<RMobileCall::TMobileDataCallParamsV1> pckgCallParams(callParams);   
       
 11498     
       
 11499     	mockData0.SerialiseL(expectData);
       
 11500       	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNone);
       
 11501 
       
 11502     	call1.Dial(requestStatus, pckgCallParams, KPhoneNumber);                                     	
       
 11503         }
       
 11504     else
       
 11505         {
       
 11506         //Dial voice call
       
 11507         mobileService1 = RMobilePhone::EVoiceService;
       
 11508             
       
 11509         CallGetMobileCallInfoL(callId1, mobileService1, KPhoneNumber);      
       
 11510             
       
 11511     	RMobileCall::TMobileCallParamsV1 callParams;
       
 11512         callParams.iInterval = 4;
       
 11513         callParams.iCug.iCugIndex = 0xFFFF;
       
 11514         TPckg<RMobileCall::TMobileCallParamsV1> pckgCallParams(callParams);
       
 11515       
       
 11516     	RMobileCall::TMobileCallInfoV8 callInfo;
       
 11517     	callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 11518     	callInfo.iService = mobileService1;
       
 11519     	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;
       
 11520     	
       
 11521     	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV8> 
       
 11522     		mockData1(0, mobileService1, callParams, callInfo);
       
 11523     
       
 11524     	mockData1.SerialiseL(expectData);
       
 11525     	iMockLTSY.ExpectL(EEtelCallDial, expectData, KErrNone);
       
 11526 
       
 11527     	call1.Dial(requestStatus, pckgCallParams, KPhoneNumber);  
       
 11528         }
       
 11529               	
       
 11530     //Change call1 status to connected
       
 11531     mobileCallStatus = RMobileCall::EStatusDialling;
       
 11532     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData2(callId1, mobileService1, mobileCallStatus);
       
 11533     completeData.Close();
       
 11534     mockData2.SerialiseL(completeData);   
       
 11535     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11536     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11537  	User::WaitForRequest(mockLtsyStatus); 	
       
 11538  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());    
       
 11539 	    
       
 11540     mobileCallStatus = RMobileCall::EStatusConnecting;
       
 11541     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData3(callId1, mobileService1, mobileCallStatus);
       
 11542     completeData.Close();
       
 11543     mockData3.SerialiseL(completeData);   
       
 11544     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11545     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData); 	
       
 11546  	User::WaitForRequest(mockLtsyStatus);
       
 11547  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());  	 
       
 11548        	   	    
       
 11549     mobileCallStatus = RMobileCall::EStatusConnected;
       
 11550     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData4(callId1, mobileService1, mobileCallStatus);
       
 11551     completeData.Close();
       
 11552     mockData4.SerialiseL(completeData);   
       
 11553     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11554     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11555  	User::WaitForRequest(mockLtsyStatus);
       
 11556  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); 
       
 11557 
       
 11558 	if ( !aLineName.Compare( KMmTsyDataLineName ) )
       
 11559         { 
       
 11560         //Dial request for voice call is completed automatically by CTSY when call goes to connected state
       
 11561         //Complete here data call Dial.
       
 11562       	TMockLtsyCallData0 mockData5(callId1, mobileService1);
       
 11563       	mockData5.SerialiseL(completeData);
       
 11564       	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);         
       
 11565         }
       
 11566          
       
 11567     User::WaitForRequest(requestStatus);   
       
 11568     AssertMockLtsyStatusL();
       
 11569     ASSERT_EQUALS(KErrNone, requestStatus.Int()); 
       
 11570   
       
 11571     //Check that call1 is active
       
 11572     call1.GetMobileCallStatus(mobileCallStatus);
       
 11573     ASSERT_EQUALS(RMobileCall::EStatusConnected, mobileCallStatus);
       
 11574 	AssertMockLtsyStatusL(); 
       
 11575 	
       
 11576 	//-------------------------------------------------------------------------
       
 11577 	
       
 11578 	
       
 11579  	//-------------------------------------------------------------------------
       
 11580 	// Create second incoming voice call.
       
 11581 	
       
 11582 	mobileCallStatus = RMobileCall::EStatusRinging;
       
 11583 	errorCode = CreateIncomingCallL(line2, callId2, callName2,
       
 11584 	                                mobileService2, mobileCallStatus);	
       
 11585 	ASSERT_EQUALS(KErrNone, errorCode);
       
 11586 	AssertMockLtsyStatusL();
       
 11587 		
       
 11588     errorCode = call2.OpenExistingCall(line2, callName2);
       
 11589     ASSERT_EQUALS(KErrNone, errorCode);
       
 11590 	AssertMockLtsyStatusL();
       
 11591 	
       
 11592 	//-------------------------------------------------------------------------	  	
       
 11593     	
       
 11594  	//-------------------------------------------------------------------------
       
 11595 	// TEST A: AnswerIncomingCall for call2 is completed with error KErrMMEtelCallForbidden 
       
 11596 	// because automatic hold for call1 fails.
       
 11597  	//-------------------------------------------------------------------------
       
 11598 	
       
 11599     //There is now one active call and one ringing call. Cellular software sets
       
 11600     //active call1 to hold automatically when ringing call is answered. Normally this operation
       
 11601     //succeeds. In DoCoMo network hold operation fails in this situation if call waiting is
       
 11602     //disabled. 
       
 11603     
       
 11604     //Background: Incoming call indication should not come from network if there is already an active call 
       
 11605     //and call waiting is disabled. However in DoCoMo network incoming call indication comes 
       
 11606     //through but answering to this call fails because hold operation for active call does not work.
       
 11607     
       
 11608     //Expected functionality: In this case CTSY should complete AnswerIncomingCall request with 
       
 11609     //error and active call should stay in active state.	
       
 11610 	
       
 11611     TMockLtsyCallData0 mockData6(callId2, mobileService2);
       
 11612     expectData.Close();
       
 11613     mockData6.SerialiseL(expectData);
       
 11614     iMockLTSY.ExpectL(EEtelCallAnswer, expectData);   
       
 11615        
       
 11616 	RMobileCall::TMobileCallParamsV1 callParamsV1;
       
 11617 	TPckg<RMobileCall::TMobileCallParamsV1> mmParamsPckgV1(callParamsV1);       
       
 11618     call2.AnswerIncomingCall(requestStatus, mmParamsPckgV1);    
       
 11619     
       
 11620     //Incoming call goes to answering state.
       
 11621     mobileCallStatus = RMobileCall::EStatusAnswering;
       
 11622     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData7(callId2, mobileService2, mobileCallStatus);
       
 11623     completeData.Close();
       
 11624     mockData7.SerialiseL(completeData);   
       
 11625     iMockLTSY.NotifyTerminated(mockLtsyStatus);    
       
 11626     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);  
       
 11627     User::WaitForRequest(mockLtsyStatus);    
       
 11628     
       
 11629     //Network rejects hold operation for active call. 
       
 11630     mobileCallStatus = RMobileCall::EStatusConnected;
       
 11631     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData8(callId1, mobileService1, mobileCallStatus);
       
 11632     completeData.Close();
       
 11633     mockData8.SerialiseL(completeData);   
       
 11634     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11635     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrMMEtelCallForbidden, completeData); 
       
 11636     
       
 11637     //AnswerIncomingCall should be completed with error.
       
 11638     User::WaitForRequest(requestStatus);    
       
 11639     User::WaitForRequest(mockLtsyStatus);
       
 11640     ASSERT_EQUALS(KErrMMEtelCallForbidden, requestStatus.Int());	
       
 11641     AssertMockLtsyStatusL();
       
 11642     
       
 11643     //Check that call1 is still in active state.
       
 11644     call1.GetMobileCallStatus(mobileCallStatus);
       
 11645     ASSERT_EQUALS(RMobileCall::EStatusConnected, mobileCallStatus);
       
 11646 	AssertMockLtsyStatusL();
       
 11647 	    
       
 11648  	//-------------------------------------------------------------------------
       
 11649 	// Hangup calls
       
 11650  	
       
 11651 	TInt hangUpCause = KErrGsmReleaseByUser;
       
 11652 	TBool autoStChangeDisable = ETrue;
       
 11653     TMockLtsyCallData2<TInt, TBool> mockData9(callId2, mobileService2, hangUpCause, autoStChangeDisable);	
       
 11654     expectData.Close();
       
 11655     mockData9.SerialiseL(expectData);
       
 11656     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);	
       
 11657 
       
 11658 	call2.HangUp(requestStatus);
       
 11659 
       
 11660     //Change call2 status to disconnecting
       
 11661     mobileCallStatus = RMobileCall::EStatusDisconnecting;
       
 11662     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData10(callId2, mobileService2, mobileCallStatus);
       
 11663     completeData.Close();
       
 11664     mockData10.SerialiseL(completeData);   
       
 11665     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11666     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11667  	User::WaitForRequest(mockLtsyStatus); 	
       
 11668  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); 
       
 11669  	
       
 11670     //Change call2 status to idle
       
 11671     mobileCallStatus = RMobileCall::EStatusIdle;
       
 11672     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData11(callId2, mobileService2, mobileCallStatus);
       
 11673     completeData.Close();
       
 11674     mockData11.SerialiseL(completeData);   
       
 11675     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11676     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11677  	User::WaitForRequest(mockLtsyStatus); 	
       
 11678  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());   	
       
 11679 	
       
 11680 	//HangUp complete for call2    
       
 11681     User::WaitForRequest(requestStatus);   
       
 11682     AssertMockLtsyStatusL();
       
 11683     ASSERT_EQUALS(KErrNone, requestStatus.Int()); 
       
 11684     
       
 11685     // Only the voice line is needing this flag.
       
 11686 	if ( !aLineName.Compare( KMmTsyDataLineName ) )
       
 11687 		{
       
 11688 		autoStChangeDisable = EFalse;
       
 11689 		}
       
 11690 	else
       
 11691 		{
       
 11692 		autoStChangeDisable = ETrue;
       
 11693 		}
       
 11694 	
       
 11695     TMockLtsyCallData2<TInt, TBool> mockData12(callId1, mobileService1, hangUpCause, autoStChangeDisable);	
       
 11696     expectData.Close();
       
 11697     mockData12.SerialiseL(expectData);
       
 11698     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);	
       
 11699 
       
 11700 	call1.HangUp(requestStatus);
       
 11701 
       
 11702     //Change call1 status to disconnecting
       
 11703     mobileCallStatus = RMobileCall::EStatusDisconnecting;
       
 11704     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData13(callId1, mobileService1, mobileCallStatus);
       
 11705     completeData.Close();
       
 11706     mockData13.SerialiseL(completeData);   
       
 11707     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11708     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11709  	User::WaitForRequest(mockLtsyStatus); 	
       
 11710  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); 
       
 11711  	
       
 11712     //Change call1 status to idle
       
 11713     mobileCallStatus = RMobileCall::EStatusIdle;
       
 11714     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData14(callId1, mobileService1, mobileCallStatus);
       
 11715     completeData.Close();
       
 11716     mockData14.SerialiseL(completeData);   
       
 11717     iMockLTSY.NotifyTerminated(mockLtsyStatus);      
       
 11718     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11719     
       
 11720     // when call becomes idle, remaining duration of the call is added to life time param in LTSY:		
       
 11721 	TUint32 duration2 = 4;	// this is a dummy value, which won't be checked by mocksy engine
       
 11722 	TMockLtsyData1<TUint32> ltsyData2( duration2 );
       
 11723 	expectData.Close();
       
 11724 	ltsyData2.SerialiseL(expectData);	
       
 11725 	iMockLTSY.ExpectL(EMmTsyUpdateLifeTimeIPC, expectData);	            
       
 11726     
       
 11727  	User::WaitForRequest(mockLtsyStatus); 	
       
 11728  	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());   	
       
 11729 
       
 11730 	//HangUp complete for call1     
       
 11731     User::WaitForRequest(requestStatus);   
       
 11732     AssertMockLtsyStatusL();
       
 11733     ASSERT_EQUALS(KErrNone, requestStatus.Int());  
       
 11734     
       
 11735     //-------------------------------------------------------------------------   	    
       
 11736 	
       
 11737 	// Done !     
       
 11738 	CleanupStack::PopAndDestroy(8, this); // call2, call1, line2, line1, phone2, 
       
 11739 	                                      // completeData, expectData, this	
       
 11740 	return KErrNone;
       
 11741     }
       
 11742 
       
 11743 /*
       
 11744  * Opens a phone subsession by name.
       
 11745  * 
       
 11746  * @param aPhone The phone from which the line is to be opened.
       
 11747  * @param On return, contains the new line. 
       
 11748  * @param aName The name of the phone to be opened
       
 11749  * @return KErrNone if successful, otherwise another of the system-wide error 
       
 11750  */
       
 11751 
       
 11752 TInt CCTsyCallControlFU::OpenNewLineLC(RMobilePhone& aPhone, RLine& aLine, const TDesC& aLineName)
       
 11753     {
       
 11754     TInt errorCode = KErrNone;
       
 11755 
       
 11756     // Open new line
       
 11757     errorCode = aLine.Open(aPhone, aLineName);
       
 11758     CleanupClosePushL(aLine);
       
 11759     
       
 11760     return errorCode;
       
 11761     }
       
 11762 
       
 11763 /*
       
 11764  * This function creates an incomming call for line and returns a name of call. 
       
 11765  * 
       
 11766  * @param aLine The line from which the call is to be created.
       
 11767  * @param aCallId ID of call.
       
 11768  * @param aIncomingCallName On return, contains the new name of incomming call.
       
 11769  * @param aMobileService Applicability of request to a mobile service group.
       
 11770  * @param aMobileCallStatus Describes the possible call states.
       
 11771  * @return KErrNone if successful, otherwise another of the system-wide error 
       
 11772  */
       
 11773 
       
 11774 TInt CCTsyCallControlFU::CreateIncomingCallL(RLine& aLine, 
       
 11775                                             const TInt aCallId, 
       
 11776                                             TName& aIncomingCallName,
       
 11777                                             RMobilePhone::TMobileService aMobileService,
       
 11778                                             RMobileCall::TMobileCallStatus aMobileCallStatus)
       
 11779 	{
       
 11780     RBuf8 completeData;
       
 11781 
       
 11782     TRequestStatus requestNotify;
       
 11783     TRequestStatus mockLtsyStatus;
       
 11784 
       
 11785  	//-------------------------------------------------------------------------
       
 11786 	// call CMmVoiceLineTsy::CompleteNotifyIncomingCall for set iCallId > 0.
       
 11787 	
       
 11788 	aLine.NotifyIncomingCall(requestNotify, aIncomingCallName);
       
 11789 
       
 11790 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11791 	RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
 11792 	TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> mockCallData1(aCallId, aMobileService, mobileCallInfo);
       
 11793     CleanupClosePushL(completeData);
       
 11794 	mockCallData1.SerialiseL(completeData);
       
 11795 	iMockLTSY.CompleteL(EEtelLineNotifyIncomingCall, KErrNone, completeData);
       
 11796 	User::WaitForRequest(mockLtsyStatus);
       
 11797 	AssertMockLtsyStatusL();
       
 11798 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11799 	
       
 11800 	User::WaitForRequest(requestNotify);
       
 11801 	AssertMockLtsyStatusL();
       
 11802 	ASSERT_EQUALS(KErrNone, requestNotify.Int());
       
 11803 
       
 11804  	//-------------------------------------------------------------------------
       
 11805 	
       
 11806  	//-------------------------------------------------------------------------
       
 11807     // call CMmVoiceCallTsy::CompleteNotifyStatusChange for set 
       
 11808     // iMobileCallStatus = RMobileCall::EStatusRinging.
       
 11809     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(aCallId, aMobileService, aMobileCallStatus);
       
 11810     completeData.Close();
       
 11811     mockCallData2.SerialiseL(completeData);
       
 11812 
       
 11813     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 11814     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 11815     User::WaitForRequest(mockLtsyStatus);
       
 11816     AssertMockLtsyStatusL();
       
 11817     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 11818  	//-------------------------------------------------------------------------
       
 11819 
       
 11820 	AssertMockLtsyStatusL();
       
 11821 	CleanupStack::PopAndDestroy(1); // completeData 
       
 11822 	
       
 11823 	return KErrNone;
       
 11824 	}
       
 11825 
       
 11826 /*
       
 11827  * This function closes an incomming call by aCallId. 
       
 11828  * 
       
 11829  * @param aCall The incomming call which is to be closed.
       
 11830  * @param aCallId ID of call.
       
 11831  * @param aMobileService Applicability of request to a mobile service group.
       
 11832  */
       
 11833 
       
 11834 void CCTsyCallControlFU::CloseIncomingCallL(RCall& aCall, const TInt aCallId,
       
 11835                                            RMobilePhone::TMobileService aMobileService)
       
 11836 	{
       
 11837     RBuf8 expectData;
       
 11838     CleanupClosePushL(expectData);
       
 11839 
       
 11840 	TInt hangUpCause = KErrGsmReleaseByUser;
       
 11841 	TBool autoStChangeDisable = EFalse;
       
 11842     TMockLtsyCallData2<TInt, TBool> mockData2(aCallId, aMobileService, 
       
 11843                                              hangUpCause, 
       
 11844                                              autoStChangeDisable);
       
 11845     expectData.Close();
       
 11846     mockData2.SerialiseL(expectData);
       
 11847     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
 11848     
       
 11849 	aCall.Close();
       
 11850 	AssertMockLtsyStatusL();
       
 11851 
       
 11852     CleanupStack::PopAndDestroy(1); // expectData 
       
 11853 	}
       
 11854 
       
 11855 //  ExpectL and CopmleteL must precede this function.
       
 11856 void CCTsyCallControlFU::CallGetMobileCallInfoL(TInt aCallId, 
       
 11857                                                RMobilePhone::TMobileService aService, 
       
 11858                                                const TDesC &aTelNumber)
       
 11859 	{
       
 11860 	_LIT(KNullDesC , "");
       
 11861 	
       
 11862 	RBuf8 data;
       
 11863 	CleanupClosePushL(data);
       
 11864 
       
 11865 	RMobileCall::TMobileCallInfoV1 callInfo;
       
 11866 	callInfo.iDialledParty.iTelNumber.Copy(aTelNumber);
       
 11867 	callInfo.iService = aService;
       
 11868 	callInfo.iEmergency = EFalse;
       
 11869 	callInfo.iRemoteParty.iCallingName = KNullDesC;
       
 11870 	callInfo.iRemoteParty.iRemoteIdStatus = RMobileCall::ERemoteIdentityUnknown;
       
 11871 	callInfo.iRemoteParty.iRemoteNumber.iTelNumber = KNullDesC;
       
 11872 	callInfo.iRemoteParty.iRemoteNumber.iNumberPlan = RMobilePhone::EUnknownNumberingPlan;
       
 11873 	callInfo.iRemoteParty.iRemoteNumber.iTypeOfNumber = RMobilePhone::EUnknownNumber;
       
 11874 	callInfo.iForwarded = EFalse;
       
 11875 	callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallRemoteParty;
       
 11876 
       
 11877 	TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> callInfoData(aCallId, aService, callInfo);
       
 11878 	callInfoData.SerialiseL(data);
       
 11879 		
       
 11880     iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data);
       
 11881     
       
 11882     CleanupStack::PopAndDestroy(1);
       
 11883 	}
       
 11884 
       
 11885 /**
       
 11886 @SYMTestCaseID BA-CTSY-CCON-CEC-0001
       
 11887 @SYMComponent  telephony_ctsy
       
 11888 @SYMTestCaseDesc Test increase coverage for RLine::EnumerateCall for voice
       
 11889 @SYMTestPriority High
       
 11890 @SYMTestActions Invokes RLine::EnumerateCall for voice
       
 11891 @SYMTestExpectedResults Pass
       
 11892 @SYMTestType CT
       
 11893 */
       
 11894 void CCTsyCallControlFU::TestEnumerateCall0001L()
       
 11895 	{
       
 11896 	AuxEnumerateCallL(KMmTsyVoice1LineName);
       
 11897 	}
       
 11898 
       
 11899 /**
       
 11900 @SYMTestCaseID BA-CTSY-CCON-CEC-0006
       
 11901 @SYMComponent  telephony_ctsy
       
 11902 @SYMTestCaseDesc Test increase coverage for RLine::EnumerateCall for data
       
 11903 @SYMTestPriority High
       
 11904 @SYMTestActions Invokes RLine::EnumerateCall for data
       
 11905 @SYMTestExpectedResults Pass
       
 11906 @SYMTestType CT
       
 11907 */
       
 11908 void CCTsyCallControlFU::TestEnumerateCall0006L()
       
 11909 	{
       
 11910 	AuxEnumerateCallL(KMmTsyDataLineName);
       
 11911 	}
       
 11912 
       
 11913 /**
       
 11914 @SYMTestCaseID BA-CTSY-CCON-CEC-00011
       
 11915 @SYMComponent  telephony_ctsy
       
 11916 @SYMTestCaseDesc Test increase coverage for RLine::EnumerateCall for fax
       
 11917 @SYMTestPriority High
       
 11918 @SYMTestActions Invokes RLine::EnumerateCall for fax
       
 11919 @SYMTestExpectedResults Pass
       
 11920 @SYMTestType CT
       
 11921 */
       
 11922 void CCTsyCallControlFU::TestEnumerateCall00011L()
       
 11923 	{
       
 11924 	AuxEnumerateCallL(KMmTsyFaxLineName);
       
 11925 	}
       
 11926 
       
 11927 /**
       
 11928 @SYMTestCaseID BA-CTSY-CCON-CNHC-0001
       
 11929 @SYMComponent  telephony_ctsy
       
 11930 @SYMTestCaseDesc Test increase coverage for RLine::NotifyHookChange for voice
       
 11931 @SYMTestPriority High
       
 11932 @SYMTestActions Invokes RLine::NotifyHookChange for voice
       
 11933 @SYMTestExpectedResults Pass
       
 11934 @SYMTestType CT
       
 11935 */
       
 11936 void CCTsyCallControlFU::TestNotifyHookChange0001L()
       
 11937 	{
       
 11938 	AuxNotifyHookChangeL(KMmTsyVoice1LineName);
       
 11939 	}
       
 11940 
       
 11941 /**
       
 11942 @SYMTestCaseID BA-CTSY-CCON-CNHC-0006
       
 11943 @SYMComponent  telephony_ctsy
       
 11944 @SYMTestCaseDesc Test increase coverage for RLine::NotifyHookChange for data
       
 11945 @SYMTestPriority High
       
 11946 @SYMTestActions Invokes RLine::NotifyHookChange for data
       
 11947 @SYMTestExpectedResults Pass
       
 11948 @SYMTestType CT
       
 11949 */
       
 11950 void CCTsyCallControlFU::TestNotifyHookChange0006L()
       
 11951 	{
       
 11952 	AuxNotifyHookChangeL(KMmTsyDataLineName);
       
 11953 	}
       
 11954 
       
 11955 /**
       
 11956 @SYMTestCaseID BA-CTSY-CCON-CNHC-00011
       
 11957 @SYMComponent  telephony_ctsy
       
 11958 @SYMTestCaseDesc Test increase coverage for RLine::NotifyHookChange for fax
       
 11959 @SYMTestPriority High
       
 11960 @SYMTestActions Invokes RLine::NotifyHookChange for fax
       
 11961 @SYMTestExpectedResults Pass
       
 11962 @SYMTestType CT
       
 11963 */
       
 11964 void CCTsyCallControlFU::TestNotifyHookChange00011L()
       
 11965 	{
       
 11966 	AuxNotifyHookChangeL(KMmTsyFaxLineName);
       
 11967 	}
       
 11968 
       
 11969 /**
       
 11970 @SYMTestCaseID BA-CTSY-CCON-CCNSC-0001
       
 11971 @SYMComponent  telephony_ctsy
       
 11972 @SYMTestCaseDesc Test increase coverage for CMmLineTsy::CompleteNotifyStatusChange for voice
       
 11973 @SYMTestPriority High
       
 11974 @SYMTestActions Invokes CMmLineTsy::CompleteNotifyStatusChange for voice
       
 11975 @SYMTestExpectedResults Pass
       
 11976 @SYMTestType CT
       
 11977 */
       
 11978 void CCTsyCallControlFU::TestCompleteNotifyStatusChange0001L()
       
 11979 	{
       
 11980 	AuxCompleteNotifyStatusChangeL(KMmTsyVoice1LineName);
       
 11981 	}
       
 11982 
       
 11983 void CCTsyCallControlFU::AuxEnumerateCallL(const TDesC& aName)
       
 11984 	{
       
 11985 
       
 11986 	if (aName.Compare(KMmTsyVoice1LineName) != 0 && 
       
 11987 		aName.Compare(KMmTsyDataLineName)   != 0 &&
       
 11988 		aName.Compare(KMmTsyFaxLineName)    != 0)
       
 11989 		return;
       
 11990 
       
 11991 	OpenEtelServerL(EUseExtendedError);
       
 11992 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 11993 	OpenPhoneL();
       
 11994 
       
 11995 	RMobileLine line;
       
 11996 
       
 11997 	// open new line for KMmTsyDataLineName
       
 11998 	TInt errorCode = OpenNewLineLC(iPhone, line, aName);
       
 11999 	ASSERT_EQUALS(KErrNone, errorCode);
       
 12000 
       
 12001 	TInt index(0);
       
 12002 
       
 12003  	//-------------------------------------------------------------------------
       
 12004 	// TEST C: Successful completion request of
       
 12005 	// RLine::EnumerateCall when result is not cached.
       
 12006  	//-------------------------------------------------------------------------
       
 12007 
       
 12008 	errorCode = line.EnumerateCall(index);
       
 12009 	ASSERT_EQUALS(KErrNone, errorCode);
       
 12010 
       
 12011 	CleanupStack::PopAndDestroy(2, this); // line, this
       
 12012 	}
       
 12013 
       
 12014 void CCTsyCallControlFU::AuxNotifyHookChangeL(const TDesC& aName)
       
 12015 	{
       
 12016 
       
 12017 	if (aName.Compare(KMmTsyVoice1LineName) != 0 && 
       
 12018 		aName.Compare(KMmTsyDataLineName)   != 0 &&
       
 12019 		aName.Compare(KMmTsyFaxLineName)    != 0)
       
 12020 		return;
       
 12021 
       
 12022 	OpenEtelServerL(EUseExtendedError);
       
 12023 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 12024 	OpenPhoneL();
       
 12025 
       
 12026 	RMobileLine line;
       
 12027 
       
 12028 	TRequestStatus requestStatus;
       
 12029 	TRequestStatus mockLtsyStatus;
       
 12030 
       
 12031 	RCall::THookStatus hookStatus;
       
 12032 
       
 12033 	TInt errorCode = OpenNewLineLC(iPhone, line, aName);
       
 12034 	ASSERT_EQUALS(KErrNone, errorCode);
       
 12035 
       
 12036 	line.NotifyHookChange(requestStatus, hookStatus);
       
 12037 
       
 12038 	User::WaitForRequest(requestStatus);
       
 12039 	AssertMockLtsyStatusL();
       
 12040 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
 12041 
       
 12042 	line.NotifyHookChangeCancel();
       
 12043 
       
 12044 	CleanupStack::PopAndDestroy(2, this); // line, this
       
 12045 	}
       
 12046 
       
 12047 void CCTsyCallControlFU::AuxCompleteNotifyStatusChangeL(const TDesC& aName)
       
 12048 	{
       
 12049 
       
 12050 	RMobilePhone::TMobileService mobileService = RMobilePhone::EServiceUnspecified;
       
 12051 
       
 12052 	if (aName.Compare(KMmTsyVoice1LineName) == 0)
       
 12053 		{
       
 12054 		mobileService = RMobilePhone::EVoiceService;
       
 12055 		}
       
 12056 	else if (aName.Compare(KMmTsyDataLineName) == 0)
       
 12057 		{
       
 12058 		mobileService = RMobilePhone::ECircuitDataService;
       
 12059 		}
       
 12060 	else if (aName.Compare(KMmTsyFaxLineName) == 0)
       
 12061 		{
       
 12062 		mobileService = RMobilePhone::EFaxService;
       
 12063 		}
       
 12064 	else
       
 12065 		return;
       
 12066 
       
 12067 	OpenEtelServerL(EUseExtendedError);
       
 12068 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 12069 	OpenPhoneL();
       
 12070 
       
 12071 	RMobileLine line;
       
 12072 	RCall call;
       
 12073 	RMobileCall::TMobileCallStatus mobileCallStatus(RMobileCall::EStatusUnknown);
       
 12074 	TName callName;
       
 12075 	TInt callId(1);
       
 12076 	RBuf8 completeData;
       
 12077 	CleanupClosePushL(completeData);
       
 12078 
       
 12079 	TRequestStatus mockLtsyStatus;
       
 12080 	TRequestStatus requestNotify;
       
 12081 
       
 12082 	TInt errorCode = OpenNewLineLC(iPhone, line, aName);
       
 12083 	ASSERT_EQUALS(KErrNone, errorCode);
       
 12084 
       
 12085 	//-------------------------------------------------------------------------
       
 12086 
       
 12087 	line.NotifyIncomingCall(requestNotify, callName);
       
 12088 	
       
 12089 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12090 	RMobileCall::TMobileCallInfoV1 mobileCallInfo;
       
 12091 	TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> mockCallData1(callId, mobileService, mobileCallInfo);
       
 12092 	mockCallData1.SerialiseL(completeData);
       
 12093 	iMockLTSY.CompleteL(EEtelLineNotifyIncomingCall, KErrNone, completeData);
       
 12094 	User::WaitForRequest(mockLtsyStatus);
       
 12095 	AssertMockLtsyStatusL();
       
 12096 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 12097 
       
 12098 	User::WaitForRequest(requestNotify);
       
 12099 	AssertMockLtsyStatusL();
       
 12100 	ASSERT_EQUALS(KErrNone, requestNotify.Int());
       
 12101 
       
 12102 	RArray<RMobileCall::TMobileCallStatus> arrayCallStatus;
       
 12103 	CleanupClosePushL(arrayCallStatus);
       
 12104 	
       
 12105 	arrayCallStatus.AppendL(RMobileCall::EStatusDialling);
       
 12106 	arrayCallStatus.AppendL(RMobileCall::EStatusAnswering);
       
 12107 	arrayCallStatus.AppendL(RMobileCall::EStatusConnecting);
       
 12108 	
       
 12109 	for (TInt i = 0; i < arrayCallStatus.Count(); i++)
       
 12110 		{
       
 12111 		
       
 12112 		mobileCallStatus = arrayCallStatus[i];
       
 12113 		
       
 12114 		TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(callId, mobileService, mobileCallStatus);
       
 12115 		completeData.Close();
       
 12116 		mockCallData2.SerialiseL(completeData);
       
 12117 
       
 12118 		iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12119 		iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 12120 		User::WaitForRequest(mockLtsyStatus);
       
 12121 		AssertMockLtsyStatusL();
       
 12122 		ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 12123 		
       
 12124 		}
       
 12125 
       
 12126 	CleanupStack::PopAndDestroy(4, this); // line, this, completeName
       
 12127 										  // arrayCallStatus
       
 12128 	}
       
 12129 
       
 12130 /**
       
 12131 @SYMTestCaseID BA-CTSY-CCON-CNUA-0001
       
 12132 @SYMComponent  telephony_ctsy
       
 12133 @SYMTestCaseDesc Test: generating a call with duration to update life time param of total call time
       
 12134 @SYMTestPriority High
       
 12135 @SYMTestActions Invokes updating life time param with every specified interval of sec elapsed 
       
 12136                 and with the reminder of time when call status becomes idle (in case of the conference call
       
 12137                 it's the last call)
       
 12138 @SYMTestExpectedResults Pass
       
 12139 @SYMTestType CT
       
 12140 */
       
 12141 void CCTsyCallControlFU::TestUpdateLifeTime0001L()
       
 12142 	{
       
 12143 
       
 12144 	OpenEtelServerL(EUseExtendedError);
       
 12145 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
 12146 	OpenPhoneL();
       
 12147 
       
 12148     RBuf8 expectData;
       
 12149     CleanupClosePushL(expectData);
       
 12150 
       
 12151     RBuf8 completeData;
       
 12152     CleanupClosePushL(completeData);
       
 12153 
       
 12154 	RLine line;
       
 12155 	RMobileCall call;
       
 12156 	
       
 12157 	TInt errorCode = KErrNone;
       
 12158     TRequestStatus requestStatus;
       
 12159     TRequestStatus requestStatus2;
       
 12160 	TRequestStatus mockLtsyStatus;
       
 12161 	
       
 12162 	// open new line and call for KMmTsyVoice1LineName
       
 12163 	errorCode = OpenNewLineLC(iPhone, line, KMmTsyVoice1LineName);
       
 12164 	ASSERT_EQUALS(KErrNone, errorCode);
       
 12165 		
       
 12166     TName name;
       
 12167     
       
 12168     // we are preparing to dial the call:
       
 12169 	
       
 12170 	_LIT(KPhoneNumber, "101632960000");   	
       
 12171    	
       
 12172 	TInt callId = 1;
       
 12173     RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
 12174 			
       
 12175     RMobileCall::TMobileCallParamsV7 callParams; 
       
 12176     RMobileCall::TMobileCallParamsV7Pckg    pckgCallParams(callParams);
       
 12177     RMobileCall::TMobileCallInfoV8 callInfo;   
       
 12178     callParams.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
 12179     callParams.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
 12180     callParams.iInterval        = 100;
       
 12181     callParams.iWaitForDialTone = RCall::EDialToneWait;
       
 12182     callParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
 12183     callParams.iCug.iExplicitInvoke = EFalse;
       
 12184     callParams.iCug.iCugIndex = 0xFFFF;
       
 12185     callParams.iCug.iSuppressPrefCug = EFalse;
       
 12186     callParams.iCug.iSuppressOA = EFalse;
       
 12187     callParams.iAutoRedial = EFalse;
       
 12188 
       
 12189     callInfo.iValid = RMobileCall::KCallDialledParty | RMobileCall::KCallAlternating;    
       
 12190     callInfo.iService   = mobileService;
       
 12191     callInfo.iStatus    = RMobileCall::EStatusUnknown;
       
 12192     callInfo.iCallId    =-1;
       
 12193     callInfo.iExitCode  =0; 
       
 12194     callInfo.iEmergency =0;
       
 12195     callInfo.iForwarded =0; 
       
 12196     callInfo.iPrivacy               = RMobilePhone::EPrivacyUnspecified;
       
 12197     callInfo.iAlternatingCall       = RMobilePhone::EAlternatingModeUnspecified;  
       
 12198     callInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
 12199 
       
 12200 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
 12201 		mockData2(0, mobileService, callParams, callInfo);
       
 12202 
       
 12203 	TMockLtsyCallData0 mockData0(callId, mobileService);
       
 12204 
       
 12205 	RCall::TCallParams callDialParams;
       
 12206 	TPckg<RCall::TCallParams> pckgCallDialParams(callDialParams);
       
 12207 	callDialParams.iSpeakerControl  = RCall::EMonitorSpeakerControlOnUntilCarrier;
       
 12208 	callDialParams.iSpeakerVolume   = RCall::EMonitorSpeakerVolumeLow;
       
 12209 	callDialParams.iInterval        = 100;
       
 12210 	callDialParams.iWaitForDialTone = RCall::EDialToneWait;
       
 12211 
       
 12212 	// open new call
       
 12213    	CleanupClosePushL(call);
       
 12214    	errorCode = call.OpenNewCall(line, name);
       
 12215     ASSERT_EQUALS(KErrNone, errorCode);
       
 12216 	
       
 12217 	expectData.Close();
       
 12218 	mockData2.SerialiseL(expectData);
       
 12219 	iMockLTSY.ExpectL(EEtelCallDial, expectData);
       
 12220 
       
 12221 	CallGetMobileCallInfoL(callId, mobileService, KPhoneNumber);
       
 12222 	
       
 12223 	completeData.Close();
       
 12224 	mockData0.SerialiseL(completeData);
       
 12225 	iMockLTSY.CompleteL(EEtelCallDial, KErrNone, completeData);
       
 12226 
       
 12227     // with a notifications we make sure the state of the call will become: connected  
       
 12228 	TRequestStatus reqState1, reqState2, reqState3;
       
 12229 	RMobileCall::TMobileCallStatus status;  
       
 12230     call.NotifyMobileCallStatusChange(reqState1, status);
       
 12231     
       
 12232     // we are dialing the call:
       
 12233 	call.Dial(requestStatus, pckgCallDialParams, KPhoneNumber);
       
 12234 		
       
 12235     RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusDialling;
       
 12236     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData4(callId, mobileService, mobileCallStatus);
       
 12237     completeData.Close();
       
 12238     mockCallData4.SerialiseL(completeData);
       
 12239 
       
 12240 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12241 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 12242 	User::WaitForRequest(mockLtsyStatus);
       
 12243     AssertMockLtsyStatusL();
       
 12244     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 12245 				
       
 12246     User::WaitForRequest(reqState1);            
       
 12247     call.NotifyMobileCallStatusChange(reqState2, status);
       
 12248     
       
 12249     mobileCallStatus = RMobileCall::EStatusConnecting;
       
 12250     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData5(callId, mobileService, mobileCallStatus);
       
 12251     completeData.Close();
       
 12252     mockCallData5.SerialiseL(completeData);
       
 12253 
       
 12254 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12255 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 12256 	User::WaitForRequest(mockLtsyStatus);
       
 12257     AssertMockLtsyStatusL();
       
 12258     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 12259                  
       
 12260     User::WaitForRequest(reqState2);
       
 12261     call.NotifyMobileCallStatusChange(reqState3, status);
       
 12262     
       
 12263     mobileCallStatus = RMobileCall::EStatusConnected;
       
 12264     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData6(callId, mobileService, mobileCallStatus);
       
 12265     completeData.Close();
       
 12266     mockCallData6.SerialiseL(completeData);
       
 12267 
       
 12268 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12269 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 12270 	User::WaitForRequest(mockLtsyStatus);
       
 12271     AssertMockLtsyStatusL();
       
 12272     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
 12273     
       
 12274     // status call becomes 'connected' here...   
       
 12275             
       
 12276     User::WaitForRequest(reqState3);    
       
 12277 	
       
 12278 	// completion of the Dial() request:
       
 12279 	User::WaitForRequest(requestStatus);
       
 12280 
       
 12281     // Here we will trigger call duration of 15sec. Timer interval causing update
       
 12282     // of life time parameter is set to 10 sec: so we will have a one update caused
       
 12283     // by firing timer. The remainding duration ~5sec will be triggered by
       
 12284     // the call status becoming idle.
       
 12285 	TUint32 duration = 10;	
       
 12286 	TMockLtsyData1<TUint32> ltsyData( duration );
       
 12287 	expectData.Close();
       
 12288 	ltsyData.SerialiseL(expectData);
       
 12289 	// firing timer will cause this:	
       
 12290 	iMockLTSY.ExpectL(EMmTsyUpdateLifeTimeIPC, expectData);
       
 12291 	
       
 12292 	// 15 sec call duration was chosen to trigger timer firing 1 update plus last update,
       
 12293 	// when call becomes idle...	
       
 12294 	User::After(15000000);
       
 12295 
       
 12296     // completion of the timer firing event:	
       
 12297 	TRequestStatus mockLtsyStatus2;
       
 12298 	iMockLTSY.NotifyTerminated(mockLtsyStatus2);
       
 12299 	iMockLTSY.CompleteL(EMmTsyUpdateLifeTimeIPC, KErrNone);	
       
 12300 	
       
 12301 	User::WaitForRequest(mockLtsyStatus2);
       
 12302 	ASSERT_EQUALS(KErrNone, mockLtsyStatus2.Int());
       
 12303     AssertMockLtsyStatusL();
       
 12304 			
       
 12305 	//
       
 12306 	
       
 12307 	// preparing call state to become 'idle' eventually:
       
 12308 	TRequestStatus notifyCallStatus;
       
 12309 	RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusUnknown;
       
 12310 	call.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
 12311 
       
 12312     // hangup call is going to LTSY:
       
 12313 	TInt hangUpCause = KErrGsmReleaseByUser;
       
 12314 	TBool autoStChangeDisable = ETrue;
       
 12315     TMockLtsyCallData2<TInt, TBool> mockData3(callId, mobileService, 
       
 12316                                              hangUpCause, 
       
 12317                                              autoStChangeDisable);
       
 12318     expectData.Close();                                             
       
 12319     mockData3.SerialiseL(expectData);
       
 12320     iMockLTSY.ExpectL(EEtelCallHangUp, expectData);
       
 12321                                                      
       
 12322 	TRequestStatus hangupStatus;
       
 12323 	call.HangUp(hangupStatus);  //<--------- hang up triggers status changes
       
 12324 			
       
 12325     callStatus = RMobileCall::EStatusDisconnecting;
       
 12326     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData7(callId, mobileService, callStatus);
       
 12327     completeData.Close();
       
 12328     mockCallData7.SerialiseL(completeData);
       
 12329     
       
 12330 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12331 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 12332 	User::WaitForRequest(mockLtsyStatus);
       
 12333     AssertMockLtsyStatusL();
       
 12334     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());        	
       
 12335 	
       
 12336 	User::WaitForRequest(notifyCallStatus);	
       
 12337 	ASSERT_EQUALS(KErrNone, notifyCallStatus.Int());
       
 12338 	ASSERT_EQUALS(RMobileCall::EStatusDisconnecting, callStatus); // <------------disconnecting status
       
 12339 	
       
 12340 	call.NotifyMobileCallStatusChange(notifyCallStatus, callStatus);
       
 12341 	
       
 12342     callStatus = RMobileCall::EStatusIdle;
       
 12343     TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData8(callId, mobileService, callStatus);
       
 12344     completeData.Close();
       
 12345     mockCallData8.SerialiseL(completeData);
       
 12346         
       
 12347 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
 12348 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, completeData);
       
 12349 
       
 12350     // when call becomes idle, remaining duration of the call is added to life time param in LTSY:		
       
 12351 	TUint32 duration2 = 4;	// this is a dummy value, which won't be checked by mocksy engine
       
 12352 	TMockLtsyData1<TUint32> ltsyData2( duration2 );
       
 12353 	expectData.Close();
       
 12354 	ltsyData2.SerialiseL(expectData);	
       
 12355 	iMockLTSY.ExpectL(EMmTsyUpdateLifeTimeIPC, expectData);	    
       
 12356 					
       
 12357 	User::WaitForRequest(mockLtsyStatus);
       
 12358 	// we did set a sleep time for 15sec, but after stopping timer it may give us 14 sec or 15 sec
       
 12359 	// we can not determine the correct value for the mockLTSY;
       
 12360 	// we tell mocksy engine to ignore duration param value	
       
 12361     AssertMockLtsyStatusL();
       
 12362     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());        	
       
 12363     	
       
 12364 	User::WaitForRequest(notifyCallStatus);
       
 12365 	ASSERT_EQUALS(KErrNone, notifyCallStatus.Int());
       
 12366 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus); // <-------- idle status
       
 12367 			
       
 12368 	User::WaitForRequest(hangupStatus);
       
 12369 	ASSERT_EQUALS(KErrNone, hangupStatus.Int()); // <--- then hang up is finished
       
 12370 	
       
 12371 	call.GetMobileCallStatus(callStatus);
       
 12372 	ASSERT_EQUALS(RMobileCall::EStatusIdle, callStatus);
       
 12373 	
       
 12374 	//
       
 12375 				
       
 12376 	TRequestStatus mockLtsyStatus3;
       
 12377 	iMockLTSY.NotifyTerminated(mockLtsyStatus3);
       
 12378 	iMockLTSY.CompleteL(EMmTsyUpdateLifeTimeIPC, KErrNone);	
       
 12379 	
       
 12380 	User::WaitForRequest(mockLtsyStatus3);
       
 12381 	ASSERT_EQUALS(KErrNone, mockLtsyStatus3.Int());
       
 12382 	
       
 12383 	call.Close();	
       
 12384 			
       
 12385     AssertMockLtsyStatusL();
       
 12386 	CleanupStack::PopAndDestroy(1);
       
 12387 	CleanupStack::PopAndDestroy(4, this);
       
 12388 	}
       
 12389 
       
 12390 
       
 12391