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