os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistryDataTest/RegistryDataTest.cpp
First public contribution.
     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".
 
     8 // Initial Contributors:
 
     9 // Nokia Corporation - initial contribution.
 
    14 // Demonstrates a simple set of derived class implementations to
 
    15 // test the CRegistryData class using the test bed.
 
    16 // It may be used as a basis to develop a full test bed dll.
 
    17 // For support and comment please contact the authors.
 
    21 #include "StateAccessor.h"
 
    22 #include <test_bed/testbeddefinitions.h>
 
    23 #include <test_bed/unittest.h>
 
    24 #include "LeakTestTransition.h"
 
    25 #include <test_bed/datalogger.h>
 
    26 #include "ComponentTester.h"
 
    28 #include "RegistryData.h"
 
    30 #include "RegistryDataUnitTests.h"
 
    32 RTest test(_L("RegistryDataTest.cpp"));
 
    34 // ______________________________________________________________________________
 
    38 	Comments : Test the CRegistryData class.
 
    40 class CRegistryData_ComponentTest : public CComponentTester
 
    44 		@fn				NewLC(CDataLogger& aDataLogger,
 
    45 							 MComponentTestObserver& aObserver)
 
    46 		Intended Usage	: Standard two-phase construction which leaves nothing on the
 
    48 		Error Condition	: Leaves with the error code.
 
    51 		@param			aDataLogger The output logging object.
 
    52 		@param			aObserver The observer of this component test.
 
    53 		@return			CRegistryData_ComponentTest* The constructed object.
 
    55 		@post			CRegistryData_ComponentTest is fully constructed.
 
    57 	static CRegistryData_ComponentTest* NewLC(CDataLogger& aDataLogger,
 
    58 							MComponentTestObserver& aObserver);
 
    62 		@fn				CRegistryData_ComponentTest(CDataLogger& aDataLogger,
 
    63 											MComponentTestObserver& aObserver)
 
    64 		Intended Usage	: Standard c'tor method.
 
    65 		Error Condition	: None.
 
    67 		@param			aDataLogger The logging object.
 
    68 		@param			aObserver The observer of this component test.
 
    70 		@post			CRegistryData_ComponentTest is fully constructed.
 
    72 	inline CRegistryData_ComponentTest(CDataLogger& aDataLogger,
 
    73 												MComponentTestObserver& aObserver);
 
    76 		Intended Usage	: Second phase of safe two phase construction,
 
    77 						to complete the object initialisation.
 
    78 		Error Condition	: Leaves with an error code.
 
    82 		@pre 			CRegistryData_ComponentTest is fully constructed.
 
    83 		@post			CRegistryData_ComponentTest is fully initialised.
 
    85 	inline void ConstructL();
 
    87 	};	// CRegistryData_ComponentTest
 
    89 // ______________________________________________________________________________
 
    91 inline CRegistryData_UnitTestContext::CRegistryData_UnitTestContext(CDataLogger& aDataLogger,
 
    92 												MStateAccessor& aStateAccessor,
 
    93 												MTransitionObserver& aObserver,
 
    95 : CUnitTestContext(aDataLogger, aStateAccessor, aObserver), iFs(aFs)
 
   100 inline CRegistryData_UnitTestContext::~CRegistryData_UnitTestContext()
 
   102 	delete iRegistryData;
 
   107 // ______________________________________________________________________________
 
   109 inline CRegistryData_ComponentTest* CRegistryData_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
 
   111 	CRegistryData_ComponentTest* self = new (ELeave) CRegistryData_ComponentTest(aDataLogger, aObserver);
 
   112 	CleanupStack::PushL(self);
 
   117 inline CRegistryData_ComponentTest::CRegistryData_ComponentTest(CDataLogger& aDataLogger,
 
   118 									MComponentTestObserver& aObserver)
 
   119 : CComponentTester(aDataLogger, aObserver)
 
   124 inline void CRegistryData_ComponentTest::ConstructL()
 
   126 	// Perform base class initialization
 
   127 	ComponentTesterConstructL();
 
   129 	AddUnitTestL(CRegistryData_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
 
   130 	AddUnitTestL(CRegistryData_RetrieveInfo_UnitTest::NewL(iDataLogger, *this));
 
   132 	AddUnitTestL(CRegistryData_GetImplInfoWhileDiscovering_UnitTest::NewL(iDataLogger, *this));
 
   133 	AddUnitTestL(CRegistryData_AddData_UnitTest::NewL(iDataLogger, *this));
 
   136 // ______________________________________________________________________________
 
   138 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
 
   139 									MComponentTestObserver&	aComponentTestObserver)
 
   141 	return CRegistryData_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
 
   144 // ___________________________________________________________________________
 
   146 // This section of the module simply includes the exported test harness template which
 
   147 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP
 
   148 // project file can then produce a EXE for the test project instead of a DLL.
 
   150 #include "ECom/Test_Bed/TestHarnessTemplate.h"
 
   152 GLDEF_C TInt E32Main()
 
   155 	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-LEGACY-REGISTRYDATATEST-0001 "));
 
   160 	return E32Main_TestHarness(NewComponentTestLC);