|
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: Isv Telephony test module. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef ISVTELEPHONYTEST_H |
|
21 #define ISVTELEPHONYTEST_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 #include <StifTestModule.h> |
|
27 #include <StifLogger.h> |
|
28 #include "IsvTelephonyTestParser.h" |
|
29 #include "IsvTelephonyTestMessageHandler.h" |
|
30 |
|
31 // MACROS |
|
32 //#define ?macro ?macro_def |
|
33 #define TEST_MODULE_VERSION_MAJOR 30 |
|
34 #define TEST_MODULE_VERSION_MINOR 9 |
|
35 #define TEST_MODULE_VERSION_BUILD 38 |
|
36 |
|
37 // Logging path |
|
38 _LIT( KIsvTelephonyTestLogPath, "\\logs\\testframework\\IsvTelephonyTest\\" ); |
|
39 // Log file |
|
40 _LIT( KIsvTelephonyTestLogFile, "IsvTelephonyTest.txt" ); |
|
41 |
|
42 // Function pointer related internal definitions |
|
43 // Rounding known bug in GCC |
|
44 #ifndef __GCC32__ |
|
45 #define GETPTR |
|
46 #else |
|
47 #define GETPTR & |
|
48 #endif |
|
49 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0} |
|
50 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0} |
|
51 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c} |
|
52 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c} |
|
53 |
|
54 // FORWARD DECLARATIONS |
|
55 class CIsvTelephonyTest; |
|
56 class CIsvTelephonyTestEngine; |
|
57 class CIsvTelephonyTestParser; |
|
58 |
|
59 // DATA TYPES |
|
60 // TInt CIsvTelephonyTest::<NameOfFunction> ( TTestResult& aResult ) |
|
61 typedef TInt (CIsvTelephonyTest::* TestFunction)(TTestResult&); |
|
62 |
|
63 // CLASS DECLARATION |
|
64 |
|
65 /** |
|
66 * An internal structure containing a test case name and |
|
67 * the pointer to function doing the test |
|
68 * |
|
69 * @lib ?library |
|
70 * @since ?Series60_version |
|
71 */ |
|
72 class TCaseInfoInternal |
|
73 { |
|
74 public: |
|
75 const TText* iCaseName; |
|
76 TestFunction iMethod; |
|
77 TBool iIsOOMTest; |
|
78 TInt iFirstMemoryAllocation; |
|
79 TInt iLastMemoryAllocation; |
|
80 }; |
|
81 |
|
82 // CLASS DECLARATION |
|
83 |
|
84 /** |
|
85 * A structure containing a test case name and |
|
86 * the pointer to function doing the test |
|
87 * |
|
88 * @lib ?library |
|
89 * @since ?Series60_version |
|
90 */ |
|
91 class TCaseInfo |
|
92 { |
|
93 public: |
|
94 TPtrC iCaseName; |
|
95 TestFunction iMethod; |
|
96 TBool iIsOOMTest; |
|
97 TInt iFirstMemoryAllocation; |
|
98 TInt iLastMemoryAllocation; |
|
99 |
|
100 TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) |
|
101 { |
|
102 }; |
|
103 }; |
|
104 |
|
105 // CLASS DECLARATION |
|
106 |
|
107 /** |
|
108 * This a IsvTelephonyTest class. |
|
109 * ?other_description_lines |
|
110 * |
|
111 * @lib ?library |
|
112 * @since ?Series60_version |
|
113 */ |
|
114 NONSHARABLE_CLASS(CIsvTelephonyTest) : |
|
115 public CTestModuleBase, |
|
116 public MIsvTelephonyTestMessageHandler |
|
117 { |
|
118 public: // Constructors and destructor |
|
119 |
|
120 /** |
|
121 * Two-phased constructor. |
|
122 */ |
|
123 static CIsvTelephonyTest* NewL(); |
|
124 |
|
125 /** |
|
126 * Destructor. |
|
127 */ |
|
128 virtual ~CIsvTelephonyTest(); |
|
129 |
|
130 public: // Functions from base classes |
|
131 |
|
132 /** |
|
133 * From CTestModuleBase InitL is used to initialize the |
|
134 * IsvTelephonyTest. It is called once for every instance of |
|
135 * IsvTelephonyTest after its creation. |
|
136 * @since |
|
137 * @param aIniFile Initialization file for the test module (optional) |
|
138 * @param aFirstTime Flag is true when InitL is executed for first |
|
139 * created instance of IsvTelephonyTest. |
|
140 * @return Symbian OS error code |
|
141 */ |
|
142 TInt InitL( TFileName& aIniFile, TBool aFirstTime ); |
|
143 |
|
144 /** |
|
145 * From CTestModuleBase GetTestCasesL is used to inquiry test cases |
|
146 * from IsvTelephonyTest. |
|
147 * @since ?Series60_version |
|
148 * @param aTestCaseFile Test case file (optional) |
|
149 * @param aTestCases Array of TestCases returned to test framework |
|
150 * @return Symbian OS error code |
|
151 */ |
|
152 TInt GetTestCasesL( const TFileName& aTestCaseFile, |
|
153 RPointerArray<TTestCaseInfo>& aTestCases ); |
|
154 |
|
155 /** |
|
156 * From CTestModuleBase RunTestCaseL is used to run an individual |
|
157 * test case. |
|
158 * @since ?Series60_version |
|
159 * @param aCaseNumber Test case number |
|
160 * @param aTestCaseFile Test case file (optional) |
|
161 * @param aResult Test case result returned to test framework (PASS/FAIL) |
|
162 * @return Symbian OS error code (test case execution error, which is |
|
163 * not reported in aResult parameter as test case failure). |
|
164 */ |
|
165 TInt RunTestCaseL( const TInt aCaseNumber, |
|
166 const TFileName& aTestCaseFile, |
|
167 TTestResult& aResult ); |
|
168 |
|
169 /** |
|
170 * From CTestModuleBase; OOMTestQueryL is used to specify is particular |
|
171 * test case going to be executed using OOM conditions |
|
172 * @param aTestCaseFile Test case file (optional) |
|
173 * @param aCaseNumber Test case number (optional) |
|
174 * @param aFailureType OOM failure type (optional) |
|
175 * @param aFirstMemFailure The first heap memory allocation failure value (optional) |
|
176 * @param aLastMemFailure The last heap memory allocation failure value (optional) |
|
177 * @return TBool |
|
178 */ |
|
179 virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, |
|
180 const TInt /* aCaseNumber */, |
|
181 TOOMFailureType& aFailureType, |
|
182 TInt& /* aFirstMemFailure */, |
|
183 TInt& /* aLastMemFailure */ ); |
|
184 |
|
185 /** |
|
186 * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM |
|
187 * test environment |
|
188 * @param aTestCaseFile Test case file (optional) |
|
189 * @param aCaseNumber Test case number (optional) |
|
190 * @return None |
|
191 */ |
|
192 virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, |
|
193 const TInt /* aCaseNumber */ ); |
|
194 |
|
195 /** |
|
196 * From CTestModuleBase; OOMHandleWarningL |
|
197 * @param aTestCaseFile Test case file (optional) |
|
198 * @param aCaseNumber Test case number (optional) |
|
199 * @param aFailNextValue FailNextValue for OOM test execution (optional) |
|
200 * @return None |
|
201 * |
|
202 * User may add implementation for OOM test warning handling. Usually no |
|
203 * implementation is required. |
|
204 */ |
|
205 virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, |
|
206 const TInt /* aCaseNumber */, |
|
207 TInt& /* aFailNextValue */); |
|
208 |
|
209 /** |
|
210 * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM |
|
211 * test environment |
|
212 * @param aTestCaseFile Test case file (optional) |
|
213 * @param aCaseNumber Test case number (optional) |
|
214 * @return None |
|
215 * |
|
216 */ |
|
217 virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, |
|
218 const TInt /* aCaseNumber */ ); |
|
219 /** |
|
220 * Method used to log version of test module |
|
221 */ |
|
222 void SendTestModuleVersion(); |
|
223 |
|
224 public: // Functions from MIsvTelephonyTestMessageHandler |
|
225 |
|
226 /** |
|
227 * From MIsvTelephonyTestMessageHandler. |
|
228 * Outputs messages to Stif UI or log |
|
229 * @param aMessage Contains the message |
|
230 */ |
|
231 virtual void PrintMessage( const TDesC& aMessage ); |
|
232 |
|
233 /** |
|
234 * From MIsvTelephonyTestMessageHandler. |
|
235 * Outputs messages to Stif UI or log |
|
236 * @param aMessage Contains the message |
|
237 */ |
|
238 virtual void PrintMessage( TRefByValue<const TDesC> aMessage,... ); |
|
239 |
|
240 private: |
|
241 |
|
242 /** |
|
243 * C++ default constructor. |
|
244 */ |
|
245 CIsvTelephonyTest(); |
|
246 |
|
247 /** |
|
248 * By default Symbian 2nd phase constructor is private. |
|
249 */ |
|
250 void ConstructL(); |
|
251 |
|
252 /** |
|
253 * Function returning test case name and pointer to test case function. |
|
254 * @since ?Series60_version |
|
255 * @param aCaseNumber test case number |
|
256 * @return TCaseInfo |
|
257 */ |
|
258 const TCaseInfo Case ( const TInt aCaseNumber ) const; |
|
259 |
|
260 /** |
|
261 * Actual Hardcoded test case functions are listed below. |
|
262 */ |
|
263 /** |
|
264 * Sets cancellation of async. function tests. |
|
265 * First call this setter case, and then execute test |
|
266 * for async. function, e.g. GetCallBarringStatus |
|
267 */ |
|
268 TInt SetCancelAsyncs( TTestResult& aResult ); |
|
269 |
|
270 /** |
|
271 * Clears cancellation of async. function tests. |
|
272 */ |
|
273 TInt ClearCancelAsyncs( TTestResult& aResult ); |
|
274 |
|
275 /** |
|
276 * Test CTelephony::GetVersion |
|
277 */ |
|
278 TInt TestGetVersion( TTestResult& aResult ); |
|
279 |
|
280 /** |
|
281 * Test CTelephony::GetPhoneId |
|
282 */ |
|
283 TInt TestGetPhoneId( TTestResult& aResult ); |
|
284 |
|
285 /** |
|
286 * Test CTelephony::GetSubscriber |
|
287 */ |
|
288 TInt TestGetSubscriberId( TTestResult& aResult ); |
|
289 |
|
290 /** |
|
291 * Test CTelephony::GetFlightMode |
|
292 */ |
|
293 TInt TestGetFlightMode( TTestResult& aResult ); |
|
294 |
|
295 /** |
|
296 * Test CTelephony::GetIndicator |
|
297 */ |
|
298 TInt TestGetIndicator( TTestResult& aResult ); |
|
299 |
|
300 /** |
|
301 * Test CTelephony::GetBatteryInfo |
|
302 */ |
|
303 TInt TestGetBatteryInfo( TTestResult& aResult ); |
|
304 |
|
305 /** |
|
306 * Test CTelephony::GetSignalStrength |
|
307 */ |
|
308 TInt TestGetSignalStrength( TTestResult& aResult ); |
|
309 |
|
310 /** |
|
311 * Test CTelephony::GetLockInfo |
|
312 */ |
|
313 TInt TestGetLockInfo( TTestResult& aResult ); |
|
314 |
|
315 /** |
|
316 * Test CTelephony::SendDTMFTones |
|
317 */ |
|
318 TInt TestSendDTMFTones( TTestResult& aResult ); |
|
319 |
|
320 /** |
|
321 * Test CTelephony::GetLineStatus |
|
322 */ |
|
323 TInt TestGetLineStatus( TTestResult& aResult ); |
|
324 |
|
325 /** |
|
326 * Test CTelephony::GetCallInfo |
|
327 */ |
|
328 TInt TestGetCallInfoL( TTestResult& aResult ); |
|
329 |
|
330 /** |
|
331 * Test CTelephony::GetNetworkRegistrationStatus |
|
332 */ |
|
333 TInt TestGetNetworkRegistrationStatus( TTestResult& aResult ); |
|
334 |
|
335 /** |
|
336 * Test CTelephony::GetCurrentNetworkInfo |
|
337 */ |
|
338 TInt TestGetCurrentNetworkInfo( TTestResult& aResult ); |
|
339 |
|
340 /** |
|
341 * Test CTelephony::GetCurrentNetworkName |
|
342 */ |
|
343 TInt TestGetCurrentNetworkName( TTestResult& aResult ); |
|
344 |
|
345 /** |
|
346 * Test CTelephony::GetOperatorName |
|
347 */ |
|
348 TInt TestGetOperatorName( TTestResult& aResult ); |
|
349 |
|
350 /** |
|
351 * Test CTelephony::GetCallForwardingStatus |
|
352 */ |
|
353 TInt TestGetCallForwardingStatus( TTestResult& aResult ); |
|
354 |
|
355 /** |
|
356 * Test CTelephony::GetCallBarringStatus |
|
357 */ |
|
358 TInt TestGetCallBarringStatus( TTestResult& aResult ); |
|
359 |
|
360 /** |
|
361 * Test CTelephony::GetCallWaitingStatus |
|
362 */ |
|
363 TInt TestGetCallWaitingStatus( TTestResult& aResult ); |
|
364 |
|
365 /** |
|
366 * Test CTelephony::GetIdentityServiceStatus |
|
367 */ |
|
368 TInt TestGetIdentityServiceStatus( TTestResult& aResult ); |
|
369 |
|
370 /** |
|
371 * Test CTelephony::DialNewCall |
|
372 */ |
|
373 TInt TestDialNewCall( TTestResult& aResult ); |
|
374 |
|
375 /** |
|
376 * Test CTelephony::GetCallDynamicCaps |
|
377 */ |
|
378 TInt TestGetCallDynamicCaps( TTestResult& aResult ); |
|
379 |
|
380 /** |
|
381 * Test CTelephony::GetCallStatus |
|
382 */ |
|
383 TInt TestGetCallStatus( TTestResult& aResult ); |
|
384 |
|
385 /** |
|
386 * Test CTelephony::Hold |
|
387 */ |
|
388 TInt TestHold( TTestResult& aResult ); |
|
389 |
|
390 /** |
|
391 * Test CTelephony::Resume |
|
392 */ |
|
393 TInt TestResume( TTestResult& aResult ); |
|
394 |
|
395 /** |
|
396 * Test CTelephony::Swap |
|
397 */ |
|
398 TInt TestSwap( TTestResult& aResult ); |
|
399 |
|
400 /** |
|
401 * Test CTelephony::Hangup |
|
402 */ |
|
403 TInt TestHangup( TTestResult& aResult ); |
|
404 |
|
405 /** |
|
406 * Test CTelephony::AnswerIncomingCall |
|
407 */ |
|
408 TInt TestAnswerIncomingCall( TTestResult& aResult ); |
|
409 |
|
410 /** |
|
411 * Test CTelephony::NotifyChange |
|
412 */ |
|
413 TInt TestNotifyChangeVoiceLineStatus ( TTestResult& aResult ); |
|
414 |
|
415 /** |
|
416 * Test CTelephony::FindDeviceStatus |
|
417 */ |
|
418 TInt TestFindDeviceStatus( TTestResult& aResult ); |
|
419 |
|
420 /** |
|
421 * Test CTelephony::EstablishDataCall |
|
422 */ |
|
423 TInt TestEstablishDataCall( TTestResult& aResult ); |
|
424 |
|
425 /** |
|
426 * Test CTelephony::EstablishDataCall |
|
427 */ |
|
428 TInt TestEstablishDataCallAsync( TTestResult& aResult ); |
|
429 |
|
430 /** |
|
431 * Test CTelephony::TerminateDataCall |
|
432 */ |
|
433 TInt TestTerminateDataCall( TTestResult& aResult ); |
|
434 |
|
435 /** |
|
436 * Test CTelephony::ReceiveDataCall |
|
437 */ |
|
438 TInt TestReceiveDataCall( TTestResult& aResult ); |
|
439 |
|
440 /** |
|
441 * Test CTelephony::ReceiveDataCall |
|
442 */ |
|
443 TInt TestReceiveDataCallAsync( TTestResult& aResult ); |
|
444 |
|
445 /** |
|
446 * Test CTelephony::CancelEstablishDataCall |
|
447 */ |
|
448 TInt TestCancelEstablishDataCall( TTestResult& aResult ); |
|
449 |
|
450 /** |
|
451 * Test CTelephony::CancelReceiveDataCall |
|
452 */ |
|
453 TInt TestCancelReceiveDataCall( TTestResult& aResult ); |
|
454 |
|
455 private: // Data |
|
456 // Pointer to test (function) to be executed |
|
457 TestFunction iMethod; |
|
458 |
|
459 // Pointer to test result |
|
460 TTestResult* iTestResult; |
|
461 |
|
462 // Pointer to logger |
|
463 CStifLogger* iLogger; |
|
464 |
|
465 // Logging output selector (Stif UI output VS. file logging) |
|
466 TMessageOption iMessageOption; |
|
467 |
|
468 // Counter for STIF UI line number |
|
469 TInt iStifUiLineCounter; |
|
470 |
|
471 // Pointer to active scheduler |
|
472 CActiveScheduler* iTestScheduler; |
|
473 |
|
474 // Pointer to test engine |
|
475 CIsvTelephonyTestEngine* iTestEngine; |
|
476 |
|
477 // Pointer to test parser |
|
478 CIsvTelephonyTestParser* iTestParser; |
|
479 |
|
480 // For ISV Telephony call handling tests |
|
481 CTelephony::TCallParamsV1 iCallParams; |
|
482 CTelephony::TCallId iCallId1; |
|
483 CTelephony::TCallId iCallId2; |
|
484 CTelephony::TCallStatusV1 iCallStatus; |
|
485 CTelephony::TCallSelectionV1 iCallSelection; |
|
486 CTelephony::TCallInfoV1 iCallInfo; |
|
487 CTelephony::TRemotePartyInfoV1 iRemotePartyInfo; |
|
488 CTelephony::TCallCapsV1 iCallCaps; |
|
489 |
|
490 // Initialised from ini file |
|
491 // Telephone number 1 |
|
492 CTelephony::TTelNumber iTelNumber1; |
|
493 // Telephone number 2 |
|
494 CTelephony::TTelNumber iTelNumber2; |
|
495 // CLIR setting |
|
496 CTelephony::TCallerIdentityRestrict iIdRestrict; |
|
497 // Phone Line |
|
498 CTelephony::TPhoneLine iPhoneLine; |
|
499 // DTMF tones |
|
500 RBuf iDTMFTones; |
|
501 |
|
502 }; |
|
503 |
|
504 #endif // ISVTELEPHONYTEST_H |
|
505 |
|
506 // End of File |