os/ossrv/lowlevellibsandfws/pluginfw/Framework/DiscovererTest/DiscovererTest.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
// Test the CDiscoverer class using the test bed.
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include "DiscovererUnitTest.h"
sl@0
    19
#include "ComponentTester.h"
sl@0
    20
sl@0
    21
// ______________________________________________________________________________
sl@0
    22
//
sl@0
    23
/**
sl@0
    24
	@internalComponent
sl@0
    25
sl@0
    26
	Comments : Test the CDiscoverer class.
sl@0
    27
 */
sl@0
    28
class CDiscoverer_ComponentTest : public CComponentTester
sl@0
    29
	{
sl@0
    30
public:
sl@0
    31
	/**
sl@0
    32
		@fn				NewLC(CDataLogger& aDataLogger,
sl@0
    33
							 MComponentTestObserver& aObserver)
sl@0
    34
		Intended Usage	: Standard two-phase construction which leaves nothing on the
sl@0
    35
						cleanup stack.
sl@0
    36
		Error Condition	: Leaves with the error code.
sl@0
    37
		@leave			KErrNoMemory
sl@0
    38
		@since			7.0
sl@0
    39
		@param			aDataLogger The output logging object.
sl@0
    40
		@param			aObserver The observer of this component test.
sl@0
    41
		@return			CDiscoverer_CreateAndDestroy_UnitTest* The constructed object.
sl@0
    42
		@pre 			None.
sl@0
    43
		@post			CDiscoverer_ComponentTest is fully constructed.
sl@0
    44
	*/
sl@0
    45
	static CDiscoverer_ComponentTest* NewLC(CDataLogger& aDataLogger, 
sl@0
    46
							MComponentTestObserver& aObserver);
sl@0
    47
sl@0
    48
private:
sl@0
    49
	/**
sl@0
    50
		@fn				CDiscoverer_ComponentTest(CDataLogger& aDataLogger,
sl@0
    51
											MComponentTestObserver& aObserver)
sl@0
    52
		Intended Usage	: Standard c'tor method.
sl@0
    53
		Error Condition	: None.
sl@0
    54
		@since			7.0
sl@0
    55
		@param			aDataLogger The logging object.
sl@0
    56
		@param			aObserver The observer of this component test.
sl@0
    57
		@pre 			None.
sl@0
    58
		@post			CDiscoverer_ComponentTest is fully constructed.
sl@0
    59
	*/
sl@0
    60
	inline CDiscoverer_ComponentTest(CDataLogger& aDataLogger,
sl@0
    61
												MComponentTestObserver& aObserver);
sl@0
    62
	/**
sl@0
    63
		@fn				void ConstructL()
sl@0
    64
		Intended Usage	: Second phase of safe two phase construction, 
sl@0
    65
						to complete the object initialisation.
sl@0
    66
		Error Condition	: Leaves with an error code.
sl@0
    67
		@leave			KErrNoMemory.
sl@0
    68
		@since			7.0
sl@0
    69
		@return			None 
sl@0
    70
		@pre 			CDiscoverer_ComponentTest is fully constructed.
sl@0
    71
		@post			CDiscoverer_ComponentTest is fully initialised.
sl@0
    72
	*/
sl@0
    73
	inline void ConstructL();
sl@0
    74
sl@0
    75
	};	// CDiscoverer_ComponentTest
sl@0
    76
sl@0
    77
// ______________________________________________________________________________
sl@0
    78
//
sl@0
    79
inline CDiscoverer_ComponentTest* CDiscoverer_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
sl@0
    80
	{
sl@0
    81
	CDiscoverer_ComponentTest* self = new (ELeave) CDiscoverer_ComponentTest(aDataLogger, aObserver);
sl@0
    82
	CleanupStack::PushL(self);
sl@0
    83
	self->ConstructL();
sl@0
    84
	return self;
sl@0
    85
	}
sl@0
    86
sl@0
    87
inline CDiscoverer_ComponentTest::CDiscoverer_ComponentTest(CDataLogger& aDataLogger,
sl@0
    88
									MComponentTestObserver& aObserver)
sl@0
    89
: CComponentTester(aDataLogger, aObserver)
sl@0
    90
	{
sl@0
    91
	// Do nothing here.
sl@0
    92
	}
sl@0
    93
sl@0
    94
inline void CDiscoverer_ComponentTest::ConstructL()
sl@0
    95
	{
sl@0
    96
	ComponentTesterConstructL();
sl@0
    97
	AddUnitTestL(CDiscoverer_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
sl@0
    98
	AddUnitTestL(CDiscoverer_UnmountDrive_UnitTest::NewL(iDataLogger, *this));
sl@0
    99
	AddUnitTestL(CDiscoverer_MountDrive_UnitTest::NewL(iDataLogger, *this));
sl@0
   100
	AddUnitTestL(CDiscoverer_IsValidEntryL_UnitTest::NewL(iDataLogger, *this));
sl@0
   101
	AddUnitTestL(CDiscoverer_ProcessEntryL_UnitTest::NewL(iDataLogger, *this));
sl@0
   102
	AddUnitTestL(CDiscoverer_ScanDirectory_UnitTest::NewL(iDataLogger, *this));
sl@0
   103
	AddUnitTestL(CDiscoverer_ScanDirectoryCancel_UnitTest::NewL(iDataLogger, *this));
sl@0
   104
	AddUnitTestL(CDiscoverer_ScanDirectoryIncrement_UnitTest::NewL(iDataLogger, *this));
sl@0
   105
sl@0
   106
	AddUnitTestL(CDiscoverer_CompleteNotificationProcessing_UnitTest::NewL(iDataLogger, *this));
sl@0
   107
	AddUnitTestL(CDiscoverer_Notification_UnitTest::NewL(iDataLogger, *this));
sl@0
   108
	AddUnitTestL(CDiscoverer_SuspendResume_UnitTest::NewL(iDataLogger, *this));
sl@0
   109
	}
sl@0
   110
sl@0
   111
// ______________________________________________________________________________
sl@0
   112
//
sl@0
   113
EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
sl@0
   114
											  MComponentTestObserver&	aComponentTestObserver)
sl@0
   115
	{
sl@0
   116
	return CDiscoverer_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
sl@0
   117
	}
sl@0
   118
sl@0
   119
// ___________________________________________________________________________
sl@0
   120
//
sl@0
   121
// This section of the module simply includes the exported test harness template which 
sl@0
   122
// makes this a "whole" CPP file with a E32Main entry point below. The test MMP 
sl@0
   123
// project file can then produce a EXE for the test project instead of a DLL.
sl@0
   124
sl@0
   125
#include <ecom/test_bed/testharnesstemplate.h>
sl@0
   126
sl@0
   127
GLDEF_C TInt E32Main()
sl@0
   128
	{
sl@0
   129
	return E32Main_TestHarness(NewComponentTestLC);
sl@0
   130
	}
sl@0
   131