os/ossrv/lowlevellibsandfws/pluginfw/Framework/SuicideTests/SuicideUnitTests.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/SuicideTests/SuicideUnitTests.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,208 @@
     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 +// This file contains the definition of the 
    1.18 +// class CSuicideInterfaceUnitTest	
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#ifndef __SUICIDEUNITTEST_H__
    1.23 +#define __SUICIDEUNITTEST_H__
    1.24 +
    1.25 +#include <e32base.h>
    1.26 +
    1.27 +#include <test_bed/unittest.h>
    1.28 +#include "SuicideStateAccessors.h"
    1.29 +#include "SuicideTransitions.h"
    1.30 +#include "SuicideTransitionValidation.h"
    1.31 +
    1.32 +// ______________________________________________________________________________
    1.33 +//
    1.34 +/**
    1.35 +	@internalComponent
    1.36 +
    1.37 +	Comments : UnitTest CreateAndDestroy on the CExampleInterface test class.
    1.38 + */
    1.39 +class CSuicideInterfaceCreateAndDestroyUnitTest : public CUnitTest
    1.40 +	{
    1.41 +public:
    1.42 +	/**
    1.43 +		@fn				NewL(CDataLogger& aDataLogger,
    1.44 +							MUnitTestObserver& aObserver)
    1.45 +		Intended Usage	: Standard two-phase construction which leaves nothing on the
    1.46 +						cleanup stack.
    1.47 +		Error Condition	: Leaves with the error code.
    1.48 +		@leave  		KErrNoMemory
    1.49 +		@since			7.0
    1.50 +		@param			aDataLogger The output logging object.
    1.51 +		@param			aObserver The observer of this UnitTest.
    1.52 +		@param			aStateAccessor WhiteBox state access to the CExampleInterface class.
    1.53 +		@return			CSuicideInterfaceCreateAndDestroyUnitTest* The constructed object.
    1.54 +		@pre 			None.
    1.55 +		@post			CSuicideInterfaceCreateAndDestroyUnitTest is fully constructed, and initialised.
    1.56 +	 */
    1.57 +	static CSuicideInterfaceCreateAndDestroyUnitTest* NewL(CDataLogger& aDataLogger,
    1.58 +											MUnitTestObserver& aObserver);
    1.59 +
    1.60 +	/**
    1.61 +		@fn				RunError(TInt aError)
    1.62 +		Intended Usage	: Intercept the panic caused by a RunL leave,
    1.63 +						to restore the CSuicideInterfaceCreateAndDestroyUnitTest
    1.64 +						object to a sensible state.
    1.65 +						(called by the Active Scheduler immediately before the Panic).
    1.66 +		Error Condition	: @see CUnitTest::RunError().
    1.67 +		@since			7.0
    1.68 +		@return			TInt KErrNone if cleanup successful, otherwise
    1.69 +						@see CUnitTest::RunError()
    1.70 +		@pre 			CSuicideInterfaceCreateAndDestroyUnitTest is fully constructed, and initialised.
    1.71 +		@post			The object has been restored to a sensible state.
    1.72 +	 */
    1.73 +	inline TInt RunError(TInt aError);
    1.74 +
    1.75 +	/**
    1.76 +		@fn				~CSuicideInterfaceCreateAndDestroyUnitTest()
    1.77 +		Intended Usage	: Standard Destructor.
    1.78 +		Error Condition	: None.	
    1.79 +		@since			7.0
    1.80 +		@pre 			CSuicideInterfaceCreateAndDestroyUnitTest is fully constructed.
    1.81 +		@post			CSuicideInterfaceCreateAndDestroyUnitTest is fully destroyed.
    1.82 +	*/
    1.83 +	inline ~CSuicideInterfaceCreateAndDestroyUnitTest();
    1.84 +
    1.85 +private:
    1.86 +	/**
    1.87 +		@fn				CSuicideInterfaceCreateAndDestroyUnitTest(CDataLogger& aDataLogger,
    1.88 +														MUnitTestObserver& aObserver)
    1.89 +		Intended Usage	: Default constructor.
    1.90 +		Error Condition	: None. 
    1.91 +		@since			7.0
    1.92 +		@param			aDataLogger The output logging object.
    1.93 +		@param			aObserver The observer of this UnitTest.
    1.94 +		@param			aStateAccessor WhiteBox state access to the CExampleInterface class.
    1.95 +		@pre 			None.
    1.96 +		@post			CSuicideInterfaceCreateAndDestroyUnitTest is fully constructed.
    1.97 +	*/
    1.98 +	inline CSuicideInterfaceCreateAndDestroyUnitTest(CDataLogger& aDataLogger,
    1.99 +											MUnitTestObserver& aObserver);
   1.100 +
   1.101 +	/**
   1.102 +		@fn				void ConstructL()
   1.103 +		Intended Usage	: Second phase of safe two phase construction, 
   1.104 +		to complete the object initialisation.
   1.105 +		Error Condition	: Leaves with an error code.
   1.106 +		@leave  		KErrNoMemory, and @see CUnitTest::BaseNewL().
   1.107 +		@since			7.0
   1.108 +		@return			None 
   1.109 +		@pre 			CSuicideInterfaceCreateAndDestroyUnitTest is fully constructed.
   1.110 +		@post			CSuicideInterfaceCreateAndDestroyUnitTest is fully initialised.
   1.111 +	*/
   1.112 +	inline void ConstructL();
   1.113 +
   1.114 +	/**
   1.115 +	The context of the Unit Test.
   1.116 +	i.e The CExampleInterface class tested by this UintTest's transitions.
   1.117 +	 */
   1.118 +	CSuicideInterface_UnitTestContext*		iUTContext;
   1.119 +	TSuicideInterface_Ctor_TransitionValidator*		iCtorValidator;
   1.120 +	TSuicideInterface_Dtor_TransitionValidator*		iDtorValidator;
   1.121 +	TSuicideInterface_StateAccessor*	iStateAccessor;
   1.122 +	REComSession* iEComSession;
   1.123 +	};
   1.124 +
   1.125 +// ______________________________________________________________________________
   1.126 +//
   1.127 +/**
   1.128 +	@internalComponent
   1.129 +
   1.130 +	Comments : UnitTest of the CExampleInterface test class.
   1.131 + */
   1.132 +class CSuicideInterfaceFireAndForgetUnitTest : public CUnitTest
   1.133 +	{
   1.134 +public:
   1.135 +	/**
   1.136 +		@fn				NewL(CDataLogger& aDataLogger, 
   1.137 +							MUnitTestObserver& aObserver)
   1.138 +		Intended Usage	: Standard two-phase construction which leaves nothing on the
   1.139 +						cleanup stack
   1.140 +		Error Condition	: Leaves with the error code.
   1.141 +		@leave  		KErrNoMemory
   1.142 +		@since			7.0
   1.143 +		@param			aDataLogger The output logging object.
   1.144 +		@param			aObserver The observer of this UnitTest.
   1.145 +		@param			aStateAccessor The WhiteBox state access for the CExampleInterface class.
   1.146 +		@return			CSuicideInterfaceFireAndForgetUnitTest* The constructed object.
   1.147 +		@pre 			None
   1.148 +		@post			CSuicideInterfaceFireAndForgetUnitTest is fully constructed, and initialised.
   1.149 +	 */
   1.150 +	static CSuicideInterfaceFireAndForgetUnitTest* NewL(CDataLogger& aDataLogger, 
   1.151 +												MUnitTestObserver& aObserver);
   1.152 +
   1.153 +	/**
   1.154 +		@fn				RunError(TInt aError)
   1.155 +		Intended Usage	: Trap on the RunL leave, called by the Active Scheduler.
   1.156 +		Error Condition	: @see CUnitTest::RunError()	
   1.157 +		@since			7.0
   1.158 +		@return			TInt KErrNone if cleanup successful, otherwise @see CUnitTest::RunError()
   1.159 +		@pre 			CSuicideInterfaceFireAndForgetUnitTest 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				~CSuicideInterfaceFireAndForgetUnitTest()
   1.166 +		Intended Usage	: Standard Destructor
   1.167 +		Error Condition	: None.	
   1.168 +		@since			7.0
   1.169 +		@pre 			CSuicideInterfaceFireAndForgetUnitTest is fully constructed.
   1.170 +		@post			CSuicideInterfaceFireAndForgetUnitTest is fully destroyed.
   1.171 +	*/
   1.172 +	inline ~CSuicideInterfaceFireAndForgetUnitTest();
   1.173 +
   1.174 +private:
   1.175 +	/**
   1.176 +		@fn				CSuicideInterfaceFireAndForgetUnitTest(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 The WhiteBox state access for the CExampleInterface class.
   1.184 +		@pre 			None
   1.185 +		@post			CSuicideInterfaceFireAndForgetUnitTest is fully constructed.
   1.186 +	*/
   1.187 +	inline CSuicideInterfaceFireAndForgetUnitTest(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 			CSuicideInterfaceFireAndForgetUnitTest is fully constructed.
   1.199 +		@post			CSuicideInterfaceFireAndForgetUnitTest is fully initialised.
   1.200 +	*/
   1.201 +	inline void ConstructL();
   1.202 +
   1.203 +/** The context of the Unit Test i.e a ClassName class */
   1.204 +	CSuicideInterface_UnitTestContext*		iUTContext;
   1.205 +	TSuicideInterface_Ctor_TransitionValidator*		iCtorValidator;
   1.206 +	TSuicideInterface_FireAndForget_TransitionValidator*	iFireAndForgetValidator;
   1.207 +	TSuicideInterface_StateAccessor*	iStateAccessor;
   1.208 +	REComSession* iEComSession;
   1.209 +	};
   1.210 +
   1.211 +#endif	// __SUICIDEUNITTEST_H__