|
1 /* |
|
2 * Copyright (c) 2002 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: 3dringingtoneinterface_tests test module. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef _3DRINGINGTONEINTERFACE_TESTS_H |
|
21 #define _3DRINGINGTONEINTERFACE_TESTS_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "StifTestModule.h" |
|
25 #include <StifLogger.h> |
|
26 |
|
27 // CONSTANTS |
|
28 //const ?type ?constant_var = ?constant; |
|
29 |
|
30 // MACROS |
|
31 //#define ?macro ?macro_def |
|
32 |
|
33 // Logging path |
|
34 _LIT( K3dringingtoneinterface_testsLogPath, "\\logs\\testframework\\3dringingtoneinterface_tests\\" ); |
|
35 // Log file |
|
36 _LIT( K3dringingtoneinterface_testsLogFile, "3dringingtoneinterface_tests.txt" ); |
|
37 |
|
38 |
|
39 #define GETPTR & |
|
40 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0} |
|
41 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0} |
|
42 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c} |
|
43 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c} |
|
44 |
|
45 // FUNCTION PROTOTYPES |
|
46 //?type ?function_name(?arg_list); |
|
47 |
|
48 // FORWARD DECLARATIONS |
|
49 //class ?FORWARD_CLASSNAME; |
|
50 class C3dringingtoneinterface_tests; |
|
51 |
|
52 // DATA TYPES |
|
53 //enum ?declaration |
|
54 //typedef ?declaration |
|
55 //extern ?data_type; |
|
56 // A typedef for function that does the actual testing, |
|
57 // function is a type |
|
58 // TInt C3dringingtoneinterface_tests::<NameOfFunction> ( TTestResult& aResult ) |
|
59 typedef TInt (C3dringingtoneinterface_tests::* TestFunction)(TTestResult&); |
|
60 |
|
61 // CLASS DECLARATION |
|
62 |
|
63 /** |
|
64 * An internal structure containing a test case name and |
|
65 * the pointer to function doing the test |
|
66 * |
|
67 * @lib ?library |
|
68 * @since ?Series60_version |
|
69 */ |
|
70 class TCaseInfoInternal |
|
71 { |
|
72 public: |
|
73 const TText* iCaseName; |
|
74 TestFunction iMethod; |
|
75 TBool iIsOOMTest; |
|
76 TInt iFirstMemoryAllocation; |
|
77 TInt iLastMemoryAllocation; |
|
78 }; |
|
79 |
|
80 // CLASS DECLARATION |
|
81 |
|
82 /** |
|
83 * A structure containing a test case name and |
|
84 * the pointer to function doing the test |
|
85 * |
|
86 * @lib ?library |
|
87 * @since ?Series60_version |
|
88 */ |
|
89 class TCaseInfo |
|
90 { |
|
91 public: |
|
92 TPtrC iCaseName; |
|
93 TestFunction iMethod; |
|
94 TBool iIsOOMTest; |
|
95 TInt iFirstMemoryAllocation; |
|
96 TInt iLastMemoryAllocation; |
|
97 |
|
98 TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) |
|
99 { |
|
100 }; |
|
101 |
|
102 }; |
|
103 |
|
104 |
|
105 // CLASS DECLARATION |
|
106 |
|
107 /** |
|
108 * This a 3dringingtoneinterface_tests class. |
|
109 * ?other_description_lines |
|
110 * |
|
111 * @lib ?library |
|
112 * @since ?Series60_version |
|
113 */ |
|
114 NONSHARABLE_CLASS(C3dringingtoneinterface_tests) : public CTestModuleBase |
|
115 { |
|
116 public: // Constructors and destructor |
|
117 |
|
118 |
|
119 /** |
|
120 * Two-phased constructor. |
|
121 */ |
|
122 static C3dringingtoneinterface_tests* NewL(); |
|
123 |
|
124 /** |
|
125 * Destructor. |
|
126 */ |
|
127 virtual ~C3dringingtoneinterface_tests(); |
|
128 |
|
129 public: // New functions |
|
130 |
|
131 /** |
|
132 * ?member_description. |
|
133 * @since ?Series60_version |
|
134 * @param ?arg1 ?description |
|
135 * @return ?description |
|
136 */ |
|
137 //?type ?member_function( ?type ?arg1 ); |
|
138 |
|
139 public: // Functions from base classes |
|
140 |
|
141 /** |
|
142 * From CTestModuleBase InitL is used to initialize the |
|
143 * 3dringingtoneinterface_tests. It is called once for every instance of |
|
144 * TestModule3dringingtoneinterface_tests after its creation. |
|
145 * @since ?Series60_version |
|
146 * @param aIniFile Initialization file for the test module (optional) |
|
147 * @param aFirstTime Flag is true when InitL is executed for first |
|
148 * created instance of 3dringingtoneinterface_tests. |
|
149 * @return Symbian OS error code |
|
150 */ |
|
151 TInt InitL( TFileName& aIniFile, TBool aFirstTime ); |
|
152 |
|
153 /** |
|
154 * From CTestModuleBase GetTestCasesL is used to inquiry test cases |
|
155 * from 3dringingtoneinterface_tests. |
|
156 * @since ?Series60_version |
|
157 * @param aTestCaseFile Test case file (optional) |
|
158 * @param aTestCases Array of TestCases returned to test framework |
|
159 * @return Symbian OS error code |
|
160 */ |
|
161 TInt GetTestCasesL( const TFileName& aTestCaseFile, |
|
162 RPointerArray<TTestCaseInfo>& aTestCases ); |
|
163 |
|
164 /** |
|
165 * From CTestModuleBase RunTestCaseL is used to run an individual |
|
166 * test case. |
|
167 * @since ?Series60_version |
|
168 * @param aCaseNumber Test case number |
|
169 * @param aTestCaseFile Test case file (optional) |
|
170 * @param aResult Test case result returned to test framework (PASS/FAIL) |
|
171 * @return Symbian OS error code (test case execution error, which is |
|
172 * not reported in aResult parameter as test case failure). |
|
173 */ |
|
174 TInt RunTestCaseL( const TInt aCaseNumber, |
|
175 const TFileName& aTestCaseFile, |
|
176 TTestResult& aResult ); |
|
177 |
|
178 /** |
|
179 * From CTestModuleBase; OOMTestQueryL is used to specify is particular |
|
180 * test case going to be executed using OOM conditions |
|
181 * @param aTestCaseFile Test case file (optional) |
|
182 * @param aCaseNumber Test case number (optional) |
|
183 * @param aFailureType OOM failure type (optional) |
|
184 * @param aFirstMemFailure The first heap memory allocation failure value (optional) |
|
185 * @param aLastMemFailure The last heap memory allocation failure value (optional) |
|
186 * @return TBool |
|
187 */ |
|
188 virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, |
|
189 const TInt /* aCaseNumber */, |
|
190 TOOMFailureType& aFailureType, |
|
191 TInt& /* aFirstMemFailure */, |
|
192 TInt& /* aLastMemFailure */ ); |
|
193 |
|
194 /** |
|
195 * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM |
|
196 * test environment |
|
197 * @param aTestCaseFile Test case file (optional) |
|
198 * @param aCaseNumber Test case number (optional) |
|
199 * @return None |
|
200 */ |
|
201 virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, |
|
202 const TInt /* aCaseNumber */ ); |
|
203 |
|
204 /** |
|
205 * From CTestModuleBase; OOMHandleWarningL |
|
206 * @param aTestCaseFile Test case file (optional) |
|
207 * @param aCaseNumber Test case number (optional) |
|
208 * @param aFailNextValue FailNextValue for OOM test execution (optional) |
|
209 * @return None |
|
210 * |
|
211 * User may add implementation for OOM test warning handling. Usually no |
|
212 * implementation is required. |
|
213 */ |
|
214 virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, |
|
215 const TInt /* aCaseNumber */, |
|
216 TInt& /* aFailNextValue */); |
|
217 |
|
218 /** |
|
219 * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM |
|
220 * test environment |
|
221 * @param aTestCaseFile Test case file (optional) |
|
222 * @param aCaseNumber Test case number (optional) |
|
223 * @return None |
|
224 * |
|
225 */ |
|
226 virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, |
|
227 const TInt /* aCaseNumber */ ); |
|
228 |
|
229 protected: // New functions |
|
230 |
|
231 /** |
|
232 * ?member_description. |
|
233 * @since ?Series60_version |
|
234 * @param ?arg1 ?description |
|
235 * @return ?description |
|
236 */ |
|
237 //?type ?member_function( ?type ?arg1 ); |
|
238 |
|
239 |
|
240 protected: // Functions from base classes |
|
241 |
|
242 private: |
|
243 |
|
244 /** |
|
245 * C++ default constructor. |
|
246 */ |
|
247 C3dringingtoneinterface_tests(); |
|
248 |
|
249 /** |
|
250 * By default Symbian 2nd phase constructor is private. |
|
251 */ |
|
252 void ConstructL(); |
|
253 |
|
254 // Prohibit copy constructor if not deriving from CBase. |
|
255 // ?classname( const ?classname& ); |
|
256 // Prohibit assigment operator if not deriving from CBase. |
|
257 // ?classname& operator=( const ?classname& ); |
|
258 |
|
259 /** |
|
260 * Function returning test case name and pointer to test case function. |
|
261 * @since ?Series60_version |
|
262 * @param aCaseNumber test case number |
|
263 * @return TCaseInfo |
|
264 */ |
|
265 const TCaseInfo Case ( const TInt aCaseNumber ) const; |
|
266 |
|
267 /** |
|
268 * Actual Hardcoded test case functions are listed below. |
|
269 */ |
|
270 //ADD NEW METHOD DEC HERE" |
|
271 |
|
272 /** |
|
273 * Printing test case. |
|
274 * @since ?Series60_version |
|
275 * @param aResult Test case result (PASS/FAIL) |
|
276 * @return Symbian OS error code (test case execution error |
|
277 * that is not returned as test case result in aResult) |
|
278 */ |
|
279 TInt PrintTest( TTestResult& aResult ); |
|
280 |
|
281 /** |
|
282 * Printing loop test case. |
|
283 * @since ?Series60_version |
|
284 * @param aResult Test case result (PASS/FAIL) |
|
285 * @return Symbian OS error code (test case execution error |
|
286 * that is not returned as test case result in aResult) |
|
287 */ |
|
288 TInt LoopTest( TTestResult& aResult ); |
|
289 |
|
290 |
|
291 TInt CreateAndDelete( TTestResult& aResult ); |
|
292 TInt PlayAndStop( TTestResult& aResult ); |
|
293 |
|
294 |
|
295 public: // Data |
|
296 // ?one_line_short_description_of_data |
|
297 //?data_declaration; |
|
298 |
|
299 protected: // Data |
|
300 // ?one_line_short_description_of_data |
|
301 //?data_declaration; |
|
302 |
|
303 private: // Data |
|
304 // Pointer to test (function) to be executed |
|
305 TestFunction iMethod; |
|
306 |
|
307 // Pointer to logger |
|
308 CStifLogger * iLog; |
|
309 |
|
310 // ?one_line_short_description_of_data |
|
311 //?data_declaration; |
|
312 |
|
313 // Reserved pointer for future extension |
|
314 //TAny* iReserved; |
|
315 |
|
316 public: // Friend classes |
|
317 //?friend_class_declaration; |
|
318 protected: // Friend classes |
|
319 //?friend_class_declaration; |
|
320 private: // Friend classes |
|
321 //?friend_class_declaration; |
|
322 |
|
323 }; |
|
324 |
|
325 #endif // _3DRINGINGTONEINTERFACE_TESTS_H |
|
326 |
|
327 // End of File |