telephonyserverplugins/multimodetsy/test/Te_LoopBack/Te_Loopbackcfailinits.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 out the TSY with a series of initialisation failure causes
       
    15 // This file implements tests of the TSY with a series of initialization failure causes.
       
    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_Loopbackcfailinits.h"
       
    27 
       
    28 //
       
    29 // Test-side class
       
    30 // With the assistance of the base class, this class must start the emulator
       
    31 // and drive the ETel API.
       
    32 //
       
    33 CTestDriveFailInit* CTestDriveFailInit::NewL(const TScriptList aScriptListEntry)
       
    34 	{
       
    35 	CTestDriveFailInit* aA=new(ELeave) CTestDriveFailInit(aScriptListEntry);
       
    36 	CleanupStack::PushL(aA);
       
    37 	aA->ConstructL();
       
    38 	CleanupStack::Pop();
       
    39 	return aA;
       
    40 	}
       
    41 
       
    42 CTestDriveFailInit::CTestDriveFailInit(const TScriptList aScriptListEntry) : iScriptListEntry(aScriptListEntry)
       
    43 	{}
       
    44 
       
    45 TInt CTestDriveFailInit::RunTestL()
       
    46 	{
       
    47 	iCurrentScript=iScriptListEntry;
       
    48 	return StartEmulatorL();
       
    49 	}
       
    50 
       
    51 TInt CTestDriveFailInit::DriveETelApiL()
       
    52 //
       
    53 // This function contains the real meat of the Client-side test code
       
    54 //
       
    55 	{
       
    56 	RMobileSmsMessaging sms;
       
    57 	TRequestStatus stat0, stat1;
       
    58 	INFO_PRINTF1(_L("Opening Sms Messaging\n"));
       
    59 	TESTL(sms.Open(iPhone)==KErrNone);
       
    60 
       
    61 	iPhone.Initialise(stat0);
       
    62 	sms.SetReceiveMode (stat1, RMobileSmsMessaging::EReceiveStored);
       
    63 
       
    64 	User::WaitForRequest(stat0);  
       
    65 	TESTL(stat0==KErrEtelModemNotDetected);
       
    66 	INFO_PRINTF1(_L("Phone initialisation completed with KErrEtelModemNotDetected.\n"));
       
    67 
       
    68 	User::WaitForRequest(stat1);
       
    69 	TESTL(stat0==KErrEtelModemNotDetected);
       
    70 	INFO_PRINTF1(_L("SMS SetReceiveMode completed with KErrEtelModemNotDetected.\n"));
       
    71 
       
    72 	// Normally, sms.ReceiveMessage would be called. As this test is expected to fail,
       
    73 	// we don't have to call it.
       
    74 
       
    75 	iPhone.Initialise(stat0);
       
    76 
       
    77 	User::WaitForRequest(stat0);
       
    78 	TESTL(stat0==KErrEtelModemNotDetected);
       
    79 
       
    80 	sms.Close();
       
    81 	return KErrNone;
       
    82 	}
       
    83 
       
    84 //
       
    85 // Emulator-side class
       
    86 // With the assistance of the base class, this class must run the designated script
       
    87 //
       
    88 CTestFailInit* CTestFailInit::NewL(const TScript* aScript)
       
    89 	{
       
    90 	CTestFailInit* aA=new(ELeave) CTestFailInit(aScript);
       
    91 	CleanupStack::PushL(aA);
       
    92 	aA->ConstructL();
       
    93 	CleanupStack::Pop();
       
    94 	return aA;
       
    95 	}
       
    96 
       
    97 CTestFailInit::CTestFailInit(const TScript* aScript) : iScript(aScript)
       
    98 	{}
       
    99 
       
   100 void CTestFailInit::ConstructL()
       
   101 	{
       
   102 	CATScriptEng::ConstructL();
       
   103 	}
       
   104 
       
   105 TInt CTestFailInit::Start()
       
   106 	{
       
   107 	StartScript(iScript);
       
   108 	return KErrNone;
       
   109 	}
       
   110 
       
   111 void CTestFailInit::SpecificAlgorithmL(TInt /* aParam */)
       
   112 	{
       
   113 	}
       
   114 
       
   115 void CTestFailInit::Complete(TInt aError)
       
   116 	{
       
   117 	iReturnValue=aError;
       
   118 	CActiveScheduler::Stop();
       
   119 	}