os/mm/mmtestenv/mmtestfwunittest/src/tsu_stubs/TestStepVirtualStub.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmtestenv/mmtestfwunittest/src/tsu_stubs/TestStepVirtualStub.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,125 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// This file is a helper for TestFramework Unit Test classes.
    1.18 +// It subclasses the abstract RTestStep to produce a working class we can test
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +// EPOC includes
    1.23 +#include <e32base.h>
    1.24 +
    1.25 +// Test system includes
    1.26 +#include <testframework.h>
    1.27 +
    1.28 +#include "TestStepVirtualStub.h"
    1.29 +
    1.30 +// --------------------------------------------
    1.31 +// RTestStepVirtualStub
    1.32 +
    1.33 +RTestStepVirtualStub* RTestStepVirtualStub::NewL()
    1.34 +	{
    1.35 +	RTestStepVirtualStub* self = new(ELeave) RTestStepVirtualStub;
    1.36 +	return self;
    1.37 +	}
    1.38 +
    1.39 +// Each test step initialises its own name
    1.40 +RTestStepVirtualStub::RTestStepVirtualStub()
    1.41 +	{
    1.42 +	iTestStepName = KTestStepVirtualStubName;
    1.43 +
    1.44 +	iPreambleRun = EFalse;
    1.45 +	iPostambleRun = EFalse;
    1.46 +	iStepRun = EFalse;
    1.47 +	}
    1.48 +
    1.49 +// preamble
    1.50 +TVerdict RTestStepVirtualStub::OpenL()
    1.51 +	{
    1.52 +	INFO_PRINTF1(_L("RTestStepVirtualStub::OpenL() has been called"));
    1.53 +	iPreambleRun = ETrue;
    1.54 +	return iTestStepResult = EPass;
    1.55 +	}
    1.56 +
    1.57 +// postamble
    1.58 +void RTestStepVirtualStub::Close()
    1.59 +	{
    1.60 +	INFO_PRINTF1(_L("RTestStepVirtualStub::Close() has been called"));
    1.61 +	iPostambleRun = ETrue;
    1.62 +	}
    1.63 +
    1.64 +// do the test step
    1.65 +TVerdict RTestStepVirtualStub::DoTestStepL()
    1.66 +	{
    1.67 +	INFO_PRINTF1(_L("RTestStepVirtualStub::DoTestStepL() has been called"));
    1.68 +	iStepRun = ETrue;
    1.69 +	return iTestStepResult = EPass;
    1.70 +	}
    1.71 +
    1.72 +// Extra methods by which RTestStep accessors can be tested.
    1.73 +// Not for use by anything except Test Harnesses
    1.74 +CTestSuite* RTestStepVirtualStub::TestGetSuite() const
    1.75 +	{
    1.76 +	return iSuite;
    1.77 +	}
    1.78 +
    1.79 +TVerdict RTestStepVirtualStub::TestGetResult() const
    1.80 +	{
    1.81 +	return iTestStepResult;
    1.82 +	}
    1.83 +
    1.84 +void RTestStepVirtualStub::TestSetStepName(const TDesC& aName)
    1.85 +	{
    1.86 +	iTestStepName = aName;
    1.87 +	}
    1.88 +
    1.89 +TBool RTestStepVirtualStub::PreambleRun()
    1.90 +	{ 
    1.91 +	return iPreambleRun;
    1.92 +	}
    1.93 +
    1.94 +TBool RTestStepVirtualStub::PostambleRun()
    1.95 +	{
    1.96 +	return iPostambleRun;
    1.97 +	}
    1.98 +
    1.99 +TBool RTestStepVirtualStub::StepRun()
   1.100 +	{
   1.101 +	return iStepRun;
   1.102 +	}
   1.103 +
   1.104 +TBool RTestStepVirtualStub::TestGetBoolFromConfig(const TDesC &aSectName, const TDesC &aKeyName, TBool &aResult)
   1.105 +	{
   1.106 +	return GetBoolFromConfig(aSectName, aKeyName, aResult);
   1.107 +	}; 
   1.108 +
   1.109 +
   1.110 +// --------------------------------------------
   1.111 +// RTestStepVirtualStub2
   1.112 +
   1.113 +RTestStepVirtualStub2* RTestStepVirtualStub2::NewL()
   1.114 +	{
   1.115 +	RTestStepVirtualStub2* self = new(ELeave) RTestStepVirtualStub2;
   1.116 +	return self;
   1.117 +	}
   1.118 +
   1.119 +// Each test step initialises its own name
   1.120 +RTestStepVirtualStub2::RTestStepVirtualStub2()
   1.121 +	{
   1.122 +	iTestStepName = KTestStepVirtualStub2Name;
   1.123 +
   1.124 +	iPreambleRun = EFalse;
   1.125 +	iPostambleRun = EFalse;
   1.126 +	iStepRun = EFalse;
   1.127 +	}
   1.128 +