os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistryDataTest/RegistryDataStateAccessor.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 state accessor class for the CRegistryData.
    15 // 
    16 //
    17 
    18 #ifndef __REGISTRYDATASTATEACCESSOR_H__
    19 #define __REGISTRYDATASTATEACCESSOR_H__
    20 
    21 #include "StateAccessor.h"
    22 #include "RegistryData.h"
    23 #include <test_bed/testbeddefinitions.h>
    24 
    25 // ______________________________________________________________________________
    26 //
    27 /**
    28 	@internalComponent
    29 	Comments : State accessor for the CRegistryData object under test.
    30  */
    31 class TRegistryData_StateAccessor : public MStateAccessor
    32 	{
    33 public:
    34 	/**
    35 		@fn				InvariantTest(TAny* aTestObject)
    36 		Intended Usage	: Checks if CRegistryData has violated its invariants.
    37 		@since			7.0
    38 		@param			TAny* A pointer to the object under test.
    39 		@return			TInt KErrNone if the invariants were valid, error code otherwise.
    40 		@pre 			TRegistryData_StateAccessor is fully constructed.
    41 		@post			The class under test is set to the state specified.
    42 	 */
    43 	TInt InvariantTest(TAny* aTestObject);
    44 
    45 	/**
    46 		@fn				Internalize(TAny* aTestObject)
    47 		Intended Usage	: Implemented by the developer to set the state of the object under test.
    48 		@since			7.0
    49 		@param			TAny* A pointer to the object under test.
    50 		@return			TInt KErrNone if the state was set, error code otherwise.
    51 		@pre 			TRegistryData_StateAccessor is fully constructed.
    52 		@post			The class under test is set to the state specified.
    53 	*/
    54 	TInt Internalize(TAny* aTestObject);
    55 
    56 	/**
    57 		@fn				Externalize(TAny* aTestObject)
    58 		Intended Usage	: Implemented by the developer to persist the state of the object under test.
    59 		@since			7.0
    60 		@param			TAny* A pointer to the object under test.
    61 		@return			TInt KErrNone if the state was persisted, error code otherwise.
    62 		@pre 			TRegistryData_StateAccessor is fully constructed.
    63 		@post			No change to the class under test.
    64 	*/
    65 	TInt Externalize(TAny* aTestObject);
    66 	void BuildIndexesL(CRegistryData& aRegData);
    67 	TInt IndexedFind(CRegistryData& aRegData, const TUid& aImplementationUid);
    68 	TBool MatchOnUid();
    69 	void RestoreL(CRegistryData& aRegData, RFileReadStream& aStore);
    70 	void StoreL(CRegistryData& aRegData, RFileWriteStream& aStore);
    71 
    72 	TBool IsRegisteredDrive(CRegistryData& aRegData, TDriveUnit aDriveUnit);
    73 
    74 private:
    75 	// These need to be stored here (rather than in the UnitTestContext) because TIndex
    76 	// is a private class in CRegistryData (but this is a friend).
    77 	CRegistryData::TInterfaceIndex		iIndexItem;
    78 	CRegistryData::TInterfaceIndex		iKey;
    79 	};	// TRegistryData_StateAccessor
    80 
    81 #endif		// __REGISTRYDATASTATEACCESSOR_H__