os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/DataLoggerTest/DataLoggerTest.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 CDataLogger 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 "DataLoggerUnitTest.h"
sl@0
    22
#include "ComponentTester.h"
sl@0
    23
sl@0
    24
RTest test(_L("DataLoggerTest.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 CDataLogger class.
sl@0
    32
 */
sl@0
    33
class CDataLogger_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			7.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			CDataLogger_ComponentTest* The constructed object.
sl@0
    47
		@pre 			None.
sl@0
    48
		@post			CDataLogger_ComponentTest is fully constructed.
sl@0
    49
	*/
sl@0
    50
	static CDataLogger_ComponentTest* NewLC(CDataLogger& aDataLogger,
sl@0
    51
							MComponentTestObserver& aObserver);
sl@0
    52
sl@0
    53
private:
sl@0
    54
	/**
sl@0
    55
		@fn				CDataLogger_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			7.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			CDataLogger_ComponentTest is fully constructed.
sl@0
    64
	*/
sl@0
    65
	inline CDataLogger_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			7.0
sl@0
    74
		@return			None
sl@0
    75
		@pre 			CDataLogger_ComponentTest is fully constructed.
sl@0
    76
		@post			CDataLogger_ComponentTest is fully initialised.
sl@0
    77
	*/
sl@0
    78
	inline void ConstructL();
sl@0
    79
sl@0
    80
	};	// CDataLogger_ComponentTest
sl@0
    81
sl@0
    82
// ______________________________________________________________________________
sl@0
    83
//
sl@0
    84
inline CDataLogger_ComponentTest* CDataLogger_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
sl@0
    85
	{
sl@0
    86
	CDataLogger_ComponentTest* self = new (ELeave) CDataLogger_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 CDataLogger_ComponentTest::CDataLogger_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
/**
sl@0
   100
@SYMTestCaseID          SYSLIB-ECOM-CT-0778
sl@0
   101
@SYMTestCaseDesc	    Tests for the implementations of CDataLogger class
sl@0
   102
@SYMTestPriority 	    High
sl@0
   103
@SYMTestActions  	    Tests for create and destroy,dump memory,log and report information operations
sl@0
   104
@SYMTestExpectedResults Test must not fail
sl@0
   105
@SYMREQ                 REQ0000
sl@0
   106
*/
sl@0
   107
inline void CDataLogger_ComponentTest::ConstructL()
sl@0
   108
	{
sl@0
   109
	// Perform base class initialization
sl@0
   110
	ComponentTesterConstructL();
sl@0
   111
sl@0
   112
	AddUnitTestL(CDataLogger_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
sl@0
   113
	AddUnitTestL(CDataLogger_DumpMemoryBlock_UnitTest::NewL(iDataLogger, *this));
sl@0
   114
	AddUnitTestL(CDataLogger_LogInformation_UnitTest::NewL(iDataLogger, *this));
sl@0
   115
	AddUnitTestL(CDataLogger_ReportInformation_UnitTest::NewL(iDataLogger, *this));
sl@0
   116
	}
sl@0
   117
sl@0
   118
// ______________________________________________________________________________
sl@0
   119
//
sl@0
   120
EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
sl@0
   121
									MComponentTestObserver&	aComponentTestObserver)
sl@0
   122
	{
sl@0
   123
	return CDataLogger_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
sl@0
   124
	}
sl@0
   125
sl@0
   126
// ___________________________________________________________________________
sl@0
   127
//
sl@0
   128
// This section of the module simply includes the exported test harness template which
sl@0
   129
// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
sl@0
   130
// project file can then produce a EXE for the test project instead of a DLL.
sl@0
   131
sl@0
   132
#include <ecom/test_bed/testharnesstemplate.h>
sl@0
   133
sl@0
   134
GLDEF_C TInt E32Main()
sl@0
   135
    {
sl@0
   136
	test.Title();
sl@0
   137
	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0778 "));
sl@0
   138
sl@0
   139
	test.End();
sl@0
   140
	test.Close();
sl@0
   141
sl@0
   142
	return E32Main_TestHarness(NewComponentTestLC);
sl@0
   143
	}
sl@0
   144