os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/ResolverTest.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Demonstrates a simple set of derived class implementations to
    15 // test the CResolver 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.
    18 // 
    19 //
    20 
    21 #include "StateAccessor.h"
    22 #include <test_bed/testbeddefinitions.h>
    23 #include <test_bed/unittest.h>
    24 #include <test_bed/datalogger.h>
    25 #include "ComponentTester.h"
    26 
    27 #include "DefaultResolver.h"
    28 
    29 #include "ResolverUnitTests.h"
    30 
    31 RTest test(_L("ResolverTest.cpp"));
    32 
    33 // ______________________________________________________________________________
    34 //
    35 /**
    36 	@internalComponent
    37 
    38 	Comments : Test the CDefaultResolver class.
    39  */
    40 class CDefaultResolver_ComponentTest : public CComponentTester
    41 	{
    42 public:
    43 	/**
    44 		@fn				NewLC(CDataLogger& aDataLogger,
    45 							 MComponentTestObserver& aObserver)
    46 		Intended Usage	: Standard two-phase construction which leaves nothing on the
    47 						cleanup stack.
    48 		Error Condition	: Leaves with the error code.
    49 		@leave  		KErrNoMemory
    50 		@since			7.0
    51 		@param			aDataLogger The output logging object.
    52 		@param			aObserver The observer of this component test.
    53 		@return			CDefaultResolver_ComponentTest* The constructed object.
    54 		@pre 			None.
    55 		@post			CDefaultResolver_ComponentTest is fully constructed.
    56 	*/
    57 	static CDefaultResolver_ComponentTest* NewLC(CDataLogger& aDataLogger,
    58 							MComponentTestObserver& aObserver);
    59 
    60 private:
    61 	/**
    62 		@fn				CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
    63 											MComponentTestObserver& aObserver)
    64 		Intended Usage	: Standard c'tor method.
    65 		Error Condition	: None.
    66 		@since			7.0
    67 		@param			aDataLogger The logging object.
    68 		@param			aObserver The observer of this component test.
    69 		@pre 			None.
    70 		@post			CDefaultResolver_ComponentTest is fully constructed.
    71 	*/
    72 	inline CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
    73 												MComponentTestObserver& aObserver);
    74 	/**
    75 		@fn				void ConstructL()
    76 		Intended Usage	: Second phase of safe two phase construction,
    77 						to complete the object initialisation.
    78 		Error Condition	: Leaves with an error code.
    79 		@leave  		KErrNoMemory.
    80 		@since			7.0
    81 		@return			None
    82 		@pre 			CDefaultResolver_ComponentTest is fully constructed.
    83 		@post			CDefaultResolver_ComponentTest is fully initialised.
    84 	*/
    85 	inline void ConstructL();
    86 
    87 	};	// CDefaultResolver_ComponentTest
    88 
    89 // ______________________________________________________________________________
    90 //
    91 inline CDefaultResolver_ComponentTest* CDefaultResolver_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
    92 	{
    93 	CDefaultResolver_ComponentTest* self = new (ELeave) CDefaultResolver_ComponentTest(aDataLogger, aObserver);
    94 	CleanupStack::PushL(self);
    95 	self->ConstructL();
    96 	return self;
    97 	}
    98 
    99 inline CDefaultResolver_ComponentTest::CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
   100 									MComponentTestObserver& aObserver)
   101 : CComponentTester(aDataLogger, aObserver)
   102 	{
   103 	// Do nothing here.
   104 	}
   105 
   106 inline void CDefaultResolver_ComponentTest::ConstructL()
   107 	{
   108 	// Perform base class initialization
   109 	ComponentTesterConstructL();
   110 
   111 	AddUnitTestL(CDefaultResolver_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
   112 	AddUnitTestL(CDefaultResolver_IdentifyImplementation_UnitTest::NewL(iDataLogger, *this));
   113 	}
   114 
   115 // ______________________________________________________________________________
   116 //
   117 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
   118 									MComponentTestObserver&	aComponentTestObserver)
   119 	{
   120 	return CDefaultResolver_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
   121 	}
   122 
   123 // ___________________________________________________________________________
   124 //
   125 // This section of the module simply includes the exported test harness template which
   126 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP
   127 // project file can then produce a EXE for the test project instead of a DLL.
   128 
   129 #include <ecom/test_bed/testharnesstemplate.h>
   130 
   131 GLDEF_C TInt E32Main()
   132     {
   133 	test.Title();
   134 	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-LEGACY-RESOLVERTEST-0001 "));
   135 
   136 	test.End();
   137 	test.Close();
   138 
   139 	return E32Main_TestHarness(NewComponentTestLC);
   140 	}
   141