|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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 #ifndef IPTVTESTUTILMODULE_H |
|
20 #define IPTVTESTUTILMODULE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <f32file.h> |
|
24 #include <BAUTILS.H> |
|
25 |
|
26 #include <StifLogger.h> |
|
27 #include <TestScripterInternal.h> |
|
28 #include <StifTestModule.h> |
|
29 |
|
30 #include "MTestUtilConnectionObserver.h" |
|
31 #include "MTestUtilDownloadObserver.h" |
|
32 #include "MIptvTestTimerObserver.h" |
|
33 |
|
34 // CONSTANTS |
|
35 const TInt KConnectionTimerId = 500; |
|
36 |
|
37 // Logging path |
|
38 _LIT( KIptvTestUtilModuleLogPath, "\\logs\\testframework\\IptvTestUtilModule\\" ); |
|
39 // Log file |
|
40 _LIT( KIptvTestUtilModuleLogFile, "IptvTestUtilModule.txt" ); |
|
41 |
|
42 // MACROS |
|
43 |
|
44 // FUNCTION PROTOTYPES |
|
45 //?type ?function_name(?arg_list); |
|
46 |
|
47 // FORWARD DECLARATIONS |
|
48 //class ?FORWARD_CLASSNAME; |
|
49 class CIptvTestUtilModule; |
|
50 class CTestUtilConnection; |
|
51 class CTestUtilConnectionWaiter; |
|
52 class CIptvTestDownloadManager; |
|
53 class CIptvTestTimer; |
|
54 class CIptvTestMobilecrashWatcher; |
|
55 class CIptvTestUtilALR; |
|
56 class CVCXTestCommon; |
|
57 class CZipFile; |
|
58 |
|
59 // DATA TYPES |
|
60 //enum ?declaration |
|
61 //typedef ?declaration |
|
62 //extern ?data_type; |
|
63 |
|
64 // CLASS DECLARATION |
|
65 |
|
66 /** |
|
67 * CIptvTestUtilModule test class for STIF Test Framework TestScripter. |
|
68 * This class should have no depencies to Video Center code. |
|
69 * |
|
70 * @lib ?library |
|
71 * @since ?Series60_version |
|
72 */ |
|
73 NONSHARABLE_CLASS(CIptvTestUtilModule) : public CScriptBase, public MTestUtilConnectionObserver, public MTestUtilDownloadObserver, public MIptvTestTimerObserver |
|
74 { |
|
75 public: // Constructors and destructor |
|
76 |
|
77 /** |
|
78 * Two-phased constructor. |
|
79 */ |
|
80 static CIptvTestUtilModule* NewL( CTestModuleIf& aTestModuleIf ); |
|
81 |
|
82 /** |
|
83 * Destructor. |
|
84 */ |
|
85 virtual ~CIptvTestUtilModule(); |
|
86 |
|
87 public: // New functions |
|
88 |
|
89 /** |
|
90 * ?member_description. |
|
91 * @since ?Series60_version |
|
92 * @param ?arg1 ?description |
|
93 * @return ?description |
|
94 */ |
|
95 //?type ?member_function( ?type ?arg1 ); |
|
96 |
|
97 public: // Functions from base classes |
|
98 |
|
99 /** |
|
100 * From CScriptBase Runs a script line. |
|
101 * @since ?Series60_version |
|
102 * @param aItem Script line containing method name and parameters |
|
103 * @return Symbian OS error code |
|
104 */ |
|
105 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
106 |
|
107 void ConnectionCreated(); |
|
108 void ConnectionClosed(); |
|
109 void ConnectionFailed(); |
|
110 void ConnectionAlreadyExists(); |
|
111 void ConnectionTimeout(); |
|
112 |
|
113 void DownloadFinished(TInt aError); |
|
114 |
|
115 void TimerComplete(TInt aTimerId, TInt aError); |
|
116 |
|
117 protected: // New functions |
|
118 |
|
119 /** |
|
120 * ?member_description. |
|
121 * @since ?Series60_version |
|
122 * @param ?arg1 ?description |
|
123 * @return ?description |
|
124 */ |
|
125 //?type ?member_function( ?type ?arg1 ); |
|
126 |
|
127 protected: // Functions from base classes |
|
128 |
|
129 private: |
|
130 |
|
131 /** |
|
132 * C++ default constructor. |
|
133 */ |
|
134 CIptvTestUtilModule( CTestModuleIf& aTestModuleIf ); |
|
135 |
|
136 /** |
|
137 * By default Symbian 2nd phase constructor is private. |
|
138 */ |
|
139 void ConstructL(); |
|
140 |
|
141 // Prohibit copy constructor if not deriving from CBase. |
|
142 // ?classname( const ?classname& ); |
|
143 // Prohibit assigment operator if not deriving from CBase. |
|
144 // ?classname& operator=( const ?classname& ); |
|
145 |
|
146 /** |
|
147 * Frees all resources allocated from test methods. |
|
148 * @since ?Series60_version |
|
149 */ |
|
150 void Delete(); |
|
151 |
|
152 /** |
|
153 * Test methods are listed below. |
|
154 */ |
|
155 |
|
156 /** |
|
157 * Creates MobilecrashesWatcher |
|
158 * @return Symbian OS error code. |
|
159 */ |
|
160 virtual TInt CreateMobilecrashWatcherL( CStifItemParser& aItem ); |
|
161 |
|
162 /** |
|
163 * Checks if there's any new mobilecrashes since the watcher was created. |
|
164 * @param aItem Script line containing IptvTest Case ID. Required. |
|
165 * @return KErrNone if there's no new mobilecrash files, else KErrAbort. |
|
166 */ |
|
167 virtual TInt CheckMobilecrashesL( CStifItemParser& aItem ); |
|
168 |
|
169 /** |
|
170 * Checks if there's any mobilecrash files. |
|
171 * @param aItem Script line containing IptvTest Case ID. Required. |
|
172 * @return KErrNone if there's no mobilecrash files, else KErrAbort. |
|
173 */ |
|
174 virtual TInt CheckMobilecrashesZeroToleranceL( CStifItemParser& aItem ); |
|
175 |
|
176 /** |
|
177 * Writes line ">>> Case start: <parameters>" using Iptv logging methods. |
|
178 * @param aItem Script line containing IptvTest Case ID. Required. |
|
179 * @return Symbian OS error code. |
|
180 */ |
|
181 virtual TInt IptvLogCaseStart( CStifItemParser& aItem ); |
|
182 |
|
183 /** |
|
184 * Writes line "<<< Case end." using Iptv logging methods. |
|
185 * @param |
|
186 * @return Symbian OS error code. |
|
187 */ |
|
188 virtual TInt IptvLogCaseEnd( CStifItemParser& aItem ); |
|
189 |
|
190 /** |
|
191 * Writes line using Iptv logging methods. |
|
192 * @param aItem Text which is written into the log. Not required. |
|
193 * @return Symbian OS error code. |
|
194 */ |
|
195 virtual TInt IptvLogWrite( CStifItemParser& aItem ); |
|
196 |
|
197 /** |
|
198 * Opens a socket to a specified IAP. |
|
199 * ASYNC. |
|
200 * @param aItem IAP name. |
|
201 * @return Symbian OS error code. |
|
202 */ |
|
203 virtual TInt ConnectL( CStifItemParser& aItem ); |
|
204 |
|
205 /** |
|
206 * Attached to open connection specified by IAP. |
|
207 * SYNC. |
|
208 * @param aItem IAP name. |
|
209 * @return Symbian OS error code. |
|
210 */ |
|
211 virtual TInt AttachL( CStifItemParser& aItem ); |
|
212 |
|
213 /** |
|
214 * Disconnects from the currently open connection. |
|
215 * SYNC. |
|
216 * @param none |
|
217 * @return Symbian OS error code. |
|
218 */ |
|
219 virtual TInt DisconnectL( CStifItemParser& aItem ); |
|
220 |
|
221 /** |
|
222 * Terminates the currently open connection, i.e. closes it immediately. |
|
223 * The connection can be opened by this module or other application. |
|
224 * SYNC. |
|
225 * @param none |
|
226 * @return Symbian OS error code. |
|
227 */ |
|
228 virtual TInt TerminateConnectionL( CStifItemParser& aItem ); |
|
229 |
|
230 /** |
|
231 * Starts observing the connection until it's activated, Signals test script. |
|
232 * @param IAP name |
|
233 * @return Symbian OS error code. |
|
234 */ |
|
235 virtual TInt WaitForConnectionActivityL( CStifItemParser& aItem ); |
|
236 |
|
237 /** |
|
238 * Starts observing the connection until it's closed, Signals test script. |
|
239 * @param IAP name |
|
240 * @return Symbian OS error code. |
|
241 */ |
|
242 virtual TInt WaitUntilConnectionIsClosed(CStifItemParser& aItem ); |
|
243 |
|
244 /** |
|
245 * Start a download. |
|
246 */ |
|
247 virtual TInt DownloadL( CStifItemParser& aItem ); |
|
248 |
|
249 /** |
|
250 * Stop downloads. |
|
251 */ |
|
252 virtual TInt StopDownloadsL( CStifItemParser& aItem ); |
|
253 |
|
254 /** |
|
255 * Advance system time for 1 second. |
|
256 */ |
|
257 virtual TInt AdvanceSystemTime1Second( CStifItemParser& aItem ); |
|
258 |
|
259 /** |
|
260 * Advance system time for X seconds. |
|
261 */ |
|
262 virtual TInt AdvanceSystemTimeSeconds( CStifItemParser& aItem ); |
|
263 |
|
264 /** |
|
265 * Advance system time for X minute. |
|
266 */ |
|
267 virtual TInt AdvanceSystemTimeMinutes( CStifItemParser& aItem ); |
|
268 |
|
269 /** |
|
270 * Advance system time for X hour. |
|
271 */ |
|
272 virtual TInt AdvanceSystemTimeHours( CStifItemParser& aItem ); |
|
273 |
|
274 /** |
|
275 * Advance system time for specified number of days. |
|
276 */ |
|
277 virtual TInt AdvanceSystemTimeDays(CStifItemParser& aItem ); |
|
278 |
|
279 /** |
|
280 * Set the system time. |
|
281 * Must be in format YYYYMMDD:HHMMSS.MMMMMM (First day / month is 0) |
|
282 */ |
|
283 virtual TInt SetSystemTime(CStifItemParser& aItem ); |
|
284 |
|
285 /** |
|
286 * Set the system time within the ongoing day. |
|
287 * |
|
288 */ |
|
289 virtual TInt SetSystemTimeToday(CStifItemParser& aItem ); |
|
290 |
|
291 /** |
|
292 * Set the system timezone. |
|
293 */ |
|
294 virtual TInt SetTimeZone(CStifItemParser& aItem ); |
|
295 |
|
296 |
|
297 /** |
|
298 * Removes the used destination cenrep value. |
|
299 */ |
|
300 virtual TInt DeleteUsedDestinationCenRepL( CStifItemParser& aItem ); |
|
301 |
|
302 /** |
|
303 * Set the used destination cenrep value for Video Center & IPTV_Engine. |
|
304 */ |
|
305 virtual TInt SetUsedDestinationL( CStifItemParser& aItem ); |
|
306 |
|
307 /** |
|
308 * Create new destination (SNAP) |
|
309 */ |
|
310 virtual TInt CreateDestinationL( CStifItemParser& aItem ); |
|
311 |
|
312 /** |
|
313 * Delete a destination (SNAP) |
|
314 */ |
|
315 virtual TInt DeleteDestinationL( CStifItemParser& aItem ); |
|
316 |
|
317 /** |
|
318 * Copy existing connection method to defined SNAP. |
|
319 */ |
|
320 virtual TInt CopyMethodL( CStifItemParser& aItem ); |
|
321 |
|
322 /** |
|
323 * Delete a connection method. |
|
324 */ |
|
325 virtual TInt DeleteMethodL( CStifItemParser& aItem ); |
|
326 |
|
327 /** |
|
328 * Set priority for a connection method. |
|
329 */ |
|
330 virtual TInt SetMethodPriorityL( CStifItemParser& aItem ); |
|
331 |
|
332 /** |
|
333 * Delete the destination when classes destructor is run. |
|
334 */ |
|
335 virtual TInt DeleteDestinationAfterwardsL( CStifItemParser& aItem ); |
|
336 |
|
337 /** |
|
338 * Sets string attribute for connection method. |
|
339 */ |
|
340 virtual TInt SetConnectionMethodStringAttributeL( CStifItemParser& aItem ); |
|
341 |
|
342 /** |
|
343 * Sets integer attribute for connection method. |
|
344 */ |
|
345 virtual TInt SetConnectionMethodIntAttributeL( CStifItemParser& aItem ); |
|
346 |
|
347 /** |
|
348 * Sets boolean attribute for connection method. |
|
349 */ |
|
350 virtual TInt SetConnectionMethodBoolAttributeL( CStifItemParser& aItem ); |
|
351 |
|
352 /** |
|
353 * CreateFileL |
|
354 */ |
|
355 virtual TInt CreateFileL( CStifItemParser& aItem ); |
|
356 |
|
357 /** |
|
358 * DeleteFileL |
|
359 */ |
|
360 virtual TInt DeleteFileL( CStifItemParser& aItem ); |
|
361 |
|
362 /* |
|
363 * CreateFolderL |
|
364 */ |
|
365 virtual TInt CreateFolderL( CStifItemParser& aItem ); |
|
366 |
|
367 /* |
|
368 * DeleteFolderL |
|
369 */ |
|
370 virtual TInt DeleteFolderL( CStifItemParser& aItem ); |
|
371 |
|
372 /* |
|
373 * LockFileL |
|
374 */ |
|
375 virtual TInt LockFileL( CStifItemParser& aItem ); |
|
376 |
|
377 /* |
|
378 * UnlockFileL |
|
379 */ |
|
380 virtual TInt UnlockFileL( CStifItemParser& aItem ); |
|
381 |
|
382 /* |
|
383 * ExtractFile |
|
384 */ |
|
385 virtual TInt ExtractFileL( CStifItemParser& aItem ); |
|
386 |
|
387 /* |
|
388 * FileExistsInZip |
|
389 */ |
|
390 virtual TBool FileExistsInZip( CZipFile* aZipFile, const TDesC& aFileName ); |
|
391 |
|
392 /** |
|
393 * Prints IAPs from commdb to debug output. |
|
394 */ |
|
395 virtual void PrintIAPs(); |
|
396 |
|
397 /** |
|
398 * Gets IAp by name. |
|
399 */ |
|
400 virtual void GetIap(TDesC& aIapName, TUint32& aIapId); |
|
401 |
|
402 /** |
|
403 * Sets free space on drive. |
|
404 * @param aDriveLetter |
|
405 * @param aDesiredSpace, bytes |
|
406 */ |
|
407 virtual TInt SetDriveFreeSpaceL( CStifItemParser& aItem ); |
|
408 |
|
409 public: // Data |
|
410 // ?one_line_short_description_of_data |
|
411 //?data_declaration; |
|
412 |
|
413 protected: // Data |
|
414 // ?one_line_short_description_of_data |
|
415 //?data_declaration; |
|
416 |
|
417 private: // Data |
|
418 |
|
419 // ?one_line_short_description_of_data |
|
420 //?data_declaration; |
|
421 |
|
422 // Reserved pointer for future extension |
|
423 //TAny* iReserved; |
|
424 |
|
425 CTestUtilConnection* iConnect; |
|
426 CTestUtilConnectionWaiter* iConnectionWaiter; |
|
427 TInt iRetryCount; |
|
428 CIptvTestDownloadManager* iDownload; |
|
429 CIptvTestTimer* iTimer; |
|
430 CIptvTestMobilecrashWatcher* iIptvTestMobilecrashWatcher; |
|
431 HBufC* iObservedServicePath; |
|
432 RPointerArray<HBufC> iObservedFiles; |
|
433 RArray<TTime> iFileModifiedDates; |
|
434 |
|
435 RPointerArray<HBufC> iToBeDeletedDestinations; |
|
436 |
|
437 CIptvTestUtilALR* iTestUtilALR; |
|
438 RFs iFs; |
|
439 RFile iLockedFile; |
|
440 TBool iFileIsLocked; |
|
441 |
|
442 TBool iCaseStarted; |
|
443 |
|
444 CVCXTestCommon* iTestCommon; |
|
445 |
|
446 TBool iDummyFilesCreated; |
|
447 }; |
|
448 |
|
449 #endif // IPTVTESTUTILMODULE_H |
|
450 |
|
451 // End of File |