telephonyserverplugins/common_tsy/test/component/src/cctsycallownershipfu.cpp
changeset 0 3553901f7fa8
child 8 3f227a47ad75
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 CallOwnership in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsycallownershipfu.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include "tmockltsydata.h"
       
    28 #include <ctsy/serviceapi/gsmerror.h>
       
    29 
       
    30 CTestSuite* CCTsyCallOwnershipFU::CreateSuiteL(const TDesC& aName)
       
    31 	{
       
    32 	SUB_SUITE;
       
    33 
       
    34 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestLoanDataPort0001L);
       
    35 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestLoanDataPort0006L);
       
    36 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestLoanDataPort0007L);
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestLoanDataPort0008L);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestLoanDataPort00011L);
       
    39 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestRecoverDataPort0001L);
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestRecoverDataPort0006L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestRecoverDataPort00011L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestAcquireOwnership0001L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestAcquireOwnership0006L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestAcquireOwnership0007L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestAcquireOwnership0009L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestAcquireOwnership00011L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestTransferOwnership0001L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestTransferOwnership0006L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyCallOwnershipFU, TestTransferOwnership00011L);
       
    50 
       
    51 	END_SUITE;
       
    52 	}
       
    53 
       
    54 
       
    55 /**
       
    56 Test support failure in CTSY for RCall::LoanDataPort
       
    57 @param aName The name of the line from which the call is to be opened to test for RCall::LoanDataPort
       
    58 @param aCallId callId ltsy must allocate for the call
       
    59 */
       
    60 void CCTsyCallOwnershipFU::TestLoanDataPortNotSupportedL(const TDesC &aName, const TInt aCallId)
       
    61 	{
       
    62 
       
    63 	RCall call;
       
    64 	RLine line;
       
    65 
       
    66 	TInt err = line.Open(iPhone, aName);
       
    67 	ASSERT_EQUALS(KErrNone, err)
       
    68 	CleanupClosePushL(line);
       
    69 	
       
    70 	err = OpenNewCall(line, call, aName);
       
    71 	ASSERT_EQUALS(KErrNone, err)
       
    72 	CleanupClosePushL(call);
       
    73 
       
    74 	RMobilePhone::TMobileService mobileService( RMobilePhone::EServiceUnspecified );
       
    75 	if ( aName == KMmTsyVoice1LineName )
       
    76 		{
       
    77 		mobileService = RMobilePhone::EVoiceService;
       
    78 		}
       
    79 	else if ( aName == KMmTsyVoice2LineName )
       
    80 		{
       
    81 		mobileService = RMobilePhone::EAuxVoiceService;
       
    82 		}
       
    83 	else if ( aName == KMmTsyFaxLineName )
       
    84 		{
       
    85 		mobileService = RMobilePhone::EFaxService;
       
    86 		}
       
    87 	if ( (mobileService == RMobilePhone::EVoiceService) ||
       
    88 			(mobileService == RMobilePhone::EAuxVoiceService) )
       
    89 		{
       
    90 		DialL(call, aCallId, mobileService);
       
    91 		}
       
    92 
       
    93 	// synchronous version testing
       
    94 	RCall::TCommPort dataPort;
       
    95 	dataPort.iCsy.Copy(_L("qwerty"));
       
    96 	dataPort.iPort.Copy(_L("asdfgh"));
       
    97 	err = call.LoanDataPort(dataPort);
       
    98 	ASSERT_EQUALS(KErrNotSupported, err)
       
    99 	AssertMockLtsyStatusL();
       
   100 	
       
   101 	// asynchronous version testing
       
   102 	TRequestStatus reqStatus;
       
   103 	call.LoanDataPort(reqStatus, dataPort);
       
   104 	User::WaitForRequest(reqStatus);
       
   105 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   106 
       
   107 	CleanupStack::PopAndDestroy(2); //call, line
       
   108 	AssertMockLtsyStatusL();
       
   109 	
       
   110 	}
       
   111 
       
   112 
       
   113 /**
       
   114 Test support failure in CTSY for RCall::RecoverDataPort
       
   115 @param aName The name of the line from which the call is to be opened to test for RCall::RecoverDataPort
       
   116 */
       
   117 void CCTsyCallOwnershipFU::TestRecoverDataPortNotSupportedL(const TDesC &aName)
       
   118 	{
       
   119 	RCall call;
       
   120 	RLine line;
       
   121 
       
   122 	TInt err = line.Open(iPhone, aName);
       
   123 	ASSERT_EQUALS(KErrNone, err)
       
   124 	CleanupClosePushL(line);
       
   125 	
       
   126 	err = OpenNewCall(line, call, aName);
       
   127 	ASSERT_EQUALS(KErrNone, err)
       
   128 	CleanupClosePushL(call);
       
   129 
       
   130 	err = call.RecoverDataPort();
       
   131 	ASSERT_EQUALS(KErrNotSupported, err)
       
   132 	
       
   133 	CleanupStack::PopAndDestroy(2); // call, line
       
   134 	AssertMockLtsyStatusL();
       
   135 	
       
   136 	}
       
   137 
       
   138 
       
   139 /**
       
   140 Test support failure in CTSY for RCall::AcquireOwnership
       
   141 @param aName The name of the line from which the call is to be opened to test for RCall::AcquireOwnership
       
   142 */
       
   143 void CCTsyCallOwnershipFU::TestAcquireOwnershipNotSupportedL(const TDesC &aName)
       
   144 	{
       
   145 	RCall call;
       
   146 	RLine line;
       
   147 
       
   148 	TInt err = line.Open(iPhone, aName);
       
   149 	ASSERT_EQUALS(KErrNone, err)
       
   150 	CleanupClosePushL(line);
       
   151 	
       
   152 	err = OpenNewCall(line, call, aName);
       
   153 	ASSERT_EQUALS(KErrNone, err)
       
   154 	CleanupClosePushL(call);
       
   155 
       
   156 	TRequestStatus reqStatus;
       
   157 	call.AcquireOwnership(reqStatus);
       
   158 	User::WaitForRequest(reqStatus);
       
   159 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   160 	
       
   161 	CleanupStack::PopAndDestroy(2); // call, line
       
   162 	AssertMockLtsyStatusL();
       
   163 	
       
   164 	}
       
   165 
       
   166 
       
   167 /**
       
   168 Test support failure in CTSY for RCall::TransferOwnership
       
   169 @param aName The name of the line from which the call is to be opened to test for RCall::TransferOwnership
       
   170 */
       
   171 void CCTsyCallOwnershipFU::TestTransferOwnershipNotSupportedL(const TDesC &aName)
       
   172 	{
       
   173 	RCall call;
       
   174 	RLine line;
       
   175 
       
   176 	TInt err = line.Open(iPhone, aName);
       
   177 	ASSERT_EQUALS(KErrNone, err)
       
   178 	CleanupClosePushL(line);
       
   179 	
       
   180 	err = OpenNewCall(line, call, aName);
       
   181 	ASSERT_EQUALS(KErrNone, err)
       
   182 	CleanupClosePushL(call);
       
   183 
       
   184 	err = call.TransferOwnership();
       
   185 	ASSERT_EQUALS(KErrNotSupported, err)
       
   186 	
       
   187 	CleanupStack::PopAndDestroy(2); // call, line
       
   188 	AssertMockLtsyStatusL();
       
   189 	
       
   190 	}
       
   191 
       
   192 
       
   193 //
       
   194 // Actual test cases
       
   195 //
       
   196 
       
   197 
       
   198 /**
       
   199 @SYMTestCaseID BA-CTSY-COWN-CLDP-0001
       
   200 @SYMComponent  telephony_ctsy
       
   201 @SYMTestCaseDesc Test support in CTSY for RCall::LoanDataPort for voice calls
       
   202 @SYMTestPriority High
       
   203 @SYMTestActions Invokes RCall::LoanDataPort for voice calls
       
   204 @SYMTestExpectedResults Pass
       
   205 @SYMTestType CT
       
   206 */
       
   207 void CCTsyCallOwnershipFU::TestLoanDataPort0001L()
       
   208 	{
       
   209 
       
   210 	OpenEtelServerL(EUseExtendedError);
       
   211 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   212 	OpenPhoneL();
       
   213 
       
   214 	TestLoanDataPortNotSupportedL(KMmTsyVoice1LineName, 1);
       
   215 
       
   216 	TestLoanDataPortNotSupportedL(KMmTsyVoice2LineName, 2);
       
   217 
       
   218 	CleanupStack::PopAndDestroy(this);
       
   219 	
       
   220 	}
       
   221 
       
   222 
       
   223 /**
       
   224 @SYMTestCaseID BA-CTSY-COWN-CLDP-0006
       
   225 @SYMComponent  telephony_ctsy
       
   226 @SYMTestCaseDesc Test support in CTSY for RCall::LoanDataPort for data calls
       
   227 @SYMTestPriority High
       
   228 @SYMTestActions Invokes RCall::LoanDataPort for data calls
       
   229 @SYMTestExpectedResults Pass
       
   230 @SYMTestType CT
       
   231 */
       
   232 void CCTsyCallOwnershipFU::TestLoanDataPort0006L()
       
   233 	{
       
   234 
       
   235 	OpenEtelServerL(EUseExtendedError);
       
   236 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   237 	OpenPhoneL();
       
   238 
       
   239 	RBuf8 data;
       
   240 	CleanupClosePushL(data);
       
   241 
       
   242 	RCall call;
       
   243 	RLine line;
       
   244 
       
   245 	TInt err = line.Open(iPhone, KMmTsyDataLineName);
       
   246 	ASSERT_EQUALS(KErrNone, err)
       
   247 	CleanupClosePushL(line);
       
   248 	
       
   249 	TName callName;
       
   250 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
   251 	ASSERT_EQUALS(KErrNone, err)
       
   252 	CleanupClosePushL(call);
       
   253 
       
   254 	// Prepare data
       
   255 	TInt callId = 0;
       
   256 	RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
   257 
       
   258 	RCall::TCommPort expDataPort;
       
   259 	expDataPort.iCsy.Copy(_L("qwerty"));
       
   260 	expDataPort.iPort.Copy(_L("asdfgh"));
       
   261 	TMockLtsyCallData1<RCall::TCommPort> expData1(callId, mobileService, expDataPort);
       
   262 	
       
   263 	callId = 1;
       
   264 	TMockLtsyCallData1<RCall::TCommPort> expData2(callId, mobileService, expDataPort);	
       
   265 
       
   266 	RCall::TCommPort dataPort;
       
   267 	dataPort.iCsy.Copy(expDataPort.iCsy);
       
   268 	dataPort.iPort.Copy(expDataPort.iPort);
       
   269 
       
   270 	TRequestStatus reqStatus;
       
   271 
       
   272 	//-------------------------------------------------------------------------
       
   273 	// Test: failure to dispatch request to CTSY when call is not active
       
   274 	//-------------------------------------------------------------------------
       
   275 	
       
   276     // Basically succeeding of LoanDataPort() request depends from LTSY.
       
   277     // Probably LTSY returns error to LoanDataPort() request when data call is
       
   278     // not active. But in theory also KErrNone is possible.  
       
   279         
       
   280 	// Synchronous version testing. LTSY returns KErrNone.
       
   281 	expData1.SerialiseL(data); 
       
   282 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data, KErrNone);
       
   283 	err = call.LoanDataPort(dataPort);
       
   284 	ASSERT_EQUALS(KErrNone, err)
       
   285 	AssertMockLtsyStatusL(); 
       
   286 
       
   287 	// Asynchronous version testing. Fails because data port is already loaned.
       
   288 	call.LoanDataPort(reqStatus, dataPort);
       
   289 	User::WaitForRequest(reqStatus);
       
   290 	ASSERT_EQUALS(KErrEtelPortAlreadyLoaned, reqStatus.Int())
       
   291 	AssertMockLtsyStatusL();
       
   292 	
       
   293 	// Recover data port before next test phase.
       
   294 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data, KErrNone);
       
   295 	err = call.RecoverDataPort();
       
   296 	ASSERT_EQUALS(KErrNone, err)
       
   297 	AssertMockLtsyStatusL();       
       
   298     
       
   299 	// Synchronous version testing. LTSY returns error KErrEtelCallNotActive.   
       
   300     iMockLTSY.ExpectL(EEtelCallLoanDataPort, data, KErrEtelCallNotActive);  	
       
   301 	err = call.LoanDataPort(dataPort);
       
   302 	ASSERT_EQUALS(KErrEtelCallNotActive, err)
       
   303 	AssertMockLtsyStatusL();	
       
   304 
       
   305 	// Asynchronous version testing. LTSY returns error KErrEtelCallNotActive.
       
   306 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data, KErrEtelCallNotActive); 
       
   307 	call.LoanDataPort(reqStatus, dataPort);
       
   308 	User::WaitForRequest(reqStatus);
       
   309 	ASSERT_EQUALS(KErrEtelCallNotActive, reqStatus.Int())
       
   310 	AssertMockLtsyStatusL();
       
   311 	
       
   312 	// Close data call. After this CCallBase should call CTSY's RelinquishOwnership()
       
   313 	// method instead of RecoverDataPortAndRelinquishOwnership().		
       
   314 	CleanupStack::PopAndDestroy(1); // call
       
   315 	
       
   316 	// Open data call again.
       
   317 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
   318 	ASSERT_EQUALS(KErrNone, err)
       
   319 	CleanupClosePushL(call);		                  	
       
   320 
       
   321  	//-------------------------------------------------------------------------
       
   322 	// TEST A: failure to dispatch request to LTSY
       
   323  	//-------------------------------------------------------------------------
       
   324 
       
   325     callId = 1;
       
   326 
       
   327 	DialL(call, callId, mobileService);
       
   328 	
       
   329 	data.Close();
       
   330 	expData2.SerialiseL(data);
       
   331 	
       
   332 	// Synchronous version testing. LTSY returns error KErrNotSupported.
       
   333 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data, KErrNotSupported);
       
   334 	err = call.LoanDataPort(dataPort);
       
   335 	ASSERT_EQUALS(KErrNotSupported, err)
       
   336 	AssertMockLtsyStatusL();
       
   337 
       
   338 	// Asynchronous version testing. LTSY returns error KErrNotSupported.
       
   339 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data, KErrNotSupported);
       
   340 	call.LoanDataPort(reqStatus, dataPort);
       
   341 	User::WaitForRequest(reqStatus);
       
   342 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   343 	AssertMockLtsyStatusL();
       
   344 
       
   345  	//-------------------------------------------------------------------------
       
   346 	// TEST C: Successful completion request of
       
   347 	// RCall::LoanDataPort.
       
   348  	//-------------------------------------------------------------------------
       
   349 
       
   350 	// Synchronous version testing. LTSY returns KErrNone.
       
   351 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data);
       
   352 	err = call.LoanDataPort(dataPort);
       
   353 	ASSERT_EQUALS(KErrNone, err)
       
   354 	AssertMockLtsyStatusL();
       
   355 
       
   356 	// Turn back environment state.
       
   357 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data);
       
   358 	err = call.RecoverDataPort();
       
   359 	ASSERT_EQUALS(KErrNone, err)
       
   360 	AssertMockLtsyStatusL();
       
   361 
       
   362 	// Asynchronous version testing. LTSY returns KErrNone.
       
   363 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data);
       
   364 	call.LoanDataPort(reqStatus, dataPort);
       
   365 	User::WaitForRequest(reqStatus);
       
   366 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
   367 	AssertMockLtsyStatusL();
       
   368 
       
   369 	// Turn back environment state.
       
   370 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data);
       
   371 	err = call.RecoverDataPort();
       
   372 	ASSERT_EQUALS(KErrNone, err)
       
   373 	AssertMockLtsyStatusL();
       
   374 
       
   375 	//-------------------------------------------------------------------------
       
   376 	// TEST: failure to dispatch request to CTSY
       
   377 	// when call is owned by other client
       
   378  	//-------------------------------------------------------------------------
       
   379 
       
   380 	// Open second client.
       
   381 	RTelServer telServer2;
       
   382 	err = telServer2.Connect();
       
   383 	ASSERT_EQUALS(KErrNone, err);
       
   384 	CleanupClosePushL(telServer2);
       
   385 
       
   386 	RMobilePhone phone2;
       
   387 	err = phone2.Open(telServer2, KMmTsyPhoneName);
       
   388 	ASSERT_EQUALS(KErrNone, err);
       
   389 	CleanupClosePushL(phone2);
       
   390 
       
   391 	RCall call2;
       
   392 	RLine line2;
       
   393 
       
   394 	err = line2.Open(phone2, KMmTsyDataLineName);
       
   395 	ASSERT_EQUALS(KErrNone, err)
       
   396 	CleanupClosePushL(line2);
       
   397 
       
   398 	err = call2.OpenExistingCall(line2, callName);
       
   399 	ASSERT_EQUALS(KErrNone, err)
       
   400 	CleanupClosePushL(call2);
       
   401 
       
   402 	// Try to loan data port when call is owned by other client.
       
   403 	err = call2.LoanDataPort(dataPort);
       
   404 	ASSERT_EQUALS(KErrEtelNotCallOwner, err)
       
   405 	AssertMockLtsyStatusL();
       
   406 
       
   407  	//-------------------------------------------------------------------------
       
   408 	// TEST: failure to dispatch request to CTSY when port is already loaned.
       
   409  	//-------------------------------------------------------------------------
       
   410 
       
   411 	// Loan data port.
       
   412 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data);
       
   413 	err = call.LoanDataPort(dataPort);
       
   414 	ASSERT_EQUALS(KErrNone, err)
       
   415 	AssertMockLtsyStatusL();
       
   416 
       
   417 	// Try to loan data port when the port is loaned by other client.
       
   418 	call.LoanDataPort(reqStatus, dataPort);
       
   419 	User::WaitForRequest(reqStatus);
       
   420 	ASSERT_EQUALS(KErrEtelPortAlreadyLoaned, reqStatus.Int())
       
   421 	AssertMockLtsyStatusL();
       
   422 	
       
   423 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data, KErrNone);
       
   424 
       
   425 	CleanupStack::PopAndDestroy(8, this); // call2, line2, phone2, telServer2, 
       
   426 	                                      // call, line, data, this	
       
   427 	}
       
   428 
       
   429 
       
   430 /**
       
   431 @SYMTestCaseID BA-CTSY-COWN-CLDP-0007
       
   432 @SYMComponent  telephony_ctsy
       
   433 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::LoanDataPort for data calls
       
   434 @SYMTestPriority High
       
   435 @SYMTestActions Invokes cancelling of RCall::LoanDataPort for data calls
       
   436 @SYMTestExpectedResults Pass
       
   437 @SYMTestType CT
       
   438 */
       
   439 void CCTsyCallOwnershipFU::TestLoanDataPort0007L()
       
   440 	{
       
   441 
       
   442 	OpenEtelServerL(EUseExtendedError);
       
   443 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   444 	OpenPhoneL();
       
   445 
       
   446 	RBuf8 data;
       
   447 	CleanupClosePushL(data);
       
   448 
       
   449 	RCall call;
       
   450 	RLine line;
       
   451 
       
   452 	TInt err = line.Open(iPhone, KMmTsyDataLineName);
       
   453 	ASSERT_EQUALS(KErrNone, err)
       
   454 	CleanupClosePushL(line);
       
   455 	
       
   456 	err = OpenNewCall(line, call, KMmTsyDataLineName);
       
   457 	ASSERT_EQUALS(KErrNone, err)
       
   458 	CleanupClosePushL(call);
       
   459 
       
   460 	// prepare data
       
   461 	const TInt KCallId( 1 );
       
   462 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
   463 
       
   464 	RCall::TCommPort expDataPort;
       
   465 	expDataPort.iCsy.Copy(_L("qwerty"));
       
   466 	expDataPort.iPort.Copy(_L("asdfgh"));
       
   467 	TMockLtsyCallData1<RCall::TCommPort> expData(KCallId, KMobileService, expDataPort);
       
   468 	expData.SerialiseL(data);
       
   469 
       
   470 	RCall::TCommPort dataPort;
       
   471 	dataPort.iCsy.Copy(expDataPort.iCsy);
       
   472 	dataPort.iPort.Copy(expDataPort.iPort);
       
   473 
       
   474 	TRequestStatus reqStatus;
       
   475 	
       
   476 	DialL(call, KCallId, KMobileService);
       
   477 
       
   478 	//-------------------------------------------------------------------------
       
   479 	// Test cancelling of RCall::LoanDataPort
       
   480  	//-------------------------------------------------------------------------
       
   481 
       
   482 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data);
       
   483 	call.LoanDataPort(reqStatus, dataPort);
       
   484 	
       
   485 	call.LoanDataPortCancel();
       
   486 	
       
   487 	User::WaitForRequest(reqStatus);
       
   488 	// cause cancel is not used in CTSY for this request
       
   489 	// it completes with KErrNone
       
   490 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
   491 	AssertMockLtsyStatusL();
       
   492 	
       
   493 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data, KErrNone);
       
   494 
       
   495 	CleanupStack::PopAndDestroy(4, this); // call, line, data, this
       
   496 	
       
   497 	}
       
   498 
       
   499 
       
   500 /**
       
   501 @SYMTestCaseID BA-CTSY-COWN-CLDP-0008
       
   502 @SYMComponent  telephony_ctsy
       
   503 @SYMTestCaseDesc Test support in CTSY for RCall::LoanDataPort with bad parameter data for data calls
       
   504 @SYMTestPriority High
       
   505 @SYMTestActions Invokes RCall::LoanDataPort with bad parameter data for data calls
       
   506 @SYMTestExpectedResults Pass
       
   507 @SYMTestType CT
       
   508 */
       
   509 void CCTsyCallOwnershipFU::TestLoanDataPort0008L()
       
   510 	{
       
   511 
       
   512 	OpenEtelServerL(EUseExtendedError);
       
   513 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   514 	OpenPhoneL();
       
   515 
       
   516 	RCall call;
       
   517 	RLine line;
       
   518 
       
   519 	TInt err = line.Open(iPhone, KMmTsyDataLineName);
       
   520 	ASSERT_EQUALS(KErrNone, err)
       
   521 	CleanupClosePushL(line);
       
   522 	
       
   523 	err = OpenNewCall(line, call, KMmTsyDataLineName);
       
   524 	ASSERT_EQUALS(KErrNone, err)
       
   525 	CleanupClosePushL(call);
       
   526 
       
   527 	const TInt KCallId( 1 );
       
   528 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
   529 	DialL(call, KCallId, KMobileService);
       
   530 	
       
   531 	//-------------------------------------------------------------------------
       
   532 	// Test C: Test passing out of bounds parameters to
       
   533 	// RCall::LoanDataPort
       
   534  	//-------------------------------------------------------------------------
       
   535  	
       
   536 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330101);
       
   537 	// Test passing out of bounds parameters (KnullDesC as port) doesn't cause an error in ctsy.
       
   538 	// Request pass to ltsy, so it returns CErrCorrupt. So request completes with KErrCorrupt instead of KErrNone.
       
   539 
       
   540 	// Asynchronous version testing.
       
   541 	RCall::TCommPort dataPort;
       
   542 	dataPort.iCsy.Copy(KNullDesC);  // incorrect argument
       
   543 	dataPort.iPort.Copy(KNullDesC); // incorrect argument
       
   544 	TRequestStatus reqStatus;
       
   545 	call.LoanDataPort(reqStatus, dataPort);
       
   546 	User::WaitForRequest(reqStatus);
       
   547 	ASSERT_EQUALS(KErrArgument, reqStatus.Int())
       
   548 	AssertMockLtsyStatusL();
       
   549 
       
   550 	// Synchronous version testing.
       
   551 	err = call.LoanDataPort(dataPort);
       
   552 	ASSERT_EQUALS(KErrArgument, err)
       
   553 	AssertMockLtsyStatusL();
       
   554 
       
   555 	CleanupStack::PopAndDestroy(3, this); // call, line, this
       
   556 
       
   557 	}
       
   558 
       
   559 
       
   560 /**
       
   561 @SYMTestCaseID BA-CTSY-COWN-CLDP-00011
       
   562 @SYMComponent  telephony_ctsy
       
   563 @SYMTestCaseDesc Test support in CTSY for RCall::LoanDataPort for fax calls
       
   564 @SYMTestPriority High
       
   565 @SYMTestActions Invokes RCall::LoanDataPort for fax calls
       
   566 @SYMTestExpectedResults Pass
       
   567 @SYMTestType CT
       
   568 */
       
   569 void CCTsyCallOwnershipFU::TestLoanDataPort00011L()
       
   570 	{
       
   571 
       
   572 	OpenEtelServerL(EUseExtendedError);
       
   573 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   574 	OpenPhoneL();
       
   575 
       
   576 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330104);
       
   577 	// RCall::LoanDataPort does not return KErrNotSupported for fax calls
       
   578 	// Request pass to ltsy, so it returns KErrCorrupt instead of KErrNotSupported.
       
   579 	
       
   580 	TestLoanDataPortNotSupportedL(KMmTsyFaxLineName, 1);
       
   581 
       
   582 	CleanupStack::PopAndDestroy(this);
       
   583 	
       
   584 	}
       
   585 
       
   586 
       
   587 /**
       
   588 @SYMTestCaseID BA-CTSY-COWN-CRDP-0001
       
   589 @SYMComponent  telephony_ctsy
       
   590 @SYMTestCaseDesc Test support in CTSY for RCall::RecoverDataPort for voice calls
       
   591 @SYMTestPriority High
       
   592 @SYMTestActions Invokes RCall::RecoverDataPort for voice calls
       
   593 @SYMTestExpectedResults Pass
       
   594 @SYMTestType CT
       
   595 */
       
   596 void CCTsyCallOwnershipFU::TestRecoverDataPort0001L()
       
   597 	{
       
   598 
       
   599 	OpenEtelServerL(EUseExtendedError);
       
   600 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   601 	OpenPhoneL();
       
   602 
       
   603 	TestRecoverDataPortNotSupportedL(KMmTsyVoice1LineName);
       
   604 
       
   605 	TestRecoverDataPortNotSupportedL(KMmTsyVoice2LineName);
       
   606 
       
   607 	CleanupStack::PopAndDestroy(this);
       
   608 	
       
   609 	}
       
   610 
       
   611 
       
   612 /**
       
   613 @SYMTestCaseID BA-CTSY-COWN-CRDP-0006
       
   614 @SYMComponent  telephony_ctsy
       
   615 @SYMTestCaseDesc Test support in CTSY for RCall::RecoverDataPort for data calls
       
   616 @SYMTestPriority High
       
   617 @SYMTestActions Invokes RCall::RecoverDataPort for data calls
       
   618 @SYMTestExpectedResults Pass
       
   619 @SYMTestType CT
       
   620 */
       
   621 void CCTsyCallOwnershipFU::TestRecoverDataPort0006L()
       
   622 	{
       
   623 
       
   624 	OpenEtelServerL(EUseExtendedError);
       
   625 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   626 	OpenPhoneL();
       
   627 
       
   628 	RBuf8 data;
       
   629 	CleanupClosePushL(data);
       
   630 	
       
   631 	RCall call;
       
   632 	RLine line;
       
   633 
       
   634 	TInt err = line.Open(iPhone, KMmTsyDataLineName);
       
   635 	ASSERT_EQUALS(KErrNone, err)
       
   636 	CleanupClosePushL(line);
       
   637 	
       
   638 	TName callName;
       
   639 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
   640 	ASSERT_EQUALS(KErrNone, err)
       
   641 	CleanupClosePushL(call);
       
   642 
       
   643 	const TInt KCallId( 1 );
       
   644 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
   645 	DialL(call, KCallId, KMobileService);
       
   646 
       
   647 	RCall::TCommPort dataPort;
       
   648 	dataPort.iCsy.Copy(_L("qwerty"));
       
   649 	dataPort.iPort.Copy(_L("asdfgh"));
       
   650 	TMockLtsyCallData1<RCall::TCommPort> expData(KCallId, KMobileService, dataPort);
       
   651 	expData.SerialiseL(data);
       
   652 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data);
       
   653 	err = call.LoanDataPort(dataPort);
       
   654 	ASSERT_EQUALS(KErrNone, err)
       
   655 	AssertMockLtsyStatusL();
       
   656 
       
   657 	//-------------------------------------------------------------------------
       
   658 	// TEST A: failure to dispatch request to LTSY
       
   659  	//-------------------------------------------------------------------------
       
   660 
       
   661 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data, KErrNotSupported);
       
   662 	err = call.RecoverDataPort();
       
   663 	ASSERT_EQUALS(KErrNotSupported, err)
       
   664 	AssertMockLtsyStatusL();
       
   665 
       
   666  	//-------------------------------------------------------------------------
       
   667 	// TEST C: Successful completion request of
       
   668 	// RCall::RecoverDataPort.
       
   669  	//-------------------------------------------------------------------------
       
   670 
       
   671 	iMockLTSY.ExpectL(EEtelCallRecoverDataPort, data);
       
   672 	err = call.RecoverDataPort();
       
   673 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330201);
       
   674 	// CMmDataCallTsy::RecoverDataPort does not checks error value
       
   675 	// returned from ltsy and allways recovers data port
       
   676 	// so CTSY recovers data port in precedent test step
       
   677 	// and test for successful completion request gets returned
       
   678 	// a KErrEtelPortNotLoanedToClient error instead of KErrNone.
       
   679 	ASSERT_EQUALS(KErrNone, err)
       
   680 	AssertMockLtsyStatusL();
       
   681 
       
   682  	//-------------------------------------------------------------------------
       
   683 	// TEST: failure to dispatch request to CTSY when port is not loaned.
       
   684  	//-------------------------------------------------------------------------
       
   685 
       
   686 	err = call.RecoverDataPort();
       
   687 	ASSERT_EQUALS(KErrEtelPortNotLoanedToClient, err)
       
   688 	AssertMockLtsyStatusL();
       
   689 
       
   690 	//-------------------------------------------------------------------------
       
   691 	// TEST: failure to dispatch request to CTSY
       
   692 	// when call is owned by other client
       
   693  	//-------------------------------------------------------------------------
       
   694 
       
   695 	// loan data port by first client
       
   696 	iMockLTSY.ExpectL(EEtelCallLoanDataPort, data);
       
   697 	err = call.LoanDataPort(dataPort);
       
   698 	ASSERT_EQUALS(KErrNone, err)
       
   699 	AssertMockLtsyStatusL();
       
   700 
       
   701 	// Open second client
       
   702 	RTelServer telServer2;
       
   703 	err = telServer2.Connect();
       
   704 	ASSERT_EQUALS(KErrNone, err);
       
   705 	CleanupClosePushL(telServer2);
       
   706 
       
   707 	RMobilePhone phone2;
       
   708 	err = phone2.Open(telServer2, KMmTsyPhoneName);
       
   709 	ASSERT_EQUALS(KErrNone, err);
       
   710 	CleanupClosePushL(phone2);
       
   711 
       
   712 	RCall call2;
       
   713 	RLine line2;
       
   714 
       
   715 	err = line2.Open(phone2, KMmTsyDataLineName);
       
   716 	ASSERT_EQUALS(KErrNone, err)
       
   717 	CleanupClosePushL(line2);
       
   718 
       
   719 	err = call2.OpenExistingCall(line2, callName);
       
   720 	ASSERT_EQUALS(KErrNone, err)
       
   721 	CleanupClosePushL(call2);
       
   722 
       
   723 	// test
       
   724 	err = call.RecoverDataPort();
       
   725 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330203);
       
   726 	// Request passes to MockLTSY as though the client owns the call.
       
   727 	// So MockLtsy returns KErrCorrupt because there is no expected IPC.
       
   728 	ASSERT_EQUALS(KErrEtelNotCallOwner, err)
       
   729 	AssertMockLtsyStatusL();
       
   730 
       
   731 	CleanupStack::PopAndDestroy(8, this); // call2, line2, phone2, telServer2, call, line, data, this
       
   732 	
       
   733 	}
       
   734 
       
   735 
       
   736 /**
       
   737 @SYMTestCaseID BA-CTSY-COWN-CRDP-00011
       
   738 @SYMComponent  telephony_ctsy
       
   739 @SYMTestCaseDesc Test support in CTSY for RCall::RecoverDataPort for fax calls
       
   740 @SYMTestPriority High
       
   741 @SYMTestActions Invokes RCall::RecoverDataPort for fax calls
       
   742 @SYMTestExpectedResults Pass
       
   743 @SYMTestType CT
       
   744 */
       
   745 void CCTsyCallOwnershipFU::TestRecoverDataPort00011L()
       
   746 	{
       
   747 
       
   748 	OpenEtelServerL(EUseExtendedError);
       
   749 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   750 	OpenPhoneL();
       
   751 
       
   752 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330202);
       
   753 	// RCall::RecoverDataPort returns KErrEtelPortNotLoanedToClient
       
   754 	// instead of KErrNotSupported for fax calls
       
   755 
       
   756 	TestRecoverDataPortNotSupportedL(KMmTsyFaxLineName);
       
   757 
       
   758 	CleanupStack::PopAndDestroy(this);
       
   759 	
       
   760 	}
       
   761 
       
   762 
       
   763 /**
       
   764 @SYMTestCaseID BA-CTSY-COWN-CAO-0001
       
   765 @SYMComponent  telephony_ctsy
       
   766 @SYMTestCaseDesc Test support in CTSY for RCall::AcquireOwnership for voice calls
       
   767 @SYMTestPriority High
       
   768 @SYMTestActions Invokes RCall::AcquireOwnership for voice calls
       
   769 @SYMTestExpectedResults Pass
       
   770 @SYMTestType CT
       
   771 */
       
   772 void CCTsyCallOwnershipFU::TestAcquireOwnership0001L()
       
   773 	{
       
   774 
       
   775 	OpenEtelServerL(EUseExtendedError);
       
   776 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   777 	OpenPhoneL();
       
   778 
       
   779 	TestAcquireOwnershipNotSupportedL(KMmTsyVoice1LineName);
       
   780 
       
   781 	TestAcquireOwnershipNotSupportedL(KMmTsyVoice2LineName);
       
   782 
       
   783 	CleanupStack::PopAndDestroy(this);
       
   784 
       
   785 	}
       
   786 
       
   787 
       
   788 /**
       
   789 @SYMTestCaseID BA-CTSY-COWN-CAO-0006
       
   790 @SYMComponent  telephony_ctsy
       
   791 @SYMTestCaseDesc Test support in CTSY for RCall::AcquireOwnership for data calls
       
   792 @SYMTestPriority High
       
   793 @SYMTestActions Invokes RCall::AcquireOwnership for data calls
       
   794 @SYMTestExpectedResults Pass
       
   795 @SYMTestType CT
       
   796 */
       
   797 void CCTsyCallOwnershipFU::TestAcquireOwnership0006L()
       
   798 	{
       
   799 
       
   800 	OpenEtelServerL(EUseExtendedError);
       
   801 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   802 	OpenPhoneL();
       
   803 
       
   804 	// Open second client
       
   805 	RTelServer telServer2;
       
   806 	TInt err = telServer2.Connect();
       
   807 	ASSERT_EQUALS(KErrNone, err);
       
   808 	CleanupClosePushL(telServer2);
       
   809 
       
   810 	RMobilePhone phone2;
       
   811 	err = phone2.Open(telServer2, KMmTsyPhoneName);
       
   812 	ASSERT_EQUALS(KErrNone, err);
       
   813 	CleanupClosePushL(phone2);
       
   814 
       
   815 	// make call having ownership
       
   816 	RCall call;
       
   817 	RLine line;
       
   818 
       
   819 	err = line.Open(iPhone, KMmTsyDataLineName);
       
   820 	ASSERT_EQUALS(KErrNone, err)
       
   821 	CleanupClosePushL(line);
       
   822 	
       
   823 	TName callName;
       
   824 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
   825 	ASSERT_EQUALS(KErrNone, err)
       
   826 	CleanupClosePushL(call);
       
   827 
       
   828  	//-------------------------------------------------------------------------
       
   829 	// TEST: failure to dispatch request to CTSY when call is not active.
       
   830  	//-------------------------------------------------------------------------
       
   831 
       
   832 	TRequestStatus reqStatus;
       
   833 	call.AcquireOwnership(reqStatus);
       
   834 	User::WaitForRequest(reqStatus);
       
   835 	ASSERT_EQUALS(KErrEtelCallNotActive, reqStatus.Int())
       
   836 	AssertMockLtsyStatusL();
       
   837 
       
   838  	//-------------------------------------------------------------------------
       
   839 	// TEST C: Successful completion request of
       
   840 	// RCall::AcquireOwnership.
       
   841  	//-------------------------------------------------------------------------
       
   842 
       
   843 	const TInt KCallId( 1 );
       
   844 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
   845 	DialL(call, KCallId, KMobileService);
       
   846 
       
   847 	// setting and execute request
       
   848 	RCall call2;
       
   849 	RLine line2;
       
   850 
       
   851 	err = line2.Open(phone2, KMmTsyDataLineName);
       
   852 	ASSERT_EQUALS(KErrNone, err)
       
   853 	CleanupClosePushL(line2);
       
   854 
       
   855 	// open existing call to send take ownership request
       
   856 	err = call2.OpenExistingCall(line2, callName);
       
   857 	ASSERT_EQUALS(KErrNone, err)
       
   858 	CleanupClosePushL(call2);
       
   859 
       
   860 	call2.AcquireOwnership(reqStatus);
       
   861 
       
   862 	// close 1st call to give ownership to call2
       
   863 	call.Close();
       
   864 
       
   865 	User::WaitForRequest(reqStatus);
       
   866 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
   867 	AssertMockLtsyStatusL();
       
   868 
       
   869 	CleanupStack::PopAndDestroy(4); // call2, line2, call, line
       
   870 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
   871 	
       
   872 	}
       
   873 
       
   874 
       
   875 /**
       
   876 @SYMTestCaseID BA-CTSY-COWN-CAO-0007
       
   877 @SYMComponent  telephony_ctsy
       
   878 @SYMTestCaseDesc Test support in CTSY for cancelling of RCall::AcquireOwnership for data calls
       
   879 @SYMTestPriority High
       
   880 @SYMTestActions Invokes cancelling of RCall::AcquireOwnership for data calls
       
   881 @SYMTestExpectedResults Pass
       
   882 @SYMTestType CT
       
   883 */
       
   884 void CCTsyCallOwnershipFU::TestAcquireOwnership0007L()
       
   885 	{
       
   886 
       
   887 	OpenEtelServerL(EUseExtendedError);
       
   888 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   889 	OpenPhoneL();
       
   890 
       
   891 	// Open second client
       
   892 	RTelServer telServer2;
       
   893 	TInt err = telServer2.Connect();
       
   894 	ASSERT_EQUALS(KErrNone, err);
       
   895 	CleanupClosePushL(telServer2);
       
   896 
       
   897 	RMobilePhone phone2;
       
   898 	err = phone2.Open(telServer2, KMmTsyPhoneName);
       
   899 	ASSERT_EQUALS(KErrNone, err);
       
   900 	CleanupClosePushL(phone2);
       
   901 
       
   902 	// make call having ownership
       
   903 	RCall call;
       
   904 	RLine line;
       
   905 
       
   906 	err = line.Open(iPhone, KMmTsyDataLineName);
       
   907 	ASSERT_EQUALS(KErrNone, err)
       
   908 	CleanupClosePushL(line);
       
   909 	
       
   910 	TName callName;
       
   911 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
   912 	ASSERT_EQUALS(KErrNone, err)
       
   913 	CleanupClosePushL(call);
       
   914 
       
   915 	const TInt KCallId( 1 );
       
   916 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
   917 	DialL(call, KCallId, KMobileService);
       
   918 
       
   919  	//-------------------------------------------------------------------------
       
   920 	// Test cancelling of RCall::AcquireOwnership
       
   921  	//-------------------------------------------------------------------------
       
   922  	
       
   923 	// setting and execute request
       
   924 	RCall call2;
       
   925 	RLine line2;
       
   926 
       
   927 	err = line2.Open(phone2, KMmTsyDataLineName);
       
   928 	ASSERT_EQUALS(KErrNone, err)
       
   929 	CleanupClosePushL(line2);
       
   930 
       
   931 	// open existing call to send take ownership request
       
   932 	err = call2.OpenExistingCall(line2, callName);
       
   933 	ASSERT_EQUALS(KErrNone, err)
       
   934 	CleanupClosePushL(call2);
       
   935 
       
   936 	TRequestStatus reqStatus;
       
   937 	call2.AcquireOwnership(reqStatus);
       
   938 
       
   939 	call2.AcquireOwnershipCancel();
       
   940 
       
   941 	// close 1st call to give ownership to call2
       
   942 	call.Close();
       
   943 
       
   944 	User::WaitForRequest(reqStatus);
       
   945 	ASSERT_EQUALS(KErrCancel, reqStatus.Int())
       
   946 
       
   947 	AssertMockLtsyStatusL();
       
   948 	CleanupStack::PopAndDestroy(4); // call2, line2, call, line
       
   949 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
   950 	
       
   951 	}
       
   952 
       
   953 
       
   954 /**
       
   955 @SYMTestCaseID BA-CTSY-COWN-CAO-0009
       
   956 @SYMComponent  telephony_ctsy
       
   957 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RCall::AcquireOwnership for data calls
       
   958 @SYMTestPriority High
       
   959 @SYMTestActions Invokes multiple client requests to RCall::AcquireOwnership for data calls
       
   960 @SYMTestExpectedResults Pass
       
   961 @SYMTestType CT
       
   962 */
       
   963 void CCTsyCallOwnershipFU::TestAcquireOwnership0009L()
       
   964 	{
       
   965 
       
   966 	OpenEtelServerL(EUseExtendedError);
       
   967 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   968 	OpenPhoneL();
       
   969 
       
   970 	// Open second client
       
   971 	RTelServer telServer2;
       
   972 	TInt err = telServer2.Connect();
       
   973 	ASSERT_EQUALS(KErrNone, err);
       
   974 	CleanupClosePushL(telServer2);
       
   975 
       
   976 	RMobilePhone phone2;
       
   977 	err = phone2.Open(telServer2, KMmTsyPhoneName);
       
   978 	ASSERT_EQUALS(KErrNone, err);
       
   979 	CleanupClosePushL(phone2);
       
   980 
       
   981 	// Open 3rd client
       
   982 	RTelServer telServer3;
       
   983 	err = telServer3.Connect();
       
   984 	ASSERT_EQUALS(KErrNone, err);
       
   985 	CleanupClosePushL(telServer3);
       
   986 
       
   987 	RMobilePhone phone3;
       
   988 	err = phone3.Open(telServer3, KMmTsyPhoneName);
       
   989 	ASSERT_EQUALS(KErrNone, err);
       
   990 	CleanupClosePushL(phone3);
       
   991 
       
   992 	//-------------------------------------------------------------------------
       
   993 	// Test A: Test multiple clients requesting RCall::AcquireOwnership
       
   994  	//-------------------------------------------------------------------------
       
   995 
       
   996 	// make call having ownership
       
   997 	RCall call;
       
   998 	RLine line;
       
   999 
       
  1000 	err = line.Open(iPhone, KMmTsyDataLineName);
       
  1001 	ASSERT_EQUALS(KErrNone, err)
       
  1002 	CleanupClosePushL(line);
       
  1003 	
       
  1004 	TName callName;
       
  1005 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
  1006 	ASSERT_EQUALS(KErrNone, err)
       
  1007 	CleanupClosePushL(call);
       
  1008 
       
  1009 	const TInt KCallId( 1 );
       
  1010 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
  1011 	DialL(call, KCallId, KMobileService);
       
  1012 
       
  1013 	// setting and execute 1st request
       
  1014 	RCall call2;
       
  1015 	RLine line2;
       
  1016 
       
  1017 	err = line2.Open(phone2, KMmTsyDataLineName);
       
  1018 	ASSERT_EQUALS(KErrNone, err)
       
  1019 	CleanupClosePushL(line2);
       
  1020 
       
  1021 	err = call2.OpenExistingCall(line2, callName);
       
  1022 	ASSERT_EQUALS(KErrNone, err)
       
  1023 	CleanupClosePushL(call2);
       
  1024 
       
  1025 	TRequestStatus reqStatus;
       
  1026 	call2.AcquireOwnership(reqStatus);
       
  1027 
       
  1028 	// setting and execute 2nd request
       
  1029 	RCall call3;
       
  1030 	RLine line3;
       
  1031 
       
  1032 	err = line3.Open(phone3, KMmTsyDataLineName);
       
  1033 	ASSERT_EQUALS(KErrNone, err)
       
  1034 	CleanupClosePushL(line3);
       
  1035 
       
  1036 	err = call3.OpenExistingCall(line3, callName);
       
  1037 	ASSERT_EQUALS(KErrNone, err)
       
  1038 	CleanupClosePushL(call3);
       
  1039 
       
  1040 	TRequestStatus reqStatus2;
       
  1041 	call3.AcquireOwnership(reqStatus2);
       
  1042 
       
  1043 	// close 1st call to give ownership to call2
       
  1044 	call.Close();
       
  1045 
       
  1046 	User::WaitForRequest(reqStatus);
       
  1047 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  1048 
       
  1049 	// close 2nd call to give ownership to call3
       
  1050 	call2.Close();
       
  1051 
       
  1052 	User::WaitForRequest(reqStatus2);
       
  1053 	ASSERT_EQUALS(KErrNone, reqStatus2.Int())
       
  1054 
       
  1055 	AssertMockLtsyStatusL();
       
  1056 	CleanupStack::PopAndDestroy(6); // call3, line3, call2, line2, call, line
       
  1057 	CleanupStack::PopAndDestroy(5, this); // phone3, telServer3, phone2, telServer2, this
       
  1058 
       
  1059 	}
       
  1060 
       
  1061 
       
  1062 /**
       
  1063 @SYMTestCaseID BA-CTSY-COWN-CAO-00011
       
  1064 @SYMComponent  telephony_ctsy
       
  1065 @SYMTestCaseDesc Test support in CTSY for RCall::AcquireOwnership for fax calls
       
  1066 @SYMTestPriority High
       
  1067 @SYMTestActions Invokes RCall::AcquireOwnership for fax calls
       
  1068 @SYMTestExpectedResults Pass
       
  1069 @SYMTestType CT
       
  1070 */
       
  1071 void CCTsyCallOwnershipFU::TestAcquireOwnership00011L()
       
  1072 	{
       
  1073 
       
  1074 	OpenEtelServerL(EUseExtendedError);
       
  1075 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1076 	OpenPhoneL();
       
  1077 
       
  1078 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330301);
       
  1079 	// RCall::AcquireOwnership returns KErrEtelCallNotActive
       
  1080 	// instead of KErrNotSupported for fax calls
       
  1081 
       
  1082 	TestAcquireOwnershipNotSupportedL(KMmTsyFaxLineName);
       
  1083 
       
  1084 	CleanupStack::PopAndDestroy(this);
       
  1085 	
       
  1086 	}
       
  1087 
       
  1088 
       
  1089 /**
       
  1090 @SYMTestCaseID BA-CTSY-COWN-CTO-0001
       
  1091 @SYMComponent  telephony_ctsy
       
  1092 @SYMTestCaseDesc Test support in CTSY for RCall::TransferOwnership for voice calls
       
  1093 @SYMTestPriority High
       
  1094 @SYMTestActions Invokes RCall::TransferOwnership for voice calls
       
  1095 @SYMTestExpectedResults Pass
       
  1096 @SYMTestType CT
       
  1097 */
       
  1098 void CCTsyCallOwnershipFU::TestTransferOwnership0001L()
       
  1099 	{
       
  1100 
       
  1101 	OpenEtelServerL(EUseExtendedError);
       
  1102 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1103 	OpenPhoneL();
       
  1104 
       
  1105 	TestTransferOwnershipNotSupportedL(KMmTsyVoice1LineName);
       
  1106 
       
  1107 	TestTransferOwnershipNotSupportedL(KMmTsyVoice2LineName);
       
  1108 
       
  1109 	CleanupStack::PopAndDestroy(this);
       
  1110 	
       
  1111 	}
       
  1112 
       
  1113 
       
  1114 /**
       
  1115 @SYMTestCaseID BA-CTSY-COWN-CTO-0006
       
  1116 @SYMComponent  telephony_ctsy
       
  1117 @SYMTestCaseDesc Test support in CTSY for RCall::TransferOwnership for data calls
       
  1118 @SYMTestPriority High
       
  1119 @SYMTestActions Invokes RCall::TransferOwnership for data calls
       
  1120 @SYMTestExpectedResults Pass
       
  1121 @SYMTestType CT
       
  1122 */
       
  1123 void CCTsyCallOwnershipFU::TestTransferOwnership0006L()
       
  1124 	{
       
  1125 
       
  1126 	OpenEtelServerL(EUseExtendedError);
       
  1127 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1128 	OpenPhoneL();
       
  1129 
       
  1130 	RBuf8 expectData;
       
  1131     CleanupClosePushL(expectData);
       
  1132 
       
  1133 	RBuf8 completeData;
       
  1134     CleanupClosePushL(completeData);    
       
  1135 
       
  1136 	// Open second client
       
  1137 	RTelServer telServer2;
       
  1138 	TInt err = telServer2.Connect();
       
  1139 	ASSERT_EQUALS(KErrNone, err);
       
  1140 	CleanupClosePushL(telServer2);
       
  1141 
       
  1142 	RMobilePhone phone2;
       
  1143 	err = phone2.Open(telServer2, KMmTsyPhoneName);
       
  1144 	ASSERT_EQUALS(KErrNone, err);
       
  1145 	CleanupClosePushL(phone2);
       
  1146 
       
  1147 	RCall call;
       
  1148 	RLine line;
       
  1149 
       
  1150 	err = line.Open(iPhone, KMmTsyDataLineName);
       
  1151 	ASSERT_EQUALS(KErrNone, err)
       
  1152 	CleanupClosePushL(line);
       
  1153 	
       
  1154 	TName callName;
       
  1155 	err = OpenNewCall(line, call, KMmTsyDataLineName, callName);
       
  1156 	ASSERT_EQUALS(KErrNone, err)
       
  1157 	CleanupClosePushL(call);
       
  1158 
       
  1159  	//-------------------------------------------------------------------------
       
  1160 	// TEST: failure to dispatch request to CTSY when call is not active
       
  1161  	//-------------------------------------------------------------------------
       
  1162 
       
  1163 	err = call.TransferOwnership();
       
  1164 	
       
  1165 	// CTSY grants call ownerhip to the ETel API client which for example
       
  1166 	// dials or answers incoming call. Call is currently in idle state so
       
  1167 	// nobody has ownership to this call object. Therefore CTSY returns error
       
  1168 	// KErrEtelNotCallOwner to TransferOwnership() request. 
       
  1169 	ASSERT_EQUALS(KErrEtelNotCallOwner, err)
       
  1170 	AssertMockLtsyStatusL();
       
  1171 
       
  1172  	//-------------------------------------------------------------------------
       
  1173 	// TEST: failure to dispatch request to CTSY when there is no client
       
  1174 	// interested in the call ownership.
       
  1175  	//-------------------------------------------------------------------------
       
  1176 
       
  1177 	// make call having ownership
       
  1178 	const TInt KCallId( 1 );
       
  1179 	const RMobilePhone::TMobileService KMobileService( RMobilePhone::ECircuitDataService );
       
  1180 	DialL(call, KCallId, KMobileService);
       
  1181 
       
  1182 	// make connected (just for coverage)
       
  1183 	ChangeCallStatusL(KCallId, KMobileService, RMobileCall::EStatusConnected);
       
  1184 
       
  1185 	err = call.TransferOwnership();
       
  1186 	ASSERT_EQUALS(KErrEtelNoClientInterestedInThisCall, err)
       
  1187 	AssertMockLtsyStatusL();
       
  1188 
       
  1189  	//-------------------------------------------------------------------------
       
  1190 	// TEST C: Successful completion request of
       
  1191 	// RCall::TransferOwnership.
       
  1192  	//-------------------------------------------------------------------------
       
  1193 
       
  1194 	// setting and execute AcquireOwnership request
       
  1195 	RCall call2;
       
  1196 	RLine line2;
       
  1197 
       
  1198 	err = line2.Open(phone2, KMmTsyDataLineName);
       
  1199 	ASSERT_EQUALS(KErrNone, err)
       
  1200 	CleanupClosePushL(line2);
       
  1201 
       
  1202 	// open existing call to send take ownership request
       
  1203 	err = call2.OpenExistingCall(line2, callName);
       
  1204 	ASSERT_EQUALS(KErrNone, err)
       
  1205 	CleanupClosePushL(call2);
       
  1206 
       
  1207 	TRequestStatus reqStatus;
       
  1208 	call2.AcquireOwnership(reqStatus);
       
  1209 
       
  1210 	// TransferOwnership to call2
       
  1211 	err = call.TransferOwnership();
       
  1212 	ASSERT_EQUALS(KErrNone, err)
       
  1213 	AssertMockLtsyStatusL();
       
  1214 
       
  1215 	User::WaitForRequest(reqStatus);
       
  1216 	ASSERT_EQUALS(KErrNone, reqStatus.Int())
       
  1217 	AssertMockLtsyStatusL();
       
  1218 
       
  1219 	//-------------------------------------------------------------------------
       
  1220 	// TEST: failure to dispatch request to CTSY
       
  1221 	// when call is owned by other client
       
  1222  	//-------------------------------------------------------------------------
       
  1223 
       
  1224 	err = call.TransferOwnership();
       
  1225 	ASSERT_EQUALS(KErrEtelNotCallOwner, err)
       
  1226 	AssertMockLtsyStatusL();
       
  1227 	
       
  1228 	//-------------------------------------------------------------------------
       
  1229 	// Hang up data call before closing objects. This is because closing of 
       
  1230 	// connected call object is bad client behaviour. RelinquishOwnership process 
       
  1231 	// does not go through if data call is in connected state and last client 
       
  1232 	// closes handle to the data call object.
       
  1233 	
       
  1234     TRequestStatus mockLtsyStatus;
       
  1235 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1236 	
       
  1237     RMobilePhone::TMobileService mobileService = RMobilePhone::ECircuitDataService;
       
  1238 	TInt hangUpCause = KErrGsmReleaseByUser;
       
  1239 	TBool autoStChangeDisable = EFalse;
       
  1240     TMockLtsyCallData2<TInt, TBool> mockData1(KCallId, mobileService, hangUpCause, 
       
  1241                                              autoStChangeDisable);
       
  1242     mockData1.SerialiseL(expectData);                                              	
       
  1243     iMockLTSY.ExpectL(EEtelCallHangUp, expectData, KErrNone);                                              
       
  1244 	
       
  1245 	//Make HangUp request
       
  1246 	call2.HangUp(reqStatus);
       
  1247 		
       
  1248 	RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusIdle; 
       
  1249 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockData2(KCallId, 
       
  1250 	                                                mobileService, mobileCallStatus);
       
  1251 	mockData2.SerialiseL(completeData);
       
  1252 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrGsmReleaseByUser, completeData);	
       
  1253 		
       
  1254 	User::WaitForRequest(reqStatus);
       
  1255 	ASSERT_EQUALS(KErrNone, reqStatus.Int());	
       
  1256 	User::WaitForRequest(mockLtsyStatus);
       
  1257 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1258 	
       
  1259 	//-------------------------------------------------------------------------
       
  1260 
       
  1261     AssertMockLtsyStatusL();
       
  1262 
       
  1263 	CleanupStack::PopAndDestroy(9, this); // call2, line2, call, line, phone2, 
       
  1264 	                                      // telServer2, completeData, expectData, this
       
  1265 	}
       
  1266 
       
  1267 
       
  1268 /**
       
  1269 @SYMTestCaseID BA-CTSY-COWN-CTO-00011
       
  1270 @SYMComponent  telephony_ctsy
       
  1271 @SYMTestCaseDesc Test support in CTSY for RCall::TransferOwnership for fax calls
       
  1272 @SYMTestPriority High
       
  1273 @SYMTestActions Invokes RCall::TransferOwnership for fax calls
       
  1274 @SYMTestExpectedResults Pass
       
  1275 @SYMTestType CT
       
  1276 */
       
  1277 void CCTsyCallOwnershipFU::TestTransferOwnership00011L()
       
  1278 	{
       
  1279 
       
  1280 	OpenEtelServerL(EUseExtendedError);
       
  1281 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1282 	OpenPhoneL();
       
  1283 
       
  1284 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 330401);
       
  1285 	// RCall::TransferOwnership returns KErrEtelNotCallOwner
       
  1286 	// instead of KErrNotSupported for fax calls
       
  1287 
       
  1288 	TestTransferOwnershipNotSupportedL(KMmTsyFaxLineName);
       
  1289 
       
  1290 	CleanupStack::PopAndDestroy(this);
       
  1291 	
       
  1292 	}