os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/ComponentTesterTest/ComponentTesterUnitTest.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/ComponentTesterTest/ComponentTesterUnitTest.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,309 @@
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 CComponentTester class.
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __COMPONENTTESTERUNITTEST_H__
1.22 +#define __COMPONENTTESTERUNITTEST_H__
1.23 +
1.24 +#include <ecom/test_bed/testbeddefinitions.h>
1.25 +#include "ComponentTesterStateAccessor.h"
1.26 +#include "ComponentTesterTransitionValidation.h"
1.27 +#include "ComponentTesterTransitions.h"
1.28 +
1.29 +// ______________________________________________________________________________
1.30 +//
1.31 +/**
1.32 + @internalComponent
1.33 +
1.34 + Comments : Unit Test for CreateAndDestroy on CComponentTester, the class under test.
1.35 + */
1.36 +class CComponentTester_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 CComponentTester_CreateAndDestroy_UnitTest* The constructed object.
1.50 + @pre None.
1.51 + @post CComponentTester_CreateAndDestroy_UnitTest is fully constructed, and initialised.
1.52 + */
1.53 + static CComponentTester_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 CComponentTester_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 CComponentTester_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 ~CComponentTester_CreateAndDestroy_UnitTest()
1.73 + Intended Usage : Standard Destructor.
1.74 + Error Condition : None.
1.75 + @since 7.0
1.76 + @pre CComponentTester_CreateAndDestroy_UnitTest is fully constructed.
1.77 + @post CComponentTester_CreateAndDestroy_UnitTest is fully destroyed.
1.78 + */
1.79 + ~CComponentTester_CreateAndDestroy_UnitTest();
1.80 +
1.81 +private:
1.82 + /**
1.83 + @fn CComponentTester_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 CComponentTester class.
1.91 + @pre None.
1.92 + @post CComponentTester_CreateAndDestroy_UnitTest is fully constructed.
1.93 + */
1.94 + inline CComponentTester_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 CComponentTester_CreateAndDestroy_UnitTest is fully constructed.
1.106 + @post CComponentTester_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 CComponentTester class tested by this UnitTest's transitions.
1.113 + */
1.114 + CComponentTester_UnitTestContext* iUTContext;
1.115 + TComponentTester_StateAccessor* iStateAccessor;
1.116 + // C'tor, d'tor, and method transition validators
1.117 + TComponentTester_Ctor_TransitionValidator* iCtorValidator;
1.118 + TComponentTester_Dtor_TransitionValidator* iDtorValidator;
1.119 + }; // CComponentTester_CreateAndDestroy_UnitTest
1.120 +
1.121 +// ______________________________________________________________________________
1.122 +//
1.123 +/**
1.124 + @internalComponent
1.125 +
1.126 + Comments : Unit Test for ManageUnitTests on CComponentTester, the class under test.
1.127 + */
1.128 +class CComponentTester_ManageUnitTests_UnitTest : public CUnitTest
1.129 + {
1.130 +public:
1.131 + /**
1.132 + @fn NewL(CDataLogger& aDataLogger,
1.133 + MUnitTestObserver& aObserver)
1.134 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.135 + cleanup stack.
1.136 + Error Condition : Leaves with the error code.
1.137 + @leave KErrNoMemory
1.138 + @since 7.0
1.139 + @param aDataLogger The output logging object.
1.140 + @param aObserver The observer of this UnitTest.
1.141 + @return CComponentTester_ManageUnitTests_UnitTest* The constructed object.
1.142 + @pre None.
1.143 + @post CComponentTester_ManageUnitTests_UnitTest is fully constructed, and initialised.
1.144 + */
1.145 + static CComponentTester_ManageUnitTests_UnitTest* NewL(CDataLogger& aDataLogger,
1.146 + MUnitTestObserver& aObserver);
1.147 +
1.148 + /**
1.149 + @fn RunError(TInt aError)
1.150 + Intended Usage : Intercept the panic caused by a RunL leave,
1.151 + to restore the CComponentTester_ManageUnitTests_UnitTest
1.152 + object to a sensible state.
1.153 + (called by the Active Scheduler immediately before the Panic).
1.154 + Error Condition : @see CUnitTest::RunError().
1.155 + @since 7.0
1.156 + @return TInt KErrNone if cleanup successful, otherwise
1.157 + @see CUnitTest::RunError()
1.158 + @pre CComponentTester_ManageUnitTests_UnitTest is fully constructed, and initialised.
1.159 + @post The object has been restored to a sensible state.
1.160 + */
1.161 + inline TInt RunError(TInt aError);
1.162 +
1.163 + /**
1.164 + @fn ~CComponentTester_ManageUnitTests_UnitTest()
1.165 + Intended Usage : Standard Destructor.
1.166 + Error Condition : None.
1.167 + @since 7.0
1.168 + @pre CComponentTester_ManageUnitTests_UnitTest is fully constructed.
1.169 + @post CComponentTester_ManageUnitTests_UnitTest is fully destroyed.
1.170 + */
1.171 + ~CComponentTester_ManageUnitTests_UnitTest();
1.172 +
1.173 +private:
1.174 + /**
1.175 + @fn CComponentTester_ManageUnitTests_UnitTest(CDataLogger& aDataLogger,
1.176 + MUnitTestObserver& aObserver)
1.177 + Intended Usage : Default constructor.
1.178 + Error Condition : None.
1.179 + @since 7.0
1.180 + @param aDataLogger The output logging object.
1.181 + @param aObserver The observer of this UnitTest.
1.182 + @param aStateAccessor WhiteBox state access to the CComponentTester class.
1.183 + @pre None.
1.184 + @post CComponentTester_ManageUnitTests_UnitTest is fully constructed.
1.185 + */
1.186 + inline CComponentTester_ManageUnitTests_UnitTest(CDataLogger& aDataLogger,
1.187 + MUnitTestObserver& aObserver);
1.188 +
1.189 + /**
1.190 + @fn void ConstructL()
1.191 + Intended Usage : Second phase of safe two phase construction,
1.192 + to complete the object initialisation.
1.193 + Error Condition : Leaves with an error code.
1.194 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.195 + @since 7.0
1.196 + @return None
1.197 + @pre CComponentTester_ManageUnitTests_UnitTest is fully constructed.
1.198 + @post CComponentTester_ManageUnitTests_UnitTest is fully initialised.
1.199 + */
1.200 + void ConstructL();
1.201 +
1.202 + /**
1.203 + The context of the Unit Test.
1.204 + i.e The CComponentTester class tested by this UnitTest's transitions.
1.205 + */
1.206 + CComponentTester_UnitTestContext* iUTContext;
1.207 + TComponentTester_StateAccessor* iStateAccessor;
1.208 + // C'tor, d'tor, and method transition validators
1.209 + TComponentTester_Ctor_TransitionValidator* iCtorValidator;
1.210 + TComponentTester_TransitionSets_TransitionValidator* iTransitionSetsValidator;
1.211 + TComponentTester_AddUnitTest_TransitionValidator* iAddUnitTestValidator;
1.212 + TComponentTester_AddParamUnitTest_TransitionValidator* iAddParamUnitTestValidator;
1.213 + TComponentTester_Dtor_TransitionValidator* iDtorValidator;
1.214 + }; // CComponentTester_ManageUnitTests_UnitTest
1.215 +
1.216 +// ______________________________________________________________________________
1.217 +//
1.218 +/**
1.219 + @internalComponent
1.220 +
1.221 + Comments : Unit Test for RunTests on CComponentTester, the class under test.
1.222 + */
1.223 +class CComponentTester_RunTests_UnitTest : public CUnitTest
1.224 + {
1.225 +public:
1.226 + /**
1.227 + @fn NewL(CDataLogger& aDataLogger,
1.228 + MUnitTestObserver& aObserver)
1.229 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.230 + cleanup stack.
1.231 + Error Condition : Leaves with the error code.
1.232 + @leave KErrNoMemory
1.233 + @since 7.0
1.234 + @param aDataLogger The output logging object.
1.235 + @param aObserver The observer of this UnitTest.
1.236 + @return CComponentTester_RunTests_UnitTest* The constructed object.
1.237 + @pre None.
1.238 + @post CComponentTester_RunTests_UnitTest is fully constructed, and initialised.
1.239 + */
1.240 + static CComponentTester_RunTests_UnitTest* NewL(CDataLogger& aDataLogger,
1.241 + MUnitTestObserver& aObserver);
1.242 +
1.243 + /**
1.244 + @fn RunError(TInt aError)
1.245 + Intended Usage : Intercept the panic caused by a RunL leave,
1.246 + to restore the CComponentTester_RunTests_UnitTest
1.247 + object to a sensible state.
1.248 + (called by the Active Scheduler immediately before the Panic).
1.249 + Error Condition : @see CUnitTest::RunError().
1.250 + @since 7.0
1.251 + @return TInt KErrNone if cleanup successful, otherwise
1.252 + @see CUnitTest::RunError()
1.253 + @pre CComponentTester_RunTests_UnitTest is fully constructed, and initialised.
1.254 + @post The object has been restored to a sensible state.
1.255 + */
1.256 + inline TInt RunError(TInt aError);
1.257 +
1.258 + /**
1.259 + @fn ~CComponentTester_RunTests_UnitTest()
1.260 + Intended Usage : Standard Destructor.
1.261 + Error Condition : None.
1.262 + @since 7.0
1.263 + @pre CComponentTester_RunTests_UnitTest is fully constructed.
1.264 + @post CComponentTester_RunTests_UnitTest is fully destroyed.
1.265 + */
1.266 + ~CComponentTester_RunTests_UnitTest();
1.267 +
1.268 +private:
1.269 + /**
1.270 + @fn CComponentTester_RunTests_UnitTest(CDataLogger& aDataLogger,
1.271 + MUnitTestObserver& aObserver)
1.272 + Intended Usage : Default constructor.
1.273 + Error Condition : None.
1.274 + @since 7.0
1.275 + @param aDataLogger The output logging object.
1.276 + @param aObserver The observer of this UnitTest.
1.277 + @param aStateAccessor WhiteBox state access to the CComponentTester class.
1.278 + @pre None.
1.279 + @post CComponentTester_RunTests_UnitTest is fully constructed.
1.280 + */
1.281 + inline CComponentTester_RunTests_UnitTest(CDataLogger& aDataLogger,
1.282 + MUnitTestObserver& aObserver);
1.283 +
1.284 + /**
1.285 + @fn void ConstructL()
1.286 + Intended Usage : Second phase of safe two phase construction,
1.287 + to complete the object initialisation.
1.288 + Error Condition : Leaves with an error code.
1.289 + @leave KErrNoMemory, and @see CUnitTest::BaseNewL().
1.290 + @since 7.0
1.291 + @return None
1.292 + @pre CComponentTester_RunTests_UnitTest is fully constructed.
1.293 + @post CComponentTester_RunTests_UnitTest is fully initialised.
1.294 + */
1.295 + void ConstructL();
1.296 +
1.297 + /**
1.298 + The context of the Unit Test.
1.299 + i.e The CComponentTester class tested by this UnitTest's transitions.
1.300 + */
1.301 + CComponentTester_UnitTestContext* iUTContext;
1.302 + TComponentTester_StateAccessor* iStateAccessor;
1.303 + // C'tor, d'tor, and method transition validators
1.304 + TComponentTester_Ctor_TransitionValidator* iCtorValidator;
1.305 + TComponentTester_TestComponent_TransitionValidator* iTestComponentValidator;
1.306 + TComponentTester_Run_TransitionValidator* iRunValidator;
1.307 + TComponentTester_Complete_TransitionValidator* iCompleteValidator;
1.308 + TComponentTester_Dtor_TransitionValidator* iDtorValidator;
1.309 + }; // CComponentTester_RunTests_UnitTest
1.310 +
1.311 +
1.312 +#endif // __COMPONENTTESTERUNITTEST_H__