lowlevellibsandfws/pluginfw/Framework/BackupNotifierTest/BackupNotifierTransitions.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 definitions of the transition classes upon the CBackupNotifier class methods.
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __BACKUPNOTIFIERTRANSITIONS_H__
       
    19 #define __BACKUPNOTIFIERTRANSITIONS_H__
       
    20 
       
    21 #include "TestUtilities.h"
       
    22 #include "StateAccessor.h"
       
    23 #include "LeakTestTransition.h"
       
    24 #include <test_bed/datalogger.h>
       
    25 #include "BackupNotifier.h"
       
    26 #include "BackupNotifierObserver.h"
       
    27 #include "BackupNotifierStateAccessor.h"
       
    28 #include <test_bed/unittest.h>
       
    29 
       
    30 #define CTransitionType CLeakTestTransition
       
    31 
       
    32 class CNotificationStub : public CBase, public MBackupNotifierObserver
       
    33 	{
       
    34 public:
       
    35 	/**
       
    36 		@fn				CNotificationStub(CDataLogger& aDataLogger)
       
    37 		Intended Usage	: Default constructor.
       
    38 		Error Condition	: None. 
       
    39 		@since			7.0
       
    40 		@param			aDataLogger The output logging object.
       
    41 		@pre 			None.
       
    42 		@post			CNotificationStub is fully constructed, and initialised.
       
    43 	*/
       
    44 	inline CNotificationStub(CDataLogger& aDataLogger);
       
    45 
       
    46 	/**
       
    47 		@fn				~CNotificationStub()
       
    48 		Intended Usage	: Default Destructor
       
    49 		@since			7.0
       
    50 		@pre 			CNotificationStub is fully constructed.
       
    51 		@post			CNotificationStub is fully destroyed
       
    52 	 */
       
    53 	virtual inline ~CNotificationStub();
       
    54 
       
    55 	/**
       
    56 		@fn				Suspend()
       
    57 		Intended Usage	: Overload of the MBackupNotifierObserver method.
       
    58 		Error Condition	: None.
       
    59 		@since			7.0
       
    60 		@pre 			CNotificationStub has been fully constructed.
       
    61 		@post			Suspend message is logged.
       
    62 	 */
       
    63 	virtual inline TInt Suspend();
       
    64 
       
    65 	/**
       
    66 		@fn				Resume()
       
    67 		Intended Usage	: Overload of the MBackupNotifierObserver method.
       
    68 		Error Condition	: None.
       
    69 		@since			7.0
       
    70 		@pre 			CNotificationStub has been fully constructed.
       
    71 		@post			Resume message is logged.
       
    72 	 */
       
    73 	virtual inline TInt Resume();
       
    74 
       
    75 private:
       
    76 	CDataLogger& iDataLogger;
       
    77 	};
       
    78 
       
    79 // ______________________________________________________________________________
       
    80 //
       
    81 /**
       
    82 	@internalComponent
       
    83 
       
    84 	Comments : Provide all the CBackupNotifier specific
       
    85 	parameters and behaviour on the CBackupNotifier
       
    86 	test class for a transition.
       
    87  */
       
    88 class CBackupNotifier_UnitTestContext : public CUnitTestContext
       
    89 	{
       
    90 public:
       
    91 	/**
       
    92 		@fn				CBackupNotifier_UnitTestContext(CDataLogger& aDataLogger,
       
    93 														MStateAccessor& aStateAccessor,
       
    94 														MTransitionObserver& aObserver)
       
    95 		Intended Usage	: Default constructor.
       
    96 		Error Condition	: None. 
       
    97 		@since			7.0
       
    98 		@param			aDataLogger The output logging object.
       
    99 		@param			aObserver The observer of this UnitTest's Transitions.
       
   100 		@param			aStateAccessor WhiteBox state access to the CBackupNotifier class under test.
       
   101 		@pre 			None.
       
   102 		@post			CBackupNotifier_UnitTestContext is fully constructed, and initialised.
       
   103 	*/
       
   104 	inline CBackupNotifier_UnitTestContext(CDataLogger& aDataLogger,
       
   105 										MStateAccessor& aStateAccessor,
       
   106 										MTransitionObserver& aObserver);
       
   107 
       
   108 	/**
       
   109 		@fn				~CBackupNotifier_UnitTestContext()
       
   110 		Intended Usage	: Default Destructor
       
   111 		@since			7.0
       
   112 		@pre 			CBackupNotifier_UnitTestContext is fully constructed.
       
   113 		@post			CBackupNotifier_UnitTestContext is fully destroyed
       
   114 	 */
       
   115 		virtual inline ~CBackupNotifier_UnitTestContext();
       
   116 
       
   117 	/** The instance of the class under test */
       
   118 	CBackupNotifier* iBackupNotifier;
       
   119 	
       
   120 	/** The instance of the stubbed observer of the class under test */
       
   121 	CNotificationStub* iStub;
       
   122 	}; // CBackupNotifier_UnitTestContext
       
   123 
       
   124 // ______________________________________________________________________________
       
   125 //
       
   126 /**
       
   127 	@internalComponent
       
   128 
       
   129 	Comments : Transition test of the CBackupNotifier::NewL method.
       
   130  */
       
   131 class CBackupNotifier_NewL_Transition : public CTransitionType
       
   132 	{
       
   133 public:
       
   134 	/**
       
   135 		@fn				CBackupNotifier_NewL_Transition(CUnitTestContext& aUTContext,
       
   136 																	TTransitionValidator& aValidator)
       
   137 		Intended Usage	: Standard c'tor method.
       
   138 		Error Condition	: None.
       
   139 		@since			7.0
       
   140 		@param			aUTContext The context this transition is operating in.
       
   141 		@param			aValidator Used for checking the pre & post conditions of the test object.
       
   142 		@pre 			None.
       
   143 		@post			CBackupNotifier_NewL_Transition is fully constructed.
       
   144 	*/
       
   145 	CBackupNotifier_NewL_Transition(CUnitTestContext& aUTContext,
       
   146 													TTransitionValidator& aValidator);
       
   147 	/**
       
   148 		@fn				TransitMethodL()
       
   149 		Intended Usage	: To execute the CBackupNotifier::NewL method for the test harness.
       
   150 		Error Condition	: Leaves with an error code.
       
   151 		@leave			KErrNoMemory, (@see CBackupNotifier::NewL)
       
   152 		@since			7.0
       
   153 		@return			None
       
   154 		@pre 			CBackupNotifier_NewL_Transition is fully constructed.
       
   155 		@post			No change in the CBackupNotifier_NewL_Transition apart
       
   156 						from iBackupNotifier, which may have changed state.
       
   157 						(@see CBackupNotifier::NewL post-condition) for iBackupNotifier's new state.
       
   158 	*/
       
   159 	inline void TransitMethodL();
       
   160 
       
   161 	/**
       
   162 		@fn				Context() const
       
   163 		Intended Usage	: To provide access to the unit test context cast to the correct type.
       
   164 		Error Condition	: None.
       
   165 		@since			7.0
       
   166 		@return			The unit test context cast to a CBackupNotifier_UnitTestContext
       
   167 		@pre 			iUTContext is a valid CBackupNotifier_UnitTestContext.
       
   168 		@post			No change in the CBackupNotifier_NewL_Transition
       
   169 	*/
       
   170 	inline CBackupNotifier_UnitTestContext& Context() const;
       
   171 	};	// CBackupNotifier_NewL_Transition
       
   172 
       
   173 // ______________________________________________________________________________
       
   174 //
       
   175 /**
       
   176 	@internalComponent
       
   177 
       
   178 	Comments : Transition test of the CBackupNotifier::Dtor method.
       
   179  */
       
   180 class CBackupNotifier_Dtor_Transition : public CTransitionType
       
   181 	{
       
   182 public:
       
   183 	/**
       
   184 		@fn				CBackupNotifier_Dtor_Transition(CUnitTestContext& aUTContext,
       
   185 																	TTransitionValidator& aValidator)
       
   186 		Intended Usage	: Standard c'tor method.
       
   187 		Error Condition	: None.
       
   188 		@since			7.0
       
   189 		@param			aUTContext The context this transition is operating in.
       
   190 		@param			aValidator Used for checking the pre & post conditions of the test object.
       
   191 		@pre 			None.
       
   192 		@post			CBackupNotifier_Dtor_Transition is fully constructed.
       
   193 	*/
       
   194 	CBackupNotifier_Dtor_Transition(CUnitTestContext& aUTContext,
       
   195 													TTransitionValidator& aValidator);
       
   196 	/**
       
   197 		@fn				TransitMethodL()
       
   198 		Intended Usage	: To execute the CBackupNotifier::Dtor method for the test harness.
       
   199 		Error Condition	: Leaves with an error code.
       
   200 		@leave			KErrNoMemory, (@see CBackupNotifier::Dtor)
       
   201 		@since			7.0
       
   202 		@return			None
       
   203 		@pre 			CBackupNotifier_Dtor_Transition is fully constructed.
       
   204 		@post			No change in the CBackupNotifier_Dtor_Transition apart
       
   205 						from iBackupNotifier, which may have changed state.
       
   206 						(@see CBackupNotifier::Dtor post-condition) for iBackupNotifier's new state.
       
   207 	*/
       
   208 	inline void TransitMethodL();
       
   209 
       
   210 	/**
       
   211 		@fn				Context() const
       
   212 		Intended Usage	: To provide access to the unit test context cast to the correct type.
       
   213 		Error Condition	: None.
       
   214 		@since			7.0
       
   215 		@return			The unit test context cast to a CBackupNotifier_UnitTestContext
       
   216 		@pre 			iUTContext is a valid CBackupNotifier_UnitTestContext.
       
   217 		@post			No change in the CBackupNotifier_Dtor_Transition
       
   218 	*/
       
   219 	inline CBackupNotifier_UnitTestContext& Context() const;
       
   220 	};	// CBackupNotifier_Dtor_Transition
       
   221 
       
   222 // Add additional Transition class definitions here...
       
   223 
       
   224 #include "BackupNotifierTransitions.inl"
       
   225 
       
   226 #include "BackupNotifierUnitTestContext.inl"
       
   227 
       
   228 #endif // __BACKUPNOTIFIERTRANSITIONS_H__
       
   229