|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This program is designed the test of the MMF_ACLNT. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file TestPlayerUtils.cpp |
|
20 */ |
|
21 |
|
22 |
|
23 #include "TestPlayerUtils.h" |
|
24 #include <caf/caf.h> |
|
25 |
|
26 // constant table of parameters for tests |
|
27 const TRepeatParameters KTestParameters[] = |
|
28 { |
|
29 { _S("playerAudioFile"), 1, 1}, |
|
30 { _S("Pcm16Mono12khz"), 3, 3}, |
|
31 { _S("PCM8"), 3, 3}, |
|
32 { _S("PCM8-6144bytes"), 1, 1}, |
|
33 { _S("ALAW"), 3, 3}, |
|
34 { _S("PCM16"), 1, 1}, |
|
35 { _S("PCMU8"), 2, 2}, |
|
36 { _S("PCMU16BE"), 3, 3}, |
|
37 { _S("PCMU16"), 1, 1}, |
|
38 { _S("MULAW"), 2, 2}, |
|
39 { _S("Sequence1"), 2, 2}, |
|
40 { _S("Sequence2"), 3, 3}, |
|
41 { _S("IMAD"), 3, 3}, |
|
42 { _S("GSM610"), 1, 1}, |
|
43 { _S("Pcm8Mono44khz"), 2, 2}, |
|
44 { _S("Pcm16Mono44khz"), 3, 3}, |
|
45 { _S("Pcm16Mono48khz"), 1, 1}, |
|
46 { _S("100khzSRate1KhzTone"), 2, 2}, |
|
47 { _S("Pcm16Mono24khz"), 3, 3}, |
|
48 { _S("playerAudioFile2"), 2, 2} |
|
49 }; |
|
50 |
|
51 const TInt KNoOfTestFiles = 20; |
|
52 TAny GetDriveName(TDes& aFileName) |
|
53 { |
|
54 #ifdef __WINS__ |
|
55 aFileName = _L("c:"); |
|
56 #elif defined(__MARM__) || defined(__X86GCC__) |
|
57 #ifdef __TEST_FILES_ON_C_DRIVE__ |
|
58 aFileName = _L("c:"); |
|
59 #else |
|
60 aFileName = _L("z:"); |
|
61 #endif // __TEST_FILES_ON_C_DRIVE__ |
|
62 #endif |
|
63 } |
|
64 |
|
65 |
|
66 #define STOP_TEST_GEN_ERROR ERR_PRINTF1(_L("State machine error")), StopTest(KErrGeneral, EFail) |
|
67 /** |
|
68 * Constructor |
|
69 */ |
|
70 CTestMmfAclntFile::CTestMmfAclntFile(const TDesC& aTestName,const TDesC& aSectName, |
|
71 const TDesC& aKeyName,const TBool aPlay, |
|
72 const TInt aExpectedError) |
|
73 :iPlay (aPlay) |
|
74 ,iExpectedError (aExpectedError) |
|
75 { |
|
76 // store the name of this test case |
|
77 // this is the name that is used by the script file |
|
78 // Each test step initialises it's own name |
|
79 iTestStepName = aTestName; |
|
80 iSectName = aSectName; |
|
81 iKeyName = aKeyName; |
|
82 } |
|
83 |
|
84 CTestMmfAclntFile* CTestMmfAclntFile::NewL(const TDesC& aTestName, const TDesC& aSectName, |
|
85 const TDesC& aKeyName,const TBool aPlay, |
|
86 const TInt aExpectedError = KErrNone) |
|
87 { |
|
88 CTestMmfAclntFile* self = new (ELeave) CTestMmfAclntFile(aTestName,aSectName,aKeyName,aPlay,aExpectedError); |
|
89 return self; |
|
90 } |
|
91 |
|
92 CTestMmfAclntFile* CTestMmfAclntFile::NewLC(const TDesC& aTestName, const TDesC& aSectName, |
|
93 const TDesC& aKeyName, |
|
94 const TBool aPlay, |
|
95 const TInt aExpectedError) |
|
96 { |
|
97 CTestMmfAclntFile* self = CTestMmfAclntFile::NewL(aTestName,aSectName,aKeyName,aPlay,aExpectedError); |
|
98 CleanupStack::PushL(self); |
|
99 return self; |
|
100 } |
|
101 |
|
102 void CTestMmfAclntFile::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration) |
|
103 { |
|
104 iError = aError; |
|
105 iDuration = aDuration; |
|
106 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
107 CActiveScheduler::Stop(); |
|
108 } |
|
109 |
|
110 void CTestMmfAclntFile::MapcPlayComplete(TInt aError) |
|
111 { |
|
112 iError = aError; |
|
113 INFO_PRINTF1(_L("MMdaAudioPlayerCallback Play Complete")); |
|
114 CActiveScheduler::Stop(); |
|
115 } |
|
116 |
|
117 |
|
118 |
|
119 /** Load and initialise an audio file. |
|
120 */ |
|
121 TVerdict CTestMmfAclntFile::DoTestStepL( void ) |
|
122 { |
|
123 INFO_PRINTF1( _L("TestPlayerUtils : File")); |
|
124 TVerdict ret = EFail; |
|
125 |
|
126 iError = KErrTimedOut; |
|
127 |
|
128 TBuf<KSizeBuf> filename; |
|
129 TPtrC filename1; |
|
130 if(!GetStringFromConfig(iSectName,iKeyName,filename1)) |
|
131 { |
|
132 return EInconclusive; |
|
133 } |
|
134 |
|
135 GetDriveName(filename); |
|
136 filename.Append(filename1); |
|
137 |
|
138 CMdaAudioPlayerUtility* player = NULL; |
|
139 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &filename); |
|
140 player = CMdaAudioPlayerUtility::NewFilePlayerL(filename, *this); |
|
141 |
|
142 if (iTestStepName.Compare(_L("MM-MMF-ACLNT-I-2001-HP"))==0) |
|
143 { |
|
144 // Check file size is more than 0 |
|
145 RFs fs; |
|
146 TInt err = fs.Connect(); |
|
147 if (err != KErrNone) |
|
148 { |
|
149 INFO_PRINTF2(_L("Error connecting to file session (%d)"), err); |
|
150 return EInconclusive; |
|
151 } |
|
152 CleanupClosePushL(fs); |
|
153 TEntry fileEntry; |
|
154 err = fs.Entry(filename, fileEntry); |
|
155 if (err != KErrNone) |
|
156 { |
|
157 INFO_PRINTF2(_L("Error getting file entry (%d)"), err); |
|
158 fs.Close(); |
|
159 return EInconclusive; |
|
160 } |
|
161 if (fileEntry.iSize <= 0) |
|
162 { |
|
163 INFO_PRINTF2(_L("Test file '%S' has size %d"), fileEntry.iSize); |
|
164 fs.Close(); |
|
165 return EInconclusive; |
|
166 |
|
167 } |
|
168 CleanupStack::PopAndDestroy(); // fs |
|
169 } |
|
170 |
|
171 #ifndef __WINS__ |
|
172 if (iTestStepName.Compare(_L("MM-MMF-ACLNT-I-2014-LP")) == 0) |
|
173 { |
|
174 // this test should not be run on Lubbock |
|
175 INFO_PRINTF1(_L("Lubbock hardware is not fast enough to convert 100KHz audio.")); |
|
176 INFO_PRINTF1(_L("This test has been skipped for this reason...")); |
|
177 |
|
178 delete player; |
|
179 User::After(KOneSecond); // wait for deletion to shut down devsound |
|
180 |
|
181 return EPass; |
|
182 } |
|
183 #endif |
|
184 |
|
185 // Wait for initialisation callback |
|
186 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
187 CActiveScheduler::Start(); |
|
188 |
|
189 if(iError != KErrNone && (iExpectedError == iError)) |
|
190 { |
|
191 if (iTestStepName.Compare(_L("MM-MMF-ACLNT-I-1008-HP")) == 0) |
|
192 { |
|
193 // Test is for non-existent file - check that the file has not been created |
|
194 RFs fs; |
|
195 TInt err = fs.Connect(); |
|
196 if (err != KErrNone) |
|
197 { |
|
198 ret = EInconclusive; |
|
199 } |
|
200 else |
|
201 { |
|
202 TEntry entry; |
|
203 if (fs.Entry(filename, entry) == KErrNone) |
|
204 { |
|
205 ret = EFail; // file exists - test fails |
|
206 } |
|
207 |
|
208 else |
|
209 ret = EPass; |
|
210 fs.Close(); |
|
211 } |
|
212 } |
|
213 else |
|
214 { |
|
215 ret = EPass; // all other tests pass |
|
216 } |
|
217 delete player; |
|
218 User::After(KOneSecond); // wait for deletion to shut down devsound |
|
219 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with expectable error %d"),iError ); |
|
220 return ret; |
|
221 } |
|
222 // Check for errors. |
|
223 if (iError == KErrNone && player != NULL) |
|
224 { |
|
225 if(iPlay) |
|
226 { |
|
227 iError = KErrTimedOut; |
|
228 player->Play(); |
|
229 |
|
230 // Wait for init callback |
|
231 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
232 CActiveScheduler::Start(); |
|
233 |
|
234 //can't use iExpected Error as is doesn't distinguish between |
|
235 //error from NewFilePlayerL or PlayL. |
|
236 if ((iTestStepName.Compare(_L("MM-MMF-ACLNT-I-2015-LP")) == 0)) |
|
237 { |
|
238 if(iError == KErrNotSupported) |
|
239 { |
|
240 ret = EPass; |
|
241 } |
|
242 } |
|
243 else if(iError == KErrNone) |
|
244 ret = EPass; |
|
245 } |
|
246 else |
|
247 ret = EPass; |
|
248 } |
|
249 |
|
250 delete player; |
|
251 User::After(KOneSecond); // wait for deletion to shut down devsound |
|
252 if(iError != KErrNone) |
|
253 { |
|
254 if ((iTestStepName.Compare(_L("MM-MMF-ACLNT-I-2014-LP")) == 0) && iError==KErrNotSupported) |
|
255 { |
|
256 //Sampling Rate greater than 96000 Hz is not expected in data , and we dont support this. |
|
257 //This test has been changed to expect KErrNotSupported due to fix in PDEF131534 |
|
258 INFO_PRINTF1( _L("CMdaAudiPlayerUtility returned KErrNotSupported as expected")); |
|
259 ret= EPass; |
|
260 } |
|
261 else |
|
262 { |
|
263 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
264 } |
|
265 } |
|
266 |
|
267 return ret; |
|
268 } |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 /** |
|
277 * Constructor |
|
278 */ |
|
279 CTestMmfAclntSEQNFile::CTestMmfAclntSEQNFile(const TDesC& aTestName,const TDesC& aSectName, |
|
280 const TDesC& aKeyName, |
|
281 const TBool aPlay, |
|
282 const TBool aIsFile) |
|
283 :iPlay (aPlay) |
|
284 ,iIsFile (aIsFile) |
|
285 { |
|
286 // store the name of this test case |
|
287 // this is the name that is used by the script file |
|
288 // Each test step initialises it's own name |
|
289 iTestStepName = aTestName; |
|
290 iSectName = aSectName; |
|
291 iKeyName = aKeyName; |
|
292 } |
|
293 |
|
294 CTestMmfAclntSEQNFile* CTestMmfAclntSEQNFile::NewL(const TDesC& aTestName, const TDesC& aSectName, |
|
295 const TDesC& aKeyName, |
|
296 const TBool aPlay, |
|
297 const TBool aIsFile) |
|
298 { |
|
299 CTestMmfAclntSEQNFile* self = new (ELeave) CTestMmfAclntSEQNFile(aTestName,aSectName,aKeyName,aPlay,aIsFile); |
|
300 return self; |
|
301 } |
|
302 |
|
303 CTestMmfAclntSEQNFile* CTestMmfAclntSEQNFile::NewLC(const TDesC& aTestName, const TDesC& aSectName, |
|
304 const TDesC& aKeyName, |
|
305 const TBool aPlay, |
|
306 const TBool aIsFile) |
|
307 { |
|
308 CTestMmfAclntSEQNFile* self = CTestMmfAclntSEQNFile::NewL(aTestName,aSectName,aKeyName,aPlay,aIsFile); |
|
309 CleanupStack::PushL(self); |
|
310 return self; |
|
311 } |
|
312 |
|
313 void CTestMmfAclntSEQNFile::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration) |
|
314 { |
|
315 iError = aError; |
|
316 iDuration = aDuration; |
|
317 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
318 CActiveScheduler::Stop(); |
|
319 } |
|
320 |
|
321 void CTestMmfAclntSEQNFile::MapcPlayComplete(TInt aError) |
|
322 { |
|
323 iError = aError; |
|
324 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); |
|
325 CActiveScheduler::Stop(); |
|
326 } |
|
327 |
|
328 |
|
329 //This method is used to stop playing the file 1 second after we started |
|
330 void CTestMmfAclntSEQNFile::DelayedMethodCallL() |
|
331 { |
|
332 CActiveScheduler::Stop(); |
|
333 } |
|
334 |
|
335 |
|
336 |
|
337 /** Load and play an audio sequence file. |
|
338 */ |
|
339 TVerdict CTestMmfAclntSEQNFile::DoTestStepL( void ) |
|
340 { |
|
341 INFO_PRINTF1( _L("TestPlayerUtils : File")); |
|
342 TVerdict ret = EFail; |
|
343 |
|
344 iError = KErrTimedOut; |
|
345 |
|
346 TBuf<KSizeBuf> filename; |
|
347 TPtrC filename1; |
|
348 if(!GetStringFromConfig(iSectName,iKeyName,filename1)) |
|
349 { |
|
350 return EInconclusive; |
|
351 } |
|
352 |
|
353 GetDriveName(filename); |
|
354 filename.Append(filename1); |
|
355 |
|
356 |
|
357 CMdaAudioPlayerUtility* player = NULL; |
|
358 HBufC8* seqnDesc = NULL; |
|
359 RFile file; |
|
360 RFs fs; |
|
361 |
|
362 if(iIsFile) |
|
363 { |
|
364 player = CMdaAudioPlayerUtility::NewFilePlayerL(filename, *this); |
|
365 } |
|
366 else |
|
367 { |
|
368 |
|
369 User::LeaveIfError(fs.Connect()); |
|
370 //TIMB |
|
371 User::LeaveIfError(file.Open(fs, filename, EFileShareReadersOnly | EFileStream)); |
|
372 CleanupClosePushL(file); |
|
373 |
|
374 TInt size; |
|
375 User::LeaveIfError(file.Size(size)); |
|
376 |
|
377 seqnDesc = HBufC8::NewMaxLC(size); |
|
378 |
|
379 TPtr8 bufferDes(seqnDesc->Des()); |
|
380 User::LeaveIfError(file.Read(bufferDes)); |
|
381 |
|
382 player = CMdaAudioPlayerUtility::NewDesPlayerL(bufferDes, *this); |
|
383 } |
|
384 |
|
385 CleanupStack::PushL(player); |
|
386 |
|
387 // Wait for initialisation callback |
|
388 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
389 CActiveScheduler::Start(); |
|
390 |
|
391 |
|
392 if(iError == KErrNone) |
|
393 { |
|
394 TInt maxVol = player->MaxVolume(); |
|
395 player->SetVolume(maxVol/2); |
|
396 TInt gotVol; |
|
397 iError = player->GetVolume(gotVol); |
|
398 |
|
399 if((iError != KErrNone) || (maxVol/2 != gotVol)) |
|
400 { |
|
401 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed volume tests")); |
|
402 if(iError == KErrNone) |
|
403 iError = KErrGeneral; |
|
404 } |
|
405 } |
|
406 |
|
407 |
|
408 if(iError == KErrNone) |
|
409 { |
|
410 TTimeIntervalMicroSeconds t(0); |
|
411 TTimeIntervalMicroSeconds zeroUs(0); |
|
412 |
|
413 t = player->Duration(); |
|
414 |
|
415 if(t != zeroUs) |
|
416 { |
|
417 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed duration test")); |
|
418 iError = KErrGeneral; |
|
419 } |
|
420 |
|
421 player->SetPosition(zeroUs); |
|
422 iError = player->GetPosition(t); |
|
423 |
|
424 if((t != zeroUs) || (iError != KErrNone)) |
|
425 { |
|
426 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed duration test")); |
|
427 if(iError == KErrNone) |
|
428 iError = KErrGeneral; |
|
429 } |
|
430 } |
|
431 |
|
432 if(iError == KErrNone) |
|
433 { |
|
434 TInt entries; |
|
435 TInt metaErr = KErrNone; |
|
436 |
|
437 metaErr = player->GetNumberOfMetaDataEntries(entries); |
|
438 |
|
439 if(metaErr != KErrNotSupported) |
|
440 { |
|
441 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed volume tests")); |
|
442 iError = metaErr; |
|
443 } |
|
444 else |
|
445 { |
|
446 CMMFMetaDataEntry* metaEntry = NULL; // EABI warning removal - "metaEntry was set but never used" |
|
447 |
|
448 TRAP(metaErr, metaEntry = player->GetMetaDataEntryL(0)); // EABI warning removal - "metaEntry was set but never used" |
|
449 |
|
450 |
|
451 if(metaErr != KErrNotSupported) |
|
452 { |
|
453 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed volume tests")); |
|
454 iError = metaErr; |
|
455 if (metaErr==KErrNone) |
|
456 { |
|
457 delete metaEntry; |
|
458 } |
|
459 } |
|
460 } |
|
461 } |
|
462 |
|
463 |
|
464 |
|
465 if(iError == KErrNone) |
|
466 { |
|
467 player->SetBalance(KMMFBalanceMaxLeft); |
|
468 TInt bal = KMMFBalanceCenter; |
|
469 |
|
470 iError = player->GetBalance(bal); |
|
471 |
|
472 if(bal != KMMFBalanceMaxLeft) |
|
473 { |
|
474 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed balance tests")); |
|
475 if(iError == KErrNone) |
|
476 iError = KErrGeneral; |
|
477 } |
|
478 else |
|
479 player->SetBalance(KMMFBalanceCenter); |
|
480 } |
|
481 |
|
482 |
|
483 if(iError == KErrNone) |
|
484 { |
|
485 TInt priErr = player->SetPriority(EMdaPriorityMin, EMdaPriorityPreferenceNone); |
|
486 |
|
487 if(priErr != KErrNone) |
|
488 { |
|
489 ERR_PRINTF1( _L("CMdaAudioPlayerUtility failed priority tests")); |
|
490 iError = KErrGeneral; |
|
491 } |
|
492 else |
|
493 player->SetPriority(EMdaPriorityNormal, EMdaPriorityPreferenceNone); |
|
494 } |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 if(iError == KErrNone) |
|
500 { |
|
501 iError = KErrTimedOut; |
|
502 player->Play(); |
|
503 |
|
504 //Stop the player after one second and restart |
|
505 CDelayedMethodCall* delayedMethodCall = CDelayedMethodCall::NewL(this); |
|
506 CleanupStack::PushL(delayedMethodCall); |
|
507 delayedMethodCall->After(KOneSecond); |
|
508 |
|
509 CActiveScheduler::Start(); |
|
510 |
|
511 CleanupStack::PopAndDestroy(delayedMethodCall); |
|
512 |
|
513 player->Stop(); |
|
514 |
|
515 player->Play(); |
|
516 CActiveScheduler::Start(); |
|
517 } |
|
518 |
|
519 |
|
520 |
|
521 CleanupStack::PopAndDestroy(player); |
|
522 if(iIsFile == EFalse) |
|
523 { |
|
524 CleanupStack::PopAndDestroy(seqnDesc); |
|
525 CleanupStack::PopAndDestroy(&file); |
|
526 } |
|
527 |
|
528 User::After(KOneSecond); // wait for deletion to shut down devsound |
|
529 if(iError == KErrNone) |
|
530 { |
|
531 ret = EPass; |
|
532 } |
|
533 |
|
534 else |
|
535 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
536 |
|
537 return ret; |
|
538 } |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 //------------------------------------------------------------------ |
|
545 |
|
546 /** |
|
547 * Constructor |
|
548 */ |
|
549 CTestMmfAclntDesc::CTestMmfAclntDesc(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TBool aPlay, const TInt aExpectedError) |
|
550 :iPlay (aPlay), |
|
551 iExpectedError(aExpectedError) |
|
552 |
|
553 { |
|
554 // store the name of this test case |
|
555 // this is the name that is used by the script file |
|
556 // Each test step initialises it's own name |
|
557 iTestStepName = aTestName; |
|
558 iSectName = aSectName; |
|
559 iKeyName = aKeyName; |
|
560 } |
|
561 |
|
562 CTestMmfAclntDesc* CTestMmfAclntDesc::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TInt aExpectedError) |
|
563 { |
|
564 CTestMmfAclntDesc* self = new (ELeave) CTestMmfAclntDesc(aTestName,aSectName,aKeyName,aPlay,aExpectedError); |
|
565 return self; |
|
566 } |
|
567 |
|
568 CTestMmfAclntDesc* CTestMmfAclntDesc::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TInt aExpectedError = KErrNone) |
|
569 { |
|
570 CTestMmfAclntDesc* self = CTestMmfAclntDesc::NewLC(aTestName,aSectName,aKeyName,aPlay, aExpectedError); |
|
571 CleanupStack::PushL(self); |
|
572 return self; |
|
573 } |
|
574 |
|
575 void CTestMmfAclntDesc::MapcInitComplete(TInt aError, |
|
576 const TTimeIntervalMicroSeconds &aDuration) |
|
577 { |
|
578 iError = aError; |
|
579 iDuration = aDuration; |
|
580 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
581 CActiveScheduler::Stop(); |
|
582 } |
|
583 |
|
584 void CTestMmfAclntDesc::MapcPlayComplete(TInt aError) |
|
585 { |
|
586 iError = aError; |
|
587 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); |
|
588 CActiveScheduler::Stop(); |
|
589 } |
|
590 |
|
591 TVerdict CTestMmfAclntDesc::DoTestStepPreambleL() |
|
592 { |
|
593 TBuf<KSizeBuf> filename; |
|
594 TPtrC filename1; |
|
595 |
|
596 if(!GetStringFromConfig(iSectName, iKeyName, filename1)) |
|
597 { |
|
598 return EInconclusive; |
|
599 } |
|
600 |
|
601 GetDriveName(filename); |
|
602 filename.Append(filename1); |
|
603 |
|
604 RFs fs; |
|
605 RFile file; |
|
606 TInt size = 0; |
|
607 TInt returnCode = 0; |
|
608 // connect to file system and open file |
|
609 |
|
610 CleanupClosePushL(file); |
|
611 |
|
612 returnCode = fs.Connect(); |
|
613 if (returnCode != KErrNone) |
|
614 { |
|
615 ERR_PRINTF2(_L("Failed to connect to file server, error %d"), returnCode); |
|
616 fs.Close(); |
|
617 return EFail; |
|
618 } |
|
619 |
|
620 returnCode = file.Open(fs,filename,EFileRead); |
|
621 if (returnCode != KErrNone) |
|
622 { |
|
623 ERR_PRINTF2(_L("Failed to Open the file, error %d"), returnCode); |
|
624 file.Close(); |
|
625 return EFail; |
|
626 } |
|
627 |
|
628 INFO_PRINTF2( _L("File opened successfully %S"), &filename); |
|
629 |
|
630 // Set HBuf size |
|
631 User::LeaveIfError(file.Size(size)); |
|
632 INFO_PRINTF2(_L("size of file = %d\n"),size); //Statement Changed under DEF105143 |
|
633 iAudio = HBufC8::NewMaxL(size); |
|
634 // read data into Hbuf |
|
635 TPtr8 bufferDes(iAudio->Des()); |
|
636 User::LeaveIfError(file.Read(bufferDes)); |
|
637 |
|
638 CleanupStack::PopAndDestroy(); //file |
|
639 return CTestMmfAclntStep::DoTestStepPreambleL(); |
|
640 } |
|
641 |
|
642 TVerdict CTestMmfAclntDesc::DoTestStepPostambleL() |
|
643 { |
|
644 delete iAudio; |
|
645 delete iPlayer; |
|
646 iPlayer = NULL; |
|
647 return CTestMmfAclntStep::DoTestStepPostambleL(); |
|
648 } |
|
649 |
|
650 /** |
|
651 * Load and initialise an audio descriptor. |
|
652 */ |
|
653 TVerdict CTestMmfAclntDesc::DoTestStepL( void ) |
|
654 { |
|
655 INFO_PRINTF1( _L("TestPlayerUtils : Desc")); |
|
656 TVerdict ret = EFail; |
|
657 |
|
658 iError = KErrTimedOut; |
|
659 |
|
660 TPtr8 bufferDes(iAudio->Des()); |
|
661 iPlayer = CMdaAudioPlayerUtility::NewDesPlayerL(bufferDes, *this); |
|
662 // Wait for init callback |
|
663 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
664 CActiveScheduler::Start(); |
|
665 |
|
666 if(iError != KErrNone && iError == iExpectedError) |
|
667 { |
|
668 delete iPlayer; |
|
669 iPlayer = NULL; |
|
670 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with expected error %d"),iError ); |
|
671 return EPass; |
|
672 } |
|
673 |
|
674 if (iError == KErrNone && iPlayer != NULL) |
|
675 { |
|
676 if(iPlay) |
|
677 { |
|
678 iError = KErrTimedOut; |
|
679 iPlayer->Play(); |
|
680 // Wait for init callback |
|
681 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
682 CActiveScheduler::Start(); |
|
683 if(iError == KErrNone) |
|
684 { |
|
685 ret = EPass; |
|
686 } |
|
687 |
|
688 } |
|
689 else |
|
690 ret = EPass; |
|
691 } |
|
692 |
|
693 if(iError != KErrNone) |
|
694 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
695 return ret; |
|
696 } |
|
697 |
|
698 //------------------------------------------------------------------ |
|
699 |
|
700 /** |
|
701 * Load and initialise an audio descriptor - read-only |
|
702 */ |
|
703 |
|
704 CTestMmfAclntDescReadOnly::CTestMmfAclntDescReadOnly(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TBool aPlay, const TInt aExpectedError) |
|
705 :CTestMmfAclntDesc(aTestName, aSectName, aKeyName, aPlay, aExpectedError) |
|
706 { |
|
707 } |
|
708 |
|
709 CTestMmfAclntDescReadOnly* CTestMmfAclntDescReadOnly::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TInt aExpectedError) |
|
710 { |
|
711 CTestMmfAclntDescReadOnly* self = new (ELeave) CTestMmfAclntDescReadOnly(aTestName,aSectName,aKeyName,aPlay,aExpectedError); |
|
712 return self; |
|
713 } |
|
714 |
|
715 CTestMmfAclntDescReadOnly* CTestMmfAclntDescReadOnly::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TInt aExpectedError = KErrNone) |
|
716 { |
|
717 CTestMmfAclntDescReadOnly* self = CTestMmfAclntDescReadOnly::NewLC(aTestName,aSectName,aKeyName,aPlay, aExpectedError); |
|
718 CleanupStack::PushL(self); |
|
719 return self; |
|
720 } |
|
721 |
|
722 TVerdict CTestMmfAclntDescReadOnly::DoTestStepL( void ) |
|
723 { |
|
724 INFO_PRINTF1( _L("TestPlayerUtils : Desc (Read-Only)")); |
|
725 TVerdict ret = EFail; |
|
726 |
|
727 iError = KErrTimedOut; |
|
728 |
|
729 TPtr8 bufferDes(iAudio->Des()); |
|
730 iPlayer = CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(bufferDes, *this); |
|
731 // Wait for init callback |
|
732 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
733 CActiveScheduler::Start(); |
|
734 |
|
735 if(iError != KErrNone && iError == iExpectedError) |
|
736 { |
|
737 delete iPlayer; |
|
738 iPlayer = NULL; |
|
739 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with expected error %d"),iError ); |
|
740 return EPass; |
|
741 } |
|
742 |
|
743 if (iError == KErrNone && iPlayer != NULL) |
|
744 { |
|
745 if(iPlay) |
|
746 { |
|
747 iError = KErrTimedOut; |
|
748 iPlayer->Play(); |
|
749 // Wait for init callback |
|
750 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
751 CActiveScheduler::Start(); |
|
752 if(iError == KErrNone) |
|
753 { |
|
754 ret = EPass; |
|
755 } |
|
756 } |
|
757 else |
|
758 ret = EPass; |
|
759 } |
|
760 |
|
761 delete iPlayer; |
|
762 iPlayer = NULL; |
|
763 if(iError != KErrNone) |
|
764 { |
|
765 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
766 } |
|
767 |
|
768 return ret; |
|
769 } |
|
770 |
|
771 //------------------------------------------------------------------ |
|
772 |
|
773 /** |
|
774 * Load and initialise an audio descriptor, using Open only |
|
775 */ |
|
776 |
|
777 CTestMmfAclntDescOpen::CTestMmfAclntDescOpen(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, const TBool aPlay, const TInt aExpectedError) |
|
778 :CTestMmfAclntDesc(aTestName, aSectName, aKeyName, aPlay, aExpectedError) |
|
779 { |
|
780 } |
|
781 |
|
782 CTestMmfAclntDescOpen* CTestMmfAclntDescOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TInt aExpectedError) |
|
783 { |
|
784 CTestMmfAclntDescOpen* self = new (ELeave) CTestMmfAclntDescOpen(aTestName,aSectName,aKeyName,aPlay,aExpectedError); |
|
785 return self; |
|
786 } |
|
787 |
|
788 CTestMmfAclntDescOpen* CTestMmfAclntDescOpen::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay, const TInt aExpectedError = KErrNone) |
|
789 { |
|
790 CTestMmfAclntDescOpen* self = CTestMmfAclntDescOpen::NewLC(aTestName,aSectName,aKeyName,aPlay, aExpectedError); |
|
791 CleanupStack::PushL(self); |
|
792 return self; |
|
793 } |
|
794 |
|
795 TVerdict CTestMmfAclntDescOpen::DoTestStepL( void ) |
|
796 { |
|
797 INFO_PRINTF1( _L("TestPlayerUtils : Desc (Open)")); |
|
798 TVerdict ret = EFail; |
|
799 |
|
800 TPtr8 bufferDes(iAudio->Des()); |
|
801 TRAPD(err, iPlayer = CMdaAudioPlayerUtility::NewL(*this)); |
|
802 if(err != KErrNone) |
|
803 { |
|
804 delete iPlayer; |
|
805 iPlayer = NULL; |
|
806 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with expected error %d"),iError ); |
|
807 return EFail; |
|
808 } |
|
809 |
|
810 if (err == KErrNone && iPlayer != NULL) |
|
811 { |
|
812 iError = KErrTimedOut; |
|
813 TRAP_IGNORE(iPlayer->OpenDesL(bufferDes)); |
|
814 // Wait for init callback |
|
815 INFO_PRINTF1( _L("OpenDesL CMdaAudioPlayerUtility")); |
|
816 CActiveScheduler::Start(); |
|
817 if(iError == KErrNone) |
|
818 { |
|
819 ret = EPass; |
|
820 } |
|
821 } |
|
822 |
|
823 delete iPlayer; |
|
824 iPlayer = NULL; |
|
825 if(iError != KErrNone) |
|
826 { |
|
827 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
828 } |
|
829 |
|
830 return ret; |
|
831 } |
|
832 |
|
833 //------------------------------------------------------------------ |
|
834 |
|
835 /** |
|
836 * Constructor |
|
837 */ |
|
838 CTestMmfAclntUrl::CTestMmfAclntUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
839 :iPlay (aPlay) |
|
840 { |
|
841 // store the name of this test case |
|
842 // this is the name that is used by the script file |
|
843 // Each test step initialises it's own name |
|
844 iTestStepName = aTestName; |
|
845 iSectName = aSectName; |
|
846 iKeyName = aKeyName; |
|
847 } |
|
848 |
|
849 CTestMmfAclntUrl* CTestMmfAclntUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
850 { |
|
851 CTestMmfAclntUrl* self = new (ELeave) CTestMmfAclntUrl(aTestName,aSectName,aKeyName,aPlay); |
|
852 return self; |
|
853 } |
|
854 |
|
855 CTestMmfAclntUrl* CTestMmfAclntUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TBool aPlay) |
|
856 { |
|
857 CTestMmfAclntUrl* self = CTestMmfAclntUrl::NewLC(aTestName,aSectName,aKeyName,aPlay); |
|
858 CleanupStack::PushL(self); |
|
859 return self; |
|
860 } |
|
861 |
|
862 void CTestMmfAclntUrl::MapcInitComplete(TInt aError, |
|
863 const TTimeIntervalMicroSeconds &aDuration) |
|
864 { |
|
865 iError = aError; |
|
866 iDuration = aDuration; |
|
867 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
868 CActiveScheduler::Stop(); |
|
869 } |
|
870 |
|
871 void CTestMmfAclntUrl::MapcPlayComplete(TInt aError) |
|
872 { |
|
873 iError = aError; |
|
874 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); |
|
875 CActiveScheduler::Stop(); |
|
876 } |
|
877 |
|
878 /** |
|
879 * Open audio from a URL and play. |
|
880 */ |
|
881 TVerdict CTestMmfAclntUrl::DoTestStepL() |
|
882 { |
|
883 INFO_PRINTF1( _L("TestPlayerUtils : URL")); |
|
884 TVerdict ret = EFail; |
|
885 |
|
886 iError = KErrTimedOut; |
|
887 |
|
888 TPtrC urlname; |
|
889 if(!GetStringFromConfig(iSectName,iKeyName,urlname)) |
|
890 { |
|
891 return EInconclusive; |
|
892 } |
|
893 |
|
894 |
|
895 CMdaAudioPlayerUtility* player = CMdaAudioPlayerUtility::NewL(*this); |
|
896 CleanupStack::PushL(player); |
|
897 |
|
898 TRAPD(err, player->OpenUrlL(urlname)); |
|
899 if(err) |
|
900 { |
|
901 if(err != KErrNotSupported) |
|
902 { |
|
903 ERR_PRINTF2( _L("OpenUrlL left with error %d"), err); |
|
904 CleanupStack::PopAndDestroy(player); |
|
905 return EFail; |
|
906 } |
|
907 else |
|
908 { |
|
909 INFO_PRINTF2( _L("OpenUrlL left with expected error %d"), err); |
|
910 CleanupStack::PopAndDestroy(player); |
|
911 return EPass; |
|
912 } |
|
913 } |
|
914 |
|
915 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
916 CActiveScheduler::Start(); |
|
917 |
|
918 if (iError == KErrNotSupported) |
|
919 { |
|
920 ret = EPass; |
|
921 } |
|
922 |
|
923 |
|
924 CleanupStack::PopAndDestroy(player); |
|
925 if(iError != KErrNone) |
|
926 { |
|
927 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
928 } |
|
929 |
|
930 return ret; |
|
931 } |
|
932 |
|
933 //------------------------------------------------------------------ |
|
934 |
|
935 /** |
|
936 * Constructor |
|
937 */ |
|
938 CTestMmfAclntAudioPlayerUtil::CTestMmfAclntAudioPlayerUtil(const TDesC& aTestName, const TDesC& aSectName) |
|
939 { |
|
940 // store the name of this test case |
|
941 // this is the name that is used by the script file |
|
942 // Each test step initialises it's own name |
|
943 iTestStepName=aTestName; |
|
944 iStop = ETrue; |
|
945 iSectName = aSectName; |
|
946 } |
|
947 |
|
948 |
|
949 void CTestMmfAclntAudioPlayerUtil::MapcInitComplete(TInt aError, |
|
950 const TTimeIntervalMicroSeconds &aDuration) |
|
951 { |
|
952 iError = aError; |
|
953 iDuration = aDuration; |
|
954 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
955 CActiveScheduler::Stop(); |
|
956 |
|
957 } |
|
958 |
|
959 void CTestMmfAclntAudioPlayerUtil::MapcPlayComplete(TInt aError) |
|
960 { |
|
961 iError = aError; |
|
962 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); |
|
963 if(iStop) |
|
964 { |
|
965 CActiveScheduler::Stop(); |
|
966 } |
|
967 } |
|
968 |
|
969 |
|
970 |
|
971 /** |
|
972 * Pause play and continue play. |
|
973 */ |
|
974 TVerdict CTestMmfAclntAudioPlayerUtil::DoTestStepL( void ) |
|
975 { |
|
976 INFO_PRINTF1( _L("TestPlayerUtils : Audio Player Util")); |
|
977 |
|
978 TVerdict ret = EFail; |
|
979 iError = KErrTimedOut; |
|
980 |
|
981 TBuf<KSizeBuf> filename; |
|
982 TPtrC filename1; |
|
983 if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename1)) |
|
984 { |
|
985 return EInconclusive; |
|
986 } |
|
987 |
|
988 GetDriveName(filename); |
|
989 filename.Append(filename1); |
|
990 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &filename); |
|
991 CMdaAudioPlayerUtility* player = CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this); |
|
992 CleanupStack::PushL(player); |
|
993 // wait for initilisation callback |
|
994 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
995 CActiveScheduler::Start(); |
|
996 |
|
997 // Attempt to wait out the in use error message!!! |
|
998 // It may just be that we have the file locked. |
|
999 if(iError == KErrInUse) |
|
1000 { |
|
1001 if(!GetStringFromConfig(iSectName, _L("playerAudioFile2"), filename1)) |
|
1002 { |
|
1003 return EInconclusive; |
|
1004 } |
|
1005 |
|
1006 GetDriveName(filename); |
|
1007 filename.Append(filename1); |
|
1008 User::After(KTwoSeconds); |
|
1009 CleanupStack::PopAndDestroy(player); |
|
1010 User::After(KTwoSeconds); |
|
1011 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &filename); |
|
1012 player = CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this); |
|
1013 CleanupStack::PushL(player); |
|
1014 // wait for initilisation callback |
|
1015 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
1016 CActiveScheduler::Start(); |
|
1017 } |
|
1018 |
|
1019 if (iError == KErrNone) |
|
1020 { |
|
1021 // no errors so far, Do Test! |
|
1022 ret = DoTestL(player); |
|
1023 } |
|
1024 |
|
1025 CleanupStack::PopAndDestroy(player); |
|
1026 User::After(KOneSecond); |
|
1027 if (iError != KErrNone) |
|
1028 { |
|
1029 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
1030 } |
|
1031 |
|
1032 return ret; |
|
1033 } |
|
1034 //======================================================================================= |
|
1035 /** |
|
1036 * Constructor |
|
1037 */ |
|
1038 CAsyncTestMmfAclntAudioPlayerUtil::CAsyncTestMmfAclntAudioPlayerUtil ( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
1039 { |
|
1040 // store the name of this test case |
|
1041 // this is the name that is used by the script file |
|
1042 // Each test step initialises it's own name |
|
1043 iTestStepName=aTestName; |
|
1044 iSectName = aSectName; |
|
1045 iKeyName = aKeyName; |
|
1046 } |
|
1047 |
|
1048 |
|
1049 void CAsyncTestMmfAclntAudioPlayerUtil::MapcInitComplete(TInt aError, |
|
1050 const TTimeIntervalMicroSeconds &aDuration) |
|
1051 { |
|
1052 iError = aError; |
|
1053 iClipDuration = aDuration; |
|
1054 if (aError != KErrNone) |
|
1055 { |
|
1056 ERR_PRINTF2(_L("*MapcInitComplete* Error: %d."), aError); |
|
1057 StopTest(aError, EFail); |
|
1058 } |
|
1059 else |
|
1060 { |
|
1061 INFO_PRINTF2(_L("*MapcInitComplete* Error: %d."), aError); |
|
1062 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
1063 iTrigger->StartTimer(500000); |
|
1064 iTestState = EStateOpened; |
|
1065 iPlayerState = EOpened; |
|
1066 } |
|
1067 } |
|
1068 |
|
1069 void CAsyncTestMmfAclntAudioPlayerUtil::MapcPlayComplete(TInt aError) |
|
1070 { |
|
1071 if(aError == KErrNone) |
|
1072 { |
|
1073 INFO_PRINTF2(_L("*MapcPlayComplete* Error: %d."), iError); |
|
1074 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
1075 iTrigger->StartTimer(500000); |
|
1076 iTestState = EStateStopTest; |
|
1077 } |
|
1078 else |
|
1079 { |
|
1080 ERR_PRINTF2(_L("*MapcPlayComplete* Error: %d."), aError); |
|
1081 StopTest(aError, EFail); |
|
1082 } |
|
1083 } |
|
1084 |
|
1085 /** |
|
1086 * |
|
1087 */ |
|
1088 void CAsyncTestMmfAclntAudioPlayerUtil::KickoffTestL( void ) |
|
1089 { |
|
1090 INFO_PRINTF1( _L("TestPlayerUtils : Audio Player Util")); |
|
1091 TPtrC filename1; |
|
1092 TInt repeatCount; |
|
1093 TInt silence; |
|
1094 if(!GetStringFromConfig(iSectName, iKeyName, filename1)) |
|
1095 { |
|
1096 INFO_PRINTF1(_L("GetStringFromConfig Failed")); |
|
1097 StopTest(KErrGeneral, EInconclusive); |
|
1098 return; |
|
1099 } |
|
1100 |
|
1101 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("numOfRepeat"), repeatCount)) |
|
1102 { |
|
1103 INFO_PRINTF1(_L("GetIntFromConfig Failed")); |
|
1104 StopTest(KErrGeneral, EInconclusive); |
|
1105 return; |
|
1106 } |
|
1107 if(!GetIntFromConfig(_L("SectionSilence"), _L("silence"), silence)) |
|
1108 { |
|
1109 INFO_PRINTF1(_L("GetIntFromConfig Failed")); |
|
1110 StopTest(KErrGeneral, EInconclusive); |
|
1111 return; |
|
1112 } |
|
1113 iNumOfRepeatsSet = repeatCount; |
|
1114 iSilence = silence; |
|
1115 |
|
1116 GetDriveName(iFileName); |
|
1117 iFileName.Append(filename1); |
|
1118 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &iFileName); |
|
1119 iTrigger = CFsmTrigger::NewL(*this); |
|
1120 iPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(iFileName,*this); |
|
1121 iPlayerState = EOpening; |
|
1122 } |
|
1123 |
|
1124 /** |
|
1125 * Time comparison utility function |
|
1126 * |
|
1127 * @param "const TUint aActual" |
|
1128 * The actual timer value produced |
|
1129 * @param "const TUint aExpected" |
|
1130 * Expected timer value |
|
1131 * @param "const TUint aDeviation" |
|
1132 * Allowed deviation of the expected value |
|
1133 * from the actual value. |
|
1134 * @return "TBool" |
|
1135 * Did actual timed value fall within deviation limits |
|
1136 */ |
|
1137 TBool CAsyncTestMmfAclntAudioPlayerUtil::TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDeviation) |
|
1138 { |
|
1139 // save unnessary conditions |
|
1140 if(aActual == aExpected) |
|
1141 return ETrue; |
|
1142 |
|
1143 // Prevent unsigned wrapping errors |
|
1144 TUint difference; |
|
1145 if(aActual > aExpected) |
|
1146 difference = aActual - aExpected; |
|
1147 else |
|
1148 difference = aExpected - aActual; |
|
1149 |
|
1150 // comapare |
|
1151 if(difference < aDeviation) |
|
1152 return ETrue; |
|
1153 return EFalse; |
|
1154 } |
|
1155 |
|
1156 void CAsyncTestMmfAclntAudioPlayerUtil::CloseTest() |
|
1157 { |
|
1158 if (iTrigger) |
|
1159 { |
|
1160 iTrigger->Cancel(); |
|
1161 delete iTrigger; |
|
1162 } |
|
1163 |
|
1164 if (iPlayer) |
|
1165 { |
|
1166 delete iPlayer; |
|
1167 } |
|
1168 } |
|
1169 // |
|
1170 /** |
|
1171 * Implementation of AO timer used to invoke test processing at desired intervals (i.e. State Machine) |
|
1172 **/ |
|
1173 |
|
1174 CFsmTrigger* CFsmTrigger::NewL(CAsyncTestMmfAclntAudioPlayerUtil& aObserver) |
|
1175 { |
|
1176 CFsmTrigger* self = new (ELeave) CFsmTrigger(aObserver); |
|
1177 CleanupStack::PushL(self); |
|
1178 self->ConstructL(); |
|
1179 CleanupStack::Pop(self); |
|
1180 return self; |
|
1181 } |
|
1182 |
|
1183 CFsmTrigger::CFsmTrigger(CAsyncTestMmfAclntAudioPlayerUtil& aObserver) |
|
1184 : CActive(CActive::EPriorityStandard), |
|
1185 iObserver (aObserver) |
|
1186 { |
|
1187 // nothing to do |
|
1188 } |
|
1189 |
|
1190 void CFsmTrigger::ConstructL() |
|
1191 { |
|
1192 User::LeaveIfError (iTimer.CreateLocal()); |
|
1193 CActiveScheduler::Add (this); |
|
1194 } |
|
1195 |
|
1196 CFsmTrigger::~CFsmTrigger() |
|
1197 { |
|
1198 Cancel(); |
|
1199 iTimer.Close(); |
|
1200 } |
|
1201 |
|
1202 void CFsmTrigger::RunL() |
|
1203 { |
|
1204 // need to call Fsm |
|
1205 iObserver.FsmL(); |
|
1206 } |
|
1207 |
|
1208 void CFsmTrigger::DoCancel() |
|
1209 { |
|
1210 iTimer.Cancel(); |
|
1211 } |
|
1212 |
|
1213 void CFsmTrigger::StartTimer(TTimeIntervalMicroSeconds32 aDelay) |
|
1214 { |
|
1215 __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("CFsmTrigger"), 1)); |
|
1216 iTimer.After(iStatus, aDelay); |
|
1217 SetActive(); |
|
1218 } |
|
1219 |
|
1220 //============================================================================================================ |
|
1221 //------------------------------------------------------------------ |
|
1222 |
|
1223 CTestMmfAclntAudioPlayStopStart::CTestMmfAclntAudioPlayStopStart(const TDesC& aTestName, const TDesC& aSectName) |
|
1224 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
1225 {} |
|
1226 |
|
1227 CTestMmfAclntAudioPlayStopStart* CTestMmfAclntAudioPlayStopStart::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1228 { |
|
1229 CTestMmfAclntAudioPlayStopStart* self = new (ELeave) CTestMmfAclntAudioPlayStopStart(aTestName, aSectName); |
|
1230 return self; |
|
1231 } |
|
1232 |
|
1233 TVerdict CTestMmfAclntAudioPlayStopStart::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1234 { |
|
1235 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play Stop/Start")); |
|
1236 TVerdict ret = EFail; |
|
1237 |
|
1238 TInt duration = I64INT(aPlayer->Duration().Int64()); |
|
1239 |
|
1240 // Tests pause functionality |
|
1241 aPlayer->Play(); |
|
1242 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1243 User::After(KTwoSeconds); |
|
1244 INFO_PRINTF1( _L("Stop CMdaAudioPlayerUtility")); |
|
1245 aPlayer->Stop(); |
|
1246 |
|
1247 |
|
1248 User::After(KTwoSeconds); |
|
1249 // only wait for second call to play. |
|
1250 iError = KErrTimedOut; |
|
1251 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1252 aPlayer->Play(); |
|
1253 |
|
1254 TTime start; |
|
1255 start.HomeTime(); |
|
1256 CActiveScheduler::Start(); |
|
1257 TTime stop; |
|
1258 stop.HomeTime(); |
|
1259 |
|
1260 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
1261 |
|
1262 |
|
1263 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"), |
|
1264 iError, I64INT(start.Int64()), I64INT(stop.Int64()), |
|
1265 duration, actualDuration); |
|
1266 if((iError == KErrNone) && |
|
1267 (TimeComparison(actualDuration, duration , KExpectedDeviation))) |
|
1268 { |
|
1269 ret = EPass; |
|
1270 } |
|
1271 |
|
1272 return ret; |
|
1273 } |
|
1274 |
|
1275 //------------------------------------------------------------------ |
|
1276 |
|
1277 // same as above, but with Pause instead of Stop |
|
1278 CTestMmfAclntAudioPlayPauseStart::CTestMmfAclntAudioPlayPauseStart(const TDesC& aTestName, const TDesC& aSectName) |
|
1279 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
1280 {} |
|
1281 |
|
1282 CTestMmfAclntAudioPlayPauseStart* CTestMmfAclntAudioPlayPauseStart::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1283 { |
|
1284 CTestMmfAclntAudioPlayPauseStart* self = new (ELeave) CTestMmfAclntAudioPlayPauseStart(aTestName, aSectName); |
|
1285 return self; |
|
1286 } |
|
1287 |
|
1288 TVerdict CTestMmfAclntAudioPlayPauseStart::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1289 { |
|
1290 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play Pause/Start")); |
|
1291 TVerdict ret = EFail; |
|
1292 |
|
1293 TInt duration = I64INT(aPlayer->Duration().Int64()); |
|
1294 |
|
1295 // Tests pause functionality |
|
1296 // NB we must take the duration from the time at PAUSE, as pause (unlike stop) |
|
1297 // does not reset the clip to start |
|
1298 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1299 aPlayer->Play(); |
|
1300 TTime start; |
|
1301 start.HomeTime(); |
|
1302 User::After(KTwoSeconds); |
|
1303 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
1304 INFO_PRINTF1(_L("Pause()"));//Statement Changed under DEF105143 |
|
1305 aPlayer->Pause(); |
|
1306 TTime stop; |
|
1307 stop.HomeTime(); |
|
1308 TUint beforeDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
1309 User::After(KTwoSeconds); |
|
1310 |
|
1311 // wait for second call to play. |
|
1312 iError = KErrTimedOut; |
|
1313 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1314 INFO_PRINTF1(_L("Play()"));//Statement Changed under DEF105143 |
|
1315 aPlayer->Play(); |
|
1316 start.HomeTime(); |
|
1317 CActiveScheduler::Start(); |
|
1318 stop.HomeTime(); |
|
1319 |
|
1320 TUint afterDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
1321 |
|
1322 |
|
1323 INFO_PRINTF7(_L("Error : %d Start = %u Stop = %u Duration = %u ActualDuration = %u + %u"), |
|
1324 iError, I64INT(start.Int64()), I64INT(stop.Int64()), |
|
1325 duration, beforeDuration, afterDuration); |
|
1326 if((iError == KErrNone) && |
|
1327 (TimeComparison(beforeDuration+afterDuration, duration, KExpectedDeviation*2))) |
|
1328 { |
|
1329 ret = EPass; |
|
1330 } |
|
1331 |
|
1332 return ret; |
|
1333 } |
|
1334 |
|
1335 //------------------------------------------------------------------ |
|
1336 |
|
1337 // Play, pause, play |
|
1338 CTestMmfAclntAudioPlayPausePlayTest::CTestMmfAclntAudioPlayPausePlayTest(const TDesC& aTestName, const TDesC& aSectName) |
|
1339 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
1340 {} |
|
1341 |
|
1342 CTestMmfAclntAudioPlayPausePlayTest* CTestMmfAclntAudioPlayPausePlayTest::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1343 { |
|
1344 CTestMmfAclntAudioPlayPausePlayTest* self = new (ELeave) CTestMmfAclntAudioPlayPausePlayTest(aTestName, aSectName); |
|
1345 return self; |
|
1346 } |
|
1347 |
|
1348 TVerdict CTestMmfAclntAudioPlayPausePlayTest::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1349 { |
|
1350 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play-Pause-Play")); |
|
1351 TVerdict ret = EFail; |
|
1352 |
|
1353 // Play #1 |
|
1354 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1355 aPlayer->Play(); |
|
1356 User::After(KTwoSeconds); |
|
1357 |
|
1358 // Pause #1 |
|
1359 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
1360 aPlayer->Pause(); |
|
1361 User::After(KTwoSeconds); |
|
1362 |
|
1363 // Play #2 |
|
1364 iError = KErrTimedOut; |
|
1365 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1366 aPlayer->Play(); |
|
1367 User::After(KOneSecond); |
|
1368 |
|
1369 // Pause #2 |
|
1370 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
1371 aPlayer->Pause(); |
|
1372 User::After(KOneSecond); |
|
1373 |
|
1374 // Play #3 |
|
1375 iError = KErrTimedOut; |
|
1376 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1377 aPlayer->Play(); |
|
1378 User::After(KOneSecond); |
|
1379 |
|
1380 // Pause #3 |
|
1381 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
1382 aPlayer->Pause(); |
|
1383 User::After(400000); |
|
1384 |
|
1385 // Play #4 |
|
1386 iError = KErrTimedOut; |
|
1387 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1388 aPlayer->Play(); |
|
1389 CActiveScheduler::Start(); // play to end |
|
1390 |
|
1391 if (iError == KErrNone) |
|
1392 { |
|
1393 ret = EPass; |
|
1394 } |
|
1395 |
|
1396 return ret; |
|
1397 } |
|
1398 |
|
1399 //------------------------------------------------------------------ |
|
1400 |
|
1401 CTestMmfAclntAudioPlayVolume::CTestMmfAclntAudioPlayVolume(const TDesC& aTestName, const TDesC& aSectName, const TInt aVolume,TBool aNegativeTest) |
|
1402 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName), iVolume(aVolume) , iNegativeTest(aNegativeTest) |
|
1403 {} |
|
1404 |
|
1405 CTestMmfAclntAudioPlayVolume* CTestMmfAclntAudioPlayVolume::NewL(const TDesC& aTestName, const TDesC& aSectName, const TInt aVolume,TBool aNegativeTest) |
|
1406 { |
|
1407 CTestMmfAclntAudioPlayVolume* self = new (ELeave) CTestMmfAclntAudioPlayVolume(aTestName, aSectName, aVolume, aNegativeTest); |
|
1408 return self; |
|
1409 } |
|
1410 |
|
1411 |
|
1412 TVerdict CTestMmfAclntAudioPlayVolume::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1413 { |
|
1414 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play Volume")); |
|
1415 TVerdict ret = EFail; |
|
1416 |
|
1417 |
|
1418 // Check maxvolume function |
|
1419 if(iVolume == -1) |
|
1420 { |
|
1421 INFO_PRINTF1( _L("Volume CHK 1")); |
|
1422 iVolume = aPlayer->MaxVolume(); |
|
1423 INFO_PRINTF2( _L("Volume: Max Volume = %d"),iVolume); |
|
1424 |
|
1425 //on device & emulator KMaxVolume have different values |
|
1426 //if(iVolume != KMaxVolume) // TODO: how to cross ref. this appears to be random values at the moment |
|
1427 // { |
|
1428 // INFO_PRINTF3( _L("Expected volume: %d, received volume : %d"), |
|
1429 // KMaxVolume, iVolume); |
|
1430 |
|
1431 // return EFail; |
|
1432 // } |
|
1433 } |
|
1434 // Volume is truncated to maxvolume |
|
1435 if(iVolume > aPlayer->MaxVolume()) |
|
1436 { |
|
1437 INFO_PRINTF1( _L("Volume CHK 2")); |
|
1438 TInt volume; |
|
1439 INFO_PRINTF2( _L("Volume: SetVolume(%d)"),iVolume); |
|
1440 aPlayer->SetVolume(iVolume); |
|
1441 aPlayer->GetVolume(volume); |
|
1442 INFO_PRINTF2( _L("Volume: GetVolume() returned"),volume); |
|
1443 if(volume == aPlayer->MaxVolume()) |
|
1444 { |
|
1445 ret = EPass; |
|
1446 } |
|
1447 |
|
1448 } |
|
1449 // Volume is truncated to 0 |
|
1450 else if(iVolume < 0) |
|
1451 { |
|
1452 INFO_PRINTF1( _L("Volume CHK 3")); |
|
1453 TInt volume; |
|
1454 INFO_PRINTF2( _L("Volume: SetVolume(%d)"),iVolume); |
|
1455 aPlayer->SetVolume(iVolume); |
|
1456 aPlayer->GetVolume(volume); |
|
1457 INFO_PRINTF2( _L("Volume: GetVolume() returned"),volume); |
|
1458 if(volume == 0) |
|
1459 { |
|
1460 ret = EPass; |
|
1461 } |
|
1462 |
|
1463 } |
|
1464 // Set volume and check |
|
1465 else |
|
1466 { |
|
1467 INFO_PRINTF1( _L("Volume CHK 4")); |
|
1468 INFO_PRINTF2( _L("Volume: SetVolume(%d)"),iVolume); |
|
1469 TInt volume; |
|
1470 aPlayer->SetVolume(iVolume); |
|
1471 aPlayer->GetVolume(volume); |
|
1472 INFO_PRINTF2( _L("Volume: GetVolume() returned"),volume); |
|
1473 if(volume == iVolume) |
|
1474 { |
|
1475 ret = EPass; |
|
1476 } |
|
1477 |
|
1478 else |
|
1479 INFO_PRINTF3( _L("Expected volume: %d, received volume : %d"), iVolume, volume); |
|
1480 |
|
1481 } |
|
1482 |
|
1483 return ret; |
|
1484 } |
|
1485 |
|
1486 //------------------------------------------------------------------ |
|
1487 |
|
1488 CTestMmfAclntAudioRepeat::CTestMmfAclntAudioRepeat(const TDesC& aTestName, const TDesC& aSectName) |
|
1489 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
1490 {} |
|
1491 |
|
1492 CTestMmfAclntAudioRepeat* CTestMmfAclntAudioRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1493 { |
|
1494 CTestMmfAclntAudioRepeat* self = new (ELeave) CTestMmfAclntAudioRepeat(aTestName, aSectName); |
|
1495 return self; |
|
1496 } |
|
1497 |
|
1498 TVerdict CTestMmfAclntAudioRepeat::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1499 { |
|
1500 INFO_PRINTF1( _L("TestPlayerUtils : Repeats")); |
|
1501 |
|
1502 TVerdict ret = EFail; |
|
1503 TTimeIntervalMicroSeconds silence(0); // silence gap |
|
1504 TInt duration = I64INT(aPlayer->Duration().Int64()); |
|
1505 |
|
1506 aPlayer->SetRepeats(NUMBER_OF_REPEATS,silence); |
|
1507 |
|
1508 iError = KErrTimedOut; |
|
1509 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1510 aPlayer->Play(); |
|
1511 |
|
1512 TTime start; |
|
1513 start.HomeTime(); |
|
1514 CActiveScheduler::Start(); |
|
1515 TTime stop; |
|
1516 stop.HomeTime(); |
|
1517 |
|
1518 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
1519 |
|
1520 INFO_PRINTF2( _L("Repeats : %d"), NUMBER_OF_REPEATS); |
|
1521 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"), |
|
1522 iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration); |
|
1523 if((iError == KErrNone) && (TimeComparison(actualDuration, duration * (NUMBER_OF_REPEATS + 1), |
|
1524 KExpectedDeviation * NUMBER_OF_REPEATS))) |
|
1525 { |
|
1526 ret = EPass; |
|
1527 } |
|
1528 |
|
1529 return ret; |
|
1530 } |
|
1531 |
|
1532 //------------------------------------------------- |
|
1533 |
|
1534 CTestMmfAclntAudioBalance::CTestMmfAclntAudioBalance(const TDesC& aTestName, const TDesC& aSectName,const TInt aValue, const TInt aExpectedError) |
|
1535 : CTestMmfAclntAudioPlayerUtil(aTestName,aSectName), iBalance(aValue), |
|
1536 iExpectedError(aExpectedError) |
|
1537 {} |
|
1538 |
|
1539 CTestMmfAclntAudioBalance* CTestMmfAclntAudioBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TInt aValue, const TInt aExpectedError) |
|
1540 { |
|
1541 CTestMmfAclntAudioBalance* self = new (ELeave) CTestMmfAclntAudioBalance(aTestName,aSectName,aValue, aExpectedError); |
|
1542 return self; |
|
1543 } |
|
1544 |
|
1545 TVerdict CTestMmfAclntAudioBalance::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1546 { |
|
1547 TVerdict verdict = EFail; |
|
1548 INFO_PRINTF1( _L("TestPlayerUtils : Audio Balance")); |
|
1549 TInt theErr = KErrNone; |
|
1550 if (iBalance < KMinBalance) |
|
1551 { |
|
1552 theErr = aPlayer->SetBalance(iBalance); |
|
1553 if(theErr != KErrNone) |
|
1554 { |
|
1555 return EFail; |
|
1556 } |
|
1557 |
|
1558 theErr = aPlayer->GetBalance(iBalance); |
|
1559 if(theErr != iExpectedError) |
|
1560 { |
|
1561 return EFail; |
|
1562 } |
|
1563 |
|
1564 INFO_PRINTF2( _L("Test finished with expectable error: %d"), iExpectedError); |
|
1565 return EPass; |
|
1566 } |
|
1567 else if (iBalance > KMaxBalance) |
|
1568 { |
|
1569 theErr = aPlayer->SetBalance(iBalance); |
|
1570 if(theErr != KErrNone) |
|
1571 { |
|
1572 return EFail; |
|
1573 } |
|
1574 |
|
1575 theErr = aPlayer->GetBalance(iBalance); |
|
1576 if(theErr != iExpectedError) |
|
1577 { |
|
1578 return EFail; |
|
1579 } |
|
1580 |
|
1581 |
|
1582 INFO_PRINTF2( _L("Test finished with expectable error: %d"), iExpectedError); |
|
1583 return EPass; |
|
1584 } |
|
1585 else |
|
1586 { |
|
1587 theErr = aPlayer->SetBalance(iBalance); |
|
1588 if(theErr != iExpectedError) |
|
1589 { |
|
1590 return EFail; |
|
1591 } |
|
1592 |
|
1593 theErr = aPlayer->GetBalance(iBalance); |
|
1594 if(theErr != iExpectedError) |
|
1595 { |
|
1596 return EFail; |
|
1597 } |
|
1598 |
|
1599 |
|
1600 INFO_PRINTF2( _L("Test finished with expectable error: %d"), iExpectedError); |
|
1601 verdict = EPass; |
|
1602 } |
|
1603 return verdict; |
|
1604 } |
|
1605 |
|
1606 CTestMmfAclntAudioDuration::CTestMmfAclntAudioDuration(const TDesC& aTestName, const TDesC& aSectName) |
|
1607 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
1608 {} |
|
1609 |
|
1610 CTestMmfAclntAudioDuration* CTestMmfAclntAudioDuration::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1611 { |
|
1612 CTestMmfAclntAudioDuration* self = new (ELeave) CTestMmfAclntAudioDuration(aTestName, aSectName); |
|
1613 return self; |
|
1614 } |
|
1615 |
|
1616 TVerdict CTestMmfAclntAudioDuration::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1617 { |
|
1618 INFO_PRINTF1( _L("TestPlayerUtils : Audio Duration")); |
|
1619 TVerdict ret = EFail; |
|
1620 if (iDuration == aPlayer->Duration()) |
|
1621 { |
|
1622 ret = EPass; |
|
1623 } |
|
1624 |
|
1625 return ret; |
|
1626 } |
|
1627 |
|
1628 //------------------------------------------------------------------ |
|
1629 |
|
1630 CDelayedMethodCall* CDelayedMethodCall::NewL(MDelayedMethodCall* aThat) |
|
1631 { |
|
1632 __ASSERT_ALWAYS(aThat, User::Leave(KErrArgument)); |
|
1633 CDelayedMethodCall* self = new (ELeave) CDelayedMethodCall(aThat); |
|
1634 CleanupStack::PushL(self); |
|
1635 self->ConstructL(); |
|
1636 CleanupStack::Pop(self); |
|
1637 return self; |
|
1638 }; |
|
1639 |
|
1640 |
|
1641 void CDelayedMethodCall::RunL() |
|
1642 { |
|
1643 iThat->DelayedMethodCallL(); |
|
1644 } |
|
1645 |
|
1646 TInt CDelayedMethodCall::RunError(TInt aError) |
|
1647 { |
|
1648 RDebug::Print( _L("CDelayedMethodCall::RunL Left %d\n"), aError); |
|
1649 return KErrNone; |
|
1650 } |
|
1651 |
|
1652 |
|
1653 CDelayedMethodCall::CDelayedMethodCall(MDelayedMethodCall* aThat) : CTimer(0), iThat(aThat) |
|
1654 { |
|
1655 CActiveScheduler::Add(this); |
|
1656 } |
|
1657 |
|
1658 |
|
1659 |
|
1660 //------------------------------------------------------------------ |
|
1661 /** |
|
1662 * Constructor |
|
1663 */ |
|
1664 CTestMmfAclntPriority::CTestMmfAclntPriority(const TDesC& aTestName, const TDesC& aSectName, const TMdaPriority aPriority) |
|
1665 { |
|
1666 // store the name of this test case |
|
1667 // this is the name that is used by the script file |
|
1668 // Each test step initialises it's own name |
|
1669 iTestStepName = aTestName; |
|
1670 iPriority = aPriority; |
|
1671 iPriorityManual = ETrue; |
|
1672 iSectName = aSectName; |
|
1673 } |
|
1674 |
|
1675 CTestMmfAclntPriority* CTestMmfAclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName, const TMdaPriority aPriority) |
|
1676 { |
|
1677 CTestMmfAclntPriority* self = new (ELeave) CTestMmfAclntPriority(aTestName, aSectName, aPriority); |
|
1678 return self; |
|
1679 } |
|
1680 |
|
1681 // overridden constructor for no priority setting |
|
1682 CTestMmfAclntPriority::CTestMmfAclntPriority(const TDesC& aTestName, const TDesC& aSectName) |
|
1683 { |
|
1684 // store the name of this test case |
|
1685 // this is the name that is used by the script file |
|
1686 // Each test step initialises it's own name |
|
1687 iTestStepName = aTestName; |
|
1688 iPriority = EMdaPriorityNormal; |
|
1689 iPriorityManual = EFalse; |
|
1690 iSectName = aSectName; |
|
1691 } |
|
1692 |
|
1693 |
|
1694 CTestMmfAclntPriority* CTestMmfAclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1695 { |
|
1696 CTestMmfAclntPriority* self = new (ELeave) CTestMmfAclntPriority(aTestName, aSectName); |
|
1697 return self; |
|
1698 } |
|
1699 |
|
1700 void CTestMmfAclntPriority::MchoComplete(TInt aID, TInt aError) |
|
1701 { |
|
1702 INFO_PRINTF3( _L("Callback for CMdaAudioPlayerUtility called : ID %d, error %d"), aID, aError); |
|
1703 |
|
1704 iError = aError; |
|
1705 |
|
1706 iCallbackError[aID] = aError; |
|
1707 |
|
1708 |
|
1709 if(iFirstCallback == -1) |
|
1710 { |
|
1711 iFirstCallback = aID; |
|
1712 } |
|
1713 |
|
1714 |
|
1715 if((--iCallbackCount) <= 0) |
|
1716 { |
|
1717 CActiveScheduler::Stop(); |
|
1718 } |
|
1719 |
|
1720 } |
|
1721 |
|
1722 |
|
1723 //This method is used to start playing file 0 after file 1 has started |
|
1724 void CTestMmfAclntPriority::DelayedMethodCallL() |
|
1725 { |
|
1726 audioUtil[0]->Play(); |
|
1727 if(iError == KErrNone) |
|
1728 { |
|
1729 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility 0")); |
|
1730 } |
|
1731 } |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 /** |
|
1737 * Audio priority. |
|
1738 */ |
|
1739 TVerdict CTestMmfAclntPriority::DoTestStepL() |
|
1740 { |
|
1741 INFO_PRINTF1( _L("TestPlayerUtils : Priority")); |
|
1742 |
|
1743 TBuf<KSizeBuf> filename0, filename1; |
|
1744 |
|
1745 TPtrC file; |
|
1746 if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), file)) |
|
1747 { |
|
1748 return EInconclusive; |
|
1749 } |
|
1750 |
|
1751 GetDriveName(filename0); |
|
1752 filename0.Append(file); |
|
1753 |
|
1754 if(!GetStringFromConfig(iSectName, _L("playerAudioFile2"), file)) |
|
1755 { |
|
1756 return EInconclusive; |
|
1757 } |
|
1758 |
|
1759 GetDriveName(filename1); |
|
1760 filename1.Append(file); |
|
1761 |
|
1762 TVerdict ret=EFail; |
|
1763 |
|
1764 CPlayerCallbackHandler* callback[2]; |
|
1765 |
|
1766 iError = KErrNone; |
|
1767 |
|
1768 for(TInt i=0; i<2; i++) |
|
1769 { |
|
1770 callback[i] = new (ELeave) CPlayerCallbackHandler(i,this); |
|
1771 CleanupStack::PushL(callback[i]); |
|
1772 } |
|
1773 |
|
1774 |
|
1775 audioUtil[0] = CMdaAudioPlayerUtility::NewFilePlayerL(filename0,*callback[0],EMdaPriorityNormal); |
|
1776 CleanupStack::PushL(audioUtil[0]); |
|
1777 audioUtil[1] = CMdaAudioPlayerUtility::NewFilePlayerL(filename1,*callback[1],EMdaPriorityNormal); |
|
1778 CleanupStack::PushL(audioUtil[1]); |
|
1779 |
|
1780 INFO_PRINTF2( _L("Initialise CMdaAudioPlayerUtility 0 - %S"), &filename0); |
|
1781 INFO_PRINTF2( _L("Initialise CMdaAudioPlayerUtility 1 - %S"), &filename1); |
|
1782 |
|
1783 iCallbackCount = 2; |
|
1784 // wait for initilisation callback |
|
1785 CActiveScheduler::Start(); |
|
1786 |
|
1787 if(iError == KErrNone && iCallbackCount == 0) |
|
1788 { |
|
1789 // set manual priority on audioUtil[0] ? |
|
1790 if(iPriorityManual) |
|
1791 { |
|
1792 TInt priErr = audioUtil[0]->SetPriority(iPriority, EMdaPriorityPreferenceNone); |
|
1793 INFO_PRINTF3(_L("Priority set manually to %d - return %d"), iPriority, priErr); |
|
1794 } |
|
1795 |
|
1796 audioUtil[1]->Play(); |
|
1797 if(iError == KErrNone) |
|
1798 { |
|
1799 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility 1")); |
|
1800 } |
|
1801 |
|
1802 iCallbackCount = 2; |
|
1803 iFirstCallback = -1; |
|
1804 |
|
1805 CDelayedMethodCall* delayedMethodCall = CDelayedMethodCall::NewL(this); |
|
1806 CleanupStack::PushL(delayedMethodCall); |
|
1807 delayedMethodCall->After(KOneSecond); |
|
1808 |
|
1809 // wait for play to complete |
|
1810 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1811 CActiveScheduler::Start(); |
|
1812 |
|
1813 CleanupStack::PopAndDestroy(delayedMethodCall); //delayedMethodCall |
|
1814 |
|
1815 if(iError == KErrNone && iCallbackCount == 0) |
|
1816 { |
|
1817 if( ((iPriority < EMdaPriorityNormal) && (iFirstCallback == 0 ) && (iCallbackError[0]==KErrInUse) && (iCallbackError[1]==KErrNone)) || |
|
1818 ((iPriority == EMdaPriorityNormal) && (iFirstCallback == 0 ) && (iCallbackError[0]==KErrInUse) && (iCallbackError[1]==KErrNone)) || |
|
1819 ((iPriority > EMdaPriorityNormal) && (iFirstCallback == 1 ) && (iCallbackError[0]==KErrNone) && (iCallbackError[1]==KErrInUse)) |
|
1820 ) |
|
1821 { |
|
1822 ret = EPass; |
|
1823 } |
|
1824 INFO_PRINTF2( _L("First callback with Id: %d"), iFirstCallback); |
|
1825 INFO_PRINTF3( _L("Error codes - file 0 = %d file 1 = %d"), iCallbackError[0], iCallbackError[1]); |
|
1826 } |
|
1827 } |
|
1828 |
|
1829 if(iError != 0) |
|
1830 { |
|
1831 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); |
|
1832 } |
|
1833 |
|
1834 |
|
1835 CleanupStack::PopAndDestroy(4); // audioUtil , callback |
|
1836 |
|
1837 User::After(KOneSecond); |
|
1838 return ret; |
|
1839 } |
|
1840 |
|
1841 |
|
1842 |
|
1843 //------------------------------------------------------------------ |
|
1844 |
|
1845 CTestMmfAclntAudioPosition::CTestMmfAclntAudioPosition(const TDesC& aTestName, const TDesC& aSectName, const TTimeIntervalMicroSeconds& aPosition) |
|
1846 : CTestMmfAclntAudioPlayerUtil(aTestName,aSectName), iPosition(aPosition) |
|
1847 {} |
|
1848 |
|
1849 CTestMmfAclntAudioPosition* CTestMmfAclntAudioPosition::NewL(const TDesC& aTestName, const TDesC& aSectName, const TTimeIntervalMicroSeconds& aPosition) |
|
1850 { |
|
1851 CTestMmfAclntAudioPosition* self = new (ELeave) CTestMmfAclntAudioPosition(aTestName,aSectName,aPosition); |
|
1852 return self; |
|
1853 } |
|
1854 |
|
1855 TVerdict CTestMmfAclntAudioPosition::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
1856 { |
|
1857 INFO_PRINTF1( _L("TestPlayerUtils : Audio Position")); |
|
1858 TVerdict ret = EFail; |
|
1859 TTimeIntervalMicroSeconds position; |
|
1860 TBool validPosition = EFalse; |
|
1861 INFO_PRINTF3(_L("Set Position %d Duration = %d"), |
|
1862 I64INT(iPosition.Int64()), I64INT(aPlayer->Duration().Int64())); |
|
1863 |
|
1864 // Set position: middle of clip. |
|
1865 if (I64INT(iPosition.Int64()) == 0) |
|
1866 { |
|
1867 iPosition = I64INT(aPlayer->Duration().Int64())/2; |
|
1868 } |
|
1869 |
|
1870 // Set position: end of clip. |
|
1871 if (I64INT(iPosition.Int64()) == -1) |
|
1872 { |
|
1873 iPosition = aPlayer->Duration(); |
|
1874 } |
|
1875 |
|
1876 // Position is beyond the end of the clips duration. |
|
1877 // so check that the value is clipped. |
|
1878 if(aPlayer->Duration() < iPosition) |
|
1879 { |
|
1880 aPlayer->SetPosition(iPosition); |
|
1881 |
|
1882 //aPlayer->Play(); // Playing the clip will reset the position to 0 when finished. |
|
1883 //CActiveScheduler::Start(); |
|
1884 |
|
1885 /*TInt theRes1 = */aPlayer->GetPosition(position); |
|
1886 |
|
1887 |
|
1888 INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64())); |
|
1889 INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"), |
|
1890 I64INT(position.Int64()), I64INT(aPlayer->Duration().Int64())); |
|
1891 |
|
1892 TInt theRes = aPlayer->GetPosition(position); |
|
1893 if(theRes == KErrNone && (position.Int64() == aPlayer->Duration().Int64())) |
|
1894 { |
|
1895 validPosition = ETrue; |
|
1896 } |
|
1897 } |
|
1898 |
|
1899 |
|
1900 // Position is before the end of the clips duration. |
|
1901 // so check that the value is clipped to 0 |
|
1902 // *** added by JW after discussion re. expected behaviour - |
|
1903 // for test 1009 |
|
1904 else if(iPosition < TTimeIntervalMicroSeconds(0)) |
|
1905 { |
|
1906 aPlayer->SetPosition(iPosition); |
|
1907 |
|
1908 aPlayer->Play(); |
|
1909 CActiveScheduler::Start(); |
|
1910 |
|
1911 /*TInt theRes1 = */aPlayer->GetPosition(position); |
|
1912 |
|
1913 |
|
1914 INFO_PRINTF2(_L("Shorter than 0 : Setting position to %d"), I64INT(iPosition.Int64())); |
|
1915 INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), |
|
1916 I64INT(position.Int64())); |
|
1917 |
|
1918 TInt theRes = aPlayer->GetPosition(position); |
|
1919 if(theRes == KErrNone && I64INT(position.Int64()) == 0) |
|
1920 { |
|
1921 validPosition = ETrue; |
|
1922 } |
|
1923 |
|
1924 } |
|
1925 |
|
1926 else |
|
1927 { |
|
1928 |
|
1929 aPlayer->SetPosition(iPosition); |
|
1930 aPlayer->GetPosition(position); |
|
1931 INFO_PRINTF3(_L("Set : position = %d, duration = %d)"), |
|
1932 I64INT(position.Int64()), I64INT(aPlayer->Duration().Int64())); |
|
1933 aPlayer->Play(); |
|
1934 |
|
1935 CActiveScheduler::Start(); |
|
1936 |
|
1937 // For test 1009, we check that the expected error code was returned |
|
1938 // *** removed by JW after discussion re. expected behaviour |
|
1939 /* |
|
1940 if (iPosition < TTimeIntervalMicroSeconds(0)) |
|
1941 { |
|
1942 TVerdict ret = EFail; |
|
1943 if (iError == KErrArgument) |
|
1944 { |
|
1945 if (position != TTimeIntervalMicroSeconds(0)) |
|
1946 { |
|
1947 INFO_PRINTF2(_L("ERROR: KErrArgument returned, but position was %d, expected position = 0"),position); |
|
1948 ret = EFail; |
|
1949 } |
|
1950 else |
|
1951 { |
|
1952 // Test passed |
|
1953 ret = EPass; |
|
1954 } |
|
1955 } |
|
1956 else |
|
1957 { |
|
1958 INFO_PRINTF3(_L("Expected error not returned, expecting %d, got %d"), KErrArgument, iError); |
|
1959 ret = EFail; |
|
1960 } |
|
1961 return ret; |
|
1962 } |
|
1963 */ |
|
1964 |
|
1965 aPlayer->Stop(); |
|
1966 |
|
1967 //TInt64 temp = (iPosition.Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound |
|
1968 aPlayer->GetPosition(position); |
|
1969 // returned position should equal the original position or number of frames * frame intervals. |
|
1970 // The above comment is invalid, one the clip has played the position should be reset to 0. - INC24264 |
|
1971 if (position.Int64() == 0) |
|
1972 //if(position.Int64() == (temp * KPcm16FrameInterval) || (position == iPosition)) |
|
1973 { |
|
1974 validPosition = ETrue; |
|
1975 } |
|
1976 //else |
|
1977 INFO_PRINTF3( _L("Expected position : %f, received position : %f"), |
|
1978 I64REAL(iPosition.Int64()), I64REAL(position.Int64())); |
|
1979 } |
|
1980 |
|
1981 // Postion was set to a valid value. |
|
1982 if(validPosition) |
|
1983 { |
|
1984 aPlayer->Play(); |
|
1985 // wait for play to complete |
|
1986 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
1987 CActiveScheduler::Start(); |
|
1988 |
|
1989 INFO_PRINTF2( _L("Error : %d"), iError); |
|
1990 if (iError == KErrNone) |
|
1991 ret = EPass; |
|
1992 } |
|
1993 return ret; |
|
1994 } |
|
1995 |
|
1996 //------------------------------------------------------------------ |
|
1997 |
|
1998 CTestMmfAclntAudioPlayWindow::CTestMmfAclntAudioPlayWindow(const TDesC& aTestName, const TDesC& aSectName, const TBool aNegative) |
|
1999 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName), iNegative(aNegative) |
|
2000 {} |
|
2001 |
|
2002 CTestMmfAclntAudioPlayWindow* CTestMmfAclntAudioPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName, const TBool aNegative) |
|
2003 { |
|
2004 CTestMmfAclntAudioPlayWindow* self = new (ELeave) CTestMmfAclntAudioPlayWindow(aTestName, aSectName, aNegative); |
|
2005 return self; |
|
2006 } |
|
2007 |
|
2008 TVerdict CTestMmfAclntAudioPlayWindow::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
2009 { |
|
2010 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play Window")); |
|
2011 TVerdict ret = EFail; |
|
2012 TInt64 temp1, temp2; |
|
2013 TInt duration = I64INT(aPlayer->Duration().Int64()); |
|
2014 |
|
2015 TInt windowDuration = 0; |
|
2016 if(iNegative) |
|
2017 { |
|
2018 INFO_PRINTF1( _L("Attempting to set an invalid play window")); |
|
2019 temp1 = -KInvalidNumber; |
|
2020 temp2 = aPlayer->Duration().Int64() + KInvalidNumber; |
|
2021 windowDuration = I64INT(aPlayer->Duration().Int64()); |
|
2022 } |
|
2023 else |
|
2024 { |
|
2025 temp1 = aPlayer->Duration().Int64()/2; |
|
2026 temp2 = aPlayer->Duration().Int64(); |
|
2027 |
|
2028 windowDuration = (I64INT(temp2) - I64INT(temp1)); |
|
2029 } |
|
2030 |
|
2031 |
|
2032 TTimeIntervalMicroSeconds startTime(temp1); |
|
2033 TTimeIntervalMicroSeconds endTime(temp2); |
|
2034 |
|
2035 INFO_PRINTF4(_L("StartTime = %d EndTime = %d WindowDuration = %d"), |
|
2036 I64INT(startTime.Int64()), I64INT(endTime.Int64()), windowDuration); |
|
2037 |
|
2038 TInt windowSet = aPlayer->SetPlayWindow(startTime,endTime); |
|
2039 |
|
2040 if (iNegative && (windowSet == KErrArgument)) |
|
2041 { |
|
2042 INFO_PRINTF1( _L("Correct return from SetPlayWindow (KErrArgument) when attempting to set an invalid window range")); |
|
2043 return EPass; |
|
2044 } |
|
2045 |
|
2046 if (windowSet != KErrNone) |
|
2047 { |
|
2048 INFO_PRINTF2( _L("Unexpected error returned from SetPlayWindow - %d"),windowSet); |
|
2049 return EFail; |
|
2050 } |
|
2051 |
|
2052 iError = KErrTimedOut; |
|
2053 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
2054 aPlayer->Play(); |
|
2055 |
|
2056 TTime start; |
|
2057 start.HomeTime(); |
|
2058 CActiveScheduler::Start(); |
|
2059 TTime stop; |
|
2060 stop.HomeTime(); |
|
2061 |
|
2062 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
2063 |
|
2064 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d WindowDuration = %d ActualDuration = %d"), |
|
2065 iError, I64INT(start.Int64()), I64INT(stop.Int64()), windowDuration, actualDuration); |
|
2066 |
|
2067 if((iError == KErrNone) && (TimeComparison(actualDuration, windowDuration, KExpectedDeviation))) |
|
2068 { |
|
2069 aPlayer->ClearPlayWindow(); |
|
2070 |
|
2071 iError = KErrTimedOut; |
|
2072 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
2073 aPlayer->Play(); |
|
2074 |
|
2075 TTime start; |
|
2076 start.HomeTime(); |
|
2077 CActiveScheduler::Start(); |
|
2078 TTime stop; |
|
2079 stop.HomeTime(); |
|
2080 |
|
2081 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
2082 |
|
2083 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"), |
|
2084 iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration); |
|
2085 ret = EPass; |
|
2086 } |
|
2087 return ret; |
|
2088 } |
|
2089 |
|
2090 //------------------------------------------------------------------ |
|
2091 |
|
2092 CTestMmfAclntAudioType::CTestMmfAclntAudioType(const TDesC& aTestName, const TDesC& aSectName) |
|
2093 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2094 {} |
|
2095 |
|
2096 CTestMmfAclntAudioType* CTestMmfAclntAudioType::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2097 { |
|
2098 CTestMmfAclntAudioType* self = new (ELeave) CTestMmfAclntAudioType(aTestName, aSectName); |
|
2099 return self; |
|
2100 } |
|
2101 |
|
2102 TVerdict CTestMmfAclntAudioType::DoTestL(CMdaAudioPlayerUtility* /*aPlayer*/) |
|
2103 { |
|
2104 INFO_PRINTF1( _L("TestPlayerUtils : Audio Type")); |
|
2105 INFO_PRINTF1( _L("#######################################################")); |
|
2106 INFO_PRINTF1( _L("No Audio Type API call for class CMdaAudioPlayerUtility")); |
|
2107 INFO_PRINTF1( _L("This test is therefore inconclusive.")); |
|
2108 INFO_PRINTF1( _L("#######################################################")); |
|
2109 TVerdict ret = EInconclusive; |
|
2110 |
|
2111 // what code should/might look like. |
|
2112 //CMdaAudioType* type = aPlayer->TypeL(); |
|
2113 |
|
2114 // CMdaAudioType class incomplete: |
|
2115 // TODO check data returned is valid??? |
|
2116 |
|
2117 return ret; |
|
2118 } |
|
2119 |
|
2120 //-------------------------------------------------------------- |
|
2121 |
|
2122 CTestMmfAclntAudioRamp::CTestMmfAclntAudioRamp(const TDesC& aTestName, const TDesC& aSectName) |
|
2123 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2124 {} |
|
2125 |
|
2126 CTestMmfAclntAudioRamp* CTestMmfAclntAudioRamp::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2127 { |
|
2128 CTestMmfAclntAudioRamp* self = new (ELeave) CTestMmfAclntAudioRamp(aTestName, aSectName); |
|
2129 return self; |
|
2130 } |
|
2131 |
|
2132 TVerdict CTestMmfAclntAudioRamp::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
2133 { |
|
2134 INFO_PRINTF1( _L("TestPlayerUtils : Audio Ramp")); |
|
2135 TVerdict ret = EFail; |
|
2136 TTimeIntervalMicroSeconds ramp(100); |
|
2137 aPlayer->SetVolumeRamp(ramp); |
|
2138 |
|
2139 aPlayer->Play(); |
|
2140 // wait for open to complete |
|
2141 iError = KErrTimedOut; |
|
2142 CActiveScheduler::Start(); |
|
2143 if(iError == KErrNone) |
|
2144 ret = EPass; |
|
2145 return ret; |
|
2146 } |
|
2147 |
|
2148 //------------------------------------------------------------------ |
|
2149 |
|
2150 CTestMmfAclntAudioMeta::CTestMmfAclntAudioMeta(const TDesC& aTestName, const TDesC& aSectName) |
|
2151 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2152 {} |
|
2153 |
|
2154 CTestMmfAclntAudioMeta* CTestMmfAclntAudioMeta::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2155 { |
|
2156 CTestMmfAclntAudioMeta* self = new (ELeave) CTestMmfAclntAudioMeta(aTestName, aSectName); |
|
2157 return self; |
|
2158 } |
|
2159 |
|
2160 _LIT(name,"Title"); |
|
2161 _LIT(data,"Symbian"); |
|
2162 TVerdict CTestMmfAclntAudioMeta::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
2163 { |
|
2164 INFO_PRINTF1( _L("TestPlayerUtils : Audio Metadata")); |
|
2165 |
|
2166 TInt numEntries; |
|
2167 TInt theErr = aPlayer->GetNumberOfMetaDataEntries(numEntries); |
|
2168 INFO_PRINTF3(_L("Error : %d NumEntries : %d"), theErr, numEntries); |
|
2169 |
|
2170 if(theErr && theErr != KErrNotSupported) // Audio Controller doesn't support - this is ok |
|
2171 { |
|
2172 ERR_PRINTF2(_L("GetNumberOfMetaDataEntries returned unexpected error %d"), theErr); |
|
2173 return EFail; |
|
2174 } |
|
2175 |
|
2176 CMMFMetaDataEntry* testData = NULL; |
|
2177 |
|
2178 TRAPD(theErr2, testData = aPlayer->GetMetaDataEntryL(0)); |
|
2179 if(!theErr2) |
|
2180 { |
|
2181 if((testData->Name() == name) && (testData->Value() == data)) |
|
2182 return EPass; |
|
2183 } |
|
2184 else |
|
2185 { |
|
2186 if(theErr == KErrNotSupported) // Audio Controller doesn't support - this is ok |
|
2187 { |
|
2188 INFO_PRINTF1(_L("Note : Audio Controller does not support metadata")); |
|
2189 return EPass; |
|
2190 } |
|
2191 else if(numEntries == 0) |
|
2192 { |
|
2193 INFO_PRINTF1(_L("No metadata entries found")); |
|
2194 return EPass; |
|
2195 } |
|
2196 else |
|
2197 { |
|
2198 ERR_PRINTF2(_L("GetMetaDataEntryL left with unexpected error %d"), theErr2); |
|
2199 return EFail; |
|
2200 } |
|
2201 } |
|
2202 return EPass; |
|
2203 } |
|
2204 |
|
2205 //------------------------------------------------------------------ |
|
2206 |
|
2207 CTestMmfAclntAudioCloseOpen::CTestMmfAclntAudioCloseOpen(const TDesC& aTestName, const TDesC& aSectName) |
|
2208 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2209 {} |
|
2210 |
|
2211 CTestMmfAclntAudioCloseOpen* CTestMmfAclntAudioCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2212 { |
|
2213 CTestMmfAclntAudioCloseOpen* self = new (ELeave) CTestMmfAclntAudioCloseOpen(aTestName, aSectName); |
|
2214 return self; |
|
2215 } |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 TVerdict CTestMmfAclntAudioCloseOpen::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
2221 { |
|
2222 INFO_PRINTF1( _L("TestPlayerUtils : Audio Close/Open")); |
|
2223 |
|
2224 TVerdict ret = EFail; |
|
2225 aPlayer->Close(); |
|
2226 |
|
2227 // get second file name |
|
2228 TBuf<KSizeBuf> filename2; |
|
2229 TPtrC filename; |
|
2230 if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename)) |
|
2231 { |
|
2232 return EInconclusive; |
|
2233 } |
|
2234 |
|
2235 GetDriveName(filename2); |
|
2236 filename2.Append(filename); |
|
2237 |
|
2238 // Open second file |
|
2239 aPlayer->OpenFileL(filename2); |
|
2240 // wait for open to complete |
|
2241 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
2242 CActiveScheduler::Start(); |
|
2243 |
|
2244 TInt openErr = iError; |
|
2245 |
|
2246 INFO_PRINTF2( _L("OpenFileL completed with error %d"), iError); |
|
2247 |
|
2248 if (iError == KErrNone && openErr == KErrNone) |
|
2249 { |
|
2250 ret = EPass; |
|
2251 } |
|
2252 |
|
2253 return ret; |
|
2254 } |
|
2255 |
|
2256 //------------------------------------------------------------------ |
|
2257 |
|
2258 CTestMmfAclntAudioBitRate::CTestMmfAclntAudioBitRate(const TDesC& aTestName,const TDesC& aKeyName1, const TDesC& aKeyName2) |
|
2259 { |
|
2260 // store the name of this test case |
|
2261 // this is the name that is used by the script file |
|
2262 // Each test step initialises it's own name |
|
2263 iTestStepName = aTestName; |
|
2264 iKeyFileName = aKeyName1; |
|
2265 iKeyBitRateName = aKeyName2; |
|
2266 } |
|
2267 |
|
2268 CTestMmfAclntAudioBitRate* CTestMmfAclntAudioBitRate::NewL(const TDesC& aTestName,const TDesC& aKeyName1, const TDesC& aKeyName2) |
|
2269 { |
|
2270 CTestMmfAclntAudioBitRate* self = new (ELeave) CTestMmfAclntAudioBitRate(aTestName,aKeyName1,aKeyName2); |
|
2271 return self; |
|
2272 } |
|
2273 |
|
2274 void CTestMmfAclntAudioBitRate::MapcInitComplete(TInt aError, |
|
2275 const TTimeIntervalMicroSeconds & /*aDuration*/) |
|
2276 { |
|
2277 iError = aError; |
|
2278 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
2279 CActiveScheduler::Stop(); |
|
2280 } |
|
2281 |
|
2282 void CTestMmfAclntAudioBitRate::MapcPlayComplete(TInt aError) |
|
2283 { |
|
2284 iError = aError; |
|
2285 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); |
|
2286 CActiveScheduler::Stop(); |
|
2287 } |
|
2288 |
|
2289 |
|
2290 TVerdict CTestMmfAclntAudioBitRate::DoTestStepL( void ) |
|
2291 { |
|
2292 |
|
2293 INFO_PRINTF1( _L("TestPlayerUtils : Audio Bit Rate")); |
|
2294 |
|
2295 iError = KErrTimedOut; |
|
2296 TUint bitRate = 0; |
|
2297 TVerdict res = EFail; |
|
2298 |
|
2299 TBuf<KSizeBuf> filename; |
|
2300 TPtrC filename1; |
|
2301 if(!GetStringFromConfig(_L("SectionNine"),iKeyFileName,filename1)) |
|
2302 { |
|
2303 return EInconclusive; |
|
2304 } |
|
2305 if(!GetIntFromConfig(_L("SectionNine"),iKeyBitRateName,iExpectedBitRate)) |
|
2306 { |
|
2307 return EInconclusive; |
|
2308 } |
|
2309 |
|
2310 INFO_PRINTF2(_L("Expected bit rate: %d"), iExpectedBitRate); |
|
2311 |
|
2312 GetDriveName(filename); |
|
2313 filename.Append(filename1); |
|
2314 |
|
2315 CMdaAudioPlayerUtility* player = CMdaAudioPlayerUtility::NewFilePlayerL(filename1,*this); |
|
2316 CleanupStack::PushL(player); |
|
2317 CActiveScheduler::Start(); |
|
2318 |
|
2319 if (iError == KErrNone) |
|
2320 { |
|
2321 player->Play(); |
|
2322 CActiveScheduler::Start(); |
|
2323 if(iError == KErrNone) |
|
2324 { |
|
2325 TInt err = player->GetBitRate(bitRate); |
|
2326 if(err == KErrNone) |
|
2327 { |
|
2328 INFO_PRINTF2(_L("Retrieved bit rate: %d"), bitRate); |
|
2329 if(static_cast<TInt>(bitRate) == iExpectedBitRate) |
|
2330 { |
|
2331 INFO_PRINTF1(_L("The Expected bit rate and retrieved bit rate matched")); |
|
2332 res = EPass; |
|
2333 } |
|
2334 else |
|
2335 { |
|
2336 INFO_PRINTF1(_L("The Expected bit rate and retrieved bit rate does not match")); |
|
2337 } |
|
2338 } |
|
2339 else |
|
2340 { |
|
2341 INFO_PRINTF2(_L("Failed with error %d while getting the bit rate"), err); |
|
2342 } |
|
2343 } |
|
2344 else |
|
2345 { |
|
2346 INFO_PRINTF1(_L("Failed during playing the audio")); |
|
2347 } |
|
2348 } |
|
2349 else |
|
2350 { |
|
2351 INFO_PRINTF2(_L("Failed during opening the file. Error = %d "), iError); |
|
2352 } |
|
2353 CleanupStack::PopAndDestroy(player); |
|
2354 return res; |
|
2355 } |
|
2356 |
|
2357 |
|
2358 //------------------------------------------------------------------ |
|
2359 CTestMmfAclntAudioQuery::CTestMmfAclntAudioQuery(const TDesC& aTestName, const TDesC& aSectName) |
|
2360 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2361 {} |
|
2362 |
|
2363 CTestMmfAclntAudioQuery* CTestMmfAclntAudioQuery::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2364 { |
|
2365 CTestMmfAclntAudioQuery* self = new (ELeave) CTestMmfAclntAudioQuery(aTestName, aSectName); |
|
2366 return self; |
|
2367 } |
|
2368 |
|
2369 TVerdict CTestMmfAclntAudioQuery::DoTestL(CMdaAudioPlayerUtility* /*aPlayer*/) |
|
2370 { |
|
2371 INFO_PRINTF1( _L("TestPlayerUtils : Audio Query")); |
|
2372 |
|
2373 TVerdict ret = EFail; |
|
2374 |
|
2375 // enhanced - to use CMMFControllerPluginSelectionParameters |
|
2376 |
|
2377 INFO_PRINTF1(_L("Querying play formats...")); |
|
2378 |
|
2379 CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC(); |
|
2380 CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); |
|
2381 |
|
2382 RArray<TUid> mediaIds; |
|
2383 mediaIds.Append(KUidMediaTypeAudio); |
|
2384 cSelect->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds); |
|
2385 cSelect->SetRequiredPlayFormatSupportL(*fSelect); |
|
2386 |
|
2387 RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data |
|
2388 CleanupResetAndDestroyPushL(controllers); |
|
2389 cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers |
|
2390 TInt numControllers = controllers.Count(); |
|
2391 if(!numControllers) |
|
2392 { |
|
2393 ERR_PRINTF1(_L("Could not find any controllers")); |
|
2394 } |
|
2395 else |
|
2396 { |
|
2397 INFO_PRINTF2(_L("Found %d controllers"), numControllers); |
|
2398 for(int i = 0; i < numControllers; i++) |
|
2399 { |
|
2400 RMMFFormatImplInfoArray cFormats = controllers[i]->PlayFormats(); |
|
2401 const CDesC8Array* fileExtensions = &cFormats[0]->SupportedMimeTypes(); |
|
2402 INFO_PRINTF3(_L("- Controller: %d Extensions : %d"), i, fileExtensions->Count()); |
|
2403 for(int j = 0; j < fileExtensions->Count(); j++) |
|
2404 { |
|
2405 TBuf<24> ext16; |
|
2406 ext16.Copy(fileExtensions->MdcaPoint(j)); |
|
2407 INFO_PRINTF2(_L("-- %S"), &ext16); |
|
2408 } |
|
2409 } |
|
2410 ret = EPass; |
|
2411 } |
|
2412 |
|
2413 CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect |
|
2414 |
|
2415 return ret; |
|
2416 } |
|
2417 |
|
2418 //-------------------------------------------------------------------- |
|
2419 |
|
2420 // Negative tests |
|
2421 |
|
2422 //-------------------------------------------------------------------- |
|
2423 |
|
2424 /** |
|
2425 * Constructor |
|
2426 */ |
|
2427 CTestMmfAclntNoLoad::CTestMmfAclntNoLoad(const TDesC& aTestName, const TDesC& aSectName) |
|
2428 :CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2429 { |
|
2430 } |
|
2431 |
|
2432 CTestMmfAclntNoLoad* CTestMmfAclntNoLoad::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2433 { |
|
2434 CTestMmfAclntNoLoad* self = new (ELeave) CTestMmfAclntNoLoad(aTestName, aSectName); |
|
2435 return self; |
|
2436 } |
|
2437 |
|
2438 TVerdict CTestMmfAclntNoLoad::DoTestL(CMdaAudioPlayerUtility* /*aPlayer*/) |
|
2439 { |
|
2440 return EPass; |
|
2441 } |
|
2442 |
|
2443 /** |
|
2444 * Play with no loaded sound file. |
|
2445 */ |
|
2446 TVerdict CTestMmfAclntNoLoad::DoTestStepL() |
|
2447 { |
|
2448 INFO_PRINTF1( _L("TestPlayerUtils : No Load")); |
|
2449 |
|
2450 iError = KErrTimedOut; |
|
2451 iStop = ETrue; |
|
2452 |
|
2453 CMdaAudioPlayerUtility* player = CMdaAudioPlayerUtility::NewL(*this); |
|
2454 CleanupStack::PushL(player); |
|
2455 player->Play(); |
|
2456 |
|
2457 CActiveScheduler::Start(); |
|
2458 |
|
2459 if(iError == KErrNotReady) |
|
2460 { |
|
2461 CleanupStack::PopAndDestroy(player); |
|
2462 return EPass; |
|
2463 } |
|
2464 |
|
2465 ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d (expected KErrNotReady)"),iError ); |
|
2466 CleanupStack::PopAndDestroy(player); |
|
2467 return EFail; |
|
2468 } |
|
2469 |
|
2470 //------------------------------------------------------------------ |
|
2471 |
|
2472 CTestMmfAclntDeletePlay::CTestMmfAclntDeletePlay(const TDesC& aTestName, const TDesC& aSectName) |
|
2473 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName) |
|
2474 {} |
|
2475 |
|
2476 CTestMmfAclntDeletePlay* CTestMmfAclntDeletePlay::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2477 { |
|
2478 CTestMmfAclntDeletePlay* self = new (ELeave) CTestMmfAclntDeletePlay(aTestName, aSectName); |
|
2479 return self; |
|
2480 } |
|
2481 |
|
2482 |
|
2483 |
|
2484 /** |
|
2485 * Audio clip - Delete object before play operation has completed. |
|
2486 */ |
|
2487 TVerdict CTestMmfAclntDeletePlay::DoTestL(CMdaAudioPlayerUtility* /*aPlayer*/) |
|
2488 { |
|
2489 INFO_PRINTF1( _L("TestPlayerUtils : Delete/Play")); |
|
2490 |
|
2491 TBuf<KSizeBuf> filename; |
|
2492 TPtrC filename1; |
|
2493 if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename1)) |
|
2494 { |
|
2495 return EInconclusive; |
|
2496 } |
|
2497 |
|
2498 GetDriveName(filename); |
|
2499 filename.Append(filename1); |
|
2500 |
|
2501 iError = KErrTimedOut; |
|
2502 __MM_HEAP_MARK; |
|
2503 |
|
2504 CMdaAudioPlayerUtility* player = CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this); |
|
2505 CleanupStack::PushL(player); |
|
2506 // wait for open to complete |
|
2507 CActiveScheduler::Start(); |
|
2508 |
|
2509 if(iError == KErrNone) |
|
2510 { |
|
2511 player->Play(); |
|
2512 CleanupStack::PopAndDestroy(player); // destroy player before play has completed |
|
2513 __MM_HEAP_MARKEND; |
|
2514 User::Heap().Check(); |
|
2515 return EPass; |
|
2516 } |
|
2517 |
|
2518 CleanupStack::PopAndDestroy(player); |
|
2519 ERR_PRINTF2( _L("CMdaAudioRecorderUtility failed with error %d"),iError ); |
|
2520 __MM_HEAP_MARKEND; |
|
2521 return EFail; |
|
2522 } |
|
2523 |
|
2524 //------------------------------------------------------------------ |
|
2525 |
|
2526 CTestMmfAclntPlayPlay::CTestMmfAclntPlayPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
2527 : CTestMmfAclntAudioPlayerUtil(aTestName, aSectName), iKeyName(aKeyName) |
|
2528 {} |
|
2529 |
|
2530 CTestMmfAclntPlayPlay* CTestMmfAclntPlayPlay::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
2531 { |
|
2532 CTestMmfAclntPlayPlay* self = new (ELeave) CTestMmfAclntPlayPlay(aTestName, aSectName, aKeyName); |
|
2533 return self; |
|
2534 } |
|
2535 |
|
2536 |
|
2537 /** |
|
2538 * Open new file while audio player is playing. |
|
2539 */ |
|
2540 TVerdict CTestMmfAclntPlayPlay::DoTestL(CMdaAudioPlayerUtility* aPlayer) |
|
2541 { |
|
2542 INFO_PRINTF1( _L("TestPlayerUtils : Play/Play")); |
|
2543 |
|
2544 TVerdict ret = EFail; |
|
2545 iError = KErrTimedOut; |
|
2546 |
|
2547 TBuf<KSizeBuf> filename; |
|
2548 TPtrC filename1; |
|
2549 //if(!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), filename1)) |
|
2550 if(!GetStringFromConfig(iSectName, iKeyName, filename1)) |
|
2551 { |
|
2552 return EInconclusive; |
|
2553 } |
|
2554 |
|
2555 GetDriveName(filename); |
|
2556 filename.Append(filename1); |
|
2557 |
|
2558 aPlayer->Play(); |
|
2559 |
|
2560 |
|
2561 TInt error = KErrNone; |
|
2562 TRAP(error,aPlayer->OpenFileL(filename)); |
|
2563 // wait for open to complete |
|
2564 CActiveScheduler::Start(); |
|
2565 aPlayer->Play(); |
|
2566 CActiveScheduler::Start(); |
|
2567 |
|
2568 if(error == KErrNone) |
|
2569 ret = EPass; |
|
2570 |
|
2571 return ret; |
|
2572 } |
|
2573 |
|
2574 //------------------------------------------------------------------ |
|
2575 |
|
2576 /** |
|
2577 * Constructor |
|
2578 */ |
|
2579 CTestMmfAclntCorruptDes::CTestMmfAclntCorruptDes(const TDesC& aTestName,const TDesC& aSectName) |
|
2580 { |
|
2581 // store the name of this test case |
|
2582 // this is the name that is used by the script file |
|
2583 // Each test step initialises it's own name |
|
2584 iTestStepName = aTestName; |
|
2585 iSectName = aSectName; |
|
2586 } |
|
2587 |
|
2588 void CTestMmfAclntCorruptDes::MapcInitComplete(TInt aError, |
|
2589 const TTimeIntervalMicroSeconds &/*aDuration*/) |
|
2590 { |
|
2591 iError = aError; |
|
2592 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Init Complete")); |
|
2593 CActiveScheduler::Stop(); |
|
2594 } |
|
2595 |
|
2596 void CTestMmfAclntCorruptDes::MapcPlayComplete(TInt aError) |
|
2597 { |
|
2598 iError = aError; |
|
2599 INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); |
|
2600 CActiveScheduler::Stop(); |
|
2601 } |
|
2602 |
|
2603 |
|
2604 |
|
2605 TVerdict CTestMmfAclntCorruptDes::DoTestStepPreambleL() |
|
2606 { |
|
2607 RFs fs; |
|
2608 RFile file; |
|
2609 TInt size = 0; |
|
2610 |
|
2611 TBuf<KSizeBuf> filename; |
|
2612 TPtrC filename1; |
|
2613 if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename1)) |
|
2614 { |
|
2615 return EInconclusive; |
|
2616 } |
|
2617 |
|
2618 GetDriveName(filename); |
|
2619 filename.Append(filename1); |
|
2620 |
|
2621 User::LeaveIfError(fs.Connect()); |
|
2622 User::LeaveIfError(file.Open(fs,filename,EFileRead)); |
|
2623 CleanupClosePushL(file); |
|
2624 |
|
2625 INFO_PRINTF2( _L("File under test - %S"), &filename); |
|
2626 |
|
2627 User::LeaveIfError(file.Size(size)); |
|
2628 INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143 |
|
2629 iAudio = HBufC8::NewMaxL(size); |
|
2630 // Buffer has not been init with data. |
|
2631 CleanupStack::PopAndDestroy(); //file |
|
2632 |
|
2633 return CTestMmfAclntStep::DoTestStepPreambleL(); |
|
2634 } |
|
2635 |
|
2636 TVerdict CTestMmfAclntCorruptDes::DoTestStepPostambleL() |
|
2637 { |
|
2638 delete iAudio; |
|
2639 return CTestMmfAclntStep::DoTestStepPostambleL(); |
|
2640 } |
|
2641 |
|
2642 /** |
|
2643 * Play using a corrupt descriptor. |
|
2644 */ |
|
2645 TVerdict CTestMmfAclntCorruptDes::DoTestStepL( void ) |
|
2646 { |
|
2647 INFO_PRINTF1( _L("TestPlayerUtils : Corrupt Des")); |
|
2648 iError = KErrTimedOut; |
|
2649 |
|
2650 TPtr8 bufferDes(iAudio->Des()); |
|
2651 CMdaAudioPlayerUtility * player = CMdaAudioPlayerUtility::NewDesPlayerL(bufferDes, *this); |
|
2652 CleanupStack::PushL(player); |
|
2653 |
|
2654 // Wait for init callback |
|
2655 INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility")); |
|
2656 CActiveScheduler::Start(); |
|
2657 |
|
2658 if (iError == KErrBadDescriptor || iError == KErrNotSupported) |
|
2659 { |
|
2660 CleanupStack::PopAndDestroy(player); |
|
2661 return EPass; |
|
2662 } |
|
2663 if (iError == KErrNone) |
|
2664 { |
|
2665 iError = KErrTimedOut; |
|
2666 player->Play(); |
|
2667 // wait for play. |
|
2668 if (iError == KErrNone) |
|
2669 { |
|
2670 CleanupStack::PopAndDestroy(player); |
|
2671 return EPass; |
|
2672 } |
|
2673 } |
|
2674 CleanupStack::PopAndDestroy(player); |
|
2675 return EFail; |
|
2676 } |
|
2677 |
|
2678 // |
|
2679 //============================================================================================= |
|
2680 // |
|
2681 |
|
2682 CAsyncTestMmfAclntAudioRepeatPlayPausePlay* CAsyncTestMmfAclntAudioRepeatPlayPausePlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
2683 { |
|
2684 return new (ELeave) CAsyncTestMmfAclntAudioRepeatPlayPausePlay( aTestName, aSectName, aKeyName); |
|
2685 } |
|
2686 |
|
2687 CAsyncTestMmfAclntAudioRepeatPlayPausePlay::CAsyncTestMmfAclntAudioRepeatPlayPausePlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
2688 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
2689 { |
|
2690 } |
|
2691 |
|
2692 void CAsyncTestMmfAclntAudioRepeatPlayPausePlay::FsmL() |
|
2693 { |
|
2694 switch (iTestState) |
|
2695 { |
|
2696 case EStateOpened: |
|
2697 { |
|
2698 INFO_PRINTF1( _L("TestPlayerUtils : Audio Repeat/Play/Pause/Play")); |
|
2699 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
2700 |
|
2701 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
2702 INFO_PRINTF2( _L("Trailing silence = %ld\n"),iSilence.Int64()); |
|
2703 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
2704 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
2705 |
|
2706 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2707 iTrigger->StartTimer(500000); |
|
2708 iTestState = EStatePlay; |
|
2709 break; |
|
2710 } |
|
2711 case EStatePlay: |
|
2712 { |
|
2713 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
2714 if(iPlayerState == EOpened) |
|
2715 { |
|
2716 iPlayer->Play(); |
|
2717 iPlayerState = EPlaying; |
|
2718 iStart.HomeTime();// start the timer |
|
2719 |
|
2720 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2721 iTrigger->StartTimer(KTwoSeconds); // Call Pause for this test case after two sec |
|
2722 iTestState = EStatePause; |
|
2723 } |
|
2724 else if(iPlayerState == EPaused || iPlayerState == EStopped ) |
|
2725 { |
|
2726 iPlayer->Play(); |
|
2727 iStart.HomeTime();// start the timer for resuming playback |
|
2728 iPlayerState = EPlaying; |
|
2729 } |
|
2730 break; |
|
2731 } |
|
2732 case EStatePause: |
|
2733 { |
|
2734 if(iPlayerState == EPlaying) |
|
2735 { |
|
2736 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
2737 iPlayer->Pause(); |
|
2738 iStop.HomeTime(); |
|
2739 |
|
2740 iPausedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
2741 |
|
2742 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2743 iTrigger->StartTimer(KTwoSeconds); // Resume after two seconds |
|
2744 iPlayerState = EPaused; |
|
2745 iTestState = EStatePlay; |
|
2746 } |
|
2747 break; |
|
2748 } |
|
2749 case EStateStopTest: |
|
2750 { |
|
2751 if(iDuration) |
|
2752 { |
|
2753 iStop.HomeTime(); |
|
2754 iResumedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
2755 iActualDuration = iPausedDuration + iResumedDuration; |
|
2756 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
2757 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
2758 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
2759 |
|
2760 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
2761 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
2762 2*KExpectedDeviation))//more because of the latency during pausing |
|
2763 { |
|
2764 StopTest(); // success |
|
2765 break; |
|
2766 } |
|
2767 else |
|
2768 { |
|
2769 STOP_TEST_GEN_ERROR; |
|
2770 break; |
|
2771 } |
|
2772 #else |
|
2773 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
2774 2*iNumOfRepeatsSet*KExpectedDeviation)) |
|
2775 { |
|
2776 StopTest(); // success |
|
2777 break; |
|
2778 } |
|
2779 else |
|
2780 { |
|
2781 STOP_TEST_GEN_ERROR; |
|
2782 break; |
|
2783 } |
|
2784 #endif |
|
2785 } |
|
2786 else // In case of .sqn file there will be no duration |
|
2787 { |
|
2788 StopTest(); |
|
2789 break; |
|
2790 } |
|
2791 } |
|
2792 |
|
2793 default: |
|
2794 STOP_TEST_GEN_ERROR; |
|
2795 break; |
|
2796 } |
|
2797 } |
|
2798 |
|
2799 CAsyncTestMmfAclntAudioRepeatPlayRepositionPlay* CAsyncTestMmfAclntAudioRepeatPlayRepositionPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, const TTimeIntervalMicroSeconds aPosition) |
|
2800 { |
|
2801 return new (ELeave) CAsyncTestMmfAclntAudioRepeatPlayRepositionPlay( aTestName, aSectName, aKeyName, aPosition); |
|
2802 } |
|
2803 |
|
2804 CAsyncTestMmfAclntAudioRepeatPlayRepositionPlay::CAsyncTestMmfAclntAudioRepeatPlayRepositionPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, const TTimeIntervalMicroSeconds aPosition) |
|
2805 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName), iPosition(aPosition) |
|
2806 { |
|
2807 } |
|
2808 |
|
2809 void CAsyncTestMmfAclntAudioRepeatPlayRepositionPlay::FsmL() |
|
2810 { |
|
2811 switch (iTestState) |
|
2812 { |
|
2813 case EStateOpened: |
|
2814 { |
|
2815 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play/Reposition/Play")); |
|
2816 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
2817 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
2818 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
2819 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
2820 |
|
2821 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2822 iTrigger->StartTimer(500000); |
|
2823 iTestState = EStatePlay; |
|
2824 break; |
|
2825 } |
|
2826 case EStatePlay: |
|
2827 { |
|
2828 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
2829 if(iPlayerState == EOpened) |
|
2830 { |
|
2831 iPlayer->Play(); |
|
2832 iPlayerState = EPlaying; |
|
2833 iStart.HomeTime();// start the timer |
|
2834 |
|
2835 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2836 iTrigger->StartTimer(KOneSecond); // Call Setposition for this test case after two sec |
|
2837 iTestState = EStateSetPosition; |
|
2838 } |
|
2839 break; |
|
2840 } |
|
2841 case EStateSetPosition: |
|
2842 { |
|
2843 if(iPlayerState == EPlaying) |
|
2844 { |
|
2845 INFO_PRINTF1( _L("SetPosition CMdaAudioPlayerUtility")); |
|
2846 iPlayer->SetPosition(iPosition); |
|
2847 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2848 } |
|
2849 break; |
|
2850 } |
|
2851 case EStateStopTest: |
|
2852 { |
|
2853 if(iDuration) |
|
2854 { |
|
2855 iStop.HomeTime(); |
|
2856 iResumedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
2857 iActualDuration = iPausedDuration + iResumedDuration; |
|
2858 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
2859 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
2860 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
2861 |
|
2862 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
2863 if(TimeComparison(iActualDuration, (iDuration * (iNumOfRepeatsSet + 1))+1, |
|
2864 2*KExpectedDeviation))//more because of the latency during repositioning |
|
2865 { |
|
2866 StopTest(); // success |
|
2867 } |
|
2868 else |
|
2869 { |
|
2870 STOP_TEST_GEN_ERROR; |
|
2871 } |
|
2872 #else |
|
2873 if(TimeComparison(iActualDuration, (iDuration * (iNumOfRepeatsSet + 1))+1, |
|
2874 2*iNumOfRepeatsSet*KExpectedDeviation))//more because of the latency during repositioning |
|
2875 { |
|
2876 StopTest(); // success |
|
2877 } |
|
2878 else |
|
2879 { |
|
2880 STOP_TEST_GEN_ERROR; |
|
2881 } |
|
2882 #endif |
|
2883 break; |
|
2884 } |
|
2885 else // In case of .sqn file there will be no duration |
|
2886 { |
|
2887 StopTest(); |
|
2888 break; |
|
2889 } |
|
2890 |
|
2891 } |
|
2892 |
|
2893 default: |
|
2894 STOP_TEST_GEN_ERROR; |
|
2895 break; |
|
2896 } |
|
2897 } |
|
2898 |
|
2899 //============================================================================================================ |
|
2900 |
|
2901 |
|
2902 CAsyncTestMmfAclntAudioRepeatPlayPauseRepeatPlay* CAsyncTestMmfAclntAudioRepeatPlayPauseRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
2903 { |
|
2904 return new (ELeave) CAsyncTestMmfAclntAudioRepeatPlayPauseRepeatPlay( aTestName, aSectName, aKeyName); |
|
2905 } |
|
2906 |
|
2907 CAsyncTestMmfAclntAudioRepeatPlayPauseRepeatPlay::CAsyncTestMmfAclntAudioRepeatPlayPauseRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
2908 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
2909 { |
|
2910 } |
|
2911 |
|
2912 void CAsyncTestMmfAclntAudioRepeatPlayPauseRepeatPlay::FsmL() |
|
2913 { |
|
2914 switch (iTestState) |
|
2915 { |
|
2916 case EStateOpened: |
|
2917 { |
|
2918 INFO_PRINTF1( _L("TestPlayerUtils : Audio Repeat/Play/Pause/Repeat/Play")); |
|
2919 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
2920 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
2921 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet ); |
|
2922 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
2923 |
|
2924 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2925 iTrigger->StartTimer(500000); |
|
2926 iTestState = EStatePlay; |
|
2927 break; |
|
2928 } |
|
2929 case EStatePlay: |
|
2930 { |
|
2931 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
2932 if(iPlayerState == EOpened) |
|
2933 { |
|
2934 iPlayer->Play(); |
|
2935 iPlayerState = EPlaying; |
|
2936 iStart.HomeTime(); |
|
2937 |
|
2938 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2939 iTrigger->StartTimer(KTwoSeconds); // Call Pause for this test case after two sec |
|
2940 iTestState = EStatePause; |
|
2941 } |
|
2942 else if(iPlayerState == EPaused || iPlayerState == EStopped ) |
|
2943 { |
|
2944 iPlayer->Play(); // wait till play completes |
|
2945 iStart.HomeTime();// start the timer after resuming playback |
|
2946 iPlayerState = EPlaying; |
|
2947 } |
|
2948 break; |
|
2949 } |
|
2950 case EStatePause: |
|
2951 { |
|
2952 if(iPlayerState == EPlaying) |
|
2953 { |
|
2954 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
2955 iPlayer->Pause(); |
|
2956 iStop.HomeTime(); |
|
2957 |
|
2958 iPausedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
2959 //Now Set New Repeat Value |
|
2960 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("newRepeatValue"), iNumOfRepeatsSet)) |
|
2961 { |
|
2962 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
2963 StopTest(KErrGeneral, EInconclusive); |
|
2964 return; |
|
2965 } |
|
2966 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
2967 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
2968 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
2969 |
|
2970 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
2971 iTrigger->StartTimer(KTwoSeconds); // Resume after two seconds |
|
2972 iPlayerState = EPaused; |
|
2973 iTestState = EStatePlay; |
|
2974 } |
|
2975 break; |
|
2976 } |
|
2977 case EStateStopTest: |
|
2978 { |
|
2979 if(iDuration) |
|
2980 { |
|
2981 iStop.HomeTime(); |
|
2982 iResumedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
2983 iActualDuration = iPausedDuration + iResumedDuration; |
|
2984 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
2985 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
2986 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
2987 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
2988 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
2989 KExpectedDeviation * 2))//more because of latency during Pausing |
|
2990 { |
|
2991 StopTest(); // success |
|
2992 } |
|
2993 else |
|
2994 { |
|
2995 STOP_TEST_GEN_ERROR; |
|
2996 } |
|
2997 #else |
|
2998 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
2999 KExpectedDeviation * 2*iNumOfRepeatsSet))//more because of latency during Pausing |
|
3000 { |
|
3001 StopTest(); // success |
|
3002 } |
|
3003 else |
|
3004 { |
|
3005 STOP_TEST_GEN_ERROR; |
|
3006 } |
|
3007 #endif |
|
3008 break; |
|
3009 } |
|
3010 else |
|
3011 { |
|
3012 StopTest(); // success |
|
3013 break; |
|
3014 } |
|
3015 } |
|
3016 |
|
3017 |
|
3018 default: |
|
3019 ERR_PRINTF1(_L("State machine error")); |
|
3020 STOP_TEST_GEN_ERROR; |
|
3021 break; |
|
3022 } |
|
3023 } |
|
3024 |
|
3025 //============================================================================================================ |
|
3026 |
|
3027 CAsyncTestMmfAclntAudioPlayPauseRepeatPlay* CAsyncTestMmfAclntAudioPlayPauseRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3028 { |
|
3029 return new (ELeave) CAsyncTestMmfAclntAudioPlayPauseRepeatPlay( aTestName, aSectName, aKeyName); |
|
3030 } |
|
3031 |
|
3032 CAsyncTestMmfAclntAudioPlayPauseRepeatPlay::CAsyncTestMmfAclntAudioPlayPauseRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3033 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3034 { |
|
3035 } |
|
3036 |
|
3037 void CAsyncTestMmfAclntAudioPlayPauseRepeatPlay::FsmL() |
|
3038 { |
|
3039 switch (iTestState) |
|
3040 { |
|
3041 case EStateOpened: |
|
3042 { |
|
3043 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play/Pause/Repeat/Play")); |
|
3044 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3045 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3046 iTrigger->StartTimer(500000); |
|
3047 iTestState = EStatePlay; |
|
3048 break; |
|
3049 } |
|
3050 case EStatePlay: |
|
3051 { |
|
3052 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3053 if(iPlayerState == EOpened) |
|
3054 { |
|
3055 iPlayer->Play(); |
|
3056 iPlayerState = EPlaying; |
|
3057 iStart.HomeTime(); |
|
3058 |
|
3059 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3060 iTrigger->StartTimer(KOneSecond); // Call Pause for this test case after two sec |
|
3061 iTestState = EStatePause; |
|
3062 } |
|
3063 else if(iPlayerState == EPaused || iPlayerState == EStopped ) |
|
3064 { |
|
3065 iPlayer->Play(); // wait till play completes |
|
3066 iStart.HomeTime();//start the timer after resuming playback |
|
3067 |
|
3068 iPlayerState = EPlaying; |
|
3069 } |
|
3070 break; |
|
3071 } |
|
3072 case EStatePause: |
|
3073 { |
|
3074 if(iPlayerState == EPlaying) |
|
3075 { |
|
3076 INFO_PRINTF1(_L("Pause CMdaAudioPlayerUtility")); |
|
3077 iPlayer->Pause(); |
|
3078 iStop.HomeTime(); |
|
3079 |
|
3080 iPausedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3081 |
|
3082 iPlayerState = EPaused; |
|
3083 |
|
3084 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3085 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3086 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3087 |
|
3088 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3089 iTrigger->StartTimer(KOneSecond); // Resume after one seconds |
|
3090 iTestState = EStatePlay; |
|
3091 } |
|
3092 break; |
|
3093 } |
|
3094 case EStateStopTest: |
|
3095 { |
|
3096 if(iDuration) |
|
3097 { |
|
3098 iStop.HomeTime(); |
|
3099 iResumedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3100 iActualDuration = iPausedDuration + iResumedDuration; |
|
3101 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3102 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3103 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3104 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3105 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3106 KExpectedDeviation * 2))//more because of latency during pausing |
|
3107 { |
|
3108 StopTest(); // success |
|
3109 break; |
|
3110 } |
|
3111 else |
|
3112 { |
|
3113 STOP_TEST_GEN_ERROR; |
|
3114 } |
|
3115 #else |
|
3116 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3117 KExpectedDeviation *iNumOfRepeatsSet* 2))//more because of latency during pausing |
|
3118 { |
|
3119 StopTest(); // success |
|
3120 } |
|
3121 else |
|
3122 { |
|
3123 STOP_TEST_GEN_ERROR; |
|
3124 } |
|
3125 #endif |
|
3126 break; |
|
3127 } |
|
3128 else |
|
3129 { |
|
3130 StopTest(); // success |
|
3131 break; |
|
3132 } |
|
3133 } |
|
3134 |
|
3135 default: |
|
3136 STOP_TEST_GEN_ERROR; |
|
3137 break; |
|
3138 } |
|
3139 } |
|
3140 |
|
3141 //============================================================================================================ |
|
3142 |
|
3143 CAsyncTestMmfAclntAudioPlayRepeat* CAsyncTestMmfAclntAudioPlayRepeat::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3144 { |
|
3145 return new (ELeave) CAsyncTestMmfAclntAudioPlayRepeat( aTestName, aSectName, aKeyName); |
|
3146 } |
|
3147 |
|
3148 CAsyncTestMmfAclntAudioPlayRepeat::CAsyncTestMmfAclntAudioPlayRepeat( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3149 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3150 { |
|
3151 } |
|
3152 |
|
3153 void CAsyncTestMmfAclntAudioPlayRepeat::FsmL() |
|
3154 { |
|
3155 switch (iTestState) |
|
3156 { |
|
3157 case EStateOpened: |
|
3158 { |
|
3159 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play/Repeat")); |
|
3160 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3161 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3162 iTrigger->StartTimer(500000); |
|
3163 iTestState = EStatePlay; |
|
3164 break; |
|
3165 } |
|
3166 case EStatePlay: |
|
3167 { |
|
3168 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3169 if(iPlayerState == EOpened) |
|
3170 { |
|
3171 iPlayer->Play(); |
|
3172 iPlayerState = EPlaying; |
|
3173 iStart.HomeTime();// Start the timer |
|
3174 |
|
3175 TTimeIntervalMicroSeconds silence(0); // silence gap |
|
3176 INFO_PRINTF1( _L("SetRepeats with higher value CMdaAudioPlayerUtility")); |
|
3177 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("maxRepeatValue"), iNumOfRepeatsSet)) |
|
3178 { |
|
3179 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
3180 StopTest(KErrGeneral, EInconclusive); |
|
3181 break; |
|
3182 } |
|
3183 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3184 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3185 } |
|
3186 break; |
|
3187 } |
|
3188 case EStateStopTest: |
|
3189 { |
|
3190 if(iDuration) |
|
3191 { |
|
3192 iStop.HomeTime(); |
|
3193 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3194 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3195 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3196 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3197 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3198 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3199 KExpectedDeviation)) |
|
3200 { |
|
3201 StopTest(); // success |
|
3202 } |
|
3203 else |
|
3204 { |
|
3205 if(TimeComparison(iActualDuration, (iDuration + 100000) * (iNumOfRepeatsSet + 1), |
|
3206 KExpectedDeviation)) |
|
3207 { |
|
3208 StopTest(KErrGeneral, EKnownFailure); |
|
3209 } |
|
3210 else |
|
3211 { |
|
3212 STOP_TEST_GEN_ERROR; |
|
3213 } |
|
3214 } |
|
3215 #else |
|
3216 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3217 KExpectedDeviation*iNumOfRepeatsSet)) |
|
3218 { |
|
3219 StopTest(); // success |
|
3220 } |
|
3221 else |
|
3222 { |
|
3223 STOP_TEST_GEN_ERROR; |
|
3224 } |
|
3225 #endif |
|
3226 break; |
|
3227 } |
|
3228 else |
|
3229 { |
|
3230 StopTest(); // success |
|
3231 break; |
|
3232 } |
|
3233 } |
|
3234 default: |
|
3235 STOP_TEST_GEN_ERROR; |
|
3236 break; |
|
3237 } |
|
3238 } |
|
3239 |
|
3240 //============================================================================================================ |
|
3241 |
|
3242 CAsyncTestMmfAclntAudioRepeatBeforeOpen* CAsyncTestMmfAclntAudioRepeatBeforeOpen::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3243 { |
|
3244 return new (ELeave) CAsyncTestMmfAclntAudioRepeatBeforeOpen( aTestName, aSectName, aKeyName); |
|
3245 } |
|
3246 |
|
3247 CAsyncTestMmfAclntAudioRepeatBeforeOpen::CAsyncTestMmfAclntAudioRepeatBeforeOpen( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3248 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3249 { |
|
3250 } |
|
3251 |
|
3252 void CAsyncTestMmfAclntAudioRepeatBeforeOpen::KickoffTestL( void ) |
|
3253 { |
|
3254 INFO_PRINTF1( _L("TestPlayerUtils : Audio Player Util")); |
|
3255 TPtrC filename1; |
|
3256 TInt repeatCount; |
|
3257 |
|
3258 if(!GetStringFromConfig(iSectName, iKeyName, filename1)) |
|
3259 { |
|
3260 ERR_PRINTF1(_L("GetStringFromConfig Failed")); |
|
3261 StopTest(KErrGeneral, EInconclusive); |
|
3262 return; |
|
3263 } |
|
3264 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("numOfRepeat"), repeatCount)) |
|
3265 { |
|
3266 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
3267 StopTest(KErrGeneral, EInconclusive); |
|
3268 return; |
|
3269 } |
|
3270 iNumOfRepeatsSet = repeatCount; |
|
3271 GetDriveName(iFileName); |
|
3272 iFileName.Append(filename1); |
|
3273 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &iFileName); |
|
3274 iTrigger = CFsmTrigger::NewL(*this); |
|
3275 |
|
3276 iPlayer = CMdaAudioPlayerUtility::NewL(*this); |
|
3277 |
|
3278 TTimeIntervalMicroSeconds trailingSilence(1); |
|
3279 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility before opening the clip")); |
|
3280 iNumOfRepeatsSet = NUMBER_OF_REPEATS; |
|
3281 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3282 iPlayer->SetRepeats(iNumOfRepeatsSet,trailingSilence); |
|
3283 iPlayer->OpenFileL(iFileName); |
|
3284 iPlayerState = EOpening; |
|
3285 } |
|
3286 |
|
3287 void CAsyncTestMmfAclntAudioRepeatBeforeOpen::FsmL() |
|
3288 { |
|
3289 switch (iTestState) |
|
3290 { |
|
3291 case EStateOpened: |
|
3292 { |
|
3293 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3294 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3295 if(iPlayerState == EOpened) |
|
3296 { |
|
3297 iPlayer->Play(); |
|
3298 iPlayerState = EPlaying; |
|
3299 iStart.HomeTime();// Start the timer |
|
3300 } |
|
3301 break; |
|
3302 } |
|
3303 case EStateStopTest: |
|
3304 { |
|
3305 if(iDuration) |
|
3306 { |
|
3307 iStop.HomeTime(); |
|
3308 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3309 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3310 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3311 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3312 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3313 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3314 KExpectedDeviation)) |
|
3315 { |
|
3316 StopTest(); // success |
|
3317 } |
|
3318 else |
|
3319 { |
|
3320 STOP_TEST_GEN_ERROR; |
|
3321 } |
|
3322 #else |
|
3323 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3324 KExpectedDeviation*iNumOfRepeatsSet)) |
|
3325 { |
|
3326 StopTest(); // success |
|
3327 } |
|
3328 else |
|
3329 { |
|
3330 STOP_TEST_GEN_ERROR; |
|
3331 } |
|
3332 #endif |
|
3333 break; |
|
3334 } |
|
3335 else |
|
3336 { |
|
3337 StopTest(); // success |
|
3338 break; |
|
3339 } |
|
3340 } |
|
3341 default: |
|
3342 STOP_TEST_GEN_ERROR; |
|
3343 break; |
|
3344 } |
|
3345 } |
|
3346 |
|
3347 //============================================================================================================ |
|
3348 |
|
3349 CAsyncTestMmfAclntAudioPlayRepeatPauseRepeatPlay* CAsyncTestMmfAclntAudioPlayRepeatPauseRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3350 { |
|
3351 return new (ELeave) CAsyncTestMmfAclntAudioPlayRepeatPauseRepeatPlay( aTestName, aSectName, aKeyName); |
|
3352 } |
|
3353 |
|
3354 CAsyncTestMmfAclntAudioPlayRepeatPauseRepeatPlay::CAsyncTestMmfAclntAudioPlayRepeatPauseRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3355 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3356 { |
|
3357 } |
|
3358 |
|
3359 void CAsyncTestMmfAclntAudioPlayRepeatPauseRepeatPlay::FsmL() |
|
3360 { |
|
3361 switch (iTestState) |
|
3362 { |
|
3363 case EStateOpened: |
|
3364 { |
|
3365 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play/Repeat/Pause/Repeat/Play")); |
|
3366 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3367 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3368 iTrigger->StartTimer(500000); |
|
3369 iTestState = EStatePlay; |
|
3370 break; |
|
3371 } |
|
3372 case EStateSetRepeat: |
|
3373 { |
|
3374 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3375 INFO_PRINTF2( _L("Repeats = %d"),iNumOfRepeatsSet); |
|
3376 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3377 |
|
3378 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3379 iTrigger->StartTimer(KOneSecond);// Call Pause after two seconds |
|
3380 iTestState = EStatePause; |
|
3381 break; |
|
3382 } |
|
3383 case EStatePlay: |
|
3384 { |
|
3385 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3386 if(iPlayerState == EOpened) |
|
3387 { |
|
3388 iPlayer->Play(); |
|
3389 iPlayerState = EPlaying; |
|
3390 iStart.HomeTime(); |
|
3391 |
|
3392 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3393 iTrigger->StartTimer(500000); |
|
3394 iTestState = EStateSetRepeat; |
|
3395 } |
|
3396 else if(iPlayerState == EPaused || iPlayerState == EStopped ) |
|
3397 { |
|
3398 iPlayer->Play(); // wait till play completes |
|
3399 iStart.HomeTime(); |
|
3400 iPlayerState = EPlaying; |
|
3401 } |
|
3402 break; |
|
3403 } |
|
3404 case EStatePause: |
|
3405 { |
|
3406 if(iPlayerState == EPlaying) |
|
3407 { |
|
3408 INFO_PRINTF1( _L("Pause CMdaAudioPlayerUtility")); |
|
3409 iPlayer->Pause(); |
|
3410 iStop.HomeTime(); |
|
3411 iPausedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3412 |
|
3413 //Now Set New Repeat Value |
|
3414 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("newRepeatValue"), iNumOfRepeatsSet)) |
|
3415 { |
|
3416 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
3417 StopTest(KErrGeneral, EInconclusive); |
|
3418 break; |
|
3419 } |
|
3420 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3421 INFO_PRINTF2( _L("Repeats = %d"),iNumOfRepeatsSet); |
|
3422 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3423 |
|
3424 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3425 iTrigger->StartTimer(KTwoSeconds); // Resume after two seconds |
|
3426 iPlayerState = EPaused; |
|
3427 iTestState = EStatePlay; |
|
3428 } |
|
3429 break; |
|
3430 } |
|
3431 case EStateStopTest: |
|
3432 { |
|
3433 if(iDuration) |
|
3434 { |
|
3435 iStop.HomeTime(); |
|
3436 iResumedDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3437 iActualDuration = iPausedDuration + iResumedDuration; |
|
3438 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3439 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3440 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3441 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3442 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3443 KExpectedDeviation * 2)) |
|
3444 { |
|
3445 StopTest(); // success |
|
3446 } |
|
3447 else |
|
3448 { |
|
3449 STOP_TEST_GEN_ERROR; |
|
3450 } |
|
3451 #else |
|
3452 if(TimeComparison(iActualDuration, iDuration * (iNumOfRepeatsSet + 1), |
|
3453 KExpectedDeviation * iNumOfRepeatsSet* 2)) |
|
3454 { |
|
3455 StopTest(); // success |
|
3456 } |
|
3457 else |
|
3458 { |
|
3459 STOP_TEST_GEN_ERROR; |
|
3460 } |
|
3461 #endif |
|
3462 break; |
|
3463 } |
|
3464 else |
|
3465 { |
|
3466 StopTest(); // success |
|
3467 break; |
|
3468 } |
|
3469 } |
|
3470 default: |
|
3471 STOP_TEST_GEN_ERROR; |
|
3472 break; |
|
3473 } |
|
3474 } |
|
3475 |
|
3476 //============================================================================================================ |
|
3477 |
|
3478 |
|
3479 CAsyncTestMmfAclntAudioRepeatPlayStopPlay* CAsyncTestMmfAclntAudioRepeatPlayStopPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3480 { |
|
3481 return new (ELeave) CAsyncTestMmfAclntAudioRepeatPlayStopPlay( aTestName, aSectName, aKeyName); |
|
3482 } |
|
3483 |
|
3484 CAsyncTestMmfAclntAudioRepeatPlayStopPlay::CAsyncTestMmfAclntAudioRepeatPlayStopPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3485 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3486 { |
|
3487 } |
|
3488 |
|
3489 void CAsyncTestMmfAclntAudioRepeatPlayStopPlay::FsmL() |
|
3490 { |
|
3491 switch (iTestState) |
|
3492 { |
|
3493 case EStateOpened: |
|
3494 { |
|
3495 INFO_PRINTF1( _L("TestPlayerUtils : Audio Repeat/Play/Stop/Play")); |
|
3496 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3497 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3498 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3499 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3500 |
|
3501 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3502 iTrigger->StartTimer(500000); |
|
3503 iTestState = EStatePlay; |
|
3504 break; |
|
3505 } |
|
3506 case EStatePlay: |
|
3507 { |
|
3508 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3509 if(iPlayerState == EOpened) |
|
3510 { |
|
3511 iPlayer->Play(); |
|
3512 iStart.HomeTime(); |
|
3513 |
|
3514 iPlayerState = EPlaying; |
|
3515 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3516 iTrigger->StartTimer(KOneSecond); // Call Stop for this test case after two sec |
|
3517 iTestState = EStateStop; |
|
3518 } |
|
3519 else if(iPlayerState == EPaused || iPlayerState == EStopped ) |
|
3520 { |
|
3521 iPlayer->Play(); // wait till play completes |
|
3522 iStart.HomeTime(); |
|
3523 iPlayerState = EPlaying; |
|
3524 } |
|
3525 break; |
|
3526 } |
|
3527 case EStateStop: |
|
3528 { |
|
3529 INFO_PRINTF1( _L("Stop CMdaAudioPlayerUtility")); |
|
3530 iPlayer->Stop(); |
|
3531 iPlayerState = EStopped; |
|
3532 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3533 iTrigger->StartTimer(KTwoSeconds); // Call Pause for this test case after two sec |
|
3534 iTestState = EStatePlay; |
|
3535 break; |
|
3536 } |
|
3537 case EStateStopTest: |
|
3538 { |
|
3539 if(iDuration) |
|
3540 { |
|
3541 iStop.HomeTime(); |
|
3542 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3543 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3544 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3545 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration*(iNumOfRepeatsSet+1)); |
|
3546 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3547 if(TimeComparison(iActualDuration, iDuration*(iNumOfRepeatsSet+1), KExpectedDeviation)) |
|
3548 { |
|
3549 StopTest(); // success |
|
3550 } |
|
3551 else |
|
3552 { |
|
3553 STOP_TEST_GEN_ERROR; |
|
3554 } |
|
3555 #else |
|
3556 if(TimeComparison(iActualDuration, iDuration*(iNumOfRepeatsSet+1), KExpectedDeviation*iNumOfRepeatsSet)) |
|
3557 { |
|
3558 StopTest(); // success |
|
3559 } |
|
3560 else |
|
3561 { |
|
3562 STOP_TEST_GEN_ERROR; |
|
3563 } |
|
3564 #endif |
|
3565 break; |
|
3566 } |
|
3567 else |
|
3568 { |
|
3569 StopTest(); |
|
3570 break; |
|
3571 } |
|
3572 } |
|
3573 |
|
3574 default: |
|
3575 STOP_TEST_GEN_ERROR; |
|
3576 break; |
|
3577 } |
|
3578 } |
|
3579 |
|
3580 //============================================================================================================ |
|
3581 |
|
3582 |
|
3583 CAsyncTestMmfAclntAudioRepeatPlayRepeatPlay* CAsyncTestMmfAclntAudioRepeatPlayRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3584 { |
|
3585 return new (ELeave) CAsyncTestMmfAclntAudioRepeatPlayRepeatPlay( aTestName, aSectName, aKeyName); |
|
3586 } |
|
3587 |
|
3588 CAsyncTestMmfAclntAudioRepeatPlayRepeatPlay::CAsyncTestMmfAclntAudioRepeatPlayRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3589 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3590 { |
|
3591 } |
|
3592 |
|
3593 void CAsyncTestMmfAclntAudioRepeatPlayRepeatPlay::FsmL() |
|
3594 { |
|
3595 switch (iTestState) |
|
3596 { |
|
3597 case EStateOpened: |
|
3598 { |
|
3599 INFO_PRINTF1( _L("TestPlayerUtils : Audio Repeat/Play/Repeat/Play")); |
|
3600 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3601 |
|
3602 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3603 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3604 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3605 |
|
3606 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3607 if(iPlayerState == EOpened) |
|
3608 { |
|
3609 iPlayer->Play(); |
|
3610 iPlayerState = EPlaying; |
|
3611 iStart.HomeTime(); |
|
3612 |
|
3613 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3614 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("newRepeatValue"), iNumOfRepeatsSet)) |
|
3615 { |
|
3616 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
3617 StopTest(KErrGeneral, EInconclusive); |
|
3618 break; |
|
3619 } |
|
3620 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet ); |
|
3621 iPlayer->SetRepeats(iNumOfRepeatsSet, iSilence); |
|
3622 } |
|
3623 break; |
|
3624 } |
|
3625 case EStateStopTest: |
|
3626 { |
|
3627 if(iDuration) |
|
3628 { |
|
3629 iStop.HomeTime(); |
|
3630 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3631 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3632 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3633 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3634 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3635 if(TimeComparison(iActualDuration, iDuration *(iNumOfRepeatsSet+1), |
|
3636 KExpectedDeviation)) |
|
3637 { |
|
3638 StopTest(); // success |
|
3639 } |
|
3640 else |
|
3641 { |
|
3642 STOP_TEST_GEN_ERROR; |
|
3643 } |
|
3644 #else |
|
3645 if(TimeComparison(iActualDuration, iDuration *(iNumOfRepeatsSet+1), |
|
3646 KExpectedDeviation*iNumOfRepeatsSet)) |
|
3647 { |
|
3648 StopTest(); // success |
|
3649 } |
|
3650 else |
|
3651 { |
|
3652 STOP_TEST_GEN_ERROR; |
|
3653 } |
|
3654 #endif |
|
3655 break; |
|
3656 } |
|
3657 else |
|
3658 { |
|
3659 StopTest(); // success |
|
3660 break; |
|
3661 } |
|
3662 } |
|
3663 default: |
|
3664 STOP_TEST_GEN_ERROR; |
|
3665 break; |
|
3666 } |
|
3667 } |
|
3668 |
|
3669 //============================================================================================================ |
|
3670 |
|
3671 |
|
3672 |
|
3673 CAsyncTestMmfAclntAudioPlayRepeatRepeatPlay* CAsyncTestMmfAclntAudioPlayRepeatRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3674 { |
|
3675 return new (ELeave) CAsyncTestMmfAclntAudioPlayRepeatRepeatPlay( aTestName, aSectName, aKeyName); |
|
3676 } |
|
3677 |
|
3678 CAsyncTestMmfAclntAudioPlayRepeatRepeatPlay::CAsyncTestMmfAclntAudioPlayRepeatRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3679 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3680 { |
|
3681 } |
|
3682 |
|
3683 void CAsyncTestMmfAclntAudioPlayRepeatRepeatPlay::FsmL() |
|
3684 { |
|
3685 switch (iTestState) |
|
3686 { |
|
3687 case EStateOpened: |
|
3688 { |
|
3689 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play/Repeat/Repeat/Play")); |
|
3690 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3691 |
|
3692 if(iPlayerState == EOpened) |
|
3693 { |
|
3694 iPlayer->Play(); |
|
3695 iPlayerState = EPlaying; |
|
3696 iStart.HomeTime(); |
|
3697 |
|
3698 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3699 INFO_PRINTF2( _L("Repeats = %d"),iNumOfRepeatsSet); |
|
3700 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3701 |
|
3702 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3703 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("newRepeatValue"), iNumOfRepeatsSet)) |
|
3704 { |
|
3705 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
3706 StopTest(KErrGeneral, EInconclusive); |
|
3707 break; |
|
3708 } |
|
3709 INFO_PRINTF2( _L("Repeats = %d"),iNumOfRepeatsSet); |
|
3710 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3711 } |
|
3712 break; |
|
3713 } |
|
3714 case EStateStopTest: |
|
3715 { |
|
3716 if(iDuration) |
|
3717 { |
|
3718 iStop.HomeTime(); |
|
3719 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3720 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3721 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3722 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3723 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3724 if(TimeComparison(iActualDuration, iDuration *(iNumOfRepeatsSet+1),KExpectedDeviation)) |
|
3725 // since we setting repeats during first playback of first repeat, we need to take into consideration of first playback |
|
3726 { |
|
3727 StopTest(); // success |
|
3728 } |
|
3729 else |
|
3730 { |
|
3731 STOP_TEST_GEN_ERROR; |
|
3732 } |
|
3733 #else |
|
3734 if(TimeComparison(iActualDuration, iDuration *(iNumOfRepeatsSet+1),KExpectedDeviation*iNumOfRepeatsSet)) |
|
3735 // since we setting repeats during first playback of first repeat, we need to take into consideration of first playback |
|
3736 { |
|
3737 StopTest(); // success |
|
3738 } |
|
3739 else |
|
3740 { |
|
3741 STOP_TEST_GEN_ERROR; |
|
3742 } |
|
3743 #endif |
|
3744 break; |
|
3745 } |
|
3746 else |
|
3747 { |
|
3748 StopTest(); // success |
|
3749 break; |
|
3750 } |
|
3751 |
|
3752 } |
|
3753 default: |
|
3754 STOP_TEST_GEN_ERROR; |
|
3755 break; |
|
3756 } |
|
3757 } |
|
3758 |
|
3759 //============================================================================================================ |
|
3760 |
|
3761 |
|
3762 |
|
3763 CAsyncTestMmfAclntAudioPlayRepeatRamp* CAsyncTestMmfAclntAudioPlayRepeatRamp::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3764 { |
|
3765 return new (ELeave) CAsyncTestMmfAclntAudioPlayRepeatRamp( aTestName, aSectName, aKeyName); |
|
3766 } |
|
3767 |
|
3768 CAsyncTestMmfAclntAudioPlayRepeatRamp::CAsyncTestMmfAclntAudioPlayRepeatRamp( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3769 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3770 { |
|
3771 } |
|
3772 |
|
3773 void CAsyncTestMmfAclntAudioPlayRepeatRamp::FsmL() |
|
3774 { |
|
3775 switch (iTestState) |
|
3776 { |
|
3777 case EStateOpened: |
|
3778 { |
|
3779 INFO_PRINTF1( _L("TestPlayerUtils : Audio Repeat/SetVolumeRamp/Play")); |
|
3780 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3781 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3782 |
|
3783 iPlayer->Play(); |
|
3784 iPlayerState = EPlaying; |
|
3785 iStart.HomeTime(); |
|
3786 |
|
3787 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3788 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3789 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3790 |
|
3791 INFO_PRINTF1( _L("SetVolumeRamp CMdaAudioPlayerUtility")); |
|
3792 iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(5000000)); |
|
3793 break; |
|
3794 } |
|
3795 case EStateStopTest: |
|
3796 { |
|
3797 if(iDuration) |
|
3798 { |
|
3799 iStop.HomeTime(); |
|
3800 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
3801 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
3802 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
3803 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(iNumOfRepeatsSet+1)); |
|
3804 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
3805 if(TimeComparison(iActualDuration, iDuration *(iNumOfRepeatsSet+1), |
|
3806 KExpectedDeviation)) |
|
3807 { |
|
3808 StopTest(); // success |
|
3809 } |
|
3810 else |
|
3811 { |
|
3812 STOP_TEST_GEN_ERROR; |
|
3813 } |
|
3814 #else |
|
3815 if(TimeComparison(iActualDuration, iDuration *(iNumOfRepeatsSet+1), |
|
3816 KExpectedDeviation*iNumOfRepeatsSet)) |
|
3817 { |
|
3818 StopTest(); // success |
|
3819 } |
|
3820 else |
|
3821 { |
|
3822 STOP_TEST_GEN_ERROR; |
|
3823 } |
|
3824 #endif |
|
3825 break; |
|
3826 } |
|
3827 else |
|
3828 { |
|
3829 StopTest(); // success |
|
3830 break; |
|
3831 } |
|
3832 } |
|
3833 default: |
|
3834 STOP_TEST_GEN_ERROR; |
|
3835 break; |
|
3836 } |
|
3837 } |
|
3838 //============================================================================================================ |
|
3839 |
|
3840 CAsyncTestMmfAclntAudioRepeatForeverPlay* CAsyncTestMmfAclntAudioRepeatForeverPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TTimeIntervalMicroSeconds aTrailingSilence) |
|
3841 { |
|
3842 return new (ELeave) CAsyncTestMmfAclntAudioRepeatForeverPlay( aTestName, aSectName, aKeyName, aTrailingSilence); |
|
3843 } |
|
3844 |
|
3845 CAsyncTestMmfAclntAudioRepeatForeverPlay::CAsyncTestMmfAclntAudioRepeatForeverPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TTimeIntervalMicroSeconds aTrailingSilence) |
|
3846 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3847 { |
|
3848 iTrailingSilence = aTrailingSilence; |
|
3849 } |
|
3850 |
|
3851 void CAsyncTestMmfAclntAudioRepeatForeverPlay::FsmL() |
|
3852 { |
|
3853 switch (iTestState) |
|
3854 { |
|
3855 case EStateOpened: |
|
3856 { |
|
3857 INFO_PRINTF1( _L("TestPlayerUtils : Audio RepeatForever/Play")); |
|
3858 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3859 |
|
3860 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3861 INFO_PRINTF2( _L("Repeats (KMdaRepeatForever) = %d\n"),KMdaRepeatForever); |
|
3862 INFO_PRINTF2( _L("Trailing silence = %ld\n"),iTrailingSilence.Int64()); |
|
3863 iPlayer->SetRepeats(KMdaRepeatForever,iTrailingSilence); |
|
3864 |
|
3865 if(iPlayerState == EOpened) |
|
3866 { |
|
3867 iPlayer->Play(); |
|
3868 iPlayerState = EPlaying; |
|
3869 if(iDuration) |
|
3870 { |
|
3871 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3872 iTrigger->StartTimer(iDuration * 6); // Wait till complettion of 5 repeats then issue stop |
|
3873 } |
|
3874 else |
|
3875 { |
|
3876 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3877 iTrigger->StartTimer(KOneSecond * 40); // Wait for 40 sec of playback and then issue stop |
|
3878 } |
|
3879 iTestState = EStateStop; |
|
3880 } |
|
3881 break; |
|
3882 } |
|
3883 case EStateStop: |
|
3884 { |
|
3885 INFO_PRINTF1( _L("Stop CMdaAudioPlayerUtility")); |
|
3886 iPlayer->Stop(); |
|
3887 iPlayerState = EStopped; |
|
3888 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3889 iTrigger->StartTimer(500000); // Call Pause for this test case after two sec |
|
3890 iTestState = EStateStopTest; |
|
3891 break; |
|
3892 } |
|
3893 case EStateStopTest: |
|
3894 { |
|
3895 StopTest(); // success |
|
3896 break; |
|
3897 } |
|
3898 default: |
|
3899 STOP_TEST_GEN_ERROR; |
|
3900 break; |
|
3901 } |
|
3902 } |
|
3903 |
|
3904 |
|
3905 //============================================================================================================ |
|
3906 |
|
3907 CAsyncTestMmfAclntAudioRepeatPlayGetPosition* CAsyncTestMmfAclntAudioRepeatPlayGetPosition::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3908 { |
|
3909 return new (ELeave) CAsyncTestMmfAclntAudioRepeatPlayGetPosition( aTestName, aSectName, aKeyName); |
|
3910 } |
|
3911 |
|
3912 CAsyncTestMmfAclntAudioRepeatPlayGetPosition::CAsyncTestMmfAclntAudioRepeatPlayGetPosition( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
3913 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3914 { |
|
3915 |
|
3916 } |
|
3917 |
|
3918 void CAsyncTestMmfAclntAudioRepeatPlayGetPosition::FsmL() |
|
3919 { |
|
3920 switch (iTestState) |
|
3921 { |
|
3922 case EStateOpened: |
|
3923 { |
|
3924 INFO_PRINTF1( _L("TestPlayerUtils : Audio Repeat/Play/GetPosition")); |
|
3925 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
3926 |
|
3927 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
3928 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
3929 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
3930 |
|
3931 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
3932 |
|
3933 if(iPlayerState == EOpened) |
|
3934 { |
|
3935 iPlayer->Play(); |
|
3936 iPlayerState = EPlaying; |
|
3937 |
|
3938 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3939 iTrigger->StartTimer(KOneSecond); // Call GetPosition (during Playback of Second repeat) for every 2 sec |
|
3940 iTestState = EStateGetPosition; |
|
3941 } |
|
3942 break; |
|
3943 } |
|
3944 case EStateGetPosition: |
|
3945 { |
|
3946 INFO_PRINTF1( _L("GetPosition CMdaAudioPlayerUtility")); |
|
3947 TInt err = iPlayer->GetPosition(iPosition); |
|
3948 if(err == KErrNone && iPosition <= iDuration * (iNumOfRepeatsSet+1) ) |
|
3949 { |
|
3950 INFO_PRINTF2(_L("GetPosition = %d"),I64INT(iPosition.Int64())); |
|
3951 INFO_PRINTF2(_L("TotalClip Duration Including Repeats = %d"),iDuration * (iNumOfRepeatsSet+1)); |
|
3952 |
|
3953 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
3954 iTrigger->StartTimer(KOneSecond); // Call GetPosition (during Playback of Second repeat) for every 2 sec |
|
3955 iTestState = EStateGetPosition; |
|
3956 |
|
3957 break; |
|
3958 } |
|
3959 else |
|
3960 { |
|
3961 StopTest(err, EFail); |
|
3962 break; |
|
3963 } |
|
3964 } |
|
3965 case EStateStopTest: |
|
3966 { |
|
3967 StopTest(); // success |
|
3968 break; |
|
3969 } |
|
3970 default: |
|
3971 STOP_TEST_GEN_ERROR; |
|
3972 break; |
|
3973 } |
|
3974 } |
|
3975 |
|
3976 //============================================================================================================ |
|
3977 |
|
3978 |
|
3979 CAsyncTestMmfAclntDRMRepeatPlay* CAsyncTestMmfAclntDRMRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, const TDesC& aUniqueId, const TInt aRepeatCount) |
|
3980 { |
|
3981 return new (ELeave) CAsyncTestMmfAclntDRMRepeatPlay( aTestName, aSectName, aKeyName, aUniqueId, aRepeatCount); |
|
3982 } |
|
3983 |
|
3984 CAsyncTestMmfAclntDRMRepeatPlay::CAsyncTestMmfAclntDRMRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, const TDesC& aUniqueId,const TInt aRepeatCount) |
|
3985 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
3986 { |
|
3987 iUniqueId = aUniqueId; |
|
3988 iNumOfRepeatsSet = aRepeatCount; |
|
3989 } |
|
3990 |
|
3991 void CAsyncTestMmfAclntDRMRepeatPlay::KickoffTestL() |
|
3992 { |
|
3993 INFO_PRINTF1( _L("TestPlayerUtils : Audio Player Util")); |
|
3994 TPtrC filename1; |
|
3995 TInt repeatCount; |
|
3996 TInt silence; |
|
3997 if(!GetStringFromConfig(iSectName, iKeyName, filename1)) |
|
3998 { |
|
3999 ERR_PRINTF1(_L("GetStringFromConfig Failed")); |
|
4000 StopTest(KErrGeneral, EInconclusive); |
|
4001 return; |
|
4002 } |
|
4003 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("numOfRepeat"), repeatCount)) |
|
4004 { |
|
4005 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
4006 StopTest(KErrGeneral, EInconclusive); |
|
4007 return; |
|
4008 } |
|
4009 if(!GetIntFromConfig(_L("SectionSilence"), _L("silence"), silence)) |
|
4010 { |
|
4011 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
4012 StopTest(KErrGeneral, EInconclusive); |
|
4013 return; |
|
4014 } |
|
4015 iSilence = silence; |
|
4016 iNumOfRepeatsSet = repeatCount; |
|
4017 |
|
4018 GetDriveName(iFileName); |
|
4019 iFileName.Append(filename1); |
|
4020 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &iFileName); |
|
4021 iTrigger = CFsmTrigger::NewL(*this); |
|
4022 |
|
4023 INFO_PRINTF1( _L("TestPlayerUtils : DRM Audio Repeat/Play")); |
|
4024 iPlayer = CMdaAudioPlayerUtility::NewL(*this); |
|
4025 iPlayer->OpenFileL(TMMFileSource(iFileName, iUniqueId, ContentAccess::EPlay)); |
|
4026 iPlayerState = EOpening; |
|
4027 } |
|
4028 |
|
4029 void CAsyncTestMmfAclntDRMRepeatPlay::MapcInitComplete(TInt aError, |
|
4030 const TTimeIntervalMicroSeconds &aDuration) |
|
4031 { |
|
4032 iError = aError; |
|
4033 iClipDuration = aDuration; |
|
4034 if (aError == KErrNone) |
|
4035 { |
|
4036 INFO_PRINTF2(_L("*MapcInitComplete* Error: %d."), aError); |
|
4037 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4038 iTrigger->StartTimer(500000); |
|
4039 iTestState = EStateStopTest; |
|
4040 } |
|
4041 else if(aError == KErrCANoPermission) |
|
4042 { |
|
4043 INFO_PRINTF2(_L("*MapcInitComplete* Error: %d Rights expired"), aError); |
|
4044 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4045 iTrigger->StartTimer(500000); |
|
4046 iTestState = EStateStopTest; |
|
4047 } |
|
4048 else |
|
4049 { |
|
4050 StopTest(aError, EFail); |
|
4051 } |
|
4052 } |
|
4053 void CAsyncTestMmfAclntDRMRepeatPlay::MapcPlayComplete(TInt aError) |
|
4054 { |
|
4055 if(aError == KErrNone ) |
|
4056 { |
|
4057 INFO_PRINTF2(_L("*MapcPlayComplete* Error: %d"), aError); |
|
4058 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4059 iTrigger->StartTimer(500000); |
|
4060 iTestState = EStateStopTest; |
|
4061 } |
|
4062 else if(aError == KErrCANoPermission) |
|
4063 { |
|
4064 INFO_PRINTF2(_L("*MapcPlayComplete* Error: %d Rights expired"), aError); |
|
4065 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4066 iTrigger->StartTimer(500000); |
|
4067 iTestState = EStateStopTest; |
|
4068 } |
|
4069 else |
|
4070 { |
|
4071 StopTest(aError, EFail); |
|
4072 } |
|
4073 } |
|
4074 void CAsyncTestMmfAclntDRMRepeatPlay::FsmL() |
|
4075 { |
|
4076 switch (iTestState) |
|
4077 { |
|
4078 case EStateOpened: |
|
4079 { |
|
4080 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
4081 |
|
4082 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
4083 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
4084 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
4085 |
|
4086 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
4087 |
|
4088 if(iPlayerState == EOpened) |
|
4089 { |
|
4090 iPlayer->Play(); |
|
4091 iPlayerState = EPlaying; |
|
4092 } |
|
4093 break; |
|
4094 } |
|
4095 case EStateStopTest: |
|
4096 { |
|
4097 StopTest(); // success |
|
4098 break; |
|
4099 } |
|
4100 default: |
|
4101 STOP_TEST_GEN_ERROR; |
|
4102 break; |
|
4103 } |
|
4104 } |
|
4105 |
|
4106 |
|
4107 |
|
4108 |
|
4109 //============================================================================================================= |
|
4110 //RAsync Negative tests |
|
4111 //============================================================================================================== |
|
4112 |
|
4113 |
|
4114 |
|
4115 CAsyncTestMmfAclntAudioNegativeRepeatPlay* CAsyncTestMmfAclntAudioNegativeRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
4116 { |
|
4117 return new (ELeave) CAsyncTestMmfAclntAudioNegativeRepeatPlay( aTestName, aSectName, aKeyName); |
|
4118 } |
|
4119 |
|
4120 CAsyncTestMmfAclntAudioNegativeRepeatPlay::CAsyncTestMmfAclntAudioNegativeRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
4121 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
4122 { |
|
4123 } |
|
4124 |
|
4125 void CAsyncTestMmfAclntAudioNegativeRepeatPlay::FsmL() |
|
4126 { |
|
4127 switch (iTestState) |
|
4128 { |
|
4129 case EStateOpened: |
|
4130 { |
|
4131 INFO_PRINTF1( _L("TestPlayerUtils : Audio NegativeRepeat/Play")); |
|
4132 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
4133 |
|
4134 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
4135 INFO_PRINTF2( _L("Repeats = %d\n"),KNegativeRepeat); |
|
4136 iPlayer->SetRepeats(KNegativeRepeat,iSilence); |
|
4137 |
|
4138 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
4139 |
|
4140 if(iPlayerState == EOpened) |
|
4141 { |
|
4142 iPlayer->Play(); |
|
4143 iPlayerState = EPlaying; |
|
4144 iStart.HomeTime(); |
|
4145 } |
|
4146 break; |
|
4147 } |
|
4148 case EStateStopTest: |
|
4149 { |
|
4150 if(iDuration) |
|
4151 { |
|
4152 iStop.HomeTime(); |
|
4153 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
4154 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
4155 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
4156 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration); |
|
4157 if(TimeComparison(iActualDuration, iDuration, |
|
4158 KExpectedDeviation)) |
|
4159 { |
|
4160 StopTest(); // success |
|
4161 break; |
|
4162 } |
|
4163 else |
|
4164 { |
|
4165 STOP_TEST_GEN_ERROR; |
|
4166 break; |
|
4167 } |
|
4168 } |
|
4169 else |
|
4170 { |
|
4171 StopTest(); |
|
4172 break; |
|
4173 } |
|
4174 } |
|
4175 default: |
|
4176 STOP_TEST_GEN_ERROR; |
|
4177 break; |
|
4178 } |
|
4179 } |
|
4180 |
|
4181 //============================================================================================================ |
|
4182 |
|
4183 |
|
4184 CAsyncTestMmfAclntAudioPlayNegativeRepeat* CAsyncTestMmfAclntAudioPlayNegativeRepeat::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
4185 { |
|
4186 return new (ELeave) CAsyncTestMmfAclntAudioPlayNegativeRepeat( aTestName, aSectName, aKeyName); |
|
4187 } |
|
4188 |
|
4189 CAsyncTestMmfAclntAudioPlayNegativeRepeat::CAsyncTestMmfAclntAudioPlayNegativeRepeat( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
4190 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
4191 { |
|
4192 } |
|
4193 |
|
4194 void CAsyncTestMmfAclntAudioPlayNegativeRepeat::FsmL() |
|
4195 { |
|
4196 switch (iTestState) |
|
4197 { |
|
4198 case EStateOpened: |
|
4199 { |
|
4200 INFO_PRINTF1( _L("TestPlayerUtils : Audio Play/NegativeRepeat")); |
|
4201 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
4202 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
4203 iPlayer->Play(); |
|
4204 iPlayerState = EPlaying; |
|
4205 iStart.HomeTime(); |
|
4206 |
|
4207 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
4208 INFO_PRINTF2( _L("Repeats = %d\n"),KNegativeRepeat); |
|
4209 iPlayer->SetRepeats(KNegativeRepeat,iSilence); |
|
4210 |
|
4211 break; |
|
4212 } |
|
4213 case EStateStopTest: |
|
4214 { |
|
4215 if(iDuration) |
|
4216 { |
|
4217 iStop.HomeTime(); |
|
4218 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
4219 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
4220 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
4221 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration); |
|
4222 if(TimeComparison(iActualDuration, iDuration, |
|
4223 KExpectedDeviation)) |
|
4224 { |
|
4225 StopTest(); // success |
|
4226 break; |
|
4227 } |
|
4228 else |
|
4229 { |
|
4230 STOP_TEST_GEN_ERROR; |
|
4231 break; |
|
4232 } |
|
4233 } |
|
4234 else |
|
4235 { |
|
4236 StopTest(); |
|
4237 break; |
|
4238 } |
|
4239 } |
|
4240 default: |
|
4241 STOP_TEST_GEN_ERROR; |
|
4242 break; |
|
4243 } |
|
4244 } |
|
4245 |
|
4246 //============================================================================================================ |
|
4247 |
|
4248 CAsyncTestMmfAclntRepeatMultipleFiles* CAsyncTestMmfAclntRepeatMultipleFiles::NewL( const TDesC& aTestName, const TDesC& aSectName) |
|
4249 { |
|
4250 return new (ELeave) CAsyncTestMmfAclntRepeatMultipleFiles( aTestName, aSectName); |
|
4251 } |
|
4252 |
|
4253 CAsyncTestMmfAclntRepeatMultipleFiles::CAsyncTestMmfAclntRepeatMultipleFiles( const TDesC& aTestName, const TDesC& aSectName) |
|
4254 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, KNullDesC), iCount(0) |
|
4255 { |
|
4256 } |
|
4257 void CAsyncTestMmfAclntRepeatMultipleFiles::KickoffTestL() |
|
4258 { |
|
4259 INFO_PRINTF1( _L("TestPlayerUtils : Audio Player Util")); |
|
4260 TInt repeatCount; |
|
4261 |
|
4262 if(!GetIntFromConfig(_L("SectionRepeatCount"), _L("numOfRepeat"), repeatCount)) |
|
4263 { |
|
4264 ERR_PRINTF1(_L("GetIntFromConfig Failed")); |
|
4265 StopTest(KErrGeneral, EInconclusive); |
|
4266 return; |
|
4267 } |
|
4268 iTrigger = CFsmTrigger::NewL(*this); |
|
4269 iPlayer = CMdaAudioPlayerUtility::NewL(*this); |
|
4270 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4271 iTrigger->StartTimer(500000); |
|
4272 } |
|
4273 void CAsyncTestMmfAclntRepeatMultipleFiles::FsmL() |
|
4274 { |
|
4275 switch (iTestState) |
|
4276 { |
|
4277 case EStateOpen: |
|
4278 { |
|
4279 INFO_PRINTF1( _L("TestPlayerUtils :Audio Repeat/Play for multiple files")); |
|
4280 TPtrC fileName; |
|
4281 iFileName = KTestParameters[iCount].iFilename; |
|
4282 if(!GetStringFromConfig(iSectName, iFileName, fileName)) |
|
4283 { |
|
4284 //return EInconclusive; |
|
4285 ERR_PRINTF1(_L("GetStringFromConfig Failed")); |
|
4286 StopTest(KErrGeneral, EInconclusive); |
|
4287 return; |
|
4288 } |
|
4289 |
|
4290 GetDriveName(iFileName); |
|
4291 iFileName.Append(fileName); |
|
4292 INFO_PRINTF2(_L("CMdaAudioPlayerUtility::NewFilePlayerL() - %S"), &iFileName); |
|
4293 iPlayer->OpenFileL(iFileName); |
|
4294 iPlayerState = EOpening; |
|
4295 break; |
|
4296 } |
|
4297 case EStateOpened: |
|
4298 { |
|
4299 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
4300 iPlayer->SetRepeats(KTestParameters[iCount].iRepeatCount, TTimeIntervalMicroSeconds(KTestParameters[iCount].iSilence)); |
|
4301 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4302 iTrigger->StartTimer(500000); |
|
4303 iTestState = EStatePlay; |
|
4304 break; |
|
4305 } |
|
4306 case EStatePlay: |
|
4307 { |
|
4308 if(iPlayerState == EOpened) |
|
4309 { |
|
4310 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
4311 iPlayer->Play(); |
|
4312 iPlayerState = EPlaying; |
|
4313 } |
|
4314 break; |
|
4315 } |
|
4316 case EStateStopTest: |
|
4317 { |
|
4318 if(iCount == KNoOfTestFiles-1) |
|
4319 { |
|
4320 StopTest(); // success |
|
4321 } |
|
4322 else |
|
4323 { |
|
4324 iCount++; |
|
4325 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4326 iTrigger->StartTimer(KOneSecond); // Call SetRepeat for this test case after two sec |
|
4327 iTestState = EStateOpen; |
|
4328 } |
|
4329 break; |
|
4330 } |
|
4331 default: |
|
4332 STOP_TEST_GEN_ERROR; |
|
4333 break; |
|
4334 } |
|
4335 } |
|
4336 |
|
4337 // PDEF131534 SPPR_PERF: Music player crashes when opening corrupted wav file. |
|
4338 // WAV file of 96000 Hz is not supported. |
|
4339 void CAsyncTestMmfAclntRepeatMultipleFiles::MapcInitComplete(TInt aError, |
|
4340 const TTimeIntervalMicroSeconds &aDuration) |
|
4341 { |
|
4342 iError = aError; |
|
4343 iClipDuration = aDuration; |
|
4344 if (aError != KErrNone) |
|
4345 { |
|
4346 TInt match = iFileName.Match(_L("*100khzSRate1KhzTone.wav")); |
|
4347 if (aError == KErrNotSupported && match != KErrNotFound) |
|
4348 { |
|
4349 INFO_PRINTF1( _L("WAV file of frequency more than 96 KHz is not supported.")); |
|
4350 INFO_PRINTF1( _L("*MapcInitComplete* Expected Error: KErrNotSupported(-5)")); |
|
4351 INFO_PRINTF2(_L("*MapcInitComplete* Actual Error: %d."), aError); |
|
4352 StopTest(aError, EPass); |
|
4353 } |
|
4354 else |
|
4355 { |
|
4356 ERR_PRINTF2(_L("*MapcInitComplete* Error: %d."), aError); |
|
4357 StopTest(aError, EFail); |
|
4358 } |
|
4359 } |
|
4360 else |
|
4361 { |
|
4362 INFO_PRINTF2(_L("*MapcInitComplete* Error: %d."), aError); |
|
4363 iTrigger->Cancel(); // ensure assert in StartTimer always succeeds |
|
4364 iTrigger->StartTimer(500000); |
|
4365 iTestState = EStateOpened; |
|
4366 iPlayerState = EOpened; |
|
4367 } |
|
4368 } |
|
4369 //============================================================================================================ |
|
4370 |
|
4371 |
|
4372 CAsyncTestMmfAclntAudioSetPlayWindowRepeatPlay* CAsyncTestMmfAclntAudioSetPlayWindowRepeatPlay::NewL( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
4373 { |
|
4374 return new (ELeave) CAsyncTestMmfAclntAudioSetPlayWindowRepeatPlay( aTestName, aSectName, aKeyName); |
|
4375 } |
|
4376 |
|
4377 CAsyncTestMmfAclntAudioSetPlayWindowRepeatPlay::CAsyncTestMmfAclntAudioSetPlayWindowRepeatPlay( const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName) |
|
4378 : CAsyncTestMmfAclntAudioPlayerUtil( aTestName, aSectName, aKeyName) |
|
4379 { |
|
4380 } |
|
4381 |
|
4382 void CAsyncTestMmfAclntAudioSetPlayWindowRepeatPlay::FsmL() |
|
4383 { |
|
4384 switch (iTestState) |
|
4385 { |
|
4386 case EStateOpened: |
|
4387 { |
|
4388 INFO_PRINTF1( _L("TestPlayerUtils : SetPlayWindow Repeat Play")); |
|
4389 iDuration = I64INT(iPlayer->Duration().Int64()); |
|
4390 |
|
4391 TInt64 temp1, temp2; |
|
4392 temp1 = iPlayer->Duration().Int64()/2; |
|
4393 temp2 = iPlayer->Duration().Int64(); |
|
4394 iWindowDuration = (I64INT(temp2) - I64INT(temp1)); |
|
4395 |
|
4396 TTimeIntervalMicroSeconds startTime(temp1); |
|
4397 TTimeIntervalMicroSeconds endTime(temp2); |
|
4398 |
|
4399 INFO_PRINTF4(_L("StartTime = %d EndTime = %d WindowDuration = %d"), |
|
4400 I64INT(startTime.Int64()), I64INT(endTime.Int64()), iWindowDuration); |
|
4401 |
|
4402 TInt windowSet = iPlayer->SetPlayWindow(startTime,endTime); |
|
4403 if (windowSet != KErrNone) |
|
4404 { |
|
4405 ERR_PRINTF2( _L("Unexpected error returned from SetPlayWindow - %d"),windowSet); |
|
4406 StopTest(windowSet, EFail); |
|
4407 break; |
|
4408 } |
|
4409 |
|
4410 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
4411 INFO_PRINTF2( _L("Repeats = %d\n"),iNumOfRepeatsSet); |
|
4412 iPlayer->SetRepeats(iNumOfRepeatsSet,iSilence); |
|
4413 |
|
4414 INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility")); |
|
4415 |
|
4416 if(iPlayerState == EOpened) |
|
4417 { |
|
4418 iPlayer->Play(); |
|
4419 iPlayerState = EPlaying; |
|
4420 iStart.HomeTime(); |
|
4421 } |
|
4422 break; |
|
4423 } |
|
4424 case EStateStopTest: |
|
4425 { |
|
4426 if(iDuration) |
|
4427 { |
|
4428 iStop.HomeTime(); |
|
4429 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
4430 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
4431 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
4432 INFO_PRINTF2( _L("Window Duration = %d "),iWindowDuration); |
|
4433 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
4434 if(TimeComparison(iActualDuration, iWindowDuration*(iNumOfRepeatsSet+1), |
|
4435 KExpectedDeviation)) |
|
4436 { |
|
4437 StopTest(); // success |
|
4438 } |
|
4439 else |
|
4440 { |
|
4441 STOP_TEST_GEN_ERROR; |
|
4442 } |
|
4443 #else |
|
4444 if(TimeComparison(iActualDuration, iWindowDuration*(iNumOfRepeatsSet+1), |
|
4445 KExpectedDeviation*iNumOfRepeatsSet)) |
|
4446 { |
|
4447 StopTest(); // success |
|
4448 } |
|
4449 else |
|
4450 { |
|
4451 STOP_TEST_GEN_ERROR; |
|
4452 } |
|
4453 #endif |
|
4454 break; |
|
4455 } |
|
4456 else |
|
4457 { |
|
4458 StopTest(); |
|
4459 break; |
|
4460 } |
|
4461 } |
|
4462 default: |
|
4463 STOP_TEST_GEN_ERROR; |
|
4464 break; |
|
4465 } |
|
4466 } |