|
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 CDataLogger class. |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __DATALOGGERUNITTEST_H__ |
|
19 #define __DATALOGGERUNITTEST_H__ |
|
20 |
|
21 #include <ecom/test_bed/testbeddefinitions.h> |
|
22 #include "DataLoggerStateAccessor.h" |
|
23 #include "DataLoggerTransitionValidation.h" |
|
24 #include "DataLoggerTransitions.h" |
|
25 |
|
26 // ______________________________________________________________________________ |
|
27 // |
|
28 /** |
|
29 @internalComponent |
|
30 |
|
31 Comments : Unit Test for CreateAndDestroy on CDataLogger, the class under test. |
|
32 */ |
|
33 class CDataLogger_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 CDataLogger_CreateAndDestroy_UnitTest* The constructed object. |
|
47 @pre None. |
|
48 @post CDataLogger_CreateAndDestroy_UnitTest is fully constructed, and initialised. |
|
49 */ |
|
50 static CDataLogger_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 CDataLogger_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 CDataLogger_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 ~CDataLogger_CreateAndDestroy_UnitTest() |
|
70 Intended Usage : Standard Destructor. |
|
71 Error Condition : None. |
|
72 @since 7.0 |
|
73 @pre CDataLogger_CreateAndDestroy_UnitTest is fully constructed. |
|
74 @post CDataLogger_CreateAndDestroy_UnitTest is fully destroyed. |
|
75 */ |
|
76 ~CDataLogger_CreateAndDestroy_UnitTest(); |
|
77 |
|
78 private: |
|
79 /** |
|
80 @fn CDataLogger_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 CDataLogger class. |
|
88 @pre None. |
|
89 @post CDataLogger_CreateAndDestroy_UnitTest is fully constructed. |
|
90 */ |
|
91 inline CDataLogger_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 CDataLogger_CreateAndDestroy_UnitTest is fully constructed. |
|
103 @post CDataLogger_CreateAndDestroy_UnitTest is fully initialised. |
|
104 */ |
|
105 void ConstructL(); |
|
106 |
|
107 /** |
|
108 The context of the Unit Test. |
|
109 i.e The CDataLogger class tested by this UnitTest's transitions. |
|
110 */ |
|
111 CDataLogger_UnitTestContext* iUTContext; |
|
112 TDataLogger_StateAccessor* iStateAccessor; |
|
113 // C'tor, d'tor, and method transition validators |
|
114 TDataLogger_Ctor_TransitionValidator* iCtorValidator; |
|
115 TDataLogger_Dtor_TransitionValidator* iDtorValidator; |
|
116 }; // CDataLogger_CreateAndDestroy_UnitTest |
|
117 |
|
118 // ______________________________________________________________________________ |
|
119 // |
|
120 /** |
|
121 @internalComponent |
|
122 |
|
123 Comments : Unit Test for DumpMemoryBlock on CDataLogger, the class under test. |
|
124 */ |
|
125 class CDataLogger_DumpMemoryBlock_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 CDataLogger_DumpMemoryBlock_UnitTest* The constructed object. |
|
139 @pre None. |
|
140 @post CDataLogger_DumpMemoryBlock_UnitTest is fully constructed, and initialised. |
|
141 */ |
|
142 static CDataLogger_DumpMemoryBlock_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 CDataLogger_DumpMemoryBlock_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 KErrNone if cleanup successful, otherwise |
|
154 @see CUnitTest::RunError() |
|
155 @pre CDataLogger_DumpMemoryBlock_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 ~CDataLogger_DumpMemoryBlock_UnitTest() |
|
162 Intended Usage : Standard Destructor. |
|
163 Error Condition : None. |
|
164 @since 7.0 |
|
165 @pre CDataLogger_DumpMemoryBlock_UnitTest is fully constructed. |
|
166 @post CDataLogger_DumpMemoryBlock_UnitTest is fully destroyed. |
|
167 */ |
|
168 ~CDataLogger_DumpMemoryBlock_UnitTest(); |
|
169 |
|
170 private: |
|
171 /** |
|
172 @fn CDataLogger_DumpMemoryBlock_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 CDataLogger class. |
|
180 @pre None. |
|
181 @post CDataLogger_DumpMemoryBlock_UnitTest is fully constructed. |
|
182 */ |
|
183 inline CDataLogger_DumpMemoryBlock_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 CDataLogger_DumpMemoryBlock_UnitTest is fully constructed. |
|
195 @post CDataLogger_DumpMemoryBlock_UnitTest is fully initialised. |
|
196 */ |
|
197 void ConstructL(); |
|
198 |
|
199 /** |
|
200 The context of the Unit Test. |
|
201 i.e The CDataLogger class tested by this UnitTest's transitions. |
|
202 */ |
|
203 CDataLogger_UnitTestContext* iUTContext; |
|
204 TDataLogger_StateAccessor* iStateAccessor; |
|
205 // C'tor, d'tor, and method transition validators |
|
206 TDataLogger_Ctor_TransitionValidator* iCtorValidator; |
|
207 TDataLogger_DumpMemoryBlock_TransitionValidator* iDumpMemoryBlockValidator; |
|
208 TDataLogger_Dtor_TransitionValidator* iDtorValidator; |
|
209 }; // CDataLogger_DumpMemoryBlock_UnitTest |
|
210 |
|
211 // ______________________________________________________________________________ |
|
212 // |
|
213 /** |
|
214 @internalComponent |
|
215 |
|
216 Comments : Unit Test for LogInformation on CDataLogger, the class under test. |
|
217 */ |
|
218 class CDataLogger_LogInformation_UnitTest : public CUnitTest |
|
219 { |
|
220 public: |
|
221 /** |
|
222 @fn NewL(CDataLogger& aDataLogger, |
|
223 MUnitTestObserver& aObserver) |
|
224 Intended Usage : Standard two-phase construction which leaves nothing on the |
|
225 cleanup stack. |
|
226 Error Condition : Leaves with the error code. |
|
227 @leave KErrNoMemory |
|
228 @since 7.0 |
|
229 @param aDataLogger The output logging object. |
|
230 @param aObserver The observer of this UnitTest. |
|
231 @return CDataLogger_LogInformation_UnitTest* The constructed object. |
|
232 @pre None. |
|
233 @post CDataLogger_LogInformation_UnitTest is fully constructed, and initialised. |
|
234 */ |
|
235 static CDataLogger_LogInformation_UnitTest* NewL(CDataLogger& aDataLogger, |
|
236 MUnitTestObserver& aObserver); |
|
237 |
|
238 /** |
|
239 @fn RunError(TInt aError) |
|
240 Intended Usage : Intercept the panic caused by a RunL leave, |
|
241 to restore the CDataLogger_LogInformation_UnitTest |
|
242 object to a sensible state. |
|
243 (called by the Active Scheduler immediately before the Panic). |
|
244 Error Condition : @see CUnitTest::RunError(). |
|
245 @since 7.0 |
|
246 @return TInt KErrNone if cleanup successful, otherwise |
|
247 @see CUnitTest::RunError() |
|
248 @pre CDataLogger_LogInformation_UnitTest is fully constructed, and initialised. |
|
249 @post The object has been restored to a sensible state. |
|
250 */ |
|
251 inline TInt RunError(TInt aError); |
|
252 |
|
253 /** |
|
254 @fn ~CDataLogger_LogInformation_UnitTest() |
|
255 Intended Usage : Standard Destructor. |
|
256 Error Condition : None. |
|
257 @since 7.0 |
|
258 @pre CDataLogger_LogInformation_UnitTest is fully constructed. |
|
259 @post CDataLogger_LogInformation_UnitTest is fully destroyed. |
|
260 */ |
|
261 ~CDataLogger_LogInformation_UnitTest(); |
|
262 |
|
263 private: |
|
264 /** |
|
265 @fn CDataLogger_LogInformation_UnitTest(CDataLogger& aDataLogger, |
|
266 MUnitTestObserver& aObserver) |
|
267 Intended Usage : Default constructor. |
|
268 Error Condition : None. |
|
269 @since 7.0 |
|
270 @param aDataLogger The output logging object. |
|
271 @param aObserver The observer of this UnitTest. |
|
272 @param aStateAccessor WhiteBox state access to the CDataLogger class. |
|
273 @pre None. |
|
274 @post CDataLogger_LogInformation_UnitTest is fully constructed. |
|
275 */ |
|
276 inline CDataLogger_LogInformation_UnitTest(CDataLogger& aDataLogger, |
|
277 MUnitTestObserver& aObserver); |
|
278 |
|
279 /** |
|
280 @fn void ConstructL() |
|
281 Intended Usage : Second phase of safe two phase construction, |
|
282 to complete the object initialisation. |
|
283 Error Condition : Leaves with an error code. |
|
284 @leave KErrNoMemory, and @see CUnitTest::BaseNewL(). |
|
285 @since 7.0 |
|
286 @return None |
|
287 @pre CDataLogger_LogInformation_UnitTest is fully constructed. |
|
288 @post CDataLogger_LogInformation_UnitTest is fully initialised. |
|
289 */ |
|
290 void ConstructL(); |
|
291 |
|
292 /** |
|
293 The context of the Unit Test. |
|
294 i.e The CDataLogger class tested by this UnitTest's transitions. |
|
295 */ |
|
296 CDataLogger_UnitTestContext* iUTContext; |
|
297 TDataLogger_StateAccessor* iStateAccessor; |
|
298 // C'tor, d'tor, and method transition validators |
|
299 TDataLogger_Ctor_TransitionValidator* iCtorValidator; |
|
300 TDataLogger_LogInformation_TransitionValidator* iLogInformationValidator; |
|
301 TDataLogger_LogInformationNarrow_TransitionValidator* iLogInformationNarrowValidator; |
|
302 TDataLogger_LogInformationWithParameters_TransitionValidator* iLogInformationWithParametersValidator; |
|
303 TDataLogger_LogInformationWithParametersNarrow_TransitionValidator* iLogInformationWithParametersNarrowValidator; |
|
304 TDataLogger_Dtor_TransitionValidator* iDtorValidator; |
|
305 }; // CDataLogger_LogInformation_UnitTest |
|
306 |
|
307 // ______________________________________________________________________________ |
|
308 // |
|
309 /** |
|
310 @internalComponent |
|
311 |
|
312 Comments : Unit Test for ReportInformation on CDataLogger, the class under test. |
|
313 */ |
|
314 class CDataLogger_ReportInformation_UnitTest : public CUnitTest |
|
315 { |
|
316 public: |
|
317 /** |
|
318 @fn NewL(CDataLogger& aDataLogger, |
|
319 MUnitTestObserver& aObserver) |
|
320 Intended Usage : Standard two-phase construction which leaves nothing on the |
|
321 cleanup stack. |
|
322 Error Condition : Leaves with the error code. |
|
323 @leave KErrNoMemory |
|
324 @since 7.0 |
|
325 @param aDataLogger The output logging object. |
|
326 @param aObserver The observer of this UnitTest. |
|
327 @return CDataLogger_ReportInformation_UnitTest* The constructed object. |
|
328 @pre None. |
|
329 @post CDataLogger_ReportInformation_UnitTest is fully constructed, and initialised. |
|
330 */ |
|
331 static CDataLogger_ReportInformation_UnitTest* NewL(CDataLogger& aDataLogger, |
|
332 MUnitTestObserver& aObserver); |
|
333 |
|
334 /** |
|
335 @fn RunError(TInt aError) |
|
336 Intended Usage : Intercept the panic caused by a RunL leave, |
|
337 to restore the CDataLogger_ReportInformation_UnitTest |
|
338 object to a sensible state. |
|
339 (called by the Active Scheduler immediately before the Panic). |
|
340 Error Condition : @see CUnitTest::RunError(). |
|
341 @since 7.0 |
|
342 @return TInt KErrNone if cleanup successful, otherwise |
|
343 @see CUnitTest::RunError() |
|
344 @pre CDataLogger_ReportInformation_UnitTest is fully constructed, and initialised. |
|
345 @post The object has been restored to a sensible state. |
|
346 */ |
|
347 inline TInt RunError(TInt aError); |
|
348 |
|
349 /** |
|
350 @fn ~CDataLogger_ReportInformation_UnitTest() |
|
351 Intended Usage : Standard Destructor. |
|
352 Error Condition : None. |
|
353 @since 7.0 |
|
354 @pre CDataLogger_ReportInformation_UnitTest is fully constructed. |
|
355 @post CDataLogger_ReportInformation_UnitTest is fully destroyed. |
|
356 */ |
|
357 ~CDataLogger_ReportInformation_UnitTest(); |
|
358 |
|
359 private: |
|
360 /** |
|
361 @fn CDataLogger_ReportInformation_UnitTest(CDataLogger& aDataLogger, |
|
362 MUnitTestObserver& aObserver) |
|
363 Intended Usage : Default constructor. |
|
364 Error Condition : None. |
|
365 @since 7.0 |
|
366 @param aDataLogger The output logging object. |
|
367 @param aObserver The observer of this UnitTest. |
|
368 @param aStateAccessor WhiteBox state access to the CDataLogger class. |
|
369 @pre None. |
|
370 @post CDataLogger_ReportInformation_UnitTest is fully constructed. |
|
371 */ |
|
372 inline CDataLogger_ReportInformation_UnitTest(CDataLogger& aDataLogger, |
|
373 MUnitTestObserver& aObserver); |
|
374 |
|
375 /** |
|
376 @fn void ConstructL() |
|
377 Intended Usage : Second phase of safe two phase construction, |
|
378 to complete the object initialisation. |
|
379 Error Condition : Leaves with an error code. |
|
380 @leave KErrNoMemory, and @see CUnitTest::BaseNewL(). |
|
381 @since 7.0 |
|
382 @return None |
|
383 @pre CDataLogger_ReportInformation_UnitTest is fully constructed. |
|
384 @post CDataLogger_ReportInformation_UnitTest is fully initialised. |
|
385 */ |
|
386 void ConstructL(); |
|
387 |
|
388 /** |
|
389 The context of the Unit Test. |
|
390 i.e The CDataLogger class tested by this UnitTest's transitions. |
|
391 */ |
|
392 CDataLogger_UnitTestContext* iUTContext; |
|
393 TDataLogger_StateAccessor* iStateAccessor; |
|
394 // C'tor, d'tor, and method transition validators |
|
395 TDataLogger_Ctor_TransitionValidator* iCtorValidator; |
|
396 TDataLogger_ReportInformation_TransitionValidator* iReportInformationValidator; |
|
397 TDataLogger_ReportInformationWithParameters_TransitionValidator* iReportInformationWithParametersValidator; |
|
398 TDataLogger_Dtor_TransitionValidator* iDtorValidator; |
|
399 |
|
400 }; // CDataLogger_ReportInformation_UnitTest |
|
401 |
|
402 |
|
403 #endif // __DATALOGGERUNITTEST_H__ |