os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestControllerTest/TestControllerTest.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/TestControllerTest/TestControllerTest.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,182 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Demonstrates a simple set of derived class implementations to
1.18 +// test the CTestController class using the test bed.
1.19 +// It may be used as a basis to develop a full test bed dll.
1.20 +// For support and comment please contact the authors.
1.21 +//
1.22 +//
1.23 +
1.24 +#include "TestControllerUnitTest.h"
1.25 +#include "ComponentTester.h"
1.26 +
1.27 +
1.28 +// ______________________________________________________________________________
1.29 +//
1.30 +/**
1.31 + @internalComponent
1.32 +
1.33 + Comments : Test the CTestController class.
1.34 + */
1.35 +class CTestController_ComponentTest : public CComponentTester
1.36 + {
1.37 +public:
1.38 + /**
1.39 + @fn NewLC(CDataLogger& aDataLogger,
1.40 + MComponentTestObserver& aObserver)
1.41 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.42 + cleanup stack.
1.43 + Error Condition : Leaves with the error code.
1.44 + @leave KErrNoMemory
1.45 + @since 7.0
1.46 + @param aDataLogger The output logging object.
1.47 + @param aObserver The observer of this component test.
1.48 + @return CTestController_ComponentTest* The constructed object.
1.49 + @pre None.
1.50 + @post CTestController_ComponentTest is fully constructed.
1.51 + */
1.52 + static CTestController_ComponentTest* NewLC(CDataLogger& aDataLogger,
1.53 + MComponentTestObserver& aObserver);
1.54 +
1.55 +private:
1.56 + /**
1.57 + @fn CTestController_ComponentTest(CDataLogger& aDataLogger,
1.58 + MComponentTestObserver& aObserver)
1.59 + Intended Usage : Standard c'tor method.
1.60 + Error Condition : None.
1.61 + @since 7.0
1.62 + @param aDataLogger The logging object.
1.63 + @param aObserver The observer of this component test.
1.64 + @pre None.
1.65 + @post CTestController_ComponentTest is fully constructed.
1.66 + */
1.67 + inline CTestController_ComponentTest(CDataLogger& aDataLogger,
1.68 + MComponentTestObserver& aObserver);
1.69 + /**
1.70 + @fn void ConstructL()
1.71 + Intended Usage : Second phase of safe two phase construction,
1.72 + to complete the object initialisation.
1.73 + Error Condition : Leaves with an error code.
1.74 + @leave KErrNoMemory.
1.75 + @since 7.0
1.76 + @return None
1.77 + @pre CTestController_ComponentTest is fully constructed.
1.78 + @post CTestController_ComponentTest is fully initialised.
1.79 + */
1.80 + inline void ConstructL();
1.81 +
1.82 + }; // CTestController_ComponentTest
1.83 +
1.84 +// ______________________________________________________________________________
1.85 +//
1.86 +inline CTestController_ComponentTest* CTestController_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
1.87 + {
1.88 + CTestController_ComponentTest* self = new (ELeave) CTestController_ComponentTest(aDataLogger, aObserver);
1.89 + CleanupStack::PushL(self);
1.90 + self->ConstructL();
1.91 + return self;
1.92 + }
1.93 +
1.94 +inline CTestController_ComponentTest::CTestController_ComponentTest(CDataLogger& aDataLogger,
1.95 + MComponentTestObserver& aObserver)
1.96 +: CComponentTester(aDataLogger, aObserver)
1.97 + {
1.98 + // Do nothing here.
1.99 + }
1.100 +
1.101 +inline void CTestController_ComponentTest::ConstructL()
1.102 + {
1.103 + // Perform base class initialization
1.104 + ComponentTesterConstructL();
1.105 +
1.106 + AddUnitTestL(CTestController_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
1.107 + AddUnitTestL(CTestController_FindTests_UnitTest::NewL(iDataLogger, *this));
1.108 + }
1.109 +
1.110 +// ______________________________________________________________________________
1.111 +//
1.112 +EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
1.113 + MComponentTestObserver& aComponentTestObserver)
1.114 + {
1.115 + return CTestController_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
1.116 + }
1.117 +
1.118 +
1.119 +// ___________________________________________________________________________
1.120 +//
1.121 +// This section of the module simply includes the exported test harness template which
1.122 +// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
1.123 +// project file can then produce a EXE for the test project instead of a DLL.
1.124 +
1.125 +#include <ecom/test_bed/testharnesstemplate.h>
1.126 +
1.127 +GLDEF_C TInt E32Main()
1.128 + {
1.129 + return E32Main_TestHarness(NewComponentTestLC);
1.130 + }
1.131 +
1.132 +// ______________________________________________________________________________
1.133 +//
1.134 +class CTestController_ComponentTest_STUB : public CComponentTester
1.135 + {
1.136 +public:
1.137 + static CTestController_ComponentTest_STUB* NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
1.138 +
1.139 +private:
1.140 + inline CTestController_ComponentTest_STUB(CDataLogger& aDataLogger, MComponentTestObserver& aObserver);
1.141 + inline void ConstructL();
1.142 + };
1.143 +
1.144 +// ______________________________________________________________________________
1.145 +//
1.146 +inline CTestController_ComponentTest_STUB* CTestController_ComponentTest_STUB::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
1.147 + {
1.148 + CTestController_ComponentTest_STUB* self = new (ELeave) CTestController_ComponentTest_STUB(aDataLogger, aObserver);
1.149 + CleanupStack::PushL(self);
1.150 + self->ConstructL();
1.151 + return self;
1.152 + }
1.153 +
1.154 +inline CTestController_ComponentTest_STUB::CTestController_ComponentTest_STUB(CDataLogger& aDataLogger,
1.155 + MComponentTestObserver& aObserver)
1.156 +: CComponentTester(aDataLogger, aObserver)
1.157 + {
1.158 + // Do nothing here.
1.159 + }
1.160 +
1.161 +/**
1.162 +@SYMTestCaseID SYSLIB-ECOM-CT-0780
1.163 +@SYMTestCaseDesc Tests for the implementations of CTransition class
1.164 +@SYMTestPriority High
1.165 +@SYMTestActions Tests for create and destroy,asynchronous,transit method operations
1.166 +@SYMTestExpectedResults Test must not fail
1.167 +@SYMREQ REQ0000
1.168 +*/
1.169 +inline void CTestController_ComponentTest_STUB::ConstructL()
1.170 + {
1.171 + // Perform base class initialization
1.172 + ComponentTesterConstructL();
1.173 +
1.174 + AddUnitTestL(CTestController_CreateAndDestroy_UnitTest_STUB::NewL(iDataLogger, *this));
1.175 + }
1.176 +
1.177 +// ______________________________________________________________________________
1.178 +//
1.179 +EXPORT_C CComponentTester* NewComponentTestLC_STUB(CDataLogger& aDataLogger,
1.180 + MComponentTestObserver& aComponentTestObserver)
1.181 + {
1.182 +
1.183 + return CTestController_ComponentTest_STUB::NewLC(aDataLogger, aComponentTestObserver);
1.184 + }
1.185 +