|
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 * TestInterface. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef TEST_INTERFACE_H |
|
20 #define TEST_INTERFACE_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <e32base.h> |
|
26 #include <StifTestModule.h> |
|
27 |
|
28 // CONSTANTS |
|
29 // None |
|
30 |
|
31 // MACROS |
|
32 // None |
|
33 |
|
34 // DATA TYPES |
|
35 // None |
|
36 |
|
37 // FUNCTION PROTOTYPES |
|
38 |
|
39 // This defines drive letters that is available in STIF TF. |
|
40 //@spe IMPORT_C const TChar StifDriveLetters( TInt aDriveNumber, TInt& aCount ); |
|
41 |
|
42 // This works and used only in EKA2 environment and used from STIF |
|
43 // TestFramework internally. |
|
44 // Executable module uses defined capabilities(PlatSec's Capability model) |
|
45 // to start session. Function for starting the TestServer and |
|
46 // Testmodule/TestClass. |
|
47 IMPORT_C TInt StartSession(); |
|
48 |
|
49 // FORWARD DECLARATIONS |
|
50 // None |
|
51 |
|
52 // CLASS DECLARATION |
|
53 const TInt KMaxStifInfoName = 0x10; |
|
54 typedef TBuf<KMaxStifInfoName> TStifInfoName; |
|
55 |
|
56 // DESCRIPTION |
|
57 // TTestInfo defines the information for test case and Test Module. |
|
58 class TTestInfo |
|
59 { |
|
60 public: |
|
61 IMPORT_C TTestInfo(); |
|
62 public: |
|
63 // The name of Test Module. |
|
64 TName iModuleName; |
|
65 // Test case info for test case execution. |
|
66 TTestCaseInfo iTestCaseInfo; |
|
67 // Config file to be used. |
|
68 TFileName iConfig; |
|
69 }; |
|
70 |
|
71 // Packaged TTestInfo |
|
72 typedef TPckg<TTestInfo> TTestInfoPckg; |
|
73 |
|
74 // CLASS DECLARATION |
|
75 |
|
76 // DESCRIPTION |
|
77 // TFullTestResult defines the full test case result information. |
|
78 class TFullTestResult |
|
79 { |
|
80 public: |
|
81 IMPORT_C TFullTestResult(); |
|
82 |
|
83 enum TCaseExecutionResult |
|
84 { |
|
85 ECaseOngoing, |
|
86 ECaseExecuted, |
|
87 ECaseCancelled, |
|
88 ECaseErrorFromModule, |
|
89 ECaseLeave, |
|
90 ECasePanic, |
|
91 ECaseException, |
|
92 ECaseTimeout, |
|
93 ECaseSuicided, |
|
94 }; |
|
95 |
|
96 public: |
|
97 // Test case result. |
|
98 TTestResult iTestResult; |
|
99 // Timestamp when test case was started. |
|
100 TTime iStartTime; |
|
101 // Timestamp when test case was ended. |
|
102 TTime iEndTime; |
|
103 |
|
104 // Test result type |
|
105 TCaseExecutionResult iCaseExecutionResultType; |
|
106 // Test result code |
|
107 TInt iCaseExecutionResultCode; |
|
108 }; |
|
109 |
|
110 // Packaged TFullTestResult |
|
111 typedef TPckg<TFullTestResult> TFullTestResultPckg; |
|
112 |
|
113 |
|
114 // CLASS DECLARATION |
|
115 |
|
116 // DESCRIPTION |
|
117 // TTestProgress defines the progress information from Test Module. |
|
118 class TTestProgress |
|
119 { |
|
120 public: |
|
121 IMPORT_C TTestProgress(); |
|
122 public: |
|
123 // "Priority" of the progress information. |
|
124 TInt iPosition; |
|
125 // Description of the data to be printed. |
|
126 TStifInfoName iDescription; |
|
127 // The actual progress information. |
|
128 TName iText; |
|
129 }; |
|
130 |
|
131 // Packaged TTestProgress |
|
132 typedef TPckg<TTestProgress> TTestProgressPckg; |
|
133 |
|
134 |
|
135 // CLASS DECLARATION |
|
136 |
|
137 // DESCRIPTION |
|
138 // TErrorNotification defines the error notifications |
|
139 class TErrorNotification |
|
140 { |
|
141 public: |
|
142 IMPORT_C TErrorNotification(); |
|
143 public: |
|
144 // Error priority |
|
145 TInt iPriority; |
|
146 // Module reporting error |
|
147 TStifInfoName iModule; |
|
148 // The actual error information. |
|
149 TName iText; |
|
150 }; |
|
151 |
|
152 // Attributes that can be changed with SetAttribute |
|
153 enum TAttribute |
|
154 { |
|
155 ELogPath, // Log file path |
|
156 ERebootPath, // Reboot path definition |
|
157 ERebootFilename, // Reboot filename definition |
|
158 EStifMeasurementOn, // STIF's Measurement enable |
|
159 EStifMeasurementOff // STIF's Measurement disable |
|
160 }; |
|
161 |
|
162 // Packaged TErrorNotification |
|
163 typedef TPckg<TErrorNotification> TErrorNotificationPckg; |
|
164 |
|
165 // Different STIF internal commands. |
|
166 enum TStifCommand |
|
167 { |
|
168 EStifCmdReceive, |
|
169 EStifCmdSend, |
|
170 EStifCmdReboot, |
|
171 EStifCmdStoreState, |
|
172 EStifCmdGetStoredState, |
|
173 EStifCmdRebootProceed, |
|
174 EStifCmdReceiveCancel, |
|
175 EStifCmdMeasurement, |
|
176 }; |
|
177 typedef TPckg<TStifCommand> TStifCommandPckg; |
|
178 |
|
179 // Class for Reboot parameter |
|
180 class TRebootParams |
|
181 { |
|
182 public: |
|
183 CTestModuleIf::TRebootType aType; |
|
184 }; |
|
185 |
|
186 // Class for Reboot state parameters |
|
187 class TRebootStateParams |
|
188 { |
|
189 public: |
|
190 TInt aCode; |
|
191 TName aName; |
|
192 }; |
|
193 |
|
194 // Class for Reboot stored parameters |
|
195 class TGetRebootStoredParams |
|
196 { |
|
197 public: |
|
198 TInt aCode; |
|
199 TName aName; |
|
200 }; |
|
201 |
|
202 // Class for Reboot stored parameters(references) |
|
203 class TGetRebootStoredParamsRef |
|
204 { |
|
205 public: |
|
206 TGetRebootStoredParamsRef( |
|
207 TInt& aCode, TName& aName ):iCode(aCode),iName(aName){}; |
|
208 public: |
|
209 TInt& iCode; |
|
210 TName& iName; |
|
211 }; |
|
212 |
|
213 // Class for measurement stored parameters |
|
214 class TGetMeasurementOptions |
|
215 { |
|
216 public: |
|
217 TInt iOptions; |
|
218 }; |
|
219 |
|
220 // Class for measurement stored parameters(options) |
|
221 class TGetMeasurementOptionsRef |
|
222 { |
|
223 public: |
|
224 TGetMeasurementOptionsRef( TInt& aOptions ): iOptions(aOptions){}; |
|
225 public: |
|
226 TInt& iOptions; |
|
227 }; |
|
228 |
|
229 // This class offer generic attribute for passing client-server interface |
|
230 union TParams |
|
231 { |
|
232 TDes* aRemoteMsgRef; |
|
233 const TDesC* aRemoteMsgConstRef; |
|
234 TRebootParams* aRebootType; |
|
235 TRebootStateParams* aRebootState; |
|
236 TGetRebootStoredParamsRef* aRebootStoredRef; |
|
237 TGetMeasurementOptionsRef* aMeasurementOption; |
|
238 }; |
|
239 |
|
240 // Packaged TRebootParams |
|
241 typedef TPckg<TRebootParams> TRebootParamsPckg; |
|
242 |
|
243 // Packaged TRebootStateParams |
|
244 typedef TPckg<TRebootStateParams> TRebootStateParamsPckg; |
|
245 |
|
246 // Packaged TGetRebootStoredParams |
|
247 typedef TPckg<TGetRebootStoredParams> TGetRebootStoredParamsPckg; |
|
248 |
|
249 // Packaged TGetMeasurementParams |
|
250 typedef TPckg<TGetMeasurementOptions> TGetMeasurementOptionsPckg; |
|
251 |
|
252 |
|
253 // CLASS DECLARATION |
|
254 |
|
255 // DESCRIPTION |
|
256 // Base class for test measurement modules. Measurement modules implements |
|
257 // measurerement operations. |
|
258 NONSHARABLE_CLASS( CSTIFTestMeasurementImplementation ) : public CBase |
|
259 { |
|
260 public: // Enumerations |
|
261 |
|
262 private: // Enumerations |
|
263 |
|
264 public: // Constructors and destructor |
|
265 |
|
266 public: // New functions |
|
267 |
|
268 /** |
|
269 * Pure virtual measurement start command. |
|
270 * Start method's implementation is in measurement module. |
|
271 */ |
|
272 virtual TInt Start( ) = 0; |
|
273 |
|
274 /** |
|
275 * Pure virtual measurement stop command. |
|
276 * Stop method's implementation is in measurement module. |
|
277 */ |
|
278 virtual TInt Stop( ) = 0; |
|
279 |
|
280 /** |
|
281 * Pure virtual measurement stop command. |
|
282 * Stop method's implementation is in measurement module. |
|
283 */ |
|
284 virtual CSTIFTestMeasurement::TSTIFMeasurementType MeasurementType() = 0; |
|
285 |
|
286 |
|
287 public: // Functions from base classes |
|
288 |
|
289 protected: // New functions |
|
290 |
|
291 protected: // Functions from base classes |
|
292 |
|
293 private: |
|
294 |
|
295 public: //Data |
|
296 |
|
297 protected: // Data |
|
298 |
|
299 private: // Data |
|
300 |
|
301 public: // Friend classes |
|
302 |
|
303 protected: // Friend classes |
|
304 |
|
305 private: // Friend classes |
|
306 |
|
307 }; |
|
308 |
|
309 // STIF utility class |
|
310 class TStifUtil |
|
311 { |
|
312 public: // Enumerations |
|
313 |
|
314 private: // Enumerations |
|
315 |
|
316 public: // Constructors and destructor |
|
317 |
|
318 public: // New functions |
|
319 /** |
|
320 * Checks if file path contains drive letter. If not file is serched |
|
321 * on all drives and first hit is added to file name. |
|
322 */ |
|
323 IMPORT_C static void CorrectFilePathL( TDes& aFilePath ); |
|
324 |
|
325 /** |
|
326 * Method used by both STIF and STIF UI to retrieve version of STIF |
|
327 */ |
|
328 IMPORT_C static void STIFVersion(TInt& aMajorV, TInt& aMinorV, TInt& aBuildV, TDes& aRelDate); |
|
329 |
|
330 public: // Functions from base classes |
|
331 |
|
332 protected: // New functions |
|
333 |
|
334 protected: // Functions from base classes |
|
335 |
|
336 private: |
|
337 |
|
338 public: //Data |
|
339 |
|
340 protected: // Data |
|
341 |
|
342 private: // Data |
|
343 |
|
344 public: // Friend classes |
|
345 |
|
346 protected: // Friend classes |
|
347 |
|
348 private: // Friend classes |
|
349 |
|
350 }; |
|
351 |
|
352 |
|
353 #endif // TEST_INTERFACE_H |
|
354 |
|
355 // End of File |