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.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Demonstrates a simple set of derived class implementations to
sl@0
    15
// test the CResolver class using the test bed.
sl@0
    16
// It may be used as a basis to develop a full test bed dll.
sl@0
    17
// For support and comment please contact the authors.
sl@0
    18
// 
sl@0
    19
//
sl@0
    20
sl@0
    21
#include "StateAccessor.h"
sl@0
    22
#include <test_bed/testbeddefinitions.h>
sl@0
    23
#include <test_bed/unittest.h>
sl@0
    24
#include <test_bed/datalogger.h>
sl@0
    25
#include "ComponentTester.h"
sl@0
    26
sl@0
    27
#include "DefaultResolver.h"
sl@0
    28
sl@0
    29
#include "ResolverUnitTests.h"
sl@0
    30
sl@0
    31
RTest test(_L("ResolverTest.cpp"));
sl@0
    32
sl@0
    33
// ______________________________________________________________________________
sl@0
    34
//
sl@0
    35
/**
sl@0
    36
	@internalComponent
sl@0
    37
sl@0
    38
	Comments : Test the CDefaultResolver class.
sl@0
    39
 */
sl@0
    40
class CDefaultResolver_ComponentTest : public CComponentTester
sl@0
    41
	{
sl@0
    42
public:
sl@0
    43
	/**
sl@0
    44
		@fn				NewLC(CDataLogger& aDataLogger,
sl@0
    45
							 MComponentTestObserver& aObserver)
sl@0
    46
		Intended Usage	: Standard two-phase construction which leaves nothing on the
sl@0
    47
						cleanup stack.
sl@0
    48
		Error Condition	: Leaves with the error code.
sl@0
    49
		@leave  		KErrNoMemory
sl@0
    50
		@since			7.0
sl@0
    51
		@param			aDataLogger The output logging object.
sl@0
    52
		@param			aObserver The observer of this component test.
sl@0
    53
		@return			CDefaultResolver_ComponentTest* The constructed object.
sl@0
    54
		@pre 			None.
sl@0
    55
		@post			CDefaultResolver_ComponentTest is fully constructed.
sl@0
    56
	*/
sl@0
    57
	static CDefaultResolver_ComponentTest* NewLC(CDataLogger& aDataLogger,
sl@0
    58
							MComponentTestObserver& aObserver);
sl@0
    59
sl@0
    60
private:
sl@0
    61
	/**
sl@0
    62
		@fn				CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
sl@0
    63
											MComponentTestObserver& aObserver)
sl@0
    64
		Intended Usage	: Standard c'tor method.
sl@0
    65
		Error Condition	: None.
sl@0
    66
		@since			7.0
sl@0
    67
		@param			aDataLogger The logging object.
sl@0
    68
		@param			aObserver The observer of this component test.
sl@0
    69
		@pre 			None.
sl@0
    70
		@post			CDefaultResolver_ComponentTest is fully constructed.
sl@0
    71
	*/
sl@0
    72
	inline CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
sl@0
    73
												MComponentTestObserver& aObserver);
sl@0
    74
	/**
sl@0
    75
		@fn				void ConstructL()
sl@0
    76
		Intended Usage	: Second phase of safe two phase construction,
sl@0
    77
						to complete the object initialisation.
sl@0
    78
		Error Condition	: Leaves with an error code.
sl@0
    79
		@leave  		KErrNoMemory.
sl@0
    80
		@since			7.0
sl@0
    81
		@return			None
sl@0
    82
		@pre 			CDefaultResolver_ComponentTest is fully constructed.
sl@0
    83
		@post			CDefaultResolver_ComponentTest is fully initialised.
sl@0
    84
	*/
sl@0
    85
	inline void ConstructL();
sl@0
    86
sl@0
    87
	};	// CDefaultResolver_ComponentTest
sl@0
    88
sl@0
    89
// ______________________________________________________________________________
sl@0
    90
//
sl@0
    91
inline CDefaultResolver_ComponentTest* CDefaultResolver_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
sl@0
    92
	{
sl@0
    93
	CDefaultResolver_ComponentTest* self = new (ELeave) CDefaultResolver_ComponentTest(aDataLogger, aObserver);
sl@0
    94
	CleanupStack::PushL(self);
sl@0
    95
	self->ConstructL();
sl@0
    96
	return self;
sl@0
    97
	}
sl@0
    98
sl@0
    99
inline CDefaultResolver_ComponentTest::CDefaultResolver_ComponentTest(CDataLogger& aDataLogger,
sl@0
   100
									MComponentTestObserver& aObserver)
sl@0
   101
: CComponentTester(aDataLogger, aObserver)
sl@0
   102
	{
sl@0
   103
	// Do nothing here.
sl@0
   104
	}
sl@0
   105
sl@0
   106
inline void CDefaultResolver_ComponentTest::ConstructL()
sl@0
   107
	{
sl@0
   108
	// Perform base class initialization
sl@0
   109
	ComponentTesterConstructL();
sl@0
   110
sl@0
   111
	AddUnitTestL(CDefaultResolver_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
sl@0
   112
	AddUnitTestL(CDefaultResolver_IdentifyImplementation_UnitTest::NewL(iDataLogger, *this));
sl@0
   113
	}
sl@0
   114
sl@0
   115
// ______________________________________________________________________________
sl@0
   116
//
sl@0
   117
EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
sl@0
   118
									MComponentTestObserver&	aComponentTestObserver)
sl@0
   119
	{
sl@0
   120
	return CDefaultResolver_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
sl@0
   121
	}
sl@0
   122
sl@0
   123
// ___________________________________________________________________________
sl@0
   124
//
sl@0
   125
// This section of the module simply includes the exported test harness template which
sl@0
   126
// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
sl@0
   127
// project file can then produce a EXE for the test project instead of a DLL.
sl@0
   128
sl@0
   129
#include <ecom/test_bed/testharnesstemplate.h>
sl@0
   130
sl@0
   131
GLDEF_C TInt E32Main()
sl@0
   132
    {
sl@0
   133
	test.Title();
sl@0
   134
	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-LEGACY-RESOLVERTEST-0001 "));
sl@0
   135
sl@0
   136
	test.End();
sl@0
   137
	test.Close();
sl@0
   138
sl@0
   139
	return E32Main_TestHarness(NewComponentTestLC);
sl@0
   140
	}
sl@0
   141