telephonyutils/etel3rdpartyapi/Test/te_etelIsv/TE_EtelIsvCallFunc.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2003-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 // Tests for ETEL 3rd Party Call APIs.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "TE_EtelIsvbase.h"
       
    23 #include "TE_EtelIsvCallFunc.h"
       
    24 
       
    25 
       
    26 CTestDialNewCall::CTestDialNewCall()
       
    27 /** Each test step initialises it's own name
       
    28 */
       
    29 {
       
    30 	// store the name of this test case
       
    31 	// this is the name that is used by the script file
       
    32 	SetTestStepName(_L("TestDialNewCall"));
       
    33 }
       
    34 
       
    35 /**
       
    36 *
       
    37 @SYMTestCaseID Etel3rdParty 9.1
       
    38 @SYMTestCaseDesc Test DialNewCall 3rd party API
       
    39 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.1
       
    40 */ 
       
    41 
       
    42 enum TVerdict CTestDialNewCall::doTestStepL()
       
    43 {
       
    44 	INFO_PRINTF1(_L("CTestDialNewCall::doTestStepL Start"));
       
    45 	
       
    46 	_LIT(KGoodNumber,"1789");
       
    47 	
       
    48 	SetTestNumber(15); 
       
    49 	
       
    50 	//Set the call parameters for call 1
       
    51 	CTelephony::TCallParamsV1 callParams1;
       
    52 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
    53 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
    54 	
       
    55 	TTestCallParams testCallParams1;
       
    56 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
    57 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
    58 	testCallParams1.iTelAddress.iTelNumber = KGoodNumber;
       
    59 	testCallParams1.iExpStat = KErrNone;
       
    60 	
       
    61 	//Set the call parameters for call 2
       
    62 	CTelephony::TCallParamsV1 callParams2;
       
    63 	callParams2.iIdRestrict = CTelephony::ESendMyId;
       
    64 	CTelephony::TCallParamsV1Pckg callParamsPckg2(callParams2);	
       
    65 	
       
    66 	TTestCallParams testCallParams2;
       
    67 	testCallParams2.iLine = CTelephony::EVoiceLine;
       
    68 	testCallParams2.iCallParamsV1Pckg = &callParamsPckg2;
       
    69 	testCallParams2.iTelAddress.iTelNumber = KGoodNumber;
       
    70 	testCallParams2.iExpStat = KErrNone;
       
    71 	
       
    72 	//Set the call parameters for call 3 - should not successfully make a call
       
    73 	CTelephony::TCallParamsV1 callParams3;
       
    74 	callParams3.iIdRestrict = CTelephony::ESendMyId;
       
    75 	CTelephony::TCallParamsV1Pckg callParamsPckg3(callParams3);	
       
    76 	
       
    77 	TTestCallParams testCallParams3;
       
    78 	testCallParams3.iLine = CTelephony::EVoiceLine;
       
    79 	testCallParams3.iCallParamsV1Pckg = &callParamsPckg3;
       
    80 	testCallParams3.iTelAddress.iTelNumber = KGoodNumber;
       
    81 	testCallParams3.iExpStat = KErrAccessDenied;
       
    82 	
       
    83 	CTelephony::TCallStatusV1 status;
       
    84 	CTelephony::TCallStatusV1Pckg statusPckg(status);
       
    85 	
       
    86 	// Create active DialNewCallAct objects
       
    87 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
    88 	
       
    89 //
       
    90 //TEST 1: Test making call on fax & data line.  Should fail
       
    91 //
       
    92 	
       
    93 	INFO_PRINTF1(_L("Test making call on fax & data line.  Should fail"));
       
    94 	testCallParams1.iLine = CTelephony::EDataLine;
       
    95 	testCallParams1.iExpStat = KErrAccessDenied;
       
    96 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
    97 	CActiveScheduler::Start();
       
    98 	
       
    99 	testCallParams1.iLine = CTelephony::EFaxLine;
       
   100 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   101 	CActiveScheduler::Start();	
       
   102 	
       
   103 //
       
   104 //TEST 2: Test OOM on Dial
       
   105 //
       
   106 #if defined(_DEBUG)
       
   107 	INFO_PRINTF1(_L("Test OOM on for Dial"));
       
   108 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   109 	testCallParams1.iExpStat = KErrNoMemory;
       
   110 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;	
       
   111 	__UHEAP_FAILNEXT(1);	
       
   112 	// Create a call - should fail	
       
   113 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   114 	CActiveScheduler::Start();
       
   115 	__UHEAP_RESET;
       
   116 	
       
   117 	__UHEAP_FAILNEXT(2);	 
       
   118 	// Create a call - should fail
       
   119 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   120 	CActiveScheduler::Start();
       
   121 	__UHEAP_RESET;
       
   122 #endif
       
   123 //
       
   124 //TEST 3: Create & Hangup a single call
       
   125 //
       
   126 
       
   127 	INFO_PRINTF1(_L("Create & Hangup a single call"));
       
   128 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   129 	testCallParams1.iExpStat = KErrNone;		 
       
   130 	// Create a call - should succeed
       
   131 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
   132 	testDialNewCallAct1->TestDialNewCall(testCallParams1, ETrue);
       
   133 	CActiveScheduler::Start();
       
   134 			
       
   135 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   136 	TEST1(err == KErrNone, ETrue);	
       
   137 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   138 	TEST1(testCallParams1.iCallId == CTelephony::EISVCall1, ETrue);
       
   139 	TEST1(callParams1.iIdRestrict == CTelephony::ESendMyId, ETrue);
       
   140 	
       
   141 	// Create an activeHangupAct object
       
   142 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);
       
   143 
       
   144 	testCallParams1.iExpStat = KErrNone;
       
   145 	testHangupAct1->TestHangup(testCallParams1);
       
   146 	CActiveScheduler::Start();
       
   147 	
       
   148 	err = iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
   149 	TEST1(err == KErrNone, ETrue);
       
   150 	TEST1(status.iStatus == CTelephony::EStatusIdle, ETrue);
       
   151 	
       
   152 //
       
   153 //TEST 4: Create 2 calls. try and create a third which should fail
       
   154 //
       
   155 	
       
   156 	INFO_PRINTF1(_L(" Create 2 calls. try and create a third which should fail."));
       
   157 	CTestHoldAct* TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
   158 	
       
   159 	INFO_PRINTF1(_L(" Create first call."));
       
   160 	testCallParams1.iExpStat = KErrNone;
       
   161 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   162 	CActiveScheduler::Start();
       
   163 	
       
   164 	err = iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   165 	TEST1(err == KErrNone, ETrue);	
       
   166 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   167 	TEST1(testCallParams1.iCallId == CTelephony::EISVCall1, ETrue);
       
   168 	
       
   169 	// Create 2nd call - should fail as other call is active
       
   170 	INFO_PRINTF1(_L(" Create first 2nd call - should fail as 1st call active"));
       
   171 	testCallParams2.iExpStat = KErrGeneral;
       
   172 	testDialNewCallAct1->TestDialNewCall(testCallParams2);
       
   173 	CActiveScheduler::Start();
       
   174 	
       
   175 	//put 1st call on hold
       
   176 	INFO_PRINTF1(_L(" Put 1st call on hold."));
       
   177 	testCallParams1.iExpStat=KErrNone;
       
   178 	TestHoldAct->TestHold(testCallParams1);
       
   179 	CActiveScheduler::Start();	
       
   180 	
       
   181 	err = iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   182 	TEST1(err == KErrNone, ETrue);	
       
   183 	TEST1(status.iStatus == CTelephony::EStatusHold, ETrue);
       
   184 	
       
   185 	// Create 2nd call - should suceed
       
   186 	INFO_PRINTF1(_L(" Create 2nd call."));
       
   187 	testCallParams2.iExpStat=KErrNone;
       
   188 	testDialNewCallAct1->TestDialNewCall(testCallParams2);
       
   189 	CActiveScheduler::Start();
       
   190 	
       
   191 	// Create a 3rd call - should fail
       
   192 	INFO_PRINTF1(_L(" Create 3rd call - should fail"));
       
   193 	testCallParams3.iExpStat = KErrAccessDenied;
       
   194 	testDialNewCallAct1->TestDialNewCall(testCallParams3);
       
   195 	CActiveScheduler::Start();			
       
   196 	
       
   197 	//Hangup calls
       
   198 	INFO_PRINTF1(_L("Hangup 1st call"));
       
   199 	testCallParams1.iExpStat = KErrNone;
       
   200 	testHangupAct1->TestHangup(testCallParams1);
       
   201 	CActiveScheduler::Start();
       
   202 	
       
   203 	err = iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
   204 	TEST1(err == KErrNone, ETrue);
       
   205 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   206 	
       
   207 	INFO_PRINTF1(_L("Hangup 2nd call"));
       
   208 	testCallParams1.iExpStat = KErrNone;
       
   209 	testHangupAct1->TestHangup(testCallParams2);
       
   210 	CActiveScheduler::Start();
       
   211 	
       
   212 	err = iTelephony->GetLineStatus(testCallParams2.iLine,  statusPckg);
       
   213 	TEST1(err == KErrNone, ETrue);
       
   214 	TEST1(status.iStatus == CTelephony::EStatusIdle, ETrue);	
       
   215 
       
   216 //
       
   217 //TEST 5: test cancel
       
   218 //
       
   219 	INFO_PRINTF1(_L(" Test dial cancel."));
       
   220 	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EDialNewCallCancel);
       
   221 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   222 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   223 	CTestCanceller* canceller = testDialNewCallAct1->RetrieveCanceller();
       
   224 	canceller->Call();
       
   225 	CActiveScheduler::Start();	
       
   226 	TEST1(testDialNewCallAct1->iStatus.Int() == KErrCancel, ETrue);
       
   227 	
       
   228 //
       
   229 //TEST 6: Test re-dialling after a cancel
       
   230 //
       
   231  	INFO_PRINTF1(_L(" Test dial after a cancel."));
       
   232  	err = iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
   233 	TEST1(status.iStatus == CTelephony::EStatusIdle, ETrue);
       
   234 	
       
   235 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   236 	CActiveScheduler::Start();	
       
   237 	
       
   238 	err = iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   239 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   240 	
       
   241 	
       
   242 	//Hangup calls
       
   243 	INFO_PRINTF1(_L("Hangup call"));
       
   244 	testCallParams1.iExpStat = KErrNone;
       
   245 	testHangupAct1->TestHangup(testCallParams1);
       
   246 	CActiveScheduler::Start();	
       
   247 	
       
   248 	CleanupStack::PopAndDestroy(TestHoldAct);
       
   249 	CleanupStack::PopAndDestroy(testHangupAct1);
       
   250 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
   251 	
       
   252 	return TestStepResult();	
       
   253 }
       
   254 
       
   255 /**
       
   256 Dial New Call Active Object
       
   257 **/
       
   258 CTestDialNewCallAct* CTestDialNewCallAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, TBool aUseMacros)
       
   259 //Factory constructor
       
   260 	{
       
   261 	CTestDialNewCallAct* obj = new(ELeave) CTestDialNewCallAct(aTestStep, aTelephony, NULL, aUseMacros);
       
   262 	CleanupStack::PushL(obj);
       
   263 	obj->ConstructL();
       
   264 	return obj;
       
   265 	}
       
   266 	
       
   267 CTestDialNewCallAct* CTestDialNewCallAct::NewL(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, MActionParent* aParent)
       
   268 //Factory constructor
       
   269 	{
       
   270 	CTestDialNewCallAct* obj = new(ELeave) CTestDialNewCallAct(aTestStep, aTelephony, aParent, ETrue);
       
   271 	CleanupStack::PushL(obj);
       
   272 	obj->ConstructL();
       
   273 	CleanupStack::Pop(obj);
       
   274 	return obj;
       
   275 	}
       
   276 	
       
   277 CTestDialNewCallAct::CTestDialNewCallAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, MActionParent* aParent, TBool aUseMacros)
       
   278     : CEtelIsvActBase(aTestStep, aTelephony)
       
   279     , iParent(aParent)
       
   280     , iUseMacros(aUseMacros) 
       
   281 	{  
       
   282 	}
       
   283 
       
   284 void CTestDialNewCallAct::ConstructL()
       
   285 	{    
       
   286 	iCanceller = new(ELeave) CTestCanceller(this);
       
   287 	CActiveScheduler::Add(this);
       
   288 	}
       
   289 
       
   290 CTestDialNewCallAct::~CTestDialNewCallAct()
       
   291 	{  
       
   292 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
   293 	delete iCanceller;
       
   294 	}
       
   295 
       
   296 void CTestDialNewCallAct::DoCancel()
       
   297 	{
       
   298 	iTelephony->CancelAsync(CTelephony::EDialNewCallCancel);
       
   299 	}
       
   300 
       
   301 void CTestDialNewCallAct::TestDialNewCall(TTestCallParams& aTestCallParams, TBool aCheckConcurrency)
       
   302 	{
       
   303  	iTestCallParams = &aTestCallParams;
       
   304 
       
   305 	// Update the expected return value.
       
   306 	iExpStat=aTestCallParams.iExpStat;
       
   307 	
       
   308 	TDes8* data;
       
   309     
       
   310 	if (iTestStep->iBufferMode)
       
   311  		{
       
   312  		// initialize the buffer first
       
   313 		iCallParamsBuff = *(reinterpret_cast<CTelephony::TCallParamsV1*> ( const_cast<TUint8*> (aTestCallParams.iCallParamsV1Pckg->Ptr() ) ));
       
   314 		data = &iCallParamsBuff;   
       
   315 		}
       
   316 	else
       
   317 		{
       
   318 		data = aTestCallParams.iCallParamsV1Pckg;
       
   319 		}
       
   320 
       
   321         
       
   322 	// Make a new call
       
   323 	iTelephony->DialNewCall(iStatus, *data ,iTestCallParams->iTelAddress.iTelNumber, iTestCallParams->iCallId, iTestCallParams->iLine);
       
   324 	if(aCheckConcurrency)
       
   325 		{
       
   326 		TRequestStatus tmpStatus;
       
   327 		iTelephony->DialNewCall(tmpStatus, *data ,iTestCallParams->iTelAddress.iTelNumber, iTestCallParams->iCallId, iTestCallParams->iLine);
       
   328 		User::WaitForRequest(tmpStatus);
       
   329 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   330 		}
       
   331 	SetActive(); 
       
   332 	}
       
   333 	
       
   334 void CTestDialNewCallAct::RunL()
       
   335 	{
       
   336 	// ActiveScheduler will have set status to KRequestComplete, just before
       
   337 	// calling this RunL().
       
   338 	if(iUseMacros)
       
   339 		{
       
   340 		iTestStep-> INFO_PRINTF1(_L(" CTestDialNewCallAct::RunL "));
       
   341 		iTestStep->INFO_PRINTF2(_L("Request Status returned is: %d"), iStatus.Int()   );
       
   342 
       
   343 		iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
   344 		}
       
   345 
       
   346 	if(iStatus.Int() == KErrNone)
       
   347 		{
       
   348 		if(iUseMacros)
       
   349 			{
       
   350 			iTestStep->INFO_PRINTF1(_L(" KErrNone returned") );
       
   351 			iTestStep->INFO_PRINTF2(_L(" Call ID is %d"), iTestCallParams->iCallId );	
       
   352 
       
   353 			CTelephony::TCallStatusV1 status;
       
   354 			CTelephony::TCallStatusV1Pckg statusPckg(status);
       
   355 
       
   356 			iTelephony->GetCallStatus(iTestCallParams->iCallId,  statusPckg);
       
   357 			iTestStep->INFO_PRINTF2(_L(" Call status is %d"), status.iStatus );
       
   358 			}
       
   359 		}
       
   360 	else
       
   361 		{
       
   362 		if(iUseMacros)
       
   363 			{
       
   364 			iTestStep->INFO_PRINTF2(_L("Request Status expected is: %d"), iExpStat.Int()   ); 
       
   365 			iTestStep->INFO_PRINTF2(_L("Error for dialnewcall: %d"), iStatus.Int() );
       
   366 			}
       
   367 		}
       
   368 	if(!iParent)
       
   369 		CActiveScheduler::Stop();
       
   370 	else
       
   371 		iParent->ActionParent(iStatus.Int(), MActionParent::EDialNewCall);
       
   372 	}
       
   373 	
       
   374  
       
   375 CTestHangup::CTestHangup()
       
   376 /** Each test step initialises it's own name
       
   377 */
       
   378 	{
       
   379 	// store the name of this test case
       
   380 	// this is the name that is used by the script file
       
   381 	SetTestStepName(_L("TestHangup"));
       
   382 	}
       
   383 
       
   384 /**
       
   385 *
       
   386 @SYMTestCaseID Etel3rdParty 10.1
       
   387 @SYMTestCaseDesc Test Hangup 3rd party API
       
   388 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.3
       
   389 */
       
   390 
       
   391 enum TVerdict CTestHangup::doTestStepL()
       
   392 	{
       
   393 	INFO_PRINTF1(_L("CTestHangup::doTestStepL Start"));
       
   394 	
       
   395 	_LIT(KGoodNumber,"1789");
       
   396 	
       
   397 	SetTestNumber(15); 
       
   398 	
       
   399 	//Hangup is been used extensively in other tests.  This test therefore just tests cancelling and trying to 
       
   400 	//hang-up when a call is not active
       
   401 	
       
   402 	//Set the call parameters
       
   403 	CTelephony::TCallParamsV1 callParams1;
       
   404 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
   405 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
   406 	
       
   407 	TTestCallParams testCallParams1;
       
   408 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   409 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
   410 	testCallParams1.iTelAddress.iTelNumber = KGoodNumber;
       
   411 	testCallParams1.iExpStat = KErrNone;
       
   412  
       
   413  	// Create an active HangupAct object
       
   414 	CTestHangupAct* TestHangupAct = CTestHangupAct::NewLC(this, iTelephony);		
       
   415 	// Create active DialNewCallAct objects
       
   416 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
   417 	
       
   418 //
       
   419 //TEST 1: Test Hangup with no active call
       
   420 //
       
   421 
       
   422 	//try hanging up when no call active
       
   423 	testCallParams1.iCallId = CTelephony::EISVCall1;
       
   424 	testCallParams1.iExpStat = KErrAccessDenied;
       
   425 	TestHangupAct->TestHangup(testCallParams1);
       
   426 	CActiveScheduler::Start();
       
   427 	
       
   428 	INFO_PRINTF1(_L(" Create a call."));
       
   429 	testCallParams1.iExpStat = KErrNone;
       
   430 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   431 	CActiveScheduler::Start();
       
   432 	
       
   433 //
       
   434 //TEST 2: Test OOM on Hangup
       
   435 //
       
   436 #if defined(_DEBUG)
       
   437 	INFO_PRINTF1(_L("Test OOM on for Hangup"));
       
   438 	testCallParams1.iExpStat = KErrNoMemory;
       
   439 	__UHEAP_FAILNEXT(1);	
       
   440 	TestHangupAct->TestHangup(testCallParams1);
       
   441 	CActiveScheduler::Start();
       
   442 	__UHEAP_RESET;
       
   443 #endif
       
   444 //
       
   445 //TEST 3: Test make a call and hangup
       
   446 //
       
   447 	
       
   448 	INFO_PRINTF1(_L("Hangup the call"));
       
   449 	testCallParams1.iExpStat = KErrNone;
       
   450 	TestHangupAct->TestHangup(testCallParams1, ETrue);
       
   451 	CActiveScheduler::Start();
       
   452 	
       
   453 //
       
   454 //TEST 4: Test Cancel
       
   455 //
       
   456 
       
   457 	//make a call first
       
   458 	INFO_PRINTF1(_L(" Create a call."));
       
   459 	testCallParams1.iExpStat = KErrNone;
       
   460 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
   461 	CActiveScheduler::Start();	
       
   462 	
       
   463 	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EHangupCancel);
       
   464 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   465 	TestHangupAct->TestHangup(testCallParams1);
       
   466 	CTestCanceller* canceller = TestHangupAct->RetrieveCanceller();
       
   467 	canceller->Call();
       
   468 	CActiveScheduler::Start();
       
   469 	TInt result = TestHangupAct->iStatus.Int();
       
   470 	
       
   471 	if(result == KErrCancel)
       
   472 		{
       
   473 		//call should still be active
       
   474 		CTelephony::TCallStatusV1 status;
       
   475 		CTelephony::TCallStatusV1Pckg statusPckg(status);
       
   476 		TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId,  statusPckg);
       
   477 		TEST1(err == KErrNone, ETrue);	
       
   478 		TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   479 	
       
   480 		//now hangup properly
       
   481 		TestHangupAct->TestHangup(testCallParams1);
       
   482 		CActiveScheduler::Start();
       
   483 		}
       
   484 	else if (result == KErrNone)
       
   485 		{
       
   486 		INFO_PRINTF1(_L("Test Cancel HangUp call: HangUp completed with KErrNone,"));
       
   487 		INFO_PRINTF1(_L("KErrCancel expected. Test Inconclusive."));
       
   488 		SetTestStepResult(EInconclusive);
       
   489 		}
       
   490 	else
       
   491 		{
       
   492 		SetTestStepResult(EFail);	
       
   493 		}
       
   494  
       
   495 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
   496 	CleanupStack::PopAndDestroy(TestHangupAct);
       
   497 	return TestStepResult();
       
   498 	}
       
   499 
       
   500 
       
   501 /**
       
   502 Hangup Active Object
       
   503 **/
       
   504 CTestHangupAct* CTestHangupAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, TBool aUseMacros)
       
   505 //Factory constructor
       
   506 	{
       
   507 	CTestHangupAct* obj = new(ELeave) CTestHangupAct(aTestStep, aTelephony, NULL, aUseMacros);
       
   508 	CleanupStack::PushL(obj);
       
   509 	obj->ConstructL();
       
   510 	return obj;
       
   511 	}
       
   512 	
       
   513 CTestHangupAct* CTestHangupAct::NewL(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, MActionParent* aParent)
       
   514 //Factory constructor
       
   515 	{
       
   516 	CTestHangupAct* obj = new(ELeave) CTestHangupAct(aTestStep, aTelephony, aParent, ETrue);
       
   517 	CleanupStack::PushL(obj);
       
   518 	obj->ConstructL();
       
   519 	CleanupStack::Pop();//obj
       
   520 	return obj;
       
   521 	}
       
   522 	
       
   523 CTestHangupAct::CTestHangupAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, MActionParent* aParent, TBool aUseMacros)
       
   524 	: CEtelIsvActBase(aTestStep, aTelephony)	 
       
   525 	, iParent(aParent)
       
   526     , iUseMacros(aUseMacros)
       
   527 	{  
       
   528 	}
       
   529 
       
   530 void CTestHangupAct::ConstructL()
       
   531 	{    
       
   532 	iCanceller = new(ELeave) CTestCanceller(this);
       
   533 	CActiveScheduler::Add(this);
       
   534 	}
       
   535 
       
   536 CTestHangupAct::~CTestHangupAct()
       
   537 	{  
       
   538 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
   539 	delete iCanceller;
       
   540 	}
       
   541 
       
   542 void CTestHangupAct::DoCancel()
       
   543 	{
       
   544 	iTelephony->CancelAsync(CTelephony::EHangupCancel);
       
   545 	}
       
   546 
       
   547 void CTestHangupAct::TestHangup(TTestCallParams& aTestCallParams, TBool aCheckConcurrency) 
       
   548                
       
   549 	{
       
   550  	iTestCallParams = &aTestCallParams;
       
   551 
       
   552 	// Update the expected return value.
       
   553 	iExpStat=iTestCallParams->iExpStat;
       
   554 
       
   555 	// Hangup existing call
       
   556 	iTelephony->Hangup(iStatus, iTestCallParams->iCallId);
       
   557 	if(aCheckConcurrency)
       
   558 		{
       
   559 		TRequestStatus tmpStatus;
       
   560 		iTelephony->Hangup(tmpStatus, iTestCallParams->iCallId);
       
   561 		User::WaitForRequest(tmpStatus);
       
   562 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   563 		}
       
   564 	SetActive(); 
       
   565 	}
       
   566 	
       
   567 void CTestHangupAct::RunL()
       
   568 	{ 
       
   569 	// ActiveScheduler will have set status to KRequestComplete, just before
       
   570 	// calling this RunL().
       
   571 	if(iUseMacros)
       
   572 		{
       
   573 		iTestStep-> INFO_PRINTF1(_L(" CTestHangupAct::RunL "));
       
   574 		iTestStep->INFO_PRINTF2(_L("Request Status returned is: %d"), iStatus.Int()   );
       
   575 		iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);
       
   576 		}
       
   577 	
       
   578 	if(iStatus.Int() == KErrNone)
       
   579 		{
       
   580 		if(iUseMacros)
       
   581 			{
       
   582 			iTestStep->INFO_PRINTF2(_L(" Call ID is %d"), iTestCallParams->iCallId );	 
       
   583 			}
       
   584 		}
       
   585 		else
       
   586 		{
       
   587 		if(iUseMacros)
       
   588 			{
       
   589 			iTestStep->INFO_PRINTF2(_L("Error for hangup: %d"), iStatus.Int() );
       
   590 			}
       
   591 		}
       
   592 	if(!iParent)
       
   593 		CActiveScheduler::Stop();
       
   594 	else
       
   595 		iParent->ActionParent(iStatus.Int(), MActionParent::EHangup);
       
   596 	}
       
   597 
       
   598 CTestAnswerIncomingCall::CTestAnswerIncomingCall(TInt& aCallCount)
       
   599 /** Each test step initialises it's own name
       
   600 */
       
   601 : iCallCount(aCallCount)
       
   602 	{
       
   603 	// store the name of this test case
       
   604 	// this is the name that is used by the script file
       
   605 	SetTestStepName(_L("TestAnswerIncomingCall"));
       
   606 	}
       
   607 
       
   608 /**
       
   609 *
       
   610 @SYMTestCaseID Etel3rdParty 11.1
       
   611 @SYMTestCaseDesc Test AnswerIncomingCall 3rd party API
       
   612 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.5, INC074753 
       
   613 */
       
   614 enum TVerdict CTestAnswerIncomingCall::doTestStepL()
       
   615 	{
       
   616 	INFO_PRINTF1(_L("CTestAnswerIncomingCall::doTestStepL Start"));
       
   617 	
       
   618 	SetTestNumber(15); 
       
   619 	
       
   620 	_LIT(KGoodNumber,"1789");
       
   621 	
       
   622 	//Set the call parameters to receive call 1
       
   623 	TTestCallParams testCallParams1;
       
   624 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   625 	testCallParams1.iCallParamsV1Pckg = NULL;
       
   626 	testCallParams1.iExpStat = KErrNone;
       
   627 	
       
   628 	//Set the call parameters for MO call 1
       
   629 	CTelephony::TCallParamsV1 callParams1;
       
   630 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
   631 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
   632 	
       
   633 	TTestCallParams testMOCallParams1;
       
   634 	testMOCallParams1.iLine = CTelephony::EVoiceLine;
       
   635 	testMOCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
   636 	testMOCallParams1.iTelAddress.iTelNumber = KGoodNumber;
       
   637 	testMOCallParams1.iExpStat = KErrNone; 
       
   638 	
       
   639 	
       
   640 	//Set the call parameters for MO call 2
       
   641 	CTelephony::TCallParamsV1 callParams2;
       
   642 	callParams2.iIdRestrict = CTelephony::ESendMyId;
       
   643 	CTelephony::TCallParamsV1Pckg callParamsPckg2(callParams2);	
       
   644 	
       
   645 	TTestCallParams testMOCallParams2;
       
   646 	testMOCallParams2.iLine = CTelephony::EVoiceLine;
       
   647 	testMOCallParams2.iCallParamsV1Pckg = &callParamsPckg2;
       
   648 	testMOCallParams2.iTelAddress.iTelNumber = KGoodNumber;
       
   649 	testMOCallParams2.iExpStat = KErrNone; 
       
   650 	
       
   651 	// Create an active AnswerIncomingCallAct object
       
   652 	CTestAnswerIncomingCallAct* testAnswerIncomingCallAct1 = CTestAnswerIncomingCallAct::NewLC(this, iTelephony);
       
   653 	
       
   654 //
       
   655 //TEST 1: Test answering call on fax & data line.  Should fail
       
   656 //
       
   657 	
       
   658 	INFO_PRINTF1(_L("Test answering call on fax & data line.  Should fail"));
       
   659 	testCallParams1.iLine = CTelephony::EDataLine;
       
   660 	testCallParams1.iExpStat = KErrAccessDenied;
       
   661 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   662 	CActiveScheduler::Start();
       
   663 	
       
   664 	testCallParams1.iLine = CTelephony::EFaxLine;
       
   665 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   666 	CActiveScheduler::Start();	
       
   667 
       
   668 //
       
   669 //TEST 2: Test AnswerIncomingCall with no ringing call
       
   670 //
       
   671 	INFO_PRINTF1(_L("Test answering call with no ringing"));
       
   672 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
   673 	testCallParams1.iExpStat = KErrAccessDenied;
       
   674 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   675 	CActiveScheduler::Start();
       
   676 	
       
   677 	//initiate callback
       
   678 	testAnswerIncomingCallAct1->CallMe(iCallCount);
       
   679 	 
       
   680 //
       
   681 //TEST 2: Test OOM on AnswerIncomingCall
       
   682 //
       
   683 #if defined(_DEBUG)
       
   684 	INFO_PRINTF1(_L("Test answering call with OOM"));
       
   685 	testCallParams1.iExpStat = KErrNoMemory;
       
   686 	__UHEAP_FAILNEXT(1);
       
   687 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   688 	CActiveScheduler::Start();
       
   689 	__UHEAP_RESET;
       
   690 #endif
       
   691  	
       
   692 //
       
   693 //TEST 3: Test answering call & hanging up on voice line 
       
   694 //	
       
   695 	INFO_PRINTF1(_L("Test answering call with hangup"));
       
   696 
       
   697 	CTelephony::TCallInfoV1 callInfoV1;
       
   698 	CTelephony::TCallInfoV1Pckg callInfoV1Pckg(callInfoV1);
       
   699 	CTelephony::TRemotePartyInfoV1 remoteInfoV1;
       
   700 	CTelephony::TRemotePartyInfoV1Pckg remoteInfoV1Pckg(remoteInfoV1);
       
   701 	
       
   702 	CTelephony::TCallSelectionV1 callSelection;
       
   703 	CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg(callSelection);
       
   704 	callSelection.iSelect = CTelephony::EInProgressCall;
       
   705 	callSelection.iLine = CTelephony::EVoiceLine;
       
   706 	
       
   707 	TInt err = iTelephony->GetCallInfo(callSelectionV1Pckg, callInfoV1Pckg, remoteInfoV1Pckg);
       
   708 
       
   709 	testCallParams1.iExpStat = KErrNone;
       
   710 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1, ETrue);
       
   711 	CActiveScheduler::Start();
       
   712 	TEST1(testCallParams1.iCallId == CTelephony::EISVCall1, ETrue);
       
   713 		
       
   714 	CTelephony::TCallStatusV1 status;
       
   715 	CTelephony::TCallStatusV1Pckg statusPckg(status);		
       
   716 	iTelephony->GetLineStatus(testCallParams1.iLine, statusPckg);
       
   717 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   718 	
       
   719 	iTelephony->GetCallStatus(testCallParams1.iCallId, statusPckg);
       
   720 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   721 	
       
   722 	//and hangup
       
   723 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);		
       
   724 	
       
   725 	testHangupAct1->TestHangup(testCallParams1);
       
   726 	CActiveScheduler::Start();
       
   727 	
       
   728 //
       
   729 //TEST 4: Test dialling a call & answering a 2nd call
       
   730 //	
       
   731 	INFO_PRINTF1(_L("Test dial a call & answering call."));
       
   732 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
   733 	INFO_PRINTF1(_L("Create a single call"));
       
   734 	// Create a call - should succeed
       
   735 	testMOCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
   736 	testDialNewCallAct1->TestDialNewCall(testMOCallParams1);
       
   737 	CActiveScheduler::Start();
       
   738 	
       
   739 	iTelephony->GetCallStatus(testMOCallParams1.iCallId, statusPckg);
       
   740 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   741 	
       
   742 	//initiate callback
       
   743 	testAnswerIncomingCallAct1->CallMe(iCallCount);
       
   744 	
       
   745 	iTelephony->GetLineStatus(testMOCallParams1.iLine,  statusPckg);
       
   746 	TEST1(status.iStatus == CTelephony::EStatusRinging, ETrue);
       
   747 	
       
   748 	//put 1st call on hold
       
   749 	CTestHoldAct* TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
   750 	INFO_PRINTF1(_L(" Put 1st call on hold."));
       
   751 	testCallParams1.iExpStat=KErrNone;
       
   752 	TestHoldAct->TestHold(testCallParams1);
       
   753 	CActiveScheduler::Start();
       
   754 	CleanupStack::PopAndDestroy(TestHoldAct);
       
   755 	
       
   756 	iTelephony->GetCallStatus(testMOCallParams1.iCallId, statusPckg);
       
   757 	TEST1(status.iStatus == CTelephony::EStatusHold, ETrue);
       
   758 	
       
   759 	//answer a call
       
   760 	testCallParams1.iExpStat = KErrNone;
       
   761 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   762 	CActiveScheduler::Start();
       
   763 	
       
   764 	iTelephony->GetCallStatus(testCallParams1.iCallId, statusPckg);
       
   765 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   766 	
       
   767 	//try and make a 3rd call - should fail
       
   768 	testMOCallParams2.iExpStat = KErrAccessDenied;
       
   769 	testDialNewCallAct1->TestDialNewCall(testMOCallParams2);
       
   770 	CActiveScheduler::Start();
       
   771 		
       
   772 	//Hangup calls
       
   773 	testCallParams1.iExpStat = KErrNone;
       
   774 	testHangupAct1->TestHangup(testCallParams1);
       
   775 	CActiveScheduler::Start();
       
   776 	
       
   777 	testHangupAct1->TestHangup(testMOCallParams1);
       
   778 	CActiveScheduler::Start();	
       
   779 	
       
   780 //
       
   781 //TEST 5: Test Cancel
       
   782 //
       
   783 	INFO_PRINTF1(_L("Test answering call cancel"));
       
   784 	
       
   785 	//initiate callback
       
   786 	testAnswerIncomingCallAct1->CallMe(iCallCount);	
       
   787 	
       
   788 	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EAnswerIncomingCallCancel);
       
   789 	TEST1(cancelerr == KErrNotFound, ETrue);
       
   790 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   791 	CTestCanceller* canceller = testAnswerIncomingCallAct1->RetrieveCanceller();
       
   792 	canceller->Call();
       
   793 	CActiveScheduler::Start();	
       
   794 	TEST1(testAnswerIncomingCallAct1->iStatus.Int() == KErrNone, ETrue);
       
   795 	
       
   796 	iTelephony->GetCallStatus(testCallParams1.iCallId, statusPckg);
       
   797 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   798 	
       
   799 	//NOTE: Attempting to Cancel an AnswerIncomingCall fails.  The specs say you can disconnect from
       
   800 	//an answering state but this is not implemented in the SIM TSY which means the cancel request fails.
       
   801 	
       
   802 	//Hangup calls
       
   803 	testCallParams1.iExpStat = KErrNone;
       
   804 	testHangupAct1->TestHangup(testCallParams1);
       
   805 	CActiveScheduler::Start();
       
   806 	
       
   807 	
       
   808 //
       
   809 //TEST 6: Test Answer call after a cancel
       
   810 //
       
   811 	INFO_PRINTF1(_L("Test answering call after a cancel"));
       
   812 	
       
   813 	//initiate callback
       
   814 	testAnswerIncomingCallAct1->CallMe(iCallCount);	
       
   815 	
       
   816 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
   817 	CActiveScheduler::Start();	
       
   818 	
       
   819 	iTelephony->GetCallStatus(testCallParams1.iCallId, statusPckg);
       
   820 	TEST1(status.iStatus == CTelephony::EStatusConnected, ETrue);
       
   821 	
       
   822 	//Hangup calls
       
   823 	testCallParams1.iExpStat = KErrNone;
       
   824 	testHangupAct1->TestHangup(testCallParams1);
       
   825 	CActiveScheduler::Start();
       
   826 
       
   827 	
       
   828 //
       
   829 //TEST 7: Test Answer call when no notification of incoming call received
       
   830 //
       
   831 	INFO_PRINTF1(_L("Test answering call when no notification of incoming call received."));
       
   832  
       
   833  	SetTestNumber(38);
       
   834  
       
   835 	//Set the call parameters for call
       
   836 	CTelephony::TCallParamsV1 callParams3;
       
   837 	//callParams1.iIdRestrict = CTelephony::ESendMyId;
       
   838 	CTelephony::TCallParamsV1Pckg callParamsPckg3(callParams3);	
       
   839 	
       
   840 	TTestCallParams testCallParams3;
       
   841 	testCallParams3.iLine = CTelephony::EVoiceLine;
       
   842 	testCallParams3.iCallParamsV1Pckg = &callParamsPckg3;
       
   843 	testCallParams3.iTelAddress.iTelNumber = KGoodNumber;
       
   844 	testCallParams3.iExpStat = KErrTimedOut; 
       
   845 
       
   846 	CTelephony::TCallStatusV1 status2;
       
   847 	CTelephony::TCallStatusV1Pckg statusPckg2(status2);		
       
   848 	iTelephony->GetLineStatus(testCallParams3.iLine, statusPckg2);
       
   849 	TEST1(status2.iStatus == CTelephony::EStatusIdle, ETrue);
       
   850  	
       
   851  	// Initiate callback
       
   852 	testAnswerIncomingCallAct1->CallMe(iCallCount);
       
   853 	
       
   854 	iTelephony->GetLineStatus(testCallParams3.iLine,  statusPckg2);
       
   855 	TEST1(status2.iStatus == CTelephony::EStatusRinging, ETrue);
       
   856  	
       
   857  	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams3);
       
   858  	CActiveScheduler::Start();
       
   859 
       
   860 //
       
   861 //TEST 8: Test Answer call when notify incoming call completes 
       
   862 //        when answer incoming call is waiting for it. 
       
   863 //
       
   864  	
       
   865  	// NOTE - This test tries to force the incoming call notification to complete
       
   866  	// when AnswerIncomingCall is doing its one second wait. The 
       
   867  	// NotifyIncomingCallPauseDuration in the config file may have to be adjusted to make 
       
   868  	// sure this happens on your computer.  	
       
   869  	INFO_PRINTF1(_L("Test answering call when answer incoming call needs to wait for the call name"));
       
   870 	INFO_PRINTF1(_L("NOTE: This test forces simtsy to delay sending the incoming call notification"));
       
   871 	INFO_PRINTF1(_L("(which provides the call name) when an incoming call arrives."));
       
   872 	INFO_PRINTF1(_L("CAnswerIncomingCallAct will wait up to one second it. This test will fail if"));
       
   873 	INFO_PRINTF1(_L("the computer running this test is running slowly causing the notification to arrive"));
       
   874 	INFO_PRINTF1(_L("too late."));
       
   875  	
       
   876  	SetTestNumber(39);
       
   877  	
       
   878  	testCallParams3.iExpStat = KErrNone;
       
   879  	
       
   880  	 // Initiate callback
       
   881 	testAnswerIncomingCallAct1->CallMe(iCallCount);
       
   882 	
       
   883 	iTelephony->GetLineStatus(testCallParams3.iLine,  statusPckg2);
       
   884 	TEST1(status2.iStatus == CTelephony::EStatusRinging, ETrue);
       
   885  	
       
   886  	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams3);
       
   887  	CActiveScheduler::Start();	
       
   888  	 
       
   889 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
   890 	CleanupStack::PopAndDestroy(testHangupAct1); 
       
   891 	CleanupStack::PopAndDestroy(testAnswerIncomingCallAct1); //testAnswerIncomingCallAct1
       
   892 	return TestStepResult();	
       
   893 	}
       
   894 
       
   895  
       
   896 CTestAnswerIncomingCallAct* CTestAnswerIncomingCallAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
   897 //Factory constructor
       
   898 	{
       
   899 	CTestAnswerIncomingCallAct* obj = new(ELeave) CTestAnswerIncomingCallAct(aTestStep, aTelephony, NULL);
       
   900 	CleanupStack::PushL(obj);
       
   901 	obj->ConstructL();
       
   902 	return obj;
       
   903 	}
       
   904 	
       
   905 CTestAnswerIncomingCallAct* CTestAnswerIncomingCallAct::NewL(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, MActionParent* aParent)
       
   906 //Factory constructor
       
   907 	{
       
   908 	CTestAnswerIncomingCallAct* obj = new(ELeave) CTestAnswerIncomingCallAct(aTestStep, aTelephony, aParent);
       
   909 	CleanupStack::PushL(obj);
       
   910 	obj->ConstructL();
       
   911 	CleanupStack::Pop(obj);
       
   912 	return obj;
       
   913 	}
       
   914 		
       
   915 CTestAnswerIncomingCallAct::CTestAnswerIncomingCallAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony, MActionParent* aParent)
       
   916 	: CEtelIsvActBase(aTestStep, aTelephony)
       
   917 	, iParent(aParent)	 
       
   918 	{  
       
   919 	}
       
   920 
       
   921 void CTestAnswerIncomingCallAct::ConstructL()
       
   922 	{    
       
   923 	iCanceller = new(ELeave) CTestCanceller(this);
       
   924 	CActiveScheduler::Add(this);
       
   925 	}
       
   926 
       
   927 CTestAnswerIncomingCallAct::~CTestAnswerIncomingCallAct()
       
   928 	{  
       
   929 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
   930 	delete iCanceller;
       
   931 	}
       
   932 
       
   933 void CTestAnswerIncomingCallAct::DoCancel()
       
   934 	{
       
   935 	iTelephony->CancelAsync(CTelephony::EAnswerIncomingCallCancel);
       
   936 	}
       
   937 
       
   938 void CTestAnswerIncomingCallAct::TestAnswerIncomingCall(TTestCallParams& aTestCallParams, TBool aCheckConcurrency) 
       
   939 	{
       
   940 	// Update the expected return value.
       
   941 	iTestCallParams = &aTestCallParams;
       
   942 
       
   943 	// Update the expected return value.
       
   944 	iExpStat=aTestCallParams.iExpStat;
       
   945 
       
   946 	// Answer incoming call
       
   947 	iTelephony->AnswerIncomingCall(iStatus, iTestCallParams->iCallId, iTestCallParams->iLine);
       
   948 	if(aCheckConcurrency)
       
   949 		{
       
   950 		TRequestStatus tmpStatus;
       
   951 		iTelephony->AnswerIncomingCall(tmpStatus, iTestCallParams->iCallId, iTestCallParams->iLine);
       
   952 		User::WaitForRequest(tmpStatus);
       
   953 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
   954 		}
       
   955 	SetActive(); 
       
   956 	}
       
   957 	
       
   958 void CTestAnswerIncomingCallAct::RunL()
       
   959 	{ 
       
   960 	// ActiveScheduler will have set status to KRequestComplete, just before
       
   961 	// calling this RunL().
       
   962 	iTestStep->INFO_PRINTF1(_L(" CTestAnswerIncomingCallAct::RunL "));
       
   963 	iTestStep->INFO_PRINTF2(_L("Request Status returned is: %d"), iStatus.Int()   );
       
   964 	iTestStep->INFO_PRINTF2(_L("Expected Status: %d"), iExpStat.Int());
       
   965 		
       
   966 	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), ETrue);	
       
   967 	
       
   968 	if(iStatus.Int() == KErrNone)
       
   969 		{
       
   970 		iTestStep->INFO_PRINTF1(_L(" KErrNone returned") );
       
   971 		iTestStep->INFO_PRINTF2(_L(" Call ID = %d"), iTestCallParams->iCallId);	 
       
   972 		}
       
   973 	else
       
   974 		{
       
   975 		iTestStep->INFO_PRINTF2(_L("Error for AnswerIncomingCall: %d"), iStatus.Int() );
       
   976 		}
       
   977 
       
   978 	if(!iParent)
       
   979 		CActiveScheduler::Stop();
       
   980 	else
       
   981 		iParent->ActionParent(iStatus.Int(), MActionParent::EAnswerIncomingCall);
       
   982 	}
       
   983 
       
   984 CTestHold::CTestHold()
       
   985 /** Each test step initialises it's own name
       
   986 */
       
   987 {
       
   988 	// store the name of this test case
       
   989 	// this is the name that is used by the script file
       
   990 	SetTestStepName(_L("TestHold"));
       
   991 }
       
   992 
       
   993 /**
       
   994 *
       
   995 @SYMTestCaseID Etel3rdParty 12.1
       
   996 @SYMTestCaseDesc Test Hold 3rd party API
       
   997 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.7
       
   998 */
       
   999   
       
  1000 enum TVerdict CTestHold::doTestStepL()
       
  1001 {
       
  1002 	INFO_PRINTF1(_L("CTestHold::doTestStepL Start"));
       
  1003 	
       
  1004 	_LIT(KCallNumber1,"1789");
       
  1005 	
       
  1006 	// Set mapping to config.txt 
       
  1007 	SetTestNumber(15); 
       
  1008 	
       
  1009 	//Set the call parameters for a basic call. 
       
  1010 	CTelephony::TCallParamsV1 callParams1;
       
  1011 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
  1012 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
  1013 	
       
  1014 	TTestCallParams testCallParams1;
       
  1015 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  1016 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  1017 	testCallParams1.iTelAddress.iTelNumber = KCallNumber1;
       
  1018 	testCallParams1.iExpStat = KErrNone; 
       
  1019 	
       
  1020 	//
       
  1021 	//
       
  1022 	// TEST 1: OOM error case
       
  1023 	// Make a call. Put the call on hold. 
       
  1024 	//
       
  1025 	//
       
  1026 	
       
  1027 	INFO_PRINTF1(_L("HOLD TEST 1 Make call.Set OOM condition. Attempt to put call on hold."));
       
  1028 	
       
  1029 	// Create an active DialNewCallAct object
       
  1030 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  1031 	
       
  1032 	// Create an active TestHoldAct object
       
  1033 	CTestHoldAct* TestHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
  1034 	  
       
  1035 	// Create a call
       
  1036 	testCallParams1.iExpStat=KErrNone;	
       
  1037 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1038 	CActiveScheduler::Start();
       
  1039 	
       
  1040 	//while call is active test OOM before first hold call
       
  1041 	#if defined(_DEBUG)
       
  1042 	INFO_PRINTF1(_L("Test OOM on for Hold"));
       
  1043 	testCallParams1.iExpStat = KErrNoMemory;
       
  1044 	__UHEAP_FAILNEXT(1);	
       
  1045 	TestHoldAct->TestHold(testCallParams1);
       
  1046 	CActiveScheduler::Start(); 
       
  1047 	__UHEAP_RESET;
       
  1048 	#endif
       
  1049 	
       
  1050 	INFO_PRINTF1(_L("END TEST 1"));
       
  1051 
       
  1052 	//
       
  1053 	//
       
  1054 	// TEST 2: Normal case
       
  1055 	// Make a call. Put the call on hold. 
       
  1056 	//
       
  1057 	//
       
  1058 
       
  1059 	INFO_PRINTF1(_L("HOLD TEST 2 Call active. Hold call. "));
       
  1060 	
       
  1061 	// Put the call on hold.
       
  1062 	// by calling the ETEL 3rd party API
       
  1063 	  
       
  1064 	testCallParams1.iExpStat=KErrNone;
       
  1065 	TestHoldAct->TestHold(testCallParams1, ETrue);
       
  1066 	CActiveScheduler::Start();
       
  1067 		 
       
  1068  
       
  1069 	// Check that the call is now at held status.
       
  1070 	CTelephony::TCallStatusV1 CallStatusV1;
       
  1071 	CTelephony::TCallStatusV1Pckg CallStatusPckg(CallStatusV1);
       
  1072 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1073 	TEST1(err == KErrNone,1);
       
  1074 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);	
       
  1075 	 
       
  1076 	INFO_PRINTF1(_L("END TEST 2"));
       
  1077 	
       
  1078 	//
       
  1079 	//
       
  1080 	// TEST 3: Error case
       
  1081 	// Call is already on hold. Try to perform a hold on the call.
       
  1082 	//
       
  1083 	//
       
  1084 	
       
  1085 	INFO_PRINTF1(_L("HOLD TEST 3. Call already held. Call hold API.")); 
       
  1086 	
       
  1087 	// Call 3rd Party hold API
       
  1088 	testCallParams1.iExpStat=KErrAccessDenied;
       
  1089 	TestHoldAct->TestHold(testCallParams1);
       
  1090 	CActiveScheduler::Start();
       
  1091 			 
       
  1092 	// Make sure call is still in held status
       
  1093 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1094 	TEST1(err == KErrNone,1);
       
  1095 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);	
       
  1096 	
       
  1097 	INFO_PRINTF1(_L("END TEST 3"));
       
  1098 	
       
  1099 	//
       
  1100 	//
       
  1101 	// TEST 4: Error case
       
  1102 	// Hang up a call. Try to put the call on hold.
       
  1103 	//
       
  1104 	//
       
  1105 	
       
  1106 	INFO_PRINTF1(_L("HOLD TEST 4 Hangup call. Try to put on hold."));
       
  1107 	
       
  1108 	// Call hangup 3rd party API
       
  1109 	testCallParams1.iExpStat=KErrNone;	
       
  1110 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);	
       
  1111 	testHangupAct1->TestHangup(testCallParams1);
       
  1112 	CActiveScheduler::Start();	
       
  1113  
       
  1114 	// Make sure the line is idle
       
  1115 	err = iTelephony->GetLineStatus(testCallParams1.iLine, CallStatusPckg);
       
  1116 	TEST1(err == KErrNone,1);
       
  1117 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusIdle,1);	
       
  1118  
       
  1119  	// Attempt to hold call. Should fail. 
       
  1120 	testCallParams1.iExpStat=KErrAccessDenied;	 
       
  1121 	TestHoldAct->TestHold(testCallParams1);
       
  1122 	CActiveScheduler::Start();
       
  1123 	
       
  1124 	// Make sure call is still in idle status
       
  1125 	err = iTelephony->GetLineStatus(testCallParams1.iLine, CallStatusPckg);
       
  1126 	TEST1(err == KErrNone,1);
       
  1127 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusIdle,1);	
       
  1128 	
       
  1129 	INFO_PRINTF1(_L("END TEST 4"));	
       
  1130 	
       
  1131 	//
       
  1132 	//
       
  1133 	// TEST 5: Test cancel
       
  1134 	// Dial call. Make a request to hold call. Attempt to cancel 
       
  1135 	// the request.
       
  1136 	//
       
  1137 	//
       
  1138 	
       
  1139 	INFO_PRINTF1(_L("TEST5 Hold call. Cancel hold request"));
       
  1140 	
       
  1141 	// Make a new call
       
  1142 	testCallParams1.iExpStat=KErrNone;		
       
  1143 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1144 	CActiveScheduler::Start();
       
  1145 
       
  1146 	// Request the call to be held then
       
  1147  	// attempt to cancel the hold request
       
  1148  	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EHoldCancel);
       
  1149 	TEST1(cancelerr == KErrNotFound, ETrue);
       
  1150  	testCallParams1.iExpStat=KErrNone;	
       
  1151 	CTestCanceller* canceller = TestHoldAct->RetrieveCanceller();
       
  1152 	TestHoldAct->TestHold(testCallParams1);
       
  1153 	canceller->Call();
       
  1154 	CActiveScheduler::Start();	
       
  1155 	
       
  1156 	// Status will be KErrCancel if the hold request has been cancelled.
       
  1157 	// It may be KErrNone if the hold request has managed to complete before 
       
  1158 	// execution of the cancel.
       
  1159 	TEST1(((TestHoldAct->iStatus.Int() == KErrCancel) || 
       
  1160 	        (TestHoldAct->iStatus.Int() == KErrNone)), 1);
       
  1161 
       
  1162 	INFO_PRINTF1(_L("END TEST 5"));	
       
  1163 	
       
  1164 	
       
  1165 	// Hang up the call for completion.
       
  1166 	testCallParams1.iExpStat=KErrNone;	
       
  1167 	testHangupAct1->TestHangup(testCallParams1);
       
  1168 	CActiveScheduler::Start();		
       
  1169  
       
  1170 	CleanupStack::PopAndDestroy(testHangupAct1);
       
  1171 	CleanupStack::PopAndDestroy(TestHoldAct);
       
  1172 	CleanupStack::PopAndDestroy(testDialNewCallAct1);	
       
  1173 	
       
  1174 	return TestStepResult();
       
  1175 	
       
  1176 }
       
  1177 
       
  1178  
       
  1179 CTestHoldAct* CTestHoldAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
  1180 //Factory constructor
       
  1181 	{
       
  1182 	CTestHoldAct* obj = new(ELeave) CTestHoldAct(aTestStep, aTelephony);
       
  1183 	CleanupStack::PushL(obj);
       
  1184 	obj->ConstructL();
       
  1185 	return obj;
       
  1186 	}
       
  1187 	
       
  1188 CTestHoldAct::CTestHoldAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
  1189 	: CEtelIsvActBase(aTestStep, aTelephony)	 
       
  1190 	{  
       
  1191 	}
       
  1192 
       
  1193 void CTestHoldAct::ConstructL()
       
  1194 	{    
       
  1195 	iCanceller = new(ELeave) CTestCanceller(this);
       
  1196 	CActiveScheduler::Add(this);
       
  1197 	}
       
  1198 
       
  1199 CTestHoldAct::~CTestHoldAct()
       
  1200 	{  
       
  1201 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
  1202 	delete iCanceller;
       
  1203 	}
       
  1204 
       
  1205 void CTestHoldAct::DoCancel()
       
  1206 	{
       
  1207 	iTelephony->CancelAsync(CTelephony::EHoldCancel);
       
  1208 	}
       
  1209 
       
  1210 void CTestHoldAct::TestHold(TTestCallParams& aTestCallParams, TBool aCheckConcurrency) 
       
  1211 	{
       
  1212 	// Update the expected return value.
       
  1213 	iExpStat=aTestCallParams.iExpStat;
       
  1214 	 
       
  1215 	iTelephony->Hold(iStatus, aTestCallParams.iCallId);
       
  1216 	if(aCheckConcurrency)
       
  1217 		{
       
  1218 		TRequestStatus tmpStatus;
       
  1219 		iTelephony->Hold(tmpStatus, aTestCallParams.iCallId);
       
  1220 		User::WaitForRequest(tmpStatus);
       
  1221 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
  1222 		}
       
  1223 	SetActive(); 
       
  1224  
       
  1225 	}
       
  1226 	
       
  1227 void CTestHoldAct::RunL()
       
  1228 	{ 
       
  1229 	// ActiveScheduler will have set status to KRequestComplete, just before
       
  1230 	// calling this RunL().
       
  1231 	
       
  1232 	iTestStep-> INFO_PRINTF1(_L(" CTestHoldAct::RunL "));
       
  1233 	iTestStep->INFO_PRINTF2(_L("Request Status expected is: %d"), iExpStat.Int()   );
       
  1234 	iTestStep->INFO_PRINTF2(_L("Request Status returned is: %d"), iStatus.Int()   );
       
  1235 	
       
  1236  	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), 1);	
       
  1237 	CActiveScheduler::Stop();
       
  1238 	}
       
  1239 
       
  1240 
       
  1241 
       
  1242 CTestResume::CTestResume()
       
  1243 /** Each test step initialises it's own name
       
  1244 */
       
  1245 {
       
  1246 	// store the name of this test case
       
  1247 	// this is the name that is used by the script file
       
  1248 	SetTestStepName(_L("TestResume"));
       
  1249 }
       
  1250 
       
  1251 /**
       
  1252 @SYMTestCaseID Etel3rdParty 13.1, TestResume
       
  1253 @SYMTestCaseDesc Test Resume 3rd party API
       
  1254 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.8
       
  1255 */
       
  1256 
       
  1257 enum TVerdict CTestResume::doTestStepL()
       
  1258 { 
       
  1259 	
       
  1260 	 INFO_PRINTF1(_L("CTestResume::doTestStepL Start"));
       
  1261 	
       
  1262 	_LIT(KCallNumber1,"1789");
       
  1263 	
       
  1264 	SetTestNumber(15); 
       
  1265 	
       
  1266 	//Set the call parameters  
       
  1267 	CTelephony::TCallParamsV1 callParams1;
       
  1268 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
  1269 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
  1270 	
       
  1271 	TTestCallParams testCallParams1;
       
  1272 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  1273 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  1274 	testCallParams1.iTelAddress.iTelNumber = KCallNumber1;
       
  1275 	testCallParams1.iExpStat = KErrNone;
       
  1276 	
       
  1277 	//
       
  1278 	//
       
  1279 	// TEST 1: OOM error scenario
       
  1280 	// Make a call. Put the call on hold. Attempt to resume the call.
       
  1281 	//
       
  1282 	//
       
  1283 	
       
  1284 	INFO_PRINTF1(_L("RESUME TEST 1 Make call. Put call on hold. Test OOM condition."));
       
  1285 	
       
  1286 	// Create the active objects for a basic call
       
  1287 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  1288 	CTestHoldAct* testHoldAct1 = CTestHoldAct::NewLC(this, iTelephony);
       
  1289 	CTestResumeAct* testResumeAct1 = CTestResumeAct::NewLC(this, iTelephony);	
       
  1290 	  
       
  1291 	// Make a call
       
  1292 	testCallParams1.iExpStat = KErrNone; 
       
  1293 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1294 	CActiveScheduler::Start();
       
  1295 	
       
  1296 	// Put the call on hold.
       
  1297 	// using the ETEL 3rd party API
       
  1298 	testCallParams1.iExpStat = KErrNone;		
       
  1299 	testHoldAct1->TestHold(testCallParams1);
       
  1300 	CActiveScheduler::Start();
       
  1301 
       
  1302 	//while call is on hold test OOM before first resume call
       
  1303 	#if defined(_DEBUG)
       
  1304 		INFO_PRINTF1(_L("Test OOM on for Resume"));
       
  1305 		testCallParams1.iExpStat = KErrNoMemory;
       
  1306 		__UHEAP_FAILNEXT(1);	
       
  1307 		testResumeAct1->TestResume(testCallParams1);
       
  1308 		CActiveScheduler::Start(); 
       
  1309 		__UHEAP_RESET;
       
  1310 	#endif
       
  1311 
       
  1312 	INFO_PRINTF1(_L("END TEST 1"));	 
       
  1313 	
       
  1314 	//
       
  1315 	//
       
  1316 	// TEST 2: Normal scenario
       
  1317 	// Call is at hold status. Resume the call.
       
  1318 	//
       
  1319 	//
       
  1320 	
       
  1321 	INFO_PRINTF1(_L("RESUME TEST 2 Call held. Resume call."));
       
  1322 	
       
  1323 	// Check that the call is now at held status.
       
  1324 	CTelephony::TCallStatusV1 CallStatusV1;
       
  1325 	CTelephony::TCallStatusV1Pckg CallStatusPckg(CallStatusV1);
       
  1326 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1327 	TEST1(err == KErrNone,1);
       
  1328 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold, 1);
       
  1329 	
       
  1330 	// Resume the call using the ETEL 3rdparty API
       
  1331 	testCallParams1.iExpStat = KErrNone;		
       
  1332 	testResumeAct1->TestResume(testCallParams1, ETrue);
       
  1333 	CActiveScheduler::Start();
       
  1334  
       
  1335  	// Check that the call is now at active status.
       
  1336 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1337 	TEST1(err == KErrNone,1);
       
  1338 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  1339 		
       
  1340 	INFO_PRINTF1(_L("END TEST 2"));	 
       
  1341 	
       
  1342 	//
       
  1343 	//
       
  1344 	// TEST 3: Error scenario
       
  1345 	// Call is already active. Try to perform a resume on the call.
       
  1346 	//
       
  1347 	//
       
  1348 	
       
  1349 	INFO_PRINTF1(_L("RESUME TEST 3 Attempt to resume an active call"));
       
  1350 	 
       
  1351 	// Call is currently active from previous test
       
  1352 	// Call resume 3rd party API
       
  1353 	testCallParams1.iExpStat=KErrAccessDenied;
       
  1354 	testResumeAct1->TestResume(testCallParams1);
       
  1355 	CActiveScheduler::Start();		
       
  1356 	 
       
  1357 	// Make sure call is still in connected status
       
  1358 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1359 	TEST1(err == KErrNone,1);
       
  1360 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  1361 	
       
  1362 	INFO_PRINTF1(_L("END TEST 3"));	 
       
  1363 	
       
  1364 	//
       
  1365 	//
       
  1366 	// TEST 4: Error scenario
       
  1367 	// Hang up a call. Try to resume the call.
       
  1368 	//
       
  1369 	//
       
  1370 	
       
  1371 	INFO_PRINTF1(_L("RESUME TEST 4 Attempt to resume an idle call"));
       
  1372 	 
       
  1373 	// Hangup the active call
       
  1374 	testCallParams1.iExpStat=KErrNone;
       
  1375 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);	
       
  1376 	testHangupAct1->TestHangup(testCallParams1);
       
  1377 	CActiveScheduler::Start();	
       
  1378 	
       
  1379 	// Make sure the line is idle
       
  1380 	err = iTelephony->GetLineStatus(testCallParams1.iLine, CallStatusPckg);
       
  1381 	TEST1(err == KErrNone,1);
       
  1382 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusIdle,1);	
       
  1383  
       
  1384  	// Attempt to resume call. Should fail. 
       
  1385 	testCallParams1.iExpStat=KErrAccessDenied;	 
       
  1386 	testResumeAct1->TestResume(testCallParams1);
       
  1387 	CActiveScheduler::Start();
       
  1388 	
       
  1389 	// Make sure call is still in idle status
       
  1390 	err = iTelephony->GetLineStatus(testCallParams1.iLine, CallStatusPckg);
       
  1391 	TEST1(err == KErrNone,1);
       
  1392 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusIdle,1);	
       
  1393 	
       
  1394 	INFO_PRINTF1(_L("END TEST 4"));	 
       
  1395 	
       
  1396 	//
       
  1397 	//
       
  1398 	// TEST 5: Cancel
       
  1399 	// Resume call. Attempt to cancel the request.
       
  1400 	//
       
  1401 	//
       
  1402 	
       
  1403 	INFO_PRINTF1(_L("RESUME TEST 5 Attempt to cancel a resume request"));
       
  1404 	
       
  1405 	// Create a new call
       
  1406 	testCallParams1.iExpStat=KErrNone; 	 
       
  1407 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1408 	CActiveScheduler::Start();
       
  1409 	
       
  1410 	// Hold the call
       
  1411 	testCallParams1.iExpStat=KErrNone; 	
       
  1412 	testHoldAct1->TestHold(testCallParams1);
       
  1413 	CActiveScheduler::Start();
       
  1414 
       
  1415 	
       
  1416 	// Request the call to be resumed then
       
  1417  	// attempt to cancel the resume request
       
  1418  	TInt cancelerr = iTelephony->CancelAsync(CTelephony::EResumeCancel);
       
  1419 	TEST1(cancelerr == KErrNotFound, ETrue);
       
  1420  	testCallParams1.iExpStat=KErrNone;	
       
  1421 	CTestCanceller* canceller = testResumeAct1->RetrieveCanceller();
       
  1422 	testResumeAct1->TestResume(testCallParams1);
       
  1423 	canceller->Call();
       
  1424 	CActiveScheduler::Start();	
       
  1425 	
       
  1426 	// Status will be KErrCancel if the hold request has been cancelled.
       
  1427 	// It may be KErrNone if the resume request has managed to complete before 
       
  1428 	// execution of the cancel.
       
  1429 	TEST1(((testResumeAct1->iStatus.Int() == KErrCancel) || 
       
  1430 	        (testResumeAct1->iStatus.Int() == KErrNone)), 1);
       
  1431 	        
       
  1432 
       
  1433 	INFO_PRINTF1(_L("END TEST 5"));	 
       
  1434 	
       
  1435 	// Hang up the call for completion.
       
  1436 	testHangupAct1->TestHangup(testCallParams1);
       
  1437 	CActiveScheduler::Start();	
       
  1438 	
       
  1439 	CleanupStack::PopAndDestroy(testHangupAct1);
       
  1440 	CleanupStack::PopAndDestroy(testResumeAct1);
       
  1441 	CleanupStack::PopAndDestroy(testHoldAct1);
       
  1442 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
  1443 	return TestStepResult();
       
  1444 	
       
  1445 }
       
  1446 
       
  1447  
       
  1448 CTestResumeAct* CTestResumeAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
  1449 //Factory constructor
       
  1450 	{
       
  1451 	CTestResumeAct* obj = new(ELeave) CTestResumeAct(aTestStep, aTelephony);
       
  1452 	CleanupStack::PushL(obj);
       
  1453 	obj->ConstructL();
       
  1454 	return obj;
       
  1455 	}
       
  1456 	
       
  1457 CTestResumeAct::CTestResumeAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
  1458 	: CEtelIsvActBase(aTestStep, aTelephony) 
       
  1459 	{  
       
  1460 	}
       
  1461 
       
  1462 void CTestResumeAct::ConstructL()
       
  1463 	{    
       
  1464 	iCanceller = new(ELeave) CTestCanceller(this);
       
  1465 	CActiveScheduler::Add(this);
       
  1466 	}
       
  1467 
       
  1468 CTestResumeAct::~CTestResumeAct()
       
  1469 	{  
       
  1470 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
  1471 	delete iCanceller;
       
  1472 	}
       
  1473 
       
  1474 void CTestResumeAct::DoCancel()
       
  1475 	{
       
  1476 	iTelephony->CancelAsync(CTelephony::EResumeCancel);
       
  1477 	}
       
  1478  
       
  1479 void  CTestResumeAct::TestResume(TTestCallParams& aTestCallParams, TBool aCheckConcurrency)
       
  1480 	{
       
  1481 
       
  1482 	// Update the expected return value.
       
  1483 	iExpStat=aTestCallParams.iExpStat;
       
  1484 	 
       
  1485 	// Call the 3rd party API
       
  1486 	iTelephony->Resume(iStatus, aTestCallParams.iCallId);
       
  1487 	if(aCheckConcurrency)
       
  1488 		{
       
  1489 		TRequestStatus tmpStatus;
       
  1490 		iTelephony->Resume(tmpStatus, aTestCallParams.iCallId);
       
  1491 		User::WaitForRequest(tmpStatus);
       
  1492 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
  1493 		}
       
  1494 	SetActive(); 	
       
  1495 	 	
       
  1496 	}
       
  1497 	
       
  1498 void CTestResumeAct::RunL()
       
  1499 	{ 
       
  1500 	// ActiveScheduler will have set status to KRequestComplete, just before
       
  1501 	// calling this RunL().
       
  1502 	iTestStep-> INFO_PRINTF1(_L(" CTestResumeAct::RunL "));
       
  1503 	 
       
  1504 	iTestStep->INFO_PRINTF2(_L(" Call ID is = %d"), iCallId );
       
  1505 	iTestStep->INFO_PRINTF2(_L("Request Status expected is: %d"), iExpStat.Int()   );
       
  1506 	iTestStep->INFO_PRINTF2(_L("Request Status returned is: %d"), iStatus.Int()   );
       
  1507 	
       
  1508  	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), 1);	
       
  1509 	CActiveScheduler::Stop();
       
  1510 	}
       
  1511 
       
  1512 
       
  1513 
       
  1514 CTestSwap::CTestSwap()
       
  1515 /** Each test step initialises it's own name
       
  1516 */
       
  1517 {
       
  1518 	// store the name of this test case
       
  1519 	// this is the name that is used by the script file
       
  1520 	SetTestStepName(_L("TestSwap"));
       
  1521 }
       
  1522 
       
  1523 
       
  1524 /**
       
  1525 @SYMTestCaseID Etel3rdParty 14.1, TestSwap
       
  1526 @SYMTestCaseDesc Test Swap 3rd party API
       
  1527 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.20
       
  1528 */
       
  1529 
       
  1530 enum TVerdict CTestSwap::doTestStepL()
       
  1531 {
       
  1532 	INFO_PRINTF1(_L("CTestSwap::doTestStepL Start"));
       
  1533 	
       
  1534 	_LIT(KCallNumber1,"1789");
       
  1535 	_LIT(KCallNumber2,"1234");
       
  1536 	
       
  1537 	 // Set the call parameters for call 1
       
  1538 	CTelephony::TCallParamsV1 callParams1;
       
  1539 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
  1540 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
  1541  	
       
  1542 	TTestCallParams testCallParams1;
       
  1543 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  1544 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  1545 	testCallParams1.iTelAddress.iTelNumber = KCallNumber1;
       
  1546 	testCallParams1.iExpStat = KErrNone;
       
  1547 	
       
  1548 	// Set the call parameters for call 2
       
  1549 	CTelephony::TCallParamsV1 callParams2;
       
  1550 	callParams2.iIdRestrict = CTelephony::ESendMyId;
       
  1551 	CTelephony::TCallParamsV1Pckg callParamsPckg2(callParams2);	
       
  1552 	
       
  1553 	TTestCallParams testCallParams2;
       
  1554 	testCallParams2.iLine = CTelephony::EVoiceLine;
       
  1555 	testCallParams2.iCallParamsV1Pckg = &callParamsPckg2;
       
  1556 	testCallParams2.iTelAddress.iTelNumber = KCallNumber2;
       
  1557 	testCallParams2.iExpStat = KErrNone;
       
  1558  	
       
  1559 	// Create 2 active DialNewCallAct objects
       
  1560 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);	
       
  1561 	CTestDialNewCallAct* testDialNewCallAct2 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  1562 	
       
  1563 	// Create hold, resume and swap active objects.
       
  1564 	CTestHoldAct* testHoldAct1 = CTestHoldAct::NewLC(this, iTelephony);	
       
  1565 	CTestResumeAct* testResumeAct1 = CTestResumeAct::NewLC(this, iTelephony);
       
  1566 	CTestSwapAct* testSwapAct1 = CTestSwapAct::NewLC(this, iTelephony);	
       
  1567  		
       
  1568 	//
       
  1569 	//
       
  1570 	// Test Scenario 1: Normal scenario
       
  1571 	// Make call 1. Put call 1 on hold. Make a 2nd call. 
       
  1572 	// Swap the calls.
       
  1573 	//
       
  1574 	//
       
  1575 	
       
  1576 	INFO_PRINTF1(_L("SWAP TEST 1 Swap 2 calls"));
       
  1577 	
       
  1578 	// Create the first call
       
  1579 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1580 	CActiveScheduler::Start();
       
  1581 	
       
  1582 	// Hold the first call
       
  1583 	testHoldAct1->TestHold(testCallParams1);
       
  1584 	CActiveScheduler::Start();
       
  1585 	
       
  1586 	// Create a 2nd call
       
  1587 	testDialNewCallAct2->TestDialNewCall(testCallParams2);
       
  1588 	CActiveScheduler::Start();	
       
  1589 		 
       
  1590 	// Check the calls are now in the expected states
       
  1591 	CTelephony::TCallStatusV1 CallStatusV1;
       
  1592 	CTelephony::TCallStatusV1Pckg CallStatusPckg(CallStatusV1);
       
  1593 	
       
  1594 	// Make sure call 1 is in the held state  
       
  1595 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1596 	TEST1(err == KErrNone,1);
       
  1597 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  1598 	
       
  1599 	// Make sure call 2 is in the connected state  
       
  1600 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  1601 	TEST1(err == KErrNone,1);
       
  1602 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  1603 	
       
  1604 	//while calls are active test OOM before first swap call
       
  1605 	#if defined(_DEBUG)
       
  1606 		INFO_PRINTF1(_L("Test OOM on for Swap"));
       
  1607 		testCallParams1.iExpStat = KErrNoMemory;
       
  1608 		__UHEAP_FAILNEXT(1);	
       
  1609 		testSwapAct1->TestSwap(testCallParams1, testCallParams2 );
       
  1610 		CActiveScheduler::Start(); 
       
  1611 		__UHEAP_RESET;
       
  1612 	#endif
       
  1613 	
       
  1614  	// Swap the calls 
       
  1615     testCallParams1.iExpStat=KErrNone; 	 
       
  1616 	testSwapAct1->TestSwap(testCallParams1, testCallParams2, ETrue);
       
  1617 	CActiveScheduler::Start(); 
       
  1618 	
       
  1619 	// Check that the call states are now reversed.
       
  1620 	
       
  1621 	// Make sure call 1 is in the connected state 
       
  1622 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1623 	TEST1(err == KErrNone,1);
       
  1624 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  1625 	
       
  1626 	// Make sure call 2 is in the held state  
       
  1627 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  1628 	TEST1(err == KErrNone,1);
       
  1629 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1); 
       
  1630 	
       
  1631 	INFO_PRINTF1(_L("END TEST 1"));	 
       
  1632 	
       
  1633 	//
       
  1634 	//
       
  1635 	// TEST 2: Normal scenario
       
  1636 	// Swap the calls back.
       
  1637 	//
       
  1638 	//
       
  1639 	
       
  1640 	INFO_PRINTF1(_L("SWAP TEST 2: Swap calls back"));
       
  1641 	
       
  1642 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  1643 	CActiveScheduler::Start(); 
       
  1644 	
       
  1645 	// Check that the call states are now reversed.
       
  1646 	
       
  1647 	// Make sure call 1 is in the held state 
       
  1648 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1649 	TEST1(err == KErrNone,1);
       
  1650 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  1651 	
       
  1652 	// Make sure call 2 is in the connected state  
       
  1653 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  1654 	TEST1(err == KErrNone,1);
       
  1655 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1); 
       
  1656 	
       
  1657 	INFO_PRINTF1(_L("END TEST 2"));	 
       
  1658 	
       
  1659 	//
       
  1660 	// 
       
  1661 	// TEST 3 Error scenario
       
  1662 	// Call 1 is on hold. Call 2 is idle. Try to swap the calls.
       
  1663 	//
       
  1664 	//
       
  1665 	
       
  1666 	INFO_PRINTF1(_L("SWAP TEST 3  Call 1 on hold, call 2 idle. Attempt swap"));
       
  1667 	
       
  1668 	// Preparation step for the test.
       
  1669 	// Hang up Call 2
       
  1670 	 
       
  1671 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);	
       
  1672 	testHangupAct1->TestHangup(testCallParams2);
       
  1673 	CActiveScheduler::Start();	
       
  1674 	
       
  1675 	 
       
  1676 	// Make sure call 1 is in the held state 
       
  1677 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1678 	TEST1(err == KErrNone,1);
       
  1679 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  1680 	
       
  1681 	 
       
  1682 	// Attempt to swap the calls
       
  1683 	testCallParams1.iExpStat=KErrAccessDenied; 	
       
  1684 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  1685 	CActiveScheduler::Start(); 
       
  1686 	
       
  1687 	// Check call statuses are unchanged as expected
       
  1688 	
       
  1689 	// Make sure call 1 is in the held state 
       
  1690 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1691 	TEST1(err == KErrNone,1);
       
  1692 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  1693 	
       
  1694 	
       
  1695 	INFO_PRINTF1(_L("END TEST 3"));	 
       
  1696 	
       
  1697 	
       
  1698 	//
       
  1699 	//
       
  1700 	// TEST 4 : Error scenario
       
  1701 	// Call 1 active. Call 2 idle. Swap the calls.
       
  1702 	//
       
  1703 	//
       
  1704 	
       
  1705 	INFO_PRINTF1(_L("SWAP TEST 4: Call 1 active, call 2 idle, swap calls"));
       
  1706 	
       
  1707 	// Preparation for test 
       
  1708 	// Make call 1 active.
       
  1709 	testCallParams1.iExpStat=KErrNone; 	
       
  1710 	testResumeAct1->TestResume(testCallParams1);
       
  1711 	CActiveScheduler::Start();	
       
  1712 	
       
  1713 	// Make sure call 1 is in the active state
       
  1714 	iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1715 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected, ETrue);	
       
  1716 	 
       
  1717 	 
       
  1718 	// Call 1 is active. Call 2 is idle. Try to swap the calls.
       
  1719 	testCallParams1.iExpStat=KErrAccessDenied; 	
       
  1720 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  1721 	CActiveScheduler::Start();
       
  1722 	
       
  1723 	
       
  1724 	// Check that call states are unchanged as expected
       
  1725 	
       
  1726 	// Make sure call 1 is in the connected state 
       
  1727 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1728 	TEST1(err == KErrNone,1);
       
  1729 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  1730 	
       
  1731 	INFO_PRINTF1(_L("END TEST 4"));	 
       
  1732 	
       
  1733 	
       
  1734 	//
       
  1735 	//
       
  1736 	// TEST 5: Cancel
       
  1737 	// Attempt to cancel a swap request
       
  1738 	//
       
  1739 	//
       
  1740 	
       
  1741 	INFO_PRINTF1(_L("SWAP TEST 5 : Cancel a swap request"));
       
  1742 	
       
  1743 	// Put call 1 on hold. 
       
  1744 	testCallParams1.iExpStat=KErrNone; 	
       
  1745 	testHoldAct1->TestHold(testCallParams1);
       
  1746 	CActiveScheduler::Start();
       
  1747 	
       
  1748 	// Make call 2
       
  1749 	testCallParams2.iExpStat=KErrNone; 	
       
  1750 	testDialNewCallAct2->TestDialNewCall(testCallParams2);
       
  1751 	CActiveScheduler::Start();	
       
  1752 	
       
  1753 	// Issue a swap request
       
  1754 	testCallParams1.iExpStat=KErrNone; 	
       
  1755 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  1756 	CActiveScheduler::Start();
       
  1757 	
       
  1758 	
       
  1759 	// Request the call to be swapped then
       
  1760  	// attempt to cancel the swap request
       
  1761  	TInt cancelerr = iTelephony->CancelAsync(CTelephony::ESwapCancel);
       
  1762 	TEST1(cancelerr == KErrNotFound, ETrue);
       
  1763  	testCallParams1.iExpStat=KErrNone;	
       
  1764 	CTestCanceller* canceller = testSwapAct1->RetrieveCanceller();
       
  1765 	testSwapAct1->TestSwap(testCallParams1, testCallParams2 );
       
  1766 	canceller->Call();
       
  1767 	CActiveScheduler::Start();	
       
  1768 	// Status will be KErrCancel if the swap request has been cancelled.
       
  1769 	// It may be KErrNone if the swap request has managed to complete before 
       
  1770 	// execution of the cancel.
       
  1771 	TEST1(((testSwapAct1->iStatus.Int() == KErrCancel) || 
       
  1772 	        (testSwapAct1->iStatus.Int() == KErrNone)), 1);
       
  1773 	        
       
  1774 	
       
  1775 	INFO_PRINTF1(_L("END TEST 5"));	 
       
  1776 		
       
  1777 		
       
  1778 	// Hang up the calls for completion
       
  1779 	testHangupAct1->TestHangup(testCallParams1);
       
  1780 	CActiveScheduler::Start();	
       
  1781 	 
       
  1782 	testHangupAct1->TestHangup(testCallParams2);
       
  1783 	CActiveScheduler::Start();			 
       
  1784 	 
       
  1785 	CleanupStack::PopAndDestroy(testHangupAct1);
       
  1786 	CleanupStack::PopAndDestroy(testSwapAct1);
       
  1787 	CleanupStack::PopAndDestroy(testResumeAct1);
       
  1788 	CleanupStack::PopAndDestroy(testHoldAct1);
       
  1789 	CleanupStack::PopAndDestroy(testDialNewCallAct2);
       
  1790 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
  1791 	
       
  1792 	return TestStepResult();
       
  1793 	
       
  1794 }
       
  1795 
       
  1796  
       
  1797 CTestSwapAct* CTestSwapAct::NewLC(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
  1798 //Factory constructor
       
  1799 	{
       
  1800 	CTestSwapAct* obj = new(ELeave) CTestSwapAct(aTestStep, aTelephony);
       
  1801 	CleanupStack::PushL(obj);
       
  1802 	obj->ConstructL();
       
  1803 	return obj;
       
  1804 	}
       
  1805 	
       
  1806 CTestSwapAct::CTestSwapAct(CEtelIsvTestStep* aTestStep, CTelephony* aTelephony)
       
  1807 	: CEtelIsvActBase(aTestStep, aTelephony)	 
       
  1808 	{  
       
  1809 	}
       
  1810 
       
  1811 void CTestSwapAct::ConstructL()
       
  1812 	{    
       
  1813 	iCanceller = new(ELeave) CTestCanceller(this);
       
  1814 	CActiveScheduler::Add(this);
       
  1815 	}
       
  1816 
       
  1817 CTestSwapAct::~CTestSwapAct()
       
  1818 	{  
       
  1819 	Cancel();	// if any Req outstanding, calls DoCancel() to cleanup.
       
  1820 	delete iCanceller;
       
  1821 	}
       
  1822 
       
  1823 void CTestSwapAct::DoCancel()
       
  1824 	{
       
  1825 	iTelephony->CancelAsync(CTelephony::ESwapCancel);
       
  1826 	}
       
  1827 
       
  1828 void CTestSwapAct::TestSwap(TTestCallParams& aTestCallParams1, TTestCallParams& aTestCallParams2, TBool aCheckConcurrency)	  
       
  1829                
       
  1830 	{
       
  1831 	// Update the expected return value.
       
  1832 	iExpStat=aTestCallParams1.iExpStat;
       
  1833 	 
       
  1834 	iTelephony->Swap(iStatus, aTestCallParams1.iCallId, aTestCallParams2.iCallId );
       
  1835 	if(aCheckConcurrency)
       
  1836 		{
       
  1837 		TRequestStatus tmpStatus;
       
  1838 		iTelephony->Swap(tmpStatus, aTestCallParams1.iCallId, aTestCallParams2.iCallId );
       
  1839 		User::WaitForRequest(tmpStatus);
       
  1840 		iTestStep->TEST1(tmpStatus.Int() == KErrInUse, ETrue);
       
  1841 		}
       
  1842 	SetActive(); 	
       
  1843 	 
       
  1844 	}
       
  1845 	
       
  1846 void CTestSwapAct::RunL()
       
  1847 	{ 
       
  1848 	// ActiveScheduler will have set status to KRequestComplete, just before
       
  1849 	// calling this RunL().
       
  1850 	
       
  1851 	iTestStep-> INFO_PRINTF1(_L(" CTestSwapAct::RunL "));
       
  1852 	iTestStep->INFO_PRINTF2(_L("Request Status expected is: %d"), iExpStat.Int()   );
       
  1853 	iTestStep->INFO_PRINTF2(_L("Request Status returned is: %d"), iStatus.Int()   );
       
  1854 	
       
  1855  	iTestStep->TEST1(iStatus.Int() == iExpStat.Int(), 1);	
       
  1856 	CActiveScheduler::Stop();
       
  1857 	}
       
  1858 
       
  1859  
       
  1860  
       
  1861 CTestHoldResume2Calls::CTestHoldResume2Calls()
       
  1862 /** Each test step initialises it's own name
       
  1863 */
       
  1864 {
       
  1865 	// store the name of this test case
       
  1866 	// this is the name that is used by the script file
       
  1867 	SetTestStepName(_L("TestHoldResume2Calls"));
       
  1868 }
       
  1869 
       
  1870 /**
       
  1871 @SYMTestCaseID Etel3rdParty 15.1, TestHoldResume2Calls
       
  1872 @SYMTestCaseDesc Test Hold, Resume 3rd party APIs
       
  1873 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.7, 2116.3.8
       
  1874 */
       
  1875 
       
  1876 enum TVerdict CTestHoldResume2Calls::doTestStepL()
       
  1877 {
       
  1878 	INFO_PRINTF1(_L("CTestHoldResume2Calls::doTestStepL Start"));
       
  1879 	
       
  1880 	_LIT(KGoodNumber1,"1789");
       
  1881 	_LIT(KGoodNumber2,"1234");
       
  1882 	
       
  1883 	SetTestNumber(15); 
       
  1884 	
       
  1885 	//Set the call parameters for call 1
       
  1886 	CTelephony::TCallParamsV1 callParams1;
       
  1887 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
  1888 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
  1889 	
       
  1890 	TTestCallParams testCallParams1;
       
  1891 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  1892 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  1893 	testCallParams1.iTelAddress.iTelNumber = KGoodNumber1;
       
  1894 	testCallParams1.iExpStat = KErrNone;
       
  1895 	
       
  1896 	//Set the call parameters for call 2
       
  1897 	CTelephony::TCallParamsV1 callParams2;
       
  1898 	callParams2.iIdRestrict = CTelephony::ESendMyId;
       
  1899 	CTelephony::TCallParamsV1Pckg callParamsPckg2(callParams2);	
       
  1900 	
       
  1901 	TTestCallParams testCallParams2;
       
  1902 	testCallParams2.iLine = CTelephony::EVoiceLine;
       
  1903 	testCallParams2.iCallParamsV1Pckg = &callParamsPckg2;
       
  1904 	testCallParams2.iTelAddress.iTelNumber = KGoodNumber2;
       
  1905 	testCallParams2.iExpStat = KErrNone;
       
  1906 	
       
  1907 	 
       
  1908 	
       
  1909 	// Create 2 active DialNewCallAct objects
       
  1910 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);	
       
  1911 	CTestDialNewCallAct* testDialNewCallAct2 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  1912 	
       
  1913 	// Creat hold, resume and swap active objects.
       
  1914 	CTestHoldAct* testHoldAct1 = CTestHoldAct::NewLC(this, iTelephony);
       
  1915 	CTestResumeAct* testResumeAct1 = CTestResumeAct::NewLC(this, iTelephony);
       
  1916 	CTestSwapAct* testSwapAct1 = CTestSwapAct::NewLC(this, iTelephony);
       
  1917 	
       
  1918 	 
       
  1919 	//
       
  1920 	// TEST SUMMARY //
       
  1921 	// 
       
  1922 	// This set of tests covers any hold and resume scenarios involving 
       
  1923 	// 2 calls. These are the tests not covered by TestHold and TestResume 
       
  1924 	// which cover the single call scenarios.
       
  1925 	//  
       
  1926 	//		// Attempt to make a 2nd call
       
  1927 	// 1. 	Call 1 is active. Make a 2nd call. 
       
  1928 	// 		Expected Result: Call 2 will not be allowed.
       
  1929 	// 2. 	Call 1 is on hold. Make a 2nd call. 
       
  1930 	// 		Expected Result: Call 1 remains on hold. Call 2 active.
       
  1931 	//
       
  1932 	//		// Make 2 calls. Attempt to resume the active call.
       
  1933 	// 3. 	Call 1 is on hold. Call 2 is active. Resume call 2.
       
  1934 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  1935 	// 4.	Call 1 is active. Call 2 is on hold. Resume call 1.
       
  1936 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  1937 	//
       
  1938 	//		// Make 2 calls. Attempt to hold the held call.
       
  1939 	// 5.	Call 1 is active. Call 2 is on hold. Hold call 2.
       
  1940 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  1941 	// 6. 	Call 1 is on hold. Call 2 is active. Hold Call 1.
       
  1942 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  1943 	//
       
  1944 	// 		// Make 2 calls. Attempt to resume the held call
       
  1945 	// 7. 	Call 1 is on hold. Call 2 is active. Resume call 1.
       
  1946 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  1947 	// 8.	Call 1 is active. Call 2 is on hold. Resume call 2.
       
  1948 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  1949 	//
       
  1950 	//		// Make 2 calls. Attempt to hold the active call.
       
  1951 	// 9.	Call 1 is active. Call 2 is on hold. Hold call 1.
       
  1952 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  1953 	// 10. 	Call 1 is on hold. Call 2 is active. Hold Call 2.
       
  1954 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  1955 	
       
  1956 	
       
  1957 	
       
  1958 	// Test Scenario 1.
       
  1959 	// 1. 	Call 1 is active. Make a 2nd call. 
       
  1960 	// 		Expected Result: Call 2 will not be allowed. 
       
  1961 	
       
  1962 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 1 "));
       
  1963 	 
       
  1964 	// Create the first call
       
  1965 	testCallParams1.iExpStat = KErrNone;
       
  1966 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  1967 	CActiveScheduler::Start();
       
  1968 	
       
  1969 	// Create a 2nd call
       
  1970 	testCallParams2.iExpStat = KErrGeneral;
       
  1971 	testDialNewCallAct2->TestDialNewCall(testCallParams2);
       
  1972 	CActiveScheduler::Start();	
       
  1973 		 
       
  1974 	// Check that the calls are now in the expected states
       
  1975 	CTelephony::TCallStatusV1 CallStatusV1;
       
  1976 	CTelephony::TCallStatusV1Pckg CallStatusPckg(CallStatusV1);
       
  1977 	
       
  1978 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  1979 	TEST1(err == KErrNone,1);
       
  1980 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  1981   
       
  1982    
       
  1983 	INFO_PRINTF1(_L("END TEST 1"));	 
       
  1984 	
       
  1985 	// Test Scenario 2
       
  1986 	// 2. 	Call 1 is on hold. Make a 2nd call. 
       
  1987 	// 		Expected Result: Call 1 remains on hold. Call 2 active.
       
  1988 	
       
  1989 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 2 "));
       
  1990 	
       
  1991 	// Put call 1 on hold. 
       
  1992 	testCallParams1.iExpStat=KErrNone; 	
       
  1993 	testHoldAct1->TestHold(testCallParams1);
       
  1994 	CActiveScheduler::Start();
       
  1995 	
       
  1996 	// Create a 2nd call
       
  1997 	testCallParams2.iExpStat = KErrNone;
       
  1998 	testDialNewCallAct2->TestDialNewCall(testCallParams2);
       
  1999 	CActiveScheduler::Start();	
       
  2000 	
       
  2001 	// Check that the calls are now in the expected states 
       
  2002 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2003 	TEST1(err == KErrNone,1);
       
  2004 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2005 	
       
  2006 	// Check that the calls are now in the expected states
       
  2007 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2008 	TEST1(err == KErrNone,1);
       
  2009 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2010 	
       
  2011 	INFO_PRINTF1(_L("END TEST 2"));	 
       
  2012 	
       
  2013 	//
       
  2014 	//		Test scenario 3
       
  2015 	// 3. 	Call 1 is on hold. Call 2 is active. Resume call 2.
       
  2016 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  2017 	
       
  2018 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 3 ")); 
       
  2019 	
       
  2020 	// Resume Call 2
       
  2021 	testCallParams2.iExpStat=KErrAccessDenied;	 
       
  2022 	testResumeAct1->TestResume(testCallParams2);
       
  2023 	CActiveScheduler::Start();
       
  2024 	
       
  2025 	// Check that the calls are now in the expected states 
       
  2026 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2027 	TEST1(err == KErrNone,1);
       
  2028 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2029 	
       
  2030 	// Check that the calls are now in the expected states
       
  2031 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2032 	TEST1(err == KErrNone,1);
       
  2033 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2034 	
       
  2035 	INFO_PRINTF1(_L("END TEST 3"));	 
       
  2036 	
       
  2037 	
       
  2038 	//
       
  2039 	//		Test scenario 4
       
  2040 	// 4.	Call 1 is active. Call 2 is on hold. Resume call 1.
       
  2041 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  2042 	
       
  2043 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 4 ")); 
       
  2044 	
       
  2045 	// Issue a swap request
       
  2046 	testCallParams1.iExpStat=KErrNone; 	
       
  2047 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  2048 	CActiveScheduler::Start();
       
  2049 	
       
  2050 	// Check that the calls are now in the expected states 
       
  2051 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2052 	TEST1(err == KErrNone,1);
       
  2053 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2054 	
       
  2055 	// Check that the calls are now in the expected states
       
  2056 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2057 	TEST1(err == KErrNone,1);
       
  2058 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2059 	
       
  2060 	// Resume Call 1
       
  2061 	testCallParams1.iExpStat=KErrAccessDenied;	 
       
  2062 	testResumeAct1->TestResume(testCallParams1);
       
  2063 	CActiveScheduler::Start();
       
  2064 	
       
  2065 	// Check that the calls are now in the expected states 
       
  2066 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2067 	TEST1(err == KErrNone,1);
       
  2068 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2069 	
       
  2070 	// Check that the calls are now in the expected states
       
  2071 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2072 	TEST1(err == KErrNone,1);
       
  2073 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2074 	
       
  2075 	INFO_PRINTF1(_L("END TEST 4"));	 
       
  2076 	
       
  2077 	//
       
  2078 	//
       
  2079 	// 5.	Call 1 is active. Call 2 is on hold. Hold call 2.
       
  2080 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  2081 	
       
  2082 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 5 ")); 
       
  2083 	
       
  2084 	// Hold Call 2
       
  2085 	testCallParams2.iExpStat=KErrAccessDenied;	 
       
  2086 	testHoldAct1->TestHold(testCallParams2);
       
  2087 	CActiveScheduler::Start();
       
  2088 	
       
  2089 	// Check that the calls are now in the expected states 
       
  2090 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2091 	TEST1(err == KErrNone,1);
       
  2092 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2093 	
       
  2094 	// Check that the calls are now in the expected states
       
  2095 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2096 	TEST1(err == KErrNone,1);
       
  2097 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2098 	
       
  2099 	INFO_PRINTF1(_L("END TEST 5"));	 
       
  2100 	
       
  2101 	
       
  2102 	//
       
  2103 	//
       
  2104 	// 6. 	Call 1 is on hold. Call 2 is active. Hold Call 1.
       
  2105 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  2106 	//
       
  2107 
       
  2108 	
       
  2109 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 6 ")); 
       
  2110 	
       
  2111 	// Issue a swap request
       
  2112 	testCallParams1.iExpStat=KErrNone; 	
       
  2113 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  2114 	CActiveScheduler::Start();
       
  2115 	
       
  2116 	// Check that the calls are now in the expected states 
       
  2117 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2118 	TEST1(err == KErrNone,1);
       
  2119 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2120 	
       
  2121 	// Check that the calls are now in the expected states
       
  2122 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2123 	TEST1(err == KErrNone,1);
       
  2124 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2125 	
       
  2126 	// Hold Call 1
       
  2127 	testCallParams1.iExpStat=KErrAccessDenied;	 
       
  2128 	testHoldAct1->TestHold(testCallParams1);
       
  2129 	CActiveScheduler::Start();
       
  2130 	
       
  2131 	// Check that the calls are now in the expected states 
       
  2132 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2133 	TEST1(err == KErrNone,1);
       
  2134 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2135 	
       
  2136 	// Check that the calls are now in the expected states
       
  2137 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2138 	TEST1(err == KErrNone,1);
       
  2139 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2140 	
       
  2141 	INFO_PRINTF1(_L("END TEST 6"));	 
       
  2142 	
       
  2143 	
       
  2144 	//
       
  2145 	//
       
  2146 	// 7. 	Call 1 is on hold. Call 2 is active. Resume call 1.
       
  2147 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  2148 	
       
  2149 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 7 "));
       
  2150 	
       
  2151 	// Resume call 1. 
       
  2152 	testCallParams1.iExpStat=KErrGeneral; 	
       
  2153 	testResumeAct1->TestResume(testCallParams1);
       
  2154 	CActiveScheduler::Start();
       
  2155 	
       
  2156 	// Check that the calls are now in the expected states 
       
  2157 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2158 	TEST1(err == KErrNone,1);
       
  2159 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2160 
       
  2161 	
       
  2162 	// Check that the calls are now in the expected states
       
  2163 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2164 	TEST1(err == KErrNone,1);
       
  2165 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2166 	
       
  2167 	INFO_PRINTF1(_L("END TEST 7"));	 
       
  2168 	
       
  2169 	//
       
  2170 	//
       
  2171 	// 8.	Call 1 is active. Call 2 is on hold. Resume call 2.
       
  2172 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  2173 	//
       
  2174 	
       
  2175 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 8 "));
       
  2176 	
       
  2177 	
       
  2178 	// Issue a swap request
       
  2179 	testCallParams1.iExpStat=KErrNone; 	
       
  2180 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  2181 	CActiveScheduler::Start();
       
  2182 	
       
  2183 	// Check that the calls are now in the expected states 
       
  2184 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2185 	TEST1(err == KErrNone,1);
       
  2186 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2187 	
       
  2188 	// Check that the calls are now in the expected states
       
  2189 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2190 	TEST1(err == KErrNone,1);
       
  2191 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2192 	
       
  2193 	// Resume call 2. 
       
  2194 	testCallParams2.iExpStat=KErrGeneral; 	
       
  2195 	testResumeAct1->TestResume(testCallParams2);
       
  2196 	CActiveScheduler::Start();
       
  2197 	
       
  2198 	// Check that the calls are now in the expected states 
       
  2199 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2200 	TEST1(err == KErrNone,1);
       
  2201 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2202 	
       
  2203 	// Check that the calls are now in the expected states
       
  2204 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2205 	TEST1(err == KErrNone,1);
       
  2206 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2207 	
       
  2208 	INFO_PRINTF1(_L("END TEST 8"));	 
       
  2209 	
       
  2210 	
       
  2211 	//
       
  2212 	//		 
       
  2213 	// 9.	Call 1 is active. Call 2 is on hold. Hold call 1.
       
  2214 	//		Expected Result: Call 1 remains active. Call 2 remains on hold.
       
  2215 	
       
  2216 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 9 "));
       
  2217 	
       
  2218 	// Hold Call 1
       
  2219 	testCallParams1.iExpStat=KErrAlreadyExists;	 
       
  2220 	testHoldAct1->TestHold(testCallParams1);
       
  2221 	CActiveScheduler::Start();
       
  2222 	
       
  2223 	// Check that the calls are now in the expected states 
       
  2224 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2225 	TEST1(err == KErrNone,1);
       
  2226 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2227 	
       
  2228 	// Check that the calls are now in the expected states
       
  2229 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2230 	TEST1(err == KErrNone,1);
       
  2231 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2232 	
       
  2233 	INFO_PRINTF1(_L("END TEST 9"));	 
       
  2234 	
       
  2235 
       
  2236 	//
       
  2237 	//
       
  2238 	// 10. 	Call 1 is on hold. Call 2 is active. Hold Call 2.
       
  2239 	//		Expected Result: Call 1 remains on hold. Call 2 remains active.
       
  2240 	
       
  2241 	INFO_PRINTF1(_L("Hold-Resume-2Calls TEST 10 "));
       
  2242 	
       
  2243 	// Issue a swap request
       
  2244 	testCallParams1.iExpStat=KErrNone; 	
       
  2245 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  2246 	CActiveScheduler::Start();
       
  2247 	
       
  2248 	// Check that the calls are now in the expected states 
       
  2249 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2250 	TEST1(err == KErrNone,1);
       
  2251 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2252 	
       
  2253 	// Check that the calls are now in the expected states
       
  2254 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2255 	TEST1(err == KErrNone,1);
       
  2256 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2257 	
       
  2258 	
       
  2259 	// Hold Call 2
       
  2260 	testCallParams2.iExpStat=KErrAlreadyExists;	 
       
  2261 	testHoldAct1->TestHold(testCallParams2);
       
  2262 	CActiveScheduler::Start();
       
  2263 	
       
  2264 	// Check that the calls are now in the expected states 
       
  2265 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, CallStatusPckg );
       
  2266 	TEST1(err == KErrNone,1);
       
  2267 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusHold,1);
       
  2268 	
       
  2269 	// Check that the calls are now in the expected states
       
  2270 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, CallStatusPckg );
       
  2271 	TEST1(err == KErrNone,1);
       
  2272 	TEST1(CallStatusV1.iStatus == CTelephony::EStatusConnected,1);
       
  2273 
       
  2274 	INFO_PRINTF1(_L("END TEST 10"));	 
       
  2275 	
       
  2276 	// Hang up the calls for completion
       
  2277 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);
       
  2278 	testCallParams1.iExpStat=KErrNone;	 	
       
  2279 	testHangupAct1->TestHangup(testCallParams1);
       
  2280 	CActiveScheduler::Start();	
       
  2281 	
       
  2282 	testCallParams2.iExpStat=KErrNone;	 	 
       
  2283 	testHangupAct1->TestHangup(testCallParams2);
       
  2284 	CActiveScheduler::Start();			 
       
  2285 	 
       
  2286 	  
       
  2287 	CleanupStack::PopAndDestroy(testHangupAct1);
       
  2288 	CleanupStack::PopAndDestroy(testSwapAct1);
       
  2289 	CleanupStack::PopAndDestroy(testResumeAct1);
       
  2290 	CleanupStack::PopAndDestroy(testHoldAct1);
       
  2291 	CleanupStack::PopAndDestroy(testDialNewCallAct2);
       
  2292 	CleanupStack::PopAndDestroy(testDialNewCallAct1);  
       
  2293 	
       
  2294 	return TestStepResult();	
       
  2295 }
       
  2296 
       
  2297 
       
  2298 CTestGetCallDynamicCaps::CTestGetCallDynamicCaps()
       
  2299 /** Each test step initialises it's own name
       
  2300 */
       
  2301 	{
       
  2302 	// store the name of this test case
       
  2303 	// this is the name that is used by the script file
       
  2304 	SetTestStepName(_L("TestGetCallDynamicCaps"));
       
  2305 	}
       
  2306 
       
  2307 /**
       
  2308 *
       
  2309 @SYMTestCaseID Etel3rdParty 24.1, TestGetCallDynamicCaps
       
  2310 @SYMTestCaseDesc Test GetCallDynamicCaps 3rd party API
       
  2311 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, REQ 2116.3.19
       
  2312 */ 
       
  2313 
       
  2314 enum TVerdict CTestGetCallDynamicCaps::doTestStepL()
       
  2315 	{
       
  2316  
       
  2317 	INFO_PRINTF1(_L("Test retrieving of the line's dynamic call capabilities"));
       
  2318 	
       
  2319 	_LIT(KCallNumber1,"1789");
       
  2320 	_LIT(KCallNumber2,"1234");
       
  2321 	
       
  2322 	SetTestNumber(15); 
       
  2323 	
       
  2324 	//Set the call parameters for MO call
       
  2325 	CTelephony::TCallParamsV1 callParams;
       
  2326 	callParams.iIdRestrict = CTelephony::ESendMyId;
       
  2327 	CTelephony::TCallParamsV1Pckg callParamsPckg(callParams);	
       
  2328 			
       
  2329 	TTestCallParams testCallParams1;
       
  2330 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  2331 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg;
       
  2332 	testCallParams1.iTelAddress.iTelNumber = KCallNumber1;
       
  2333 	testCallParams1.iExpStat = KErrNone;
       
  2334 	
       
  2335 	TTestCallParams testCallParams2;
       
  2336 	testCallParams2.iLine = CTelephony::EVoiceLine;
       
  2337 	testCallParams2.iCallParamsV1Pckg = &callParamsPckg;
       
  2338 	testCallParams2.iTelAddress.iTelNumber = KCallNumber2;
       
  2339 	testCallParams2.iExpStat = KErrNone;
       
  2340 
       
  2341 	// Create an active DialNewCallAct object
       
  2342 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  2343 	
       
  2344 	// Create an second active DialNewCallAct object
       
  2345 	CTestDialNewCallAct* testDialNewCallAct2 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  2346 	
       
  2347 	// Create an active TestHoldAct object
       
  2348 	CTestHoldAct* testHoldAct1 = CTestHoldAct::NewLC(this, iTelephony);	
       
  2349 	
       
  2350 	// Create an active TestResumeAct object
       
  2351 	CTestResumeAct* testResumeAct1 = CTestResumeAct::NewLC(this, iTelephony);	
       
  2352 	
       
  2353 	// Create status object for GetCallStatus calls
       
  2354 	CTelephony::TCallStatusV1 CallStatusV1;
       
  2355 	CTelephony::TCallStatusV1Pckg CallStatusPckg(CallStatusV1);
       
  2356 	TPckgBuf<CTelephony::TCallStatusV1> CallStatusBuff(CallStatusV1);
       
  2357 	TDes8* CallStatusData;
       
  2358 	if (iBufferMode)
       
  2359 		{
       
  2360 		CallStatusData = &CallStatusBuff;
       
  2361 		}
       
  2362 	else
       
  2363 		{
       
  2364 		CallStatusData = &CallStatusPckg;
       
  2365 		}
       
  2366 	
       
  2367 	CTelephony::TCallStatusV1& CallStatusResult = 
       
  2368 		reinterpret_cast<CTelephony::TCallStatusV1&> ( const_cast<TUint8&> (*CallStatusData->Ptr() ) );
       
  2369 	
       
  2370 	//
       
  2371 	//
       
  2372 	// TEST 1: Normal case
       
  2373 	// Make a call. Retrieve the call capabilities. 
       
  2374 	//
       
  2375 	//
       
  2376 	
       
  2377 	INFO_PRINTF1(_L(" TEST 1 Dynamic Call Caps. Get caps in connected state "));
       
  2378 	
       
  2379 	// Create a call
       
  2380 	testCallParams1.iExpStat=KErrNone;	
       
  2381 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  2382 	CActiveScheduler::Start();
       
  2383 	
       
  2384 	// Check the call is now at connected status 
       
  2385 
       
  2386 	TInt err = iTelephony->GetCallStatus(testCallParams1.iCallId, *CallStatusData );
       
  2387 	TEST1(err == KErrNone,1);
       
  2388 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusConnected,1);	
       
  2389 	
       
  2390 	// Get the call capabilities 
       
  2391 	CTelephony::TCallCapsV1 callCaps;
       
  2392 	CTelephony::TCallCapsV1Pckg callCapsPckg(callCaps);
       
  2393 	TPckgBuf<CTelephony::TCallCapsV1> callCapsBuff(callCaps);
       
  2394 	TDes8* callCapsData;
       
  2395 	if (iBufferMode)
       
  2396 		{
       
  2397 		callCapsData = &callCapsBuff;
       
  2398 		}
       
  2399 	else
       
  2400 		{
       
  2401 		callCapsData = &callCapsPckg;
       
  2402 		}
       
  2403 		
       
  2404 	CTelephony::TCallCapsV1& callCapsResults = 
       
  2405 		reinterpret_cast<CTelephony::TCallCapsV1&> ( const_cast<TUint8&> ( *callCapsData->Ptr() ) );
       
  2406 	
       
  2407 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2408 	TEST1(err==KErrNone, ETrue);
       
  2409 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2410 		
       
  2411 	// Check that the call capabilties are that the call can be held or swapped
       
  2412 	// but not resumed.
       
  2413 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsHold, 1);
       
  2414 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2415 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2416 	
       
  2417 	
       
  2418 	INFO_PRINTF1(_L("END TEST 1"));
       
  2419 	
       
  2420 	//
       
  2421 	//
       
  2422 	// TEST 2: Normal case
       
  2423 	// Put the call on hold. Retrieve the call capabilities. 
       
  2424 	//
       
  2425 	//
       
  2426 	
       
  2427 	INFO_PRINTF1(_L(" TEST 2 Dynamic Call Caps. Get caps in held state "));
       
  2428 	
       
  2429 	 
       
  2430 	// Put the call on hold.
       
  2431 	// by calling the ETEL 3rd party API	  
       
  2432 	testCallParams1.iExpStat=KErrNone;
       
  2433 	testHoldAct1->TestHold(testCallParams1);
       
  2434 	CActiveScheduler::Start();
       
  2435 	
       
  2436 	// Check that the call is now at held status.
       
  2437 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, *CallStatusData );
       
  2438 	TEST1(err == KErrNone,1);
       
  2439 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusHold,1);
       
  2440 	
       
  2441 	// Get the call capabilities 
       
  2442 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2443 	TEST1(err==KErrNone, ETrue);
       
  2444 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2445 		
       
  2446 	// Check that the call capabilties are that the call can be resumed or swapped
       
  2447 	// but not held.
       
  2448 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2449 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2450 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsResume, 1);	
       
  2451 	
       
  2452 	INFO_PRINTF1(_L("END TEST 2")); 
       
  2453 	
       
  2454 	//
       
  2455 	//
       
  2456 	// TEST 3: Normal case
       
  2457 	// Resume the call. Retrieve the call capabilities. 
       
  2458 	//
       
  2459 	//
       
  2460 	
       
  2461 	INFO_PRINTF1(_L(" TEST 3 Dynamic Call Caps. Get caps after call resumed "));
       
  2462 	
       
  2463 	// Resume the call
       
  2464 	// by calling the ETEL 3rd party API	  
       
  2465 	testCallParams1.iExpStat=KErrNone;
       
  2466 	testResumeAct1->TestResume(testCallParams1);
       
  2467 	CActiveScheduler::Start();
       
  2468 	
       
  2469 	// Check that the call is now at connected status.
       
  2470 	err = iTelephony->GetCallStatus(testCallParams1.iCallId, *CallStatusData );
       
  2471 	TEST1(err == KErrNone,1);
       
  2472 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusConnected,1);
       
  2473 	
       
  2474 	// Get the call capabilities 
       
  2475 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2476 	TEST1(err==KErrNone, ETrue);
       
  2477 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2478 		
       
  2479 	// Check that the call capabilities are that the call can be held or swapped
       
  2480 	// but not resumed.
       
  2481 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsHold, 1);
       
  2482 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2483 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);	
       
  2484 	
       
  2485 	INFO_PRINTF1(_L("END TEST 3"));
       
  2486 	
       
  2487 	
       
  2488 	//
       
  2489 	//
       
  2490 	// TEST 4: Normal case
       
  2491 	// Call 1 on hold. Call 2 active.
       
  2492 	// Retrieve call capabilities. 
       
  2493 	//
       
  2494 	//
       
  2495 	
       
  2496 	INFO_PRINTF1(_L(" TEST 4 Dynamic Call Caps. Check capability in 2 call case "));
       
  2497 	
       
  2498 	
       
  2499 	// Hold Call 1
       
  2500 	testCallParams1.iExpStat=KErrNone;	 
       
  2501 	testHoldAct1->TestHold(testCallParams1);
       
  2502 	CActiveScheduler::Start();
       
  2503 	
       
  2504 	// Create a second call.
       
  2505 	testCallParams2.iExpStat=KErrNone;	
       
  2506 	testDialNewCallAct2->TestDialNewCall(testCallParams2);
       
  2507 	CActiveScheduler::Start();
       
  2508 	
       
  2509 	// Check the first call is now at held status
       
  2510     err = iTelephony->GetCallStatus(testCallParams1.iCallId, *CallStatusData );
       
  2511 	TEST1(err == KErrNone,1);
       
  2512 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusHold,1);	
       
  2513 	
       
  2514 	// Check the second call is now at connected status
       
  2515 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, *CallStatusData );
       
  2516 	TEST1(err == KErrNone,1);
       
  2517 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusConnected,1);	
       
  2518 	
       
  2519 	// Get the call capabilities of the first call
       
  2520 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2521 	TEST1(err==KErrNone, 1);
       
  2522 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2523 	
       
  2524 	// Check that the call capabilties are that the call can be swapped 
       
  2525 	// but not held or resumed.
       
  2526 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2527 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2528 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2529  
       
  2530 	// Get the call capabilities of the second call
       
  2531 	err = iTelephony->GetCallDynamicCaps(testCallParams2.iCallId, *callCapsData);
       
  2532 	TEST1(err==KErrNone, 1);
       
  2533 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2534 		
       
  2535 	// Check that the call capabilties are that the call can be held or swapped
       
  2536 	// but not resumed.
       
  2537 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2538 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2539 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2540 	
       
  2541 	
       
  2542 	INFO_PRINTF1(_L("END TEST 4"));
       
  2543 	
       
  2544 	//
       
  2545 	//
       
  2546 	// TEST 5: Normal case
       
  2547 	// Ensure caps are set correctly after a swap operation.
       
  2548 	// Call 1 active. Call 2 on hold.
       
  2549 	// Retrieve call capabilities. 
       
  2550 	//
       
  2551 	//
       
  2552 	
       
  2553 	INFO_PRINTF1(_L(" TEST 5 Dynamic Call Caps. Check capability in 2 call case "));
       
  2554 	
       
  2555 	// Swap the calls 
       
  2556 	CTestSwapAct* testSwapAct1 = CTestSwapAct::NewLC(this, iTelephony);	
       
  2557     testCallParams1.iExpStat=KErrNone; 	 
       
  2558 	testSwapAct1->TestSwap(testCallParams1, testCallParams2 );
       
  2559 	CActiveScheduler::Start(); 
       
  2560 	
       
  2561 	// Check the first call is now at connected status
       
  2562     err = iTelephony->GetCallStatus(testCallParams1.iCallId, *CallStatusData );
       
  2563 	TEST1(err == KErrNone,1);
       
  2564 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusConnected,1);	
       
  2565 	
       
  2566 	// Check the second call is now at held status
       
  2567 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, *CallStatusData );
       
  2568 	TEST1(err == KErrNone,1);
       
  2569 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusHold,1);	
       
  2570 	
       
  2571 	// Get the call capabilities of the first call
       
  2572 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2573 	TEST1(err==KErrNone, 1);
       
  2574 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2575 	
       
  2576 	// Check that the call capabilties are that the call can be swapped 
       
  2577 	// but not held or resumed.
       
  2578 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2579 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2580 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2581  
       
  2582 	// Get the call capabilities of the second call
       
  2583 	err = iTelephony->GetCallDynamicCaps(testCallParams2.iCallId, *callCapsData);
       
  2584 	TEST1(err==KErrNone, 1);
       
  2585 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2586 	
       
  2587 	// Check that the call capabilties are that the call can be held or swapped
       
  2588 	// but not resumed.
       
  2589 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2590 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2591 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2592 	
       
  2593 	
       
  2594 	INFO_PRINTF1(_L("END TEST 5"));
       
  2595 	
       
  2596 	//
       
  2597 	//
       
  2598 	// TEST 6: Normal case
       
  2599 	// Ensure caps are set correctly after a swap back operation.
       
  2600 	// Call 1 on hold. Call 2 active.
       
  2601 	// Retrieve call capabilities. 
       
  2602 	//
       
  2603 	//
       
  2604 	
       
  2605 	INFO_PRINTF1(_L(" TEST 6 Dynamic Call Caps. Check capability in 2 call case "));
       
  2606 	
       
  2607 	// Swap the calls 
       
  2608     testCallParams1.iExpStat=KErrNone; 	 
       
  2609 	testSwapAct1->TestSwap(testCallParams1, testCallParams2 );
       
  2610 	CActiveScheduler::Start(); 
       
  2611 	
       
  2612 	// Check the first call is now at held status
       
  2613     err = iTelephony->GetCallStatus(testCallParams1.iCallId, *CallStatusData );
       
  2614 	TEST1(err == KErrNone,1);
       
  2615 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusHold,1);	
       
  2616 	
       
  2617 	// Check the second call is now at connected status
       
  2618 	err = iTelephony->GetCallStatus(testCallParams2.iCallId, *CallStatusData );
       
  2619 	TEST1(err == KErrNone,1);
       
  2620 	TEST1(CallStatusResult.iStatus == CTelephony::EStatusConnected,1);	
       
  2621 	
       
  2622 	// Get the call capabilities of the first call
       
  2623 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2624 	TEST1(err==KErrNone,1);
       
  2625 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2626 	
       
  2627 	// Check that the call capabilties are that the call can be swapped 
       
  2628 	// but not held or resumed.
       
  2629 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2630 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2631 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2632  
       
  2633 	// Get the call capabilities of the second call
       
  2634 	err = iTelephony->GetCallDynamicCaps(testCallParams2.iCallId, *callCapsData);
       
  2635 	TEST1(err==KErrNone,1);
       
  2636 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2637 	
       
  2638 	// Check that the call capabilties are that the call can be swapped
       
  2639 	// but not held or resumed.
       
  2640 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsHold), 1);
       
  2641 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2642 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);
       
  2643 	
       
  2644 	
       
  2645 	INFO_PRINTF1(_L("END TEST 6"));
       
  2646 	
       
  2647 	
       
  2648 	
       
  2649 	//
       
  2650 	//
       
  2651 	// TEST 7: Error case
       
  2652 	// Hang up the call. Retrieve the call capabilities. 
       
  2653 	//
       
  2654 	//
       
  2655 	
       
  2656 	INFO_PRINTF1(_L(" TEST 7 Dynamic Call Caps. Get caps in hungup state "));
       
  2657 	
       
  2658 	
       
  2659 	// Hang up call 1  
       
  2660 	CTestHangupAct* testHangupAct1 = CTestHangupAct::NewLC(this, iTelephony);	
       
  2661 	testHangupAct1->TestHangup(testCallParams1);
       
  2662 	CActiveScheduler::Start();	
       
  2663 	
       
  2664 	// Get the call capabilities of Call 1
       
  2665 	err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, *callCapsData);
       
  2666 	TEST1(err==KErrAccessDenied, 1);	 
       
  2667 	
       
  2668 	// Get the call capabilities of Call 2
       
  2669 	err = iTelephony->GetCallDynamicCaps(testCallParams2.iCallId, *callCapsData);
       
  2670 	TEST1(err==KErrNone, 1);
       
  2671 	INFO_PRINTF2(_L("iControlCaps is %x"), callCapsResults.iControlCaps);
       
  2672 	
       
  2673 	// Check that the call capabilties are that the call   
       
  2674 	// can be held or swapped.
       
  2675 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsHold, 1);
       
  2676 	TEST1(callCapsResults.iControlCaps & CTelephony::KCapsSwap, 1);
       
  2677 	TEST1(!(callCapsResults.iControlCaps & CTelephony::KCapsResume), 1);	
       
  2678 	
       
  2679 	INFO_PRINTF1(_L("END TEST 7")); 
       
  2680 	
       
  2681 	// Hang up Call 2 for completion.
       
  2682 	testHangupAct1->TestHangup(testCallParams2);
       
  2683 	CActiveScheduler::Start();	
       
  2684 		 
       
  2685 	CleanupStack::PopAndDestroy(testHangupAct1);
       
  2686 	CleanupStack::PopAndDestroy(testSwapAct1);
       
  2687 	CleanupStack::PopAndDestroy(testResumeAct1);
       
  2688 	CleanupStack::PopAndDestroy(testHoldAct1);
       
  2689 	CleanupStack::PopAndDestroy(testDialNewCallAct2);
       
  2690 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
  2691 	
       
  2692 	
       
  2693 	return TestStepResult();
       
  2694 	}
       
  2695 
       
  2696 
       
  2697 CTestCallFuncFlightModeOnWithPublishSubscribe::CTestCallFuncFlightModeOnWithPublishSubscribe(TInt& aCallCount)
       
  2698 /** Each test step initialises it's own name
       
  2699 */
       
  2700 : iCallCount(aCallCount)
       
  2701 {
       
  2702 	// store the name of this test case
       
  2703 	// this is the name that is used by the script file
       
  2704 	SetTestStepName(_L("TestCallFuncFlightModeOnWithPublishSubscribe"));
       
  2705 }
       
  2706 
       
  2707 /**
       
  2708 @SYMTestCaseID Etel3rdParty 16.1, TestCallFuncFlightModeOn
       
  2709 @SYMTestCaseDesc Test DialNewCall, HangupCall, AnswerIncomingCall,
       
  2710 *  Hold, Resume, Swap 3rd party APIs
       
  2711 @SYMFssID SGL.GT0166.054 v1.3 A2_Telephony_Functional_Specification.doc, 
       
  2712 * REQ 2116.3.1/3/5/7/8/19/20
       
  2713 */
       
  2714 
       
  2715 enum TVerdict CTestCallFuncFlightModeOnWithPublishSubscribe::doTestStepL()
       
  2716 {
       
  2717 	INFO_PRINTF1(_L("START TEST 16.1"));	
       
  2718 	 
       
  2719 	SetTestNumber(15); 
       
  2720 	
       
  2721 	// Set up phonePowerProperty variable so that flight mode can be manipulated.
       
  2722 	RProperty phonePowerProperty;
       
  2723 	User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid));
       
  2724 	CleanupClosePushL(phonePowerProperty);
       
  2725 
       
  2726 	//
       
  2727 	//
       
  2728 	// DialNewCall - Flight Mode on
       
  2729 	//
       
  2730 	//
       
  2731 	
       
  2732 	INFO_PRINTF1(_L(" TEST: DialNewCall disallowed when flight mode on "));
       
  2733 	 
       
  2734 	//Set the call parameters for call 1
       
  2735 	_LIT(KGoodNumber,"1789");
       
  2736 	CTelephony::TCallParamsV1 callParams1;
       
  2737 	callParams1.iIdRestrict = CTelephony::ESendMyId;
       
  2738 	CTelephony::TCallParamsV1Pckg callParamsPckg1(callParams1);	
       
  2739 	
       
  2740 	TTestCallParams testCallParams1;
       
  2741 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  2742 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  2743 	testCallParams1.iTelAddress.iTelNumber = KGoodNumber;
       
  2744 	testCallParams1.iExpStat = KErrNone;
       
  2745 	testCallParams1.iLine = CTelephony::EVoiceLine; 
       
  2746  
       
  2747 	
       
  2748 	// Create active DialNewCallAct objects
       
  2749 	CTestDialNewCallAct* testDialNewCallAct1 = CTestDialNewCallAct::NewLC(this, iTelephony);
       
  2750 	 
       
  2751 	// Switch flight mode on (ie radio mode off)
       
  2752 	TRequestStatus requeststatus;
       
  2753 	phonePowerProperty.Subscribe(requeststatus);
       
  2754 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
       
  2755 	User::WaitForRequest(requeststatus);
       
  2756 	TEST(requeststatus.Int() == KErrNone);	
       
  2757 	 
       
  2758 	// Set expected status to KErrAccessDenied as this should be returned in
       
  2759 	// the case where flight mode is on.
       
  2760 	testCallParams1.iExpStat = KErrAccessDenied;	
       
  2761 	
       
  2762 	// Attempt call.	 
       
  2763 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
  2764 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  2765 	CActiveScheduler::Start();
       
  2766 	
       
  2767 	
       
  2768 	//
       
  2769 	//
       
  2770 	// HangUpCall - Flight Mode on
       
  2771 	//
       
  2772 	//
       
  2773 	
       
  2774 	INFO_PRINTF1(_L(" TEST: Hang up disallowed when flight mode on "));
       
  2775 	
       
  2776 	// Switch flight mode off so that a call can be made.
       
  2777 	phonePowerProperty.Subscribe(requeststatus);
       
  2778 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn));
       
  2779 	User::WaitForRequest(requeststatus);
       
  2780 	TEST(requeststatus.Int() == KErrNone);	
       
  2781 	 
       
  2782 	// Make call.	 
       
  2783 	testCallParams1.iExpStat = KErrNone;	
       
  2784 	testCallParams1.iCallId = CTelephony::EISVMaxNumOfCalls;
       
  2785 	testDialNewCallAct1->TestDialNewCall(testCallParams1);
       
  2786 	CActiveScheduler::Start();
       
  2787 	
       
  2788 	// Switch flight mode on. Hangup attempt should fail.
       
  2789 	phonePowerProperty.Subscribe(requeststatus);
       
  2790 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
       
  2791 	User::WaitForRequest(requeststatus);
       
  2792 	TEST(requeststatus.Int() == KErrNone);	
       
  2793 	
       
  2794 	INFO_PRINTF1(_L("Attempt to hangup the call"));
       
  2795 	// Create an active HangupAct object
       
  2796 	CTestHangupAct* testHangupAct = CTestHangupAct::NewLC(this, iTelephony);	
       
  2797 	testCallParams1.iExpStat = KErrAccessDenied;
       
  2798 	testHangupAct->TestHangup(testCallParams1);
       
  2799 	CActiveScheduler::Start();
       
  2800 	
       
  2801 	// Switch flight mode off and hang up call in preparation
       
  2802 	// for next test.
       
  2803 	phonePowerProperty.Subscribe(requeststatus);
       
  2804 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn));
       
  2805 	User::WaitForRequest(requeststatus);
       
  2806 	TEST(requeststatus.Int() == KErrNone);	
       
  2807 
       
  2808 	testCallParams1.iExpStat = KErrNone;
       
  2809 	testHangupAct->TestHangup(testCallParams1);
       
  2810 	CActiveScheduler::Start();
       
  2811 	
       
  2812 	
       
  2813 	//
       
  2814 	//
       
  2815 	// Answer Incoming Call - Flight Mode on
       
  2816 	//
       
  2817 	//
       
  2818 	
       
  2819 	INFO_PRINTF1(_L(" TEST: Answer incoming call disallowed when flight mode on "));
       
  2820 	
       
  2821 	// Create an active AnswerIncomingCallAct object
       
  2822 	CTestAnswerIncomingCallAct* testAnswerIncomingCallAct1 = CTestAnswerIncomingCallAct::NewLC(this, iTelephony);
       
  2823 	
       
  2824 	//Set the call parameters to receive call 1
       
  2825 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  2826 	testCallParams1.iCallParamsV1Pckg = NULL;
       
  2827 	testCallParams1.iExpStat = KErrNone;
       
  2828 	
       
  2829  	//initiate callback
       
  2830 	testAnswerIncomingCallAct1->CallMe(iCallCount);
       
  2831 	
       
  2832 	CTelephony::TCallStatusV1 status;
       
  2833 	CTelephony::TCallStatusV1Pckg statusPckg(status);	
       
  2834 	iTelephony->GetLineStatus(testCallParams1.iLine,  statusPckg);
       
  2835 	TEST1(status.iStatus == CTelephony::EStatusRinging, ETrue);
       
  2836 	
       
  2837 	// Switch flight mode on and  attempt to answer the incoming call.
       
  2838 	phonePowerProperty.Subscribe(requeststatus);
       
  2839 	User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff));
       
  2840 	User::WaitForRequest(requeststatus);
       
  2841 	TEST(requeststatus.Int() == KErrNone);	
       
  2842 	
       
  2843 	testCallParams1.iExpStat = KErrAccessDenied;
       
  2844 	testAnswerIncomingCallAct1->TestAnswerIncomingCall(testCallParams1);
       
  2845 	CActiveScheduler::Start();
       
  2846 	 
       
  2847 	//
       
  2848 	//
       
  2849 	// Hold Call - Flight Mode on
       
  2850 	//
       
  2851 	//
       
  2852 	
       
  2853 	INFO_PRINTF1(_L(" TEST: Hold call disallowed when flight mode on "));
       
  2854 	
       
  2855 	// Set up call parms
       
  2856 	testCallParams1.iLine = CTelephony::EVoiceLine;
       
  2857 	testCallParams1.iCallParamsV1Pckg = &callParamsPckg1;
       
  2858 	testCallParams1.iTelAddress.iTelNumber = KGoodNumber;
       
  2859 	testCallParams1.iExpStat = KErrNone;
       
  2860 	testCallParams1.iLine = CTelephony::EVoiceLine; 
       
  2861 	
       
  2862 	// Create an active TestHoldAct object
       
  2863 	CTestHoldAct* testHoldAct = CTestHoldAct::NewLC(this, iTelephony);	
       
  2864 	
       
  2865 	testCallParams1.iExpStat=KErrAccessDenied;
       
  2866 	testHoldAct->TestHold(testCallParams1);
       
  2867 	CActiveScheduler::Start();
       
  2868 	
       
  2869 	//
       
  2870 	//
       
  2871 	// Resume Call - Flight Mode on
       
  2872 	//
       
  2873 	//
       
  2874 	
       
  2875 	INFO_PRINTF1(_L(" TEST: Resume call disallowed when flight mode on "));
       
  2876 	
       
  2877 	CTestResumeAct* testResumeAct1 = CTestResumeAct::NewLC(this, iTelephony);	
       
  2878 	
       
  2879 	// Attempt to resume the call using the ETEL 3rdparty API
       
  2880 	testCallParams1.iExpStat = KErrAccessDenied;		
       
  2881 	testResumeAct1->TestResume(testCallParams1);
       
  2882 	CActiveScheduler::Start();
       
  2883 	
       
  2884 	//
       
  2885 	//
       
  2886 	// Swap Call - Flight Mode on
       
  2887 	//
       
  2888 	//
       
  2889 	
       
  2890 	INFO_PRINTF1(_L(" TEST: Swap call disallowed when flight mode on "));
       
  2891 	
       
  2892 	CTestSwapAct* testSwapAct1 = CTestSwapAct::NewLC(this, iTelephony);	
       
  2893 	
       
  2894 	
       
  2895 	// Set up parameters for a second call
       
  2896 	CTelephony::TCallParamsV1 callParams2;
       
  2897 	callParams2.iIdRestrict = CTelephony::ESendMyId;
       
  2898 	CTelephony::TCallParamsV1Pckg callParamsPckg2(callParams2);	
       
  2899 	TTestCallParams testCallParams2;
       
  2900 	testCallParams2.iLine = CTelephony::EVoiceLine;
       
  2901 	testCallParams2.iCallParamsV1Pckg = &callParamsPckg2;
       
  2902 	testCallParams2.iTelAddress.iTelNumber = KGoodNumber;
       
  2903 	testCallParams2.iExpStat = KErrNone;
       
  2904 	
       
  2905 	// Attempt a call to the Swap ETEL 3rdparty API
       
  2906 	testCallParams1.iExpStat = KErrAccessDenied;		
       
  2907 	testSwapAct1->TestSwap(testCallParams1, testCallParams2);
       
  2908 	CActiveScheduler::Start();
       
  2909 	
       
  2910 	//
       
  2911 	//
       
  2912 	// Test GetCallDynamicCaps with flight mode on.
       
  2913 	//
       
  2914 	//
       
  2915 	
       
  2916 	INFO_PRINTF1(_L("Test retrieval of dynamic caps - flight mode on"));
       
  2917 	
       
  2918 	// Get the call capabilities 
       
  2919 	CTelephony::TCallCapsV1 callCaps;
       
  2920 	CTelephony::TCallCapsV1Pckg callCapsPckg(callCaps);
       
  2921 	TInt err = iTelephony->GetCallDynamicCaps(testCallParams1.iCallId, callCapsPckg);
       
  2922 	TEST1(err==KErrAccessDenied, ETrue);
       
  2923 		
       
  2924 	INFO_PRINTF1(_L("END TEST 16.1"));
       
  2925 	
       
  2926 	CleanupStack::PopAndDestroy(testSwapAct1);
       
  2927 	CleanupStack::PopAndDestroy(testResumeAct1);
       
  2928 	CleanupStack::PopAndDestroy(testHoldAct);
       
  2929 	CleanupStack::PopAndDestroy(testAnswerIncomingCallAct1);
       
  2930 	CleanupStack::PopAndDestroy(testHangupAct);
       
  2931 	CleanupStack::PopAndDestroy(testDialNewCallAct1);
       
  2932 	CleanupStack::PopAndDestroy(&phonePowerProperty);	 
       
  2933 	 
       
  2934 	return TestStepResult() ;	  
       
  2935 	 
       
  2936 }
       
  2937 
       
  2938 
       
  2939 CTestDeprecatedDataCallAPIs::CTestDeprecatedDataCallAPIs()
       
  2940 /** Each test step initialises it's own name
       
  2941 */
       
  2942 {
       
  2943     SetTestStepName(_L("TestDeprecatedDataCallAPIs"));
       
  2944 }
       
  2945 
       
  2946 
       
  2947 /**
       
  2948     @SYMTestCaseID           TEL/EtelIsv/GT0246/1035
       
  2949     @SYMREQ                  CNON-67WJ2G
       
  2950     @SYMTestCaseDesc         Test deprecated data call APIs
       
  2951     @SYMTestPriority         Critical
       
  2952     @SYMTestActions          Calls each deprecated API and ensures it returns KErrNotSupported
       
  2953     @SYMTestExpectedResults  Pass
       
  2954     @SYMTestType             CT
       
  2955 */
       
  2956 enum TVerdict CTestDeprecatedDataCallAPIs::doTestStepL()
       
  2957 {
       
  2958     TInt  result;
       
  2959     TInt  callStatus;
       
  2960     TRequestStatus  requestStatus;
       
  2961     TInt  dataChannel;
       
  2962     TBuf<CTelephony::KMaxTelNumberSize>  dialNumber;
       
  2963 
       
  2964     result = iTelephony->FindDeviceStatus(callStatus);
       
  2965     TEST1(result == KErrNotSupported, ETrue);
       
  2966 
       
  2967     result = iTelephony->EstablishDataCall(dataChannel, dialNumber);
       
  2968     TEST1(result == KErrNotSupported, ETrue);
       
  2969 
       
  2970     iTelephony->EstablishDataCall(requestStatus, dataChannel, dialNumber);
       
  2971     User::WaitForRequest(requestStatus);
       
  2972     TEST1(requestStatus.Int() == KErrNotSupported, ETrue);
       
  2973 
       
  2974     iTelephony->EstablishDataCall(requestStatus, dataChannel, dialNumber);
       
  2975     iTelephony->CancelEstablishDataCall();
       
  2976     User::WaitForRequest(requestStatus);
       
  2977     TEST1(requestStatus.Int() == KErrNotSupported, ETrue);
       
  2978 
       
  2979     result = iTelephony->TerminateDataCall();
       
  2980     TEST1(result == KErrNotSupported, ETrue);
       
  2981 
       
  2982     result = iTelephony->ReceiveDataCall(dataChannel);
       
  2983     TEST1(result == KErrNotSupported, ETrue);
       
  2984 
       
  2985     iTelephony->ReceiveDataCall(requestStatus, dataChannel);
       
  2986     User::WaitForRequest(requestStatus);
       
  2987     TEST1(requestStatus.Int() == KErrNotSupported, ETrue);
       
  2988 	 
       
  2989     iTelephony->ReceiveDataCall(requestStatus, dataChannel);
       
  2990     iTelephony->CancelReceiveDataCall();
       
  2991     User::WaitForRequest(requestStatus);
       
  2992     TEST1(requestStatus.Int() == KErrNotSupported, ETrue);
       
  2993 	 
       
  2994     return TestStepResult();
       
  2995 } // CTestDeprecatedDataCallAPIs::doTestStepL
       
  2996