lowlevellibsandfws/pluginfw/Test_Bed/TestControllerTest/TestControllerTest.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 // Demonstrates a simple set of derived class implementations to
       
    15 // test the CTestController class using the test bed.
       
    16 // It may be used as a basis to develop a full test bed dll.
       
    17 // For support and comment please contact the authors.
       
    18 // 
       
    19 //
       
    20 
       
    21 #include "TestControllerUnitTest.h"
       
    22 #include "ComponentTester.h"
       
    23 
       
    24 
       
    25 // ______________________________________________________________________________
       
    26 //
       
    27 /**
       
    28 	@internalComponent
       
    29 
       
    30 	Comments : Test the CTestController class.
       
    31  */
       
    32 class CTestController_ComponentTest : public CComponentTester
       
    33 	{
       
    34 public:
       
    35 	/**
       
    36 		@fn				NewLC(CDataLogger& aDataLogger,
       
    37 							 MComponentTestObserver& aObserver)
       
    38 		Intended Usage	: Standard two-phase construction which leaves nothing on the
       
    39 						cleanup stack.
       
    40 		Error Condition	: Leaves with the error code.
       
    41 		@leave  		KErrNoMemory
       
    42 		@since			7.0
       
    43 		@param			aDataLogger The output logging object.
       
    44 		@param			aObserver The observer of this component test.
       
    45 		@return			CTestController_ComponentTest* The constructed object.
       
    46 		@pre 			None.
       
    47 		@post			CTestController_ComponentTest is fully constructed.
       
    48 	*/
       
    49 	static CTestController_ComponentTest* NewLC(CDataLogger& aDataLogger,
       
    50 							MComponentTestObserver& aObserver);
       
    51 
       
    52 private:
       
    53 	/**
       
    54 		@fn				CTestController_ComponentTest(CDataLogger& aDataLogger,
       
    55 											MComponentTestObserver& aObserver)
       
    56 		Intended Usage	: Standard c'tor method.
       
    57 		Error Condition	: None.
       
    58 		@since			7.0
       
    59 		@param			aDataLogger The logging object.
       
    60 		@param			aObserver The observer of this component test.
       
    61 		@pre 			None.
       
    62 		@post			CTestController_ComponentTest is fully constructed.
       
    63 	*/
       
    64 	inline CTestController_ComponentTest(CDataLogger& aDataLogger,
       
    65 												MComponentTestObserver& aObserver);
       
    66 	/**
       
    67 		@fn				void ConstructL()
       
    68 		Intended Usage	: Second phase of safe two phase construction,
       
    69 						to complete the object initialisation.
       
    70 		Error Condition	: Leaves with an error code.
       
    71 		@leave  		KErrNoMemory.
       
    72 		@since			7.0
       
    73 		@return			None
       
    74 		@pre 			CTestController_ComponentTest is fully constructed.
       
    75 		@post			CTestController_ComponentTest is fully initialised.
       
    76 	*/
       
    77 	inline void ConstructL();
       
    78 
       
    79 	};	// CTestController_ComponentTest
       
    80 
       
    81 // ______________________________________________________________________________
       
    82 //
       
    83 inline CTestController_ComponentTest* CTestController_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
       
    84 	{
       
    85 	CTestController_ComponentTest* self = new (ELeave) CTestController_ComponentTest(aDataLogger, aObserver);
       
    86 	CleanupStack::PushL(self);
       
    87 	self->ConstructL();
       
    88 	return self;
       
    89 	}
       
    90 
       
    91 inline CTestController_ComponentTest::CTestController_ComponentTest(CDataLogger& aDataLogger,
       
    92 									MComponentTestObserver& aObserver)
       
    93 : CComponentTester(aDataLogger, aObserver)
       
    94 	{
       
    95 	// Do nothing here.
       
    96 	}
       
    97 
       
    98 inline void CTestController_ComponentTest::ConstructL()
       
    99 	{
       
   100 	// Perform base class initialization
       
   101 	ComponentTesterConstructL();
       
   102 
       
   103 	AddUnitTestL(CTestController_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
       
   104 	AddUnitTestL(CTestController_FindTests_UnitTest::NewL(iDataLogger, *this));
       
   105 	}
       
   106 
       
   107 // ______________________________________________________________________________
       
   108 //
       
   109 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
       
   110 									MComponentTestObserver&	aComponentTestObserver)
       
   111 	{
       
   112 	return CTestController_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
       
   113 	}
       
   114 
       
   115 
       
   116 // ___________________________________________________________________________
       
   117 //
       
   118 // This section of the module simply includes the exported test harness template which
       
   119 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP
       
   120 // project file can then produce a EXE for the test project instead of a DLL.
       
   121 
       
   122 #include <ecom/test_bed/testharnesstemplate.h>
       
   123 
       
   124 GLDEF_C TInt E32Main()
       
   125     {
       
   126 	return E32Main_TestHarness(NewComponentTestLC);
       
   127 	}
       
   128 
       
   129 // ______________________________________________________________________________
       
   130 //
       
   131 class CTestController_ComponentTest_STUB : public CComponentTester
       
   132 	{
       
   133 public:
       
   134 	static CTestController_ComponentTest_STUB* NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
       
   135 
       
   136 private:
       
   137 	inline CTestController_ComponentTest_STUB(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
       
   138 	inline void ConstructL();
       
   139 	};
       
   140 
       
   141 // ______________________________________________________________________________
       
   142 //
       
   143 inline CTestController_ComponentTest_STUB* CTestController_ComponentTest_STUB::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
       
   144 	{
       
   145 	CTestController_ComponentTest_STUB* self = new (ELeave) CTestController_ComponentTest_STUB(aDataLogger, aObserver);
       
   146 	CleanupStack::PushL(self);
       
   147 	self->ConstructL();
       
   148 	return self;
       
   149 	}
       
   150 
       
   151 inline CTestController_ComponentTest_STUB::CTestController_ComponentTest_STUB(CDataLogger& aDataLogger,
       
   152 									MComponentTestObserver& aObserver)
       
   153 : CComponentTester(aDataLogger, aObserver)
       
   154 	{
       
   155 	// Do nothing here.
       
   156 	}
       
   157 
       
   158 /**
       
   159 @SYMTestCaseID          SYSLIB-ECOM-CT-0780
       
   160 @SYMTestCaseDesc	    Tests for the implementations of CTransition class
       
   161 @SYMTestPriority 	    High
       
   162 @SYMTestActions  	    Tests for create and destroy,asynchronous,transit method operations
       
   163 @SYMTestExpectedResults Test must not fail
       
   164 @SYMREQ                 REQ0000
       
   165 */
       
   166 inline void CTestController_ComponentTest_STUB::ConstructL()
       
   167 	{
       
   168 	// Perform base class initialization
       
   169 	ComponentTesterConstructL();
       
   170 
       
   171 	AddUnitTestL(CTestController_CreateAndDestroy_UnitTest_STUB::NewL(iDataLogger, *this));
       
   172 	}
       
   173 
       
   174 // ______________________________________________________________________________
       
   175 //
       
   176 EXPORT_C CComponentTester* NewComponentTestLC_STUB(CDataLogger& aDataLogger,
       
   177 									MComponentTestObserver&	aComponentTestObserver)
       
   178 	{
       
   179 
       
   180 	return CTestController_ComponentTest_STUB::NewLC(aDataLogger, aComponentTestObserver);
       
   181 	}
       
   182