os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/ComponentInfoTest/ComponentInfoTest.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Test_Bed/ComponentInfoTest/ComponentInfoTest.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,131 @@
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 +// Set of implementations to test the CComponentInfo class using the test bed.
1.18 +//
1.19 +//
1.20 +
1.21 +#include "ComponentInfoUnitTest.h"
1.22 +#include "ComponentTester.h"
1.23 +
1.24 +// ______________________________________________________________________________
1.25 +//
1.26 +/**
1.27 + @internalComponent
1.28 +
1.29 + Comments : Test the CComponentInfo class.
1.30 + */
1.31 +class CComponentInfo_ComponentTest : public CComponentTester
1.32 + {
1.33 +public:
1.34 + /**
1.35 + @fn NewLC(CDataLogger& aDataLogger,
1.36 + MComponentTestObserver& aObserver)
1.37 + Intended Usage : Standard two-phase construction which leaves nothing on the
1.38 + cleanup stack.
1.39 + Error Condition : Leaves with the error code.
1.40 + @leave KErrNoMemory
1.41 + @since 7.0
1.42 + @param aDataLogger The output logging object.
1.43 + @param aObserver The observer of this component test.
1.44 + @return CComponentInfo_ComponentTest* The constructed object.
1.45 + @pre None.
1.46 + @post CComponentInfo_ComponentTest is fully constructed and initialised.
1.47 + */
1.48 + static CComponentInfo_ComponentTest* NewLC(CDataLogger& aDataLogger,
1.49 + MComponentTestObserver& aObserver);
1.50 +
1.51 +private:
1.52 + /**
1.53 + @fn CComponentInfo_ComponentTest(CDataLogger& aDataLogger,
1.54 + MComponentTestObserver& aObserver)
1.55 + Intended Usage : Standard constructor method.
1.56 + Error Condition : None.
1.57 + @since 7.0
1.58 + @param aDataLogger The logging object.
1.59 + @param aObserver The observer of this component test.
1.60 + @pre None.
1.61 + @post CComponentInfo_ComponentTest is fully constructed.
1.62 + */
1.63 + inline CComponentInfo_ComponentTest(CDataLogger& aDataLogger,
1.64 + MComponentTestObserver& aObserver);
1.65 + /**
1.66 + @fn void ConstructL()
1.67 + Intended Usage : Second phase of safe two phase construction,
1.68 + to complete the object initialisation.
1.69 + Error Condition : Leaves with an error code.
1.70 + @leave KErrNoMemory.
1.71 + @since 7.0
1.72 + @return None
1.73 + @pre CComponentInfo_ComponentTest is fully constructed.
1.74 + @post CComponentInfo_ComponentTest is fully initialised.
1.75 + */
1.76 + inline void ConstructL();
1.77 +
1.78 + }; // CComponentInfo_ComponentTest
1.79 +
1.80 +// ______________________________________________________________________________
1.81 +//
1.82 +inline CComponentInfo_ComponentTest* CComponentInfo_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver)
1.83 + {
1.84 + CComponentInfo_ComponentTest* self = new (ELeave) CComponentInfo_ComponentTest(aDataLogger, aObserver);
1.85 + CleanupStack::PushL(self);
1.86 + self->ConstructL();
1.87 + return self;
1.88 + }
1.89 +
1.90 +inline CComponentInfo_ComponentTest::CComponentInfo_ComponentTest(CDataLogger& aDataLogger,
1.91 + MComponentTestObserver& aObserver)
1.92 +: CComponentTester(aDataLogger, aObserver)
1.93 + {
1.94 + // Do nothing here.
1.95 + }
1.96 +
1.97 +/**
1.98 +@SYMTestCaseID SYSLIB-ECOM-CT-0774
1.99 +@SYMTestCaseDesc Tests for implementations of CComponentInfo class
1.100 +@SYMTestPriority High
1.101 +@SYMTestActions Component tests for CComponentInfo class
1.102 +@SYMTestExpectedResults Test must not fail CComponentInfo class
1.103 +@SYMREQ REQ0000
1.104 +*/
1.105 +inline void CComponentInfo_ComponentTest::ConstructL()
1.106 + {
1.107 + // Perform base class initialization
1.108 + ComponentTesterConstructL();
1.109 +
1.110 + AddUnitTestL(CComponentInfo_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this));
1.111 + AddUnitTestL(CComponentInfo_RetrieveTestNames_UnitTest::NewL(iDataLogger, *this));
1.112 + }
1.113 +
1.114 +// ______________________________________________________________________________
1.115 +//
1.116 +EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger,
1.117 + MComponentTestObserver& aComponentTestObserver)
1.118 + {
1.119 + return CComponentInfo_ComponentTest::NewLC(aDataLogger, aComponentTestObserver);
1.120 + }
1.121 +
1.122 +// ___________________________________________________________________________
1.123 +//
1.124 +// This section of the module simply includes the exported test harness template which
1.125 +// makes this a "whole" CPP file with a E32Main entry point below. The test MMP
1.126 +// project file can then produce a EXE for the test project instead of a DLL.
1.127 +
1.128 +#include <ecom/test_bed/testharnesstemplate.h>
1.129 +
1.130 +GLDEF_C TInt E32Main()
1.131 + {
1.132 + return E32Main_TestHarness(NewComponentTestLC);
1.133 + }
1.134 +