Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // CPP file: Audio Resource Notification tests for Audio Player.
19 @file TestPlayerUtilsARN.cpp
22 #include "TestAudioClientUtilitiesARN.h"
24 //------------------------------------------------------------------------------
25 //********************PREQ 797 - Audio Resource Notification********************
26 //------------------------------------------------------------------------------
29 //CTestMdaAudioPlayerCallbackSupport
35 CTestMdaAudioPlayerCallbackSupport* CTestMdaAudioPlayerCallbackSupport::NewL(MTestAudioPlayerCallback& aCallback)
37 return new(ELeave) CTestMdaAudioPlayerCallbackSupport(aCallback);
43 void CTestMdaAudioPlayerCallbackSupport::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
45 iCallback.MapcInitCompleteTest(aError, aDuration, *this);
51 void CTestMdaAudioPlayerCallbackSupport::MapcPlayComplete(TInt aError)
53 iCallback.MapcPlayCompleteTest(aError, *this);
57 * MarncResourceAvailable
59 void CTestMdaAudioPlayerCallbackSupport::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData)
61 iCallback.MarncResourceAvailableTest(aNotificationEventId, aNotificationData, *this);
67 CTestMdaAudioPlayerCallbackSupport::CTestMdaAudioPlayerCallbackSupport(MTestAudioPlayerCallback& aCallback):iCallback(aCallback)
73 //CTestMmfAclntAudioPlayerARN
79 CTestMmfAclntAudioPlayerARN::CTestMmfAclntAudioPlayerARN(const TDesC& aTestName, const TDesC& aSectName)
81 // store the name of this test case
82 iTestStepName=aTestName;
84 iSectName = aSectName;
89 * MapcInitCompleteTest
91 void CTestMmfAclntAudioPlayerARN::MapcInitCompleteTest(TInt aError, const TTimeIntervalMicroSeconds& aDuration, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
93 iDuration = aDuration;
94 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
96 INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError);
97 TRAP(iError, FsmL(EMapcInitComplete1, aError));
99 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
101 INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError);
102 TRAP(iError, FsmL(EMapcInitComplete2, aError));
104 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
106 INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError);
107 TRAP(iError, FsmL(EMapcInitComplete3, aError));
113 * MapcPlayCompleteTest
115 void CTestMmfAclntAudioPlayerARN::MapcPlayCompleteTest(TInt aError, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
117 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
119 INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
120 TRAP(iError, FsmL(EMapcPlayComplete1, aError));
122 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
124 INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
125 TRAP(iError, FsmL(EMapcPlayComplete2, aError));
127 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
129 INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
130 TRAP(iError, FsmL(EMapcPlayComplete3, aError));
136 * MarncResourceAvailableTest
138 void CTestMmfAclntAudioPlayerARN::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
140 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
142 INFO_PRINTF1(_L("iAudioPlayer::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable"));
144 //Convert TDesc8 to TInt64
145 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf;
146 timeIntvbuf.Copy(aNotificationData);
147 TTimeIntervalMicroSeconds intPos = timeIntvbuf();
149 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
151 INFO_PRINTF1(_L("iAudioPlayer1 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable..waiting for playcomplete"));
152 TRAP(iError, FsmL(EMarncResourceAvailable1, KErrNone));
154 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
156 INFO_PRINTF1(_L("iAudioPlayer2 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
157 TRAP(iError, FsmL(EMarncResourceAvailable2, KErrNone));
159 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
161 INFO_PRINTF1(_L("iAudioPlayer3 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
162 TRAP(iError, FsmL(EMarncResourceAvailable3, KErrNone));
167 INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable"));
172 * DoTestStepPreambleL
174 TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepPreambleL()
177 TVerdict ret = EPass;
179 // Call base DoTestStepPreambleL()
180 ret = CTestMmfAclntStep::DoTestStepPreambleL();
187 if(!GetStringFromConfig(iSectName, _L("playerAudioFile1"), filename))
189 return EInconclusive;
191 GetDriveName(iFilename1);
192 iFilename1.Append(filename);
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);
201 if(!GetStringFromConfig(iSectName, _L("playerAudioFile2"), filename))
203 return EInconclusive;
205 GetDriveName(iFilename2);
206 iFilename2.Append(filename);
208 // Initialise 2nd Audio Player
209 INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility2 : EMdaPriorityMax"));
210 iMdaAudioPlayerCallbackSupport2 = CTestMdaAudioPlayerCallbackSupport::NewL(*this);
211 iTestAudioPlayer2 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport2, EMdaPriorityMax);
214 if(!GetStringFromConfig(iSectName, _L("playerAudioFile3"), filename))
216 return EInconclusive;
218 GetDriveName(iFilename3);
219 iFilename3.Append(filename);
221 // Initialise 3rd Audio Player
222 INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility3 : EMdaPriorityMin"));
223 iMdaAudioPlayerCallbackSupport3 = CTestMdaAudioPlayerCallbackSupport::NewL(*this);
224 iTestAudioPlayer3 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport3, EMdaPriorityMin);
226 // Initialise the CCallBackTimer.
227 iCallBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler));
233 * DoTestStepPostambleL
235 TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepPostambleL()
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;
254 delete iEventChecker;
256 return CTestMmfAclntStep::DoTestStepPostambleL();
262 TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepL()
270 void CTestMmfAclntAudioPlayerARN::StateInit()
272 iExpectedEvent=EIdlePlayer;
273 iExpectedError=KErrNone;
280 void CTestMmfAclntAudioPlayerARN::StateChange(TMmfAudioPlayerState aState, TMmfAudioPlayerEvents aExpectedEvent, TInt aExpectedError)
282 iExpectedEvent=aExpectedEvent;
283 iExpectedError=aExpectedError;
290 TBool CTestMmfAclntAudioPlayerARN::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
292 TBool retFsmCheck = EFalse;
293 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
295 INFO_PRINTF1(_L("Underflow !"));
297 else if (iExpectedEvent != aEventCode)
299 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
300 iTestStepResult = EFail;
301 CActiveScheduler::Stop();
303 else if (iExpectedError != aError)
305 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
306 iTestStepResult = EFail;
307 CActiveScheduler::Stop();
321 //CTestMmfAclntARN8101
327 CTestMmfAclntARN8101::CTestMmfAclntARN8101(const TDesC& aTestName, const TDesC& aSectName)
328 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
334 CTestMmfAclntARN8101* CTestMmfAclntARN8101::NewL(const TDesC& aTestName, const TDesC& aSectName)
336 CTestMmfAclntARN8101* self = new (ELeave) CTestMmfAclntARN8101(aTestName, aSectName);
343 TVerdict CTestMmfAclntARN8101::DoTestL()
345 return( PerformTestL() );
351 void CTestMmfAclntARN8101::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
353 if (FsmCheck(aEventCode, aError))
355 TInt retErr = KErrNone;
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);
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 )
371 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
372 iTestStepResult = EFail;
373 CActiveScheduler::Stop();
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);
383 // Play iTestAudioPlayer#2
384 iTestAudioPlayer2->Play();
385 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
386 // Set ExpectedEvent and change the State
387 StateChange(EStateEndPlay2, EMapcPlayComplete2);
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);
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();
409 TVerdict CTestMmfAclntARN8101::PerformTestL()
411 INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
412 iTestStepResult = EFail;
414 // Initialise the state variables
418 FsmL(EIdlePlayer, KErrNone);
420 // Start the scheduler - Done only once !
421 CActiveScheduler::Start();
423 return iTestStepResult;
427 //CTestMmfAclntARN8102
433 CTestMmfAclntARN8102::CTestMmfAclntARN8102(const TDesC& aTestName, const TDesC& aSectName)
434 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
440 CTestMmfAclntARN8102* CTestMmfAclntARN8102::NewL(const TDesC& aTestName, const TDesC& aSectName)
442 CTestMmfAclntARN8102* self = new (ELeave) CTestMmfAclntARN8102(aTestName, aSectName);
449 TVerdict CTestMmfAclntARN8102::DoTestL()
451 return( PerformTestL() );
457 void CTestMmfAclntARN8102::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
459 if (FsmCheck(aEventCode, aError))
461 TInt retErr = KErrNone;
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);
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 )
477 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
478 iTestStepResult = EFail;
479 CActiveScheduler::Stop();
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);
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);
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);
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();
523 TVerdict CTestMmfAclntARN8102::PerformTestL()
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;
529 // Initialise the state variables
533 FsmL(EIdlePlayer, KErrNone);
535 // Start the scheduler - Done only once !
536 CActiveScheduler::Start();
538 return iTestStepResult;
542 //CTestMmfAclntARN8103
548 CTestMmfAclntARN8103::CTestMmfAclntARN8103(const TDesC& aTestName, const TDesC& aSectName)
549 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
555 CTestMmfAclntARN8103* CTestMmfAclntARN8103::NewL(const TDesC& aTestName, const TDesC& aSectName)
557 CTestMmfAclntARN8103* self = new (ELeave) CTestMmfAclntARN8103(aTestName, aSectName);
564 TVerdict CTestMmfAclntARN8103::DoTestL()
566 return( PerformTestL() );
572 TBool CTestMmfAclntARN8103::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
574 TBool retFsmCheck = EFalse;
575 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
577 INFO_PRINTF1(_L("Underflow !"));
579 else if (iExpectedEvent != aEventCode)
581 if ((aEventCode == EMapcPlayComplete2))
584 if (iEventOccured == EMarncResourceAvailable1)
590 iEventOccured = EMapcPlayComplete2;
593 else if (aEventCode == EMarncResourceAvailable1)
596 if (iEventOccured == EMapcPlayComplete2)
602 iEventOccured = EMarncResourceAvailable1;
607 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
608 iTestStepResult = EFail;
609 CActiveScheduler::Stop();
612 else if (iExpectedError != aError)
614 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
615 iTestStepResult = EFail;
616 CActiveScheduler::Stop();
628 void CTestMmfAclntARN8103::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
630 if (FsmCheck(aEventCode, aError))
632 TInt retErr = KErrNone;
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);
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 )
651 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
652 iTestStepResult = EFail;
653 CActiveScheduler::Stop();
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);
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);
669 case EStateErrInUsePlayer1:
670 // Set ExpectedEvent and change the State
671 StateChange(EStateEndPlay2, EMapcPlayComplete2);
674 // Timer to check if Notification Event Occurs.
675 iCallBackTimer->After(2000000);
676 // Set ExpectedEvent and change the State
677 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
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();
692 TVerdict CTestMmfAclntARN8103::PerformTestL()
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;
698 // Initialise the state variables
702 FsmL(EIdlePlayer, KErrNone);
704 // Start the scheduler - Done only once !
705 CActiveScheduler::Start();
707 return iTestStepResult;
711 //CTestMmfAclntARN8104
717 CTestMmfAclntARN8104::CTestMmfAclntARN8104(const TDesC& aTestName, const TDesC& aSectName)
718 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
724 CTestMmfAclntARN8104* CTestMmfAclntARN8104::NewL(const TDesC& aTestName, const TDesC& aSectName)
726 CTestMmfAclntARN8104* self = new (ELeave) CTestMmfAclntARN8104(aTestName, aSectName);
733 TVerdict CTestMmfAclntARN8104::DoTestL()
735 return( PerformTestL() );
741 void CTestMmfAclntARN8104::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
743 if (FsmCheck(aEventCode, aError))
745 TInt canErr = KErrNone;
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);
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);
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);
772 case EStateErrInUsePlayer1:
773 // Cancel notification for iTestAudioPlayer#1
774 canErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
775 INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification()"));
776 if( canErr != KErrNone )
778 ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), canErr);
779 iTestStepResult = EFail;
780 CActiveScheduler::Stop();
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);
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();
808 TVerdict CTestMmfAclntARN8104::PerformTestL()
810 INFO_PRINTF1(_L("Registration (b4 File Open) and Cancellation of the notification request"));
811 iTestStepResult = EFail;
813 // Initialise the state variables
816 // Register iTestAudioPlayer#1 for Notification
817 TInt retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
818 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
819 if( retErr != KErrNone )
821 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
826 FsmL(EIdlePlayer, KErrNone);
828 // Start the scheduler - Done only once !
829 CActiveScheduler::Start();
831 return iTestStepResult;
835 //CTestMmfAclntARN8105
841 CTestMmfAclntARN8105::CTestMmfAclntARN8105(const TDesC& aTestName, const TDesC& aSectName)
842 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
848 CTestMmfAclntARN8105* CTestMmfAclntARN8105::NewL(const TDesC& aTestName, const TDesC& aSectName)
850 CTestMmfAclntARN8105* self = new (ELeave) CTestMmfAclntARN8105(aTestName, aSectName);
857 TVerdict CTestMmfAclntARN8105::DoTestL()
859 return( PerformTestL() );
865 TBool CTestMmfAclntARN8105::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
867 TBool retFsmCheck = EFalse;
868 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
870 INFO_PRINTF1(_L("Underflow !"));
872 else if (iExpectedEvent != aEventCode)
874 if ((aEventCode == EMapcPlayComplete2))
877 if (iEventOccured == EMarncResourceAvailable1)
883 iEventOccured = EMapcPlayComplete2;
886 else if (aEventCode == EMarncResourceAvailable1)
889 if (iEventOccured == EMapcPlayComplete2)
895 iEventOccured = EMarncResourceAvailable1;
900 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
901 iTestStepResult = EFail;
902 CActiveScheduler::Stop();
905 else if (iExpectedError != aError)
907 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
908 iTestStepResult = EFail;
909 CActiveScheduler::Stop();
921 void CTestMmfAclntARN8105::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
923 if (FsmCheck(aEventCode, aError))
925 TInt retErr = KErrNone;
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);
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);
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);
952 case EStateErrInUsePlayer1:
953 //Get Position of iTestAudioPlayer#1
954 retErr = iTestAudioPlayer1->GetPosition(iPositionStop);
955 INFO_PRINTF1(_L("iTestAudioPlayer1->GetPosition()"));
956 if( retErr != KErrNone )
958 ERR_PRINTF2(_L("iTestAudioPlayer1->GetPosition - Failed with Error : %d"), retErr);
959 iTestStepResult = EFail;
960 CActiveScheduler::Stop();
963 INFO_PRINTF2(_L("value of iPositionStop = %d"),iPositionStop.Int64());//Statement Changed under DEF105143
965 // Register iTestAudioPlayer#1 for Notification
966 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
967 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
968 if( retErr != KErrNone )
970 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
971 iTestStepResult = EFail;
972 CActiveScheduler::Stop();
975 // Set ExpectedEvent and change the State
976 StateChange(EStateEndPlay2, EMapcPlayComplete2);
979 // Timer to check if Notification Event Occurs.
980 iCallBackTimer->After(2000000);
981 // Set ExpectedEvent and change the State
982 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
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)
992 INFO_PRINTF3(_L("iTestAudioPlayer1->Audio Resource iPositionResume >= iPositionStop, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
993 iTestStepResult=EPass;
997 ERR_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position is NOT iPositionResume >= iPositionStop, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
998 iTestStepResult=EFail;
1008 TVerdict CTestMmfAclntARN8105::PerformTestL()
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;
1013 // Initialise the state variables
1016 // Begin the process
1017 FsmL(EIdlePlayer, KErrNone);
1019 // Start the scheduler - Done only once !
1020 CActiveScheduler::Start();
1022 return iTestStepResult;
1026 //CTestMmfAclntARN8106
1032 CTestMmfAclntARN8106::CTestMmfAclntARN8106(const TDesC& aTestName, const TDesC& aSectName)
1033 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1039 CTestMmfAclntARN8106* CTestMmfAclntARN8106::NewL(const TDesC& aTestName, const TDesC& aSectName)
1041 CTestMmfAclntARN8106* self = new (ELeave) CTestMmfAclntARN8106(aTestName, aSectName);
1048 TVerdict CTestMmfAclntARN8106::DoTestL()
1050 return( PerformTestL() );
1056 TBool CTestMmfAclntARN8106::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1058 TBool retFsmCheck = EFalse;
1059 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1061 INFO_PRINTF1(_L("Underflow !"));
1063 else if (iExpectedEvent != aEventCode)
1065 if ((aEventCode == EMapcPlayComplete2))
1067 retFsmCheck = ETrue;
1068 if (iEventOccured == EMarncResourceAvailable1)
1074 iEventOccured = EMapcPlayComplete2;
1077 else if (aEventCode == EMarncResourceAvailable1)
1079 retFsmCheck = ETrue;
1080 if (iEventOccured == EMapcPlayComplete2)
1086 iEventOccured = EMarncResourceAvailable1;
1091 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1092 iTestStepResult = EFail;
1093 CActiveScheduler::Stop();
1096 else if (iExpectedError != aError)
1098 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1099 iTestStepResult = EFail;
1100 CActiveScheduler::Stop();
1104 retFsmCheck = ETrue;
1112 void CTestMmfAclntARN8106::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1114 if (FsmCheck(aEventCode, aError))
1116 TInt retErr = KErrNone;
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);
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);
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);
1143 case EStateErrInUsePlayer1:
1144 //Get Position of iTestAudioPlayer#1
1145 retErr = iTestAudioPlayer1->GetPosition(iPositionStop);
1146 INFO_PRINTF1(_L("iTestAudioPlayer1->GetPosition()"));
1147 if( retErr != KErrNone )
1149 ERR_PRINTF2(_L("iTestAudioPlayer1->GetPosition - Failed with Error : %d"), retErr);
1150 iTestStepResult = EFail;
1151 CActiveScheduler::Stop();
1154 // Register iTestAudioPlayer#1 for Notification
1155 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1156 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1157 if( retErr != KErrNone )
1159 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1160 iTestStepResult = EFail;
1161 CActiveScheduler::Stop();
1164 // Set ExpectedEvent and change the State
1165 StateChange(EStateEndPlay2, EMapcPlayComplete2);
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);
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)
1181 INFO_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position Matches, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
1182 iTestStepResult=EPass;
1186 ERR_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position does NOT Match, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
1187 iTestStepResult=EFail;
1197 TVerdict CTestMmfAclntARN8106::PerformTestL()
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;
1202 // Initialise the state variables
1205 // Begin the process
1206 FsmL(EIdlePlayer, KErrNone);
1208 // Start the scheduler - Done only once !
1209 CActiveScheduler::Start();
1211 return iTestStepResult;
1215 //CTestMmfAclntARN8107
1221 CTestMmfAclntARN8107::CTestMmfAclntARN8107(const TDesC& aTestName, const TDesC& aSectName)
1222 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1228 CTestMmfAclntARN8107* CTestMmfAclntARN8107::NewL(const TDesC& aTestName, const TDesC& aSectName)
1230 CTestMmfAclntARN8107* self = new (ELeave) CTestMmfAclntARN8107(aTestName, aSectName);
1237 TVerdict CTestMmfAclntARN8107::DoTestL()
1239 return( PerformTestL() );
1245 TBool CTestMmfAclntARN8107::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1247 TBool retFsmCheck = EFalse;
1248 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1250 INFO_PRINTF1(_L("Underflow !"));
1252 else if (iExpectedEvent != aEventCode)
1254 if ((aEventCode == EMapcPlayComplete2))
1256 retFsmCheck = ETrue;
1257 if (iEventOccured == EMarncResourceAvailable1)
1263 iEventOccured = EMapcPlayComplete2;
1266 else if (aEventCode == EMarncResourceAvailable1)
1268 retFsmCheck = ETrue;
1269 if (iEventOccured == EMapcPlayComplete2)
1275 iEventOccured = EMarncResourceAvailable1;
1280 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1281 iTestStepResult = EFail;
1282 CActiveScheduler::Stop();
1285 else if (iExpectedError != aError)
1287 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1288 iTestStepResult = EFail;
1289 CActiveScheduler::Stop();
1293 retFsmCheck = ETrue;
1301 void CTestMmfAclntARN8107::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1303 if (FsmCheck(aEventCode, aError))
1305 TInt retErr = KErrNone;
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);
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 )
1324 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1325 iTestStepResult = EFail;
1326 CActiveScheduler::Stop();
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);
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);
1342 case EStateErrInUsePlayer1:
1343 // Set ExpectedEvent and change the State
1344 StateChange(EStateEndPlay2, EMapcPlayComplete2);
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);
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 )
1359 ERR_PRINTF2(_L("iTestAudioPlayer1->WillResumePlay() - Failed with Error : %d"), retErr);
1360 iTestStepResult = EFail;
1361 CActiveScheduler::Stop();
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);
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);
1381 case EStateErrInUsePlayer1A:
1382 // Set ExpectedEvent and change the State
1383 StateChange(EStateEndPlay2A, EMapcPlayComplete2);
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);
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();
1404 TVerdict CTestMmfAclntARN8107::PerformTestL()
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;
1409 // Initialise the state variables
1412 // Begin the process
1413 FsmL(EIdlePlayer, KErrNone);
1415 // Start the scheduler - Done only once !
1416 CActiveScheduler::Start();
1418 return iTestStepResult;
1422 //CTestMmfAclntARN8108
1428 CTestMmfAclntARN8108* CTestMmfAclntARN8108::NewL(const TDesC& aTestName, const TDesC& aSectName)
1430 CTestMmfAclntARN8108* self = new (ELeave) CTestMmfAclntARN8108(aTestName, aSectName);
1437 CTestMmfAclntARN8108::CTestMmfAclntARN8108(const TDesC& aTestName, const TDesC& aSectName)
1438 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1445 TVerdict CTestMmfAclntARN8108::DoTestL()
1447 return( PerformTestL() );
1450 void CTestMmfAclntARN8108::DecideFsmState(TInt aClientNumber,CMultiEventChecker::TClientUtilityType aClientType, TInt aEventCode, TInt aError)
1452 if (iEventChecker->CheckFsm(aClientNumber, aClientType, aEventCode, aError))
1454 iTestStepResult = (this->*(iStateHandlers[iEventChecker->NextState()]))();
1455 if(iTestStepResult != EPass)
1457 iEventChecker->StopTest();
1462 void CTestMmfAclntARN8108::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1464 if (aEventCode == EMapcInitComplete1 || aEventCode == EMapcPlayComplete1 || aEventCode == EMarncResourceAvailable1)
1466 DecideFsmState(1,CMultiEventChecker::EAudioPlayer,aEventCode,aError);
1468 if (aEventCode == EMapcInitComplete2 || aEventCode == EMapcPlayComplete2 || aEventCode == EMarncResourceAvailable2)
1470 DecideFsmState(2,CMultiEventChecker::EAudioPlayer,aEventCode,aError);
1472 if (aEventCode == EMapcInitComplete3 || aEventCode == EMapcPlayComplete3 || aEventCode == EMarncResourceAvailable3)
1474 DecideFsmState(3,CMultiEventChecker::EAudioPlayer,aEventCode,aError);
1479 void CTestMmfAclntARN8108::InitTest()
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;
1491 void CTestMmfAclntARN8108::StartTestL()
1493 // Open iTestAudioPlayer#1
1494 iTestAudioPlayer1->OpenFileL(iFilename1);
1495 INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1496 iEventChecker->SetExpectedEvent(1,EMapcInitComplete1,KErrNone);
1497 iEventChecker->SetExpectedState(EStateOpenPlayer1);
1500 TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer1()
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 )
1511 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1512 iTestStepResult = EFail;
1513 CActiveScheduler::Stop();
1516 // Register iTestAudioPlayer#3 for Notification
1517 retErr = iTestAudioPlayer3->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport3, KMMFEventCategoryAudioResourceAvailable);
1518 INFO_PRINTF1(_L("iTestAudioPlayer3->RegisterAudioResourceNotification()"));
1519 if( retErr != KErrNone )
1521 ERR_PRINTF2(_L("iTestAudioPlayer3->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1522 iTestStepResult = EFail;
1523 CActiveScheduler::Stop();
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);
1535 TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer3()
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);
1545 TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer2()
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);
1555 TVerdict CTestMmfAclntARN8108::HandleStateErrInUsePlayer1()
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);
1566 TVerdict CTestMmfAclntARN8108::HandleStateErrInUsePlayer3()
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);
1582 TVerdict CTestMmfAclntARN8108::HandleStateNotifiedPlayer1()
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 )
1590 ERR_PRINTF2(_L("iTestAudioPlayer1->WillResumePlay() - Failed with Error : %d"), retErr);
1591 iTestStepResult = EFail;
1592 CActiveScheduler::Stop();
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();
1606 TVerdict CTestMmfAclntARN8108::HandleStateNotifiedPlayer3()
1608 INFO_PRINTF1(_L("iTestAudioPlayer3->NotificationReceived"));
1609 if(iEventChecker->IsMonitoringFinished())
1611 iTestStepResult = EPass;
1612 iCallBackTimer->Cancel();
1613 iEventChecker->StopTest();
1617 iEventChecker->EnableMultipleEventMonitor();
1622 TVerdict CTestMmfAclntARN8108::HandleStatePlaying1()
1624 INFO_PRINTF1(_L("iTestAudioPlayer1->AudioPlayerComplete"));
1625 iCallBackTimer->After(2000000);
1626 if(iEventChecker->IsMonitoringFinished())
1628 iTestStepResult = EPass;
1629 iCallBackTimer->Cancel();
1630 iEventChecker->StopTest();
1634 iEventChecker->EnableMultipleEventMonitor();
1639 TVerdict CTestMmfAclntARN8108::PerformTestL()
1641 INFO_PRINTF1(_L("Call WillResumePlay()."));
1642 iTestStepResult = EFail;
1644 // Initialise the handler functions
1647 // Initiate the process
1650 // Start the scheduler - Done only once !
1651 CActiveScheduler::Start();
1653 return iTestStepResult;
1658 //CTestMmfAclntARN8109
1664 CTestMmfAclntARN8109* CTestMmfAclntARN8109::NewL(const TDesC& aTestName, const TDesC& aSectName)
1666 CTestMmfAclntARN8109* self = new (ELeave) CTestMmfAclntARN8109(aTestName, aSectName);
1673 CTestMmfAclntARN8109::CTestMmfAclntARN8109(const TDesC& aTestName, const TDesC& aSectName)
1674 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName), iPlayComplete2(EFalse), iResourceAvailable1(EFalse)
1681 TVerdict CTestMmfAclntARN8109::DoTestL()
1683 return( PerformTestL() );
1686 * MapcPlayCompleteTest
1688 void CTestMmfAclntARN8109::MapcPlayCompleteTest(TInt aError, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1690 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1692 INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1693 TRAP(iError, FsmL(EMapcPlayComplete1, aError));
1695 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1697 INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1698 iPlayComplete2= ETrue;
1699 TRAP(iError, FsmL(EMapcPlayComplete2, aError));
1701 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1703 INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1704 TRAP(iError, FsmL(EMapcPlayComplete3, aError));
1710 * MarncResourceAvailableTest
1712 void CTestMmfAclntARN8109::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1714 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
1716 INFO_PRINTF1(_L("iAudioPlayer::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable"));
1718 //Convert TDesc8 to TInt64
1719 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf;
1720 timeIntvbuf.Copy(aNotificationData);
1721 TTimeIntervalMicroSeconds intPos = timeIntvbuf();
1723 if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1725 INFO_PRINTF1(_L("iAudioPlayer1 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable..waiting for playcomplete"));
1726 iResourceAvailable1 = ETrue;
1727 TRAP(iError, FsmL(EMarncResourceAvailable1, KErrNone));
1729 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1731 INFO_PRINTF1(_L("iAudioPlayer2 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
1732 TRAP(iError, FsmL(EMarncResourceAvailable2, KErrNone));
1734 else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1736 INFO_PRINTF1(_L("iAudioPlayer3 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
1737 TRAP(iError, FsmL(EMarncResourceAvailable3, KErrNone));
1742 INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable"));
1749 TBool CTestMmfAclntARN8109::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1751 TBool retFsmCheck = EFalse;
1752 if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1754 INFO_PRINTF1(_L("Underflow !"));
1756 else if (iExpectedEvent != aEventCode)
1758 if(aEventCode == EMarncResourceAvailable1)
1760 retFsmCheck = EFalse;
1764 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1765 iTestStepResult = EFail;
1766 CActiveScheduler::Stop();
1769 else if (iExpectedError != aError)
1771 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1772 iTestStepResult = EFail;
1773 CActiveScheduler::Stop();
1777 retFsmCheck = ETrue;
1784 void CTestMmfAclntARN8109::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1786 if (FsmCheck(aEventCode, aError))
1788 TTimeIntervalMicroSeconds silence(0); // 3 sec of silence
1789 TInt retErr = KErrNone;
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);
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 )
1809 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1810 iTestStepResult = EFail;
1811 CActiveScheduler::Stop();
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);
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()"));
1828 iTestAudioPlayer2->Play();
1830 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1831 // Set ExpectedEvent and change the State
1832 StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1834 case EStateErrInUsePlayer1:
1835 // Set ExpectedEvent and change the State
1836 StateChange(EStateEndPlay2, EMapcPlayComplete2);
1838 case EStateEndPlay2:
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)
1846 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1847 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1848 KExpectedDeviation))
1850 iCallBackTimer->Cancel(); // in case something else stopped the AS
1851 INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1852 iTestStepResult = EPass;
1853 CActiveScheduler::Stop();
1857 iTestStepResult = EFail;
1858 CActiveScheduler::Stop();
1861 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1862 KExpectedDeviation*NUMBER_OF_REPEATS))
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.
1872 iTestStepResult = EFail;
1873 CActiveScheduler::Stop();
1877 else if(iPlayComplete2 && ! iResourceAvailable1)
1879 #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1880 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1881 KExpectedDeviation))
1883 // Timer to check if Notification Event Occurs.
1884 iCallBackTimer->After(2000000);
1885 // Set ExpectedEvent and change the State
1886 StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1890 iTestStepResult = EFail;
1891 CActiveScheduler::Stop();
1894 if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1895 KExpectedDeviation*NUMBER_OF_REPEATS))
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.
1905 iTestStepResult = EFail;
1906 CActiveScheduler::Stop();
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();
1920 TBool CTestMmfAclntARN8109::TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDeviation)
1922 // save unnessary conditions
1923 if(aActual == aExpected)
1926 // Prevent unsigned wrapping errors
1928 if(aActual > aExpected)
1929 difference = aActual - aExpected;
1931 difference = aExpected - aActual;
1934 if(difference < aDeviation)
1941 TVerdict CTestMmfAclntARN8109::PerformTestL()
1943 INFO_PRINTF1(_L("High priority client plays with repeats and low priority client doesn't get resources."));
1944 iTestStepResult = EFail;
1946 // Initialise the state variables
1949 // Begin the process
1950 FsmL(EIdlePlayer, KErrNone);
1952 // Start the scheduler - Done only once !
1953 CActiveScheduler::Start();
1955 return iTestStepResult;
1960 //CTestMmfAclntARN8110 //test to cover CR id:
1966 CTestMmfAclntARN8110::CTestMmfAclntARN8110(const TDesC& aTestName, const TDesC& aSectName)
1967 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1973 CTestMmfAclntARN8110* CTestMmfAclntARN8110::NewL(const TDesC& aTestName, const TDesC& aSectName)
1975 CTestMmfAclntARN8110* self = new (ELeave) CTestMmfAclntARN8110(aTestName, aSectName);
1982 TVerdict CTestMmfAclntARN8110::DoTestL()
1984 return( PerformTestL() );
1990 void CTestMmfAclntARN8110::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1992 if (FsmCheck(aEventCode, aError))
1994 TTimeIntervalMicroSeconds32 wait2secs(2000000);
1995 TTimeIntervalMicroSeconds oneNhalf(MAKE_TINT64(0,1500000));
1996 TInt retErr = KErrNone;
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);
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);
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);
2024 case EStateErrInUsePlayer1:
2025 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
2026 if(retErr != KErrNone)
2028 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
2029 iTestStepResult = EFail;
2030 CActiveScheduler::Stop();
2033 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
2034 //using 1.5 sec for comparison as sometimes playback is slow.
2035 if(iPlayer1Pos < oneNhalf)
2037 iTestStepResult = EFail;
2038 CActiveScheduler::Stop();
2041 // Set ExpectedEvent and change the State
2042 StateChange(EStateEndPlay2, EMapcPlayComplete2 );
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)
2052 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
2053 iTestStepResult = EFail;
2054 CActiveScheduler::Stop();
2057 if(pos == 0 || pos != iPlayer1Pos )
2059 iTestStepResult = EFail;
2060 CActiveScheduler::Stop();
2063 iTestAudioPlayer1->Play();
2064 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
2065 retErr = iTestAudioPlayer1->GetPosition(pos);
2066 if(retErr != KErrNone)
2068 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
2069 iTestStepResult = EFail;
2070 CActiveScheduler::Stop();
2073 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
2074 if(pos < iPlayer1Pos)
2076 iTestStepResult = EFail;
2077 CActiveScheduler::Stop();
2080 iTestAudioPlayer1->Stop();
2081 INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()"));
2082 iTestStepResult = EPass;
2083 CActiveScheduler::Stop();
2084 // Set ExpectedEvent and change the State
2093 TVerdict CTestMmfAclntARN8110::PerformTestL()
2095 INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
2096 iTestStepResult = EFail;
2098 // Initialise the state variables
2101 // Begin the process
2102 FsmL(EIdlePlayer, KErrNone);
2104 // Start the scheduler - Done only once !
2105 CActiveScheduler::Start();
2107 return iTestStepResult;
2112 //CTestMmfAclntARN8111 //test to cover CR id:
2118 CTestMmfAclntARN8111::CTestMmfAclntARN8111(const TDesC& aTestName, const TDesC& aSectName)
2119 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
2125 CTestMmfAclntARN8111* CTestMmfAclntARN8111::NewL(const TDesC& aTestName, const TDesC& aSectName)
2127 CTestMmfAclntARN8111* self = new (ELeave) CTestMmfAclntARN8111(aTestName, aSectName);
2134 TVerdict CTestMmfAclntARN8111::DoTestL()
2136 return( PerformTestL() );
2142 void CTestMmfAclntARN8111::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
2144 if (FsmCheck(aEventCode, aError))
2146 TTimeIntervalMicroSeconds32 wait2secs(2000000);
2147 TTimeIntervalMicroSeconds oneNhalf(MAKE_TINT64(0,1500000));
2148 TTimeIntervalMicroSeconds zeroSecs(MAKE_TINT64(0,0));
2149 TInt retErr = KErrNone;
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);
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);
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);
2177 case EStateErrInUsePlayer1:
2178 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
2179 if(retErr != KErrNone)
2181 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
2182 iTestStepResult = EFail;
2183 CActiveScheduler::Stop();
2186 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
2187 //using 1.5 sec for comparison as sometimes playback is slow.
2188 if(iPlayer1Pos < oneNhalf)
2190 iTestStepResult = EFail;
2191 CActiveScheduler::Stop();
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)
2200 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
2201 iTestStepResult = EFail;
2202 CActiveScheduler::Stop();
2205 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
2206 if(iPlayer1Pos != zeroSecs)
2208 iTestStepResult = EFail;
2209 CActiveScheduler::Stop();
2212 // Set ExpectedEvent and change the State
2213 StateChange(EStateEndPlay2, EMapcPlayComplete2 );
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
2233 TVerdict CTestMmfAclntARN8111::PerformTestL()
2235 INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
2236 iTestStepResult = EFail;
2238 // Initialise the state variables
2241 // Begin the process
2242 FsmL(EIdlePlayer, KErrNone);
2244 // Start the scheduler - Done only once !
2245 CActiveScheduler::Start();
2247 return iTestStepResult;
2251 //CTestMmfAclntARN8112 //test to cover CR id:
2257 CTestMmfAclntARN8112::CTestMmfAclntARN8112(const TDesC& aTestName, const TDesC& aSectName)
2258 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
2264 CTestMmfAclntARN8112* CTestMmfAclntARN8112::NewL(const TDesC& aTestName, const TDesC& aSectName)
2266 CTestMmfAclntARN8112* self = new (ELeave) CTestMmfAclntARN8112(aTestName, aSectName);
2273 TVerdict CTestMmfAclntARN8112::DoTestL()
2275 return( PerformTestL() );
2281 void CTestMmfAclntARN8112::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
2283 if (FsmCheck(aEventCode, aError))
2285 TTimeIntervalMicroSeconds32 wait1secs(1000000);
2286 TTimeIntervalMicroSeconds zeroSecs(MAKE_TINT64(0,0));
2287 TInt retErr = KErrNone;
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);
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);
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);
2315 case EStateErrInUsePlayer1:
2316 retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
2317 if(retErr != KErrNone)
2319 ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
2320 iTestStepResult = EFail;
2321 CActiveScheduler::Stop();
2324 INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
2325 if(iPlayer1Pos != zeroSecs)
2327 iTestStepResult = EFail;
2328 CActiveScheduler::Stop();
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()"));
2337 // Set ExpectedEvent and change the State
2338 StateChange(EStateEndPlay1, EMapcPlayComplete1 );
2340 case EStateEndPlay1:
2341 iTestStepResult = EPass;
2342 // Play iTestAudioPlayer#1 again
2343 CActiveScheduler::Stop();
2344 // Set ExpectedEvent and change the State
2353 TVerdict CTestMmfAclntARN8112::PerformTestL()
2355 INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
2356 iTestStepResult = EFail;
2358 // Initialise the state variables
2361 // Begin the process
2362 FsmL(EIdlePlayer, KErrNone);
2364 // Start the scheduler - Done only once !
2365 CActiveScheduler::Start();
2367 return iTestStepResult;
2375 //CTestMmfAclntARN1301
2381 CTestMmfAclntARN1301::CTestMmfAclntARN1301(const TDesC& aTestName, const TDesC& aSectName)
2382 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
2388 CTestMmfAclntARN1301* CTestMmfAclntARN1301::NewL(const TDesC& aTestName, const TDesC& aSectName)
2390 CTestMmfAclntARN1301* self = new (ELeave) CTestMmfAclntARN1301(aTestName, aSectName);
2397 TVerdict CTestMmfAclntARN1301::DoTestL()
2399 return( PerformTestL() );
2405 void CTestMmfAclntARN1301::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
2407 if (FsmCheck(aEventCode, aError))
2409 TInt retErr = KErrNone;
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);
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 )
2425 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Returned KErrNotSupported ") );
2426 iTestStepResult = EPass;
2430 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2431 iTestStepResult = EFail;
2433 CActiveScheduler::Stop();
2442 TVerdict CTestMmfAclntARN1301::PerformTestL()
2444 INFO_PRINTF1(_L("Register for notification with an unsupported event type."));
2445 iTestStepResult = EFail;
2447 // Initialise the state variables
2450 // Begin the process
2451 FsmL(EIdlePlayer, KErrNone);
2453 // Start the scheduler - Done only once !
2454 CActiveScheduler::Start();
2456 return iTestStepResult;
2460 //CTestMmfAclntARN1302
2466 CTestMmfAclntARN1302::CTestMmfAclntARN1302(const TDesC& aTestName, const TDesC& aSectName)
2467 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
2473 CTestMmfAclntARN1302* CTestMmfAclntARN1302::NewL(const TDesC& aTestName, const TDesC& aSectName)
2475 CTestMmfAclntARN1302* self = new (ELeave) CTestMmfAclntARN1302(aTestName, aSectName);
2482 TVerdict CTestMmfAclntARN1302::DoTestL()
2484 return( PerformTestL() );
2490 void CTestMmfAclntARN1302::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
2492 if (FsmCheck(aEventCode, aError))
2494 TInt retErr = KErrNone;
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);
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 )
2510 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2511 iTestStepResult = EFail;
2512 CActiveScheduler::Stop();
2515 // Cancel notification for iTestAudioPlayer#1
2516 retErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete);
2517 INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete)"));
2518 if( retErr == KErrNotSupported )
2520 ERR_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Returned KErrNotSupported ") );
2521 iTestStepResult = EPass;
2525 ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2526 iTestStepResult = EFail;
2528 CActiveScheduler::Stop();
2537 TVerdict CTestMmfAclntARN1302::PerformTestL()
2539 INFO_PRINTF1(_L("Cancel the request for notification with an unsupported event type."));
2540 iTestStepResult = EFail;
2542 // Initialise the state variables
2545 // Begin the process
2546 FsmL(EIdlePlayer, KErrNone);
2548 // Start the scheduler - Done only once !
2549 CActiveScheduler::Start();
2551 return iTestStepResult;
2555 //CTestMmfAclntARN1303
2561 CTestMmfAclntARN1303::CTestMmfAclntARN1303(const TDesC& aTestName, const TDesC& aSectName)
2562 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
2568 CTestMmfAclntARN1303* CTestMmfAclntARN1303::NewL(const TDesC& aTestName, const TDesC& aSectName)
2570 CTestMmfAclntARN1303* self = new (ELeave) CTestMmfAclntARN1303(aTestName, aSectName);
2577 TVerdict CTestMmfAclntARN1303::DoTestL()
2579 return( PerformTestL() );
2585 void CTestMmfAclntARN1303::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
2587 if (FsmCheck(aEventCode, aError))
2589 TInt retErr = KErrNone;
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);
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 )
2605 ERR_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Returned KErrCancel ") );
2606 iTestStepResult = EPass;
2610 ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2611 iTestStepResult = EFail;
2613 CActiveScheduler::Stop();
2622 TVerdict CTestMmfAclntARN1303::PerformTestL()
2624 INFO_PRINTF1(_L("Cancel when no resource Notification is requested."));
2625 iTestStepResult = EFail;
2627 // Initialise the state variables
2630 // Begin the process
2631 FsmL(EIdlePlayer, KErrNone);
2633 // Start the scheduler - Done only once !
2634 CActiveScheduler::Start();
2636 return iTestStepResult;
2640 //CTestMmfAclntARN1304
2646 CTestMmfAclntARN1304::CTestMmfAclntARN1304(const TDesC& aTestName, const TDesC& aSectName)
2647 : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
2653 CTestMmfAclntARN1304* CTestMmfAclntARN1304::NewL(const TDesC& aTestName, const TDesC& aSectName)
2655 CTestMmfAclntARN1304* self = new (ELeave) CTestMmfAclntARN1304(aTestName, aSectName);
2662 TVerdict CTestMmfAclntARN1304::DoTestL()
2664 return( PerformTestL() );
2670 void CTestMmfAclntARN1304::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
2672 if (FsmCheck(aEventCode, aError))
2674 TInt retErr = KErrNone;
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);
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 )
2690 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #1 - Failed with Error : %d"), retErr);
2691 iTestStepResult = EFail;
2692 CActiveScheduler::Stop();
2695 // Register iTestAudioPlayer#1 for Notification (AGAIN)
2696 retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
2697 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()#2"));
2698 if( retErr == KErrAlreadyExists )
2700 INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #2 - Returned KErrAlreadyExists ") );
2701 iTestStepResult = EPass;
2705 ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #2 - Failed with Error : %d"), retErr);
2706 iTestStepResult = EFail;
2708 CActiveScheduler::Stop();
2717 TVerdict CTestMmfAclntARN1304::PerformTestL()
2719 INFO_PRINTF1(_L("Multiple Registration for notification for the same event type."));
2720 iTestStepResult = EFail;
2722 // Initialise the state variables
2725 // Begin the process
2726 FsmL(EIdlePlayer, KErrNone);
2728 // Start the scheduler - Done only once !
2729 CActiveScheduler::Start();
2731 return iTestStepResult;