os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestManagerTest/TestManagerTest.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
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 CTestManager 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 "TestManagerUnitTest.h"
sl@0
    22
#include "ComponentTester.h"
sl@0
    23
sl@0
    24
RTest test(_L("TestManagerTest.cpp"));
sl@0
    25
sl@0
    26
// ______________________________________________________________________________
sl@0
    27
//
sl@0
    28
/**
sl@0
    29
	@internalComponent
sl@0
    30
sl@0
    31
	Comments : Test the CTestManager class.
sl@0
    32
 */
sl@0
    33
class CTestManager_ComponentTest : public CComponentTester
sl@0
    34
	{
sl@0
    35
public:
sl@0
    36
	/**
sl@0
    37
		@fn				NewLC(CDataLogger& aDataLogger,
sl@0
    38
							 MComponentTestObserver& aObserver)
sl@0
    39
		Intended Usage	: Standard two-phase construction which leaves nothing on the
sl@0
    40
						cleanup stack.
sl@0
    41
		Error Condition	: Leaves with the error code.
sl@0
    42
		@leave  		KErrNoMemory
sl@0
    43
		@since			6.0
sl@0
    44
		@param			aDataLogger The output logging object.
sl@0
    45
		@param			aObserver The observer of this component test.
sl@0
    46
		@return			CTestManager_ComponentTest* The constructed object.
sl@0
    47
		@pre 			None.
sl@0
    48
		@post			CTestManager_ComponentTest is fully constructed.
sl@0
    49
	*/
sl@0
    50
	static CTestManager_ComponentTest* NewLC(CDataLogger& aDataLogger,
sl@0
    51
							MComponentTestObserver& aObserver);
sl@0
    52
sl@0
    53
private:
sl@0
    54
	/**
sl@0
    55
		@fn				CTestManager_ComponentTest(CDataLogger& aDataLogger,
sl@0
    56
											MComponentTestObserver& aObserver)
sl@0
    57
		Intended Usage	: Standard c'tor method.
sl@0
    58
		Error Condition	: None.
sl@0
    59
		@since			6.0
sl@0
    60
		@param			aDataLogger The logging object.
sl@0
    61
		@param			aObserver The observer of this component test.
sl@0
    62
		@pre 			None.
sl@0
    63
		@post			CTestManager_ComponentTest is fully constructed.
sl@0
    64
	*/
sl@0
    65
	inline CTestManager_ComponentTest(CDataLogger& aDataLogger,
sl@0
    66
												MComponentTestObserver& aObserver);
sl@0
    67
	/**
sl@0
    68
		@fn				void ConstructL()
sl@0
    69
		Intended Usage	: Second phase of safe two phase construction,
sl@0
    70
						to complete the object initialisation.
sl@0
    71
		Error Condition	: Leaves with an error code.
sl@0
    72
		@leave  		KErrNoMemory.
sl@0
    73
		@since			6.0
sl@0
    74
		@return			None
sl@0
    75
		@pre 			CTestManager_ComponentTest is fully constructed.
sl@0
    76
		@post			CTestManager_ComponentTest is fully initialised.
sl@0
    77
	*/
sl@0
    78
	inline void ConstructL();
sl@0
    79
sl@0
    80
	};	// CTestManager_ComponentTest
sl@0
    81
sl@0
    82
// ______________________________________________________________________________
sl@0
    83
//
sl@0
    84
inline CTestManager_ComponentTest* CTestManager_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
sl@0
    85
	{
sl@0
    86
	CTestManager_ComponentTest* self = new (ELeave) CTestManager_ComponentTest(aDataLogger, aObserver);
sl@0
    87
	CleanupStack::PushL(self);
sl@0
    88
	self->ConstructL();
sl@0
    89
	return self;
sl@0
    90
	}
sl@0
    91
sl@0
    92
inline CTestManager_ComponentTest::CTestManager_ComponentTest(CDataLogger& aDataLogger,
sl@0
    93
									MComponentTestObserver& aObserver)
sl@0
    94
: CComponentTester(aDataLogger, aObserver)
sl@0
    95
	{
sl@0
    96
	// Do nothing here.
sl@0
    97
	}
sl@0
    98
sl@0
    99
inline void CTestManager_ComponentTest::ConstructL()
sl@0
   100
	{
sl@0
   101
	// Perform base class initialization
sl@0
   102
	ComponentTesterConstructL();
sl@0
   103
sl@0
   104
	AddUnitTestL(CTestManager_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
sl@0
   105
	AddUnitTestL(CTestManager_ManageTests_UnitTest::NewL(iDataLogger, *this));
sl@0
   106
	}
sl@0
   107
sl@0
   108
// ______________________________________________________________________________
sl@0
   109
//
sl@0
   110
EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
sl@0
   111
									MComponentTestObserver&	aComponentTestObserver)
sl@0
   112
	{
sl@0
   113
	return CTestManager_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
sl@0
   114
	}
sl@0
   115
sl@0
   116
// ______________________________________________________________________________
sl@0
   117
//
sl@0
   118
class CTestManager_ComponentTest_STUB : public CComponentTester
sl@0
   119
	{
sl@0
   120
public:
sl@0
   121
	static CTestManager_ComponentTest_STUB* NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
sl@0
   122
sl@0
   123
private:
sl@0
   124
	inline CTestManager_ComponentTest_STUB(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
sl@0
   125
	inline void ConstructL();
sl@0
   126
	};
sl@0
   127
sl@0
   128
// ______________________________________________________________________________
sl@0
   129
//
sl@0
   130
inline CTestManager_ComponentTest_STUB* CTestManager_ComponentTest_STUB::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
sl@0
   131
	{
sl@0
   132
	CTestManager_ComponentTest_STUB* self = new (ELeave) CTestManager_ComponentTest_STUB(aDataLogger, aObserver);
sl@0
   133
	CleanupStack::PushL(self);
sl@0
   134
	self->ConstructL();
sl@0
   135
	return self;
sl@0
   136
	}
sl@0
   137
sl@0
   138
inline CTestManager_ComponentTest_STUB::CTestManager_ComponentTest_STUB(CDataLogger& aDataLogger,
sl@0
   139
									MComponentTestObserver& aObserver)
sl@0
   140
: CComponentTester(aDataLogger, aObserver)
sl@0
   141
	{
sl@0
   142
	// Do nothing here.
sl@0
   143
	}
sl@0
   144
sl@0
   145
/**
sl@0
   146
@SYMTestCaseID          SYSLIB-ECOM-CT-0781
sl@0
   147
@SYMTestCaseDesc	    Tests for the implementations of CTestManager class
sl@0
   148
@SYMTestPriority 	    High
sl@0
   149
@SYMTestActions  	    Tests for create and destroy operations
sl@0
   150
@SYMTestExpectedResults Test must not fail
sl@0
   151
@SYMREQ                 REQ0000
sl@0
   152
*/
sl@0
   153
inline void CTestManager_ComponentTest_STUB::ConstructL()
sl@0
   154
	{
sl@0
   155
	// Perform base class initialization
sl@0
   156
	ComponentTesterConstructL();
sl@0
   157
sl@0
   158
	AddUnitTestL(CTestManager_CreateAndDestroy_UnitTest_STUB::NewL(iDataLogger, *this));
sl@0
   159
	}
sl@0
   160
sl@0
   161
// ______________________________________________________________________________
sl@0
   162
//
sl@0
   163
EXPORT_C CComponentTester* NewComponentTestLC_STUB(CDataLogger& aDataLogger,
sl@0
   164
									MComponentTestObserver&	aComponentTestObserver)
sl@0
   165
	{
sl@0
   166
	return CTestManager_ComponentTest_STUB::NewLC(aDataLogger, aComponentTestObserver);
sl@0
   167
	}
sl@0
   168
sl@0
   169
// ___________________________________________________________________________
sl@0
   170
//
sl@0
   171
// This section of the module simply includes the exported test harness template which
sl@0
   172
// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
sl@0
   173
// project file can then produce a EXE for the test project instead of a DLL.
sl@0
   174
sl@0
   175
#include <ecom/test_bed/testharnesstemplate.h>
sl@0
   176
sl@0
   177
GLDEF_C TInt E32Main()
sl@0
   178
    {
sl@0
   179
	test.Title();
sl@0
   180
	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0781 "));
sl@0
   181
sl@0
   182
	test.End();
sl@0
   183
	test.Close();
sl@0
   184
sl@0
   185
	return E32Main_TestHarness(NewComponentTestLC);
sl@0
   186
	}
sl@0
   187