sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // The unit test class definitions for the CTransition class.
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef __TRANSITIONUNITTEST_H__
sl@0: #define __TRANSITIONUNITTEST_H__
sl@0: 
sl@0: #include <ecom/test_bed/testbeddefinitions.h>
sl@0: #include "TransitionStateAccessor.h"
sl@0: #include "TransitionTransitionValidation.h"
sl@0: #include "TransitionTransitions.h"
sl@0: 
sl@0: // ______________________________________________________________________________
sl@0: //
sl@0: /**
sl@0: 	@internalComponent
sl@0: 	
sl@0: 	Comments : Unit Test for CreateAndDestroy on CTransition, the class under test.
sl@0:  */
sl@0: class CTransition_CreateAndDestroy_UnitTest : public CUnitTest
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				NewL(CDataLogger& aDataLogger,
sl@0: 							MUnitTestObserver& aObserver)
sl@0: 		Intended Usage	: Standard two-phase construction which leaves nothing on the
sl@0: 						cleanup stack.
sl@0: 		Error Condition	: Leaves with the error code.
sl@0: 		@leave  		KErrNoMemory
sl@0: 		@since			7.0
sl@0: 		@param			aDataLogger The output logging object.
sl@0: 		@param			aObserver The observer of this UnitTest.
sl@0: 		@return			CTransition_CreateAndDestroy_UnitTest* The constructed object.
sl@0: 		@pre 			None.
sl@0: 		@post			CTransition_CreateAndDestroy_UnitTest is fully constructed, and initialised.
sl@0: 	 */
sl@0: 	static CTransition_CreateAndDestroy_UnitTest* NewL(CDataLogger& aDataLogger,
sl@0: 											MUnitTestObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				RunError(TInt aError)
sl@0: 		Intended Usage	: Intercept the panic caused by a RunL leave,
sl@0: 						to restore the CTransition_CreateAndDestroy_UnitTest
sl@0: 						object to a sensible state.
sl@0: 						(called by the Active Scheduler immediately before the Panic).
sl@0: 		Error Condition	: @see CUnitTest::RunError().
sl@0: 		@since			7.0
sl@0: 		@return			TInt KErrNone if cleanup successful, otherwise
sl@0: 						@see CUnitTest::RunError()
sl@0: 		@pre 			CTransition_CreateAndDestroy_UnitTest is fully constructed, and initialised.
sl@0: 		@post			The object has been restored to a sensible state.
sl@0: 	 */
sl@0: 	inline TInt RunError(TInt aError);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				~CTransition_CreateAndDestroy_UnitTest()
sl@0: 		Intended Usage	: Standard Destructor.
sl@0: 		Error Condition	: None.	
sl@0: 		@since			7.0
sl@0: 		@pre 			CTransition_CreateAndDestroy_UnitTest is fully constructed.
sl@0: 		@post			CTransition_CreateAndDestroy_UnitTest is fully destroyed.
sl@0: 	*/
sl@0: 	~CTransition_CreateAndDestroy_UnitTest();
sl@0: 
sl@0: private:
sl@0: 	/**
sl@0: 		@fn				CTransition_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
sl@0: 														MUnitTestObserver& aObserver)
sl@0: 		Intended Usage	: Default constructor.
sl@0: 		Error Condition	: None. 
sl@0: 		@since			7.0
sl@0: 		@param			aDataLogger The output logging object.
sl@0: 		@param			aObserver The observer of this UnitTest.
sl@0: 		@param			aStateAccessor WhiteBox state access to the CTransition class.
sl@0: 		@pre 			None.
sl@0: 		@post			CTransition_CreateAndDestroy_UnitTest is fully constructed.
sl@0: 	*/
sl@0: 	inline CTransition_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger,
sl@0: 											MUnitTestObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				void ConstructL()
sl@0: 		Intended Usage	: Second phase of safe two phase construction, 
sl@0: 		to complete the object initialisation.
sl@0: 		Error Condition	: Leaves with an error code.
sl@0: 		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
sl@0: 		@since			7.0
sl@0: 		@return			None 
sl@0: 		@pre 			CTransition_CreateAndDestroy_UnitTest is fully constructed.
sl@0: 		@post			CTransition_CreateAndDestroy_UnitTest is fully initialised.
sl@0: 	*/
sl@0: 	void ConstructL();
sl@0: 
sl@0: 	/**
sl@0: 	The context of the Unit Test.
sl@0: 	i.e The CTransition class tested by this UnitTest's transitions.
sl@0: 	 */
sl@0: 	CTransition_UnitTestContext* iUTContext;
sl@0: 	TTransition_StateAccessor*	iStateAccessor;
sl@0: 	/* C'tor, d'tor, and method transition validators */
sl@0: 	TTransition_Ctor_TransitionValidator*	iCtorValidator;
sl@0: 	TTransition_Dtor_TransitionValidator*	iDtorValidator;
sl@0: 	};	// CTransition_CreateAndDestroy_UnitTest
sl@0: 
sl@0: // ______________________________________________________________________________
sl@0: //
sl@0: /**
sl@0: 	@internalComponent
sl@0: 
sl@0: 	Comments : Unit Test for TransitMethodL on CTransition, the class under test.
sl@0:  */
sl@0: class CTransition_TransitMethodL_UnitTest : public CUnitTest
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				NewL(CDataLogger& aDataLogger,
sl@0: 							MUnitTestObserver& aObserver)
sl@0: 		Intended Usage	: Standard two-phase construction which leaves nothing on the
sl@0: 						cleanup stack.
sl@0: 		Error Condition	: Leaves with the error code.
sl@0: 		@leave  		KErrNoMemory
sl@0: 		@since			7.0
sl@0: 		@param			aDataLogger The output logging object.
sl@0: 		@param			aObserver The observer of this UnitTest.
sl@0: 		@return			CTransition_TransitMethodL_UnitTest* The constructed object.
sl@0: 		@pre 			None.
sl@0: 		@post			CTransition_TransitMethodL_UnitTest is fully constructed, and initialised.
sl@0: 	 */
sl@0: 	static CTransition_TransitMethodL_UnitTest* NewL(CDataLogger& aDataLogger,
sl@0: 											MUnitTestObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				RunError(TInt aError)
sl@0: 		Intended Usage	: Intercept the panic caused by a RunL leave,
sl@0: 						to restore the CTransition_TransitMethodL_UnitTest
sl@0: 						object to a sensible state.
sl@0: 						(called by the Active Scheduler immediately before the Panic).
sl@0: 		Error Condition	: @see CUnitTest::RunError().
sl@0: 		@since			7.0
sl@0: 		@return			TInt KErrNone if cleanup successful, otherwise
sl@0: 						@see CUnitTest::RunError()
sl@0: 		@pre 			CTransition_TransitMethodL_UnitTest is fully constructed, and initialised.
sl@0: 		@post			The object has been restored to a sensible state.
sl@0: 	 */
sl@0: 	inline TInt RunError(TInt aError);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				~CTransition_TransitMethodL_UnitTest()
sl@0: 		Intended Usage	: Standard Destructor.
sl@0: 		Error Condition	: None.	
sl@0: 		@since			7.0
sl@0: 		@pre 			CTransition_TransitMethodL_UnitTest is fully constructed.
sl@0: 		@post			CTransition_TransitMethodL_UnitTest is fully destroyed.
sl@0: 	*/
sl@0: 	~CTransition_TransitMethodL_UnitTest();
sl@0: 
sl@0: private:
sl@0: 	/**
sl@0: 		@fn				CTransition_TransitMethodL_UnitTest(CDataLogger& aDataLogger,
sl@0: 														MUnitTestObserver& aObserver)
sl@0: 		Intended Usage	: Default constructor.
sl@0: 		Error Condition	: None. 
sl@0: 		@since			7.0
sl@0: 		@param			aDataLogger The output logging object.
sl@0: 		@param			aObserver The observer of this UnitTest.
sl@0: 		@param			aStateAccessor WhiteBox state access to the CTransition class.
sl@0: 		@pre 			None.
sl@0: 		@post			CTransition_TransitMethodL_UnitTest is fully constructed.
sl@0: 	*/
sl@0: 	inline CTransition_TransitMethodL_UnitTest(CDataLogger& aDataLogger,
sl@0: 											MUnitTestObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				void ConstructL()
sl@0: 		Intended Usage	: Second phase of safe two phase construction, 
sl@0: 		to complete the object initialisation.
sl@0: 		Error Condition	: Leaves with an error code.
sl@0: 		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
sl@0: 		@since			7.0
sl@0: 		@return			None 
sl@0: 		@pre 			CTransition_TransitMethodL_UnitTest is fully constructed.
sl@0: 		@post			CTransition_TransitMethodL_UnitTest is fully initialised.
sl@0: 	*/
sl@0: 	void ConstructL();
sl@0: 
sl@0: 	/**
sl@0: 	The context of the Unit Test.
sl@0: 	i.e The CTransition class tested by this UnitTest's transitions.
sl@0: 	 */
sl@0: 	CTransition_UnitTestContext* iUTContext;
sl@0: 	TTransition_StateAccessor*	iStateAccessor;
sl@0: 	/* C'tor, d'tor, and method transition validators */
sl@0: 	TTransition_Ctor_TransitionValidator*	iCtorValidator;
sl@0: 	TTransition_RepeatOnce_TransitionValidator*	iRepeatOnceValidator;
sl@0: 	TTransition_TransitionId_TransitionValidator* iTransitionIdValidator;
sl@0: 	TTransition_TransitionInfo_TransitionValidator* iTransitionInfoValidator;
sl@0: 	TTransition_IsBlocking_TransitionValidator* iIsBlockingValidator;
sl@0: 	TTransition_SetBlocking_TransitionValidator* iSetBlockingValidator;
sl@0: 	TTransition_TransitMethodL_TransitionValidator*	iTransitMethodLValidator;
sl@0: 	TTransition_Dtor_TransitionValidator*	iDtorValidator;
sl@0: 	};	// CTransition_TransitMethodL_UnitTest
sl@0: 
sl@0: // ______________________________________________________________________________
sl@0: //
sl@0: /**
sl@0: 	@internalComponent
sl@0: 
sl@0: 	Comments : Unit Test for AsyncOperation on CTransition, the class under test.
sl@0:  */
sl@0: class CTransition_AsyncOperation_UnitTest : public CUnitTest
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				NewL(CDataLogger& aDataLogger,
sl@0: 							MUnitTestObserver& aObserver)
sl@0: 		Intended Usage	: Standard two-phase construction which leaves nothing on the
sl@0: 						cleanup stack.
sl@0: 		Error Condition	: Leaves with the error code.
sl@0: 		@leave  		KErrNoMemory
sl@0: 		@since			7.0
sl@0: 		@param			aDataLogger The output logging object.
sl@0: 		@param			aObserver The observer of this UnitTest.
sl@0: 		@return			CTransition_AsyncOperation_UnitTest* The constructed object.
sl@0: 		@pre 			None.
sl@0: 		@post			CTransition_AsyncOperation_UnitTest is fully constructed, and initialised.
sl@0: 	 */
sl@0: 	static CTransition_AsyncOperation_UnitTest* NewL(CDataLogger& aDataLogger,
sl@0: 											MUnitTestObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				RunError(TInt aError)
sl@0: 		Intended Usage	: Intercept the panic caused by a RunL leave,
sl@0: 						to restore the CTransition_AsyncOperation_UnitTest
sl@0: 						object to a sensible state.
sl@0: 						(called by the Active Scheduler immediately before the Panic).
sl@0: 		Error Condition	: @see CUnitTest::RunError().
sl@0: 		@since			7.0
sl@0: 		@return			TInt KErrNone if cleanup successful, otherwise
sl@0: 						@see CUnitTest::RunError()
sl@0: 		@pre 			CTransition_AsyncOperation_UnitTest is fully constructed, and initialised.
sl@0: 		@post			The object has been restored to a sensible state.
sl@0: 	 */
sl@0: 	inline TInt RunError(TInt aError);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				~CTransition_AsyncOperation_UnitTest()
sl@0: 		Intended Usage	: Standard Destructor.
sl@0: 		Error Condition	: None.	
sl@0: 		@since			7.0
sl@0: 		@pre 			CTransition_AsyncOperation_UnitTest is fully constructed.
sl@0: 		@post			CTransition_AsyncOperation_UnitTest is fully destroyed.
sl@0: 	*/
sl@0: 	~CTransition_AsyncOperation_UnitTest();
sl@0: 
sl@0: private:
sl@0: 	/**
sl@0: 		@fn				CTransition_AsyncOperation_UnitTest(CDataLogger& aDataLogger,
sl@0: 														MUnitTestObserver& aObserver)
sl@0: 		Intended Usage	: Default constructor.
sl@0: 		Error Condition	: None. 
sl@0: 		@since			7.0
sl@0: 		@param			aDataLogger The output logging object.
sl@0: 		@param			aObserver The observer of this UnitTest.
sl@0: 		@param			aStateAccessor WhiteBox state access to the CTransition class.
sl@0: 		@pre 			None.
sl@0: 		@post			CTransition_AsyncOperation_UnitTest is fully constructed.
sl@0: 	*/
sl@0: 	inline CTransition_AsyncOperation_UnitTest(CDataLogger& aDataLogger,
sl@0: 											MUnitTestObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				void ConstructL()
sl@0: 		Intended Usage	: Second phase of safe two phase construction, 
sl@0: 		to complete the object initialisation.
sl@0: 		Error Condition	: Leaves with an error code.
sl@0: 		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
sl@0: 		@since			7.0
sl@0: 		@return			None 
sl@0: 		@pre 			CTransition_AsyncOperation_UnitTest is fully constructed.
sl@0: 		@post			CTransition_AsyncOperation_UnitTest is fully initialised.
sl@0: 	*/
sl@0: 	void ConstructL();
sl@0: 
sl@0: 	/**
sl@0: 	The context of the Unit Test.
sl@0: 	i.e The CTransition class tested by this UnitTest's transitions.
sl@0: 	 */
sl@0: 	CTransition_UnitTestContext* iUTContext;
sl@0: 	TTransition_StateAccessor*	iStateAccessor;
sl@0: 	/* C'tor, d'tor, and method transition validators */
sl@0: 	TTransition_Ctor_TransitionValidator*	iCtorValidator;
sl@0: 	TTransition_RunTransition_TransitionValidator* iRunTransitionValidator;
sl@0: 	TTransition_Cancel_TransitionValidator* iCancelValidator;
sl@0: 	TTransition_GetErrorCode_TransitionValidator* iGetErrorCodeValidator;
sl@0: 	TTransition_Dtor_TransitionValidator*	iDtorValidator;
sl@0: 	};	// CTransition_AsyncOperation_UnitTest
sl@0: 
sl@0: 
sl@0: #endif	// __TRANSITIONUNITTEST_H__