|
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 CTestManager 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 "TestManagerUnitTest.h" |
|
22 #include "ComponentTester.h" |
|
23 |
|
24 RTest test(_L("TestManagerTest.cpp")); |
|
25 |
|
26 // ______________________________________________________________________________ |
|
27 // |
|
28 /** |
|
29 @internalComponent |
|
30 |
|
31 Comments : Test the CTestManager class. |
|
32 */ |
|
33 class CTestManager_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 6.0 |
|
44 @param aDataLogger The output logging object. |
|
45 @param aObserver The observer of this component test. |
|
46 @return CTestManager_ComponentTest* The constructed object. |
|
47 @pre None. |
|
48 @post CTestManager_ComponentTest is fully constructed. |
|
49 */ |
|
50 static CTestManager_ComponentTest* NewLC(CDataLogger& aDataLogger, |
|
51 MComponentTestObserver& aObserver); |
|
52 |
|
53 private: |
|
54 /** |
|
55 @fn CTestManager_ComponentTest(CDataLogger& aDataLogger, |
|
56 MComponentTestObserver& aObserver) |
|
57 Intended Usage : Standard c'tor method. |
|
58 Error Condition : None. |
|
59 @since 6.0 |
|
60 @param aDataLogger The logging object. |
|
61 @param aObserver The observer of this component test. |
|
62 @pre None. |
|
63 @post CTestManager_ComponentTest is fully constructed. |
|
64 */ |
|
65 inline CTestManager_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 6.0 |
|
74 @return None |
|
75 @pre CTestManager_ComponentTest is fully constructed. |
|
76 @post CTestManager_ComponentTest is fully initialised. |
|
77 */ |
|
78 inline void ConstructL(); |
|
79 |
|
80 }; // CTestManager_ComponentTest |
|
81 |
|
82 // ______________________________________________________________________________ |
|
83 // |
|
84 inline CTestManager_ComponentTest* CTestManager_ComponentTest::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver) |
|
85 { |
|
86 CTestManager_ComponentTest* self = new (ELeave) CTestManager_ComponentTest(aDataLogger, aObserver); |
|
87 CleanupStack::PushL(self); |
|
88 self->ConstructL(); |
|
89 return self; |
|
90 } |
|
91 |
|
92 inline CTestManager_ComponentTest::CTestManager_ComponentTest(CDataLogger& aDataLogger, |
|
93 MComponentTestObserver& aObserver) |
|
94 : CComponentTester(aDataLogger, aObserver) |
|
95 { |
|
96 // Do nothing here. |
|
97 } |
|
98 |
|
99 inline void CTestManager_ComponentTest::ConstructL() |
|
100 { |
|
101 // Perform base class initialization |
|
102 ComponentTesterConstructL(); |
|
103 |
|
104 AddUnitTestL(CTestManager_CreateAndDestroy_UnitTest::NewL(iDataLogger, *this)); |
|
105 AddUnitTestL(CTestManager_ManageTests_UnitTest::NewL(iDataLogger, *this)); |
|
106 } |
|
107 |
|
108 // ______________________________________________________________________________ |
|
109 // |
|
110 EXPORT_C CComponentTester* NewComponentTestLC(CDataLogger& aDataLogger, |
|
111 MComponentTestObserver& aComponentTestObserver) |
|
112 { |
|
113 return CTestManager_ComponentTest::NewLC(aDataLogger, aComponentTestObserver); |
|
114 } |
|
115 |
|
116 // ______________________________________________________________________________ |
|
117 // |
|
118 class CTestManager_ComponentTest_STUB : public CComponentTester |
|
119 { |
|
120 public: |
|
121 static CTestManager_ComponentTest_STUB* NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver); |
|
122 |
|
123 private: |
|
124 inline CTestManager_ComponentTest_STUB(CDataLogger& aDataLogger, MComponentTestObserver& aObserver); |
|
125 inline void ConstructL(); |
|
126 }; |
|
127 |
|
128 // ______________________________________________________________________________ |
|
129 // |
|
130 inline CTestManager_ComponentTest_STUB* CTestManager_ComponentTest_STUB::NewLC(CDataLogger& aDataLogger, MComponentTestObserver& aObserver) |
|
131 { |
|
132 CTestManager_ComponentTest_STUB* self = new (ELeave) CTestManager_ComponentTest_STUB(aDataLogger, aObserver); |
|
133 CleanupStack::PushL(self); |
|
134 self->ConstructL(); |
|
135 return self; |
|
136 } |
|
137 |
|
138 inline CTestManager_ComponentTest_STUB::CTestManager_ComponentTest_STUB(CDataLogger& aDataLogger, |
|
139 MComponentTestObserver& aObserver) |
|
140 : CComponentTester(aDataLogger, aObserver) |
|
141 { |
|
142 // Do nothing here. |
|
143 } |
|
144 |
|
145 /** |
|
146 @SYMTestCaseID SYSLIB-ECOM-CT-0781 |
|
147 @SYMTestCaseDesc Tests for the implementations of CTestManager class |
|
148 @SYMTestPriority High |
|
149 @SYMTestActions Tests for create and destroy operations |
|
150 @SYMTestExpectedResults Test must not fail |
|
151 @SYMREQ REQ0000 |
|
152 */ |
|
153 inline void CTestManager_ComponentTest_STUB::ConstructL() |
|
154 { |
|
155 // Perform base class initialization |
|
156 ComponentTesterConstructL(); |
|
157 |
|
158 AddUnitTestL(CTestManager_CreateAndDestroy_UnitTest_STUB::NewL(iDataLogger, *this)); |
|
159 } |
|
160 |
|
161 // ______________________________________________________________________________ |
|
162 // |
|
163 EXPORT_C CComponentTester* NewComponentTestLC_STUB(CDataLogger& aDataLogger, |
|
164 MComponentTestObserver& aComponentTestObserver) |
|
165 { |
|
166 return CTestManager_ComponentTest_STUB::NewLC(aDataLogger, aComponentTestObserver); |
|
167 } |
|
168 |
|
169 // ___________________________________________________________________________ |
|
170 // |
|
171 // This section of the module simply includes the exported test harness template which |
|
172 // makes this a "whole" CPP file with a E32Main entry point below. The test MMP |
|
173 // project file can then produce a EXE for the test project instead of a DLL. |
|
174 |
|
175 #include <ecom/test_bed/testharnesstemplate.h> |
|
176 |
|
177 GLDEF_C TInt E32Main() |
|
178 { |
|
179 test.Title(); |
|
180 test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0781 ")); |
|
181 |
|
182 test.End(); |
|
183 test.Close(); |
|
184 |
|
185 return E32Main_TestHarness(NewComponentTestLC); |
|
186 } |
|
187 |