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 definitions of the transition classes upon the CBackupNotifier class methods.
sl@0: // 
sl@0: //
sl@0: 
sl@0: #ifndef __BACKUPNOTIFIERTRANSITIONS_H__
sl@0: #define __BACKUPNOTIFIERTRANSITIONS_H__
sl@0: 
sl@0: #include "TestUtilities.h"
sl@0: #include "StateAccessor.h"
sl@0: #include "LeakTestTransition.h"
sl@0: #include <test_bed/datalogger.h>
sl@0: #include "BackupNotifier.h"
sl@0: #include "BackupNotifierObserver.h"
sl@0: #include "BackupNotifierStateAccessor.h"
sl@0: #include <test_bed/unittest.h>
sl@0: 
sl@0: #define CTransitionType CLeakTestTransition
sl@0: 
sl@0: class CNotificationStub : public CBase, public MBackupNotifierObserver
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				CNotificationStub(CDataLogger& aDataLogger)
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: 		@pre 			None.
sl@0: 		@post			CNotificationStub is fully constructed, and initialised.
sl@0: 	*/
sl@0: 	inline CNotificationStub(CDataLogger& aDataLogger);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				~CNotificationStub()
sl@0: 		Intended Usage	: Default Destructor
sl@0: 		@since			7.0
sl@0: 		@pre 			CNotificationStub is fully constructed.
sl@0: 		@post			CNotificationStub is fully destroyed
sl@0: 	 */
sl@0: 	virtual inline ~CNotificationStub();
sl@0: 
sl@0: 	/**
sl@0: 		@fn				Suspend()
sl@0: 		Intended Usage	: Overload of the MBackupNotifierObserver method.
sl@0: 		Error Condition	: None.
sl@0: 		@since			7.0
sl@0: 		@pre 			CNotificationStub has been fully constructed.
sl@0: 		@post			Suspend message is logged.
sl@0: 	 */
sl@0: 	virtual inline TInt Suspend();
sl@0: 
sl@0: 	/**
sl@0: 		@fn				Resume()
sl@0: 		Intended Usage	: Overload of the MBackupNotifierObserver method.
sl@0: 		Error Condition	: None.
sl@0: 		@since			7.0
sl@0: 		@pre 			CNotificationStub has been fully constructed.
sl@0: 		@post			Resume message is logged.
sl@0: 	 */
sl@0: 	virtual inline TInt Resume();
sl@0: 
sl@0: private:
sl@0: 	CDataLogger& iDataLogger;
sl@0: 	};
sl@0: 
sl@0: // ______________________________________________________________________________
sl@0: //
sl@0: /**
sl@0: 	@internalComponent
sl@0: 
sl@0: 	Comments : Provide all the CBackupNotifier specific
sl@0: 	parameters and behaviour on the CBackupNotifier
sl@0: 	test class for a transition.
sl@0:  */
sl@0: class CBackupNotifier_UnitTestContext : public CUnitTestContext
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				CBackupNotifier_UnitTestContext(CDataLogger& aDataLogger,
sl@0: 														MStateAccessor& aStateAccessor,
sl@0: 														MTransitionObserver& 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's Transitions.
sl@0: 		@param			aStateAccessor WhiteBox state access to the CBackupNotifier class under test.
sl@0: 		@pre 			None.
sl@0: 		@post			CBackupNotifier_UnitTestContext is fully constructed, and initialised.
sl@0: 	*/
sl@0: 	inline CBackupNotifier_UnitTestContext(CDataLogger& aDataLogger,
sl@0: 										MStateAccessor& aStateAccessor,
sl@0: 										MTransitionObserver& aObserver);
sl@0: 
sl@0: 	/**
sl@0: 		@fn				~CBackupNotifier_UnitTestContext()
sl@0: 		Intended Usage	: Default Destructor
sl@0: 		@since			7.0
sl@0: 		@pre 			CBackupNotifier_UnitTestContext is fully constructed.
sl@0: 		@post			CBackupNotifier_UnitTestContext is fully destroyed
sl@0: 	 */
sl@0: 		virtual inline ~CBackupNotifier_UnitTestContext();
sl@0: 
sl@0: 	/** The instance of the class under test */
sl@0: 	CBackupNotifier* iBackupNotifier;
sl@0: 	
sl@0: 	/** The instance of the stubbed observer of the class under test */
sl@0: 	CNotificationStub* iStub;
sl@0: 	}; // CBackupNotifier_UnitTestContext
sl@0: 
sl@0: // ______________________________________________________________________________
sl@0: //
sl@0: /**
sl@0: 	@internalComponent
sl@0: 
sl@0: 	Comments : Transition test of the CBackupNotifier::NewL method.
sl@0:  */
sl@0: class CBackupNotifier_NewL_Transition : public CTransitionType
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				CBackupNotifier_NewL_Transition(CUnitTestContext& aUTContext,
sl@0: 																	TTransitionValidator& aValidator)
sl@0: 		Intended Usage	: Standard c'tor method.
sl@0: 		Error Condition	: None.
sl@0: 		@since			7.0
sl@0: 		@param			aUTContext The context this transition is operating in.
sl@0: 		@param			aValidator Used for checking the pre & post conditions of the test object.
sl@0: 		@pre 			None.
sl@0: 		@post			CBackupNotifier_NewL_Transition is fully constructed.
sl@0: 	*/
sl@0: 	CBackupNotifier_NewL_Transition(CUnitTestContext& aUTContext,
sl@0: 													TTransitionValidator& aValidator);
sl@0: 	/**
sl@0: 		@fn				TransitMethodL()
sl@0: 		Intended Usage	: To execute the CBackupNotifier::NewL method for the test harness.
sl@0: 		Error Condition	: Leaves with an error code.
sl@0: 		@leave			KErrNoMemory, (@see CBackupNotifier::NewL)
sl@0: 		@since			7.0
sl@0: 		@return			None
sl@0: 		@pre 			CBackupNotifier_NewL_Transition is fully constructed.
sl@0: 		@post			No change in the CBackupNotifier_NewL_Transition apart
sl@0: 						from iBackupNotifier, which may have changed state.
sl@0: 						(@see CBackupNotifier::NewL post-condition) for iBackupNotifier's new state.
sl@0: 	*/
sl@0: 	inline void TransitMethodL();
sl@0: 
sl@0: 	/**
sl@0: 		@fn				Context() const
sl@0: 		Intended Usage	: To provide access to the unit test context cast to the correct type.
sl@0: 		Error Condition	: None.
sl@0: 		@since			7.0
sl@0: 		@return			The unit test context cast to a CBackupNotifier_UnitTestContext
sl@0: 		@pre 			iUTContext is a valid CBackupNotifier_UnitTestContext.
sl@0: 		@post			No change in the CBackupNotifier_NewL_Transition
sl@0: 	*/
sl@0: 	inline CBackupNotifier_UnitTestContext& Context() const;
sl@0: 	};	// CBackupNotifier_NewL_Transition
sl@0: 
sl@0: // ______________________________________________________________________________
sl@0: //
sl@0: /**
sl@0: 	@internalComponent
sl@0: 
sl@0: 	Comments : Transition test of the CBackupNotifier::Dtor method.
sl@0:  */
sl@0: class CBackupNotifier_Dtor_Transition : public CTransitionType
sl@0: 	{
sl@0: public:
sl@0: 	/**
sl@0: 		@fn				CBackupNotifier_Dtor_Transition(CUnitTestContext& aUTContext,
sl@0: 																	TTransitionValidator& aValidator)
sl@0: 		Intended Usage	: Standard c'tor method.
sl@0: 		Error Condition	: None.
sl@0: 		@since			7.0
sl@0: 		@param			aUTContext The context this transition is operating in.
sl@0: 		@param			aValidator Used for checking the pre & post conditions of the test object.
sl@0: 		@pre 			None.
sl@0: 		@post			CBackupNotifier_Dtor_Transition is fully constructed.
sl@0: 	*/
sl@0: 	CBackupNotifier_Dtor_Transition(CUnitTestContext& aUTContext,
sl@0: 													TTransitionValidator& aValidator);
sl@0: 	/**
sl@0: 		@fn				TransitMethodL()
sl@0: 		Intended Usage	: To execute the CBackupNotifier::Dtor method for the test harness.
sl@0: 		Error Condition	: Leaves with an error code.
sl@0: 		@leave			KErrNoMemory, (@see CBackupNotifier::Dtor)
sl@0: 		@since			7.0
sl@0: 		@return			None
sl@0: 		@pre 			CBackupNotifier_Dtor_Transition is fully constructed.
sl@0: 		@post			No change in the CBackupNotifier_Dtor_Transition apart
sl@0: 						from iBackupNotifier, which may have changed state.
sl@0: 						(@see CBackupNotifier::Dtor post-condition) for iBackupNotifier's new state.
sl@0: 	*/
sl@0: 	inline void TransitMethodL();
sl@0: 
sl@0: 	/**
sl@0: 		@fn				Context() const
sl@0: 		Intended Usage	: To provide access to the unit test context cast to the correct type.
sl@0: 		Error Condition	: None.
sl@0: 		@since			7.0
sl@0: 		@return			The unit test context cast to a CBackupNotifier_UnitTestContext
sl@0: 		@pre 			iUTContext is a valid CBackupNotifier_UnitTestContext.
sl@0: 		@post			No change in the CBackupNotifier_Dtor_Transition
sl@0: 	*/
sl@0: 	inline CBackupNotifier_UnitTestContext& Context() const;
sl@0: 	};	// CBackupNotifier_Dtor_Transition
sl@0: 
sl@0: // Add additional Transition class definitions here...
sl@0: 
sl@0: #include "BackupNotifierTransitions.inl"
sl@0: 
sl@0: #include "BackupNotifierUnitTestContext.inl"
sl@0: 
sl@0: #endif // __BACKUPNOTIFIERTRANSITIONS_H__
sl@0: