|
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 definitions of the transition classes upon the CComponentTester class methods. |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __COMPONENTTESTERTRANSITIONS_H__ |
|
19 #define __COMPONENTTESTERTRANSITIONS_H__ |
|
20 |
|
21 #include "TestUtilities.h" |
|
22 #include "StateAccessor.h" |
|
23 #include "LeakTestTransition.h" |
|
24 #include <ecom/test_bed/datalogger.h> |
|
25 #include "ComponentTester.h" |
|
26 #include "ComponentTesterStateAccessor.h" |
|
27 #include <ecom/test_bed/unittest.h> |
|
28 |
|
29 #define CTransitionType CLeakTestTransition |
|
30 |
|
31 // ______________________________________________________________________________ |
|
32 // |
|
33 /** |
|
34 @internalComponent |
|
35 |
|
36 Comments : Provide all the CComponentTester specific |
|
37 parameters and behaviour on the CComponentTester |
|
38 test class for a transition. |
|
39 */ |
|
40 class CComponentTester_UnitTestContext : public CUnitTestContext |
|
41 { |
|
42 public: |
|
43 /** |
|
44 @fn CComponentTester_UnitTestContext(CDataLogger& aDataLogger, |
|
45 MStateAccessor& aStateAccessor, |
|
46 MTransitionObserver& aObserver) |
|
47 Intended Usage : Default constructor. |
|
48 Error Condition : None. |
|
49 @since 7.0 |
|
50 @param aDataLogger The output logging object. |
|
51 @param aObserver The observer of this UnitTest's Transitions. |
|
52 @param aStateAccessor WhiteBox state access to the CComponentTester class under test. |
|
53 @pre None. |
|
54 @post CComponentTester_UnitTestContext is fully constructed, and initialised. |
|
55 */ |
|
56 inline CComponentTester_UnitTestContext(CDataLogger& aDataLogger, |
|
57 MStateAccessor& aStateAccessor, |
|
58 MTransitionObserver& aObserver); |
|
59 |
|
60 /** |
|
61 @fn ~CComponentTester_UnitTestContext() |
|
62 Intended Usage : Default Destructor |
|
63 @since 7.0 |
|
64 @pre CComponentTester_UnitTestContext is fully constructed. |
|
65 @post CComponentTester_UnitTestContext is fully destroyed |
|
66 */ |
|
67 virtual inline ~CComponentTester_UnitTestContext(); |
|
68 |
|
69 /** The instance of the class under test */ |
|
70 CComponentTester* iComponentTester; |
|
71 /** The data logger for the ComponentTester to use */ |
|
72 CDataLogger* iDataLogger; |
|
73 /** An observer to inform when the test has been completed */ |
|
74 MComponentTestObserver* iObserver; |
|
75 /** The unit test for the ComponentTester to use */ |
|
76 CUnitTest* iUnitTest; |
|
77 /** An array of the tests to be run by ComponentTester */ |
|
78 RPointerArray<TTestInfo> iTests; |
|
79 /** A class derived from the class under test */ |
|
80 CComponentTesterTestDerivation* iComponentUnderTest; |
|
81 }; // CComponentTester_UnitTestContext |
|
82 |
|
83 // ______________________________________________________________________________ |
|
84 // |
|
85 /** |
|
86 @internalComponent |
|
87 |
|
88 Comments : Transition test of the CComponentTester::NewL method. |
|
89 */ |
|
90 class CComponentTester_NewL_Transition : public CTransitionType |
|
91 { |
|
92 public: |
|
93 /** |
|
94 @fn CComponentTester_NewL_Transition(CUnitTestContext& aUTContext, |
|
95 TTransitionValidator& aValidator) |
|
96 Intended Usage : Standard c'tor method. |
|
97 Error Condition : None. |
|
98 @since 7.0 |
|
99 @param aUTContext The context this transition is operating in. |
|
100 @param aValidator Used for checking the pre & post conditions of the test object. |
|
101 @pre None. |
|
102 @post CComponentTester_NewL_Transition is fully constructed. |
|
103 */ |
|
104 CComponentTester_NewL_Transition(CUnitTestContext& aUTContext, |
|
105 TTransitionValidator& aValidator); |
|
106 /** |
|
107 @fn TransitMethodL() |
|
108 Intended Usage : To execute the CComponentTester::NewL method for the test harness. |
|
109 Error Condition : Leaves with an error code. |
|
110 @leave KErrNoMemory, (@see CComponentTester::NewL) |
|
111 @since 7.0 |
|
112 @return None |
|
113 @pre CComponentTester_NewL_Transition is fully constructed. |
|
114 @post No change in the CComponentTester_NewL_Transition apart |
|
115 from iComponentTester, which may have changed state. |
|
116 (@see CComponentTester::NewL post-condition) for iComponentTester's new state. |
|
117 */ |
|
118 inline void TransitMethodL(); |
|
119 |
|
120 /** |
|
121 @fn Context() const |
|
122 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
123 Error Condition : None. |
|
124 @since 7.0 |
|
125 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
126 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
127 @post No change in the CComponentTester_NewL_Transition |
|
128 */ |
|
129 inline CComponentTester_UnitTestContext& Context() const; |
|
130 }; // CComponentTester_NewL_Transition |
|
131 |
|
132 // ______________________________________________________________________________ |
|
133 // |
|
134 /** |
|
135 @internalComponent |
|
136 |
|
137 Comments : Transition test of the CComponentTester::Dtor method. |
|
138 */ |
|
139 class CComponentTester_Dtor_Transition : public CTransition |
|
140 { |
|
141 public: |
|
142 /** |
|
143 @fn CComponentTester_Dtor_Transition(CUnitTestContext& aUTContext, |
|
144 TTransitionValidator& aValidator) |
|
145 Intended Usage : Standard c'tor method. |
|
146 Error Condition : None. |
|
147 @since 7.0 |
|
148 @param aUTContext The context this transition is operating in. |
|
149 @param aValidator Used for checking the pre & post conditions of the test object. |
|
150 @pre None. |
|
151 @post CComponentTester_Dtor_Transition is fully constructed. |
|
152 */ |
|
153 CComponentTester_Dtor_Transition(CUnitTestContext& aUTContext, |
|
154 TTransitionValidator& aValidator); |
|
155 /** |
|
156 @fn TransitMethodL() |
|
157 Intended Usage : To execute the CComponentTester::Dtor method for the test harness. |
|
158 Error Condition : Leaves with an error code. |
|
159 @leave KErrNoMemory, (@see CComponentTester::Dtor) |
|
160 @since 7.0 |
|
161 @return None |
|
162 @pre CComponentTester_Dtor_Transition is fully constructed. |
|
163 @post No change in the CComponentTester_Dtor_Transition apart |
|
164 from iComponentTester, which may have changed state. |
|
165 (@see CComponentTester::Dtor post-condition) for iComponentTester's new state. |
|
166 */ |
|
167 inline void TransitMethodL(); |
|
168 |
|
169 /** |
|
170 @fn Context() const |
|
171 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
172 Error Condition : None. |
|
173 @since 7.0 |
|
174 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
175 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
176 @post No change in the CComponentTester_Dtor_Transition |
|
177 */ |
|
178 inline CComponentTester_UnitTestContext& Context() const; |
|
179 }; // CComponentTester_Dtor_Transition |
|
180 |
|
181 // ______________________________________________________________________________ |
|
182 // |
|
183 /** |
|
184 @internalComponent |
|
185 |
|
186 Comments : Transition test of the CComponentTester::TransitionSetsL method. |
|
187 */ |
|
188 class CComponentTester_TransitionSetsL_Transition : public CTransitionType |
|
189 { |
|
190 public: |
|
191 /** |
|
192 @fn CComponentTester_TransitionSetsL_Transition(CUnitTestContext& aUTContext, |
|
193 TTransitionValidator& aValidator) |
|
194 Intended Usage : Standard c'tor method. |
|
195 Error Condition : None. |
|
196 @since 7.0 |
|
197 @param aUTContext The context this transition is operating in. |
|
198 @param aValidator Used for checking the pre & post conditions of the test object. |
|
199 @pre None. |
|
200 @post CComponentTester_TransitionSetsL_Transition is fully constructed. |
|
201 */ |
|
202 CComponentTester_TransitionSetsL_Transition(CUnitTestContext& aUTContext, |
|
203 TTransitionValidator& aValidator); |
|
204 /** |
|
205 @fn TransitMethodL() |
|
206 Intended Usage : To execute the CComponentTester::TransitionSetsL method for the test harness. |
|
207 Error Condition : Leaves with an error code. |
|
208 @leave KErrNoMemory, (@see CComponentTester::TransitionSetsL) |
|
209 @since 7.0 |
|
210 @return None |
|
211 @pre CComponentTester_TransitionSetsL_Transition is fully constructed. |
|
212 @post No change in the CComponentTester_TransitionSetsL_Transition apart |
|
213 from iComponentTester, which may have changed state. |
|
214 (@see CComponentTester::TransitionSetsL post-condition) for iComponentTester's new state. |
|
215 */ |
|
216 inline void TransitMethodL(); |
|
217 |
|
218 /** |
|
219 @fn Context() const |
|
220 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
221 Error Condition : None. |
|
222 @since 7.0 |
|
223 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
224 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
225 @post No change in the CComponentTester_TransitionSetsL_Transition |
|
226 */ |
|
227 inline CComponentTester_UnitTestContext& Context() const; |
|
228 }; // CComponentTester_TransitionSetsL_Transition |
|
229 |
|
230 // ______________________________________________________________________________ |
|
231 // |
|
232 /** |
|
233 @internalComponent |
|
234 |
|
235 Comments : Transition test of the CComponentTester::AddUnitTestL method. |
|
236 */ |
|
237 class CComponentTester_AddUnitTestL_Transition : public CTransitionType |
|
238 { |
|
239 public: |
|
240 /** |
|
241 @fn CComponentTester_AddUnitTestL_Transition(CUnitTestContext& aUTContext, |
|
242 TTransitionValidator& aValidator) |
|
243 Intended Usage : Standard c'tor method. |
|
244 Error Condition : None. |
|
245 @since 7.0 |
|
246 @param aUTContext The context this transition is operating in. |
|
247 @param aValidator Used for checking the pre & post conditions of the test object. |
|
248 @pre None. |
|
249 @post CComponentTester_AddUnitTestL_Transition is fully constructed. |
|
250 */ |
|
251 CComponentTester_AddUnitTestL_Transition(CUnitTestContext& aUTContext, |
|
252 TTransitionValidator& aValidator); |
|
253 /** |
|
254 @fn TransitMethodL() |
|
255 Intended Usage : To execute the CComponentTester::AddUnitTestL method for the test harness. |
|
256 Error Condition : Leaves with an error code. |
|
257 @leave KErrNoMemory, (@see CComponentTester::AddUnitTestL) |
|
258 @since 7.0 |
|
259 @return None |
|
260 @pre CComponentTester_AddUnitTestL_Transition is fully constructed. |
|
261 @post No change in the CComponentTester_AddUnitTestL_Transition apart |
|
262 from iComponentTester, which may have changed state. |
|
263 (@see CComponentTester::AddUnitTestL post-condition) for iComponentTester's new state. |
|
264 */ |
|
265 inline void TransitMethodL(); |
|
266 |
|
267 /** |
|
268 @fn Context() const |
|
269 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
270 Error Condition : None. |
|
271 @since 7.0 |
|
272 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
273 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
274 @post No change in the CComponentTester_AddUnitTestL_Transition |
|
275 */ |
|
276 inline CComponentTester_UnitTestContext& Context() const; |
|
277 }; // CComponentTester_AddUnitTestL_Transition |
|
278 |
|
279 // ______________________________________________________________________________ |
|
280 // |
|
281 /** |
|
282 @internalComponent |
|
283 |
|
284 Comments : Transition test of the CComponentTester::AddParamUnitTestL method. |
|
285 */ |
|
286 class CComponentTester_AddParamUnitTestL_Transition : public CTransitionType |
|
287 { |
|
288 public: |
|
289 /** |
|
290 @fn CComponentTester_AddParamUnitTestL_Transition(CUnitTestContext& aUTContext, |
|
291 TTransitionValidator& aValidator) |
|
292 Intended Usage : Standard c'tor method. |
|
293 Error Condition : None. |
|
294 @since 7.0 |
|
295 @param aUTContext The context this transition is operating in. |
|
296 @param aValidator Used for checking the pre & post conditions of the test object. |
|
297 @pre None. |
|
298 @post CComponentTester_AddParamUnitTestL_Transition is fully constructed. |
|
299 */ |
|
300 CComponentTester_AddParamUnitTestL_Transition(CUnitTestContext& aUTContext, |
|
301 TTransitionValidator& aValidator); |
|
302 /** |
|
303 @fn TransitMethodL() |
|
304 Intended Usage : To execute the CComponentTester::AddParamUnitTestL method for the test harness. |
|
305 Error Condition : Leaves with an error code. |
|
306 @leave KErrNoMemory, (@see CComponentTester::AddParamUnitTestL) |
|
307 @since 7.0 |
|
308 @return None |
|
309 @pre CComponentTester_AddParamUnitTestL_Transition is fully constructed. |
|
310 @post No change in the CComponentTester_AddParamUnitTestL_Transition apart |
|
311 from iComponentTester, which may have changed state. |
|
312 (@see CComponentTester::AddParamUnitTestL post-condition) for iComponentTester's new state. |
|
313 */ |
|
314 inline void TransitMethodL(); |
|
315 |
|
316 /** |
|
317 @fn Context() const |
|
318 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
319 Error Condition : None. |
|
320 @since 7.0 |
|
321 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
322 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
323 @post No change in the CComponentTester_AddParamUnitTestL_Transition |
|
324 */ |
|
325 inline CComponentTester_UnitTestContext& Context() const; |
|
326 }; // CComponentTester_AddParamUnitTestL_Transition |
|
327 |
|
328 // ______________________________________________________________________________ |
|
329 // |
|
330 /** |
|
331 @internalComponent |
|
332 |
|
333 Comments : Transition test of the CComponentTester::TestComponent method. |
|
334 */ |
|
335 class CComponentTester_TestComponent_Transition : public CTransition |
|
336 { |
|
337 public: |
|
338 /** |
|
339 @fn CComponentTester_TestComponent_Transition(CUnitTestContext& aUTContext, |
|
340 TTransitionValidator& aValidator) |
|
341 Intended Usage : Standard c'tor method. |
|
342 Error Condition : None. |
|
343 @since 7.0 |
|
344 @param aUTContext The context this transition is operating in. |
|
345 @param aValidator Used for checking the pre & post conditions of the test object. |
|
346 @pre None. |
|
347 @post CComponentTester_TestComponent_Transition is fully constructed. |
|
348 */ |
|
349 CComponentTester_TestComponent_Transition(CUnitTestContext& aUTContext, |
|
350 TTransitionValidator& aValidator); |
|
351 /** |
|
352 @fn TransitMethodL() |
|
353 Intended Usage : To execute the CComponentTester::TestComponent method for the test harness. |
|
354 Error Condition : Leaves with an error code. |
|
355 @leave KErrNoMemory, (@see CComponentTester::TestComponent) |
|
356 @since 7.0 |
|
357 @return None |
|
358 @pre CComponentTester_TestComponent_Transition is fully constructed. |
|
359 @post No change in the CComponentTester_TestComponent_Transition apart |
|
360 from iComponentTester, which may have changed state. |
|
361 (@see CComponentTester::TestComponent post-condition) for iComponentTester's new state. |
|
362 */ |
|
363 inline void TransitMethodL(); |
|
364 |
|
365 /** |
|
366 @fn Context() const |
|
367 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
368 Error Condition : None. |
|
369 @since 7.0 |
|
370 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
371 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
372 @post No change in the CComponentTester_TestComponent_Transition |
|
373 */ |
|
374 inline CComponentTester_UnitTestContext& Context() const; |
|
375 }; // CComponentTester_TestComponent_Transition |
|
376 |
|
377 // ______________________________________________________________________________ |
|
378 // |
|
379 /** |
|
380 @internalComponent |
|
381 |
|
382 Comments : Transition test of the CComponentTester::RunL method. |
|
383 */ |
|
384 class CComponentTester_RunL_Transition : public CTransitionType |
|
385 { |
|
386 public: |
|
387 /** |
|
388 @fn CComponentTester_RunL_Transition(CUnitTestContext& aUTContext, |
|
389 TTransitionValidator& aValidator) |
|
390 Intended Usage : Standard c'tor method. |
|
391 Error Condition : None. |
|
392 @since 7.0 |
|
393 @param aUTContext The context this transition is operating in. |
|
394 @param aValidator Used for checking the pre & post conditions of the test object. |
|
395 @pre None. |
|
396 @post CComponentTester_RunL_Transition is fully constructed. |
|
397 */ |
|
398 CComponentTester_RunL_Transition(CUnitTestContext& aUTContext, |
|
399 TTransitionValidator& aValidator); |
|
400 /** |
|
401 @fn TransitMethodL() |
|
402 Intended Usage : To execute the CComponentTester::RunL method for the test harness. |
|
403 Error Condition : Leaves with an error code. |
|
404 @leave KErrNoMemory, (@see CComponentTester::RunL) |
|
405 @since 7.0 |
|
406 @return None |
|
407 @pre CComponentTester_RunL_Transition is fully constructed. |
|
408 @post No change in the CComponentTester_RunL_Transition apart |
|
409 from iComponentTester, which may have changed state. |
|
410 (@see CComponentTester::RunL post-condition) for iComponentTester's new state. |
|
411 */ |
|
412 inline void TransitMethodL(); |
|
413 |
|
414 /** |
|
415 @fn Context() const |
|
416 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
417 Error Condition : None. |
|
418 @since 7.0 |
|
419 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
420 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
421 @post No change in the CComponentTester_RunL_Transition |
|
422 */ |
|
423 inline CComponentTester_UnitTestContext& Context() const; |
|
424 }; // CComponentTester_RunL_Transition |
|
425 |
|
426 // ______________________________________________________________________________ |
|
427 // |
|
428 /** |
|
429 @internalComponent |
|
430 |
|
431 Comments : Transition test of the CComponentTester::Complete method. |
|
432 */ |
|
433 class CComponentTester_Complete_Transition : public CTransition |
|
434 { |
|
435 public: |
|
436 /** |
|
437 @fn CComponentTester_Complete_Transition(CUnitTestContext& aUTContext, |
|
438 TTransitionValidator& aValidator) |
|
439 Intended Usage : Standard c'tor method. |
|
440 Error Condition : None. |
|
441 @since 7.0 |
|
442 @param aUTContext The context this transition is operating in. |
|
443 @param aValidator Used for checking the pre & post conditions of the test object. |
|
444 @pre None. |
|
445 @post CComponentTester_Complete_Transition is fully constructed. |
|
446 */ |
|
447 CComponentTester_Complete_Transition(CUnitTestContext& aUTContext, |
|
448 TTransitionValidator& aValidator); |
|
449 /** |
|
450 @fn TransitMethodL() |
|
451 Intended Usage : To execute the CComponentTester::Complete method for the test harness. |
|
452 Error Condition : Leaves with an error code. |
|
453 @leave KErrNoMemory, (@see CComponentTester::Complete) |
|
454 @since 7.0 |
|
455 @return None |
|
456 @pre CComponentTester_Complete_Transition is fully constructed. |
|
457 @post No change in the CComponentTester_Complete_Transition apart |
|
458 from iComponentTester, which may have changed state. |
|
459 (@see CComponentTester::Complete post-condition) for iComponentTester's new state. |
|
460 */ |
|
461 inline void TransitMethodL(); |
|
462 |
|
463 /** |
|
464 @fn Context() const |
|
465 Intended Usage : To provide access to the unit test context cast to the correct type. |
|
466 Error Condition : None. |
|
467 @since 7.0 |
|
468 @return The unit test context cast to a CComponentTester_UnitTestContext |
|
469 @pre iUTContext is a valid CComponentTester_UnitTestContext. |
|
470 @post No change in the CComponentTester_Complete_Transition |
|
471 */ |
|
472 inline CComponentTester_UnitTestContext& Context() const; |
|
473 }; // CComponentTester_Complete_Transition |
|
474 |
|
475 |
|
476 // Add additional Transition class definitions here... |
|
477 |
|
478 #include "ComponentTesterTransitions.inl" |
|
479 |
|
480 #include "ComponentTesterUnitTestContext.inl" |
|
481 |
|
482 #endif // __COMPONENTTESTERTRANSITIONS_H__ |
|
483 |