|
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 // The unit test class definitions for the CComponentTester class. |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __COMPONENTTESTERUNITTEST_H__ |
|
19 #define __COMPONENTTESTERUNITTEST_H__ |
|
20 |
|
21 #include <ecom/test_bed/testbeddefinitions.h> |
|
22 #include "ComponentTesterStateAccessor.h" |
|
23 #include "ComponentTesterTransitionValidation.h" |
|
24 #include "ComponentTesterTransitions.h" |
|
25 |
|
26 // ______________________________________________________________________________ |
|
27 // |
|
28 /** |
|
29 @internalComponent |
|
30 |
|
31 Comments : Unit Test for CreateAndDestroy on CComponentTester, the class under test. |
|
32 */ |
|
33 class CComponentTester_CreateAndDestroy_UnitTest : public CUnitTest |
|
34 { |
|
35 public: |
|
36 /** |
|
37 @fn NewL(CDataLogger& aDataLogger, |
|
38 MUnitTestObserver& 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 UnitTest. |
|
46 @return CComponentTester_CreateAndDestroy_UnitTest* The constructed object. |
|
47 @pre None. |
|
48 @post CComponentTester_CreateAndDestroy_UnitTest is fully constructed, and initialised. |
|
49 */ |
|
50 static CComponentTester_CreateAndDestroy_UnitTest* NewL(CDataLogger& aDataLogger, |
|
51 MUnitTestObserver& aObserver); |
|
52 |
|
53 /** |
|
54 @fn RunError(TInt aError) |
|
55 Intended Usage : Intercept the panic caused by a RunL leave, |
|
56 to restore the CComponentTester_CreateAndDestroy_UnitTest |
|
57 object to a sensible state. |
|
58 (called by the Active Scheduler immediately before the Panic). |
|
59 Error Condition : @see CUnitTest::RunError(). |
|
60 @since 7.0 |
|
61 @return TInt KErrNone if cleanup successful, otherwise |
|
62 @see CUnitTest::RunError() |
|
63 @pre CComponentTester_CreateAndDestroy_UnitTest is fully constructed, and initialised. |
|
64 @post The object has been restored to a sensible state. |
|
65 */ |
|
66 inline TInt RunError(TInt aError); |
|
67 |
|
68 /** |
|
69 @fn ~CComponentTester_CreateAndDestroy_UnitTest() |
|
70 Intended Usage : Standard Destructor. |
|
71 Error Condition : None. |
|
72 @since 7.0 |
|
73 @pre CComponentTester_CreateAndDestroy_UnitTest is fully constructed. |
|
74 @post CComponentTester_CreateAndDestroy_UnitTest is fully destroyed. |
|
75 */ |
|
76 ~CComponentTester_CreateAndDestroy_UnitTest(); |
|
77 |
|
78 private: |
|
79 /** |
|
80 @fn CComponentTester_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger, |
|
81 MUnitTestObserver& aObserver) |
|
82 Intended Usage : Default constructor. |
|
83 Error Condition : None. |
|
84 @since 7.0 |
|
85 @param aDataLogger The output logging object. |
|
86 @param aObserver The observer of this UnitTest. |
|
87 @param aStateAccessor WhiteBox state access to the CComponentTester class. |
|
88 @pre None. |
|
89 @post CComponentTester_CreateAndDestroy_UnitTest is fully constructed. |
|
90 */ |
|
91 inline CComponentTester_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger, |
|
92 MUnitTestObserver& aObserver); |
|
93 |
|
94 /** |
|
95 @fn void ConstructL() |
|
96 Intended Usage : Second phase of safe two phase construction, |
|
97 to complete the object initialisation. |
|
98 Error Condition : Leaves with an error code. |
|
99 @leave KErrNoMemory, and @see CUnitTest::BaseNewL(). |
|
100 @since 7.0 |
|
101 @return None |
|
102 @pre CComponentTester_CreateAndDestroy_UnitTest is fully constructed. |
|
103 @post CComponentTester_CreateAndDestroy_UnitTest is fully initialised. |
|
104 */ |
|
105 void ConstructL(); |
|
106 |
|
107 /** |
|
108 The context of the Unit Test. |
|
109 i.e The CComponentTester class tested by this UnitTest's transitions. |
|
110 */ |
|
111 CComponentTester_UnitTestContext* iUTContext; |
|
112 TComponentTester_StateAccessor* iStateAccessor; |
|
113 // C'tor, d'tor, and method transition validators |
|
114 TComponentTester_Ctor_TransitionValidator* iCtorValidator; |
|
115 TComponentTester_Dtor_TransitionValidator* iDtorValidator; |
|
116 }; // CComponentTester_CreateAndDestroy_UnitTest |
|
117 |
|
118 // ______________________________________________________________________________ |
|
119 // |
|
120 /** |
|
121 @internalComponent |
|
122 |
|
123 Comments : Unit Test for ManageUnitTests on CComponentTester, the class under test. |
|
124 */ |
|
125 class CComponentTester_ManageUnitTests_UnitTest : public CUnitTest |
|
126 { |
|
127 public: |
|
128 /** |
|
129 @fn NewL(CDataLogger& aDataLogger, |
|
130 MUnitTestObserver& aObserver) |
|
131 Intended Usage : Standard two-phase construction which leaves nothing on the |
|
132 cleanup stack. |
|
133 Error Condition : Leaves with the error code. |
|
134 @leave KErrNoMemory |
|
135 @since 7.0 |
|
136 @param aDataLogger The output logging object. |
|
137 @param aObserver The observer of this UnitTest. |
|
138 @return CComponentTester_ManageUnitTests_UnitTest* The constructed object. |
|
139 @pre None. |
|
140 @post CComponentTester_ManageUnitTests_UnitTest is fully constructed, and initialised. |
|
141 */ |
|
142 static CComponentTester_ManageUnitTests_UnitTest* NewL(CDataLogger& aDataLogger, |
|
143 MUnitTestObserver& aObserver); |
|
144 |
|
145 /** |
|
146 @fn RunError(TInt aError) |
|
147 Intended Usage : Intercept the panic caused by a RunL leave, |
|
148 to restore the CComponentTester_ManageUnitTests_UnitTest |
|
149 object to a sensible state. |
|
150 (called by the Active Scheduler immediately before the Panic). |
|
151 Error Condition : @see CUnitTest::RunError(). |
|
152 @since 7.0 |
|
153 @return TInt KErrNone if cleanup successful, otherwise |
|
154 @see CUnitTest::RunError() |
|
155 @pre CComponentTester_ManageUnitTests_UnitTest is fully constructed, and initialised. |
|
156 @post The object has been restored to a sensible state. |
|
157 */ |
|
158 inline TInt RunError(TInt aError); |
|
159 |
|
160 /** |
|
161 @fn ~CComponentTester_ManageUnitTests_UnitTest() |
|
162 Intended Usage : Standard Destructor. |
|
163 Error Condition : None. |
|
164 @since 7.0 |
|
165 @pre CComponentTester_ManageUnitTests_UnitTest is fully constructed. |
|
166 @post CComponentTester_ManageUnitTests_UnitTest is fully destroyed. |
|
167 */ |
|
168 ~CComponentTester_ManageUnitTests_UnitTest(); |
|
169 |
|
170 private: |
|
171 /** |
|
172 @fn CComponentTester_ManageUnitTests_UnitTest(CDataLogger& aDataLogger, |
|
173 MUnitTestObserver& aObserver) |
|
174 Intended Usage : Default constructor. |
|
175 Error Condition : None. |
|
176 @since 7.0 |
|
177 @param aDataLogger The output logging object. |
|
178 @param aObserver The observer of this UnitTest. |
|
179 @param aStateAccessor WhiteBox state access to the CComponentTester class. |
|
180 @pre None. |
|
181 @post CComponentTester_ManageUnitTests_UnitTest is fully constructed. |
|
182 */ |
|
183 inline CComponentTester_ManageUnitTests_UnitTest(CDataLogger& aDataLogger, |
|
184 MUnitTestObserver& aObserver); |
|
185 |
|
186 /** |
|
187 @fn void ConstructL() |
|
188 Intended Usage : Second phase of safe two phase construction, |
|
189 to complete the object initialisation. |
|
190 Error Condition : Leaves with an error code. |
|
191 @leave KErrNoMemory, and @see CUnitTest::BaseNewL(). |
|
192 @since 7.0 |
|
193 @return None |
|
194 @pre CComponentTester_ManageUnitTests_UnitTest is fully constructed. |
|
195 @post CComponentTester_ManageUnitTests_UnitTest is fully initialised. |
|
196 */ |
|
197 void ConstructL(); |
|
198 |
|
199 /** |
|
200 The context of the Unit Test. |
|
201 i.e The CComponentTester class tested by this UnitTest's transitions. |
|
202 */ |
|
203 CComponentTester_UnitTestContext* iUTContext; |
|
204 TComponentTester_StateAccessor* iStateAccessor; |
|
205 // C'tor, d'tor, and method transition validators |
|
206 TComponentTester_Ctor_TransitionValidator* iCtorValidator; |
|
207 TComponentTester_TransitionSets_TransitionValidator* iTransitionSetsValidator; |
|
208 TComponentTester_AddUnitTest_TransitionValidator* iAddUnitTestValidator; |
|
209 TComponentTester_AddParamUnitTest_TransitionValidator* iAddParamUnitTestValidator; |
|
210 TComponentTester_Dtor_TransitionValidator* iDtorValidator; |
|
211 }; // CComponentTester_ManageUnitTests_UnitTest |
|
212 |
|
213 // ______________________________________________________________________________ |
|
214 // |
|
215 /** |
|
216 @internalComponent |
|
217 |
|
218 Comments : Unit Test for RunTests on CComponentTester, the class under test. |
|
219 */ |
|
220 class CComponentTester_RunTests_UnitTest : public CUnitTest |
|
221 { |
|
222 public: |
|
223 /** |
|
224 @fn NewL(CDataLogger& aDataLogger, |
|
225 MUnitTestObserver& aObserver) |
|
226 Intended Usage : Standard two-phase construction which leaves nothing on the |
|
227 cleanup stack. |
|
228 Error Condition : Leaves with the error code. |
|
229 @leave KErrNoMemory |
|
230 @since 7.0 |
|
231 @param aDataLogger The output logging object. |
|
232 @param aObserver The observer of this UnitTest. |
|
233 @return CComponentTester_RunTests_UnitTest* The constructed object. |
|
234 @pre None. |
|
235 @post CComponentTester_RunTests_UnitTest is fully constructed, and initialised. |
|
236 */ |
|
237 static CComponentTester_RunTests_UnitTest* NewL(CDataLogger& aDataLogger, |
|
238 MUnitTestObserver& aObserver); |
|
239 |
|
240 /** |
|
241 @fn RunError(TInt aError) |
|
242 Intended Usage : Intercept the panic caused by a RunL leave, |
|
243 to restore the CComponentTester_RunTests_UnitTest |
|
244 object to a sensible state. |
|
245 (called by the Active Scheduler immediately before the Panic). |
|
246 Error Condition : @see CUnitTest::RunError(). |
|
247 @since 7.0 |
|
248 @return TInt KErrNone if cleanup successful, otherwise |
|
249 @see CUnitTest::RunError() |
|
250 @pre CComponentTester_RunTests_UnitTest is fully constructed, and initialised. |
|
251 @post The object has been restored to a sensible state. |
|
252 */ |
|
253 inline TInt RunError(TInt aError); |
|
254 |
|
255 /** |
|
256 @fn ~CComponentTester_RunTests_UnitTest() |
|
257 Intended Usage : Standard Destructor. |
|
258 Error Condition : None. |
|
259 @since 7.0 |
|
260 @pre CComponentTester_RunTests_UnitTest is fully constructed. |
|
261 @post CComponentTester_RunTests_UnitTest is fully destroyed. |
|
262 */ |
|
263 ~CComponentTester_RunTests_UnitTest(); |
|
264 |
|
265 private: |
|
266 /** |
|
267 @fn CComponentTester_RunTests_UnitTest(CDataLogger& aDataLogger, |
|
268 MUnitTestObserver& aObserver) |
|
269 Intended Usage : Default constructor. |
|
270 Error Condition : None. |
|
271 @since 7.0 |
|
272 @param aDataLogger The output logging object. |
|
273 @param aObserver The observer of this UnitTest. |
|
274 @param aStateAccessor WhiteBox state access to the CComponentTester class. |
|
275 @pre None. |
|
276 @post CComponentTester_RunTests_UnitTest is fully constructed. |
|
277 */ |
|
278 inline CComponentTester_RunTests_UnitTest(CDataLogger& aDataLogger, |
|
279 MUnitTestObserver& aObserver); |
|
280 |
|
281 /** |
|
282 @fn void ConstructL() |
|
283 Intended Usage : Second phase of safe two phase construction, |
|
284 to complete the object initialisation. |
|
285 Error Condition : Leaves with an error code. |
|
286 @leave KErrNoMemory, and @see CUnitTest::BaseNewL(). |
|
287 @since 7.0 |
|
288 @return None |
|
289 @pre CComponentTester_RunTests_UnitTest is fully constructed. |
|
290 @post CComponentTester_RunTests_UnitTest is fully initialised. |
|
291 */ |
|
292 void ConstructL(); |
|
293 |
|
294 /** |
|
295 The context of the Unit Test. |
|
296 i.e The CComponentTester class tested by this UnitTest's transitions. |
|
297 */ |
|
298 CComponentTester_UnitTestContext* iUTContext; |
|
299 TComponentTester_StateAccessor* iStateAccessor; |
|
300 // C'tor, d'tor, and method transition validators |
|
301 TComponentTester_Ctor_TransitionValidator* iCtorValidator; |
|
302 TComponentTester_TestComponent_TransitionValidator* iTestComponentValidator; |
|
303 TComponentTester_Run_TransitionValidator* iRunValidator; |
|
304 TComponentTester_Complete_TransitionValidator* iCompleteValidator; |
|
305 TComponentTester_Dtor_TransitionValidator* iDtorValidator; |
|
306 }; // CComponentTester_RunTests_UnitTest |
|
307 |
|
308 |
|
309 #endif // __COMPONENTTESTERUNITTEST_H__ |