|
1 /* |
|
2 * Copyright (c) 2008-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef GENERICHIDTEST_H |
|
22 #define GENERICHIDTEST_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <StifLogger.h> |
|
26 #include <TestScripterInternal.h> |
|
27 #include <StifTestModule.h> |
|
28 #include <TestclassAssert.h> |
|
29 |
|
30 #include "hidparser.h" |
|
31 |
|
32 // CONSTANTS |
|
33 //const ?type ?constant_var = ?constant; |
|
34 |
|
35 // MACROS |
|
36 //#define ?macro ?macro_def |
|
37 #define TEST_CLASS_VERSION_MAJOR 0 |
|
38 #define TEST_CLASS_VERSION_MINOR 0 |
|
39 #define TEST_CLASS_VERSION_BUILD 0 |
|
40 |
|
41 #ifdef STIF_LOG |
|
42 #undef STIF_LOG |
|
43 #endif |
|
44 |
|
45 #define STIF_LOG( s )\ |
|
46 {\ |
|
47 TBuf<KMaxLogData> traceBuf;\ |
|
48 traceBuf.Append( _L( "[STIF_LOG] " ) );\ |
|
49 traceBuf.Append( _L( s ) );\ |
|
50 iLog->Log( _L( s ) );\ |
|
51 RDebug::Print( traceBuf );\ |
|
52 } |
|
53 |
|
54 #define STIF_LOG1( s, v ) \ |
|
55 {\ |
|
56 TBuf<KMaxLogData> traceBuf;\ |
|
57 traceBuf.Append( _L( "[STIF_LOG] " ) );\ |
|
58 traceBuf.Append( _L( s ) );\ |
|
59 iLog->Log( _L( s ), v );\ |
|
60 RDebug::Print( traceBuf, v );\ |
|
61 } |
|
62 |
|
63 #define STIF_LOG2( s, v1, v2 ) \ |
|
64 {\ |
|
65 TBuf<KMaxLogData> traceBuf;\ |
|
66 traceBuf.Append( _L( "[STIF_LOG] " ) );\ |
|
67 traceBuf.Append( _L( s ) );\ |
|
68 iLog->Log( _L( s ), v1, v2 );\ |
|
69 RDebug::Print( traceBuf, v1, v2 );\ |
|
70 } |
|
71 |
|
72 #define STIF_LOG3( s, v1, v2, v3 ) \ |
|
73 {\ |
|
74 TBuf<KMaxLogData> traceBuf;\ |
|
75 traceBuf.Append( _L( "[STIF_LOG] " ) );\ |
|
76 traceBuf.Append( _L( s ) );\ |
|
77 iLog->Log( _L( s ), v1, v2, v3 );\ |
|
78 RDebug::Print( traceBuf, v1, v2, v3 );\ |
|
79 } |
|
80 |
|
81 // Logging path |
|
82 //_LIT( KGenericHidTestLogPath, "\\logs\\testframework\\GenericHidTest\\" ); |
|
83 |
|
84 // Logging path for ATS - for phone builds comment this line |
|
85 _LIT( KGenericHidTestLogPath, "e:\\testing\\stiflogs\\" ); |
|
86 |
|
87 // Log file |
|
88 _LIT( KGenericHidTestLogFile, "GenericHidTest.txt" ); |
|
89 _LIT( KGenericHidTestLogFileWithTitle, "GenericHidTest_[%S].txt" ); |
|
90 |
|
91 // FUNCTION PROTOTYPES |
|
92 //?type ?function_name(?arg_list); |
|
93 |
|
94 // FORWARD DECLARATIONS |
|
95 //class ?FORWARD_CLASSNAME; |
|
96 class CGenericHidTest; |
|
97 |
|
98 class CHidTestLogger; |
|
99 class CtGenericHIDAPI; |
|
100 //class CMediaControl; |
|
101 class CDialClient; |
|
102 class CAlarmControl; |
|
103 |
|
104 // DATA TYPES |
|
105 //enum ?declaration |
|
106 |
|
107 enum TGenericHidTestResult |
|
108 { |
|
109 ETestCasePassed, |
|
110 ETestCaseFailed |
|
111 }; |
|
112 |
|
113 //typedef ?declaration |
|
114 //extern ?data_type; |
|
115 |
|
116 // CLASS DECLARATION |
|
117 |
|
118 NONSHARABLE_CLASS( TGenericHidTestBlockParams ) |
|
119 { |
|
120 public: |
|
121 TPtrC iTestBlockName; |
|
122 |
|
123 TPtrC iTestOption1; |
|
124 TPtrC iTestOption2; |
|
125 TPtrC iTestOption3; |
|
126 |
|
127 TInt iTestIntOption1; |
|
128 TInt iTestIntOption2; |
|
129 |
|
130 TChar iTestCharOption1; |
|
131 TChar iTestCharOption2; |
|
132 }; |
|
133 |
|
134 /** |
|
135 * CGenericHidTest test class for STIF Test Framework TestScripter. |
|
136 * ?other_description_lines |
|
137 * |
|
138 * @lib ?library |
|
139 * @since ?Series60_version |
|
140 */ |
|
141 NONSHARABLE_CLASS( CGenericHidTest ) : public CScriptBase |
|
142 { |
|
143 public: // Constructors and destructor |
|
144 |
|
145 /** |
|
146 * Two-phased constructor. |
|
147 */ |
|
148 static CGenericHidTest* NewL( CTestModuleIf& aTestModuleIf ); |
|
149 |
|
150 /** |
|
151 * Destructor. |
|
152 */ |
|
153 virtual ~CGenericHidTest(); |
|
154 |
|
155 public: // New functions |
|
156 |
|
157 /** |
|
158 * ?member_description. |
|
159 * @since ?Series60_version |
|
160 * @param ?arg1 ?description |
|
161 * @return ?description |
|
162 */ |
|
163 //?type ?member_function( ?type ?arg1 ); |
|
164 |
|
165 public: // Functions from base classes |
|
166 |
|
167 /** |
|
168 * From CScriptBase Runs a script line. |
|
169 * @since ?Series60_version |
|
170 * @param aItem Script line containing method name and parameters |
|
171 * @return Symbian OS error code |
|
172 */ |
|
173 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
174 |
|
175 protected: // New functions |
|
176 |
|
177 /** |
|
178 * ?member_description. |
|
179 * @since ?Series60_version |
|
180 * @param ?arg1 ?description |
|
181 * @return ?description |
|
182 */ |
|
183 //?type ?member_function( ?type ?arg1 ); |
|
184 |
|
185 protected: // Functions from base classes |
|
186 |
|
187 /** |
|
188 * From ?base_class ?member_description |
|
189 */ |
|
190 //?type ?member_function(); |
|
191 |
|
192 private: |
|
193 |
|
194 /** |
|
195 * C++ default constructor. |
|
196 */ |
|
197 CGenericHidTest( CTestModuleIf& aTestModuleIf ); |
|
198 |
|
199 /** |
|
200 * By default Symbian 2nd phase constructor is private. |
|
201 */ |
|
202 void ConstructL(); |
|
203 |
|
204 // Prohibit copy constructor if not deriving from CBase. |
|
205 // ?classname( const ?classname& ); |
|
206 // Prohibit assigment operator if not deriving from CBase. |
|
207 // ?classname& operator=( const ?classname& ); |
|
208 |
|
209 /** |
|
210 * Frees all resources allocated from test methods. |
|
211 * @since ?Series60_version |
|
212 */ |
|
213 void Delete(); |
|
214 |
|
215 /** |
|
216 * Test methods are listed below. |
|
217 */ |
|
218 |
|
219 virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem ); |
|
220 virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem ); |
|
221 virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem ); |
|
222 |
|
223 /** |
|
224 * Method used to log version of test class |
|
225 */ |
|
226 void SendTestClassVersion(); |
|
227 |
|
228 //ADD NEW METHOD DEC HERE |
|
229 //[TestMethods] - Do not remove |
|
230 |
|
231 void GetTestBlockParamsL( CStifItemParser& aItem ); |
|
232 |
|
233 void DoExecuteApiTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult ); |
|
234 void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult ); |
|
235 void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult ); |
|
236 |
|
237 void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption, |
|
238 TInt aTestIntOption, TInt aTestCharOption, TGenericHidTestResult& aTestResult ); |
|
239 |
|
240 virtual TInt ConnectL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
241 virtual TInt DisconnectL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
242 virtual TInt DataIn( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
243 virtual TInt WaitL( TPtrC aTestOption, TInt aTestIntOption, TGenericHidTestResult& aTestResult ); |
|
244 virtual TInt CreateCallL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
245 virtual TInt AddAlarmL( TPtrC aTestOption, TInt aTestIntOption, TGenericHidTestResult& aTestResult ); |
|
246 virtual TInt DeleteAlarm( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
247 virtual TInt CountryCodeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
248 virtual TInt VendorIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
249 virtual TInt ProductIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
250 virtual TInt SetProtocolL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
251 virtual TInt GetProtocoL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
252 virtual TInt GetReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
253 virtual TInt SetReportL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
254 virtual TInt DataOutL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult); |
|
255 virtual TInt GetIdleL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
256 virtual TInt SetIdleL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
257 |
|
258 virtual TInt CommandResultL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
259 virtual TInt ReportDescriptorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
260 virtual TInt CreateReportGeneratorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
261 virtual TInt DeleteReportGeneratorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
262 virtual TInt ReportGeneratorReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
263 virtual TInt ReportGeneratorSetFieldL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
264 virtual TInt CreateReportTranslatorL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
265 virtual TInt CreateReportTranslator_FieldNullL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
266 virtual TInt CreateReportTranslator_NotArrayL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
267 virtual TInt CreateReportTranslator_FieldCountZeroL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
268 virtual TInt DeleteReportTranslatorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
269 virtual TInt ReportTranslatorGetValueL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
270 virtual TInt ReportTranslatorValueL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
271 virtual TInt ReportTranslatorGetUsageIdL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
272 virtual TInt ReportTranslatorUsageIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
273 virtual TInt ReportTranslatorRawValueL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
274 virtual TInt ReportTranslatorCountL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
275 |
|
276 virtual TInt CollectiontypeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
277 virtual TInt CollectionIsPhysicalL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
278 virtual TInt CollectionIsLogicalL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
279 virtual TInt CollectionIsReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
280 virtual TInt CollectionIsNamedArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
281 virtual TInt CollectionIsUsageSwitchL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
282 virtual TInt CollectionIsUsageModifierL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
283 |
|
284 virtual TInt CollectionIsApplicationL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
285 virtual TInt CollectionUsagePageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
286 virtual TInt CollectionUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
287 virtual TInt CollectionCollectionCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
288 virtual TInt CollectionFieldCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
289 virtual TInt CollectionCollectionByIndexL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
290 virtual TInt CollectionFieldByIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
291 |
|
292 virtual TInt ReportrootReportSizeBytes( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
293 |
|
294 virtual TInt FieldLogicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
295 virtual TInt FieldPhysicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
296 virtual TInt FieldPhysicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
297 virtual TInt FieldUnitL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
298 virtual TInt FieldUnitExponentL( TPtrC aTestOption, TGenericHidTestResult& aTestResult); |
|
299 |
|
300 virtual TInt FieldCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
301 virtual TInt FieldSizeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
302 virtual TInt FieldOffsetL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
303 virtual TInt FieldReportIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
304 virtual TInt FieldIsInReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
305 virtual TInt FieldDesignatorIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
306 virtual TInt FieldStringIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
307 virtual TInt FieldUsagePageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
308 |
|
309 virtual TInt FieldHasUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
310 |
|
311 virtual TInt FieldUsageArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
312 virtual TInt FieldUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
313 virtual TInt FieldUsageCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
314 virtual TInt FieldClearUsageListL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
315 virtual TInt FieldLastUsageL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult ); |
|
316 |
|
317 virtual TInt FieldAttributesL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
318 virtual TInt FieldTypeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
319 virtual TInt FieldIsVariableL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
320 virtual TInt FieldIsArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
321 virtual TInt FieldIsConstantL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
322 virtual TInt FieldIsDataL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
323 virtual TInt FieldSetLogicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
324 virtual TInt FieldSetLogicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
325 virtual TInt FieldSetPhysicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
326 virtual TInt FieldSetPhysicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
327 virtual TInt FieldSetDesignatorMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
328 virtual TInt FieldSetDesignatorMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
329 virtual TInt FieldSetUsageMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
330 virtual TInt FieldSetUsageMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
331 virtual TInt FieldSetStringMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
332 virtual TInt FieldSetStringMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
333 |
|
334 virtual TInt FieldSetLogicalRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
335 virtual TInt FieldSetUsageRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
336 virtual TInt FieldSetPhysicalRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
337 virtual TInt FieldSetStringRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
338 virtual TInt FieldSetDesignatorRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
339 virtual TInt FieldIsInputL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
340 |
|
341 virtual TInt FieldIsOutputL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
342 virtual TInt FieldIsFeatureL( TPtrC aTestOption, TGenericHidTestResult& aTestResult ); |
|
343 |
|
344 HBufC8* ConvertArray(const TPtrC& aFilename); |
|
345 TUint ConvSingleItem(TBuf8<2>& singleItem); |
|
346 |
|
347 public: // Data |
|
348 // ?one_line_short_description_of_data |
|
349 //?data_declaration; |
|
350 |
|
351 protected: // Data |
|
352 // ?one_line_short_description_of_data |
|
353 //?data_declaration; |
|
354 |
|
355 private: // Data |
|
356 TGenericHidTestBlockParams iTestBlockParams; |
|
357 |
|
358 CtGenericHIDAPI* iGenericHIDTest; |
|
359 CDialClient* iDialClient; |
|
360 CAlarmControl* iAlarmControl; |
|
361 |
|
362 CParser* iParser; |
|
363 // Reserved pointer for future extension |
|
364 //TAny* iReserved; |
|
365 |
|
366 public: // Friend classes |
|
367 //?friend_class_declaration; |
|
368 protected: // Friend classes |
|
369 //?friend_class_declaration; |
|
370 private: // Friend classes |
|
371 //?friend_class_declaration; |
|
372 |
|
373 }; |
|
374 |
|
375 #endif // GENERICHIDTEST_H |
|
376 |
|
377 // End of File |