First public contribution.
1 // Copyright (c) 2006-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 Video Player.
19 @file testvideoplayer_apr.cpp
22 #include "testvideoplayer_apr.h"
23 const TUint KCacheSize = 1000000; //1MB
24 const TUint KMaxCacheSize = 30000000; //20MB
27 //------------------------------------------------------------------------------
28 //******************** CR 0805 - Auto Pause Resume for video client********************
29 //------------------------------------------------------------------------------
32 * Standard static NewL() taking a callback function
34 CCallBackTimer* CCallBackTimer::NewL(TCallBack aCallBack, TPriority aPriority)
36 CCallBackTimer* self = new(ELeave) CCallBackTimer(aCallBack, aPriority);
37 CleanupStack::PushL(self);
39 CleanupStack::Pop(); // self
46 CCallBackTimer::CCallBackTimer(TCallBack aCallBack, TPriority aPriority)
50 CActiveScheduler::Add(this);
54 * Callback on timer complete
56 void CCallBackTimer::RunL()
62 //CTestAVPlayerAPRCallbackSupport
68 CTestAVPlayerAPRCallbackSupport* CTestAVPlayerAPRCallbackSupport::NewL(MTestAVPlayerAPRCallback& aCallback)
70 return new(ELeave) CTestAVPlayerAPRCallbackSupport(aCallback);
76 void CTestAVPlayerAPRCallbackSupport::MvpuoOpenComplete(TInt aError)
78 iCallback.MvpuoOpenCompleteTest(aError, *this);
82 * MvpuoPrepareComplete
84 void CTestAVPlayerAPRCallbackSupport::MvpuoPrepareComplete(TInt aError)
86 iCallback.MvpuoPrepareCompleteTest(aError, *this);
92 void CTestAVPlayerAPRCallbackSupport::MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError)
94 iCallback.MvpuoFrameReadyTest(aFrame, aError, *this);
100 void CTestAVPlayerAPRCallbackSupport::MvpuoPlayComplete(TInt aError)
102 iCallback.MvpuoPlayCompleteTest(aError, *this);
108 void CTestAVPlayerAPRCallbackSupport::MvpuoEvent(const TMMFEvent &aEvent)
110 iCallback.MvpuoEventTest(aEvent, *this);
116 void CTestAVPlayerAPRCallbackSupport::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
118 iCallback.MapcInitCompleteTest(aError, aDuration, *this);
124 void CTestAVPlayerAPRCallbackSupport::MapcPlayComplete(TInt aError)
126 iCallback.MapcPlayCompleteTest(aError, *this);
130 * MarncResourceAvailable
132 void CTestAVPlayerAPRCallbackSupport::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData)
134 iCallback.MarncResourceAvailableTest(aNotificationEventId, aNotificationData, *this);
140 CTestAVPlayerAPRCallbackSupport::CTestAVPlayerAPRCallbackSupport(MTestAVPlayerAPRCallback& aCallback):iCallback(aCallback)
146 //RTestMmfVclntVideoPlayerAPR
152 RTestMmfVclntVideoPlayerAPR::RTestMmfVclntVideoPlayerAPR(const TDesC& aTestName, const TDesC& aSectName)
153 :RTestMmfVclntAviStep(aTestName, aSectName, _L(""), KErrNone)
161 * MvpuoOpenCompleteTest
163 void RTestMmfVclntVideoPlayerAPR::MvpuoOpenCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aVideoPlayerCallbackSupport)
165 if (&aVideoPlayerCallbackSupport == iVideoPlayerCallbackSupport1)
167 INFO_PRINTF2(_L("iVideoPlayer -> MMdaVideoPlayerCallback OpenComplete (%d)"), aError);
168 Fsm(EMvpuoOpenComplete, aError);
173 * MvpuoPrepareCompleteTest
175 void RTestMmfVclntVideoPlayerAPR::MvpuoPrepareCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aVideoPlayerCallbackSupport)
177 if (&aVideoPlayerCallbackSupport == iVideoPlayerCallbackSupport1)
179 INFO_PRINTF2(_L("iVideoPlayer -> MMdaVideoPlayerCallback PrepareComplete (%d)"), aError);
180 Fsm(EMvpuoPrepareComplete, aError);
184 * MvpuoFrameReadyTest
186 void RTestMmfVclntVideoPlayerAPR::MvpuoFrameReadyTest(CFbsBitmap &/*aFrame*/, TInt aError, CTestAVPlayerAPRCallbackSupport& aVideoPlayerCallbackSupport)
188 if (&aVideoPlayerCallbackSupport == iVideoPlayerCallbackSupport1)
190 INFO_PRINTF2(_L("iVideoPlayer -> MMdaVideoPlayerCallback FrameReady (%d)"), aError);
191 Fsm(EMvpuoFrameReady, aError);
195 * MvpuoPlayCompleteTest
197 void RTestMmfVclntVideoPlayerAPR::MvpuoPlayCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aVideoPlayerCallbackSupport)
199 if (&aVideoPlayerCallbackSupport == iVideoPlayerCallbackSupport1)
201 Fsm(EMvpuoPlayComplete, aError);
207 void RTestMmfVclntVideoPlayerAPR::MvpuoEventTest(const TMMFEvent &aEvent, CTestAVPlayerAPRCallbackSupport& aVideoPlayerCallbackSupport)
209 if (&aVideoPlayerCallbackSupport == iVideoPlayerCallbackSupport1)
211 INFO_PRINTF2(_L("iVideoPlayer -> MMdaVideoPlayerCallback Event (%d)"), aEvent.iErrorCode);
212 Fsm(EMvpuoEvent, aEvent.iErrorCode);
217 * MapcInitCompleteTest
219 void RTestMmfVclntVideoPlayerAPR::MapcInitCompleteTest(TInt aError, const TTimeIntervalMicroSeconds &/*aDuration*/, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)
221 if (&aMdaVideoPlayerCallbackSupport == iAudioPlayerCallbackSupport1)
223 Fsm(EMapcInitComplete1, aError);
225 else if (&aMdaVideoPlayerCallbackSupport == iAudioPlayerCallbackSupport2)
227 Fsm(EMapcInitComplete2, aError);
232 * MapcPlayCompleteTest
234 void RTestMmfVclntVideoPlayerAPR::MapcPlayCompleteTest(TInt aError, CTestAVPlayerAPRCallbackSupport& aMdaVideoPlayerCallbackSupport)
236 if (&aMdaVideoPlayerCallbackSupport == iAudioPlayerCallbackSupport1)
238 Fsm(EMapcPlayComplete1, aError);
240 else if (&aMdaVideoPlayerCallbackSupport == iAudioPlayerCallbackSupport2)
242 Fsm(EMapcPlayComplete2, aError);
247 * MarncResourceAvailableTest
249 void RTestMmfVclntVideoPlayerAPR::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestAVPlayerAPRCallbackSupport& aVideoPlayerCallbackSupport)
251 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
253 //Convert TDesc8 to TInt64
254 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf;
255 timeIntvbuf.Copy(aNotificationData);
256 TTimeIntervalMicroSeconds intPos = timeIntvbuf();
259 if (&aVideoPlayerCallbackSupport == iVideoPlayerCallbackSupport1)
261 Fsm(EMarncResourceAvailable1, KErrNone);
263 else if (&aVideoPlayerCallbackSupport == iAudioPlayerCallbackSupport1)
265 Fsm(EMarncResourceAvailable2, KErrNone);
267 else if (&aVideoPlayerCallbackSupport == iAudioPlayerCallbackSupport2)
269 Fsm(EMarncResourceAvailable3, KErrNone);
274 INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable"));
281 TVerdict RTestMmfVclntVideoPlayerAPR::DoTestStepCreateL()
284 TVerdict ret = EPass;
285 TRect rect, clipRect;
286 //WDP::Increase cache size for paging, else we spend time thrashing
289 return EInconclusive;
292 // Get Video file name
293 if(!GetStringFromConfig(iSectName, _L("VideoFile1"), filename))
295 return EInconclusive;
297 GetDriveName(iFilename1);
298 iFilename1.Append(filename);
300 // Initialise Video Player
301 INFO_PRINTF2(_L("Initialise CVideoPlayerUtility : %S, EMdaPriorityNormal"), &iFilename1);
302 iVideoPlayerCallbackSupport1 = CTestAVPlayerAPRCallbackSupport::NewL(*this);
303 CleanupStack::PushL(iVideoPlayerCallbackSupport1);
304 iTestVideoPlayer = CVideoPlayerUtility::NewL(*iVideoPlayerCallbackSupport1, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality, iWs, *iScreen, *iWindow, rect, clipRect);
305 CleanupStack::PushL(iTestVideoPlayer);
307 // Get 1st Audio file name
308 if(!GetStringFromConfig(iSectName, _L("AudioFile1"), filename))
310 return EInconclusive;
312 GetDriveName(iFilename2);
313 iFilename2.Append(filename);
315 // Initialise 1st Audio Player
316 INFO_PRINTF2(_L("Initialise CMdaAudioPlayerUtility1 : %S, EMdaPriorityMax"), &iFilename2);
317 iAudioPlayerCallbackSupport1 = CTestAVPlayerAPRCallbackSupport::NewL(*this);
318 CleanupStack::PushL(iAudioPlayerCallbackSupport1);
319 iTestAudioPlayer1 = CMdaAudioPlayerUtility::NewL(*iAudioPlayerCallbackSupport1, EMdaPriorityMax);
320 CleanupStack::PushL(iTestAudioPlayer1);
322 // Get 2nd Audio file name
323 if(!GetStringFromConfig(iSectName, _L("AudioFile2"), filename))
325 return EInconclusive;
327 GetDriveName(iFilename3);
328 iFilename3.Append(filename);
330 // Initialise 2nd Audio Player
331 INFO_PRINTF2(_L("Initialise CMdaAudioPlayerUtility2 : %S, EMdaPriorityMin"), &iFilename3);
332 iAudioPlayerCallbackSupport2 = CTestAVPlayerAPRCallbackSupport::NewL(*this);
333 CleanupStack::PushL(iAudioPlayerCallbackSupport2);
334 iTestAudioPlayer2 = CMdaAudioPlayerUtility::NewL(*iAudioPlayerCallbackSupport2, EMdaPriorityMin);
335 CleanupStack::PushL(iTestAudioPlayer2);
337 // Initialise the CCallBackTimer.
338 iCallBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler));
340 // pop all the items from the stack in case of no errors.#
341 CleanupStack::Pop(6);
348 TVerdict RTestMmfVclntVideoPlayerAPR::DoTestStepDeleteL()
350 // Delete all the AudioPlayer and VideoPlayer utilities.
351 iTestVideoPlayer->Close();
352 delete iTestVideoPlayer;
353 iTestVideoPlayer=NULL;
354 iTestAudioPlayer1->Close();
355 delete iTestAudioPlayer1;
356 iTestAudioPlayer1=NULL;
357 iTestAudioPlayer2->Close();
358 delete iTestAudioPlayer2;
359 iTestAudioPlayer2=NULL;
360 // Delete CTestAVPlayerAPRCallbackSupport
361 delete iVideoPlayerCallbackSupport1;
362 delete iAudioPlayerCallbackSupport1;
363 delete iAudioPlayerCallbackSupport2;
364 // Delete the CCallBackTimer.
365 delete iCallBackTimer;
374 TVerdict RTestMmfVclntVideoPlayerAPR::DoTestStepL()
376 TVerdict ret = EPass;
380 TUint defaultCacheSize = 0;
381 //Done with the test. Setting 0 makes the cache size revert back to boot up values
382 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)defaultCacheSize,(TAny*)defaultCacheSize);
383 if(CheckCacheError(error))
385 INFO_PRINTF1(_L("Could not revert the cache size to default"));
396 void RTestMmfVclntVideoPlayerAPR::StateInit()
398 iCanStateChange = EFalse;
399 for (TInt i=0; i< KMaxEvents; i++)
401 iExpectedEvent[i] = EIdlePlayer;
402 iExpectedError[i] = KErrNone;
404 iState = EStateBegin;
410 void RTestMmfVclntVideoPlayerAPR::StateChange(TAVPlayerAPRState aState, TAVPlayerAPREvents aExpectedEvent, TInt aExpectedError, TInt aEventIndex)
412 iCanStateChange = EFalse;
413 iExpectedEvent[aEventIndex-1] = aExpectedEvent;
414 iExpectedError[aEventIndex-1] = aExpectedError;
422 TBool RTestMmfVclntVideoPlayerAPR::FsmCheck(TAVPlayerAPREvents aEventCode, TInt aError)
424 TBool retFsmCheck = EFalse;
425 #ifndef SYMBIAN_VARIABLE_BITRATE_CODEC
426 if((aEventCode == EMvpuoOpenComplete) && (aError == KErrNotSupported))
428 iTestStepResult = EKnownFailure;
429 INFO_PRINTF1(_L("The AVI Play Controller is not available in this OS version, hence KNOWN FAILURE"));
430 CActiveScheduler::Stop();
434 if (aError == KErrNoMemory)
436 // Added to enable Alloc tests with Use Client heap...
438 iTestStepResult = EFail;
439 CActiveScheduler::Stop();
443 // analyse if we can go to the next state.
444 TInt analysisError = 0;
445 analysisError = AnalyseInput(aEventCode, aError);
446 if (analysisError == -1)
449 iTestStepResult = EFail;
450 CActiveScheduler::Stop();
462 * returns 1 = it can move to a new state
463 * returns 0 = still waiting for more events
464 * returns -1 = some error has occured
466 TInt RTestMmfVclntVideoPlayerAPR::AnalyseInput(TAVPlayerAPREvents aEventCode, TInt aError)
469 TBool matchFound = EFalse;
470 for(TInt i = 0; i < iExpEventCount; i++)
472 //check for client and event.
473 if((iExpectedEvent[i] == aEventCode) && (iExpectedError[i] == aError))
481 if(matchFound == EFalse)
483 for(TInt i = 0; i < iExpEventCount; i++)
485 //check for client and event.
486 ERR_PRINTF5(_L("Expectedevent[%d]=%d, Actualevent[%d]=%d"), i, iExpectedEvent[i], i, aEventCode);
487 ERR_PRINTF5(_L("Expectederror[%d]=%d, Actualerror[%d]=%d"), i, iExpectedError[i], i, aError);
492 if(iActEventCount == iExpEventCount)
494 iCanStateChange = ETrue;
495 // Reset the event counters, for processing next event.
501 iCanStateChange = EFalse;
507 TInt RTestMmfVclntVideoPlayerAPR::SetCacheSize()
509 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize);
510 TInt ret=CheckCacheError(error);
515 TInt RTestMmfVclntVideoPlayerAPR::CheckCacheError(TInt aError)
519 //Winscw does not support getting cache size. Ignoring -5 error
522 if(aError!=KErrNotSupported)
524 INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
530 {//For ARMV5 we stop for all errors
531 INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
544 //RTestVclntAprRegOnce4SameEvent (MM-MMF-VCLNTAVIAPR-I-0001-HP)
550 RTestVclntAprRegOnce4SameEvent::RTestVclntAprRegOnce4SameEvent(const TDesC& aTestName, const TDesC& aSectName)
551 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
557 RTestVclntAprRegOnce4SameEvent* RTestVclntAprRegOnce4SameEvent::NewL(const TDesC& aTestName, const TDesC& aSectName)
559 RTestVclntAprRegOnce4SameEvent* self = new (ELeave) RTestVclntAprRegOnce4SameEvent(aTestName, aSectName);
566 TVerdict RTestVclntAprRegOnce4SameEvent::DoTestL()
568 TVerdict testResult = EFail;
569 TRAPD(err, testResult = PerformTestL());
570 User::LeaveIfError(err);
577 void RTestVclntAprRegOnce4SameEvent::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
579 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
581 TInt retErr = KErrNone;
586 // Open iTestVideoPlayer
587 if (iBinaryCompatibility)
589 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
593 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
596 if( iError != KErrNone )
598 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
599 iTestStepResult = EFail;
600 CActiveScheduler::Stop();
603 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
606 case EStateOpenVideoPlayer:
608 // Prepare iTestVideoPlayer
609 iTestVideoPlayer->Prepare();
610 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
611 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
614 case EStatePrepareVideoPlayer:
616 // Play iTestVideoPlayer
617 iTestVideoPlayer->Play();
618 // Open iTestAudioPlayer1
619 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
620 if( iError != KErrNone )
622 iTestStepResult = EFail;
623 CActiveScheduler::Stop();
626 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
629 case EStateOpenAudioPlayer1:
631 // Play iTestAudioPlayer#1
632 iTestAudioPlayer1->Play();
633 // Set ExpectedEvent and change the State
634 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
637 case EStateErrInUseVideoPlayer:
639 // Register iTestVideoPlayer for Notification
640 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
641 if( retErr != KErrNone )
643 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
644 iTestStepResult = EFail;
645 CActiveScheduler::Stop();
648 // Set ExpectedEvent and change the State
650 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1, KErrNone, 1);
651 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1, KErrNone, 2);
654 case EStateEndAudioPlay1:
656 INFO_PRINTF1(_L("iTestVideoPlayer-> Received Notification 1st time"));
657 iTestVideoPlayer->Play();
659 INFO_PRINTF1(_L("iTestVideoPlayer->Play() - Again"));
661 iTestAudioPlayer1->Play();
662 StateChange(EStateErrInUseVideoPlayer1A, EMvpuoPlayComplete, KErrInUse);
665 case EStateErrInUseVideoPlayer1A:
667 // Set ExpectedEvent and change the State
669 StateChange(EStateNotifiedVideoPlayer1A, EMarncResourceAvailable1, KErrNone, 1);
670 StateChange(EStateEndAudioPlay1A, EMapcPlayComplete1, KErrNone, 2);
673 case EStateEndAudioPlay1A:
675 // we have received all the events, so pass the test
676 INFO_PRINTF1(_L("iTestVideoPlayer-> Received Notification 2nd time"));
677 iTestStepResult = EPass;
678 CActiveScheduler::Stop();
688 TVerdict RTestVclntAprRegOnce4SameEvent::PerformTestL()
690 INFO_PRINTF1(_L("Register Once for same event"));
691 iTestStepResult = EFail;
693 // Initialise the state variables
697 Fsm(EIdlePlayer, KErrNone);
699 // Start the scheduler - Done only once !
700 CActiveScheduler::Start();
702 User::LeaveIfError(iError);
704 return iTestStepResult;
708 //RTestVclntAprRegB4Open (MM-MMF-VCLNTAVIAPR-I-0002-HP)
714 RTestVclntAprRegB4Open::RTestVclntAprRegB4Open(const TDesC& aTestName, const TDesC& aSectName)
715 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
721 RTestVclntAprRegB4Open* RTestVclntAprRegB4Open::NewL(const TDesC& aTestName, const TDesC& aSectName)
723 RTestVclntAprRegB4Open* self = new (ELeave) RTestVclntAprRegB4Open(aTestName, aSectName);
730 TVerdict RTestVclntAprRegB4Open::DoTestL()
732 TVerdict testResult = EFail;
733 TRAPD(err, testResult = PerformTestL());
734 User::LeaveIfError(err);
741 void RTestVclntAprRegB4Open::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
743 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
745 TInt retErr = KErrNone;
750 // Register iTestVideoPlayer for Notification
751 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
752 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
753 if( retErr != KErrNone )
755 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
756 iTestStepResult = EFail;
757 CActiveScheduler::Stop();
760 // Open iTestVideoPlayer
761 if (iBinaryCompatibility)
763 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
767 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
770 if( iError != KErrNone )
772 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
773 iTestStepResult = EFail;
774 CActiveScheduler::Stop();
777 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
780 case EStateOpenVideoPlayer:
782 // Prepare iTestVideoPlayer
783 iTestVideoPlayer->Prepare();
784 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
785 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
788 case EStatePrepareVideoPlayer:
790 // Open iTestAudioPlayer1
791 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
792 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
793 if( iError != KErrNone )
795 iTestStepResult = EFail;
796 CActiveScheduler::Stop();
799 // Set ExpectedEvent and change the State
800 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
803 case EStateOpenAudioPlayer1:
805 // Play iTestAudioPlayer#1
806 iTestAudioPlayer1->Play();
807 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
808 // Play iTestVideoPlayer
809 iTestVideoPlayer->Play();
810 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
811 // Set ExpectedEvent and change the State
812 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
815 case EStateErrInUseVideoPlayer:
817 // Set ExpectedEvent and change the State
819 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1, KErrNone, 1);
820 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1, KErrNone, 2);
823 case EStateEndAudioPlay1:
825 // we have received all the events, so pass the test
826 INFO_PRINTF1(_L("iTestVideoPlayer->NotificationReceived"));
827 iTestStepResult = EPass;
828 CActiveScheduler::Stop();
839 TVerdict RTestVclntAprRegB4Open::PerformTestL()
841 INFO_PRINTF1(_L("Register before opening video player"));
842 iTestStepResult = EFail;
844 // Initialise the state variables
848 Fsm(EIdlePlayer, KErrNone);
850 // Start the scheduler - Done only once !
851 CActiveScheduler::Start();
853 User::LeaveIfError(iError);
855 return iTestStepResult;
859 //RTestVclntAprRegAftrOpenAndB4Play (MM-MMF-VCLNTAVIAPR-I-0003-HP)
865 RTestVclntAprRegAftrOpenAndB4Play::RTestVclntAprRegAftrOpenAndB4Play(const TDesC& aTestName, const TDesC& aSectName)
866 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
874 RTestVclntAprRegAftrOpenAndB4Play* RTestVclntAprRegAftrOpenAndB4Play::NewL(const TDesC& aTestName, const TDesC& aSectName)
876 RTestVclntAprRegAftrOpenAndB4Play* self = new (ELeave) RTestVclntAprRegAftrOpenAndB4Play(aTestName, aSectName);
883 TVerdict RTestVclntAprRegAftrOpenAndB4Play::DoTestL()
885 TVerdict testResult = EFail;
886 TRAPD(err, testResult = PerformTestL());
887 User::LeaveIfError(err);
894 void RTestVclntAprRegAftrOpenAndB4Play::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
896 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
898 TInt retErr = KErrNone;
903 // Open iTestVideoPlayer
904 if (iBinaryCompatibility)
906 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
910 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
913 if( iError != KErrNone )
915 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
916 iTestStepResult = EFail;
917 CActiveScheduler::Stop();
920 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
923 case EStateOpenVideoPlayer:
925 // Register iTestVideoPlayer for Notification
926 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
927 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
928 if( retErr != KErrNone )
930 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
931 iTestStepResult = EFail;
932 CActiveScheduler::Stop();
935 // Prepare iTestVideoPlayer
936 iTestVideoPlayer->Prepare();
937 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
938 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
941 case EStatePrepareVideoPlayer:
943 // Play iTestVideoPlayer
944 iTestVideoPlayer->Play();
945 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
946 // Open iTestAudioPlayer1
947 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
948 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
949 if( iError != KErrNone )
951 iTestStepResult = EFail;
952 CActiveScheduler::Stop();
955 // Set ExpectedEvent and change the State
956 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
959 case EStateOpenAudioPlayer1:
961 // Get position for iTestVideoPlayer
962 TRAP(iError, iVidPosition = iTestVideoPlayer->PositionL());
963 INFO_PRINTF3(_L("iTestVideoPlayer->Position returned %d, error %d"), I64LOW(iVidPosition.Int64()), iError);
964 if( iError != KErrNone )
966 iTestStepResult = EFail;
967 CActiveScheduler::Stop();
970 // Play iTestAudioPlayer#1
971 iTestAudioPlayer1->Play();
972 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
973 // Set ExpectedEvent and change the State
974 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
977 case EStateErrInUseVideoPlayer:
979 // Set ExpectedEvent and change the State
981 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1, KErrNone, 1);
982 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1, KErrNone, 2);
985 case EStateEndAudioPlay1:
987 INFO_PRINTF2(_L("iTestVideoPlayer->Position returned after receiving Notification = %d"), I64LOW(iPosition.Int64()));
988 // we have received all the events, so pass the test
989 // Check the position
990 CActiveScheduler::Stop();
991 // check the difference with a time dalay
992 if(TimeComparison(I64INT(iPosition.Int64()), I64INT(iVidPosition.Int64()), KExpectedDeviation))
994 INFO_PRINTF1(_L("Position matches..."));
995 iTestStepResult = EPass;
999 INFO_PRINTF1(_L("Position does not match..."));
1000 iTestStepResult = EFail;
1012 TVerdict RTestVclntAprRegAftrOpenAndB4Play::PerformTestL()
1014 INFO_PRINTF1(_L("Register after opening and before playing video player"));
1015 iTestStepResult = EFail;
1017 // Initialise the state variables
1020 // Begin the process
1021 Fsm(EIdlePlayer, KErrNone);
1023 // Start the scheduler - Done only once !
1024 CActiveScheduler::Start();
1026 User::LeaveIfError(iError);
1028 return iTestStepResult;
1032 //RTestVclntAprRegAftrHpClntCompltPlay (MM-MMF-VCLNTAVIAPR-I-0004-HP)
1038 RTestVclntAprRegAftrHpClntCompltPlay::RTestVclntAprRegAftrHpClntCompltPlay(const TDesC& aTestName, const TDesC& aSectName)
1039 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
1045 RTestVclntAprRegAftrHpClntCompltPlay* RTestVclntAprRegAftrHpClntCompltPlay::NewL(const TDesC& aTestName, const TDesC& aSectName)
1047 RTestVclntAprRegAftrHpClntCompltPlay* self = new (ELeave) RTestVclntAprRegAftrHpClntCompltPlay(aTestName, aSectName);
1054 TVerdict RTestVclntAprRegAftrHpClntCompltPlay::DoTestL()
1056 TVerdict testResult = EFail;
1057 TRAPD(err, testResult = PerformTestL());
1058 User::LeaveIfError(err);
1065 void RTestVclntAprRegAftrHpClntCompltPlay::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
1067 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
1069 TInt retErr = KErrNone;
1074 // Open iTestVideoPlayer
1075 if (iBinaryCompatibility)
1077 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
1081 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
1084 if( iError != KErrNone )
1086 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
1087 iTestStepResult = EFail;
1088 CActiveScheduler::Stop();
1091 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
1094 case EStateOpenVideoPlayer:
1096 // Prepare iTestVideoPlayer
1097 iTestVideoPlayer->Prepare();
1098 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
1099 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
1102 case EStatePrepareVideoPlayer:
1104 // Play iTestVideoPlayer
1105 iTestVideoPlayer->Play();
1106 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
1107 // Open iTestAudioPlayer1
1108 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
1109 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
1110 if( iError != KErrNone )
1112 iTestStepResult = EFail;
1113 CActiveScheduler::Stop();
1116 // Set ExpectedEvent and change the State
1117 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
1120 case EStateOpenAudioPlayer1:
1122 // Play iTestAudioPlayer#1
1123 iTestAudioPlayer1->Play();
1124 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1125 // Set ExpectedEvent and change the State
1126 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
1129 case EStateErrInUseVideoPlayer:
1131 // Set ExpectedEvent and change the State
1132 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1);
1135 case EStateEndAudioPlay1:
1137 // Register iTestVideoPlayer for Notification
1138 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1139 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
1140 if( retErr != KErrNone )
1142 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1143 iTestStepResult = EFail;
1144 CActiveScheduler::Stop();
1147 // Play iTestVideoPlayer again
1148 iTestVideoPlayer->Play();
1149 INFO_PRINTF1(_L("iTestVideoPlayer->Play() - Again"));
1150 // Play iTestAudioPlayer1 again
1151 iTestAudioPlayer1->Play();
1152 INFO_PRINTF1(_L("iTestAudioPlayer1->Play() - Again"));
1153 // Set ExpectedEvent and change the State
1154 StateChange(EStateErrInUseVideoPlayer1A, EMvpuoPlayComplete, KErrInUse);
1157 case EStateErrInUseVideoPlayer1A:
1159 iCallBackTimer->Cancel(); // in case some other event (apart from Notification is received)
1160 // Set ExpectedEvent and change the State
1162 StateChange(EStateNotifiedVideoPlayer1A, EMarncResourceAvailable1, KErrNone, 1);
1163 StateChange(EStateEndAudioPlay1A, EMapcPlayComplete1, KErrNone, 2);
1166 case EStateEndAudioPlay1A:
1168 // we have received all the events, so pass the test
1169 INFO_PRINTF1(_L("iTestVideoPlayer->NotificationReceived"));
1170 iTestStepResult = EPass;
1171 CActiveScheduler::Stop();
1182 TVerdict RTestVclntAprRegAftrHpClntCompltPlay::PerformTestL()
1184 INFO_PRINTF1(_L("Registration after the the High priority client completes play"));
1185 iTestStepResult = EFail;
1187 // Initialise the state variables
1190 // Begin the process
1191 Fsm(EIdlePlayer, KErrNone);
1193 // Start the scheduler - Done only once !
1194 CActiveScheduler::Start();
1196 User::LeaveIfError(iError);
1198 return iTestStepResult;
1202 //RTestVclntAprRegSamePriorityPlayers (MM-MMF-VCLNTAVIAPR-I-0005-HP)
1208 RTestVclntAprRegSamePriorityPlayers::RTestVclntAprRegSamePriorityPlayers(const TDesC& aTestName, const TDesC& aSectName)
1209 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
1215 RTestVclntAprRegSamePriorityPlayers* RTestVclntAprRegSamePriorityPlayers::NewL(const TDesC& aTestName, const TDesC& aSectName)
1217 RTestVclntAprRegSamePriorityPlayers* self = new (ELeave) RTestVclntAprRegSamePriorityPlayers(aTestName, aSectName);
1224 TVerdict RTestVclntAprRegSamePriorityPlayers::DoTestL()
1226 TVerdict testResult = EFail;
1227 TRAPD(err, testResult = PerformTestL());
1228 User::LeaveIfError(err);
1235 void RTestVclntAprRegSamePriorityPlayers::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
1237 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
1239 TInt retErr = KErrNone;
1240 TInt retErr1 = KErrNone;
1245 // Open iTestVideoPlayer
1246 if (iBinaryCompatibility)
1248 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
1252 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
1255 if( iError != KErrNone )
1257 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
1258 iTestStepResult = EFail;
1259 CActiveScheduler::Stop();
1262 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
1265 case EStateOpenVideoPlayer:
1267 // Prepare iTestVideoPlayer
1268 iTestVideoPlayer->Prepare();
1269 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
1270 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
1273 case EStatePrepareVideoPlayer:
1275 // Play iTestVideoPlayer
1276 iTestVideoPlayer->Play();
1277 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
1278 // Open iTestAudioPlayer1
1279 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
1280 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
1281 if( iError != KErrNone )
1283 iTestStepResult = EFail;
1284 CActiveScheduler::Stop();
1287 // Set ExpectedEvent and change the State
1288 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
1291 case EStateOpenAudioPlayer1:
1293 // Play iTestAudioPlayer#1
1294 iTestAudioPlayer1->Play();
1295 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1296 // Set ExpectedEvent and change the State
1297 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
1300 case EStateErrInUseVideoPlayer:
1302 // Register iTestVideoPlayer for Notification
1303 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1304 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
1305 if( retErr != KErrNone )
1307 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1308 iTestStepResult = EFail;
1309 CActiveScheduler::Stop();
1312 // Open iTestAudioPlayer2
1313 TRAP(iError, iTestAudioPlayer2->OpenFileL(iFilename3));
1314 INFO_PRINTF2(_L("iTestAudioPlayer2->OpenFileL(), returned %d"), iError);
1315 if( iError != KErrNone )
1317 iTestStepResult = EFail;
1318 CActiveScheduler::Stop();
1321 // Set ExpectedEvent and change the State
1322 StateChange(EStateOpenAudioPlayer2, EMapcInitComplete2);
1325 case EStateOpenAudioPlayer2:
1327 // Play iTestAudioPlayer#2
1328 iTestAudioPlayer2->Play();
1329 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1330 // Set ExpectedEvent and change the State
1331 StateChange(EStateErrInUseAudioPlayer2, EMapcPlayComplete2, KErrInUse);
1334 case EStateErrInUseAudioPlayer2:
1336 // Register iTestAudioPlayer2 for Notification
1337 retErr1 = iTestAudioPlayer2->RegisterAudioResourceNotification(*iAudioPlayerCallbackSupport2, KMMFEventCategoryAudioResourceAvailable);
1338 INFO_PRINTF1(_L("iTestAudioPlayer2->RegisterAudioResourceNotification()"));
1339 if( retErr1 != KErrNone )
1341 ERR_PRINTF2(_L("iTestAudioPlayer2->RegisterAudioResourceNotification - Failed with Error : %d"), retErr1);
1342 iTestStepResult = EFail;
1343 CActiveScheduler::Stop();
1346 // Set ExpectedEvent and change the State
1348 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1, KErrNone, 1);
1349 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1, KErrNone, 2);
1352 case EStateEndAudioPlay1:
1354 // we have received all the events, so pass the test
1355 INFO_PRINTF1(_L("iTestVideoPlayer->NotificationReceived"));
1356 iTestStepResult = EPass;
1357 CActiveScheduler::Stop();
1368 TVerdict RTestVclntAprRegSamePriorityPlayers::PerformTestL()
1370 INFO_PRINTF1(_L("Receive notification by same priority players in the order of registration"));
1371 iTestStepResult = EFail;
1373 // Initialise the state variables
1376 // Begin the process
1377 Fsm(EIdlePlayer, KErrNone);
1379 // Start the scheduler - Done only once !
1380 CActiveScheduler::Start();
1382 User::LeaveIfError(iError);
1384 return iTestStepResult;
1388 //RTestVclntAprRegAtPlayAndCancelNfn (MM-MMF-VCLNTAVIAPR-I-0006-HP)
1394 RTestVclntAprRegAtPlayAndCancelNfn::RTestVclntAprRegAtPlayAndCancelNfn(const TDesC& aTestName, const TDesC& aSectName)
1395 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
1401 RTestVclntAprRegAtPlayAndCancelNfn* RTestVclntAprRegAtPlayAndCancelNfn::NewL(const TDesC& aTestName, const TDesC& aSectName)
1403 RTestVclntAprRegAtPlayAndCancelNfn* self = new (ELeave) RTestVclntAprRegAtPlayAndCancelNfn(aTestName, aSectName);
1410 TVerdict RTestVclntAprRegAtPlayAndCancelNfn::DoTestL()
1412 TVerdict testResult = EFail;
1413 TRAPD(err, testResult = PerformTestL());
1414 User::LeaveIfError(err);
1421 void RTestVclntAprRegAtPlayAndCancelNfn::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
1423 if (FsmCheck(aEventCode, aError))
1425 TInt retErr = KErrNone;
1426 TInt retErr1 = KErrNone;
1431 // Open iTestVideoPlayer
1432 if (iBinaryCompatibility)
1434 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
1438 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
1441 if( iError != KErrNone )
1443 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
1444 iTestStepResult = EFail;
1445 CActiveScheduler::Stop();
1448 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
1451 case EStateOpenVideoPlayer:
1453 // Prepare iTestVideoPlayer
1454 iTestVideoPlayer->Prepare();
1455 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
1456 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
1459 case EStatePrepareVideoPlayer:
1461 // Play iTestVideoPlayer
1462 iTestVideoPlayer->Play();
1463 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
1464 // Open iTestAudioPlayer1
1465 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
1466 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
1467 if( iError != KErrNone )
1469 iTestStepResult = EFail;
1470 CActiveScheduler::Stop();
1473 // Set ExpectedEvent and change the State
1474 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
1477 case EStateOpenAudioPlayer1:
1479 // Play iTestAudioPlayer#1
1480 iTestAudioPlayer1->Play();
1481 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1482 // Set ExpectedEvent and change the State
1483 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
1486 case EStateErrInUseVideoPlayer:
1488 // Register iTestVideoPlayer for Notification
1489 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1490 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
1491 if( retErr != KErrNone )
1493 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1494 iTestStepResult = EFail;
1495 CActiveScheduler::Stop();
1498 retErr1 = iTestVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
1499 INFO_PRINTF1(_L("iTestVideoPlayer->CancelRegisterAudioResourceNotification()"));
1500 if (retErr1 == KErrNone)
1502 INFO_PRINTF1(_L("iTestVideoPlayer should not receive Notification as registration is cancelled."));
1506 ERR_PRINTF2(_L("iTestVideoPlayer->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1507 iTestStepResult = EFail;
1508 CActiveScheduler::Stop();
1511 // Set ExpectedEvent and change the State
1512 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1);
1515 case EStateEndAudioPlay1:
1517 // Timer to check if Notification Event Occurs.
1518 iCallBackTimer->After(2000000);
1519 iTestStepResult = EPass;
1520 // Set ExpectedEvent and change the State
1521 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1);
1524 case EStateNotifiedVideoPlayer:
1526 iCallBackTimer->Cancel(); // in case something else stopped the AS
1527 // we have received the notification event (unexpected), so fail the test
1528 INFO_PRINTF1(_L("iTestVideoPlayer->NotificationReceived"));
1529 iTestStepResult = EFail;
1530 CActiveScheduler::Stop();
1541 TVerdict RTestVclntAprRegAtPlayAndCancelNfn::PerformTestL()
1543 INFO_PRINTF1(_L("Cancellation of the notification request"));
1544 iTestStepResult = EFail;
1546 // Initialise the state variables
1549 // Begin the process
1550 Fsm(EIdlePlayer, KErrNone);
1552 // Start the scheduler - Done only once !
1553 CActiveScheduler::Start();
1555 User::LeaveIfError(iError);
1557 return iTestStepResult;
1561 //RTestVclntAprTestWillResumePlay (MM-MMF-VCLNTAVIAPR-I-0007-HP)
1567 RTestVclntAprTestWillResumePlay::RTestVclntAprTestWillResumePlay(const TDesC& aTestName, const TDesC& aSectName)
1568 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
1574 RTestVclntAprTestWillResumePlay* RTestVclntAprTestWillResumePlay::NewL(const TDesC& aTestName, const TDesC& aSectName)
1576 RTestVclntAprTestWillResumePlay* self = new (ELeave) RTestVclntAprTestWillResumePlay(aTestName, aSectName);
1583 TVerdict RTestVclntAprTestWillResumePlay::DoTestL()
1585 TVerdict testResult = EFail;
1586 TRAPD(err, testResult = PerformTestL());
1587 User::LeaveIfError(err);
1594 void RTestVclntAprTestWillResumePlay::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
1596 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
1598 TInt retErr = KErrNone;
1599 TInt retErr1 = KErrNone;
1604 // Open iTestAudioPlayer2 - Low priority
1605 TRAP(iError, iTestAudioPlayer2->OpenFileL(iFilename3));
1606 if( iError != KErrNone )
1608 ERR_PRINTF2(_L("iTestAudioPlayer2->OpenFileL - Failed with Error : %d"), iError);
1609 iTestStepResult = EFail;
1610 CActiveScheduler::Stop();
1613 // Set ExpectedEvent and change the State
1614 StateChange(EStateOpenAudioPlayer2, EMapcInitComplete2);
1617 case EStateOpenAudioPlayer2:
1619 // Play iTestAudioPlayer#2
1620 iTestAudioPlayer2->Play();
1621 INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1622 // Open iTestVideoPlayer
1623 if (iBinaryCompatibility)
1625 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
1629 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
1632 INFO_PRINTF2(_L("iTestVideoPlayer->OpenFileL(), returned %d"), iError);
1633 if( iError != KErrNone )
1635 iTestStepResult = EFail;
1636 CActiveScheduler::Stop();
1639 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
1642 case EStateOpenVideoPlayer:
1644 // Prepare iTestVideoPlayer
1645 iTestVideoPlayer->Prepare();
1646 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
1647 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
1650 case EStatePrepareVideoPlayer:
1652 // Play iTestVideoPlayer
1653 iTestVideoPlayer->Play();
1654 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
1655 // Set ExpectedEvent and change the State
1656 StateChange(EStateErrInUseAudioPlayer2, EMapcPlayComplete2, KErrInUse);
1659 case EStateErrInUseAudioPlayer2:
1661 // Register iTestAudioPlayer2 for Notification
1662 retErr = iTestAudioPlayer2->RegisterAudioResourceNotification(*iAudioPlayerCallbackSupport2, KMMFEventCategoryAudioResourceAvailable);
1663 INFO_PRINTF1(_L("iTestAudioPlayer2->RegisterAudioResourceNotification()"));
1664 if( retErr != KErrNone )
1666 ERR_PRINTF2(_L("iTestAudioPlayer2->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1667 iTestStepResult = EFail;
1668 CActiveScheduler::Stop();
1671 // Open iTestAudioPlayer1
1672 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
1673 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
1674 if( iError != KErrNone )
1676 iTestStepResult = EFail;
1677 CActiveScheduler::Stop();
1680 // Set ExpectedEvent and change the State
1681 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
1684 case EStateOpenAudioPlayer1:
1686 // Play iTestAudioPlayer#1
1687 iTestAudioPlayer1->Play();
1688 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1689 // Set ExpectedEvent and change the State
1690 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
1693 case EStateErrInUseVideoPlayer:
1695 // Register iTestVideoPlayer for Notification
1696 retErr1 = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1697 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
1698 if( retErr1 != KErrNone )
1700 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr1);
1701 iTestStepResult = EFail;
1702 CActiveScheduler::Stop();
1705 // Set ExpectedEvent and change the State
1707 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1, KErrNone, 1);
1708 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1, KErrNone, 2);
1711 case EStateEndAudioPlay1:
1713 iCallBackTimer->Cancel(); // in case something else stopped the AS
1714 INFO_PRINTF1(_L("iTestVideoPlayer->NotificationReceived"));
1715 retErr = iTestVideoPlayer->WillResumePlay();
1716 INFO_PRINTF1(_L("iTestVideoPlayer->WillResumePlay()"));
1717 if( retErr != KErrNone )
1719 ERR_PRINTF2(_L("iTestVideoPlayer->WillResumePlay() - Failed with Error : %d"), retErr);
1720 iTestStepResult = EFail;
1721 CActiveScheduler::Stop();
1724 // initialise and start the timer (5 Sec), just to check if no other event occurs.
1725 TRAPD(err, iWillResumePlayTimer = CVclntAviAprWillResumeTimer::NewL(this, 5000000));
1726 if (err != KErrNone)
1728 ERR_PRINTF2(_L("CVclntAviAprWillResumeTimer::NewL left with error = %d"), err);
1729 iTestStepResult = EFail;
1730 CActiveScheduler::Stop();
1733 iWillResumePlayTimer->Start();
1734 // Check if No other client is notified in 5 seconds.
1735 StateChange(EStateNoOtherPlayerNotified, EIdlePlayer);
1738 case EStateNoOtherPlayerNotified:
1740 INFO_PRINTF1(_L("No other client has been notified in 5 seconds after calling WillResumePlay()"));
1741 iTestVideoPlayer->Play(); // directly calling play, without setting position.
1743 StateChange(EStateNotifiedAudioPlayer2, EMarncResourceAvailable3, KErrNone, 1);
1744 StateChange(EStateEndVideoPlay, EMvpuoPlayComplete, KErrNone, 2);
1747 case EStateEndVideoPlay:
1749 INFO_PRINTF1(_L("iTestAudioPlayer2->NotificationReceived"));
1750 iTestStepResult = EPass;
1751 CActiveScheduler::Stop();
1762 TVerdict RTestVclntAprTestWillResumePlay::PerformTestL()
1764 INFO_PRINTF1(_L("WillResumePlay Implementation with three clients"));
1765 iTestStepResult = EFail;
1767 // Initialise the state variables
1770 // Begin the process
1771 Fsm(EIdlePlayer, KErrNone);
1773 // Start the scheduler - Done only once !
1774 CActiveScheduler::Start();
1776 User::LeaveIfError(iError);
1778 return iTestStepResult;
1782 * set finished on callback from a timer
1784 void RTestVclntAprTestWillResumePlay::FinishedL()
1786 // say that no events have occured after calling WillResumePlay()
1787 // and can proceed to the next step
1788 Fsm(EIdlePlayer, KErrNone);
1792 // CVclntAviAprWillResumeTimer
1798 CVclntAviAprWillResumeTimer* CVclntAviAprWillResumeTimer::NewL(RTestVclntAprTestWillResumePlay* aParent, TTimeIntervalMicroSeconds32 aWaitTime)
1800 CVclntAviAprWillResumeTimer* self = new (ELeave) CVclntAviAprWillResumeTimer(aParent, aWaitTime);
1801 CleanupStack::PushL(self);
1803 CleanupStack::Pop(self);
1810 CVclntAviAprWillResumeTimer::CVclntAviAprWillResumeTimer(RTestVclntAprTestWillResumePlay* aParent, TTimeIntervalMicroSeconds32 aWaitTime)
1811 : CTimer(EPriorityNormal), iParent(aParent), iWaitTime(aWaitTime)
1813 CActiveScheduler::Add(this);
1817 * Start() - Start the timer
1819 void CVclntAviAprWillResumeTimer::Start()
1825 * RunL() - see CActive class for more info
1827 void CVclntAviAprWillResumeTimer::RunL()
1829 // (iParent->Finished() should call Stop() or not, as we decide)
1830 iParent->FinishedL();
1834 * RunError() - see CActive class for more info
1836 TInt CVclntAviAprWillResumeTimer::RunError(TInt aError)
1838 CActiveScheduler::Stop();
1843 //RTestVclntAprAllocUsingSharedHeap (MM-MMF-VCLNTAVIAPR-I-0008-HP)
1849 RTestVclntAprAllocUsingSharedHeap::RTestVclntAprAllocUsingSharedHeap(const TDesC& aTestName, const TDesC& aSectName)
1850 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
1857 RTestVclntAprAllocUsingSharedHeap* RTestVclntAprAllocUsingSharedHeap::NewL(const TDesC& aTestName, const TDesC& aSectName)
1859 RTestVclntAprAllocUsingSharedHeap* self = new (ELeave) RTestVclntAprAllocUsingSharedHeap(aTestName, aSectName);
1866 TVerdict RTestVclntAprAllocUsingSharedHeap::DoTestStepL()
1868 TVerdict ret = EPass;
1876 TVerdict RTestVclntAprAllocUsingSharedHeap::DoTestL()
1878 TVerdict testResult = EFail;
1879 TRAPD(err, testResult = PerformTestL());
1880 User::LeaveIfError(err);
1888 void RTestVclntAprAllocUsingSharedHeap::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
1890 if ((FsmCheck(aEventCode, aError)) && iCanStateChange)
1892 TInt retErr = KErrNone;
1897 // Open iTestVideoPlayer
1898 if (iBinaryCompatibility)
1900 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
1904 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
1907 if( iError != KErrNone )
1909 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
1910 iTestStepResult = EFail;
1911 CActiveScheduler::Stop();
1914 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
1917 case EStateOpenVideoPlayer:
1919 // Prepare iTestVideoPlayer
1920 iTestVideoPlayer->Prepare();
1921 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
1924 case EStatePrepareVideoPlayer:
1926 // Play iTestVideoPlayer
1927 iTestVideoPlayer->Play();
1928 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
1929 // Open iTestAudioPlayer1
1930 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
1931 if( iError != KErrNone )
1933 iTestStepResult = EFail;
1934 CActiveScheduler::Stop();
1937 // Set ExpectedEvent and change the State
1938 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
1941 case EStateOpenAudioPlayer1:
1943 // Play iTestAudioPlayer#1
1944 iTestAudioPlayer1->Play();
1945 // Set ExpectedEvent and change the State
1946 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
1949 case EStateErrInUseVideoPlayer:
1951 // Register iTestVideoPlayer for Notification
1952 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1953 if( retErr != KErrNone )
1955 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1956 iTestStepResult = EFail;
1957 CActiveScheduler::Stop();
1960 // Set ExpectedEvent and change the State
1962 StateChange(EStateNotifiedVideoPlayer, EMarncResourceAvailable1, KErrNone, 1);
1963 StateChange(EStateEndAudioPlay1, EMapcPlayComplete1, KErrNone, 2);
1966 case EStateEndAudioPlay1:
1968 iCallBackTimer->Cancel(); // in case something else stopped the AS
1969 iTestVideoPlayer->Play();
1970 INFO_PRINTF1(_L("iTestVideoPlayer->Play() - Again"));
1971 iTestAudioPlayer1->Play();
1972 StateChange(EStateErrInUseVideoPlayer1A, EMvpuoPlayComplete, KErrInUse);
1975 case EStateErrInUseVideoPlayer1A:
1977 // Set ExpectedEvent and change the State
1979 StateChange(EStateNotifiedVideoPlayer1A, EMarncResourceAvailable1, KErrNone, 1);
1980 StateChange(EStateEndAudioPlay1A, EMapcPlayComplete1, KErrNone, 2);
1983 case EStateEndAudioPlay1A:
1985 iCallBackTimer->Cancel(); // in case something else stopped the AS
1986 iTestStepResult = EPass;
1987 CActiveScheduler::Stop();
1996 * Play video by marking heap.
1999 void RTestVclntAprAllocUsingSharedHeap::VideoPlayAllocL()
2002 // create new instance of video player
2003 TInt startAllocCount = User::CountAllocCells();
2005 DoTestStepCreateL();
2007 // call the state handler and start the test
2009 // Initialise the state variables
2012 // Begin the process
2013 Fsm(EIdlePlayer, KErrNone);
2015 // Start the scheduler - Done only once !
2016 CActiveScheduler::Start();
2018 DoTestStepDeleteL();
2021 if (iError != KErrNone)
2023 ERR_PRINTF2(_L("Opening/playing the video file failed, unexpected error : %d."), iError);
2024 User::Leave(iError);
2027 TInt endAllocCount = User::CountAllocCells();
2036 TVerdict RTestVclntAprAllocUsingSharedHeap::PerformTestL()
2038 INFO_PRINTF1(_L("<<< APR alloc test using VideoPlayer utility.>>>"));
2039 iTestStepResult = EFail;
2041 TRAPD(err, VideoPlayAllocL());
2042 if ((err != KErrNone) || (iTestStepResult != EPass))
2044 return iTestStepResult;
2047 iTestStepResult = EFail;
2050 TBool completed = EFalse;
2051 TBool badResult = EFalse;
2052 TBool reachedEnd = EFalse;
2056 INFO_PRINTF2(_L("ALLOC Test Loop #%d."), failCount);
2057 __UHEAP_SETFAIL(RHeap::EFailNext, failCount);
2060 TInt err = KErrNone;
2061 TRAP(err, VideoPlayAllocL());
2062 ERR_PRINTF2(_L("Tracing the error = %d."), err);
2065 if (err == KErrNone)
2067 TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
2075 User::Free(testAlloc);
2079 if (iTestStepResult != EPass)
2084 completed = reachedEnd || badResult;
2086 else if (err != KErrNoMemory)
2088 __UHEAP_SETFAIL(RHeap::ENone, 0);
2089 ERR_PRINTF2(_L("Bad error code %d"), err);
2095 __UHEAP_SETFAIL(RHeap::ENone, 0);
2105 if (err != KErrNone || badResult)
2109 ERR_PRINTF3(_L("Bad result with %d memory allocations tested. The Error returned is %d."), failCount, err);
2113 ERR_PRINTF3(_L("Error(%d) with %d memory allocations tested."), failCount, err);
2116 iTestStepResult = EFail;
2120 INFO_PRINTF2(_L("Completed OK with %d memory allocations tested.\n"), failCount);
2121 iTestStepResult = EPass;
2124 return iTestStepResult;
2128 //RTestVclntAprMultRegAtPlay (MM-MMF-VCLNTAVIAPR-I-0101-HP)
2134 RTestVclntAprMultRegAtPlay::RTestVclntAprMultRegAtPlay(const TDesC& aTestName, const TDesC& aSectName)
2135 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
2141 RTestVclntAprMultRegAtPlay* RTestVclntAprMultRegAtPlay::NewL(const TDesC& aTestName, const TDesC& aSectName)
2143 RTestVclntAprMultRegAtPlay* self = new (ELeave) RTestVclntAprMultRegAtPlay(aTestName, aSectName);
2150 TVerdict RTestVclntAprMultRegAtPlay::DoTestL()
2152 TVerdict testResult = EFail;
2153 TRAPD(err, testResult = PerformTestL());
2154 User::LeaveIfError(err);
2161 void RTestVclntAprMultRegAtPlay::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
2163 if (FsmCheck(aEventCode, aError))
2165 TInt retErr = KErrNone;
2170 // Open iTestVideoPlayer
2171 if (iBinaryCompatibility)
2173 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
2177 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
2180 if( iError != KErrNone )
2182 ERR_PRINTF2(_L("iTestVideoPlayer->OpenFileL - Failed with Error : %d"), iError);
2183 iTestStepResult = EFail;
2184 CActiveScheduler::Stop();
2187 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
2190 case EStateOpenVideoPlayer:
2192 // Prepare iTestVideoPlayer
2193 iTestVideoPlayer->Prepare();
2194 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
2195 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
2198 case EStatePrepareVideoPlayer:
2200 // Play iTestVideoPlayer
2201 iTestVideoPlayer->Play();
2202 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
2203 // Register iTestVideoPlayer for Notification
2204 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
2205 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification() - First Regn"));
2206 if( retErr != KErrNone )
2208 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2209 iTestStepResult = EFail;
2210 CActiveScheduler::Stop();
2213 // Open iTestAudioPlayer1
2214 TRAP(iError, iTestAudioPlayer1->OpenFileL(iFilename2));
2215 INFO_PRINTF2(_L("iTestAudioPlayer1->OpenFileL(), returned %d"), iError);
2216 if( iError != KErrNone )
2218 iTestStepResult = EFail;
2219 CActiveScheduler::Stop();
2222 // Set ExpectedEvent and change the State
2223 StateChange(EStateOpenAudioPlayer1, EMapcInitComplete1);
2226 case EStateOpenAudioPlayer1:
2228 // Play iTestAudioPlayer#1
2229 iTestAudioPlayer1->Play();
2230 INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
2231 // Set ExpectedEvent and change the State
2232 StateChange(EStateErrInUseVideoPlayer, EMvpuoPlayComplete, KErrInUse);
2235 case EStateErrInUseVideoPlayer:
2237 // Register iTestVideoPlayer for Notification
2238 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
2239 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification() - Second Regn"));
2240 if( retErr == KErrAlreadyExists )
2242 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification (2nd Time) - Failed with Error : %d"), retErr);
2243 iTestStepResult = EPass;
2245 else if( retErr != KErrNone )
2247 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2248 iTestStepResult = EFail;
2250 CActiveScheduler::Stop();
2261 TVerdict RTestVclntAprMultRegAtPlay::PerformTestL()
2263 INFO_PRINTF1(_L("Multiple registration at the time of play"));
2264 iTestStepResult = EFail;
2266 // Initialise the state variables
2269 // Begin the process
2270 Fsm(EIdlePlayer, KErrNone);
2272 // Start the scheduler - Done only once !
2273 CActiveScheduler::Start();
2275 User::LeaveIfError(iError);
2277 return iTestStepResult;
2282 //RTestVclntAprCancelNoResourceNfn (MM-MMF-VCLNTAVIAPR-I-0102-HP)
2288 RTestVclntAprCancelNoResourceNfn::RTestVclntAprCancelNoResourceNfn(const TDesC& aTestName, const TDesC& aSectName)
2289 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
2295 RTestVclntAprCancelNoResourceNfn* RTestVclntAprCancelNoResourceNfn::NewL(const TDesC& aTestName, const TDesC& aSectName)
2297 RTestVclntAprCancelNoResourceNfn* self = new (ELeave) RTestVclntAprCancelNoResourceNfn(aTestName, aSectName);
2304 TVerdict RTestVclntAprCancelNoResourceNfn::DoTestL()
2306 TVerdict testResult = EFail;
2307 TRAPD(err, testResult = PerformTestL());
2308 User::LeaveIfError(err);
2315 void RTestVclntAprCancelNoResourceNfn::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
2317 if (FsmCheck(aEventCode, aError))
2319 TInt retErr = KErrNone;
2324 // Open iTestVideoPlayer
2325 if (iBinaryCompatibility)
2327 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
2331 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
2334 INFO_PRINTF2(_L("iTestVideoPlayer->OpenFileL(), returned %d"), iError);
2335 if( iError != KErrNone )
2337 iTestStepResult = EFail;
2338 CActiveScheduler::Stop();
2341 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
2344 case EStateOpenVideoPlayer:
2346 // Prepare iTestVideoPlayer
2347 iTestVideoPlayer->Prepare();
2348 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
2349 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
2352 case EStatePrepareVideoPlayer:
2354 // Play iTestVideoPlayer
2355 iTestVideoPlayer->Play();
2356 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
2357 retErr = iTestVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
2358 if (retErr == KErrCancel)
2360 INFO_PRINTF1(_L("iTestVideoPlayer->CancelRegisterAudioResourceNotification() returned KErrCancel - Successful"));
2361 iTestStepResult = EPass;
2365 ERR_PRINTF2(_L("iTestVideoPlayer->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr);
2366 iTestStepResult = EFail;
2368 CActiveScheduler::Stop();
2379 TVerdict RTestVclntAprCancelNoResourceNfn::PerformTestL()
2381 INFO_PRINTF1(_L("Cancel when no resource Notification is requested"));
2382 iTestStepResult = EFail;
2384 // Initialise the state variables
2387 // Begin the process
2388 Fsm(EIdlePlayer, KErrNone);
2390 // Start the scheduler - Done only once !
2391 CActiveScheduler::Start();
2393 User::LeaveIfError(iError);
2395 return iTestStepResult;
2399 //RTestVclntAprRegUnsupportedEvent (MM-MMF-VCLNTAVIAPR-I-0103-HP)
2405 RTestVclntAprRegUnsupportedEvent::RTestVclntAprRegUnsupportedEvent(const TDesC& aTestName, const TDesC& aSectName)
2406 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
2412 RTestVclntAprRegUnsupportedEvent* RTestVclntAprRegUnsupportedEvent::NewL(const TDesC& aTestName, const TDesC& aSectName)
2414 RTestVclntAprRegUnsupportedEvent* self = new (ELeave) RTestVclntAprRegUnsupportedEvent(aTestName, aSectName);
2421 TVerdict RTestVclntAprRegUnsupportedEvent::DoTestL()
2423 TVerdict testResult = EFail;
2424 TRAPD(err, testResult = PerformTestL());
2425 User::LeaveIfError(err);
2432 void RTestVclntAprRegUnsupportedEvent::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
2434 if (FsmCheck(aEventCode, aError))
2436 TInt retErr = KErrNone;
2441 // Open iTestVideoPlayer
2442 if (iBinaryCompatibility)
2444 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
2448 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
2451 INFO_PRINTF2(_L("iTestVideoPlayer->OpenFileL(), returned %d"), iError);
2452 if( iError != KErrNone )
2454 iTestStepResult = EFail;
2455 CActiveScheduler::Stop();
2458 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
2461 case EStateOpenVideoPlayer:
2463 // Prepare iTestVideoPlayer
2464 iTestVideoPlayer->Prepare();
2465 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
2466 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
2469 case EStatePrepareVideoPlayer:
2471 // Play iTestVideoPlayer
2472 iTestVideoPlayer->Play();
2473 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
2474 // Register iTestVideoPlayer for Notification
2475 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryVideoPrepareComplete);
2476 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
2477 if( retErr == KErrNotSupported )
2479 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification() with an Unsupported Event"));
2480 iTestStepResult = EPass;
2484 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification with Error : %d"), retErr);
2485 iTestStepResult = EFail;
2487 CActiveScheduler::Stop();
2498 TVerdict RTestVclntAprRegUnsupportedEvent::PerformTestL()
2500 INFO_PRINTF1(_L("Register with Unsupported event"));
2501 iTestStepResult = EFail;
2503 // Initialise the state variables
2506 // Begin the process
2507 Fsm(EIdlePlayer, KErrNone);
2509 // Start the scheduler - Done only once !
2510 CActiveScheduler::Start();
2512 User::LeaveIfError(iError);
2514 return iTestStepResult;
2518 //RTestVclntAprCancelUnsupportedEvent (MM-MMF-VCLNTAVIAPR-I-0104-HP)
2524 RTestVclntAprCancelUnsupportedEvent::RTestVclntAprCancelUnsupportedEvent(const TDesC& aTestName, const TDesC& aSectName)
2525 : RTestMmfVclntVideoPlayerAPR(aTestName, aSectName)
2531 RTestVclntAprCancelUnsupportedEvent* RTestVclntAprCancelUnsupportedEvent::NewL(const TDesC& aTestName, const TDesC& aSectName)
2533 RTestVclntAprCancelUnsupportedEvent* self = new (ELeave) RTestVclntAprCancelUnsupportedEvent(aTestName, aSectName);
2540 TVerdict RTestVclntAprCancelUnsupportedEvent::DoTestL()
2542 TVerdict testResult = EFail;
2543 TRAPD(err, testResult = PerformTestL());
2544 User::LeaveIfError(err);
2551 void RTestVclntAprCancelUnsupportedEvent::Fsm(TAVPlayerAPREvents aEventCode, TInt aError)
2553 if (FsmCheck(aEventCode, aError))
2555 TInt retErr = KErrNone;
2556 TInt retErr1 = KErrNone;
2561 // Open iTestVideoPlayer
2562 if (iBinaryCompatibility)
2564 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1, ControllerUid()));
2568 TRAP(iError, iTestVideoPlayer->OpenFileL(iFilename1));
2571 INFO_PRINTF2(_L("iTestVideoPlayer->OpenFileL(), returned %d"), iError);
2572 if( iError != KErrNone )
2574 iTestStepResult = EFail;
2575 CActiveScheduler::Stop();
2578 StateChange(EStateOpenVideoPlayer, EMvpuoOpenComplete);
2581 case EStateOpenVideoPlayer:
2583 // Prepare iTestVideoPlayer
2584 iTestVideoPlayer->Prepare();
2585 INFO_PRINTF1(_L("iTestVideoPlayer->Prepare()"));
2586 StateChange(EStatePrepareVideoPlayer, EMvpuoPrepareComplete);
2589 case EStatePrepareVideoPlayer:
2591 // Play iTestVideoPlayer
2592 iTestVideoPlayer->Play();
2593 INFO_PRINTF1(_L("iTestVideoPlayer->Play()"));
2594 // Register iTestVideoPlayer for Notification
2595 retErr = iTestVideoPlayer->RegisterAudioResourceNotification(*iVideoPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
2596 INFO_PRINTF1(_L("iTestVideoPlayer->RegisterAudioResourceNotification()"));
2597 if( retErr != KErrNone )
2599 ERR_PRINTF2(_L("iTestVideoPlayer->RegisterAudioResourceNotification - Failed with Error : %d"), retErr1);
2600 iTestStepResult = EFail;
2601 CActiveScheduler::Stop();
2604 retErr1 = iTestVideoPlayer->CancelRegisterAudioResourceNotification(KMMFEventCategoryVideoRecorderGeneralError);
2605 if (retErr1 == KErrNotSupported)
2607 INFO_PRINTF1(_L("iTestVideoPlayer->CancelRegisterAudioResourceNotification - Unsuccessful due to Unsupported event"));
2608 iTestStepResult = EPass;
2612 ERR_PRINTF2(_L("iTestVideoPlayer->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr1);
2613 iTestStepResult = EFail;
2615 CActiveScheduler::Stop();
2626 TVerdict RTestVclntAprCancelUnsupportedEvent::PerformTestL()
2628 INFO_PRINTF1(_L("Cancel registration with unsupported event type"));
2629 iTestStepResult = EFail;
2631 // Initialise the state variables
2634 // Begin the process
2635 Fsm(EIdlePlayer, KErrNone);
2637 // Start the scheduler - Done only once !
2638 CActiveScheduler::Start();
2640 User::LeaveIfError(iError);
2642 return iTestStepResult;