|
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 // This file contains the definition of the |
|
15 // class CAllTransitionsUnitTest |
|
16 // Note : All the REComSession references from this file |
|
17 // These are simple fudges for early development tests |
|
18 // before the true server migration of the code. |
|
19 // |
|
20 // |
|
21 |
|
22 #include <e32uid.h> |
|
23 |
|
24 #include "TestUtilities.h" // For __FILE__LINE__ |
|
25 #include "Interface.h" |
|
26 #include <ecom/test_bed/datalogger.h> |
|
27 |
|
28 #include "MagicUnitTests.h" |
|
29 #include "MagicTransitions.h" |
|
30 #include "MagicTransitionValidation.h" |
|
31 |
|
32 #include "TlsData.h" // For GlobalData |
|
33 |
|
34 #define UNUSED_VAR(a) a = a |
|
35 |
|
36 // ______________________________________________________________________________ |
|
37 // |
|
38 _LIT(KInterfaceCreateAndDestroyUnitTest,"CExampleInterfaceCreateAndDestroyUnitTest"); |
|
39 |
|
40 CExampleInterfaceCreateAndDestroyUnitTest* CExampleInterfaceCreateAndDestroyUnitTest::NewL(CDataLogger& aDataLogger, |
|
41 MUnitTestObserver& aObserver) |
|
42 { |
|
43 CExampleInterfaceCreateAndDestroyUnitTest* self = |
|
44 new(ELeave) CExampleInterfaceCreateAndDestroyUnitTest(aDataLogger, |
|
45 aObserver); |
|
46 CleanupStack::PushL(self); |
|
47 // Chain to the base which calls the ConstructL |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop(); |
|
50 return self; |
|
51 } |
|
52 |
|
53 TInt CExampleInterfaceCreateAndDestroyUnitTest::RunError(TInt aError) |
|
54 { |
|
55 // The RunL left so chain to the base first and then cleanup |
|
56 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
57 delete iUTContext; |
|
58 iUTContext = NULL; |
|
59 delete iStateAccessor; |
|
60 iStateAccessor = NULL; |
|
61 delete iCtorValidator; |
|
62 delete iDtorValidator; |
|
63 |
|
64 return error; |
|
65 } |
|
66 |
|
67 CExampleInterfaceCreateAndDestroyUnitTest::~CExampleInterfaceCreateAndDestroyUnitTest() |
|
68 { |
|
69 // Simply delete our test class instance |
|
70 delete iUTContext; |
|
71 delete iStateAccessor; |
|
72 delete iCtorValidator; |
|
73 delete iDtorValidator; |
|
74 |
|
75 } |
|
76 |
|
77 CExampleInterfaceCreateAndDestroyUnitTest::CExampleInterfaceCreateAndDestroyUnitTest(CDataLogger& aDataLogger, |
|
78 MUnitTestObserver& aObserver) |
|
79 : CUnitTest(KInterfaceCreateAndDestroyUnitTest, aDataLogger, aObserver) |
|
80 { |
|
81 //Do nothing |
|
82 } |
|
83 |
|
84 // Now the Individual transitions need to be added. |
|
85 void CExampleInterfaceCreateAndDestroyUnitTest::ConstructL() |
|
86 { |
|
87 // Perform the base class initialization |
|
88 UnitTestConstructL(); |
|
89 |
|
90 // Create the Unit test state accessor |
|
91 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor(); |
|
92 |
|
93 // context |
|
94 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
95 |
|
96 // Add the Transitions in the order they are to run |
|
97 // C'tor first, D'tor last... |
|
98 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
99 AddTransitionL(new(ELeave)CExampleInterfaceNewLTransition(*iUTContext,*iCtorValidator)); |
|
100 |
|
101 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
102 AddTransitionL(new(ELeave)CExampleInterfaceDtorTransition(*iUTContext,*iDtorValidator)); |
|
103 } |
|
104 // ______________________________________________________________________________ |
|
105 // |
|
106 _LIT(KExampleInterfaceAltCreateAndDestroyUnitTest,"CExampleInterfaceAltCreateAndDestroyUnitTest"); |
|
107 |
|
108 CExampleInterfaceAltCreateAndDestroyUnitTest* CExampleInterfaceAltCreateAndDestroyUnitTest::NewL(CDataLogger& aDataLogger, |
|
109 MUnitTestObserver& aObserver) |
|
110 { |
|
111 CExampleInterfaceAltCreateAndDestroyUnitTest* self = |
|
112 new(ELeave) CExampleInterfaceAltCreateAndDestroyUnitTest(aDataLogger, |
|
113 aObserver); |
|
114 CleanupStack::PushL(self); |
|
115 // Chain to the base which calls the ConstructL |
|
116 self->ConstructL(); |
|
117 CleanupStack::Pop(self); |
|
118 return self; |
|
119 } |
|
120 |
|
121 TInt CExampleInterfaceAltCreateAndDestroyUnitTest::RunError(TInt aError) |
|
122 { |
|
123 // The RunL left so chain to the base first and then cleanup |
|
124 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
125 delete iUTContext; |
|
126 iUTContext = NULL; |
|
127 delete iStateAccessor; |
|
128 iStateAccessor = NULL; |
|
129 delete iCtorValidator; |
|
130 iCtorValidator = NULL; |
|
131 delete iDtorValidator; |
|
132 iDtorValidator = NULL; |
|
133 |
|
134 return error; |
|
135 } |
|
136 |
|
137 CExampleInterfaceAltCreateAndDestroyUnitTest::~CExampleInterfaceAltCreateAndDestroyUnitTest() |
|
138 { |
|
139 // Simply delete our test class instance |
|
140 delete iUTContext; |
|
141 delete iStateAccessor; |
|
142 delete iCtorValidator; |
|
143 delete iDtorValidator; |
|
144 |
|
145 } |
|
146 |
|
147 CExampleInterfaceAltCreateAndDestroyUnitTest::CExampleInterfaceAltCreateAndDestroyUnitTest(CDataLogger& aDataLogger, |
|
148 MUnitTestObserver& aObserver) |
|
149 : CUnitTest(KExampleInterfaceAltCreateAndDestroyUnitTest, aDataLogger, aObserver) |
|
150 { |
|
151 //Do nothing |
|
152 } |
|
153 |
|
154 // Now the Individual transitions need to be added. |
|
155 void CExampleInterfaceAltCreateAndDestroyUnitTest::ConstructL() |
|
156 { |
|
157 // Perform the base class initialization |
|
158 UnitTestConstructL(); |
|
159 |
|
160 // Create the Unit test state accessor |
|
161 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor(); |
|
162 // context |
|
163 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
164 |
|
165 // Create the required validators |
|
166 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
167 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
168 |
|
169 // Add the transitions in the order they are to run |
|
170 AddTransitionL(new(ELeave)CExampleInterfaceNewWPLTransition(*iUTContext, *iCtorValidator)); |
|
171 AddTransitionL(new(ELeave)CExampleInterfaceDtorTransition(*iUTContext, *iDtorValidator)); |
|
172 |
|
173 AddTransitionL(new(ELeave)CExampleInterfaceNewResolveLTransition(*iUTContext, *iCtorValidator)); |
|
174 AddTransitionL(new(ELeave)CExampleInterfaceDtorTransition(*iUTContext, *iDtorValidator)); |
|
175 |
|
176 } |
|
177 |
|
178 // ______________________________________________________________________________ |
|
179 // |
|
180 _LIT(KExampleInterfaceListAllImplementationsUnitTest,"CExampleInterface_ListImplementations_UnitTest"); |
|
181 |
|
182 CExampleInterface_ListImplementations_UnitTest* CExampleInterface_ListImplementations_UnitTest::NewL(CDataLogger& aDataLogger, |
|
183 MUnitTestObserver& aObserver) |
|
184 { |
|
185 CExampleInterface_ListImplementations_UnitTest* self = |
|
186 new(ELeave) CExampleInterface_ListImplementations_UnitTest(aDataLogger, |
|
187 aObserver); |
|
188 CleanupStack::PushL(self); |
|
189 self->ConstructL(); |
|
190 CleanupStack::Pop(); |
|
191 return self; |
|
192 } |
|
193 |
|
194 inline TInt CExampleInterface_ListImplementations_UnitTest::RunError(TInt aError) |
|
195 { |
|
196 // The RunL left so chain to the base first and then cleanup |
|
197 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
198 delete iUTContext; |
|
199 iUTContext = NULL; |
|
200 delete iStateAccessor; |
|
201 // delete any validators used |
|
202 delete iCtorValidator; |
|
203 iCtorValidator = NULL; |
|
204 delete iListImplementationsValidator; |
|
205 iListImplementationsValidator = NULL; |
|
206 delete iDtorValidator; |
|
207 iDtorValidator = NULL; |
|
208 |
|
209 return error; |
|
210 } |
|
211 |
|
212 inline CExampleInterface_ListImplementations_UnitTest::~CExampleInterface_ListImplementations_UnitTest() |
|
213 { |
|
214 delete iUTContext; |
|
215 delete iStateAccessor; |
|
216 // delete any validators used |
|
217 delete iCtorValidator; |
|
218 delete iListImplementationsValidator; |
|
219 delete iDtorValidator; |
|
220 } |
|
221 |
|
222 inline CExampleInterface_ListImplementations_UnitTest::CExampleInterface_ListImplementations_UnitTest(CDataLogger& aDataLogger, |
|
223 MUnitTestObserver& aObserver) |
|
224 : CUnitTest(KExampleInterfaceListAllImplementationsUnitTest, aDataLogger, aObserver) |
|
225 { |
|
226 //Do nothing |
|
227 } |
|
228 |
|
229 // Now the Individual transitions need to be added. |
|
230 inline void CExampleInterface_ListImplementations_UnitTest::ConstructL() |
|
231 { |
|
232 // Perform the base class initialization |
|
233 UnitTestConstructL(); |
|
234 |
|
235 // Create the Unit test state accessor |
|
236 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor; |
|
237 // Construct the Unit test context. |
|
238 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
239 // Add the Transitions in the order they are to run |
|
240 // C'tor first, D'tor last... |
|
241 // Examples of C'tor and D'tor transitions on CExampleInterface class. |
|
242 // using ctor and dtor validators |
|
243 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
244 AddTransitionL(new(ELeave)CExampleInterfaceNewLTransition(*iUTContext,*iCtorValidator)); |
|
245 |
|
246 iListImplementationsValidator = new(ELeave) TExampleInterface_ListImplementations_TransitionValidator(*iUTContext); |
|
247 AddTransitionL(new(ELeave)CExampleInterfaceListAllImplementationsLTransition(*iUTContext,*iListImplementationsValidator)); |
|
248 AddTransitionL(new(ELeave)CExampleInterfaceListImplementationsLTransition(*iUTContext,*iListImplementationsValidator)); |
|
249 |
|
250 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
251 AddTransitionL(new(ELeave)CExampleInterfaceDtorTransition(*iUTContext,*iDtorValidator)); |
|
252 } |
|
253 |
|
254 // ______________________________________________________________________________ |
|
255 // |
|
256 _LIT(KExampleInterfaceDefectHAN4WZHSYUnitTest,"CExampleInterface_DefectHAN4WZHSY_UnitTest"); |
|
257 |
|
258 CExampleInterface_DefectHAN4WZHSY_UnitTest* CExampleInterface_DefectHAN4WZHSY_UnitTest::NewL(CDataLogger& aDataLogger, |
|
259 MUnitTestObserver& aObserver) |
|
260 { |
|
261 CExampleInterface_DefectHAN4WZHSY_UnitTest* self = |
|
262 new(ELeave) CExampleInterface_DefectHAN4WZHSY_UnitTest(aDataLogger, |
|
263 aObserver); |
|
264 CleanupStack::PushL(self); |
|
265 self->ConstructL(); |
|
266 CleanupStack::Pop(); |
|
267 return self; |
|
268 } |
|
269 |
|
270 inline TInt CExampleInterface_DefectHAN4WZHSY_UnitTest::RunError(TInt aError) |
|
271 { |
|
272 // The RunL left so chain to the base first and then cleanup |
|
273 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
274 delete iUTContext; |
|
275 delete iStateAccessor; |
|
276 |
|
277 delete iCtorValidator; |
|
278 delete iDtorValidator; |
|
279 |
|
280 return error; |
|
281 } |
|
282 |
|
283 inline CExampleInterface_DefectHAN4WZHSY_UnitTest::~CExampleInterface_DefectHAN4WZHSY_UnitTest() |
|
284 { |
|
285 // Simply delete our test class instance |
|
286 delete iUTContext; |
|
287 delete iStateAccessor; |
|
288 |
|
289 delete iCtorValidator; |
|
290 delete iDtorValidator; |
|
291 } |
|
292 |
|
293 inline CExampleInterface_DefectHAN4WZHSY_UnitTest::CExampleInterface_DefectHAN4WZHSY_UnitTest(CDataLogger& aDataLogger, |
|
294 MUnitTestObserver& aObserver) |
|
295 : CUnitTest(KExampleInterfaceDefectHAN4WZHSYUnitTest, aDataLogger, aObserver) |
|
296 { |
|
297 //Do nothing |
|
298 } |
|
299 |
|
300 // Now the Individual transitions need to be added. |
|
301 inline void CExampleInterface_DefectHAN4WZHSY_UnitTest::ConstructL() |
|
302 { |
|
303 // Perform the base class initialization |
|
304 UnitTestConstructL(); |
|
305 |
|
306 // Create the Unit test state accessor |
|
307 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor; |
|
308 // Construct the Unit test context. |
|
309 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
310 |
|
311 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
312 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
313 |
|
314 AddTransitionL(new(ELeave)CExampleInterfaceNewLTransition(*iUTContext,*iCtorValidator)); |
|
315 AddTransitionL(new(ELeave)CExampleInterfaceDtorTransition(*iUTContext,*iDtorValidator)); |
|
316 } |
|
317 |
|
318 // ______________________________________________________________________________ |
|
319 // |
|
320 _LIT(KExampleInterfaceDefectCUO4YCEUEUnitTest,"CExampleInterface_DefectCUO4YCEUE_UnitTest"); |
|
321 |
|
322 CExampleInterface_DefectCUO4YCEUE_UnitTest* CExampleInterface_DefectCUO4YCEUE_UnitTest::NewL(CDataLogger& aDataLogger, |
|
323 MUnitTestObserver& aObserver) |
|
324 { |
|
325 CExampleInterface_DefectCUO4YCEUE_UnitTest* self = |
|
326 new(ELeave) CExampleInterface_DefectCUO4YCEUE_UnitTest(aDataLogger, |
|
327 aObserver); |
|
328 CleanupStack::PushL(self); |
|
329 self->ConstructL(); |
|
330 CleanupStack::Pop(self); |
|
331 return self; |
|
332 } |
|
333 |
|
334 inline TInt CExampleInterface_DefectCUO4YCEUE_UnitTest::RunError(TInt aError) |
|
335 { |
|
336 // The RunL left so chain to the base first and then cleanup |
|
337 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
338 delete iUTContext; |
|
339 delete iStateAccessor; |
|
340 |
|
341 delete iCtorValidator; |
|
342 delete iDtorValidator; |
|
343 |
|
344 return error; |
|
345 } |
|
346 |
|
347 inline CExampleInterface_DefectCUO4YCEUE_UnitTest::~CExampleInterface_DefectCUO4YCEUE_UnitTest() |
|
348 { |
|
349 // Simply delete our test class instance |
|
350 delete iUTContext; |
|
351 delete iStateAccessor; |
|
352 |
|
353 delete iCtorValidator; |
|
354 delete iDtorValidator; |
|
355 } |
|
356 |
|
357 inline CExampleInterface_DefectCUO4YCEUE_UnitTest::CExampleInterface_DefectCUO4YCEUE_UnitTest(CDataLogger& aDataLogger, |
|
358 MUnitTestObserver& aObserver) |
|
359 : CUnitTest(KExampleInterfaceDefectCUO4YCEUEUnitTest, aDataLogger, aObserver) |
|
360 { |
|
361 //Do nothing |
|
362 } |
|
363 |
|
364 // Now the Individual transitions need to be added. |
|
365 inline void CExampleInterface_DefectCUO4YCEUE_UnitTest::ConstructL() |
|
366 { |
|
367 // Perform the base class initialization |
|
368 UnitTestConstructL(); |
|
369 |
|
370 // Create the Unit test state accessor |
|
371 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor; |
|
372 // Construct the Unit test context. |
|
373 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
374 |
|
375 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
376 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
377 |
|
378 AddTransitionL(new(ELeave)CExampleInterfaceDoubleNewLTransition(*iUTContext,*iCtorValidator)); |
|
379 AddTransitionL(new(ELeave)CExampleInterfaceDoubleDtorTransition(*iUTContext,*iDtorValidator)); |
|
380 } |
|
381 |
|
382 // ______________________________________________________________________________ |
|
383 // |
|
384 _LIT(KExampleInterfaceDefectEVS4Z9BPGUnitTest,"CExampleInterface_DefectEVS4Z9BPG_UnitTest"); |
|
385 |
|
386 CExampleInterface_DefectEVS4Z9BPG_UnitTest* CExampleInterface_DefectEVS4Z9BPG_UnitTest::NewL(CDataLogger& aDataLogger, |
|
387 MUnitTestObserver& aObserver) |
|
388 { |
|
389 CExampleInterface_DefectEVS4Z9BPG_UnitTest* self = |
|
390 new(ELeave) CExampleInterface_DefectEVS4Z9BPG_UnitTest(aDataLogger, |
|
391 aObserver); |
|
392 CleanupStack::PushL(self); |
|
393 self->ConstructL(); |
|
394 CleanupStack::Pop(self); |
|
395 return self; |
|
396 } |
|
397 |
|
398 inline TInt CExampleInterface_DefectEVS4Z9BPG_UnitTest::RunError(TInt aError) |
|
399 { |
|
400 // The RunL left so chain to the base first and then cleanup |
|
401 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
402 delete iUTContext; |
|
403 delete iStateAccessor; |
|
404 |
|
405 delete iCtorValidator; |
|
406 delete iDefaultValidator; |
|
407 delete iDtorValidator; |
|
408 |
|
409 return error; |
|
410 } |
|
411 |
|
412 inline CExampleInterface_DefectEVS4Z9BPG_UnitTest::~CExampleInterface_DefectEVS4Z9BPG_UnitTest() |
|
413 { |
|
414 // Simply delete our test class instance |
|
415 delete iUTContext; |
|
416 delete iStateAccessor; |
|
417 |
|
418 delete iCtorValidator; |
|
419 delete iDefaultValidator; |
|
420 delete iDtorValidator; |
|
421 } |
|
422 |
|
423 inline CExampleInterface_DefectEVS4Z9BPG_UnitTest::CExampleInterface_DefectEVS4Z9BPG_UnitTest(CDataLogger& aDataLogger, |
|
424 MUnitTestObserver& aObserver) |
|
425 : CUnitTest(KExampleInterfaceDefectEVS4Z9BPGUnitTest, aDataLogger, aObserver) |
|
426 { |
|
427 //Do nothing |
|
428 } |
|
429 |
|
430 // Now the Individual transitions need to be added. |
|
431 inline void CExampleInterface_DefectEVS4Z9BPG_UnitTest::ConstructL() |
|
432 { |
|
433 // Perform the base class initialization |
|
434 UnitTestConstructL(); |
|
435 |
|
436 // Create the Unit test state accessor |
|
437 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor; |
|
438 // Construct the Unit test context. |
|
439 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
440 |
|
441 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
442 iDefaultValidator = new(ELeave) TExampleInterface_Default_TransitionValidator(*iUTContext); |
|
443 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
444 |
|
445 AddTransitionL(new(ELeave)CExampleInterfaceDoubleNewLTransition(*iUTContext,*iCtorValidator)); |
|
446 AddTransitionL(new(ELeave)CExampleInterfaceDoMethodLTransition(*iUTContext,*iDefaultValidator)); |
|
447 AddTransitionL(new(ELeave)CExampleInterfaceDoubleDtorTransition(*iUTContext,*iDtorValidator)); |
|
448 } |
|
449 |
|
450 // ______________________________________________________________________________ |
|
451 // |
|
452 _LIT(KExampleInterfaceDefectKRN53SL4QUnitTest,"CExampleInterface_DefectKRN53SL4Q_UnitTest"); |
|
453 |
|
454 CExampleInterface_DefectKRN53SL4Q_UnitTest* CExampleInterface_DefectKRN53SL4Q_UnitTest::NewL(CDataLogger& aDataLogger, |
|
455 MUnitTestObserver& aObserver) |
|
456 { |
|
457 CExampleInterface_DefectKRN53SL4Q_UnitTest* self = |
|
458 new(ELeave) CExampleInterface_DefectKRN53SL4Q_UnitTest(aDataLogger, |
|
459 aObserver); |
|
460 CleanupStack::PushL(self); |
|
461 self->ConstructL(); |
|
462 CleanupStack::Pop(self); |
|
463 return self; |
|
464 } |
|
465 |
|
466 inline TInt CExampleInterface_DefectKRN53SL4Q_UnitTest::RunError(TInt aError) |
|
467 { |
|
468 // The RunL left so chain to the base first and then cleanup |
|
469 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
470 delete iUTContext; |
|
471 delete iStateAccessor; |
|
472 |
|
473 delete iCtorValidator; |
|
474 delete iDefaultValidator; |
|
475 delete iDtorValidator; |
|
476 |
|
477 return error; |
|
478 } |
|
479 |
|
480 inline CExampleInterface_DefectKRN53SL4Q_UnitTest::~CExampleInterface_DefectKRN53SL4Q_UnitTest() |
|
481 { |
|
482 // Simply delete our test class instance |
|
483 delete iUTContext; |
|
484 delete iStateAccessor; |
|
485 |
|
486 delete iCtorValidator; |
|
487 delete iDefaultValidator; |
|
488 delete iDtorValidator; |
|
489 } |
|
490 |
|
491 inline CExampleInterface_DefectKRN53SL4Q_UnitTest::CExampleInterface_DefectKRN53SL4Q_UnitTest(CDataLogger& aDataLogger, |
|
492 MUnitTestObserver& aObserver) |
|
493 : CUnitTest(KExampleInterfaceDefectKRN53SL4QUnitTest, aDataLogger, aObserver) |
|
494 { |
|
495 //Do nothing |
|
496 } |
|
497 |
|
498 TInt ThreadFunc(TAny* aTrapHandler) |
|
499 { |
|
500 User::SetTrapHandler(REINTERPRET_CAST(TCleanupTrapHandler*, aTrapHandler)); |
|
501 |
|
502 RImplInfoPtrArray implementations; |
|
503 TRAPD(error, CExampleInterface::ListImplementationsL(implementations)); |
|
504 UNUSED_VAR(error); |
|
505 return KErrNone; |
|
506 } |
|
507 |
|
508 // Now the Individual transitions need to be added. |
|
509 inline void CExampleInterface_DefectKRN53SL4Q_UnitTest::ConstructL() |
|
510 { |
|
511 // Perform the base class initialization |
|
512 UnitTestConstructL(); |
|
513 |
|
514 // Create the Unit test state accessor |
|
515 iStateAccessor = new(ELeave) TExampleInterface_StateAccessor; |
|
516 // Construct the Unit test context. |
|
517 iUTContext = new(ELeave) CExampleInterface_UnitTestContext(iDataLogger, *iStateAccessor, *this); |
|
518 |
|
519 _LIT(KNewThreadName, "ListImpl"); |
|
520 User::Leave (KErrNone != iUTContext->iListImplThread.Create(KNewThreadName(), // The name of the thread |
|
521 ThreadFunc, //CExampleInterface_UnitTestContext::ListImplementationsThreadFunction, // The function to be called when this thread resumes |
|
522 2048, // The stacksize for this thread |
|
523 2048, // min heap size |
|
524 2048, // max heap size |
|
525 User::TrapHandler())); // Parameter to be passed to function |
|
526 |
|
527 |
|
528 iCtorValidator = new(ELeave) TExampleInterface_Ctor_TransitionValidator(*iUTContext); |
|
529 iDefaultValidator = new(ELeave) TExampleInterface_Default_TransitionValidator(*iUTContext); |
|
530 iDtorValidator = new(ELeave) TExampleInterface_Dtor_TransitionValidator(*iUTContext); |
|
531 |
|
532 AddTransitionL(new(ELeave)CExampleInterfaceNewLTransition(*iUTContext,*iCtorValidator)); |
|
533 AddTransitionL(new(ELeave)CExampleInterfaceListImplementationsLNewThreadTransition(*iUTContext,*iDefaultValidator)); |
|
534 AddBlockingTransitionL(new(ELeave)CExampleInterfaceDtorTransition(*iUTContext,*iDtorValidator)); |
|
535 } |
|
536 |