lowlevellibsandfws/pluginfw/Test_Bed/DefaultLogOutputTest/DefaultLogOutputTest.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 CDefaultLogOutput 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 "DefaultLogOutputUnitTest.h"
       
    22 #include "ComponentTester.h"
       
    23 
       
    24 RTest test(_L("DefaultLogOutputTest.cpp"));
       
    25 
       
    26 // ______________________________________________________________________________
       
    27 //
       
    28 /**
       
    29 	@internalComponent
       
    30 
       
    31 	Comments : Test the CDefaultLogOutput class.
       
    32  */
       
    33 class CDefaultLogOutput_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			CDefaultLogOutput_ComponentTest* The constructed object.
       
    47 		@pre 			None.
       
    48 		@post			CDefaultLogOutput_ComponentTest is fully constructed.
       
    49 	*/
       
    50 	static CDefaultLogOutput_ComponentTest* NewLC(CDataLogger& aDataLogger,
       
    51 							MComponentTestObserver& aObserver);
       
    52 
       
    53 private:
       
    54 	/**
       
    55 		@fn				CDefaultLogOutput_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			CDefaultLogOutput_ComponentTest is fully constructed.
       
    64 	*/
       
    65 	inline CDefaultLogOutput_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 			CDefaultLogOutput_ComponentTest is fully constructed.
       
    76 		@post			CDefaultLogOutput_ComponentTest is fully initialised.
       
    77 	*/
       
    78 	inline void ConstructL();
       
    79 
       
    80 	};	// CDefaultLogOutput_ComponentTest
       
    81 
       
    82 // ______________________________________________________________________________
       
    83 //
       
    84 inline CDefaultLogOutput_ComponentTest* CDefaultLogOutput_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
       
    85 	{
       
    86 	CDefaultLogOutput_ComponentTest* self = new (ELeave) CDefaultLogOutput_ComponentTest(aDataLogger, aObserver);
       
    87 	CleanupStack::PushL(self);
       
    88 	self->ConstructL();
       
    89 	return self;
       
    90 	}
       
    91 
       
    92 inline CDefaultLogOutput_ComponentTest::CDefaultLogOutput_ComponentTest(CDataLogger& aDataLogger,
       
    93 									MComponentTestObserver& aObserver)
       
    94 : CComponentTester(aDataLogger, aObserver)
       
    95 	{
       
    96 	// Do nothing here.
       
    97 	}
       
    98 
       
    99 /**
       
   100 @SYMTestCaseID          SYSLIB-ECOM-CT-0777
       
   101 @SYMTestCaseDesc	    Tests for the implementations of CDefaultLogOutput class
       
   102 @SYMTestPriority 	    High
       
   103 @SYMTestActions  	    Tests for the open and close,create and destroy,write and close operations
       
   104 @SYMTestExpectedResults Test must not fail
       
   105 @SYMREQ                 REQ0000
       
   106 */
       
   107 inline void CDefaultLogOutput_ComponentTest::ConstructL()
       
   108 	{
       
   109 	// Perform base class initialization
       
   110 	ComponentTesterConstructL();
       
   111 
       
   112 	AddUnitTestL(CDefaultLogOutput_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
       
   113 	AddUnitTestL(CDefaultLogOutput_OpenAndClose_UnitTest::NewL(iDataLogger, *this));
       
   114 	AddUnitTestL(CDefaultLogOutput_OpenWriteClose_UnitTest::NewL(iDataLogger, *this));
       
   115 	}
       
   116 
       
   117 // ______________________________________________________________________________
       
   118 //
       
   119 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
       
   120 									MComponentTestObserver&	aComponentTestObserver)
       
   121 	{
       
   122 	return CDefaultLogOutput_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
       
   123 	}
       
   124 
       
   125 // ___________________________________________________________________________
       
   126 //
       
   127 // This section of the module simply includes the exported test harness template which
       
   128 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP
       
   129 // project file can then produce a EXE for the test project instead of a DLL.
       
   130 
       
   131 #include <ecom/test_bed/testharnesstemplate.h>
       
   132 
       
   133 GLDEF_C TInt E32Main()
       
   134     {
       
   135 	test.Title();
       
   136 	test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0777 "));
       
   137 
       
   138 	test.End();
       
   139 	test.Close();
       
   140 
       
   141 	return E32Main_TestHarness(NewComponentTestLC);
       
   142 	}