|
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 CDefaultLogOutput class. |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __DEFAULTLOGOUTPUTUNITTEST_H__ |
|
19 #define __DEFAULTLOGOUTPUTUNITTEST_H__ |
|
20 |
|
21 #include <ecom/test_bed/testbeddefinitions.h> |
|
22 #include "DefaultLogOutputStateAccessor.h" |
|
23 #include "DefaultLogOutputTransitionValidation.h" |
|
24 #include "DefaultLogOutputTransitions.h" |
|
25 |
|
26 // ______________________________________________________________________________ |
|
27 // |
|
28 /** |
|
29 @internalComponent |
|
30 |
|
31 Comments : Unit Test for CreateAndDestroy on CDefaultLogOutput, the class under test. |
|
32 */ |
|
33 class CDefaultLogOutput_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 CDefaultLogOutput_CreateAndDestroy_UnitTest* The constructed object. |
|
47 @pre None. |
|
48 @post CDefaultLogOutput_CreateAndDestroy_UnitTest is fully constructed, and initialised. |
|
49 */ |
|
50 static CDefaultLogOutput_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 CDefaultLogOutput_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 CDefaultLogOutput_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 ~CDefaultLogOutput_CreateAndDestroy_UnitTest() |
|
70 Intended Usage : Standard Destructor. |
|
71 Error Condition : None. |
|
72 @since 7.0 |
|
73 @pre CDefaultLogOutput_CreateAndDestroy_UnitTest is fully constructed. |
|
74 @post CDefaultLogOutput_CreateAndDestroy_UnitTest is fully destroyed. |
|
75 */ |
|
76 ~CDefaultLogOutput_CreateAndDestroy_UnitTest(); |
|
77 |
|
78 private: |
|
79 /** |
|
80 @fn CDefaultLogOutput_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 CDefaultLogOutput class. |
|
88 @pre None. |
|
89 @post CDefaultLogOutput_CreateAndDestroy_UnitTest is fully constructed. |
|
90 */ |
|
91 inline CDefaultLogOutput_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 CDefaultLogOutput_CreateAndDestroy_UnitTest is fully constructed. |
|
103 @post CDefaultLogOutput_CreateAndDestroy_UnitTest is fully initialised. |
|
104 */ |
|
105 void ConstructL(); |
|
106 |
|
107 /** |
|
108 The context of the Unit Test. |
|
109 i.e The CDefaultLogOutput class tested by this UnitTest's transitions. |
|
110 */ |
|
111 CDefaultLogOutput_UnitTestContext* iUTContext; |
|
112 TDefaultLogOutput_StateAccessor* iStateAccessor; |
|
113 // C'tor, d'tor, and method transition validators |
|
114 TDefaultLogOutput_Ctor_TransitionValidator* iCtorValidator; |
|
115 TDefaultLogOutput_Dtor_TransitionValidator* iDtorValidator; |
|
116 }; // CDefaultLogOutput_CreateAndDestroy_UnitTest |
|
117 |
|
118 // ______________________________________________________________________________ |
|
119 // |
|
120 /** |
|
121 @internalComponent |
|
122 |
|
123 Comments : Unit Test for OpenAndClose on CDefaultLogOutput, the class under test. |
|
124 */ |
|
125 class CDefaultLogOutput_OpenAndClose_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 CDefaultLogOutput_OpenAndClose_UnitTest* The constructed object. |
|
139 @pre None. |
|
140 @post CDefaultLogOutput_OpenAndClose_UnitTest is fully constructed, and initialised. |
|
141 */ |
|
142 static CDefaultLogOutput_OpenAndClose_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 CDefaultLogOutput_OpenAndClose_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 CDefaultLogOutput_OpenAndClose_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 ~CDefaultLogOutput_OpenAndClose_UnitTest() |
|
162 Intended Usage : Standard Destructor. |
|
163 Error Condition : None. |
|
164 @since 7.0 |
|
165 @pre CDefaultLogOutput_OpenAndClose_UnitTest is fully constructed. |
|
166 @post CDefaultLogOutput_OpenAndClose_UnitTest is fully destroyed. |
|
167 */ |
|
168 ~CDefaultLogOutput_OpenAndClose_UnitTest(); |
|
169 |
|
170 private: |
|
171 /** |
|
172 @fn CDefaultLogOutput_OpenAndClose_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 CDefaultLogOutput class. |
|
180 @pre None. |
|
181 @post CDefaultLogOutput_OpenAndClose_UnitTest is fully constructed. |
|
182 */ |
|
183 inline CDefaultLogOutput_OpenAndClose_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 CDefaultLogOutput_OpenAndClose_UnitTest is fully constructed. |
|
195 @post CDefaultLogOutput_OpenAndClose_UnitTest is fully initialised. |
|
196 */ |
|
197 void ConstructL(); |
|
198 |
|
199 /** |
|
200 The context of the Unit Test. |
|
201 i.e The CDefaultLogOutput class tested by this UnitTest's transitions. |
|
202 */ |
|
203 CDefaultLogOutput_UnitTestContext* iUTContext; |
|
204 TDefaultLogOutput_StateAccessor* iStateAccessor; |
|
205 // C'tor, d'tor, and method transition validators |
|
206 TDefaultLogOutput_Ctor_TransitionValidator* iCtorValidator; |
|
207 TDefaultLogOutput_Open_TransitionValidator* iOpenValidator; |
|
208 TDefaultLogOutput_Close_TransitionValidator* iCloseValidator; |
|
209 TDefaultLogOutput_Dtor_TransitionValidator* iDtorValidator; |
|
210 }; // CDefaultLogOutput_OpenAndClose_UnitTest |
|
211 |
|
212 // ______________________________________________________________________________ |
|
213 // |
|
214 /** |
|
215 @internalComponent |
|
216 |
|
217 Comments : Unit Test for OpenWriteClose on CDefaultLogOutput, the class under test. |
|
218 */ |
|
219 class CDefaultLogOutput_OpenWriteClose_UnitTest : public CUnitTest |
|
220 { |
|
221 public: |
|
222 /** |
|
223 @fn NewL(CDataLogger& aDataLogger, |
|
224 MUnitTestObserver& aObserver) |
|
225 Intended Usage : Standard two-phase construction which leaves nothing on the |
|
226 cleanup stack. |
|
227 Error Condition : Leaves with the error code. |
|
228 @leave KErrNoMemory |
|
229 @since 7.0 |
|
230 @param aDataLogger The output logging object. |
|
231 @param aObserver The observer of this UnitTest. |
|
232 @return CDefaultLogOutput_OpenWriteClose_UnitTest* The constructed object. |
|
233 @pre None. |
|
234 @post CDefaultLogOutput_OpenWriteClose_UnitTest is fully constructed, and initialised. |
|
235 */ |
|
236 static CDefaultLogOutput_OpenWriteClose_UnitTest* NewL(CDataLogger& aDataLogger, |
|
237 MUnitTestObserver& aObserver); |
|
238 |
|
239 /** |
|
240 @fn RunError(TInt aError) |
|
241 Intended Usage : Intercept the panic caused by a RunL leave, |
|
242 to restore the CDefaultLogOutput_OpenWriteClose_UnitTest |
|
243 object to a sensible state. |
|
244 (called by the Active Scheduler immediately before the Panic). |
|
245 Error Condition : @see CUnitTest::RunError(). |
|
246 @since 7.0 |
|
247 @return TInt KErrNone if cleanup successful, otherwise |
|
248 @see CUnitTest::RunError() |
|
249 @pre CDefaultLogOutput_OpenWriteClose_UnitTest is fully constructed, and initialised. |
|
250 @post The object has been restored to a sensible state. |
|
251 */ |
|
252 inline TInt RunError(TInt aError); |
|
253 |
|
254 /** |
|
255 @fn ~CDefaultLogOutput_OpenWriteClose_UnitTest() |
|
256 Intended Usage : Standard Destructor. |
|
257 Error Condition : None. |
|
258 @since 7.0 |
|
259 @pre CDefaultLogOutput_OpenWriteClose_UnitTest is fully constructed. |
|
260 @post CDefaultLogOutput_OpenWriteClose_UnitTest is fully destroyed. |
|
261 */ |
|
262 ~CDefaultLogOutput_OpenWriteClose_UnitTest(); |
|
263 |
|
264 private: |
|
265 /** |
|
266 @fn CDefaultLogOutput_OpenWriteClose_UnitTest(CDataLogger& aDataLogger, |
|
267 MUnitTestObserver& aObserver) |
|
268 Intended Usage : Default constructor. |
|
269 Error Condition : None. |
|
270 @since 7.0 |
|
271 @param aDataLogger The output logging object. |
|
272 @param aObserver The observer of this UnitTest. |
|
273 @param aStateAccessor WhiteBox state access to the CDefaultLogOutput class. |
|
274 @pre None. |
|
275 @post CDefaultLogOutput_OpenWriteClose_UnitTest is fully constructed. |
|
276 */ |
|
277 inline CDefaultLogOutput_OpenWriteClose_UnitTest(CDataLogger& aDataLogger, |
|
278 MUnitTestObserver& aObserver); |
|
279 |
|
280 /** |
|
281 @fn void ConstructL() |
|
282 Intended Usage : Second phase of safe two phase construction, |
|
283 to complete the object initialisation. |
|
284 Error Condition : Leaves with an error code. |
|
285 @leave KErrNoMemory, and @see CUnitTest::BaseNewL(). |
|
286 @since 7.0 |
|
287 @return None |
|
288 @pre CDefaultLogOutput_OpenWriteClose_UnitTest is fully constructed. |
|
289 @post CDefaultLogOutput_OpenWriteClose_UnitTest is fully initialised. |
|
290 */ |
|
291 void ConstructL(); |
|
292 |
|
293 /** |
|
294 The context of the Unit Test. |
|
295 i.e The CDefaultLogOutput class tested by this UnitTest's transitions. |
|
296 */ |
|
297 CDefaultLogOutput_UnitTestContext* iUTContext; |
|
298 TDefaultLogOutput_StateAccessor* iStateAccessor; |
|
299 // C'tor, d'tor, and method transition validators |
|
300 TDefaultLogOutput_Ctor_TransitionValidator* iCtorValidator; |
|
301 TDefaultLogOutput_Open_TransitionValidator* iOpenValidator; |
|
302 TDefaultLogOutput_Write_TransitionValidator* iWriteValidator; |
|
303 TDefaultLogOutput_Close_TransitionValidator* iCloseValidator; |
|
304 TDefaultLogOutput_Dtor_TransitionValidator* iDtorValidator; |
|
305 }; // CDefaultLogOutput_OpenWriteClose_UnitTest |
|
306 |
|
307 |
|
308 #endif // __DEFAULTLOGOUTPUTUNITTEST_H__ |