lowlevellibsandfws/pluginfw/Test_Bed/ComponentTesterTest/ComponentTesterStateAccessor.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-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 definition of the accessor class upon the CComponentTester
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __COMPONENTTESTERSTATEACCESSOR_H__
       
    19 #define __COMPONENTTESTERSTATEACCESSOR_H__
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <f32file.h>
       
    23 #include <s32stor.h>
       
    24 #include <s32file.h>
       
    25 
       
    26 #include "TestUtilities.h"
       
    27 #include <ecom/test_bed/testbeddefinitions.h>
       
    28 #include "StateAccessor.h"
       
    29 #include "ComponentTester.h"
       
    30 
       
    31 
       
    32 class CComponentTesterTestDerivation : public CComponentTester
       
    33 	{
       
    34 public:
       
    35 
       
    36 	inline CComponentTesterTestDerivation(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
       
    37 
       
    38 	inline void ConstructL();
       
    39 	};
       
    40 
       
    41 // ______________________________________________________________________________
       
    42 //
       
    43 /**
       
    44 	@internalComponent 
       
    45 
       
    46 	Comments : State accessor for the CComponentTester object under test.
       
    47  */
       
    48 class TComponentTester_StateAccessor : public MStateAccessor
       
    49 	{
       
    50 public:
       
    51 	/**
       
    52 		@fn				InvariantTest(TAny* aTestObject)
       
    53 		Intended Usage	: Checks the CComponentTester class for Invariant violation.
       
    54 		@since			7.0
       
    55 		@param			TAny* A pointer to the object under test.
       
    56 		@return			TInt KErrNone if the invariants were valid, error code otherwise.
       
    57 		@pre 			TComponentTester_StateAccessor is fully constructed.
       
    58 		@post			The class under test is set to the state specified.
       
    59 	 */
       
    60 	inline TInt InvariantTest(TAny* aTestObject);
       
    61 
       
    62 	/**
       
    63 		@fn				Internalize(TAny* aTestObject)
       
    64 		Intended Usage	: Implemented by the developer to set the state of the object under test.
       
    65 		@since			7.0
       
    66 		@param			aTestObject The object to be tested
       
    67 		@return			KErrNone if the internalize was successful.
       
    68 		@return			One of the EPOC standard error codes indicating the reason
       
    69 						for the failure	to load the object state.
       
    70 		@pre 			TComponentTester_StateAccessor is fully constructed, and
       
    71 						valid test object must be passed in.
       
    72 		@post			The class under test is set to the state specified
       
    73 	 */
       
    74 	inline virtual TInt Internalize(TAny* aTestObject);
       
    75 
       
    76 	/**
       
    77 		@fn				Externalize(TAny* aTestObject)
       
    78 		Intended Usage	: Implemented by the developer to persist the state of the object under test.
       
    79 		@since			7.0
       
    80 		@param			aTestObject The object to be tested
       
    81 		@return			KErrNone if the internalize was successful.
       
    82 		@return			One of the EPOC standard error codes indicating the reason
       
    83 						for the failure	to externalize the object.
       
    84 		@pre 			TComponentTester_StateAccessor is fully constructed, and
       
    85 						valid test object must be passed in.
       
    86 		@post			Returns an error code dependant on the result of the test
       
    87 	 */
       
    88 	inline virtual TInt Externalize(TAny* aTestObject);
       
    89 
       
    90 	/**
       
    91 		@fn				InternalizeL(RFileReadStream& aStream, CComponentTester* aComponentTester)
       
    92 		Intended Usage	: Implemented by the developer to set the state of the object under test.
       
    93 		Error Condition	: Leaves with an error code.
       
    94 		@since			7.0
       
    95 		@param			aStream The filestream to read from .
       
    96 		@param			aComponentTester A pointer to the CComponentTester object under test.
       
    97 		@return			None.
       
    98 		@pre 			TComponentTester_StateAccessor is fully constructed.
       
    99 		@post			The class under test is set to the state specified.
       
   100 	 */
       
   101 		inline void InternalizeL(RFileReadStream& aStream, CComponentTester* aComponentTester);
       
   102 
       
   103 	/**
       
   104 		@fn				ExternalizeL(RFileWriteStream& aStream, CComponentTester* aComponentTester)
       
   105 		Intended Usage	: Implemented by the developer to persist the state of the object under test.
       
   106 		Error Condition	: Leaves with an error code.
       
   107 		@since			7.0
       
   108 		@param			aStream The filestream to persist into.
       
   109 		@param			aComponentTester A pointer to the CComponentTester object under test.
       
   110 		@return			None.
       
   111 		@pre 			TComponentTester_StateAccessor is fully constructed.
       
   112 		@post			No change to the class under test, its internal state.
       
   113 						is persisted.
       
   114 	*/
       
   115 	inline void ExternalizeL(RFileWriteStream& aStream, CComponentTester* aComponentTester);
       
   116 
       
   117 	inline CComponentTesterTestDerivation* CreateComponentTester(CComponentTester& aCompTest, CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
       
   118 
       
   119 	inline void AddUnitTestL(CComponentTester& aCompTest, CUnitTest* aUnitTest);
       
   120 
       
   121 	inline void AddParamUnitTestL(CComponentTester& aCompTest, CUnitTest* aUnitTest);
       
   122 
       
   123 	inline void RunL(CComponentTester& aCompTest);
       
   124 
       
   125 private:
       
   126 	/**
       
   127 		@fn				InternalizeL(CComponentTester* aComponentTester)
       
   128 		Intended Usage	: Implemented by the developer to set the state of the object under test.
       
   129 		Error Condition	: Leaves with an error code.
       
   130 		@since			7.0
       
   131 		@param			TAny* A pointer to the object under test.
       
   132 		@return			None.
       
   133 		@pre 			TComponentTester_StateAccessor is fully constructed.
       
   134 		@post			The class under test is set to the state specified.
       
   135 	*/
       
   136 	inline void InternalizeL(CComponentTester* aComponentTester);
       
   137 
       
   138 	/**
       
   139 		@fn				ExternalizeL(CComponentTester* aComponentTester)
       
   140 		Intended Usage	: Implemented by the developer to persist the state of the object under test.
       
   141 		Error Condition	: Leaves with an error code.
       
   142 		@since			7.0
       
   143 		@param			TAny* A pointer to the object under test.
       
   144 		@return			None.
       
   145 		@pre 			TComponentTester_StateAccessor is fully constructed.
       
   146 		@post			No change to the class under test, its internal state.
       
   147 						is persisted.
       
   148 	*/
       
   149 	inline void ExternalizeL(CComponentTester* aComponentTester);
       
   150 	};	// TComponentTester_StateAccessor
       
   151 
       
   152 #include "ComponentTesterStateAccessor.inl"
       
   153 
       
   154 #endif // __COMPONENTTESTERSTATEACCESSOR_H__
       
   155