mmtestenv/mmtestfwunittest/src/tsu_stubs/TestStepVirtualStub.cpp
changeset 0 b8ed18f6c07b
equal deleted inserted replaced
-1:000000000000 0:b8ed18f6c07b
       
     1 // Copyright (c) 2002-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 // This file is a helper for TestFramework Unit Test classes.
       
    15 // It subclasses the abstract RTestStep to produce a working class we can test
       
    16 // 
       
    17 //
       
    18 
       
    19 // EPOC includes
       
    20 #include <e32base.h>
       
    21 
       
    22 // Test system includes
       
    23 #include <testframework.h>
       
    24 
       
    25 #include "TestStepVirtualStub.h"
       
    26 
       
    27 // --------------------------------------------
       
    28 // RTestStepVirtualStub
       
    29 
       
    30 RTestStepVirtualStub* RTestStepVirtualStub::NewL()
       
    31 	{
       
    32 	RTestStepVirtualStub* self = new(ELeave) RTestStepVirtualStub;
       
    33 	return self;
       
    34 	}
       
    35 
       
    36 // Each test step initialises its own name
       
    37 RTestStepVirtualStub::RTestStepVirtualStub()
       
    38 	{
       
    39 	iTestStepName = KTestStepVirtualStubName;
       
    40 
       
    41 	iPreambleRun = EFalse;
       
    42 	iPostambleRun = EFalse;
       
    43 	iStepRun = EFalse;
       
    44 	}
       
    45 
       
    46 // preamble
       
    47 TVerdict RTestStepVirtualStub::OpenL()
       
    48 	{
       
    49 	INFO_PRINTF1(_L("RTestStepVirtualStub::OpenL() has been called"));
       
    50 	iPreambleRun = ETrue;
       
    51 	return iTestStepResult = EPass;
       
    52 	}
       
    53 
       
    54 // postamble
       
    55 void RTestStepVirtualStub::Close()
       
    56 	{
       
    57 	INFO_PRINTF1(_L("RTestStepVirtualStub::Close() has been called"));
       
    58 	iPostambleRun = ETrue;
       
    59 	}
       
    60 
       
    61 // do the test step
       
    62 TVerdict RTestStepVirtualStub::DoTestStepL()
       
    63 	{
       
    64 	INFO_PRINTF1(_L("RTestStepVirtualStub::DoTestStepL() has been called"));
       
    65 	iStepRun = ETrue;
       
    66 	return iTestStepResult = EPass;
       
    67 	}
       
    68 
       
    69 // Extra methods by which RTestStep accessors can be tested.
       
    70 // Not for use by anything except Test Harnesses
       
    71 CTestSuite* RTestStepVirtualStub::TestGetSuite() const
       
    72 	{
       
    73 	return iSuite;
       
    74 	}
       
    75 
       
    76 TVerdict RTestStepVirtualStub::TestGetResult() const
       
    77 	{
       
    78 	return iTestStepResult;
       
    79 	}
       
    80 
       
    81 void RTestStepVirtualStub::TestSetStepName(const TDesC& aName)
       
    82 	{
       
    83 	iTestStepName = aName;
       
    84 	}
       
    85 
       
    86 TBool RTestStepVirtualStub::PreambleRun()
       
    87 	{ 
       
    88 	return iPreambleRun;
       
    89 	}
       
    90 
       
    91 TBool RTestStepVirtualStub::PostambleRun()
       
    92 	{
       
    93 	return iPostambleRun;
       
    94 	}
       
    95 
       
    96 TBool RTestStepVirtualStub::StepRun()
       
    97 	{
       
    98 	return iStepRun;
       
    99 	}
       
   100 
       
   101 TBool RTestStepVirtualStub::TestGetBoolFromConfig(const TDesC &aSectName, const TDesC &aKeyName, TBool &aResult)
       
   102 	{
       
   103 	return GetBoolFromConfig(aSectName, aKeyName, aResult);
       
   104 	}; 
       
   105 
       
   106 
       
   107 // --------------------------------------------
       
   108 // RTestStepVirtualStub2
       
   109 
       
   110 RTestStepVirtualStub2* RTestStepVirtualStub2::NewL()
       
   111 	{
       
   112 	RTestStepVirtualStub2* self = new(ELeave) RTestStepVirtualStub2;
       
   113 	return self;
       
   114 	}
       
   115 
       
   116 // Each test step initialises its own name
       
   117 RTestStepVirtualStub2::RTestStepVirtualStub2()
       
   118 	{
       
   119 	iTestStepName = KTestStepVirtualStub2Name;
       
   120 
       
   121 	iPreambleRun = EFalse;
       
   122 	iPostambleRun = EFalse;
       
   123 	iStepRun = EFalse;
       
   124 	}
       
   125