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