|
1 // Copyright (c) 2005-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 // CPP file: Audio Resource Notification tests for Audio Player. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file TestPlayerUtilsARN.cpp |
|
20 */ |
|
21 |
|
22 #include "TestAudioClientUtilitiesARN.h" |
|
23 |
|
24 //------------------------------------------------------------------------------ |
|
25 //********************PREQ 797 - Audio Resource Notification******************** |
|
26 //------------------------------------------------------------------------------ |
|
27 |
|
28 // |
|
29 //CTestMdaAudioPlayerCallbackSupport |
|
30 // |
|
31 |
|
32 /** |
|
33 * NewL |
|
34 */ |
|
35 CTestMdaAudioPlayerCallbackSupport* CTestMdaAudioPlayerCallbackSupport::NewL(MTestAudioPlayerCallback& aCallback) |
|
36 { |
|
37 return new(ELeave) CTestMdaAudioPlayerCallbackSupport(aCallback); |
|
38 } |
|
39 |
|
40 /** |
|
41 * MapcInitComplete |
|
42 */ |
|
43 void CTestMdaAudioPlayerCallbackSupport::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) |
|
44 { |
|
45 iCallback.MapcInitCompleteTest(aError, aDuration, *this); |
|
46 } |
|
47 |
|
48 /** |
|
49 * MapcPlayComplete |
|
50 */ |
|
51 void CTestMdaAudioPlayerCallbackSupport::MapcPlayComplete(TInt aError) |
|
52 { |
|
53 iCallback.MapcPlayCompleteTest(aError, *this); |
|
54 } |
|
55 |
|
56 /** |
|
57 * MarncResourceAvailable |
|
58 */ |
|
59 void CTestMdaAudioPlayerCallbackSupport::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData) |
|
60 { |
|
61 iCallback.MarncResourceAvailableTest(aNotificationEventId, aNotificationData, *this); |
|
62 } |
|
63 |
|
64 /** |
|
65 * Constructor |
|
66 */ |
|
67 CTestMdaAudioPlayerCallbackSupport::CTestMdaAudioPlayerCallbackSupport(MTestAudioPlayerCallback& aCallback):iCallback(aCallback) |
|
68 { |
|
69 |
|
70 } |
|
71 |
|
72 // |
|
73 //CTestMmfAclntAudioPlayerARN |
|
74 // |
|
75 |
|
76 /** |
|
77 * Constructor |
|
78 */ |
|
79 CTestMmfAclntAudioPlayerARN::CTestMmfAclntAudioPlayerARN(const TDesC& aTestName, const TDesC& aSectName) |
|
80 { |
|
81 // store the name of this test case |
|
82 iTestStepName=aTestName; |
|
83 iHeapSize = 3600000; |
|
84 iSectName = aSectName; |
|
85 } |
|
86 |
|
87 |
|
88 /** |
|
89 * MapcInitCompleteTest |
|
90 */ |
|
91 void CTestMmfAclntAudioPlayerARN::MapcInitCompleteTest(TInt aError, const TTimeIntervalMicroSeconds& aDuration, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport) |
|
92 { |
|
93 iDuration = aDuration; |
|
94 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1) |
|
95 { |
|
96 INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError); |
|
97 TRAP(iError, FsmL(EMapcInitComplete1, aError)); |
|
98 } |
|
99 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2) |
|
100 { |
|
101 INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError); |
|
102 TRAP(iError, FsmL(EMapcInitComplete2, aError)); |
|
103 } |
|
104 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3) |
|
105 { |
|
106 INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError); |
|
107 TRAP(iError, FsmL(EMapcInitComplete3, aError)); |
|
108 } |
|
109 } |
|
110 |
|
111 |
|
112 /** |
|
113 * MapcPlayCompleteTest |
|
114 */ |
|
115 void CTestMmfAclntAudioPlayerARN::MapcPlayCompleteTest(TInt aError, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport) |
|
116 { |
|
117 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1) |
|
118 { |
|
119 INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError); |
|
120 TRAP(iError, FsmL(EMapcPlayComplete1, aError)); |
|
121 } |
|
122 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2) |
|
123 { |
|
124 INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError); |
|
125 TRAP(iError, FsmL(EMapcPlayComplete2, aError)); |
|
126 } |
|
127 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3) |
|
128 { |
|
129 INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError); |
|
130 TRAP(iError, FsmL(EMapcPlayComplete3, aError)); |
|
131 } |
|
132 } |
|
133 |
|
134 |
|
135 /** |
|
136 * MarncResourceAvailableTest |
|
137 */ |
|
138 void CTestMmfAclntAudioPlayerARN::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport) |
|
139 { |
|
140 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) |
|
141 { |
|
142 INFO_PRINTF1(_L("iAudioPlayer::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable")); |
|
143 |
|
144 //Convert TDesc8 to TInt64 |
|
145 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf; |
|
146 timeIntvbuf.Copy(aNotificationData); |
|
147 TTimeIntervalMicroSeconds intPos = timeIntvbuf(); |
|
148 iPosition = intPos; |
|
149 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1) |
|
150 { |
|
151 INFO_PRINTF1(_L("iAudioPlayer1 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable..waiting for playcomplete")); |
|
152 TRAP(iError, FsmL(EMarncResourceAvailable1, KErrNone)); |
|
153 } |
|
154 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2) |
|
155 { |
|
156 INFO_PRINTF1(_L("iAudioPlayer2 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable")); |
|
157 TRAP(iError, FsmL(EMarncResourceAvailable2, KErrNone)); |
|
158 } |
|
159 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3) |
|
160 { |
|
161 INFO_PRINTF1(_L("iAudioPlayer3 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable")); |
|
162 TRAP(iError, FsmL(EMarncResourceAvailable3, KErrNone)); |
|
163 } |
|
164 } |
|
165 else |
|
166 { |
|
167 INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable")); |
|
168 } |
|
169 } |
|
170 |
|
171 /** |
|
172 * DoTestStepPreambleL |
|
173 */ |
|
174 TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepPreambleL() |
|
175 { |
|
176 TPtrC filename; |
|
177 TVerdict ret = EPass; |
|
178 |
|
179 // Call base DoTestStepPreambleL() |
|
180 ret = CTestMmfAclntStep::DoTestStepPreambleL(); |
|
181 if (ret == EFail) |
|
182 { |
|
183 return ret; |
|
184 } |
|
185 |
|
186 // Get 1st file name |
|
187 if(!GetStringFromConfig(iSectName, _L("playerAudioFile1"), filename)) |
|
188 { |
|
189 return EInconclusive; |
|
190 } |
|
191 GetDriveName(iFilename1); |
|
192 iFilename1.Append(filename); |
|
193 |
|
194 iEventChecker = CMultiEventChecker::NewL(); |
|
195 // Initialise 1st Audio Player |
|
196 INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility1 : EMdaPriorityNormal")); |
|
197 iMdaAudioPlayerCallbackSupport1 = CTestMdaAudioPlayerCallbackSupport::NewL(*this); |
|
198 iTestAudioPlayer1 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport1, EMdaPriorityNormal); |
|
199 |
|
200 // Get 2nd file name |
|
201 if(!GetStringFromConfig(iSectName, _L("playerAudioFile2"), filename)) |
|
202 { |
|
203 return EInconclusive; |
|
204 } |
|
205 GetDriveName(iFilename2); |
|
206 iFilename2.Append(filename); |
|
207 |
|
208 // Initialise 2nd Audio Player |
|
209 INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility2 : EMdaPriorityMax")); |
|
210 iMdaAudioPlayerCallbackSupport2 = CTestMdaAudioPlayerCallbackSupport::NewL(*this); |
|
211 iTestAudioPlayer2 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport2, EMdaPriorityMax); |
|
212 |
|
213 // Get 3rd file name |
|
214 if(!GetStringFromConfig(iSectName, _L("playerAudioFile3"), filename)) |
|
215 { |
|
216 return EInconclusive; |
|
217 } |
|
218 GetDriveName(iFilename3); |
|
219 iFilename3.Append(filename); |
|
220 |
|
221 // Initialise 3rd Audio Player |
|
222 INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility3 : EMdaPriorityMin")); |
|
223 iMdaAudioPlayerCallbackSupport3 = CTestMdaAudioPlayerCallbackSupport::NewL(*this); |
|
224 iTestAudioPlayer3 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport3, EMdaPriorityMin); |
|
225 |
|
226 // Initialise the CCallBackTimer. |
|
227 iCallBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler)); |
|
228 |
|
229 return ret; |
|
230 } |
|
231 |
|
232 /** |
|
233 * DoTestStepPostambleL |
|
234 */ |
|
235 TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepPostambleL() |
|
236 { |
|
237 // Delete all the iTestAudioPlayer utilities. |
|
238 iTestAudioPlayer1->Close(); |
|
239 delete iTestAudioPlayer1; |
|
240 iTestAudioPlayer1=NULL; |
|
241 iTestAudioPlayer2->Close(); |
|
242 delete iTestAudioPlayer2; |
|
243 iTestAudioPlayer2=NULL; |
|
244 iTestAudioPlayer3->Close(); |
|
245 delete iTestAudioPlayer3; |
|
246 iTestAudioPlayer3=NULL; |
|
247 // Delete CTestMdaAudioPlayerCallbackSupport |
|
248 delete iMdaAudioPlayerCallbackSupport1; |
|
249 delete iMdaAudioPlayerCallbackSupport2; |
|
250 delete iMdaAudioPlayerCallbackSupport3; |
|
251 // Delete the CCallBackTimer. |
|
252 delete iCallBackTimer; |
|
253 iCallBackTimer=NULL; |
|
254 delete iEventChecker; |
|
255 // Base Postamble. |
|
256 return CTestMmfAclntStep::DoTestStepPostambleL(); |
|
257 } |
|
258 |
|
259 /** |
|
260 * DoTestStepL |
|
261 */ |
|
262 TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepL() |
|
263 { |
|
264 return( DoTestL() ); |
|
265 } |
|
266 |
|
267 /** |
|
268 * StateInit |
|
269 */ |
|
270 void CTestMmfAclntAudioPlayerARN::StateInit() |
|
271 { |
|
272 iExpectedEvent=EIdlePlayer; |
|
273 iExpectedError=KErrNone; |
|
274 iState=EStateBegin; |
|
275 } |
|
276 |
|
277 /** |
|
278 * StateChange |
|
279 */ |
|
280 void CTestMmfAclntAudioPlayerARN::StateChange(TMmfAudioPlayerState aState, TMmfAudioPlayerEvents aExpectedEvent, TInt aExpectedError) |
|
281 { |
|
282 iExpectedEvent=aExpectedEvent; |
|
283 iExpectedError=aExpectedError; |
|
284 iState=aState; |
|
285 } |
|
286 |
|
287 /** |
|
288 * FsmCheck |
|
289 */ |
|
290 TBool CTestMmfAclntAudioPlayerARN::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
291 { |
|
292 TBool retFsmCheck = EFalse; |
|
293 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow)) |
|
294 { |
|
295 INFO_PRINTF1(_L("Underflow !")); |
|
296 } |
|
297 else if (iExpectedEvent != aEventCode) |
|
298 { |
|
299 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
300 iTestStepResult = EFail; |
|
301 CActiveScheduler::Stop(); |
|
302 } |
|
303 else if (iExpectedError != aError) |
|
304 { |
|
305 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
306 iTestStepResult = EFail; |
|
307 CActiveScheduler::Stop(); |
|
308 } |
|
309 else |
|
310 { |
|
311 retFsmCheck = ETrue; |
|
312 } |
|
313 return retFsmCheck; |
|
314 } |
|
315 |
|
316 // |
|
317 //POSITIVE TESTS// |
|
318 // |
|
319 |
|
320 // |
|
321 //CTestMmfAclntARN8101 |
|
322 // |
|
323 |
|
324 /** |
|
325 * Constructor |
|
326 */ |
|
327 CTestMmfAclntARN8101::CTestMmfAclntARN8101(const TDesC& aTestName, const TDesC& aSectName) |
|
328 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
329 {} |
|
330 |
|
331 /** |
|
332 * NewL |
|
333 */ |
|
334 CTestMmfAclntARN8101* CTestMmfAclntARN8101::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
335 { |
|
336 CTestMmfAclntARN8101* self = new (ELeave) CTestMmfAclntARN8101(aTestName, aSectName); |
|
337 return self; |
|
338 } |
|
339 |
|
340 /** |
|
341 * DoTestL |
|
342 */ |
|
343 TVerdict CTestMmfAclntARN8101::DoTestL() |
|
344 { |
|
345 return( PerformTestL() ); |
|
346 } |
|
347 |
|
348 /** |
|
349 * FsmL |
|
350 */ |
|
351 void CTestMmfAclntARN8101::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
352 { |
|
353 if (FsmCheck(aEventCode, aError)) |
|
354 { |
|
355 TInt retErr = KErrNone; |
|
356 switch (iState) |
|
357 { |
|
358 case EStateBegin: |
|
359 // Open iTestAudioPlayer#1 |
|
360 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
361 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
362 // Set ExpectedEvent and change the State |
|
363 StateChange(EStateOpenPlayer2, EMapcInitComplete1); |
|
364 break; |
|
365 case EStateOpenPlayer2: |
|
366 // Register iTestAudioPlayer#1 for Notification |
|
367 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
368 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
369 if( retErr != KErrNone ) |
|
370 { |
|
371 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
372 iTestStepResult = EFail; |
|
373 CActiveScheduler::Stop(); |
|
374 break; |
|
375 } |
|
376 // Open iTestAudioPlayer#2 |
|
377 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
378 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
379 // Set ExpectedEvent and change the State |
|
380 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
381 break; |
|
382 case EStatePlaying2: |
|
383 // Play iTestAudioPlayer#2 |
|
384 iTestAudioPlayer2->Play(); |
|
385 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
386 // Set ExpectedEvent and change the State |
|
387 StateChange(EStateEndPlay2, EMapcPlayComplete2); |
|
388 break; |
|
389 case EStateEndPlay2: |
|
390 // Timer to check if Notification Event Occurs. |
|
391 iCallBackTimer->After(2000000); |
|
392 iTestStepResult = EPass; |
|
393 // Set ExpectedEvent and change the State |
|
394 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
395 break; |
|
396 case EStateNotifiedPlayer1: |
|
397 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
398 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
399 iTestStepResult = EFail; |
|
400 CActiveScheduler::Stop(); |
|
401 break; |
|
402 } |
|
403 } |
|
404 } |
|
405 |
|
406 /** |
|
407 * PerformTestL |
|
408 */ |
|
409 TVerdict CTestMmfAclntARN8101::PerformTestL() |
|
410 { |
|
411 INFO_PRINTF1(_L("Register for notification, but make no request to play audio")); |
|
412 iTestStepResult = EFail; |
|
413 |
|
414 // Initialise the state variables |
|
415 StateInit(); |
|
416 |
|
417 // Begin the process |
|
418 FsmL(EIdlePlayer, KErrNone); |
|
419 |
|
420 // Start the scheduler - Done only once ! |
|
421 CActiveScheduler::Start(); |
|
422 |
|
423 return iTestStepResult; |
|
424 } |
|
425 |
|
426 // |
|
427 //CTestMmfAclntARN8102 |
|
428 // |
|
429 |
|
430 /** |
|
431 * Constructor |
|
432 */ |
|
433 CTestMmfAclntARN8102::CTestMmfAclntARN8102(const TDesC& aTestName, const TDesC& aSectName) |
|
434 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
435 {} |
|
436 |
|
437 /** |
|
438 * NewL |
|
439 */ |
|
440 CTestMmfAclntARN8102* CTestMmfAclntARN8102::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
441 { |
|
442 CTestMmfAclntARN8102* self = new (ELeave) CTestMmfAclntARN8102(aTestName, aSectName); |
|
443 return self; |
|
444 } |
|
445 |
|
446 /** |
|
447 * DoTestL |
|
448 */ |
|
449 TVerdict CTestMmfAclntARN8102::DoTestL() |
|
450 { |
|
451 return( PerformTestL() ); |
|
452 } |
|
453 |
|
454 /** |
|
455 * FsmL |
|
456 */ |
|
457 void CTestMmfAclntARN8102::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
458 { |
|
459 if (FsmCheck(aEventCode, aError)) |
|
460 { |
|
461 TInt retErr = KErrNone; |
|
462 switch (iState) |
|
463 { |
|
464 case EStateBegin: |
|
465 // Open iTestAudioPlayer#1 |
|
466 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
467 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
468 // Set ExpectedEvent and change the State |
|
469 StateChange(EStateOpenPlayer2, EMapcInitComplete1); |
|
470 break; |
|
471 case EStateOpenPlayer2: |
|
472 // Register iTestAudioPlayer#1 for Notification |
|
473 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
474 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
475 if( retErr != KErrNone ) |
|
476 { |
|
477 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
478 iTestStepResult = EFail; |
|
479 CActiveScheduler::Stop(); |
|
480 break; |
|
481 } |
|
482 // Open iTestAudioPlayer#2 |
|
483 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
484 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
485 // Set ExpectedEvent and change the State |
|
486 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
487 break; |
|
488 case EStatePlaying2: |
|
489 // Play iTestAudioPlayer#2 |
|
490 iTestAudioPlayer2->Play(); |
|
491 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
492 // Play iTestAudioPlayer#1 |
|
493 iTestAudioPlayer1->Play(); |
|
494 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
495 // Set ExpectedEvent and change the State |
|
496 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
497 break; |
|
498 case EStateErrInUsePlayer1: |
|
499 // Close iTestAudioPlayer#2 |
|
500 WaitWithTimeout(iRequestStatus,1000000); |
|
501 iTestAudioPlayer2->Stop(); |
|
502 INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()")); |
|
503 iTestAudioPlayer2->Close(); |
|
504 INFO_PRINTF1(_L("iTestAudioPlayer2->Close()")); |
|
505 // Timer to check if Notification Event Occurs. |
|
506 iCallBackTimer->After(2000000); |
|
507 // Set ExpectedEvent and change the State |
|
508 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
509 break; |
|
510 case EStateNotifiedPlayer1: |
|
511 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
512 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
513 iTestStepResult = EPass; |
|
514 CActiveScheduler::Stop(); |
|
515 break; |
|
516 } |
|
517 } |
|
518 } |
|
519 |
|
520 /** |
|
521 * PerformTestL |
|
522 */ |
|
523 TVerdict CTestMmfAclntARN8102::PerformTestL() |
|
524 { |
|
525 INFO_PRINTF1(_L("Register (b4 play, after Open) and Receive Notification of a Resource Available Event.")); |
|
526 INFO_PRINTF1(_L("(when audio resource is currently unavailable and then available)")); |
|
527 iTestStepResult = EFail; |
|
528 |
|
529 // Initialise the state variables |
|
530 StateInit(); |
|
531 |
|
532 // Begin the process |
|
533 FsmL(EIdlePlayer, KErrNone); |
|
534 |
|
535 // Start the scheduler - Done only once ! |
|
536 CActiveScheduler::Start(); |
|
537 |
|
538 return iTestStepResult; |
|
539 } |
|
540 |
|
541 // |
|
542 //CTestMmfAclntARN8103 |
|
543 // |
|
544 |
|
545 /** |
|
546 * Constructor |
|
547 */ |
|
548 CTestMmfAclntARN8103::CTestMmfAclntARN8103(const TDesC& aTestName, const TDesC& aSectName) |
|
549 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
550 {} |
|
551 |
|
552 /** |
|
553 * NewL |
|
554 */ |
|
555 CTestMmfAclntARN8103* CTestMmfAclntARN8103::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
556 { |
|
557 CTestMmfAclntARN8103* self = new (ELeave) CTestMmfAclntARN8103(aTestName, aSectName); |
|
558 return self; |
|
559 } |
|
560 |
|
561 /** |
|
562 * DoTestL |
|
563 */ |
|
564 TVerdict CTestMmfAclntARN8103::DoTestL() |
|
565 { |
|
566 return( PerformTestL() ); |
|
567 } |
|
568 |
|
569 /** |
|
570 * FsmCheck |
|
571 */ |
|
572 TBool CTestMmfAclntARN8103::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
573 { |
|
574 TBool retFsmCheck = EFalse; |
|
575 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow)) |
|
576 { |
|
577 INFO_PRINTF1(_L("Underflow !")); |
|
578 } |
|
579 else if (iExpectedEvent != aEventCode) |
|
580 { |
|
581 if ((aEventCode == EMapcPlayComplete2)) |
|
582 { |
|
583 retFsmCheck = ETrue; |
|
584 if (iEventOccured == EMarncResourceAvailable1) |
|
585 { |
|
586 return retFsmCheck; |
|
587 } |
|
588 else |
|
589 { |
|
590 iEventOccured = EMapcPlayComplete2; |
|
591 } |
|
592 } |
|
593 else if (aEventCode == EMarncResourceAvailable1) |
|
594 { |
|
595 retFsmCheck = ETrue; |
|
596 if (iEventOccured == EMapcPlayComplete2) |
|
597 { |
|
598 return retFsmCheck; |
|
599 } |
|
600 else |
|
601 { |
|
602 iEventOccured = EMarncResourceAvailable1; |
|
603 } |
|
604 } |
|
605 else |
|
606 { |
|
607 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
608 iTestStepResult = EFail; |
|
609 CActiveScheduler::Stop(); |
|
610 } |
|
611 } |
|
612 else if (iExpectedError != aError) |
|
613 { |
|
614 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
615 iTestStepResult = EFail; |
|
616 CActiveScheduler::Stop(); |
|
617 } |
|
618 else |
|
619 { |
|
620 retFsmCheck = ETrue; |
|
621 } |
|
622 return retFsmCheck; |
|
623 } |
|
624 |
|
625 /** |
|
626 * FsmL |
|
627 */ |
|
628 void CTestMmfAclntARN8103::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
629 { |
|
630 if (FsmCheck(aEventCode, aError)) |
|
631 { |
|
632 TInt retErr = KErrNone; |
|
633 switch (iState) |
|
634 { |
|
635 case EStateBegin: |
|
636 // Open iTestAudioPlayer#1 |
|
637 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
638 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
639 // Set ExpectedEvent and change the State |
|
640 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
641 break; |
|
642 case EStatePlaying1: |
|
643 // Play iTestAudioPlayer#1 |
|
644 iTestAudioPlayer1->Play(); |
|
645 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
646 // Register iTestAudioPlayer#1 for Notification |
|
647 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
648 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
649 if( retErr != KErrNone ) |
|
650 { |
|
651 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
652 iTestStepResult = EFail; |
|
653 CActiveScheduler::Stop(); |
|
654 break; |
|
655 } |
|
656 // Open iTestAudioPlayer#2 |
|
657 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
658 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
659 // Set ExpectedEvent and change the State |
|
660 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
661 break; |
|
662 case EStatePlaying2: |
|
663 // Play iTestAudioPlayer#2 |
|
664 iTestAudioPlayer2->Play(); |
|
665 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
666 // Set ExpectedEvent and change the State |
|
667 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
668 break; |
|
669 case EStateErrInUsePlayer1: |
|
670 // Set ExpectedEvent and change the State |
|
671 StateChange(EStateEndPlay2, EMapcPlayComplete2); |
|
672 break; |
|
673 case EStateEndPlay2: |
|
674 // Timer to check if Notification Event Occurs. |
|
675 iCallBackTimer->After(2000000); |
|
676 // Set ExpectedEvent and change the State |
|
677 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
678 break; |
|
679 case EStateNotifiedPlayer1: |
|
680 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
681 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
682 iTestStepResult = EPass; |
|
683 CActiveScheduler::Stop(); |
|
684 break; |
|
685 } |
|
686 } |
|
687 } |
|
688 |
|
689 /** |
|
690 * PerformTestL |
|
691 */ |
|
692 TVerdict CTestMmfAclntARN8103::PerformTestL() |
|
693 { |
|
694 INFO_PRINTF1(_L("Register (at the time of Play) and Receive Notification of a Resource Available Event.")); |
|
695 INFO_PRINTF1(_L("(when audio resource is currently available and subsequently unavailable, and then available)")); |
|
696 iTestStepResult = EFail; |
|
697 |
|
698 // Initialise the state variables |
|
699 StateInit(); |
|
700 |
|
701 // Begin the process |
|
702 FsmL(EIdlePlayer, KErrNone); |
|
703 |
|
704 // Start the scheduler - Done only once ! |
|
705 CActiveScheduler::Start(); |
|
706 |
|
707 return iTestStepResult; |
|
708 } |
|
709 |
|
710 // |
|
711 //CTestMmfAclntARN8104 |
|
712 // |
|
713 |
|
714 /** |
|
715 * Constructor |
|
716 */ |
|
717 CTestMmfAclntARN8104::CTestMmfAclntARN8104(const TDesC& aTestName, const TDesC& aSectName) |
|
718 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
719 {} |
|
720 |
|
721 /** |
|
722 * NewL |
|
723 */ |
|
724 CTestMmfAclntARN8104* CTestMmfAclntARN8104::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
725 { |
|
726 CTestMmfAclntARN8104* self = new (ELeave) CTestMmfAclntARN8104(aTestName, aSectName); |
|
727 return self; |
|
728 } |
|
729 |
|
730 /** |
|
731 * DoTestL |
|
732 */ |
|
733 TVerdict CTestMmfAclntARN8104::DoTestL() |
|
734 { |
|
735 return( PerformTestL() ); |
|
736 } |
|
737 |
|
738 /** |
|
739 * FsmL |
|
740 */ |
|
741 void CTestMmfAclntARN8104::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
742 { |
|
743 if (FsmCheck(aEventCode, aError)) |
|
744 { |
|
745 TInt canErr = KErrNone; |
|
746 switch (iState) |
|
747 { |
|
748 case EStateBegin: |
|
749 // Open iTestAudioPlayer#1 |
|
750 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
751 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
752 // Set ExpectedEvent and change the State |
|
753 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
754 break; |
|
755 case EStatePlaying1: |
|
756 // Play iTestAudioPlayer#1 |
|
757 iTestAudioPlayer1->Play(); |
|
758 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
759 // Open iTestAudioPlayer#2 |
|
760 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
761 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
762 // Set ExpectedEvent and change the State |
|
763 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
764 break; |
|
765 case EStatePlaying2: |
|
766 // Play iTestAudioPlayer#2 |
|
767 iTestAudioPlayer2->Play(); |
|
768 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
769 // Set ExpectedEvent and change the State |
|
770 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
771 break; |
|
772 case EStateErrInUsePlayer1: |
|
773 // Cancel notification for iTestAudioPlayer#1 |
|
774 canErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable); |
|
775 INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification()")); |
|
776 if( canErr != KErrNone ) |
|
777 { |
|
778 ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), canErr); |
|
779 iTestStepResult = EFail; |
|
780 CActiveScheduler::Stop(); |
|
781 break; |
|
782 } |
|
783 // Close iTestAudioPlayer#2 |
|
784 WaitWithTimeout(iRequestStatus,1000000); |
|
785 iTestAudioPlayer2->Stop(); |
|
786 INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()")); |
|
787 iTestAudioPlayer2->Close(); |
|
788 INFO_PRINTF1(_L("iTestAudioPlayer2->Close()")); |
|
789 // Timer to check if Notification Event Occurs. |
|
790 iCallBackTimer->After(2000000); |
|
791 iTestStepResult = EPass; |
|
792 // Set ExpectedEvent and change the State |
|
793 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
794 break; |
|
795 case EStateNotifiedPlayer1: |
|
796 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
797 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
798 iTestStepResult = EFail; |
|
799 CActiveScheduler::Stop(); |
|
800 break; |
|
801 } |
|
802 } |
|
803 } |
|
804 |
|
805 /** |
|
806 * PerformTestL |
|
807 */ |
|
808 TVerdict CTestMmfAclntARN8104::PerformTestL() |
|
809 { |
|
810 INFO_PRINTF1(_L("Registration (b4 File Open) and Cancellation of the notification request")); |
|
811 iTestStepResult = EFail; |
|
812 |
|
813 // Initialise the state variables |
|
814 StateInit(); |
|
815 |
|
816 // Register iTestAudioPlayer#1 for Notification |
|
817 TInt retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
818 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
819 if( retErr != KErrNone ) |
|
820 { |
|
821 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
822 return EFail; |
|
823 } |
|
824 |
|
825 // Begin the process |
|
826 FsmL(EIdlePlayer, KErrNone); |
|
827 |
|
828 // Start the scheduler - Done only once ! |
|
829 CActiveScheduler::Start(); |
|
830 |
|
831 return iTestStepResult; |
|
832 } |
|
833 |
|
834 // |
|
835 //CTestMmfAclntARN8105 |
|
836 // |
|
837 |
|
838 /** |
|
839 * Constructor |
|
840 */ |
|
841 CTestMmfAclntARN8105::CTestMmfAclntARN8105(const TDesC& aTestName, const TDesC& aSectName) |
|
842 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
843 {} |
|
844 |
|
845 /** |
|
846 * NewL |
|
847 */ |
|
848 CTestMmfAclntARN8105* CTestMmfAclntARN8105::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
849 { |
|
850 CTestMmfAclntARN8105* self = new (ELeave) CTestMmfAclntARN8105(aTestName, aSectName); |
|
851 return self; |
|
852 } |
|
853 |
|
854 /** |
|
855 * DoTestL |
|
856 */ |
|
857 TVerdict CTestMmfAclntARN8105::DoTestL() |
|
858 { |
|
859 return( PerformTestL() ); |
|
860 } |
|
861 |
|
862 /** |
|
863 * FsmCheck |
|
864 */ |
|
865 TBool CTestMmfAclntARN8105::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
866 { |
|
867 TBool retFsmCheck = EFalse; |
|
868 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow)) |
|
869 { |
|
870 INFO_PRINTF1(_L("Underflow !")); |
|
871 } |
|
872 else if (iExpectedEvent != aEventCode) |
|
873 { |
|
874 if ((aEventCode == EMapcPlayComplete2)) |
|
875 { |
|
876 retFsmCheck = ETrue; |
|
877 if (iEventOccured == EMarncResourceAvailable1) |
|
878 { |
|
879 return retFsmCheck; |
|
880 } |
|
881 else |
|
882 { |
|
883 iEventOccured = EMapcPlayComplete2; |
|
884 } |
|
885 } |
|
886 else if (aEventCode == EMarncResourceAvailable1) |
|
887 { |
|
888 retFsmCheck = ETrue; |
|
889 if (iEventOccured == EMapcPlayComplete2) |
|
890 { |
|
891 return retFsmCheck; |
|
892 } |
|
893 else |
|
894 { |
|
895 iEventOccured = EMarncResourceAvailable1; |
|
896 } |
|
897 } |
|
898 else |
|
899 { |
|
900 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
901 iTestStepResult = EFail; |
|
902 CActiveScheduler::Stop(); |
|
903 } |
|
904 } |
|
905 else if (iExpectedError != aError) |
|
906 { |
|
907 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
908 iTestStepResult = EFail; |
|
909 CActiveScheduler::Stop(); |
|
910 } |
|
911 else |
|
912 { |
|
913 retFsmCheck = ETrue; |
|
914 } |
|
915 return retFsmCheck; |
|
916 } |
|
917 |
|
918 /** |
|
919 * FsmL |
|
920 */ |
|
921 void CTestMmfAclntARN8105::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
922 { |
|
923 if (FsmCheck(aEventCode, aError)) |
|
924 { |
|
925 TInt retErr = KErrNone; |
|
926 switch (iState) |
|
927 { |
|
928 case EStateBegin: |
|
929 // Open iTestAudioPlayer#1 |
|
930 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
931 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
932 // Set ExpectedEvent and change the State |
|
933 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
934 break; |
|
935 case EStatePlaying1: |
|
936 // Play iTestAudioPlayer#1 |
|
937 iTestAudioPlayer1->Play(); |
|
938 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
939 // Open iTestAudioPlayer#2 |
|
940 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
941 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
942 // Set ExpectedEvent and change the State |
|
943 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
944 break; |
|
945 case EStatePlaying2: |
|
946 // Play iTestAudioPlayer#2 |
|
947 iTestAudioPlayer2->Play(); |
|
948 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
949 // Set ExpectedEvent and change the State |
|
950 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
951 break; |
|
952 case EStateErrInUsePlayer1: |
|
953 //Get Position of iTestAudioPlayer#1 |
|
954 retErr = iTestAudioPlayer1->GetPosition(iPositionStop); |
|
955 INFO_PRINTF1(_L("iTestAudioPlayer1->GetPosition()")); |
|
956 if( retErr != KErrNone ) |
|
957 { |
|
958 ERR_PRINTF2(_L("iTestAudioPlayer1->GetPosition - Failed with Error : %d"), retErr); |
|
959 iTestStepResult = EFail; |
|
960 CActiveScheduler::Stop(); |
|
961 break; |
|
962 } |
|
963 INFO_PRINTF2(_L("value of iPositionStop = %d"),iPositionStop.Int64());//Statement Changed under DEF105143 |
|
964 |
|
965 // Register iTestAudioPlayer#1 for Notification |
|
966 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
967 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
968 if( retErr != KErrNone ) |
|
969 { |
|
970 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
971 iTestStepResult = EFail; |
|
972 CActiveScheduler::Stop(); |
|
973 break; |
|
974 } |
|
975 // Set ExpectedEvent and change the State |
|
976 StateChange(EStateEndPlay2, EMapcPlayComplete2); |
|
977 break; |
|
978 case EStateEndPlay2: |
|
979 // Timer to check if Notification Event Occurs. |
|
980 iCallBackTimer->After(2000000); |
|
981 // Set ExpectedEvent and change the State |
|
982 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
983 break; |
|
984 case EStateNotifiedPlayer1: |
|
985 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
986 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
987 iPositionResume = iPosition; |
|
988 CActiveScheduler::Stop(); |
|
989 // Check for the Position. |
|
990 if (iPositionResume >= iPositionStop) |
|
991 { |
|
992 INFO_PRINTF3(_L("iTestAudioPlayer1->Audio Resource iPositionResume >= iPositionStop, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64()); |
|
993 iTestStepResult=EPass; |
|
994 } |
|
995 else |
|
996 { |
|
997 ERR_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position is NOT iPositionResume >= iPositionStop, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64()); |
|
998 iTestStepResult=EFail; |
|
999 } |
|
1000 break; |
|
1001 } |
|
1002 } |
|
1003 } |
|
1004 |
|
1005 /** |
|
1006 * PerformTestL |
|
1007 */ |
|
1008 TVerdict CTestMmfAclntARN8105::PerformTestL() |
|
1009 { |
|
1010 INFO_PRINTF1(_L("Register (after Play Error) and Get the actual position from where the paused audio can be resumed. Low priority client is played first.")); |
|
1011 iTestStepResult = EFail; |
|
1012 |
|
1013 // Initialise the state variables |
|
1014 StateInit(); |
|
1015 |
|
1016 // Begin the process |
|
1017 FsmL(EIdlePlayer, KErrNone); |
|
1018 |
|
1019 // Start the scheduler - Done only once ! |
|
1020 CActiveScheduler::Start(); |
|
1021 |
|
1022 return iTestStepResult; |
|
1023 } |
|
1024 |
|
1025 // |
|
1026 //CTestMmfAclntARN8106 |
|
1027 // |
|
1028 |
|
1029 /** |
|
1030 * Constructor |
|
1031 */ |
|
1032 CTestMmfAclntARN8106::CTestMmfAclntARN8106(const TDesC& aTestName, const TDesC& aSectName) |
|
1033 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
1034 {} |
|
1035 |
|
1036 /** |
|
1037 * NewL |
|
1038 */ |
|
1039 CTestMmfAclntARN8106* CTestMmfAclntARN8106::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1040 { |
|
1041 CTestMmfAclntARN8106* self = new (ELeave) CTestMmfAclntARN8106(aTestName, aSectName); |
|
1042 return self; |
|
1043 } |
|
1044 |
|
1045 /** |
|
1046 * DoTestL |
|
1047 */ |
|
1048 TVerdict CTestMmfAclntARN8106::DoTestL() |
|
1049 { |
|
1050 return( PerformTestL() ); |
|
1051 } |
|
1052 |
|
1053 /** |
|
1054 * FsmCheck |
|
1055 */ |
|
1056 TBool CTestMmfAclntARN8106::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1057 { |
|
1058 TBool retFsmCheck = EFalse; |
|
1059 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow)) |
|
1060 { |
|
1061 INFO_PRINTF1(_L("Underflow !")); |
|
1062 } |
|
1063 else if (iExpectedEvent != aEventCode) |
|
1064 { |
|
1065 if ((aEventCode == EMapcPlayComplete2)) |
|
1066 { |
|
1067 retFsmCheck = ETrue; |
|
1068 if (iEventOccured == EMarncResourceAvailable1) |
|
1069 { |
|
1070 return retFsmCheck; |
|
1071 } |
|
1072 else |
|
1073 { |
|
1074 iEventOccured = EMapcPlayComplete2; |
|
1075 } |
|
1076 } |
|
1077 else if (aEventCode == EMarncResourceAvailable1) |
|
1078 { |
|
1079 retFsmCheck = ETrue; |
|
1080 if (iEventOccured == EMapcPlayComplete2) |
|
1081 { |
|
1082 return retFsmCheck; |
|
1083 } |
|
1084 else |
|
1085 { |
|
1086 iEventOccured = EMarncResourceAvailable1; |
|
1087 } |
|
1088 } |
|
1089 else |
|
1090 { |
|
1091 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
1092 iTestStepResult = EFail; |
|
1093 CActiveScheduler::Stop(); |
|
1094 } |
|
1095 } |
|
1096 else if (iExpectedError != aError) |
|
1097 { |
|
1098 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
1099 iTestStepResult = EFail; |
|
1100 CActiveScheduler::Stop(); |
|
1101 } |
|
1102 else |
|
1103 { |
|
1104 retFsmCheck = ETrue; |
|
1105 } |
|
1106 return retFsmCheck; |
|
1107 } |
|
1108 |
|
1109 /** |
|
1110 * FsmL |
|
1111 */ |
|
1112 void CTestMmfAclntARN8106::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1113 { |
|
1114 if (FsmCheck(aEventCode, aError)) |
|
1115 { |
|
1116 TInt retErr = KErrNone; |
|
1117 switch (iState) |
|
1118 { |
|
1119 case EStateBegin: |
|
1120 // Open iTestAudioPlayer#2 |
|
1121 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
1122 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
1123 // Set ExpectedEvent and change the State |
|
1124 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
1125 break; |
|
1126 case EStatePlaying2: |
|
1127 // Play iTestAudioPlayer#2 |
|
1128 iTestAudioPlayer2->Play(); |
|
1129 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
1130 // Open iTestAudioPlayer#1 |
|
1131 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
1132 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
1133 // Set ExpectedEvent and change the State |
|
1134 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
1135 break; |
|
1136 case EStatePlaying1: |
|
1137 // Play iTestAudioPlayer#1 |
|
1138 iTestAudioPlayer1->Play(); |
|
1139 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
1140 // Set ExpectedEvent and change the State |
|
1141 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
1142 break; |
|
1143 case EStateErrInUsePlayer1: |
|
1144 //Get Position of iTestAudioPlayer#1 |
|
1145 retErr = iTestAudioPlayer1->GetPosition(iPositionStop); |
|
1146 INFO_PRINTF1(_L("iTestAudioPlayer1->GetPosition()")); |
|
1147 if( retErr != KErrNone ) |
|
1148 { |
|
1149 ERR_PRINTF2(_L("iTestAudioPlayer1->GetPosition - Failed with Error : %d"), retErr); |
|
1150 iTestStepResult = EFail; |
|
1151 CActiveScheduler::Stop(); |
|
1152 break; |
|
1153 } |
|
1154 // Register iTestAudioPlayer#1 for Notification |
|
1155 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1156 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
1157 if( retErr != KErrNone ) |
|
1158 { |
|
1159 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
1160 iTestStepResult = EFail; |
|
1161 CActiveScheduler::Stop(); |
|
1162 break; |
|
1163 } |
|
1164 // Set ExpectedEvent and change the State |
|
1165 StateChange(EStateEndPlay2, EMapcPlayComplete2); |
|
1166 break; |
|
1167 case EStateEndPlay2: |
|
1168 // Timer to check if Notification Event Occurs. |
|
1169 iCallBackTimer->After(2000000); |
|
1170 // Set ExpectedEvent and change the State |
|
1171 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
1172 break; |
|
1173 case EStateNotifiedPlayer1: |
|
1174 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1175 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
1176 iPositionResume = iPosition; |
|
1177 CActiveScheduler::Stop(); |
|
1178 // Check for the Position |
|
1179 if (iPositionResume >= iPositionStop) |
|
1180 { |
|
1181 INFO_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position Matches, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64()); |
|
1182 iTestStepResult=EPass; |
|
1183 } |
|
1184 else |
|
1185 { |
|
1186 ERR_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position does NOT Match, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64()); |
|
1187 iTestStepResult=EFail; |
|
1188 } |
|
1189 break; |
|
1190 } |
|
1191 } |
|
1192 } |
|
1193 |
|
1194 /** |
|
1195 * PerformTestL |
|
1196 */ |
|
1197 TVerdict CTestMmfAclntARN8106::PerformTestL() |
|
1198 { |
|
1199 INFO_PRINTF1(_L("Register (after Play Error) and Get the actual position from where the paused audio can be resumed. High priority client is played first.")); |
|
1200 iTestStepResult = EFail; |
|
1201 |
|
1202 // Initialise the state variables |
|
1203 StateInit(); |
|
1204 |
|
1205 // Begin the process |
|
1206 FsmL(EIdlePlayer, KErrNone); |
|
1207 |
|
1208 // Start the scheduler - Done only once ! |
|
1209 CActiveScheduler::Start(); |
|
1210 |
|
1211 return iTestStepResult; |
|
1212 } |
|
1213 |
|
1214 // |
|
1215 //CTestMmfAclntARN8107 |
|
1216 // |
|
1217 |
|
1218 /** |
|
1219 * Constructor |
|
1220 */ |
|
1221 CTestMmfAclntARN8107::CTestMmfAclntARN8107(const TDesC& aTestName, const TDesC& aSectName) |
|
1222 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
1223 {} |
|
1224 |
|
1225 /** |
|
1226 * NewL |
|
1227 */ |
|
1228 CTestMmfAclntARN8107* CTestMmfAclntARN8107::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1229 { |
|
1230 CTestMmfAclntARN8107* self = new (ELeave) CTestMmfAclntARN8107(aTestName, aSectName); |
|
1231 return self; |
|
1232 } |
|
1233 |
|
1234 /** |
|
1235 * DoTestL |
|
1236 */ |
|
1237 TVerdict CTestMmfAclntARN8107::DoTestL() |
|
1238 { |
|
1239 return( PerformTestL() ); |
|
1240 } |
|
1241 |
|
1242 /** |
|
1243 * FsmCheck |
|
1244 */ |
|
1245 TBool CTestMmfAclntARN8107::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1246 { |
|
1247 TBool retFsmCheck = EFalse; |
|
1248 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow)) |
|
1249 { |
|
1250 INFO_PRINTF1(_L("Underflow !")); |
|
1251 } |
|
1252 else if (iExpectedEvent != aEventCode) |
|
1253 { |
|
1254 if ((aEventCode == EMapcPlayComplete2)) |
|
1255 { |
|
1256 retFsmCheck = ETrue; |
|
1257 if (iEventOccured == EMarncResourceAvailable1) |
|
1258 { |
|
1259 return retFsmCheck; |
|
1260 } |
|
1261 else |
|
1262 { |
|
1263 iEventOccured = EMapcPlayComplete2; |
|
1264 } |
|
1265 } |
|
1266 else if (aEventCode == EMarncResourceAvailable1) |
|
1267 { |
|
1268 retFsmCheck = ETrue; |
|
1269 if (iEventOccured == EMapcPlayComplete2) |
|
1270 { |
|
1271 return retFsmCheck; |
|
1272 } |
|
1273 else |
|
1274 { |
|
1275 iEventOccured = EMarncResourceAvailable1; |
|
1276 } |
|
1277 } |
|
1278 else |
|
1279 { |
|
1280 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
1281 iTestStepResult = EFail; |
|
1282 CActiveScheduler::Stop(); |
|
1283 } |
|
1284 } |
|
1285 else if (iExpectedError != aError) |
|
1286 { |
|
1287 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
1288 iTestStepResult = EFail; |
|
1289 CActiveScheduler::Stop(); |
|
1290 } |
|
1291 else |
|
1292 { |
|
1293 retFsmCheck = ETrue; |
|
1294 } |
|
1295 return retFsmCheck; |
|
1296 } |
|
1297 |
|
1298 /** |
|
1299 * FsmL |
|
1300 */ |
|
1301 void CTestMmfAclntARN8107::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1302 { |
|
1303 if (FsmCheck(aEventCode, aError)) |
|
1304 { |
|
1305 TInt retErr = KErrNone; |
|
1306 switch (iState) |
|
1307 { |
|
1308 case EStateBegin: |
|
1309 // Open iTestAudioPlayer#1 |
|
1310 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
1311 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
1312 // Set ExpectedEvent and change the State |
|
1313 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
1314 break; |
|
1315 case EStatePlaying1: |
|
1316 // Play iTestAudioPlayer#1 |
|
1317 iTestAudioPlayer1->Play(); |
|
1318 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
1319 // Register iTestAudioPlayer#1 for Notification |
|
1320 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1321 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
1322 if( retErr != KErrNone ) |
|
1323 { |
|
1324 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
1325 iTestStepResult = EFail; |
|
1326 CActiveScheduler::Stop(); |
|
1327 break; |
|
1328 } |
|
1329 // Open iTestAudioPlayer#2 |
|
1330 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
1331 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
1332 // Set ExpectedEvent and change the State |
|
1333 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
1334 break; |
|
1335 case EStatePlaying2: |
|
1336 // Play iTestAudioPlayer#2 |
|
1337 iTestAudioPlayer2->Play(); |
|
1338 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
1339 // Set ExpectedEvent and change the State |
|
1340 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
1341 break; |
|
1342 case EStateErrInUsePlayer1: |
|
1343 // Set ExpectedEvent and change the State |
|
1344 StateChange(EStateEndPlay2, EMapcPlayComplete2); |
|
1345 break; |
|
1346 case EStateEndPlay2: |
|
1347 // Timer to check if Notification Event Occurs. |
|
1348 iCallBackTimer->After(2000000); |
|
1349 // Set ExpectedEvent and change the State |
|
1350 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
1351 break; |
|
1352 case EStateNotifiedPlayer1: |
|
1353 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1354 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived => 1")); |
|
1355 retErr = iTestAudioPlayer1->WillResumePlay(); |
|
1356 INFO_PRINTF1(_L("iTestAudioPlayer1->WillResumePlay()")); |
|
1357 if( retErr != KErrNone ) |
|
1358 { |
|
1359 ERR_PRINTF2(_L("iTestAudioPlayer1->WillResumePlay() - Failed with Error : %d"), retErr); |
|
1360 iTestStepResult = EFail; |
|
1361 CActiveScheduler::Stop(); |
|
1362 break; |
|
1363 } |
|
1364 iTestAudioPlayer1->SetPosition(iPosition); |
|
1365 // Play iTestAudioPlayer#1 |
|
1366 iTestAudioPlayer1->Play(); |
|
1367 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
1368 // Open iTestAudioPlayer#2 |
|
1369 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
1370 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
1371 // Set ExpectedEvent and change the State |
|
1372 StateChange(EStatePlaying2A, EMapcInitComplete2); |
|
1373 break; |
|
1374 case EStatePlaying2A: |
|
1375 // Play iTestAudioPlayer#2 |
|
1376 iTestAudioPlayer2->Play(); |
|
1377 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
1378 // Set ExpectedEvent and change the State |
|
1379 StateChange(EStateErrInUsePlayer1A, EMapcPlayComplete1, KErrInUse); |
|
1380 break; |
|
1381 case EStateErrInUsePlayer1A: |
|
1382 // Set ExpectedEvent and change the State |
|
1383 StateChange(EStateEndPlay2A, EMapcPlayComplete2); |
|
1384 break; |
|
1385 case EStateEndPlay2A: |
|
1386 // Timer to check if Notification Event Occurs. |
|
1387 iCallBackTimer->After(2000000); |
|
1388 // Set ExpectedEvent and change the State |
|
1389 StateChange(EStateNotifiedPlayer1A, EMarncResourceAvailable1); |
|
1390 break; |
|
1391 case EStateNotifiedPlayer1A: |
|
1392 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1393 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived => 2")); |
|
1394 iTestStepResult = EPass; |
|
1395 CActiveScheduler::Stop(); |
|
1396 break; |
|
1397 } |
|
1398 } |
|
1399 } |
|
1400 |
|
1401 /** |
|
1402 * PerformTestL |
|
1403 */ |
|
1404 TVerdict CTestMmfAclntARN8107::PerformTestL() |
|
1405 { |
|
1406 INFO_PRINTF1(_L("Client does not need to Re-register for the same event when the event is received i.e API is not one shot.")); |
|
1407 iTestStepResult = EFail; |
|
1408 |
|
1409 // Initialise the state variables |
|
1410 StateInit(); |
|
1411 |
|
1412 // Begin the process |
|
1413 FsmL(EIdlePlayer, KErrNone); |
|
1414 |
|
1415 // Start the scheduler - Done only once ! |
|
1416 CActiveScheduler::Start(); |
|
1417 |
|
1418 return iTestStepResult; |
|
1419 } |
|
1420 |
|
1421 // |
|
1422 //CTestMmfAclntARN8108 |
|
1423 // |
|
1424 |
|
1425 /** |
|
1426 * NewL |
|
1427 */ |
|
1428 CTestMmfAclntARN8108* CTestMmfAclntARN8108::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1429 { |
|
1430 CTestMmfAclntARN8108* self = new (ELeave) CTestMmfAclntARN8108(aTestName, aSectName); |
|
1431 return self; |
|
1432 } |
|
1433 |
|
1434 /** |
|
1435 * Constructor |
|
1436 */ |
|
1437 CTestMmfAclntARN8108::CTestMmfAclntARN8108(const TDesC& aTestName, const TDesC& aSectName) |
|
1438 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
1439 {} |
|
1440 |
|
1441 |
|
1442 /** |
|
1443 * DoTestL |
|
1444 */ |
|
1445 TVerdict CTestMmfAclntARN8108::DoTestL() |
|
1446 { |
|
1447 return( PerformTestL() ); |
|
1448 } |
|
1449 |
|
1450 void CTestMmfAclntARN8108::DecideFsmState(TInt aClientNumber,CMultiEventChecker::TClientUtilityType aClientType, TInt aEventCode, TInt aError) |
|
1451 { |
|
1452 if (iEventChecker->CheckFsm(aClientNumber, aClientType, aEventCode, aError)) |
|
1453 { |
|
1454 iTestStepResult = (this->*(iStateHandlers[iEventChecker->NextState()]))(); |
|
1455 if(iTestStepResult != EPass) |
|
1456 { |
|
1457 iEventChecker->StopTest(); |
|
1458 } |
|
1459 } |
|
1460 } |
|
1461 |
|
1462 void CTestMmfAclntARN8108::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1463 { |
|
1464 if (aEventCode == EMapcInitComplete1 || aEventCode == EMapcPlayComplete1 || aEventCode == EMarncResourceAvailable1) |
|
1465 { //Client 1 |
|
1466 DecideFsmState(1,CMultiEventChecker::EAudioPlayer,aEventCode,aError); |
|
1467 } |
|
1468 if (aEventCode == EMapcInitComplete2 || aEventCode == EMapcPlayComplete2 || aEventCode == EMarncResourceAvailable2) |
|
1469 { //Client 2 |
|
1470 DecideFsmState(2,CMultiEventChecker::EAudioPlayer,aEventCode,aError); |
|
1471 } |
|
1472 if (aEventCode == EMapcInitComplete3 || aEventCode == EMapcPlayComplete3 || aEventCode == EMarncResourceAvailable3) |
|
1473 { //Client 3 |
|
1474 DecideFsmState(3,CMultiEventChecker::EAudioPlayer,aEventCode,aError); |
|
1475 } |
|
1476 } |
|
1477 |
|
1478 |
|
1479 void CTestMmfAclntARN8108::InitTest() |
|
1480 { |
|
1481 iStateHandlers[EStateOpenPlayer1]=&CTestMmfAclntARN8108::HandleStateOpenPlayer1; |
|
1482 iStateHandlers[EStateOpenPlayer3]=&CTestMmfAclntARN8108::HandleStateOpenPlayer3; |
|
1483 iStateHandlers[EStateOpenPlayer2]=&CTestMmfAclntARN8108::HandleStateOpenPlayer2; |
|
1484 iStateHandlers[EStateErrInUsePlayer1]=&CTestMmfAclntARN8108::HandleStateErrInUsePlayer1; |
|
1485 iStateHandlers[EStateErrInUsePlayer3]=&CTestMmfAclntARN8108::HandleStateErrInUsePlayer3; |
|
1486 iStateHandlers[EStateNotifiedPlayer1]=&CTestMmfAclntARN8108::HandleStateNotifiedPlayer1; |
|
1487 iStateHandlers[EStateNotifiedPlayer3]=&CTestMmfAclntARN8108::HandleStateNotifiedPlayer3; |
|
1488 iStateHandlers[EStatePlaying1]=&CTestMmfAclntARN8108::HandleStatePlaying1; |
|
1489 } |
|
1490 |
|
1491 void CTestMmfAclntARN8108::StartTestL() |
|
1492 { |
|
1493 // Open iTestAudioPlayer#1 |
|
1494 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
1495 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
1496 iEventChecker->SetExpectedEvent(1,EMapcInitComplete1,KErrNone); |
|
1497 iEventChecker->SetExpectedState(EStateOpenPlayer1); |
|
1498 } |
|
1499 |
|
1500 TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer1() |
|
1501 { |
|
1502 TInt retErr; |
|
1503 // Play iTestAudioPlayer#1 |
|
1504 iTestAudioPlayer1->Play(); |
|
1505 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
1506 // Register iTestAudioPlayer#1 for Notification |
|
1507 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1508 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
1509 if( retErr != KErrNone ) |
|
1510 { |
|
1511 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
1512 iTestStepResult = EFail; |
|
1513 CActiveScheduler::Stop(); |
|
1514 return EFail; |
|
1515 } |
|
1516 // Register iTestAudioPlayer#3 for Notification |
|
1517 retErr = iTestAudioPlayer3->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport3, KMMFEventCategoryAudioResourceAvailable); |
|
1518 INFO_PRINTF1(_L("iTestAudioPlayer3->RegisterAudioResourceNotification()")); |
|
1519 if( retErr != KErrNone ) |
|
1520 { |
|
1521 ERR_PRINTF2(_L("iTestAudioPlayer3->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
1522 iTestStepResult = EFail; |
|
1523 CActiveScheduler::Stop(); |
|
1524 return EFail; |
|
1525 } |
|
1526 // Open iTestAudioPlayer#3 |
|
1527 iTestAudioPlayer3->OpenFileL(iFilename3); |
|
1528 INFO_PRINTF1(_L("iTestAudioPlayer3->OpenFileL()")); |
|
1529 // Set ExpectedEvent and change the State |
|
1530 iEventChecker->SetExpectedEvent(3,EMapcInitComplete3,KErrNone); |
|
1531 iEventChecker->SetExpectedState(EStateOpenPlayer3); |
|
1532 return EPass; |
|
1533 } |
|
1534 |
|
1535 TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer3() |
|
1536 { |
|
1537 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
1538 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
1539 // Set ExpectedEvent and change the State |
|
1540 iEventChecker->SetExpectedEvent(2,EMapcInitComplete2,KErrNone); |
|
1541 iEventChecker->SetExpectedState(EStateOpenPlayer2); |
|
1542 return EPass; |
|
1543 } |
|
1544 |
|
1545 TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer2() |
|
1546 { |
|
1547 // Play iTestAudioPlayer#2 |
|
1548 iTestAudioPlayer2->Play(); |
|
1549 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
1550 // Set ExpectedEvent and change the State |
|
1551 iEventChecker->SetExpectedEvent(1,EMapcPlayComplete1,KErrInUse); |
|
1552 iEventChecker->SetExpectedState(EStateErrInUsePlayer1); |
|
1553 return EPass; |
|
1554 } |
|
1555 TVerdict CTestMmfAclntARN8108::HandleStateErrInUsePlayer1() |
|
1556 { |
|
1557 // Play iTestAudioPlayer#3 |
|
1558 iTestAudioPlayer3->Play(); |
|
1559 INFO_PRINTF1(_L("iTestAudioPlayer3->Play()")); |
|
1560 // Set ExpectedEvent and change the State |
|
1561 iEventChecker->SetExpectedEvent(3,EMapcPlayComplete3,KErrInUse); |
|
1562 iEventChecker->SetExpectedState(EStateErrInUsePlayer3); |
|
1563 return EPass; |
|
1564 } |
|
1565 |
|
1566 TVerdict CTestMmfAclntARN8108::HandleStateErrInUsePlayer3() |
|
1567 { |
|
1568 // Close iTestAudioPlayer#2 |
|
1569 WaitWithTimeout(iRequestStatus,1000000); |
|
1570 iTestAudioPlayer2->Stop(); |
|
1571 INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()")); |
|
1572 iTestAudioPlayer2->Close(); |
|
1573 INFO_PRINTF1(_L("iTestAudioPlayer2->Close()")); |
|
1574 // Timer to check if Notification Event Occurs. |
|
1575 iCallBackTimer->After(2000000); |
|
1576 // Set ExpectedEvent and change the State |
|
1577 iEventChecker->SetExpectedEvent(1,EMarncResourceAvailable1,KErrNone); |
|
1578 iEventChecker->SetExpectedState(EStateNotifiedPlayer1); |
|
1579 return EPass; |
|
1580 } |
|
1581 |
|
1582 TVerdict CTestMmfAclntARN8108::HandleStateNotifiedPlayer1() |
|
1583 { |
|
1584 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1585 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
1586 TInt retErr = iTestAudioPlayer1->WillResumePlay(); |
|
1587 INFO_PRINTF1(_L("iTestAudioPlayer1->WillResumePlay()")); |
|
1588 if( retErr != KErrNone ) |
|
1589 { |
|
1590 ERR_PRINTF2(_L("iTestAudioPlayer1->WillResumePlay() - Failed with Error : %d"), retErr); |
|
1591 iTestStepResult = EFail; |
|
1592 CActiveScheduler::Stop(); |
|
1593 return EFail; |
|
1594 } |
|
1595 iTestAudioPlayer1->SetPosition(iPosition); |
|
1596 // Play iTestAudioPlayer#1 |
|
1597 iTestAudioPlayer1->Play(); |
|
1598 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
1599 // Set ExpectedEvent and change the State |
|
1600 iEventChecker->RegisterClientEventToMonitor(1,EMapcPlayComplete1,KErrNone,EStateNotifiedPlayer3); |
|
1601 iEventChecker->RegisterClientEventToMonitor(3,EMarncResourceAvailable3,KErrNone,EStatePlaying1); |
|
1602 iEventChecker->EnableMultipleEventMonitor(); |
|
1603 return EPass; |
|
1604 } |
|
1605 |
|
1606 TVerdict CTestMmfAclntARN8108::HandleStateNotifiedPlayer3() |
|
1607 { |
|
1608 INFO_PRINTF1(_L("iTestAudioPlayer3->NotificationReceived")); |
|
1609 if(iEventChecker->IsMonitoringFinished()) |
|
1610 { |
|
1611 iTestStepResult = EPass; |
|
1612 iCallBackTimer->Cancel(); |
|
1613 iEventChecker->StopTest(); |
|
1614 } |
|
1615 else |
|
1616 { |
|
1617 iEventChecker->EnableMultipleEventMonitor(); |
|
1618 } |
|
1619 return EPass; |
|
1620 } |
|
1621 |
|
1622 TVerdict CTestMmfAclntARN8108::HandleStatePlaying1() |
|
1623 { |
|
1624 INFO_PRINTF1(_L("iTestAudioPlayer1->AudioPlayerComplete")); |
|
1625 iCallBackTimer->After(2000000); |
|
1626 if(iEventChecker->IsMonitoringFinished()) |
|
1627 { |
|
1628 iTestStepResult = EPass; |
|
1629 iCallBackTimer->Cancel(); |
|
1630 iEventChecker->StopTest(); |
|
1631 } |
|
1632 else |
|
1633 { |
|
1634 iEventChecker->EnableMultipleEventMonitor(); |
|
1635 } |
|
1636 return EPass; |
|
1637 } |
|
1638 |
|
1639 TVerdict CTestMmfAclntARN8108::PerformTestL() |
|
1640 { |
|
1641 INFO_PRINTF1(_L("Call WillResumePlay().")); |
|
1642 iTestStepResult = EFail; |
|
1643 |
|
1644 // Initialise the handler functions |
|
1645 InitTest(); |
|
1646 |
|
1647 // Initiate the process |
|
1648 StartTestL(); |
|
1649 |
|
1650 // Start the scheduler - Done only once ! |
|
1651 CActiveScheduler::Start(); |
|
1652 |
|
1653 return iTestStepResult; |
|
1654 } |
|
1655 |
|
1656 |
|
1657 // |
|
1658 //CTestMmfAclntARN8109 |
|
1659 // |
|
1660 |
|
1661 /** |
|
1662 * NewL |
|
1663 */ |
|
1664 CTestMmfAclntARN8109* CTestMmfAclntARN8109::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1665 { |
|
1666 CTestMmfAclntARN8109* self = new (ELeave) CTestMmfAclntARN8109(aTestName, aSectName); |
|
1667 return self; |
|
1668 } |
|
1669 |
|
1670 /** |
|
1671 * Constructor |
|
1672 */ |
|
1673 CTestMmfAclntARN8109::CTestMmfAclntARN8109(const TDesC& aTestName, const TDesC& aSectName) |
|
1674 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName), iPlayComplete2(EFalse), iResourceAvailable1(EFalse) |
|
1675 {} |
|
1676 |
|
1677 |
|
1678 /** |
|
1679 * DoTestL |
|
1680 */ |
|
1681 TVerdict CTestMmfAclntARN8109::DoTestL() |
|
1682 { |
|
1683 return( PerformTestL() ); |
|
1684 } |
|
1685 /** |
|
1686 * MapcPlayCompleteTest |
|
1687 */ |
|
1688 void CTestMmfAclntARN8109::MapcPlayCompleteTest(TInt aError, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport) |
|
1689 { |
|
1690 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1) |
|
1691 { |
|
1692 INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError); |
|
1693 TRAP(iError, FsmL(EMapcPlayComplete1, aError)); |
|
1694 } |
|
1695 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2) |
|
1696 { |
|
1697 INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError); |
|
1698 iPlayComplete2= ETrue; |
|
1699 TRAP(iError, FsmL(EMapcPlayComplete2, aError)); |
|
1700 } |
|
1701 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3) |
|
1702 { |
|
1703 INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError); |
|
1704 TRAP(iError, FsmL(EMapcPlayComplete3, aError)); |
|
1705 } |
|
1706 } |
|
1707 |
|
1708 |
|
1709 /** |
|
1710 * MarncResourceAvailableTest |
|
1711 */ |
|
1712 void CTestMmfAclntARN8109::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport) |
|
1713 { |
|
1714 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) |
|
1715 { |
|
1716 INFO_PRINTF1(_L("iAudioPlayer::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable")); |
|
1717 |
|
1718 //Convert TDesc8 to TInt64 |
|
1719 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf; |
|
1720 timeIntvbuf.Copy(aNotificationData); |
|
1721 TTimeIntervalMicroSeconds intPos = timeIntvbuf(); |
|
1722 iPosition = intPos; |
|
1723 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1) |
|
1724 { |
|
1725 INFO_PRINTF1(_L("iAudioPlayer1 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable..waiting for playcomplete")); |
|
1726 iResourceAvailable1 = ETrue; |
|
1727 TRAP(iError, FsmL(EMarncResourceAvailable1, KErrNone)); |
|
1728 } |
|
1729 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2) |
|
1730 { |
|
1731 INFO_PRINTF1(_L("iAudioPlayer2 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable")); |
|
1732 TRAP(iError, FsmL(EMarncResourceAvailable2, KErrNone)); |
|
1733 } |
|
1734 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3) |
|
1735 { |
|
1736 INFO_PRINTF1(_L("iAudioPlayer3 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable")); |
|
1737 TRAP(iError, FsmL(EMarncResourceAvailable3, KErrNone)); |
|
1738 } |
|
1739 } |
|
1740 else |
|
1741 { |
|
1742 INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable")); |
|
1743 } |
|
1744 } |
|
1745 |
|
1746 /** |
|
1747 * FsmCheck |
|
1748 */ |
|
1749 TBool CTestMmfAclntARN8109::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1750 { |
|
1751 TBool retFsmCheck = EFalse; |
|
1752 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow)) |
|
1753 { |
|
1754 INFO_PRINTF1(_L("Underflow !")); |
|
1755 } |
|
1756 else if (iExpectedEvent != aEventCode) |
|
1757 { |
|
1758 if(aEventCode == EMarncResourceAvailable1) |
|
1759 { |
|
1760 retFsmCheck = EFalse; |
|
1761 } |
|
1762 else |
|
1763 { |
|
1764 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
1765 iTestStepResult = EFail; |
|
1766 CActiveScheduler::Stop(); |
|
1767 } |
|
1768 } |
|
1769 else if (iExpectedError != aError) |
|
1770 { |
|
1771 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
1772 iTestStepResult = EFail; |
|
1773 CActiveScheduler::Stop(); |
|
1774 } |
|
1775 else |
|
1776 { |
|
1777 retFsmCheck = ETrue; |
|
1778 } |
|
1779 return retFsmCheck; |
|
1780 } |
|
1781 /** |
|
1782 * FsmL |
|
1783 */ |
|
1784 void CTestMmfAclntARN8109::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1785 { |
|
1786 if (FsmCheck(aEventCode, aError)) |
|
1787 { |
|
1788 TTimeIntervalMicroSeconds silence(0); // 3 sec of silence |
|
1789 TInt retErr = KErrNone; |
|
1790 switch (iState) |
|
1791 { |
|
1792 |
|
1793 case EStateBegin: |
|
1794 // Open iTestAudioPlayer#1 |
|
1795 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
1796 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
1797 // Set ExpectedEvent and change the State |
|
1798 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
1799 break; |
|
1800 case EStatePlaying1: |
|
1801 // Play iTestAudioPlayer#1 |
|
1802 iTestAudioPlayer1->Play(); |
|
1803 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
1804 // Register iTestAudioPlayer#1 for Notification |
|
1805 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1806 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
1807 if( retErr != KErrNone ) |
|
1808 { |
|
1809 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
1810 iTestStepResult = EFail; |
|
1811 CActiveScheduler::Stop(); |
|
1812 break; |
|
1813 } |
|
1814 // Open iTestAudioPlayer#2 |
|
1815 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
1816 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
1817 // Set ExpectedEvent and change the State |
|
1818 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
1819 break; |
|
1820 case EStatePlaying2: |
|
1821 // Play iTestAudioPlayer#2 |
|
1822 iDuration = I64INT(iTestAudioPlayer2->Duration().Int64()); |
|
1823 INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility")); |
|
1824 INFO_PRINTF2( _L("Repeats = %d\n"),NUMBER_OF_REPEATS); |
|
1825 iTestAudioPlayer2->SetRepeats(NUMBER_OF_REPEATS,silence); |
|
1826 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
1827 |
|
1828 iTestAudioPlayer2->Play(); |
|
1829 iStart.HomeTime(); |
|
1830 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
1831 // Set ExpectedEvent and change the State |
|
1832 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
1833 break; |
|
1834 case EStateErrInUsePlayer1: |
|
1835 // Set ExpectedEvent and change the State |
|
1836 StateChange(EStateEndPlay2, EMapcPlayComplete2); |
|
1837 break; |
|
1838 case EStateEndPlay2: |
|
1839 iStop.HomeTime(); |
|
1840 iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64()); |
|
1841 INFO_PRINTF2( _L("Clip Duration = %d "),iDuration); |
|
1842 INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration); |
|
1843 INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(NUMBER_OF_REPEATS)); |
|
1844 if(iPlayComplete2 && iResourceAvailable1) |
|
1845 { |
|
1846 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
1847 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1), |
|
1848 KExpectedDeviation)) |
|
1849 { |
|
1850 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1851 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
1852 iTestStepResult = EPass; |
|
1853 CActiveScheduler::Stop(); |
|
1854 } |
|
1855 else |
|
1856 { |
|
1857 iTestStepResult = EFail; |
|
1858 CActiveScheduler::Stop(); |
|
1859 } |
|
1860 #else |
|
1861 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1), |
|
1862 KExpectedDeviation*NUMBER_OF_REPEATS)) |
|
1863 { |
|
1864 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1865 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
1866 iTestStepResult = EPass; |
|
1867 CActiveScheduler::Stop(); |
|
1868 // Timer to check if Notification Event Occurs. |
|
1869 } |
|
1870 else |
|
1871 { |
|
1872 iTestStepResult = EFail; |
|
1873 CActiveScheduler::Stop(); |
|
1874 } |
|
1875 #endif |
|
1876 } |
|
1877 else if(iPlayComplete2 && ! iResourceAvailable1) |
|
1878 { |
|
1879 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND |
|
1880 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1), |
|
1881 KExpectedDeviation)) |
|
1882 { |
|
1883 // Timer to check if Notification Event Occurs. |
|
1884 iCallBackTimer->After(2000000); |
|
1885 // Set ExpectedEvent and change the State |
|
1886 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
1887 } |
|
1888 else |
|
1889 { |
|
1890 iTestStepResult = EFail; |
|
1891 CActiveScheduler::Stop(); |
|
1892 } |
|
1893 #else |
|
1894 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1), |
|
1895 KExpectedDeviation*NUMBER_OF_REPEATS)) |
|
1896 { |
|
1897 // Timer to check if Notification Event Occurs. |
|
1898 iCallBackTimer->After(2000000); |
|
1899 // Set ExpectedEvent and change the State |
|
1900 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1); |
|
1901 // Timer to check if Notification Event Occurs. |
|
1902 } |
|
1903 else |
|
1904 { |
|
1905 iTestStepResult = EFail; |
|
1906 CActiveScheduler::Stop(); |
|
1907 } |
|
1908 #endif |
|
1909 } |
|
1910 break; |
|
1911 case EStateNotifiedPlayer1: |
|
1912 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1913 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived")); |
|
1914 iTestStepResult = EPass; |
|
1915 CActiveScheduler::Stop(); |
|
1916 break; |
|
1917 } |
|
1918 } |
|
1919 } |
|
1920 TBool CTestMmfAclntARN8109::TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDeviation) |
|
1921 { |
|
1922 // save unnessary conditions |
|
1923 if(aActual == aExpected) |
|
1924 return ETrue; |
|
1925 |
|
1926 // Prevent unsigned wrapping errors |
|
1927 TUint difference; |
|
1928 if(aActual > aExpected) |
|
1929 difference = aActual - aExpected; |
|
1930 else |
|
1931 difference = aExpected - aActual; |
|
1932 |
|
1933 // comapare |
|
1934 if(difference < aDeviation) |
|
1935 return ETrue; |
|
1936 return EFalse; |
|
1937 } |
|
1938 /** |
|
1939 * PerformTestL |
|
1940 */ |
|
1941 TVerdict CTestMmfAclntARN8109::PerformTestL() |
|
1942 { |
|
1943 INFO_PRINTF1(_L("High priority client plays with repeats and low priority client doesn't get resources.")); |
|
1944 iTestStepResult = EFail; |
|
1945 |
|
1946 // Initialise the state variables |
|
1947 StateInit(); |
|
1948 |
|
1949 // Begin the process |
|
1950 FsmL(EIdlePlayer, KErrNone); |
|
1951 |
|
1952 // Start the scheduler - Done only once ! |
|
1953 CActiveScheduler::Start(); |
|
1954 |
|
1955 return iTestStepResult; |
|
1956 } |
|
1957 |
|
1958 |
|
1959 // |
|
1960 //CTestMmfAclntARN8110 //test to cover CR id: |
|
1961 // |
|
1962 |
|
1963 /** |
|
1964 * Constructor |
|
1965 */ |
|
1966 CTestMmfAclntARN8110::CTestMmfAclntARN8110(const TDesC& aTestName, const TDesC& aSectName) |
|
1967 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
1968 {} |
|
1969 |
|
1970 /** |
|
1971 * NewL |
|
1972 */ |
|
1973 CTestMmfAclntARN8110* CTestMmfAclntARN8110::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
1974 { |
|
1975 CTestMmfAclntARN8110* self = new (ELeave) CTestMmfAclntARN8110(aTestName, aSectName); |
|
1976 return self; |
|
1977 } |
|
1978 |
|
1979 /** |
|
1980 * DoTestL |
|
1981 */ |
|
1982 TVerdict CTestMmfAclntARN8110::DoTestL() |
|
1983 { |
|
1984 return( PerformTestL() ); |
|
1985 } |
|
1986 |
|
1987 /** |
|
1988 * FsmL |
|
1989 */ |
|
1990 void CTestMmfAclntARN8110::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
1991 { |
|
1992 if (FsmCheck(aEventCode, aError)) |
|
1993 { |
|
1994 TTimeIntervalMicroSeconds32 wait2secs(2000000); |
|
1995 TTimeIntervalMicroSeconds oneNhalf(MAKE_TINT64(0,1500000)); |
|
1996 TInt retErr = KErrNone; |
|
1997 switch (iState) |
|
1998 { |
|
1999 case EStateBegin: |
|
2000 // Open iTestAudioPlayer#1 // next event to play iTestAudioPlayer#1 |
|
2001 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2002 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2003 // Set ExpectedEvent and change the State |
|
2004 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
2005 break; |
|
2006 case EStatePlaying1: |
|
2007 // Play iTestAudioPlayer#1 |
|
2008 iTestAudioPlayer1->Play(); |
|
2009 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
2010 // Open iTestAudioPlayer#2 |
|
2011 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
2012 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
2013 // Set ExpectedEvent and change the State |
|
2014 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
2015 break; |
|
2016 case EStatePlaying2: |
|
2017 // Play iTestAudioPlayer#2 |
|
2018 User::After(wait2secs); |
|
2019 iTestAudioPlayer2->Play(); |
|
2020 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
2021 // Set ExpectedEvent and change the State |
|
2022 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
2023 break; |
|
2024 case EStateErrInUsePlayer1: |
|
2025 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos); |
|
2026 if(retErr != KErrNone) |
|
2027 { |
|
2028 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr); |
|
2029 iTestStepResult = EFail; |
|
2030 CActiveScheduler::Stop(); |
|
2031 break; |
|
2032 } |
|
2033 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()")); |
|
2034 //using 1.5 sec for comparison as sometimes playback is slow. |
|
2035 if(iPlayer1Pos < oneNhalf) |
|
2036 { |
|
2037 iTestStepResult = EFail; |
|
2038 CActiveScheduler::Stop(); |
|
2039 break; |
|
2040 } |
|
2041 // Set ExpectedEvent and change the State |
|
2042 StateChange(EStateEndPlay2, EMapcPlayComplete2 ); |
|
2043 break; |
|
2044 case EStateEndPlay2: |
|
2045 iTestStepResult = EPass; |
|
2046 // Play iTestAudioPlayer#1 again |
|
2047 TTimeIntervalMicroSeconds pos; |
|
2048 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()")); |
|
2049 retErr = iTestAudioPlayer1->GetPosition(pos); |
|
2050 if(retErr != KErrNone) |
|
2051 { |
|
2052 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr); |
|
2053 iTestStepResult = EFail; |
|
2054 CActiveScheduler::Stop(); |
|
2055 break; |
|
2056 } |
|
2057 if(pos == 0 || pos != iPlayer1Pos ) |
|
2058 { |
|
2059 iTestStepResult = EFail; |
|
2060 CActiveScheduler::Stop(); |
|
2061 break; |
|
2062 } |
|
2063 iTestAudioPlayer1->Play(); |
|
2064 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
2065 retErr = iTestAudioPlayer1->GetPosition(pos); |
|
2066 if(retErr != KErrNone) |
|
2067 { |
|
2068 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr); |
|
2069 iTestStepResult = EFail; |
|
2070 CActiveScheduler::Stop(); |
|
2071 break; |
|
2072 } |
|
2073 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()")); |
|
2074 if(pos < iPlayer1Pos) |
|
2075 { |
|
2076 iTestStepResult = EFail; |
|
2077 CActiveScheduler::Stop(); |
|
2078 break; |
|
2079 } |
|
2080 iTestAudioPlayer1->Stop(); |
|
2081 INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()")); |
|
2082 iTestStepResult = EPass; |
|
2083 CActiveScheduler::Stop(); |
|
2084 // Set ExpectedEvent and change the State |
|
2085 break; |
|
2086 } |
|
2087 } |
|
2088 } |
|
2089 |
|
2090 /** |
|
2091 * PerformTestL |
|
2092 */ |
|
2093 TVerdict CTestMmfAclntARN8110::PerformTestL() |
|
2094 { |
|
2095 INFO_PRINTF1(_L("Register for notification, but make no request to play audio")); |
|
2096 iTestStepResult = EFail; |
|
2097 |
|
2098 // Initialise the state variables |
|
2099 StateInit(); |
|
2100 |
|
2101 // Begin the process |
|
2102 FsmL(EIdlePlayer, KErrNone); |
|
2103 |
|
2104 // Start the scheduler - Done only once ! |
|
2105 CActiveScheduler::Start(); |
|
2106 |
|
2107 return iTestStepResult; |
|
2108 } |
|
2109 |
|
2110 |
|
2111 // |
|
2112 //CTestMmfAclntARN8111 //test to cover CR id: |
|
2113 // |
|
2114 |
|
2115 /** |
|
2116 * Constructor |
|
2117 */ |
|
2118 CTestMmfAclntARN8111::CTestMmfAclntARN8111(const TDesC& aTestName, const TDesC& aSectName) |
|
2119 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
2120 {} |
|
2121 |
|
2122 /** |
|
2123 * NewL |
|
2124 */ |
|
2125 CTestMmfAclntARN8111* CTestMmfAclntARN8111::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2126 { |
|
2127 CTestMmfAclntARN8111* self = new (ELeave) CTestMmfAclntARN8111(aTestName, aSectName); |
|
2128 return self; |
|
2129 } |
|
2130 |
|
2131 /** |
|
2132 * DoTestL |
|
2133 */ |
|
2134 TVerdict CTestMmfAclntARN8111::DoTestL() |
|
2135 { |
|
2136 return( PerformTestL() ); |
|
2137 } |
|
2138 |
|
2139 /** |
|
2140 * FsmL |
|
2141 */ |
|
2142 void CTestMmfAclntARN8111::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
2143 { |
|
2144 if (FsmCheck(aEventCode, aError)) |
|
2145 { |
|
2146 TTimeIntervalMicroSeconds32 wait2secs(2000000); |
|
2147 TTimeIntervalMicroSeconds oneNhalf(MAKE_TINT64(0,1500000)); |
|
2148 TTimeIntervalMicroSeconds zeroSecs(MAKE_TINT64(0,0)); |
|
2149 TInt retErr = KErrNone; |
|
2150 switch (iState) |
|
2151 { |
|
2152 case EStateBegin: |
|
2153 // Open iTestAudioPlayer#1 // next event to play iTestAudioPlayer#1 |
|
2154 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2155 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2156 // Set ExpectedEvent and change the State |
|
2157 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
2158 break; |
|
2159 case EStatePlaying1: |
|
2160 // Play iTestAudioPlayer#1 |
|
2161 iTestAudioPlayer1->Play(); |
|
2162 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
2163 // Open iTestAudioPlayer#2 |
|
2164 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
2165 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
2166 // Set ExpectedEvent and change the State |
|
2167 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
2168 break; |
|
2169 case EStatePlaying2: |
|
2170 // Play iTestAudioPlayer#2 |
|
2171 User::After(wait2secs); |
|
2172 iTestAudioPlayer2->Play(); |
|
2173 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
2174 // Set ExpectedEvent and change the State |
|
2175 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
2176 break; |
|
2177 case EStateErrInUsePlayer1: |
|
2178 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos); |
|
2179 if(retErr != KErrNone) |
|
2180 { |
|
2181 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr); |
|
2182 iTestStepResult = EFail; |
|
2183 CActiveScheduler::Stop(); |
|
2184 break; |
|
2185 } |
|
2186 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()")); |
|
2187 //using 1.5 sec for comparison as sometimes playback is slow. |
|
2188 if(iPlayer1Pos < oneNhalf) |
|
2189 { |
|
2190 iTestStepResult = EFail; |
|
2191 CActiveScheduler::Stop(); |
|
2192 break; |
|
2193 } |
|
2194 //stop the iTestAudioPlayer#1 after pre-emption and check if the position is reset. |
|
2195 iTestAudioPlayer1->Stop(); |
|
2196 INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()")); |
|
2197 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos); |
|
2198 if(retErr != KErrNone) |
|
2199 { |
|
2200 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr); |
|
2201 iTestStepResult = EFail; |
|
2202 CActiveScheduler::Stop(); |
|
2203 break; |
|
2204 } |
|
2205 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()")); |
|
2206 if(iPlayer1Pos != zeroSecs) |
|
2207 { |
|
2208 iTestStepResult = EFail; |
|
2209 CActiveScheduler::Stop(); |
|
2210 break; |
|
2211 } |
|
2212 // Set ExpectedEvent and change the State |
|
2213 StateChange(EStateEndPlay2, EMapcPlayComplete2 ); |
|
2214 break; |
|
2215 case EStateEndPlay2: |
|
2216 iTestStepResult = EPass; |
|
2217 // Play iTestAudioPlayer#1 again |
|
2218 iTestAudioPlayer1->Play(); |
|
2219 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
2220 User::After(wait2secs); |
|
2221 iTestAudioPlayer1->Stop(); |
|
2222 INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()")); |
|
2223 CActiveScheduler::Stop(); |
|
2224 // Set ExpectedEvent and change the State |
|
2225 break; |
|
2226 } |
|
2227 } |
|
2228 } |
|
2229 |
|
2230 /** |
|
2231 * PerformTestL |
|
2232 */ |
|
2233 TVerdict CTestMmfAclntARN8111::PerformTestL() |
|
2234 { |
|
2235 INFO_PRINTF1(_L("Register for notification, but make no request to play audio")); |
|
2236 iTestStepResult = EFail; |
|
2237 |
|
2238 // Initialise the state variables |
|
2239 StateInit(); |
|
2240 |
|
2241 // Begin the process |
|
2242 FsmL(EIdlePlayer, KErrNone); |
|
2243 |
|
2244 // Start the scheduler - Done only once ! |
|
2245 CActiveScheduler::Start(); |
|
2246 |
|
2247 return iTestStepResult; |
|
2248 } |
|
2249 |
|
2250 // |
|
2251 //CTestMmfAclntARN8112 //test to cover CR id: |
|
2252 // |
|
2253 |
|
2254 /** |
|
2255 * Constructor |
|
2256 */ |
|
2257 CTestMmfAclntARN8112::CTestMmfAclntARN8112(const TDesC& aTestName, const TDesC& aSectName) |
|
2258 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
2259 {} |
|
2260 |
|
2261 /** |
|
2262 * NewL |
|
2263 */ |
|
2264 CTestMmfAclntARN8112* CTestMmfAclntARN8112::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2265 { |
|
2266 CTestMmfAclntARN8112* self = new (ELeave) CTestMmfAclntARN8112(aTestName, aSectName); |
|
2267 return self; |
|
2268 } |
|
2269 |
|
2270 /** |
|
2271 * DoTestL |
|
2272 */ |
|
2273 TVerdict CTestMmfAclntARN8112::DoTestL() |
|
2274 { |
|
2275 return( PerformTestL() ); |
|
2276 } |
|
2277 |
|
2278 /** |
|
2279 * FsmL |
|
2280 */ |
|
2281 void CTestMmfAclntARN8112::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
2282 { |
|
2283 if (FsmCheck(aEventCode, aError)) |
|
2284 { |
|
2285 TTimeIntervalMicroSeconds32 wait1secs(1000000); |
|
2286 TTimeIntervalMicroSeconds zeroSecs(MAKE_TINT64(0,0)); |
|
2287 TInt retErr = KErrNone; |
|
2288 switch (iState) |
|
2289 { |
|
2290 case EStateBegin: |
|
2291 // Open iTestAudioPlayer#2 // next event to play iTestAudioPlayer#2 |
|
2292 iTestAudioPlayer2->OpenFileL(iFilename2); |
|
2293 INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()")); |
|
2294 // Set ExpectedEvent and change the State |
|
2295 StateChange(EStatePlaying2, EMapcInitComplete2); |
|
2296 break; |
|
2297 case EStatePlaying2: |
|
2298 // Play iTestAudioPlayer#1 |
|
2299 iTestAudioPlayer2->Play(); |
|
2300 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()")); |
|
2301 // Open iTestAudioPlayer#1 |
|
2302 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2303 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2304 // Set ExpectedEvent and change the State |
|
2305 StateChange(EStatePlaying1, EMapcInitComplete1); |
|
2306 break; |
|
2307 case EStatePlaying1: |
|
2308 // Play iTestAudioPlayer#1 |
|
2309 User::After(wait1secs); |
|
2310 iTestAudioPlayer1->Play(); |
|
2311 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
2312 // Set ExpectedEvent and change the State |
|
2313 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse); |
|
2314 break; |
|
2315 case EStateErrInUsePlayer1: |
|
2316 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos); |
|
2317 if(retErr != KErrNone) |
|
2318 { |
|
2319 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr); |
|
2320 iTestStepResult = EFail; |
|
2321 CActiveScheduler::Stop(); |
|
2322 break; |
|
2323 } |
|
2324 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()")); |
|
2325 if(iPlayer1Pos != zeroSecs) |
|
2326 { |
|
2327 iTestStepResult = EFail; |
|
2328 CActiveScheduler::Stop(); |
|
2329 break; |
|
2330 } |
|
2331 //stop the iTestAudioPlayer#1 after pre-emption and check if the position is reset. |
|
2332 iTestAudioPlayer2->Stop(); |
|
2333 INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()")); |
|
2334 iTestAudioPlayer1->Play(); |
|
2335 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()")); |
|
2336 |
|
2337 // Set ExpectedEvent and change the State |
|
2338 StateChange(EStateEndPlay1, EMapcPlayComplete1 ); |
|
2339 break; |
|
2340 case EStateEndPlay1: |
|
2341 iTestStepResult = EPass; |
|
2342 // Play iTestAudioPlayer#1 again |
|
2343 CActiveScheduler::Stop(); |
|
2344 // Set ExpectedEvent and change the State |
|
2345 break; |
|
2346 } |
|
2347 } |
|
2348 } |
|
2349 |
|
2350 /** |
|
2351 * PerformTestL |
|
2352 */ |
|
2353 TVerdict CTestMmfAclntARN8112::PerformTestL() |
|
2354 { |
|
2355 INFO_PRINTF1(_L("Register for notification, but make no request to play audio")); |
|
2356 iTestStepResult = EFail; |
|
2357 |
|
2358 // Initialise the state variables |
|
2359 StateInit(); |
|
2360 |
|
2361 // Begin the process |
|
2362 FsmL(EIdlePlayer, KErrNone); |
|
2363 |
|
2364 // Start the scheduler - Done only once ! |
|
2365 CActiveScheduler::Start(); |
|
2366 |
|
2367 return iTestStepResult; |
|
2368 } |
|
2369 |
|
2370 // |
|
2371 //NEGATIVE TESTS// |
|
2372 // |
|
2373 |
|
2374 // |
|
2375 //CTestMmfAclntARN1301 |
|
2376 // |
|
2377 |
|
2378 /** |
|
2379 * Constructor |
|
2380 */ |
|
2381 CTestMmfAclntARN1301::CTestMmfAclntARN1301(const TDesC& aTestName, const TDesC& aSectName) |
|
2382 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
2383 {} |
|
2384 |
|
2385 /** |
|
2386 * NewL |
|
2387 */ |
|
2388 CTestMmfAclntARN1301* CTestMmfAclntARN1301::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2389 { |
|
2390 CTestMmfAclntARN1301* self = new (ELeave) CTestMmfAclntARN1301(aTestName, aSectName); |
|
2391 return self; |
|
2392 } |
|
2393 |
|
2394 /** |
|
2395 * DoTestL |
|
2396 */ |
|
2397 TVerdict CTestMmfAclntARN1301::DoTestL() |
|
2398 { |
|
2399 return( PerformTestL() ); |
|
2400 } |
|
2401 |
|
2402 /** |
|
2403 * FsmL |
|
2404 */ |
|
2405 void CTestMmfAclntARN1301::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
2406 { |
|
2407 if (FsmCheck(aEventCode, aError)) |
|
2408 { |
|
2409 TInt retErr = KErrNone; |
|
2410 switch (iState) |
|
2411 { |
|
2412 case EStateBegin: |
|
2413 // Open iTestAudioPlayer#1 |
|
2414 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2415 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2416 // Set ExpectedEvent and change the State |
|
2417 StateChange(EStateOpenPlayer1, EMapcInitComplete1); |
|
2418 break; |
|
2419 case EStateOpenPlayer1: |
|
2420 // Register iTestAudioPlayer#1 for Notification |
|
2421 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryPlaybackComplete); |
|
2422 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete)")); |
|
2423 if( retErr == KErrNotSupported ) |
|
2424 { |
|
2425 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Returned KErrNotSupported ") ); |
|
2426 iTestStepResult = EPass; |
|
2427 } |
|
2428 else |
|
2429 { |
|
2430 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
2431 iTestStepResult = EFail; |
|
2432 } |
|
2433 CActiveScheduler::Stop(); |
|
2434 break; |
|
2435 } |
|
2436 } |
|
2437 } |
|
2438 |
|
2439 /** |
|
2440 * PerformTestL |
|
2441 */ |
|
2442 TVerdict CTestMmfAclntARN1301::PerformTestL() |
|
2443 { |
|
2444 INFO_PRINTF1(_L("Register for notification with an unsupported event type.")); |
|
2445 iTestStepResult = EFail; |
|
2446 |
|
2447 // Initialise the state variables |
|
2448 StateInit(); |
|
2449 |
|
2450 // Begin the process |
|
2451 FsmL(EIdlePlayer, KErrNone); |
|
2452 |
|
2453 // Start the scheduler - Done only once ! |
|
2454 CActiveScheduler::Start(); |
|
2455 |
|
2456 return iTestStepResult; |
|
2457 } |
|
2458 |
|
2459 // |
|
2460 //CTestMmfAclntARN1302 |
|
2461 // |
|
2462 |
|
2463 /** |
|
2464 * Constructor |
|
2465 */ |
|
2466 CTestMmfAclntARN1302::CTestMmfAclntARN1302(const TDesC& aTestName, const TDesC& aSectName) |
|
2467 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
2468 {} |
|
2469 |
|
2470 /** |
|
2471 * NewL |
|
2472 */ |
|
2473 CTestMmfAclntARN1302* CTestMmfAclntARN1302::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2474 { |
|
2475 CTestMmfAclntARN1302* self = new (ELeave) CTestMmfAclntARN1302(aTestName, aSectName); |
|
2476 return self; |
|
2477 } |
|
2478 |
|
2479 /** |
|
2480 * DoTestL |
|
2481 */ |
|
2482 TVerdict CTestMmfAclntARN1302::DoTestL() |
|
2483 { |
|
2484 return( PerformTestL() ); |
|
2485 } |
|
2486 |
|
2487 /** |
|
2488 * FsmL |
|
2489 */ |
|
2490 void CTestMmfAclntARN1302::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
2491 { |
|
2492 if (FsmCheck(aEventCode, aError)) |
|
2493 { |
|
2494 TInt retErr = KErrNone; |
|
2495 switch (iState) |
|
2496 { |
|
2497 case EStateBegin: |
|
2498 // Open iTestAudioPlayer#1 |
|
2499 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2500 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2501 // Set ExpectedEvent and change the State |
|
2502 StateChange(EStateOpenPlayer1, EMapcInitComplete1); |
|
2503 break; |
|
2504 case EStateOpenPlayer1: |
|
2505 // Register iTestAudioPlayer#1 for Notification |
|
2506 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
2507 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()")); |
|
2508 if( retErr != KErrNone ) |
|
2509 { |
|
2510 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
2511 iTestStepResult = EFail; |
|
2512 CActiveScheduler::Stop(); |
|
2513 break; |
|
2514 } |
|
2515 // Cancel notification for iTestAudioPlayer#1 |
|
2516 retErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete); |
|
2517 INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete)")); |
|
2518 if( retErr == KErrNotSupported ) |
|
2519 { |
|
2520 ERR_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Returned KErrNotSupported ") ); |
|
2521 iTestStepResult = EPass; |
|
2522 } |
|
2523 else |
|
2524 { |
|
2525 ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
2526 iTestStepResult = EFail; |
|
2527 } |
|
2528 CActiveScheduler::Stop(); |
|
2529 break; |
|
2530 } |
|
2531 } |
|
2532 } |
|
2533 |
|
2534 /** |
|
2535 * PerformTestL |
|
2536 */ |
|
2537 TVerdict CTestMmfAclntARN1302::PerformTestL() |
|
2538 { |
|
2539 INFO_PRINTF1(_L("Cancel the request for notification with an unsupported event type.")); |
|
2540 iTestStepResult = EFail; |
|
2541 |
|
2542 // Initialise the state variables |
|
2543 StateInit(); |
|
2544 |
|
2545 // Begin the process |
|
2546 FsmL(EIdlePlayer, KErrNone); |
|
2547 |
|
2548 // Start the scheduler - Done only once ! |
|
2549 CActiveScheduler::Start(); |
|
2550 |
|
2551 return iTestStepResult; |
|
2552 } |
|
2553 |
|
2554 // |
|
2555 //CTestMmfAclntARN1303 |
|
2556 // |
|
2557 |
|
2558 /** |
|
2559 * Constructor |
|
2560 */ |
|
2561 CTestMmfAclntARN1303::CTestMmfAclntARN1303(const TDesC& aTestName, const TDesC& aSectName) |
|
2562 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
2563 {} |
|
2564 |
|
2565 /** |
|
2566 * NewL |
|
2567 */ |
|
2568 CTestMmfAclntARN1303* CTestMmfAclntARN1303::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2569 { |
|
2570 CTestMmfAclntARN1303* self = new (ELeave) CTestMmfAclntARN1303(aTestName, aSectName); |
|
2571 return self; |
|
2572 } |
|
2573 |
|
2574 /** |
|
2575 * DoTestL |
|
2576 */ |
|
2577 TVerdict CTestMmfAclntARN1303::DoTestL() |
|
2578 { |
|
2579 return( PerformTestL() ); |
|
2580 } |
|
2581 |
|
2582 /** |
|
2583 * FsmL |
|
2584 */ |
|
2585 void CTestMmfAclntARN1303::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
2586 { |
|
2587 if (FsmCheck(aEventCode, aError)) |
|
2588 { |
|
2589 TInt retErr = KErrNone; |
|
2590 switch (iState) |
|
2591 { |
|
2592 case EStateBegin: |
|
2593 // Open iTestAudioPlayer#1 |
|
2594 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2595 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2596 // Set ExpectedEvent and change the State |
|
2597 StateChange(EStateOpenPlayer1, EMapcInitComplete1); |
|
2598 break; |
|
2599 case EStateOpenPlayer1: |
|
2600 // Cancel notification for iTestAudioPlayer#1 |
|
2601 retErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable); |
|
2602 INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable)")); |
|
2603 if( retErr == KErrCancel ) |
|
2604 { |
|
2605 ERR_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Returned KErrCancel ") ); |
|
2606 iTestStepResult = EPass; |
|
2607 } |
|
2608 else |
|
2609 { |
|
2610 ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr); |
|
2611 iTestStepResult = EFail; |
|
2612 } |
|
2613 CActiveScheduler::Stop(); |
|
2614 break; |
|
2615 } |
|
2616 } |
|
2617 } |
|
2618 |
|
2619 /** |
|
2620 * PerformTestL |
|
2621 */ |
|
2622 TVerdict CTestMmfAclntARN1303::PerformTestL() |
|
2623 { |
|
2624 INFO_PRINTF1(_L("Cancel when no resource Notification is requested.")); |
|
2625 iTestStepResult = EFail; |
|
2626 |
|
2627 // Initialise the state variables |
|
2628 StateInit(); |
|
2629 |
|
2630 // Begin the process |
|
2631 FsmL(EIdlePlayer, KErrNone); |
|
2632 |
|
2633 // Start the scheduler - Done only once ! |
|
2634 CActiveScheduler::Start(); |
|
2635 |
|
2636 return iTestStepResult; |
|
2637 } |
|
2638 |
|
2639 // |
|
2640 //CTestMmfAclntARN1304 |
|
2641 // |
|
2642 |
|
2643 /** |
|
2644 * Constructor |
|
2645 */ |
|
2646 CTestMmfAclntARN1304::CTestMmfAclntARN1304(const TDesC& aTestName, const TDesC& aSectName) |
|
2647 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName) |
|
2648 {} |
|
2649 |
|
2650 /** |
|
2651 * NewL |
|
2652 */ |
|
2653 CTestMmfAclntARN1304* CTestMmfAclntARN1304::NewL(const TDesC& aTestName, const TDesC& aSectName) |
|
2654 { |
|
2655 CTestMmfAclntARN1304* self = new (ELeave) CTestMmfAclntARN1304(aTestName, aSectName); |
|
2656 return self; |
|
2657 } |
|
2658 |
|
2659 /** |
|
2660 * DoTestL |
|
2661 */ |
|
2662 TVerdict CTestMmfAclntARN1304::DoTestL() |
|
2663 { |
|
2664 return( PerformTestL() ); |
|
2665 } |
|
2666 |
|
2667 /** |
|
2668 * FsmL |
|
2669 */ |
|
2670 void CTestMmfAclntARN1304::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError) |
|
2671 { |
|
2672 if (FsmCheck(aEventCode, aError)) |
|
2673 { |
|
2674 TInt retErr = KErrNone; |
|
2675 switch (iState) |
|
2676 { |
|
2677 case EStateBegin: |
|
2678 // Open iTestAudioPlayer#1 |
|
2679 iTestAudioPlayer1->OpenFileL(iFilename1); |
|
2680 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()")); |
|
2681 // Set ExpectedEvent and change the State |
|
2682 StateChange(EStateOpenPlayer1, EMapcInitComplete1); |
|
2683 break; |
|
2684 case EStateOpenPlayer1: |
|
2685 // Register iTestAudioPlayer#1 for Notification |
|
2686 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
2687 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()#1")); |
|
2688 if( retErr != KErrNone ) |
|
2689 { |
|
2690 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #1 - Failed with Error : %d"), retErr); |
|
2691 iTestStepResult = EFail; |
|
2692 CActiveScheduler::Stop(); |
|
2693 break; |
|
2694 } |
|
2695 // Register iTestAudioPlayer#1 for Notification (AGAIN) |
|
2696 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
2697 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()#2")); |
|
2698 if( retErr == KErrAlreadyExists ) |
|
2699 { |
|
2700 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #2 - Returned KErrAlreadyExists ") ); |
|
2701 iTestStepResult = EPass; |
|
2702 } |
|
2703 else |
|
2704 { |
|
2705 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #2 - Failed with Error : %d"), retErr); |
|
2706 iTestStepResult = EFail; |
|
2707 } |
|
2708 CActiveScheduler::Stop(); |
|
2709 break; |
|
2710 } |
|
2711 } |
|
2712 } |
|
2713 |
|
2714 /** |
|
2715 * PerformTestL |
|
2716 */ |
|
2717 TVerdict CTestMmfAclntARN1304::PerformTestL() |
|
2718 { |
|
2719 INFO_PRINTF1(_L("Multiple Registration for notification for the same event type.")); |
|
2720 iTestStepResult = EFail; |
|
2721 |
|
2722 // Initialise the state variables |
|
2723 StateInit(); |
|
2724 |
|
2725 // Begin the process |
|
2726 FsmL(EIdlePlayer, KErrNone); |
|
2727 |
|
2728 // Start the scheduler - Done only once ! |
|
2729 CActiveScheduler::Start(); |
|
2730 |
|
2731 return iTestStepResult; |
|
2732 } |