os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestControllerTest/TestControllerUnitTest.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestControllerTest/TestControllerUnitTest.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,236 @@
1.4 +// Copyright (c) 1997-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 +// The unit test class definitions for the CTestController class.
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __TESTCONTROLLERUNITTEST_H__
1.22 +#define __TESTCONTROLLERUNITTEST_H__
1.23 +
1.24 +#include <ecom/test_bed/testbeddefinitions.h>
1.25 +#include "TestControllerStateAccessor.h"
1.26 +#include "TestControllerTransitionValidation.h"
1.27 +#include "TestControllerTransitions.h"
1.28 +
1.29 +// ______________________________________________________________________________
1.30 +//
1.31 +/**
1.32 + @internalComponent
1.33 +
1.34 + Comments : Unit Test for CreateAndDestroy on CTestController, the class under test.
1.35 + */
1.36 +class CTestController_CreateAndDestroy_UnitTest : public CUnitTest
1.37 + {
1.38 +public:
1.39 + /**
1.40 + @fn NewL(CDataLogger& aDataLogger,
1.41 + MUnitTestObserver& aObserver)
1.42 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.43 + cleanup stack.
1.44 + Error Condition : Leaves with the error code.
1.45 + @leave KErrNoMemory
1.46 + @since 7.0
1.47 + @param aDataLogger The output logging object.
1.48 + @param aObserver The observer of this UnitTest.
1.49 + @return CTestController_CreateAndDestroy_UnitTest* The constructed object.
1.50 + @pre None.
1.51 + @post CTestController_CreateAndDestroy_UnitTest is fully constructed, and initialised.
1.52 + */
1.53 + static CTestController_CreateAndDestroy_UnitTest* NewL(CDataLogger& aDataLogger,
1.54 + MUnitTestObserver& aObserver);
1.55 +
1.56 + /**
1.57 + @fn RunError(TInt aError)
1.58 + Intended Usage : Intercept the panic caused by a RunL leave,
1.59 + to restore the CTestController_CreateAndDestroy_UnitTest
1.60 + object to a sensible state.
1.61 + (called by the Active Scheduler immediately before the Panic).
1.62 + Error Condition : @see CUnitTest::RunError().
1.63 + @since 7.0
1.64 + @return TInt KErrNone if cleanup successful, otherwise
1.65 + @see CUnitTest::RunError()
1.66 + @pre CTestController_CreateAndDestroy_UnitTest is fully constructed, and initialised.
1.67 + @post The object has been restored to a sensible state.
1.68 + */
1.69 + inline TInt RunError(TInt aError);
1.70 +
1.71 + /**
1.72 + @fn ~CTestController_CreateAndDestroy_UnitTest()
1.73 + Intended Usage : Standard Destructor.
1.74 + Error Condition : None.
1.75 + @since 7.0
1.76 + @pre CTestController_CreateAndDestroy_UnitTest is fully constructed.
1.77 + @post CTestController_CreateAndDestroy_UnitTest is fully destroyed.
1.78 + */
1.79 + ~CTestController_CreateAndDestroy_UnitTest();
1.80 +
1.81 +private:
1.82 + /**
1.83 + @fn CTestController_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
1.84 + MUnitTestObserver& aObserver)
1.85 + Intended Usage : Default constructor.
1.86 + Error Condition : None.
1.87 + @since 7.0
1.88 + @param aDataLogger The output logging object.
1.89 + @param aObserver The observer of this UnitTest.
1.90 + @param aStateAccessor WhiteBox state access to the CTestController class.
1.91 + @pre None.
1.92 + @post CTestController_CreateAndDestroy_UnitTest is fully constructed.
1.93 + */
1.94 + inline CTestController_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
1.95 + MUnitTestObserver& aObserver);
1.96 +
1.97 + /**
1.98 + @fn void ConstructL()
1.99 + Intended Usage : Second phase of safe two phase construction,
1.100 + to complete the object initialisation.
1.101 + Error Condition : Leaves with an error code.
1.102 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.103 + @since 7.0
1.104 + @return None
1.105 + @pre CTestController_CreateAndDestroy_UnitTest is fully constructed.
1.106 + @post CTestController_CreateAndDestroy_UnitTest is fully initialised.
1.107 + */
1.108 + void ConstructL();
1.109 +
1.110 + /**
1.111 + The context of the Unit Test.
1.112 + i.e The CTestController class tested by this UnitTest's transitions.
1.113 + */
1.114 + CTestController_UnitTestContext* iUTContext;
1.115 + TTestController_StateAccessor* iStateAccessor;
1.116 + // C'tor, d'tor, and method transition validators
1.117 + TTestController_Ctor_TransitionValidator* iCtorValidator;
1.118 + TTestController_Dtor_TransitionValidator* iDtorValidator;
1.119 + RFs iFs;
1.120 + }; // CTestController_CreateAndDestroy_UnitTest
1.121 +
1.122 +// ______________________________________________________________________________
1.123 +//
1.124 +/**
1.125 + @internalComponent
1.126 +
1.127 + Comments : Unit Test for FindTests on CTestController, the class under test.
1.128 + */
1.129 +class CTestController_FindTests_UnitTest : public CUnitTest
1.130 + {
1.131 +public:
1.132 + /**
1.133 + @fn NewL(CDataLogger& aDataLogger,
1.134 + MUnitTestObserver& aObserver)
1.135 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.136 + cleanup stack.
1.137 + Error Condition : Leaves with the error code.
1.138 + @leave KErrNoMemory
1.139 + @since 7.0
1.140 + @param aDataLogger The output logging object.
1.141 + @param aObserver The observer of this UnitTest.
1.142 + @return CTestController_FindTests_UnitTest* The constructed object.
1.143 + @pre None.
1.144 + @post CTestController_FindTests_UnitTest is fully constructed, and initialised.
1.145 + */
1.146 + static CTestController_FindTests_UnitTest* NewL(CDataLogger& aDataLogger,
1.147 + MUnitTestObserver& aObserver);
1.148 +
1.149 + /**
1.150 + @fn RunError(TInt aError)
1.151 + Intended Usage : Intercept the panic caused by a RunL leave,
1.152 + to restore the CTestController_FindTests_UnitTest
1.153 + object to a sensible state.
1.154 + (called by the Active Scheduler immediately before the Panic).
1.155 + Error Condition : @see CUnitTest::RunError().
1.156 + @since 7.0
1.157 + @return TInt KErrNone if cleanup successful, otherwise
1.158 + @see CUnitTest::RunError()
1.159 + @pre CTestController_FindTests_UnitTest is fully constructed, and initialised.
1.160 + @post The object has been restored to a sensible state.
1.161 + */
1.162 + inline TInt RunError(TInt aError);
1.163 +
1.164 + /**
1.165 + @fn ~CTestController_FindTests_UnitTest()
1.166 + Intended Usage : Standard Destructor.
1.167 + Error Condition : None.
1.168 + @since 7.0
1.169 + @pre CTestController_FindTests_UnitTest is fully constructed.
1.170 + @post CTestController_FindTests_UnitTest is fully destroyed.
1.171 + */
1.172 + ~CTestController_FindTests_UnitTest();
1.173 +
1.174 +private:
1.175 + /**
1.176 + @fn CTestController_FindTests_UnitTest(CDataLogger& aDataLogger,
1.177 + MUnitTestObserver& aObserver)
1.178 + Intended Usage : Default constructor.
1.179 + Error Condition : None.
1.180 + @since 7.0
1.181 + @param aDataLogger The output logging object.
1.182 + @param aObserver The observer of this UnitTest.
1.183 + @param aStateAccessor WhiteBox state access to the CTestController class.
1.184 + @pre None.
1.185 + @post CTestController_FindTests_UnitTest is fully constructed.
1.186 + */
1.187 + inline CTestController_FindTests_UnitTest(CDataLogger& aDataLogger,
1.188 + MUnitTestObserver& aObserver);
1.189 +
1.190 + /**
1.191 + @fn void ConstructL()
1.192 + Intended Usage : Second phase of safe two phase construction,
1.193 + to complete the object initialisation.
1.194 + Error Condition : Leaves with an error code.
1.195 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.196 + @since 7.0
1.197 + @return None
1.198 + @pre CTestController_FindTests_UnitTest is fully constructed.
1.199 + @post CTestController_FindTests_UnitTest is fully initialised.
1.200 + */
1.201 + void ConstructL();
1.202 +
1.203 + /**
1.204 + The context of the Unit Test.
1.205 + i.e The CTestController class tested by this UnitTest's transitions.
1.206 + */
1.207 + CTestController_UnitTestContext* iUTContext;
1.208 + TTestController_StateAccessor* iStateAccessor;
1.209 + // C'tor, d'tor, and method transition validators
1.210 + TTestController_Ctor_TransitionValidator* iCtorValidator;
1.211 + TTestController_FindComponents_TransitionValidator* iFindComponentsValidator;
1.212 + TTestController_Start_TransitionValidator* iStartValidator;
1.213 + TTestController_Dtor_TransitionValidator* iDtorValidator;
1.214 + RFs iFs;
1.215 + }; // CTestController_FindTests_UnitTest
1.216 +
1.217 +// ______________________________________________________________________________
1.218 +//
1.219 +
1.220 +class CTestController_CreateAndDestroy_UnitTest_STUB : public CUnitTest
1.221 + {
1.222 +public:
1.223 + static CTestController_CreateAndDestroy_UnitTest_STUB* NewL(CDataLogger& aDataLogger,
1.224 + MUnitTestObserver& aObserver);
1.225 +
1.226 + inline TInt RunError(TInt aError);
1.227 +
1.228 + ~CTestController_CreateAndDestroy_UnitTest_STUB();
1.229 +
1.230 +private:
1.231 + inline CTestController_CreateAndDestroy_UnitTest_STUB(CDataLogger& aDataLogger,
1.232 + MUnitTestObserver& aObserver);
1.233 +
1.234 + void ConstructL();
1.235 +
1.236 + /* No data since class acts as a do nothing stub*/
1.237 + };
1.238 +
1.239 +#endif // __TESTCONTROLLERUNITTEST_H__