os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TransitionTest/TransitionUnitTest.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2001-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 // The unit test class definitions for the CTransition class.
    15 // 
    16 //
    17 
    18 #ifndef __TRANSITIONUNITTEST_H__
    19 #define __TRANSITIONUNITTEST_H__
    20 
    21 #include <ecom/test_bed/testbeddefinitions.h>
    22 #include "TransitionStateAccessor.h"
    23 #include "TransitionTransitionValidation.h"
    24 #include "TransitionTransitions.h"
    25 
    26 // ______________________________________________________________________________
    27 //
    28 /**
    29 	@internalComponent
    30 	
    31 	Comments : Unit Test for CreateAndDestroy on CTransition, the class under test.
    32  */
    33 class CTransition_CreateAndDestroy_UnitTest : public CUnitTest
    34 	{
    35 public:
    36 	/**
    37 		@fn				NewL(CDataLogger& aDataLogger,
    38 							MUnitTestObserver& aObserver)
    39 		Intended Usage	: Standard two-phase construction which leaves nothing on the
    40 						cleanup stack.
    41 		Error Condition	: Leaves with the error code.
    42 		@leave  		KErrNoMemory
    43 		@since			7.0
    44 		@param			aDataLogger The output logging object.
    45 		@param			aObserver The observer of this UnitTest.
    46 		@return			CTransition_CreateAndDestroy_UnitTest* The constructed object.
    47 		@pre 			None.
    48 		@post			CTransition_CreateAndDestroy_UnitTest is fully constructed, and initialised.
    49 	 */
    50 	static CTransition_CreateAndDestroy_UnitTest* NewL(CDataLogger& aDataLogger,
    51 											MUnitTestObserver& aObserver);
    52 
    53 	/**
    54 		@fn				RunError(TInt aError)
    55 		Intended Usage	: Intercept the panic caused by a RunL leave,
    56 						to restore the CTransition_CreateAndDestroy_UnitTest
    57 						object to a sensible state.
    58 						(called by the Active Scheduler immediately before the Panic).
    59 		Error Condition	: @see CUnitTest::RunError().
    60 		@since			7.0
    61 		@return			TInt KErrNone if cleanup successful, otherwise
    62 						@see CUnitTest::RunError()
    63 		@pre 			CTransition_CreateAndDestroy_UnitTest is fully constructed, and initialised.
    64 		@post			The object has been restored to a sensible state.
    65 	 */
    66 	inline TInt RunError(TInt aError);
    67 
    68 	/**
    69 		@fn				~CTransition_CreateAndDestroy_UnitTest()
    70 		Intended Usage	: Standard Destructor.
    71 		Error Condition	: None.	
    72 		@since			7.0
    73 		@pre 			CTransition_CreateAndDestroy_UnitTest is fully constructed.
    74 		@post			CTransition_CreateAndDestroy_UnitTest is fully destroyed.
    75 	*/
    76 	~CTransition_CreateAndDestroy_UnitTest();
    77 
    78 private:
    79 	/**
    80 		@fn				CTransition_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
    81 														MUnitTestObserver& aObserver)
    82 		Intended Usage	: Default constructor.
    83 		Error Condition	: None. 
    84 		@since			7.0
    85 		@param			aDataLogger The output logging object.
    86 		@param			aObserver The observer of this UnitTest.
    87 		@param			aStateAccessor WhiteBox state access to the CTransition class.
    88 		@pre 			None.
    89 		@post			CTransition_CreateAndDestroy_UnitTest is fully constructed.
    90 	*/
    91 	inline CTransition_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
    92 											MUnitTestObserver& aObserver);
    93 
    94 	/**
    95 		@fn				void ConstructL()
    96 		Intended Usage	: Second phase of safe two phase construction, 
    97 		to complete the object initialisation.
    98 		Error Condition	: Leaves with an error code.
    99 		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
   100 		@since			7.0
   101 		@return			None 
   102 		@pre 			CTransition_CreateAndDestroy_UnitTest is fully constructed.
   103 		@post			CTransition_CreateAndDestroy_UnitTest is fully initialised.
   104 	*/
   105 	void ConstructL();
   106 
   107 	/**
   108 	The context of the Unit Test.
   109 	i.e The CTransition class tested by this UnitTest's transitions.
   110 	 */
   111 	CTransition_UnitTestContext* iUTContext;
   112 	TTransition_StateAccessor*	iStateAccessor;
   113 	/* C'tor, d'tor, and method transition validators */
   114 	TTransition_Ctor_TransitionValidator*	iCtorValidator;
   115 	TTransition_Dtor_TransitionValidator*	iDtorValidator;
   116 	};	// CTransition_CreateAndDestroy_UnitTest
   117 
   118 // ______________________________________________________________________________
   119 //
   120 /**
   121 	@internalComponent
   122 
   123 	Comments : Unit Test for TransitMethodL on CTransition, the class under test.
   124  */
   125 class CTransition_TransitMethodL_UnitTest : public CUnitTest
   126 	{
   127 public:
   128 	/**
   129 		@fn				NewL(CDataLogger& aDataLogger,
   130 							MUnitTestObserver& aObserver)
   131 		Intended Usage	: Standard two-phase construction which leaves nothing on the
   132 						cleanup stack.
   133 		Error Condition	: Leaves with the error code.
   134 		@leave  		KErrNoMemory
   135 		@since			7.0
   136 		@param			aDataLogger The output logging object.
   137 		@param			aObserver The observer of this UnitTest.
   138 		@return			CTransition_TransitMethodL_UnitTest* The constructed object.
   139 		@pre 			None.
   140 		@post			CTransition_TransitMethodL_UnitTest is fully constructed, and initialised.
   141 	 */
   142 	static CTransition_TransitMethodL_UnitTest* NewL(CDataLogger& aDataLogger,
   143 											MUnitTestObserver& aObserver);
   144 
   145 	/**
   146 		@fn				RunError(TInt aError)
   147 		Intended Usage	: Intercept the panic caused by a RunL leave,
   148 						to restore the CTransition_TransitMethodL_UnitTest
   149 						object to a sensible state.
   150 						(called by the Active Scheduler immediately before the Panic).
   151 		Error Condition	: @see CUnitTest::RunError().
   152 		@since			7.0
   153 		@return			TInt KErrNone if cleanup successful, otherwise
   154 						@see CUnitTest::RunError()
   155 		@pre 			CTransition_TransitMethodL_UnitTest is fully constructed, and initialised.
   156 		@post			The object has been restored to a sensible state.
   157 	 */
   158 	inline TInt RunError(TInt aError);
   159 
   160 	/**
   161 		@fn				~CTransition_TransitMethodL_UnitTest()
   162 		Intended Usage	: Standard Destructor.
   163 		Error Condition	: None.	
   164 		@since			7.0
   165 		@pre 			CTransition_TransitMethodL_UnitTest is fully constructed.
   166 		@post			CTransition_TransitMethodL_UnitTest is fully destroyed.
   167 	*/
   168 	~CTransition_TransitMethodL_UnitTest();
   169 
   170 private:
   171 	/**
   172 		@fn				CTransition_TransitMethodL_UnitTest(CDataLogger& aDataLogger,
   173 														MUnitTestObserver& aObserver)
   174 		Intended Usage	: Default constructor.
   175 		Error Condition	: None. 
   176 		@since			7.0
   177 		@param			aDataLogger The output logging object.
   178 		@param			aObserver The observer of this UnitTest.
   179 		@param			aStateAccessor WhiteBox state access to the CTransition class.
   180 		@pre 			None.
   181 		@post			CTransition_TransitMethodL_UnitTest is fully constructed.
   182 	*/
   183 	inline CTransition_TransitMethodL_UnitTest(CDataLogger& aDataLogger,
   184 											MUnitTestObserver& aObserver);
   185 
   186 	/**
   187 		@fn				void ConstructL()
   188 		Intended Usage	: Second phase of safe two phase construction, 
   189 		to complete the object initialisation.
   190 		Error Condition	: Leaves with an error code.
   191 		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
   192 		@since			7.0
   193 		@return			None 
   194 		@pre 			CTransition_TransitMethodL_UnitTest is fully constructed.
   195 		@post			CTransition_TransitMethodL_UnitTest is fully initialised.
   196 	*/
   197 	void ConstructL();
   198 
   199 	/**
   200 	The context of the Unit Test.
   201 	i.e The CTransition class tested by this UnitTest's transitions.
   202 	 */
   203 	CTransition_UnitTestContext* iUTContext;
   204 	TTransition_StateAccessor*	iStateAccessor;
   205 	/* C'tor, d'tor, and method transition validators */
   206 	TTransition_Ctor_TransitionValidator*	iCtorValidator;
   207 	TTransition_RepeatOnce_TransitionValidator*	iRepeatOnceValidator;
   208 	TTransition_TransitionId_TransitionValidator* iTransitionIdValidator;
   209 	TTransition_TransitionInfo_TransitionValidator* iTransitionInfoValidator;
   210 	TTransition_IsBlocking_TransitionValidator* iIsBlockingValidator;
   211 	TTransition_SetBlocking_TransitionValidator* iSetBlockingValidator;
   212 	TTransition_TransitMethodL_TransitionValidator*	iTransitMethodLValidator;
   213 	TTransition_Dtor_TransitionValidator*	iDtorValidator;
   214 	};	// CTransition_TransitMethodL_UnitTest
   215 
   216 // ______________________________________________________________________________
   217 //
   218 /**
   219 	@internalComponent
   220 
   221 	Comments : Unit Test for AsyncOperation on CTransition, the class under test.
   222  */
   223 class CTransition_AsyncOperation_UnitTest : public CUnitTest
   224 	{
   225 public:
   226 	/**
   227 		@fn				NewL(CDataLogger& aDataLogger,
   228 							MUnitTestObserver& aObserver)
   229 		Intended Usage	: Standard two-phase construction which leaves nothing on the
   230 						cleanup stack.
   231 		Error Condition	: Leaves with the error code.
   232 		@leave  		KErrNoMemory
   233 		@since			7.0
   234 		@param			aDataLogger The output logging object.
   235 		@param			aObserver The observer of this UnitTest.
   236 		@return			CTransition_AsyncOperation_UnitTest* The constructed object.
   237 		@pre 			None.
   238 		@post			CTransition_AsyncOperation_UnitTest is fully constructed, and initialised.
   239 	 */
   240 	static CTransition_AsyncOperation_UnitTest* NewL(CDataLogger& aDataLogger,
   241 											MUnitTestObserver& aObserver);
   242 
   243 	/**
   244 		@fn				RunError(TInt aError)
   245 		Intended Usage	: Intercept the panic caused by a RunL leave,
   246 						to restore the CTransition_AsyncOperation_UnitTest
   247 						object to a sensible state.
   248 						(called by the Active Scheduler immediately before the Panic).
   249 		Error Condition	: @see CUnitTest::RunError().
   250 		@since			7.0
   251 		@return			TInt KErrNone if cleanup successful, otherwise
   252 						@see CUnitTest::RunError()
   253 		@pre 			CTransition_AsyncOperation_UnitTest is fully constructed, and initialised.
   254 		@post			The object has been restored to a sensible state.
   255 	 */
   256 	inline TInt RunError(TInt aError);
   257 
   258 	/**
   259 		@fn				~CTransition_AsyncOperation_UnitTest()
   260 		Intended Usage	: Standard Destructor.
   261 		Error Condition	: None.	
   262 		@since			7.0
   263 		@pre 			CTransition_AsyncOperation_UnitTest is fully constructed.
   264 		@post			CTransition_AsyncOperation_UnitTest is fully destroyed.
   265 	*/
   266 	~CTransition_AsyncOperation_UnitTest();
   267 
   268 private:
   269 	/**
   270 		@fn				CTransition_AsyncOperation_UnitTest(CDataLogger& aDataLogger,
   271 														MUnitTestObserver& aObserver)
   272 		Intended Usage	: Default constructor.
   273 		Error Condition	: None. 
   274 		@since			7.0
   275 		@param			aDataLogger The output logging object.
   276 		@param			aObserver The observer of this UnitTest.
   277 		@param			aStateAccessor WhiteBox state access to the CTransition class.
   278 		@pre 			None.
   279 		@post			CTransition_AsyncOperation_UnitTest is fully constructed.
   280 	*/
   281 	inline CTransition_AsyncOperation_UnitTest(CDataLogger& aDataLogger,
   282 											MUnitTestObserver& aObserver);
   283 
   284 	/**
   285 		@fn				void ConstructL()
   286 		Intended Usage	: Second phase of safe two phase construction, 
   287 		to complete the object initialisation.
   288 		Error Condition	: Leaves with an error code.
   289 		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
   290 		@since			7.0
   291 		@return			None 
   292 		@pre 			CTransition_AsyncOperation_UnitTest is fully constructed.
   293 		@post			CTransition_AsyncOperation_UnitTest is fully initialised.
   294 	*/
   295 	void ConstructL();
   296 
   297 	/**
   298 	The context of the Unit Test.
   299 	i.e The CTransition class tested by this UnitTest's transitions.
   300 	 */
   301 	CTransition_UnitTestContext* iUTContext;
   302 	TTransition_StateAccessor*	iStateAccessor;
   303 	/* C'tor, d'tor, and method transition validators */
   304 	TTransition_Ctor_TransitionValidator*	iCtorValidator;
   305 	TTransition_RunTransition_TransitionValidator* iRunTransitionValidator;
   306 	TTransition_Cancel_TransitionValidator* iCancelValidator;
   307 	TTransition_GetErrorCode_TransitionValidator* iGetErrorCodeValidator;
   308 	TTransition_Dtor_TransitionValidator*	iDtorValidator;
   309 	};	// CTransition_AsyncOperation_UnitTest
   310 
   311 
   312 #endif	// __TRANSITIONUNITTEST_H__