os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/ResolverTest.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/ResolverTest.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,141 @@
     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 +// Demonstrates a simple set of derived class implementations to
    1.18 +// test the CResolver class using the test bed.
    1.19 +// It may be used as a basis to develop a full test bed dll.
    1.20 +// For support and comment please contact the authors.
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +#include "StateAccessor.h"
    1.25 +#include <test_bed/testbeddefinitions.h>
    1.26 +#include <test_bed/unittest.h>
    1.27 +#include <test_bed/datalogger.h>
    1.28 +#include "ComponentTester.h"
    1.29 +
    1.30 +#include "DefaultResolver.h"
    1.31 +
    1.32 +#include "ResolverUnitTests.h"
    1.33 +
    1.34 +RTest test(_L("ResolverTest.cpp"));
    1.35 +
    1.36 +// ______________________________________________________________________________
    1.37 +//
    1.38 +/**
    1.39 +	@internalComponent
    1.40 +
    1.41 +	Comments : Test the CDefaultResolver class.
    1.42 + */
    1.43 +class CDefaultResolver_ComponentTest : public CComponentTester
    1.44 +	{
    1.45 +public:
    1.46 +	/**
    1.47 +		@fn				NewLC(CDataLogger& aDataLogger,
    1.48 +							 MComponentTestObserver& aObserver)
    1.49 +		Intended Usage	: Standard two-phase construction which leaves nothing on the
    1.50 +						cleanup stack.
    1.51 +		Error Condition	: Leaves with the error code.
    1.52 +		@leave  		KErrNoMemory
    1.53 +		@since			7.0
    1.54 +		@param			aDataLogger The output logging object.
    1.55 +		@param			aObserver The observer of this component test.
    1.56 +		@return			CDefaultResolver_ComponentTest* The constructed object.
    1.57 +		@pre 			None.
    1.58 +		@post			CDefaultResolver_ComponentTest is fully constructed.
    1.59 +	*/
    1.60 +	static CDefaultResolver_ComponentTest* NewLC(CDataLogger& aDataLogger,
    1.61 +							MComponentTestObserver& aObserver);
    1.62 +
    1.63 +private:
    1.64 +	/**
    1.65 +		@fn				CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
    1.66 +											MComponentTestObserver& aObserver)
    1.67 +		Intended Usage	: Standard c'tor method.
    1.68 +		Error Condition	: None.
    1.69 +		@since			7.0
    1.70 +		@param			aDataLogger The logging object.
    1.71 +		@param			aObserver The observer of this component test.
    1.72 +		@pre 			None.
    1.73 +		@post			CDefaultResolver_ComponentTest is fully constructed.
    1.74 +	*/
    1.75 +	inline CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
    1.76 +												MComponentTestObserver& aObserver);
    1.77 +	/**
    1.78 +		@fn				void ConstructL()
    1.79 +		Intended Usage	: Second phase of safe two phase construction,
    1.80 +						to complete the object initialisation.
    1.81 +		Error Condition	: Leaves with an error code.
    1.82 +		@leave  		KErrNoMemory.
    1.83 +		@since			7.0
    1.84 +		@return			None
    1.85 +		@pre 			CDefaultResolver_ComponentTest is fully constructed.
    1.86 +		@post			CDefaultResolver_ComponentTest is fully initialised.
    1.87 +	*/
    1.88 +	inline void ConstructL();
    1.89 +
    1.90 +	};	// CDefaultResolver_ComponentTest
    1.91 +
    1.92 +// ______________________________________________________________________________
    1.93 +//
    1.94 +inline CDefaultResolver_ComponentTest* CDefaultResolver_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
    1.95 +	{
    1.96 +	CDefaultResolver_ComponentTest* self = new (ELeave) CDefaultResolver_ComponentTest(aDataLogger, aObserver);
    1.97 +	CleanupStack::PushL(self);
    1.98 +	self->ConstructL();
    1.99 +	return self;
   1.100 +	}
   1.101 +
   1.102 +inline CDefaultResolver_ComponentTest::CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
   1.103 +									MComponentTestObserver& aObserver)
   1.104 +: CComponentTester(aDataLogger, aObserver)
   1.105 +	{
   1.106 +	// Do nothing here.
   1.107 +	}
   1.108 +
   1.109 +inline void CDefaultResolver_ComponentTest::ConstructL()
   1.110 +	{
   1.111 +	// Perform base class initialization
   1.112 +	ComponentTesterConstructL();
   1.113 +
   1.114 +	AddUnitTestL(CDefaultResolver_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
   1.115 +	AddUnitTestL(CDefaultResolver_IdentifyImplementation_UnitTest::NewL(iDataLogger, *this));
   1.116 +	}
   1.117 +
   1.118 +// ______________________________________________________________________________
   1.119 +//
   1.120 +EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
   1.121 +									MComponentTestObserver&	aComponentTestObserver)
   1.122 +	{
   1.123 +	return CDefaultResolver_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
   1.124 +	}
   1.125 +
   1.126 +// ___________________________________________________________________________
   1.127 +//
   1.128 +// This section of the module simply includes the exported test harness template which
   1.129 +// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
   1.130 +// project file can then produce a EXE for the test project instead of a DLL.
   1.131 +
   1.132 +#include <ecom/test_bed/testharnesstemplate.h>
   1.133 +
   1.134 +GLDEF_C TInt E32Main()
   1.135 +    {
   1.136 +	test.Title();
   1.137 +	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-LEGACY-RESOLVERTEST-0001 "));
   1.138 +
   1.139 +	test.End();
   1.140 +	test.Close();
   1.141 +
   1.142 +	return E32Main_TestHarness(NewComponentTestLC);
   1.143 +	}
   1.144 +