telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_LoopBackcdatacallcancel.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 // Test some "canceling while making a data call" scenarios. 
       
    15 // This file implements some canceling calls while making a data call test scenarios.
       
    16 // See CDataCall.cpp for fully documented test scenario.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22 */
       
    23 
       
    24 #include <e32test.h>
       
    25 #include <etelmm.h>
       
    26 #include "Te_LoopBackcdatacallcancel.h"
       
    27 #include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
       
    28 
       
    29 //
       
    30 // Test-side class
       
    31 // With the assistance of the base class, this class must start the emulator
       
    32 // and drive the ETel API.
       
    33 //
       
    34 CTestDriveDataCallCancel* CTestDriveDataCallCancel::NewL(const TScriptList aScriptListEntry)
       
    35 	{
       
    36 	CTestDriveDataCallCancel* aA=new(ELeave) CTestDriveDataCallCancel(aScriptListEntry);
       
    37 	CleanupStack::PushL(aA);
       
    38 	aA->ConstructL();
       
    39 	CleanupStack::Pop();
       
    40 	return aA;
       
    41 	}
       
    42 
       
    43 CTestDriveDataCallCancel::CTestDriveDataCallCancel(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
       
    44 	{}
       
    45 
       
    46 TInt CTestDriveDataCallCancel::RunTestL()
       
    47 	{
       
    48 	iCurrentScript=iScriptListEntry;
       
    49 	return StartEmulatorL();
       
    50 	}
       
    51 
       
    52 TInt CTestDriveDataCallCancel::DriveETelApiL()
       
    53 //
       
    54 // This function contains the real meat of the Client-side test code
       
    55 //
       
    56 	{
       
    57 	_LIT(KDataLineName,"Data");
       
    58 	RLine line;
       
    59 	INFO_PRINTF1(_L("Opening Data Line\n"));
       
    60 	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);
       
    61 
       
    62 	INFO_PRINTF1(_L("Opening New Data Call\n"));
       
    63 	RCall call;
       
    64 	TESTL(call.OpenNewCall(line)==KErrNone);
       
    65 
       
    66 	TRequestStatus stat0,reqStatus;
       
    67 
       
    68 	RMobilePhone::TMMTableSettings tableSettings;
       
    69 	tableSettings.iLocId=KInternetAccessPoint;
       
    70 	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
       
    71 	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
       
    72 	User::WaitForRequest(reqStatus);
       
    73 	TESTL(reqStatus == KErrNone);
       
    74 
       
    75 	_LIT(KDialString,"+1234");
       
    76 	call.Dial(stat0,KDialString);
       
    77 
       
    78 	User::After(1000000L); 
       
    79 	call.DialCancel();
       
    80 
       
    81 	User::WaitForRequest(stat0);
       
    82 	TESTL((stat0==KErrCancel) || (stat0==KErrTimedOut) || (stat0==KErrNone));
       
    83 
       
    84 	line.Close();
       
    85 	call.Close();
       
    86 	return KErrNone;
       
    87 	}
       
    88 
       
    89 //
       
    90 // Emulator-side class
       
    91 // With the assistance of the base class, this class must run the designated script
       
    92 //
       
    93 CTestDataCallCancel* CTestDataCallCancel::NewL(const TScript* aScript)
       
    94 	{
       
    95 	CTestDataCallCancel* aA=new(ELeave) CTestDataCallCancel(aScript);
       
    96 	CleanupStack::PushL(aA);
       
    97 	aA->ConstructL();
       
    98 	CleanupStack::Pop();
       
    99 	return aA;
       
   100 	}
       
   101 
       
   102 CTestDataCallCancel::CTestDataCallCancel(const TScript* aScript) : iScript(aScript)
       
   103 	{}
       
   104 
       
   105 void CTestDataCallCancel::ConstructL()
       
   106 	{
       
   107 	CATScriptEng::ConstructL();
       
   108 	}
       
   109 
       
   110 TInt CTestDataCallCancel::Start()
       
   111 	{
       
   112 	StartScript(iScript);
       
   113 	return KErrNone;
       
   114 	}
       
   115 
       
   116 void CTestDataCallCancel::SpecificAlgorithmL(TInt /* aParam */)
       
   117 	{
       
   118 	}
       
   119 
       
   120 void CTestDataCallCancel::Complete(TInt aError)
       
   121 	{
       
   122 	iReturnValue=aError;
       
   123 	CActiveScheduler::Stop();
       
   124 	}