2
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: This file contains the header file of the
|
|
15 |
* CTestModuleBase and CTestModuleIf classes. Test Module inherits
|
|
16 |
* the CTestModuleBase and uses the CTestModuleIf for printing
|
|
17 |
* to user interface and event system control.
|
|
18 |
*
|
|
19 |
* The initialization of this interface must be done from the Test Module Server with:
|
|
20 |
* CTestModuleXXX *mod = new CTestModuleXXX;
|
|
21 |
* RThread thread;
|
|
22 |
* CTestModuleIf::NewL( this, (CTestModuleBase*) mod, thread.Id() );
|
|
23 |
*
|
|
24 |
* CTestModuleIf is deleted by destructor of the CTestModuleBase.
|
|
25 |
*
|
|
26 |
*/
|
|
27 |
|
|
28 |
#ifndef TESTMODULE_H
|
|
29 |
#define TESTMODULE_H
|
|
30 |
|
|
31 |
// INCLUDES
|
|
32 |
#include <e32std.h>
|
|
33 |
#include <e32base.h>
|
|
34 |
#include "StifCommand.h"
|
|
35 |
|
|
36 |
// CONSTANTS
|
|
37 |
|
|
38 |
// Define Old Test Module API version - API that doesn't support version of test module
|
|
39 |
const TInt KOldTestModuleAPIMajor = 1;
|
|
40 |
const TInt KOldTestModuleAPIMinor = 1;
|
|
41 |
const TInt KOldTestModuleAPIBuild = 0;
|
|
42 |
|
|
43 |
// Define Test Module API version
|
|
44 |
const TInt KTestModuleAPIMajor = 1;
|
|
45 |
const TInt KTestModuleAPIMinor = 2;
|
|
46 |
const TInt KTestModuleAPIBuild = 0;
|
|
47 |
const TInt KStifMaxResultDes = 128; // Maximum test result description length
|
|
48 |
|
|
49 |
// Max array value for STIF macros allow result.
|
|
50 |
const TInt KSTIFMacroResultArraySize = 10;
|
|
51 |
|
|
52 |
// Test module def-file check when setting parameters.
|
|
53 |
const TUint32 KStifTestModuleParameterChanged = 0xdeadbeef;
|
|
54 |
|
|
55 |
// MACROS
|
|
56 |
// Test result description. Maximum length is 128 characters.
|
|
57 |
typedef TBuf<KStifMaxResultDes> TResultDes;
|
|
58 |
|
|
59 |
// Macro for boolean.
|
|
60 |
#ifdef TL
|
|
61 |
#pragma message( "============================================================" )
|
|
62 |
#pragma message( " TL macro is already defined, now using STIF TF's TL macro" )
|
|
63 |
#pragma message( "============================================================" )
|
|
64 |
#undef TL
|
|
65 |
#endif
|
|
66 |
// Macro for integer and one expected result.
|
|
67 |
#ifdef T1L
|
|
68 |
#pragma message( "==============================================================" )
|
|
69 |
#pragma message( " T1L macro is already defined, now using STIF TF's T1L macro" )
|
|
70 |
#pragma message( "==============================================================" )
|
|
71 |
#undef T1L
|
|
72 |
#endif
|
|
73 |
// Macro for integer and two expected result.
|
|
74 |
#ifdef T2L
|
|
75 |
#pragma message( "==============================================================" )
|
|
76 |
#pragma message( " T2L macro is already defined, now using STIF TF's T2L macro" )
|
|
77 |
#pragma message( "==============================================================" )
|
|
78 |
#undef T2L
|
|
79 |
#endif
|
|
80 |
// Macro for integer and three expected result.
|
|
81 |
#ifdef T3L
|
|
82 |
#pragma message( "==============================================================" )
|
|
83 |
#pragma message( " T3L macro is already defined, now using STIF TF's T3L macro" )
|
|
84 |
#pragma message( "==============================================================" )
|
|
85 |
#undef T3L
|
|
86 |
#endif
|
|
87 |
// Macro for integer and four expected result.
|
|
88 |
#ifdef T4L
|
|
89 |
#pragma message( "==============================================================" )
|
|
90 |
#pragma message( " T4L macro is already defined, now using STIF TF's T4L macro" )
|
|
91 |
#pragma message( "==============================================================" )
|
|
92 |
#undef T4L
|
|
93 |
#endif
|
|
94 |
// Macro for integer and five expected result.
|
|
95 |
#ifdef T5L
|
|
96 |
#pragma message( "==============================================================" )
|
|
97 |
#pragma message( " T5L macro is already defined, now using STIF TF's T5L macro" )
|
|
98 |
#pragma message( "==============================================================" )
|
|
99 |
#undef T5L
|
|
100 |
#endif
|
|
101 |
|
|
102 |
// Macro for boolean. Recommended use with TestScripter's test class.
|
|
103 |
#ifdef TAL
|
|
104 |
#pragma message( "==============================================================" )
|
|
105 |
#pragma message( " TAL macro is already defined, now using STIF TF's TAL macro" )
|
|
106 |
#pragma message( "==============================================================" )
|
|
107 |
#undef TAL
|
|
108 |
#endif
|
|
109 |
// Macro for integer and one expected result. Recommended use with TestScripter's test
|
|
110 |
// class.
|
|
111 |
#ifdef TA1L
|
|
112 |
#pragma message( "================================================================" )
|
|
113 |
#pragma message( " TA1L macro is already defined, now using STIF TF's TA1L macro" )
|
|
114 |
#pragma message( "================================================================" )
|
|
115 |
#undef TA1L
|
|
116 |
#endif
|
|
117 |
// Macro for integer and two expected result. Recommended use with TestScripter's test
|
|
118 |
// class.
|
|
119 |
#ifdef TA2L
|
|
120 |
#pragma message( "================================================================" )
|
|
121 |
#pragma message( " TA2L macro is already defined, now using STIF TF's TA2L macro" )
|
|
122 |
#pragma message( "================================================================" )
|
|
123 |
#undef TA2L
|
|
124 |
#endif
|
|
125 |
// Macro for integer and three expected result. Recommended use with TestScripter's test
|
|
126 |
// class.
|
|
127 |
#ifdef TA3L
|
|
128 |
#pragma message( "================================================================" )
|
|
129 |
#pragma message( " TA3L macro is already defined, now using STIF TF's TA3L macro" )
|
|
130 |
#pragma message( "================================================================" )
|
|
131 |
#undef TA3L
|
|
132 |
#endif
|
|
133 |
// Macro for integer and four expected result. Recommended use with TestScripter's test
|
|
134 |
// class.
|
|
135 |
#ifdef TA4L
|
|
136 |
#pragma message( "================================================================" )
|
|
137 |
#pragma message( " TA4L macro is already defined, now using STIF TF's TA4L macro" )
|
|
138 |
#pragma message( "================================================================" )
|
|
139 |
#undef TA4L
|
|
140 |
#endif
|
|
141 |
// Macro for integer and five expected result. Recommended use with TestScripter's test
|
|
142 |
// class.
|
|
143 |
#ifdef TA5L
|
|
144 |
#pragma message( "================================================================" )
|
|
145 |
#pragma message( " TA5L macro is already defined, now using STIF TF's TA5L macro" )
|
|
146 |
#pragma message( "================================================================" )
|
|
147 |
#undef TA5L
|
|
148 |
#endif
|
|
149 |
|
|
150 |
|
|
151 |
// TL ========================================================================
|
|
152 |
// Macro for verify boolean value.
|
|
153 |
// Example for use, 1: TL( Open() == KErrNone );
|
|
154 |
// 1: TL( VerifyString1() == VerifyString2() );
|
|
155 |
// 2: TL( 6 <= 8 );
|
|
156 |
// ===========================================================================
|
|
157 |
#define TL( aIsTrue )\
|
|
158 |
if( (!(aIsTrue)) )\
|
|
159 |
{ TestModuleIf().StifMacroError( (0), (TText8*)__FILE__, __FUNCTION__, __LINE__ );\
|
|
160 |
User::Leave( KErrArgument ); };
|
|
161 |
|
|
162 |
// T1L =======================================================================
|
|
163 |
// Macro for verify integer value from the expected 1 value.
|
|
164 |
// Example: T1L( Open(), KErrNone );
|
|
165 |
// ===========================================================================
|
|
166 |
#define T1L( aResult, aExpected1 )\
|
|
167 |
{\
|
|
168 |
TInt result = aResult;\
|
|
169 |
if( ( (result) != (aExpected1) ) )\
|
|
170 |
{ TestModuleIf().StifMacroError(\
|
|
171 |
(1), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1) );\
|
|
172 |
User::Leave( KErrArgument ); };\
|
|
173 |
};
|
|
174 |
|
|
175 |
// T2L =======================================================================
|
|
176 |
// Macro for verify integer value from the expected 1 and 2 values.
|
|
177 |
// Example for use: T1L( Open(), KErrNone, KErrAlreadyExists );
|
|
178 |
// ===========================================================================
|
|
179 |
#define T2L( aResult, aExpected1, aExpected2 )\
|
|
180 |
{\
|
|
181 |
TInt result = aResult;\
|
|
182 |
if( ( (result) != (aExpected1) && (result) != (aExpected2) ) )\
|
|
183 |
{ TestModuleIf().StifMacroError(\
|
|
184 |
(2), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2) );\
|
|
185 |
User::Leave( KErrArgument ); };\
|
|
186 |
};
|
|
187 |
|
|
188 |
// T3L =======================================================================
|
|
189 |
// Macro for verify integer value from the expected 1, 2 and 3 values.
|
|
190 |
// Example for use: T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull );
|
|
191 |
// ===========================================================================
|
|
192 |
#define T3L( aResult, aExpected1, aExpected2, aExpected3 )\
|
|
193 |
{\
|
|
194 |
TInt result = aResult;\
|
|
195 |
if( ( (result) != (aExpected1) && (result) != (aExpected2) && (result) != (aExpected3) ) )\
|
|
196 |
{ TestModuleIf().StifMacroError(\
|
|
197 |
(3), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2), (aExpected3) );\
|
|
198 |
User::Leave( KErrArgument ); };\
|
|
199 |
};
|
|
200 |
|
|
201 |
// T4L =======================================================================
|
|
202 |
// Macro for verify integer value from the expected 1, 2, 3 and 4 values.
|
|
203 |
// Example for use:
|
|
204 |
// T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull, KErrDisconnected );
|
|
205 |
// ===========================================================================
|
|
206 |
#define T4L( aResult, aExpected1, aExpected2, aExpected3, aExpected4 )\
|
|
207 |
{\
|
|
208 |
TInt result = aResult;\
|
|
209 |
if( ( (result) != (aExpected1) && \
|
|
210 |
(result) != (aExpected2) && \
|
|
211 |
(result) != (aExpected3) && \
|
|
212 |
(result) != (aExpected4) ) )\
|
|
213 |
{ TestModuleIf().StifMacroError(\
|
|
214 |
(4), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
|
|
215 |
(aExpected1), (aExpected2), (aExpected3), (aExpected4) );\
|
|
216 |
User::Leave( KErrArgument ); };\
|
|
217 |
};
|
|
218 |
|
|
219 |
// T5L =======================================================================
|
|
220 |
// Macro for verify integer value from the expected 1, 2, 3, 4 and 5 values.
|
|
221 |
// Example for use:
|
|
222 |
// T1L( Open(), KErrNone, KErrDied, KErrInUse, KErrDisconnected, KErrAbort );
|
|
223 |
// ===========================================================================
|
|
224 |
#define T5L( aResult, aExpected1, aExpected2, aExpected3, aExpected4, aExpected5 )\
|
|
225 |
{\
|
|
226 |
TInt result = aResult;\
|
|
227 |
if( ( (result) != (aExpected1) && \
|
|
228 |
(result) != (aExpected2) && \
|
|
229 |
(result) != (aExpected3) && \
|
|
230 |
(result) != (aExpected4) && \
|
|
231 |
(result) != (aExpected5) ) )\
|
|
232 |
{ TestModuleIf().StifMacroError(\
|
|
233 |
(5), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
|
|
234 |
(aExpected1), (aExpected2), (aExpected3), (aExpected4), (aExpected5) );\
|
|
235 |
User::Leave( KErrArgument ); };\
|
|
236 |
};
|
|
237 |
|
|
238 |
|
|
239 |
// TAL ========================================================================
|
|
240 |
// Macro for verify boolean value.
|
|
241 |
// Recommended use with TestScripter's test class. Allowed result can be defined
|
|
242 |
// with 'allownextresult' and 'allowerrorcodes' keywords.
|
|
243 |
// Example for use, 1: TL( Open() == KErrNone );
|
|
244 |
// 1: TL( VerifyString1() == VerifyString2() );
|
|
245 |
// 2: TL( 6 <= 8 );
|
|
246 |
// =============================================================================
|
|
247 |
#define TAL( aIsTrue )\
|
|
248 |
if( ( !(aIsTrue) ) && TestModuleIf().CheckAllowResult( 0 /* = EFalse*/ ) )\
|
|
249 |
{ TestModuleIf().StifMacroError( (0), (TText8*)__FILE__, __FUNCTION__, __LINE__ );\
|
|
250 |
User::Leave( KErrArgument ); };
|
|
251 |
|
|
252 |
// TA1L =======================================================================
|
|
253 |
// Macro for verify integer value from the expected 1 value.
|
|
254 |
// Recommended use with TestScripter's test class. Allowed result can be defined
|
|
255 |
// with 'allownextresult' and 'allowerrorcodes' keywords.
|
|
256 |
// Example: T1L( Open(), KErrNone );
|
|
257 |
// =============================================================================
|
|
258 |
#define TA1L( aResult, aExpected1 )\
|
|
259 |
{\
|
|
260 |
TInt result = aResult;\
|
|
261 |
if( ( (result) != (aExpected1) ) && \
|
|
262 |
TestModuleIf().CheckAllowResult( result ) ) \
|
|
263 |
{ TestModuleIf().StifMacroError(\
|
|
264 |
(1), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1) );\
|
|
265 |
User::Leave( KErrArgument ); };\
|
|
266 |
};
|
|
267 |
|
|
268 |
// TA2L =======================================================================
|
|
269 |
// Macro for verify integer value from the expected 1 and 2 values.
|
|
270 |
// Recommended use with TestScripter's test class. Allowed result can be defined
|
|
271 |
// with 'allownextresult' and 'allowerrorcodes' keywords.
|
|
272 |
// Example for use: T1L( Open(), KErrNone, KErrAlreadyExists );
|
|
273 |
// =============================================================================
|
|
274 |
#define TA2L( aResult, aExpected1, aExpected2 )\
|
|
275 |
{\
|
|
276 |
TInt result = aResult;\
|
|
277 |
if( ( (result) != (aExpected1) && (result) != (aExpected2) ) && \
|
|
278 |
TestModuleIf().CheckAllowResult( result ) ) \
|
|
279 |
{ TestModuleIf().StifMacroError(\
|
|
280 |
(2), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2) );\
|
|
281 |
User::Leave( KErrArgument ); };\
|
|
282 |
};
|
|
283 |
|
|
284 |
// TA3L =======================================================================
|
|
285 |
// Macro for verify integer value from the expected 1, 2 and 3 values.
|
|
286 |
// Recommended use with TestScripter's test class. Allowed result can be defined
|
|
287 |
// with 'allownextresult' and 'allowerrorcodes' keywords.
|
|
288 |
// Example for use: T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull );
|
|
289 |
// =============================================================================
|
|
290 |
#define TA3L( aResult, aExpected1, aExpected2, aExpected3 )\
|
|
291 |
{\
|
|
292 |
TInt result = aResult;\
|
|
293 |
if( ( (result) != (aExpected1) && (result) != (aExpected2) && (result) != (aExpected3) ) && \
|
|
294 |
TestModuleIf().CheckAllowResult( result ) )\
|
|
295 |
{ TestModuleIf().StifMacroError(\
|
|
296 |
(3), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), (aExpected1), (aExpected2), (aExpected3) );\
|
|
297 |
User::Leave( KErrArgument ); };\
|
|
298 |
};
|
|
299 |
|
|
300 |
// TA4L =======================================================================
|
|
301 |
// Macro for verify integer value from the expected 1, 2, 3 and 4 values.
|
|
302 |
// Recommended use with TestScripter's test class. Allowed result can be defined
|
|
303 |
// with 'allownextresult' and 'allowerrorcodes' keywords.
|
|
304 |
// Example for use:
|
|
305 |
// T1L( Open(), KErrNone, KErrAlreadyExists, KErrDiskFull, KErrDisconnected );
|
|
306 |
// =============================================================================
|
|
307 |
#define TA4L( aResult, aExpected1, aExpected2, aExpected3, aExpected4 )\
|
|
308 |
{\
|
|
309 |
TInt result = aResult;\
|
|
310 |
if( ( (result) != (aExpected1) && \
|
|
311 |
(result) != (aExpected2) && \
|
|
312 |
(result) != (aExpected3) && \
|
|
313 |
(result) != (aExpected4) ) && \
|
|
314 |
TestModuleIf().CheckAllowResult( result ) ) \
|
|
315 |
{ TestModuleIf().StifMacroError(\
|
|
316 |
(4), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
|
|
317 |
(aExpected1), (aExpected2), (aExpected3), (aExpected4) );\
|
|
318 |
User::Leave( KErrArgument ); };\
|
|
319 |
};
|
|
320 |
|
|
321 |
// TA5L =======================================================================
|
|
322 |
// Macro for verify integer value from the expected 1, 2, 3, 4 and 5 values.
|
|
323 |
// Recommended use with TestScripter's test class. Allowed result can be defined
|
|
324 |
// with 'allownextresult' and 'allowerrorcodes' keywords.
|
|
325 |
// Example for use:
|
|
326 |
// T1L( Open(), KErrNone, KErrDied, KErrInUse, KErrDisconnected, KErrAbort );
|
|
327 |
// =============================================================================
|
|
328 |
#define TA5L( aResult, aExpected1, aExpected2, aExpected3, aExpected4, aExpected5 )\
|
|
329 |
{\
|
|
330 |
TInt result = aResult;\
|
|
331 |
if( ( (result) != (aExpected1) && \
|
|
332 |
(result) != (aExpected2) && \
|
|
333 |
(result) != (aExpected3) && \
|
|
334 |
(result) != (aExpected4) && \
|
|
335 |
(result) != (aExpected5) ) && \
|
|
336 |
TestModuleIf().CheckAllowResult( result ) ) \
|
|
337 |
{ TestModuleIf().StifMacroError(\
|
|
338 |
(5), (TText8*)__FILE__, __FUNCTION__, __LINE__, (result), \
|
|
339 |
(aExpected1), (aExpected2), (aExpected3), (aExpected4), (aExpected5) );\
|
|
340 |
User::Leave( KErrArgument ); };\
|
|
341 |
};
|
|
342 |
|
|
343 |
|
|
344 |
// Workaround for ARM RVCT compiler error. This added because if some
|
|
345 |
// environment do not include this definition.
|
|
346 |
#if !defined (NONSHARABLE_CLASS)
|
|
347 |
#define NONSHARABLE_CLASS(x) class x
|
|
348 |
#endif
|
|
349 |
|
|
350 |
// DATA TYPES
|
|
351 |
// None
|
|
352 |
|
|
353 |
// FUNCTION PROTOTYPES
|
|
354 |
// None
|
|
355 |
|
|
356 |
// FORWARD DECLARATIONS
|
|
357 |
class CTestModuleBase;
|
|
358 |
class TEventIf;
|
|
359 |
class CTestThreadContainer;
|
|
360 |
class MSTIFTestInterference;
|
|
361 |
class CSTIFTestMeasurement;
|
|
362 |
class CSTIFTestMeasurementImplementation;
|
|
363 |
class CUiEnvProxy;
|
|
364 |
|
|
365 |
// CLASS DECLARATION
|
|
366 |
|
|
367 |
// DESCRIPTION
|
|
368 |
// Base class for test case measurement . User can start measurement operations
|
|
369 |
// via this class.
|
|
370 |
NONSHARABLE_CLASS( CSTIFTestMeasurement )
|
|
371 |
:public CBase
|
|
372 |
{
|
|
373 |
public: // Enumerations
|
|
374 |
|
|
375 |
/**
|
|
376 |
* Enumeration for different measurement types.
|
|
377 |
*/
|
|
378 |
enum TSTIFMeasurementType
|
|
379 |
{
|
|
380 |
KStifMeasurementEnableAll,
|
|
381 |
KStifMeasurementPlugin01,
|
|
382 |
KStifMeasurementPlugin02,
|
|
383 |
KStifMeasurementPlugin03,
|
|
384 |
KStifMeasurementPlugin04,
|
|
385 |
KStifMeasurementPlugin05,
|
|
386 |
KStifMeasurementBappeaProfiler,
|
|
387 |
KStifMeasurementDisableAll,
|
|
388 |
};
|
|
389 |
|
|
390 |
/**
|
|
391 |
* Enumeration for different measurement operations.
|
|
392 |
*/
|
|
393 |
enum TSTIFMeasurementOperation
|
|
394 |
{
|
|
395 |
KMeasurementNew,
|
|
396 |
KMeasurementStart,
|
|
397 |
KMeasurementStop,
|
|
398 |
};
|
|
399 |
|
|
400 |
/**
|
|
401 |
* Struct for measurement.
|
|
402 |
*/
|
|
403 |
struct TStifMeasurementStruct
|
|
404 |
{
|
|
405 |
TSTIFMeasurementType iMeasurementType;
|
|
406 |
TFileName iConfigurationInfo;
|
|
407 |
TSTIFMeasurementOperation iMeasurementOperation;
|
|
408 |
TInt iOperationResult;
|
|
409 |
CTestModuleBase* iPointerToMeasurementModule;
|
|
410 |
};
|
|
411 |
|
|
412 |
private: // Enumerations
|
|
413 |
|
|
414 |
public: // Constructors and destructor
|
|
415 |
|
|
416 |
/**
|
|
417 |
* Two-phased constructor. Intializes test measurement module.
|
|
418 |
*/
|
|
419 |
IMPORT_C static CSTIFTestMeasurement* NewL(
|
|
420 |
CTestModuleBase* aTestModuleBase,
|
|
421 |
TSTIFMeasurementType aType,
|
|
422 |
const TDesC& aConfigurationInfo );
|
|
423 |
|
|
424 |
public: // New functions
|
|
425 |
|
|
426 |
/**
|
|
427 |
* Start commant for test measurement module.
|
|
428 |
* Returns Symbian error code.
|
|
429 |
*/
|
|
430 |
IMPORT_C TInt Start();
|
|
431 |
|
|
432 |
/**
|
|
433 |
* Stop command for test measurement module.
|
|
434 |
* Returns Symbian error code.
|
|
435 |
*/
|
|
436 |
IMPORT_C TInt Stop();
|
|
437 |
|
|
438 |
public: // Functions from base classes
|
|
439 |
|
|
440 |
/**
|
|
441 |
* Destructor
|
|
442 |
*/
|
|
443 |
virtual ~CSTIFTestMeasurement();
|
|
444 |
|
|
445 |
protected: // New functions
|
|
446 |
|
|
447 |
protected: // Functions from base classes
|
|
448 |
|
|
449 |
private:
|
|
450 |
|
|
451 |
/**
|
|
452 |
* C++ default constructor.
|
|
453 |
*/
|
|
454 |
CSTIFTestMeasurement( CTestModuleBase* aTestModuleBase );
|
|
455 |
|
|
456 |
/**
|
|
457 |
* By default Symbian OS constructor is private.
|
|
458 |
*/
|
|
459 |
void ConstructL( TSTIFMeasurementType aType,
|
|
460 |
const TDesC& aConfigurationInfo );
|
|
461 |
|
|
462 |
public: //Data
|
|
463 |
|
|
464 |
protected: // Data
|
|
465 |
|
|
466 |
private: // Data
|
|
467 |
|
|
468 |
// Pointer to STIF side
|
|
469 |
CTestModuleBase* iTestModuleBase;
|
|
470 |
|
|
471 |
// Stuct that includes measurement related information
|
|
472 |
TStifMeasurementStruct iMeasurementStruct;
|
|
473 |
|
|
474 |
// Indicates is measurement disable
|
|
475 |
TInt iMeasurementOption;
|
|
476 |
|
|
477 |
public: // Friend classes
|
|
478 |
|
|
479 |
protected: // Friend classes
|
|
480 |
|
|
481 |
private: // Friend classes
|
|
482 |
friend class CTestModuleBase;
|
|
483 |
|
|
484 |
};
|
|
485 |
|
|
486 |
|
|
487 |
// CLASS DECLARATION
|
|
488 |
|
|
489 |
// DESCRIPTION
|
|
490 |
// TTestResult defines the test case result information.
|
|
491 |
class TTestResult
|
|
492 |
{
|
|
493 |
public:
|
|
494 |
|
|
495 |
/**
|
|
496 |
* Default constructor of TTestResult.
|
|
497 |
*/
|
|
498 |
IMPORT_C TTestResult();
|
|
499 |
|
|
500 |
/**
|
|
501 |
* Sets result and result description of the test case.
|
|
502 |
*/
|
|
503 |
IMPORT_C void SetResult( TInt aResultCode, const TDesC& aResultDes );
|
|
504 |
|
|
505 |
public:
|
|
506 |
|
|
507 |
// Test case result as Symbian OS error code.
|
|
508 |
TInt iResult;
|
|
509 |
// Descriptive test case result.
|
|
510 |
TResultDes iResultDes;
|
|
511 |
};
|
|
512 |
|
|
513 |
// CLASS DECLARATION
|
|
514 |
|
|
515 |
// DESCRIPTION
|
|
516 |
// TTestCaseInfo defines the information for test case execution.
|
|
517 |
class TTestCaseInfo
|
|
518 |
{
|
|
519 |
public:
|
|
520 |
// Default test case priority values
|
|
521 |
enum TPriority
|
|
522 |
{
|
|
523 |
EPriorityLow = -100,
|
|
524 |
EPriorityNormal = 0,
|
|
525 |
EPriorityHigh = 100,
|
|
526 |
};
|
|
527 |
|
|
528 |
public:
|
|
529 |
|
|
530 |
/**
|
|
531 |
* Default constructor of TTestCaseInfo.
|
|
532 |
*/
|
|
533 |
IMPORT_C TTestCaseInfo();
|
|
534 |
|
|
535 |
public:
|
|
536 |
|
|
537 |
// Test case number.
|
|
538 |
TInt iCaseNumber;
|
|
539 |
// Test case title.
|
|
540 |
TName iTitle;
|
|
541 |
// Test Case Timeout ( 0 == No timeout )
|
|
542 |
TTimeIntervalMicroSeconds iTimeout;
|
|
543 |
// Test case priority
|
|
544 |
TInt iPriority;
|
|
545 |
|
|
546 |
};
|
|
547 |
// Packaged TTestCaseInfo
|
|
548 |
typedef TPckg<TTestCaseInfo> TTestCaseInfoPckg;
|
|
549 |
|
|
550 |
// CLASS DECLARATION
|
|
551 |
class CScriptBase;
|
|
552 |
class TScriptObject
|
|
553 |
{
|
|
554 |
public:
|
|
555 |
TName& ObjectId()
|
|
556 |
{
|
|
557 |
return iName;
|
|
558 |
}
|
|
559 |
TScriptObject():
|
|
560 |
iScript(NULL)
|
|
561 |
{
|
|
562 |
}
|
|
563 |
IMPORT_C virtual ~TScriptObject();
|
|
564 |
public:
|
|
565 |
//CScriptBaseProxy iScript;
|
|
566 |
CScriptBase* iScript;
|
|
567 |
protected:
|
|
568 |
TName iName;
|
|
569 |
};
|
|
570 |
// DESCRIPTION
|
|
571 |
// CTestModuleIf provides interface for Test Module to perform
|
|
572 |
// printing to user interface and to control event system.
|
|
573 |
class CTestModuleIf
|
|
574 |
:public CBase
|
|
575 |
{
|
|
576 |
public: // Enumerations
|
|
577 |
|
|
578 |
// Possible test case exit reasons.
|
|
579 |
enum TExitReason
|
|
580 |
{
|
|
581 |
// Case will exit normally AND return test case result.
|
|
582 |
ENormal,
|
|
583 |
// Case is expected to panic.
|
|
584 |
EPanic,
|
|
585 |
// Case will end to exception.
|
|
586 |
EException,
|
|
587 |
};
|
|
588 |
|
|
589 |
enum TRebootType
|
|
590 |
{
|
|
591 |
EDefaultReset = 0, // Do not change the value
|
|
592 |
EKernelReset,
|
|
593 |
|
|
594 |
EDeviceReset0 = 100,
|
|
595 |
EDeviceReset1,
|
|
596 |
EDeviceReset2,
|
|
597 |
EDeviceReset3,
|
|
598 |
EDeviceReset4,
|
|
599 |
EDeviceReset5
|
|
600 |
};
|
|
601 |
|
|
602 |
enum TTestBehavior
|
|
603 |
{
|
|
604 |
ETestLeaksMem = 0x00000001,
|
|
605 |
ETestLeaksRequests = 0x00000002,
|
|
606 |
ETestLeaksHandles = 0x00000004,
|
|
607 |
EOOMDisableLeakChecks = 0x00000008,
|
|
608 |
};
|
|
609 |
|
|
610 |
private: // Enumerations
|
|
611 |
|
|
612 |
public: // Constructors and destructor
|
|
613 |
|
|
614 |
/**
|
|
615 |
* Two-phased constructor.
|
|
616 |
*/
|
|
617 |
IMPORT_C static CTestModuleIf* NewL( CTestThreadContainer* aExecutionSession,
|
|
618 |
CTestModuleBase* aTestModule );
|
|
619 |
|
|
620 |
public: // New functions
|
|
621 |
|
|
622 |
/**
|
|
623 |
* Printf is used to provide different information up to the UI
|
|
624 |
* that can be then printed e.g. to the Console Screen.
|
|
625 |
* The definition of data to be printed is copied to aDefinition.
|
|
626 |
* The aPriority tells how important information is returned.
|
|
627 |
* The priority can be used in the UI to decide if the information
|
|
628 |
* received from the Test Module will be discarded or not in
|
|
629 |
* the different performance situations. The priority is also
|
|
630 |
* used in the Test Module server and in the Test Engine to queue
|
|
631 |
* the Printf responses.
|
|
632 |
* This method is implemented in Test Module Server and the Test Module
|
|
633 |
* can call it to provide printable information to the UI.
|
|
634 |
*/
|
|
635 |
IMPORT_C void Printf( const TInt aPriority,
|
|
636 |
const TDesC& aDefinition,
|
|
637 |
TRefByValue<const TDesC> aFmt,... );
|
|
638 |
|
|
639 |
/**
|
|
640 |
* Event function is used to control and use the event system.
|
|
641 |
* TEvent &aEvent encapsulates the request type and
|
|
642 |
* the event name, see StifTestEventInterface.h for more information.
|
|
643 |
* This method is implemented in Test Module Server and the Test Module
|
|
644 |
* can call it to control the event system.
|
|
645 |
*/
|
|
646 |
IMPORT_C TInt Event( TEventIf& aEvent );
|
|
647 |
|
|
648 |
/**
|
|
649 |
* Asynchronous overload function for the previous. Only one
|
|
650 |
* asynchronous Event call can be active concurrently. Second
|
|
651 |
* concurrent call will block until first one is completed.
|
|
652 |
*/
|
|
653 |
IMPORT_C void Event( TEventIf& aEvent, TRequestStatus& aStatus );
|
|
654 |
|
|
655 |
/**
|
|
656 |
* Cancel asynchronous event command.
|
|
657 |
*/
|
|
658 |
IMPORT_C TInt CancelEvent( TEventIf& aEvent,
|
|
659 |
TRequestStatus* aStatus );
|
|
660 |
|
|
661 |
/**
|
|
662 |
* SetExitReason function is used to set different crash reasons to
|
|
663 |
* acceptable test case result.
|
|
664 |
* Only one exit reason can be set at time. When function is called
|
|
665 |
* again, previous exit reason is removed and new one is set to
|
|
666 |
* acceptable exit reason.
|
|
667 |
*
|
|
668 |
* Function is typically used to accept test case panics as "passed"
|
|
669 |
* test cases.
|
|
670 |
*
|
|
671 |
* Test case that panics or gets exception is set to passed
|
|
672 |
* if aExitReason parameter matches with exit reason and
|
|
673 |
* aExitCode matches with panic code or exception type.
|
|
674 |
*/
|
|
675 |
IMPORT_C void SetExitReason( const CTestModuleIf::TExitReason aExitReason,
|
|
676 |
const TInt aExitCode );
|
|
677 |
|
|
678 |
|
|
679 |
/**
|
|
680 |
* RemoteSend function is used send remote control protocol messages.
|
|
681 |
*/
|
|
682 |
IMPORT_C TInt RemoteSend( const TDesC& aRemoteMsg );
|
|
683 |
|
|
684 |
/**
|
|
685 |
* RemoteReceive function is used receive remote
|
|
686 |
* control protocol messages.
|
|
687 |
*/
|
|
688 |
IMPORT_C void RemoteReceive( TDes& aRemoteMsg,
|
|
689 |
TRequestStatus& aStatus );
|
|
690 |
|
|
691 |
/**
|
|
692 |
* RemoteReceiveCancel function is used cancel
|
|
693 |
* pending RemoteReceive.
|
|
694 |
*/
|
|
695 |
IMPORT_C void RemoteReceiveCancel();
|
|
696 |
|
|
697 |
/**
|
|
698 |
* Reboot device, StoreState MUST have been called.
|
|
699 |
*/
|
|
700 |
IMPORT_C TInt Reboot( TInt aType = EDefaultReset );
|
|
701 |
|
|
702 |
/**
|
|
703 |
* Store state before reboot. MUST be called before calling Reboot().
|
|
704 |
*/
|
|
705 |
IMPORT_C TInt StoreState( TInt aCode, TName& aName );
|
|
706 |
|
|
707 |
/**
|
|
708 |
* Get state after reboot (stored with StoreState).
|
|
709 |
*/
|
|
710 |
IMPORT_C TInt GetStoredState( TInt& aCode, TName& aName );
|
|
711 |
|
|
712 |
/**
|
|
713 |
* Set test case behavior, e.g. allow memory leak, handle leak etc.
|
|
714 |
*/
|
|
715 |
IMPORT_C TInt SetBehavior( TTestBehavior aType, TAny* aPtr=NULL );
|
|
716 |
|
|
717 |
/**
|
|
718 |
* This can be called from test module but it is recommended to use
|
|
719 |
* TL, T1L, T2L or T3L macro instead of this method.
|
|
720 |
* For more information see macro definitions above on this file.
|
|
721 |
*/
|
|
722 |
IMPORT_C TInt StifMacroError( TInt aMacroType,
|
|
723 |
const TText8* aFile,
|
|
724 |
const char* aFunction,
|
|
725 |
TInt aLine,
|
|
726 |
TInt aResult = 0,
|
|
727 |
TInt aExpected1 = 0,
|
|
728 |
TInt aExpected2 = 0,
|
|
729 |
TInt aExpected3 = 0,
|
|
730 |
TInt aExpected4 = 0,
|
|
731 |
TInt aExpected5 = 0 );
|
|
732 |
|
|
733 |
/**
|
|
734 |
* Add thread handle to Array. Via array can handle test interference
|
|
735 |
* thread's kill in panic etc. cases
|
|
736 |
*/
|
|
737 |
TInt AddInterferenceThread( RThread aSTIFTestInterference );
|
|
738 |
|
|
739 |
/**
|
|
740 |
* Remove thread handle from Array.Test interference thread is stopped
|
|
741 |
* and killed successfully
|
|
742 |
*/
|
|
743 |
TInt RemoveInterferenceThread( RThread aSTIFTestInterference );
|
|
744 |
|
|
745 |
/**
|
|
746 |
* With this can be stored information about test measurement
|
|
747 |
* to TestServer space.
|
|
748 |
*/
|
|
749 |
TInt HandleMeasurementProcess( CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo );
|
|
750 |
|
|
751 |
/**
|
|
752 |
* Get measurement option(s) given from initialization file etc.
|
|
753 |
*/
|
|
754 |
IMPORT_C TInt GetMeasurementOptions( TInt& aOptions );
|
|
755 |
|
|
756 |
/**
|
|
757 |
* Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to allow
|
|
758 |
* results.
|
|
759 |
* Set test case allow result given by user. In TestScripter cases allow
|
|
760 |
* result can set by 'allownextresult' or 'allowerrorcodes' keywords. In
|
|
761 |
* Normal and Hardcoded test modules allow result can be set with this
|
|
762 |
* method, reset should be done with ResetAllowResult method.
|
|
763 |
*/
|
|
764 |
IMPORT_C TInt SetAllowResult( TInt aResult );
|
|
765 |
|
|
766 |
/**
|
|
767 |
* This is mainly used by STIF's TAL-TA5L macros internally.
|
|
768 |
* Check is macros result allowed result.
|
|
769 |
*/
|
|
770 |
IMPORT_C TInt CheckAllowResult( TInt aResult );
|
|
771 |
|
|
772 |
/**
|
|
773 |
* Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to reset allowed
|
|
774 |
* results.
|
|
775 |
* Reset allow result(s) given with SetAllowResult. In TestScripter
|
|
776 |
* cases this will be called automatically by STIF. Normal and Hardcoded
|
|
777 |
* cases this should be called by user.
|
|
778 |
*/
|
|
779 |
IMPORT_C TInt ResetAllowResult();
|
|
780 |
|
|
781 |
/**
|
|
782 |
* StopExecution function is used to stop the execution of test case.
|
|
783 |
*/
|
|
784 |
IMPORT_C TInt StopExecution(TStopExecutionType aType, TInt aCode = KErrNone);
|
|
785 |
|
|
786 |
/**
|
|
787 |
* SendTestModuleVersion method is used to pass version of test module
|
|
788 |
* to test engine
|
|
789 |
*/
|
|
790 |
IMPORT_C TInt SendTestModuleVersion(TVersion aVersion, TFileName aModuleName);
|
|
791 |
|
|
792 |
/**
|
|
793 |
* SendTestModuleVersion method is used to pass version of test module
|
|
794 |
* to test engine. This version with 3 parameters were added because version with
|
|
795 |
* 2 parameters has arguments passed by value which is incorrect. So the third argument
|
|
796 |
* was added only to overload the method and enable test modules using "old" version
|
|
797 |
* (with 2 parameters) to work. Only this version (with three parameters) should be used.
|
|
798 |
*/
|
|
799 |
IMPORT_C TInt SendTestModuleVersion(TVersion& aVersion, const TDesC& aModuleName, TBool aNewVersion);
|
|
800 |
|
|
801 |
/**
|
|
802 |
* Command function is used to send command to test engine.
|
|
803 |
* It was created to provide possibility to kill test case by itself.
|
|
804 |
*/
|
|
805 |
TInt Command(TCommand aCommand, const TDesC8& aParamsPckg);
|
|
806 |
|
|
807 |
/**
|
|
808 |
* GetTestCaseTitleL function is used to obtain test case title.
|
|
809 |
*/
|
|
810 |
IMPORT_C void GetTestCaseTitleL(TDes& aTestCaseTitle);
|
|
811 |
|
|
812 |
/**
|
|
813 |
* Checks if testserver supports UI testing
|
|
814 |
*/
|
|
815 |
IMPORT_C TBool UITesting();
|
|
816 |
|
|
817 |
/**
|
|
818 |
* Gets UIEnvProxy
|
|
819 |
*/
|
|
820 |
IMPORT_C CUiEnvProxy* GetUiEnvProxy();
|
|
821 |
|
|
822 |
/**
|
|
823 |
*
|
|
824 |
*/
|
|
825 |
IMPORT_C TBool SeperateProcesses();
|
|
826 |
|
|
827 |
/**
|
|
828 |
* Gets CScriptBase
|
|
829 |
*/
|
|
830 |
IMPORT_C CScriptBase* GetObjFrmCaseDict(const TDesC& aObjectId);
|
|
831 |
|
|
832 |
public: // Functions from base classes
|
|
833 |
|
|
834 |
protected: // New functions
|
|
835 |
|
|
836 |
/**
|
|
837 |
* Get TScriptObject
|
|
838 |
*/
|
|
839 |
IMPORT_C TScriptObject* GetTestObjFromCaseDict(const TDesC& aObjectId) const;
|
|
840 |
|
|
841 |
/*
|
|
842 |
* Delete Test Object
|
|
843 |
*/
|
|
844 |
IMPORT_C void DelTestObjFromCaseDict(const TDesC& aObjectId);
|
|
845 |
|
|
846 |
/**
|
|
847 |
* Add Test Object
|
|
848 |
*/
|
|
849 |
IMPORT_C void AddTestObjToCaseDictL(TScriptObject* aObject);
|
|
850 |
|
|
851 |
protected: // Functions from base classes
|
|
852 |
|
|
853 |
private:
|
|
854 |
|
|
855 |
/**
|
|
856 |
* C++ default constructor.
|
|
857 |
*/
|
|
858 |
CTestModuleIf( CTestThreadContainer* aTestExecution );
|
|
859 |
|
|
860 |
/**
|
|
861 |
* By default Symbian OS constructor is private.
|
|
862 |
*/
|
|
863 |
void ConstructL( CTestModuleBase* aTestModule );
|
|
864 |
|
|
865 |
/**
|
|
866 |
* Destructor is also private.
|
|
867 |
* ONLY friend CTestModuleBase can delete CTestModuleIf.
|
|
868 |
*/
|
|
869 |
~CTestModuleIf();
|
|
870 |
|
|
871 |
/**
|
|
872 |
* Check that server is alive.
|
|
873 |
*/
|
|
874 |
TBool IsServerAlive();
|
|
875 |
|
|
876 |
protected: // Data
|
|
877 |
|
|
878 |
private: // Data
|
|
879 |
CTestThreadContainer* iTestExecution;
|
|
880 |
|
|
881 |
// Indicates is reboot operation ready to start.
|
|
882 |
TBool iIsRebootReady;
|
|
883 |
|
|
884 |
// Indicated StoreState() method's call times.
|
|
885 |
TInt iStoreStateCounter;
|
|
886 |
|
|
887 |
// Test case allowed results. Array is a static one for avoid dynamic
|
|
888 |
// allocations.
|
|
889 |
TInt iTestCaseResults[KSTIFMacroResultArraySize];
|
|
890 |
// Test case allowed results count. This is used with
|
|
891 |
// iTestCaseResults array.
|
|
892 |
TInt iAllowTestCaseResultsCount;
|
|
893 |
|
|
894 |
public: //Data
|
|
895 |
TInt iNumberInGlbDict;
|
|
896 |
public: // Friend classes
|
|
897 |
|
|
898 |
protected: // Friend classes
|
|
899 |
|
|
900 |
private: // Friend classes
|
|
901 |
friend class CTestModuleBase;
|
|
902 |
friend class CTestScripter;
|
|
903 |
|
|
904 |
};
|
|
905 |
|
|
906 |
|
|
907 |
// CLASS DECLARATION
|
|
908 |
|
|
909 |
// DESCRIPTION
|
|
910 |
// Base class for test module parameters. According to parameters may
|
|
911 |
// configure test module. e.g. heap and stack configuring.
|
|
912 |
class CTestModuleParam : public CBase
|
|
913 |
{
|
|
914 |
|
|
915 |
public: // Enumerations
|
|
916 |
|
|
917 |
/**
|
|
918 |
* Evolution version for test module parameters.
|
|
919 |
**/
|
|
920 |
enum TParameterVersio
|
|
921 |
{
|
|
922 |
EVersio1 = 1, // For heap and stack configuring.
|
|
923 |
EVersio2 = 2, // For future needs.
|
|
924 |
EVersio3 = 3, // For future needs.
|
|
925 |
EVersio4 = 4, // For future needs.
|
|
926 |
EVersio5 = 5, // For future needs.
|
|
927 |
|
|
928 |
};
|
|
929 |
|
|
930 |
private: // Enumerations
|
|
931 |
|
|
932 |
public: // Constructors and destructor
|
|
933 |
|
|
934 |
/**
|
|
935 |
* Two-phased constructor.
|
|
936 |
*/
|
|
937 |
//IMPORT_C static CTestModuleParam* NewL();
|
|
938 |
|
|
939 |
/**
|
|
940 |
*
|
|
941 |
*/
|
|
942 |
//IMPORT_C ~CTestModuleParam();
|
|
943 |
|
|
944 |
public: // New functions
|
|
945 |
|
|
946 |
/**
|
|
947 |
*
|
|
948 |
*/
|
|
949 |
virtual TInt Version() = 0;
|
|
950 |
|
|
951 |
public: // Functions from base classes
|
|
952 |
|
|
953 |
protected: // New functions
|
|
954 |
|
|
955 |
protected: // Functions from base classes
|
|
956 |
|
|
957 |
private:
|
|
958 |
|
|
959 |
/**
|
|
960 |
* C++ default constructor.
|
|
961 |
*/
|
|
962 |
//CTestModuleParam();
|
|
963 |
|
|
964 |
/**
|
|
965 |
* By default Symbian OS constructor is private.
|
|
966 |
*/
|
|
967 |
//void ConstructL();
|
|
968 |
|
|
969 |
public: //Data
|
|
970 |
|
|
971 |
protected: // Data
|
|
972 |
|
|
973 |
private: // Data
|
|
974 |
|
|
975 |
public: // Friend classes
|
|
976 |
|
|
977 |
protected: // Friend classes
|
|
978 |
|
|
979 |
private: // Friend classes
|
|
980 |
|
|
981 |
};
|
|
982 |
|
|
983 |
// CLASS DECLARATION
|
|
984 |
|
|
985 |
// DESCRIPTION
|
|
986 |
// CTestModuleParamVer01 implements evolution version 1 for test module's
|
|
987 |
// heap and stack configuring.
|
|
988 |
class CTestModuleParamVer01 : public CTestModuleParam
|
|
989 |
{
|
|
990 |
public: // Enumerations
|
|
991 |
|
|
992 |
private: // Enumerations
|
|
993 |
|
|
994 |
public: // Constructors and destructor
|
|
995 |
|
|
996 |
/**
|
|
997 |
* Two-phased constructor.
|
|
998 |
*/
|
|
999 |
IMPORT_C static CTestModuleParamVer01* NewL();
|
|
1000 |
//IMPORT_C CTestModuleParamVer01* NewL();
|
|
1001 |
|
|
1002 |
/**
|
|
1003 |
* C++ default constructor.
|
|
1004 |
*/
|
|
1005 |
CTestModuleParamVer01();
|
|
1006 |
|
|
1007 |
/**
|
|
1008 |
* Destructor.
|
|
1009 |
*/
|
|
1010 |
IMPORT_C ~CTestModuleParamVer01();
|
|
1011 |
|
|
1012 |
private: // Constructors and destructor
|
|
1013 |
|
|
1014 |
/**
|
|
1015 |
* By default Symbian OS constructor is private.
|
|
1016 |
*/
|
|
1017 |
void ConstructL();
|
|
1018 |
|
|
1019 |
public: // New functions
|
|
1020 |
|
|
1021 |
/**
|
|
1022 |
*
|
|
1023 |
*/
|
|
1024 |
inline TInt Version() { return iVersio; };
|
|
1025 |
|
|
1026 |
public: // Functions from base classes
|
|
1027 |
|
|
1028 |
protected: // New functions
|
|
1029 |
|
|
1030 |
protected: // Functions from base classes
|
|
1031 |
|
|
1032 |
private:
|
|
1033 |
|
|
1034 |
public: // Data
|
|
1035 |
|
|
1036 |
/**
|
|
1037 |
* Test thread stack size defined by user.
|
|
1038 |
**/
|
|
1039 |
TInt iTestThreadStackSize;
|
|
1040 |
|
|
1041 |
/**
|
|
1042 |
* Test thread heap minimum size defined by user.
|
|
1043 |
**/
|
|
1044 |
TInt iTestThreadMinHeap;
|
|
1045 |
|
|
1046 |
/**
|
|
1047 |
* Test thread heap maximum size defined by user.
|
|
1048 |
**/
|
|
1049 |
TInt iTestThreadMaxHeap;
|
|
1050 |
|
|
1051 |
protected: // Data
|
|
1052 |
|
|
1053 |
private: // Data
|
|
1054 |
|
|
1055 |
/**
|
|
1056 |
*
|
|
1057 |
**/
|
|
1058 |
TInt iVersio;
|
|
1059 |
|
|
1060 |
public: // Friend classes
|
|
1061 |
|
|
1062 |
protected: // Friend classes
|
|
1063 |
|
|
1064 |
private: // Friend classes
|
|
1065 |
|
|
1066 |
};
|
|
1067 |
|
|
1068 |
// CLASS DECLARATION
|
|
1069 |
|
|
1070 |
// DESCRIPTION
|
|
1071 |
// Test Module inherits the CTestModuleBase class that is used to provide
|
|
1072 |
// simple interface between Test Engine and Test Module. CTestModuleBase
|
|
1073 |
// consists of pure virtual methods that the Test Module shall implement
|
|
1074 |
// and virtual methods that the Test Module should implement.
|
|
1075 |
class CTestModuleBase
|
|
1076 |
:public CBase
|
|
1077 |
{
|
|
1078 |
public: // Enumerations
|
|
1079 |
|
|
1080 |
// For OOM execution
|
|
1081 |
enum TOOMFailureType
|
|
1082 |
{
|
|
1083 |
EFailNext
|
|
1084 |
};
|
|
1085 |
private: // Enumerations
|
|
1086 |
|
|
1087 |
public: // Version query.
|
|
1088 |
|
|
1089 |
/**
|
|
1090 |
* Returns the API version which this test module complies.
|
|
1091 |
* Test Framework uses this function to verify that loaded module
|
|
1092 |
* can be used in current framework release.
|
|
1093 |
*
|
|
1094 |
* Note that this function must always be the very first function
|
|
1095 |
* that is defined in CTestModuleBase.
|
|
1096 |
*/
|
|
1097 |
virtual inline TVersion Version()
|
|
1098 |
{ return TVersion ( KTestModuleAPIMajor,
|
|
1099 |
KTestModuleAPIMinor,
|
|
1100 |
KTestModuleAPIBuild); }
|
|
1101 |
|
|
1102 |
public: // Constructors and destructor
|
|
1103 |
|
|
1104 |
/**
|
|
1105 |
* C++ default constructor.
|
|
1106 |
*/
|
|
1107 |
CTestModuleBase(): iTestModuleIf(0) {};
|
|
1108 |
|
|
1109 |
/**
|
|
1110 |
* Destructor.
|
|
1111 |
*/
|
|
1112 |
virtual ~CTestModuleBase(){ delete iTestModuleIf; };
|
|
1113 |
|
|
1114 |
public: // New functions
|
|
1115 |
|
|
1116 |
/**
|
|
1117 |
* InitL is used to initialize the Test Module. The Test Modules may
|
|
1118 |
* use the initialization file to read parameters for Test Module
|
|
1119 |
* initialization but they can also have their own configure file or
|
|
1120 |
* some other routine to initialize themselves.
|
|
1121 |
* This method is virtual and it is not mandatory to implement it
|
|
1122 |
* to Test Module.
|
|
1123 |
*/
|
|
1124 |
virtual TInt InitL( TFileName& /* aIniFile */,
|
|
1125 |
TBool /* aFirstTime */ )
|
|
1126 |
{ return KErrNone; };
|
|
1127 |
|
|
1128 |
/**
|
|
1129 |
* Test cases are inquired from the Test Module by calling
|
|
1130 |
* GetTestCasesL. Test cases may be read from the testcase file
|
|
1131 |
* specified by aTestCaseFile or they can be e.g. hardcoded to testmodule.
|
|
1132 |
* If the Test Module does not use testcase files for test case
|
|
1133 |
* definition it does not use aTestCaseFile parameter. Test cases are
|
|
1134 |
* appended to RPointerArray<TTestCaseInfo> that is a list
|
|
1135 |
* consisting of several TTestCaseInfo objects.
|
|
1136 |
* The STIF Test Framework will be the owner of the objects stored to
|
|
1137 |
* RPointerArray after the GetTestCasesL has appended them to the list
|
|
1138 |
* and it does the memory deallocation.
|
|
1139 |
* This method is pure virtual and the Test Module must implement it.
|
|
1140 |
*/
|
|
1141 |
virtual TInt GetTestCasesL( const TFileName& aTestCaseFile,
|
|
1142 |
RPointerArray<TTestCaseInfo>& aTestCases ) = 0;
|
|
1143 |
|
|
1144 |
/**
|
|
1145 |
* RunTestCaseL is used to run an individual test case specified
|
|
1146 |
* by aCaseNumber and aTestCaseFile (optional).
|
|
1147 |
* This method is synchronous and test case result is returned as
|
|
1148 |
* reference parameter aResult value.
|
|
1149 |
* The function shall return KErrNone if case is started succesfully.
|
|
1150 |
* If test case is not available (i.e invalid testcase file or
|
|
1151 |
* or case number), then function shall return KErrNotFound. In other
|
|
1152 |
* error situations another Symbian error code is returned.
|
|
1153 |
* This method is pure virtual and the Test Module must implement it.
|
|
1154 |
*/
|
|
1155 |
virtual TInt RunTestCaseL( const TInt aCaseNumber,
|
|
1156 |
const TFileName& aTestCaseFile,
|
|
1157 |
TTestResult& aResult ) = 0;
|
|
1158 |
|
|
1159 |
/**
|
|
1160 |
* TestModuleIf returns the handle to the CTestModuleIf interface.
|
|
1161 |
* This is an utility function that can be used if the upper layer
|
|
1162 |
* interface is needed to be used.
|
|
1163 |
* This method must not be called from the constructor of Test Module
|
|
1164 |
* that derives the CTestModuleBase.
|
|
1165 |
*/
|
|
1166 |
inline CTestModuleIf& TestModuleIf(){ return *iTestModuleIf; };
|
|
1167 |
|
|
1168 |
/**
|
|
1169 |
* Used to perform the test environment setup for a particular OOM test
|
|
1170 |
* case. The Test Modules may use the initialization file to read parameters
|
|
1171 |
* for Test Module initialization but they can also have their own
|
|
1172 |
* configure file or some other routine to initialize themselves.
|
|
1173 |
*
|
|
1174 |
* This method is virtual and will be implemented if test case is to be
|
|
1175 |
* executed using OOM conditions.
|
|
1176 |
*/
|
|
1177 |
virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */,
|
|
1178 |
const TInt /* aCaseNumber */ ) {};
|
|
1179 |
|
|
1180 |
/**
|
|
1181 |
* Used to perform the test environment cleanup for a particular OOM
|
|
1182 |
* test case.
|
|
1183 |
*
|
|
1184 |
* This method is virtual and will be implemented if test case is to be
|
|
1185 |
* executed using OOM conditions.
|
|
1186 |
*/
|
|
1187 |
virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */,
|
|
1188 |
const TInt /* aCaseNumber */ ) {};
|
|
1189 |
|
|
1190 |
/**
|
|
1191 |
* Used to check if a particular Test Case should be run in OOM
|
|
1192 |
* conditions and which memory allocations should fail.
|
|
1193 |
* Method returns ETrue if test is should run in OOM conditions, EFalse
|
|
1194 |
* otherwise.
|
|
1195 |
*
|
|
1196 |
* This method is virtual and will be implemented if test case is to be
|
|
1197 |
* executed using OOM conditions.
|
|
1198 |
*/
|
|
1199 |
virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */,
|
|
1200 |
const TInt /* aCaseNumber */,
|
|
1201 |
TOOMFailureType& aFailureType,
|
|
1202 |
TInt& /* aFirstMemFailure */,
|
|
1203 |
TInt& /* aLastMemFailure */ )
|
|
1204 |
{
|
|
1205 |
aFailureType = EFailNext;
|
|
1206 |
return EFalse;
|
|
1207 |
};
|
|
1208 |
|
|
1209 |
/**
|
|
1210 |
* Used in OOM testing only. Provides a way to the derived TestModule to
|
|
1211 |
* handle warnings related to non-leaving or TRAPped allocations.
|
|
1212 |
*
|
|
1213 |
* In some cases the allocation should be skipped, either due to problems
|
|
1214 |
* in the OS code or components used by the code being tested, or even
|
|
1215 |
* inside the tested components which are implemented this way on purpose
|
|
1216 |
* (by design), so it is important to give the tester a way to bypass
|
|
1217 |
* allocation failures.
|
|
1218 |
*
|
|
1219 |
* This method is virtual and will be implemented if test case is to be
|
|
1220 |
* executed using OOM conditions.
|
|
1221 |
*/
|
|
1222 |
virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
|
|
1223 |
const TInt /* aCaseNumber */,
|
|
1224 |
TInt& /* aFailNextValue */) {};
|
|
1225 |
|
|
1226 |
public: // Functions from base classes
|
|
1227 |
|
|
1228 |
protected: // New functions
|
|
1229 |
|
|
1230 |
protected: // Functions from base classes
|
|
1231 |
|
|
1232 |
private:
|
|
1233 |
|
|
1234 |
public: // Data
|
|
1235 |
|
|
1236 |
protected: // Data
|
|
1237 |
|
|
1238 |
private: // Data
|
|
1239 |
CTestModuleIf* iTestModuleIf;
|
|
1240 |
|
|
1241 |
public: // Friend classes
|
|
1242 |
|
|
1243 |
protected: // Friend classes
|
|
1244 |
|
|
1245 |
private: // Friend classes
|
|
1246 |
friend class CTestModuleIf;
|
|
1247 |
friend class CTestModuleParam;
|
|
1248 |
friend class MSTIFTestInterference;
|
|
1249 |
friend class CSTIFInterferenceThread;
|
|
1250 |
friend class CSTIFTestMeasurement;
|
|
1251 |
|
|
1252 |
};
|
|
1253 |
|
|
1254 |
#endif // TESTMODULE_H
|
|
1255 |
|
|
1256 |
// End of File
|