sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // Specific includes for this test code sl@0: #include sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #include sl@0: #endif sl@0: #include "tsu_mmf_avictrl_teststep.h" sl@0: #include "tsu_mmf_avictrl_testsuite.h" sl@0: #include "tsu_mmf_avictrlplay.h" sl@0: #include "tsu_mmf_avictrltestids.h" sl@0: #define KExtraIterations 5 sl@0: sl@0: const TUint RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::KMaxFreeRamForTest; sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlPlay::RTestStepAviPlayCtrlPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Do the test step. This test Primes the AviPlayController and Plays an avi file to its completion sl@0: and checks for the proper play completion sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlPlay::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("this step plays an avi file ")); sl@0: TInt errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlVolume::RTestStepAviPlayCtrlVolume(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This tests setting the volume on AviPlayController in Stopped, Primed and Playing sl@0: states and checks if the volume set is same as the volume got. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlVolume::DoTestStepL( void ) sl@0: { sl@0: TInt errorCode = 0; sl@0: RMMFVideoPlayControllerCustomCommands thePlayCommander(iController); sl@0: TBool enabled = EFalse; sl@0: thePlayCommander.GetAudioEnabled(enabled); sl@0: if(!enabled) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioEnabled() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of AviPlayController")); sl@0: RMMFAudioPlayDeviceCustomCommands theAudioDevice(iController); sl@0: TInt maxVolume(0); sl@0: errorCode =theAudioDevice.GetMaxVolume(maxVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetMaxVolume() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: TInt theVolume = maxVolume /2; sl@0: TTimeIntervalMicroSeconds ramp(100); sl@0: //try setting volume in Stopped State sl@0: errorCode =theAudioDevice.SetVolume(theVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: TInt theNewVolume (0); sl@0: errorCode =theAudioDevice.GetVolume(theNewVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( theNewVolume != theVolume ) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Volumes are different during Stopped State")); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.SetVolumeRamp(ramp); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolumeRamp() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: //try setting volume in Primed State sl@0: errorCode =theAudioDevice.SetVolume(theVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolume() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetVolume(theNewVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetVolume() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( theNewVolume != theVolume ) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Volumes are different during Primed State")); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.SetVolumeRamp(ramp); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolumeRamp() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: //try setting volume in Playing State sl@0: errorCode =theAudioDevice.SetVolume(theVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolume() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetVolume(theNewVolume); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetVolume() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: if(theNewVolume != theVolume) sl@0: { sl@0: //stop the controller sl@0: INFO_PRINTF1(_L("Set and Get Volumes are different during Playing State")); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.SetVolumeRamp(ramp); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolumeRamp() during play State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: //get the play completion event sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlPlayBalance::RTestStepAviPlayCtrlPlayBalance(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This tests setting the PlayBalance on AviPlayController in Stopped, Primed and Playing sl@0: states and checks if the PlayBalance set is same as the PlayBalance got. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlPlayBalance::DoTestStepL( void ) sl@0: { sl@0: TInt errorCode=0; sl@0: INFO_PRINTF1(_L("this checks if audio is enabled on the sample.avi file")); sl@0: RMMFVideoPlayControllerCustomCommands thePlayCommander(iController); sl@0: TBool enabled = EFalse; sl@0: thePlayCommander.GetAudioEnabled(enabled); sl@0: if(!enabled) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioEnabled() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: INFO_PRINTF1(_L("this step tests SetBalance/GetBalance() APIs of AviPlayController ")); sl@0: RMMFAudioPlayDeviceCustomCommands theAudioDevice( iController ); sl@0: TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft; sl@0: errorCode = theAudioDevice.SetBalance(theBalance); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: TInt theNewBalance (0); sl@0: errorCode =theAudioDevice.GetBalance(theNewBalance); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetBalance() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( theNewBalance != theBalance ) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Balances are different during Stopped State")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = theAudioDevice.SetBalance( theBalance ); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetBalance() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetBalance( theNewBalance ); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetBalance() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( theNewBalance != theBalance ) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Balances are different during Primed State")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theAudioDevice.SetBalance(theBalance); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetBalance() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetBalance(theNewBalance); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetBalance() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: if(theNewBalance != theBalance) sl@0: { sl@0: //stop the controller sl@0: INFO_PRINTF1(_L("Set and Get Balances are different during Playing State")); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: //get the play completion event sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlDuration::RTestStepAviPlayCtrlDuration(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This tests checks for the duration of the file in Stopped, Primed and Playing states. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlDuration::DoTestStepL(void) sl@0: { sl@0: const TTimeIntervalMicroSeconds KExpectedDuration = 6300000; sl@0: INFO_PRINTF1(_L("this step checks for duration of the file")); sl@0: TTimeIntervalMicroSeconds expectedDuration(KExpectedDuration); sl@0: TTimeIntervalMicroSeconds currentDuration; sl@0: TInt errorCode = iController.GetDuration(currentDuration); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: else if(currentDuration != expectedDuration) sl@0: { sl@0: INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), currentDuration. Int64()); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.GetDuration(currentDuration); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: else if(currentDuration != expectedDuration) sl@0: { sl@0: INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), currentDuration. Int64()); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.GetDuration(currentDuration); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: else if(currentDuration != expectedDuration) sl@0: { sl@0: INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), currentDuration. Int64()); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlPause::RTestStepAviPlayCtrlPause(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step. This tests the Pause functionality of the AviPlayController in Stopped, Primed and Playing sl@0: states and checks if it returns KErrNot Supported. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlPause::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests Pause() API of AviPlayController ")); sl@0: TInt errorCode = iController.Pause(); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("Pause() during Stopped State is failed to return KErrNotSupported but returned %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.Pause(); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("Pause() during Primed State is failed to return KErrNotSupported but returned %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.Pause(); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("Pause() during Playing State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode != KErrNotReady) sl@0: { sl@0: INFO_PRINTF2(_L("Play() after Pause() is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: //get the play completion event sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlStop::RTestStepAviPlayCtrlStop(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step. This tests the Stop functionality of the AviPlayController in Stopped, Primed and Playing sl@0: states It expects KErrNotReady error if Stop is called during Stopped state. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlStop::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests Stop() API of AviPlayController ")); sl@0: TInt errorCode = iController.Stop(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Stop() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.Stop(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Stop() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: User::After(2000000); sl@0: errorCode = iController.Stop(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Stop() during Playing State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() after Stop() is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EInconclusive; sl@0: } sl@0: //get the play completion event sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlSetGetCropRegion::RTestStepAviPlayCtrlSetGetCropRegion(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to set and get the crop region for the file. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetGetCropRegion::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests GetCropRegion() APIs of AviPlayController")); sl@0: TRect cropRegion(1,3,5,7); sl@0: TRect newCropRegion(1,3,5,7); sl@0: RMMFVideoPlayControllerCustomCommands thePlayCommander(iController); sl@0: TInt errorCode =thePlayCommander.SetCropRegion(cropRegion); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetCropRegion() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =thePlayCommander.GetCropRegion(newCropRegion); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetCropRegion() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =thePlayCommander.SetCropRegion(cropRegion); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetCropRegion() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =thePlayCommander.GetCropRegion(newCropRegion); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetCropRegion() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =thePlayCommander.SetCropRegion(cropRegion); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetCropRegion() during play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =thePlayCommander.GetCropRegion(newCropRegion); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetCropRegion() during play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlSetGetFrameRate::RTestStepAviPlayCtrlSetGetFrameRate(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to set and get the framerate for the file sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetGetFrameRate::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests SetFrameRate/GetFrameRate() APIs of AviPlayController")); sl@0: TInt KFrameRate = 10; sl@0: TReal32 frameRate(KFrameRate); sl@0: TReal32 expectedFrameRate(KFrameRate) ; sl@0: RMMFVideoControllerCustomCommands theVideoCommander(iController); sl@0: TInt errorCode =theVideoCommander.SetFrameRate(frameRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetFrameRate() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoCommander.GetFrameRate(expectedFrameRate); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetFrameRate() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if(expectedFrameRate != KFrameRate) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Framerates are different during Stopped State")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoCommander.SetFrameRate(frameRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetFrameRate() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoCommander.GetFrameRate(expectedFrameRate); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetFrameRate() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if(expectedFrameRate != KFrameRate) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Framerates are different during Primed State")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EInconclusive; sl@0: } sl@0: //try getting framerate inPlaying State sl@0: errorCode =theVideoCommander.SetFrameRate(frameRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetFrameRate() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoCommander.GetFrameRate(expectedFrameRate); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetFrameRate() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: if(expectedFrameRate != KFrameRate) sl@0: { sl@0: INFO_PRINTF1(_L("Set and Get Framerates are different during Playing State")); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlGetFrameSize::RTestStepAviPlayCtrlGetFrameSize(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to get the framesize from the file. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlGetFrameSize::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests GetFrameSize() APIs of AviPlayController")); sl@0: TSize frameSize(0,0); sl@0: TSize expectedFrameSize(176,144); sl@0: RMMFVideoControllerCustomCommands theVideoCommander(iController); sl@0: TInt errorCode =theVideoCommander.GetVideoFrameSize(frameSize); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetFrameSize() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if(frameSize != expectedFrameSize) sl@0: { sl@0: INFO_PRINTF1(_L("Frame sizes are different during Stopped states")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoCommander.GetVideoFrameSize(frameSize); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetFrameSize() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( frameSize != expectedFrameSize ) sl@0: { sl@0: INFO_PRINTF1(_L("Frame sizes are different during Primed state")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoCommander.GetVideoFrameSize(frameSize); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetFrameSize() during play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: if( frameSize != expectedFrameSize ) sl@0: { sl@0: INFO_PRINTF1(_L("Frame sizes are different during play state")); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: //get the play completion event sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlGetAudioDataType::RTestStepAviPlayCtrlGetAudioDataType(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to get the audio data type from the avi file. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlGetAudioDataType::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("this step tests GetAudioType() and GetAudioBitRate() APIs of AviPlayController")); sl@0: TFourCC audioCodec; sl@0: TFourCC expectedAudioCodec(KMMFFourCCCodePCM16); sl@0: TInt errorCode = 0; sl@0: TInt bitRate = 705600; sl@0: TInt newBitRate =0; sl@0: RMMFVideoPlayControllerCustomCommands thePlayCommander(iController); sl@0: TBool enabled(EFalse); sl@0: thePlayCommander.GetAudioEnabled(enabled); sl@0: if(!enabled) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioEnabled() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: RMMFVideoControllerCustomCommands theCommander(iController); sl@0: errorCode =theCommander.GetAudioCodec(audioCodec); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioCodec() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( audioCodec != expectedAudioCodec ) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong audio codec was returned")); sl@0: return EFail; sl@0: } sl@0: errorCode = theCommander.GetAudioBitRate(newBitRate); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if(newBitRate != bitRate ) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong audio bitrate was returned")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: //Check for audio codec sl@0: errorCode =theCommander.GetAudioCodec(audioCodec); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioCodec() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if( audioCodec != expectedAudioCodec ) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong audio codec was returned")); sl@0: return EFail; sl@0: } sl@0: errorCode = theCommander.GetAudioBitRate(newBitRate); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if(newBitRate != bitRate ) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong audio bitrate was returned")); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: //Check for audio codec sl@0: errorCode =theCommander.GetAudioCodec(audioCodec); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioCodec() during play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: if( audioCodec != expectedAudioCodec ) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong audio codec was returned")); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode = theCommander.GetAudioBitRate(newBitRate); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: if(newBitRate != bitRate ) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong audio bitrate was returned")); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlGetVideoDataType::RTestStepAviPlayCtrlGetVideoDataType(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: /** sl@0: Do the test step.This test tries to get the video mime type sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlGetVideoDataType::DoTestStepL(void) sl@0: { sl@0: const TInt KBufferSize = 256; sl@0: INFO_PRINTF1(_L("this step tests GetVideoMimeType() APIs of AviPlayController")); sl@0: HBufC8* iMimeType = HBufC8::NewL(KBufferSize); sl@0: TPtr8 des = iMimeType->Des(); sl@0: TInt errorCode = 0; sl@0: char xv[]="XVID"; sl@0: TUint8* p = (TUint8*)xv; sl@0: TPtrC8 temp(p); sl@0: RMMFVideoControllerCustomCommands theCommander(iController); sl@0: errorCode =theCommander.GetVideoMimeType(des); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoMimeType() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if (des.Compare(temp)) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong video mime type returned")); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Correct video mime type returned")); sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theCommander.GetVideoMimeType(des); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoMimeType() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if (des.Compare(temp)) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong video mime type returned")); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Correct video mime type returned")); sl@0: } sl@0: sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theCommander.GetVideoMimeType(des); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoMimeType() during play State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if (des.Compare(temp)) sl@0: { sl@0: INFO_PRINTF1(_L("Wrong video mime type returned")); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Correct video mime type returned")); sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlMetaData::RTestStepAviPlayCtrlMetaData(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to fetch the metadata from the avi file. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlMetaData::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests GetNumberOfMetaDataEntries/GetMetaDataEntryL() APIs of AviPlayController ")); sl@0: TInt numEntries = 0; sl@0: TInt errorCode = iController.GetNumberOfMetaDataEntries( numEntries ); sl@0: CMMFMetaDataEntry* metaEntry = NULL; sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetNumberOfMetaDataEntries() is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: if(numEntries == 0) sl@0: { sl@0: INFO_PRINTF1(_L("File does not have meta entries ")); sl@0: } sl@0: else sl@0: { sl@0: for(TInt counter = 0; counter < numEntries; ++counter) sl@0: { sl@0: TRAP(errorCode, metaEntry = iController.GetMetaDataEntryL(counter)); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("GetMetaDataEntryL is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: INFO_PRINTF3(_L("%S %S"), &metaEntry->Name(), &metaEntry->Value()); sl@0: } sl@0: } sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlSetGetRotation::RTestStepAviPlayCtrlSetGetRotation(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to set and get the rotation sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetGetRotation::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests SetRotation/GetRotation() APIs of AviPlayController")); sl@0: TVideoRotation aRotation; sl@0: RMMFVideoPlayControllerCustomCommands theVideoPlayCommander(iController); sl@0: TInt errorCode = theVideoPlayCommander.SetRotation(EVideoRotationClockwise90); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetRotation() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoPlayCommander.GetRotation(aRotation); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetRotation() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoPlayCommander.SetRotation(EVideoRotationClockwise90); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetRotation() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoPlayCommander.GetRotation(aRotation); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetRotation() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoPlayCommander.SetRotation(EVideoRotationClockwise90); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetRotation() during Play State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoPlayCommander.GetRotation(aRotation); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetRotation() during Play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlSetGetScaling::RTestStepAviPlayCtrlSetGetScaling(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: * Do the test step.This test tries to do the scaling and expect KErrNotsupported sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetGetScaling::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests SetScaling/GetScaling() APIs of AviPlayController")); sl@0: TReal32 aWidthPercentage = .75; sl@0: TReal32 aHeightPercentage = .3; sl@0: TBool aAntiAliasFiltering = EFalse; sl@0: sl@0: RMMFVideoPlayControllerCustomCommands theVideoPlayCommander(iController); sl@0: TInt errorCode = theVideoPlayCommander.SetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetScaleFactor() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoPlayCommander.GetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetScaleFactor() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = theVideoPlayCommander.SetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetScaleFactor() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoPlayCommander.GetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetScaleFactor() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = theVideoPlayCommander.SetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetScaleFactor() during play State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theVideoPlayCommander.GetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetScaleFactor() during play State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlSetPosition::RTestStepAviPlayCtrlSetPosition(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to set the position in the file and expect KErrNotSupported sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetPosition::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests SetPosition() APIs of AviPlayController")); sl@0: TTimeIntervalMicroSeconds aPosition; sl@0: TInt errorCode = KErrNone; sl@0: errorCode = iController.SetPosition(aPosition); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetPosition() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.SetPosition(aPosition); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetPosition() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.SetPosition(aPosition); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetPosition() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlGetVideoBitrate::RTestStepAviPlayCtrlGetVideoBitrate(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to get the bitrate from the file sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlGetVideoBitrate::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests GetVideoBitrate() APIs of AviPlayController")); sl@0: TInt aBitRate; sl@0: RMMFVideoControllerCustomCommands theVideoCommander(iController); sl@0: TInt errorCode =theVideoCommander.GetVideoBitRate(aBitRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoBitRate() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoBitRate() during Stopped State returned KErrNotSupported %d "), errorCode); sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoCommander.GetVideoBitRate(aBitRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoBitRate() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoBitRate() during Primed State returned KErrNotSupported %d "), errorCode); sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EInconclusive; sl@0: } sl@0: errorCode =theVideoCommander.GetVideoBitRate(aBitRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoBitRate() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("GetVideoBitRate() during Play State returned KErrNotSupported %d "), errorCode); sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlGetAudioBitrate::RTestStepAviPlayCtrlGetAudioBitrate(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: Do the test step.This test tries to fetch the audio bit rate. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlGetAudioBitrate::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests GetAudioBitrate() APIs of AviPlayController")); sl@0: TInt audioBitRate; sl@0: RMMFVideoControllerCustomCommands theVideoCommander(iController); sl@0: TInt errorCode =theVideoCommander.GetAudioBitRate(audioBitRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Stopped State returned KErrNotSupported %d "), errorCode); sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Primed State returned KErrNotSupported %d "), errorCode); sl@0: } sl@0: errorCode =theVideoCommander.GetAudioBitRate(audioBitRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EInconclusive; sl@0: } sl@0: //try getting framerate inPlaying State sl@0: errorCode =theVideoCommander.GetAudioBitRate(audioBitRate); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("GetAudioBitRate() during Playing State returned KErrNotSupported %d "), errorCode); sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviCtrlDirectScreenAccess::RTestStepAviCtrlDirectScreenAccess(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: This test code tries to check the direct screen access property. sl@0: */ sl@0: TVerdict RTestStepAviCtrlDirectScreenAccess::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tests DirectScreenAccessL of AviPlayController when audio not enabled")); sl@0: RMMFVideoPlayControllerCustomCommands theVideoCommander(iController); sl@0: TMMFDSAEvent dsaEvent1 = EAbortDSA; sl@0: TMMFDSAEvent dsaEvent2 = EResumeDSA; sl@0: TInt errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = theVideoCommander.DirectScreenAccessEvent(dsaEvent2); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("DirectScreenAccessEvent() is failed during primed state %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: errorCode = theVideoCommander.DirectScreenAccessEvent(dsaEvent1); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("DirectScreenAccessEvent() is failed during primed state %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviCtrlSetPlayWindow::RTestStepAviCtrlSetPlayWindow(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: This test code tries to set the set playwindow and expects KErrNotSupported sl@0: */ sl@0: TVerdict RTestStepAviCtrlSetPlayWindow::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step plays an avi file ")); sl@0: TInt errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: RMMFVideoPlayControllerCustomCommands theVideoCommander(iController); sl@0: TTimeIntervalMicroSeconds theDuration; sl@0: errorCode = iController.GetDuration(theDuration); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: TInt64 duration = theDuration. Int64(); sl@0: TTimeIntervalMicroSeconds thePlayStart(duration/2); sl@0: TTimeIntervalMicroSeconds thePlayEnd(duration); sl@0: errorCode = theVideoCommander.Play(thePlayStart, thePlayEnd); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() after SetPlayWindow() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: //Negative Tests sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviCtrlPlayInvalid::RTestStepAviCtrlPlayInvalid(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: TVerdict RTestStepAviCtrlPlayInvalid::DoTestStepPreambleL(void) sl@0: { sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Do the test step(Negative Test).This test tries to open an invalid file. Expects KErrCurrupt from AviPlayController sl@0: */ sl@0: TVerdict RTestStepAviCtrlPlayInvalid::DoTestStepL(void) sl@0: { sl@0: const TUid KAviPlayControllerUid = {0x102737A5}; sl@0: INFO_PRINTF1(_L("This test tries to open an invalid file using AviPlayController")); sl@0: iScheduler = new(ELeave)CActiveScheduler; sl@0: CleanupStack::PushL(iScheduler ); sl@0: CActiveScheduler::Install(iScheduler ); sl@0: CleanupStack::Pop(); sl@0: iPriority.iPriority = 11; // set the priority to some default value sl@0: iPriority.iPref = EMdaPriorityPreferenceQuality; sl@0: iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController); sl@0: TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: iControllerEventMonitor->Start(); sl@0: SetupReadFileConfigL(); sl@0: errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig()); sl@0: if(errorCode != KErrCorrupt) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSource() returned KErrCorrupt with invalid .avi file %d "), errorCode); sl@0: return EPass; sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviCtrlNotAudioEnabled::RTestStepAviCtrlNotAudioEnabled(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: sl@0: } sl@0: sl@0: /** sl@0: This test step tries to get the volume and balance from a file where audio is not enabled and expect KErrNotsupported sl@0: */ sl@0: TVerdict RTestStepAviCtrlNotAudioEnabled::DoTestStepL(void) sl@0: { sl@0: TInt theNewBalance (0); sl@0: TTimeIntervalMicroSeconds ramp(100); sl@0: INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of AviPlayController when audio not enabled")); sl@0: RMMFAudioPlayDeviceCustomCommands theAudioDevice(iController); sl@0: TInt maxVolume(0); sl@0: TInt errorCode = theAudioDevice.GetMaxVolume(maxVolume); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetMaxVolume() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: TInt theVolume = maxVolume /2; sl@0: //try setting volume in Stopped State sl@0: errorCode =theAudioDevice.SetVolume(theVolume); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: TInt theNewVolume (0); sl@0: errorCode =theAudioDevice.GetVolume(theNewVolume); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft; sl@0: errorCode = theAudioDevice.SetBalance(theBalance); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetBalance(theNewBalance); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetBalance() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.SetVolumeRamp(ramp); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolumeRamp() during Stopped State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: //try setting volume in Primed State sl@0: errorCode =theAudioDevice.SetVolume(theVolume); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolume() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetVolume(theNewVolume); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetVolume() during Primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.SetVolumeRamp(ramp); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolumeRamp() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft; sl@0: errorCode = theAudioDevice.SetBalance(theBalance); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetBalance() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetBalance(theNewBalance); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetBalance() during primed State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: return EInconclusive; sl@0: } sl@0: //try setting volume in Playing State sl@0: errorCode =theAudioDevice.SetVolume(theVolume); sl@0: if(errorCode!= KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolume() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetVolume(theNewVolume); sl@0: if(errorCode!= KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetVolume() during Playing State is failed with %d "), errorCode); sl@0: iController.Stop(); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.SetVolumeRamp(ramp); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetVolumeRamp() during play State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft; sl@0: errorCode = theAudioDevice.SetBalance(theBalance); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("SetBalance() during playing State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode =theAudioDevice.GetBalance(theNewBalance); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("GetBalance() during playing State is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: //get the play completion event sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name, input filename and the screen number. sl@0: */ sl@0: RTestStepAviPlayCtrlSetScrnPlay::RTestStepAviPlayCtrlSetScrnPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid, TInt aScreenNumber) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: iScreenNumber = aScreenNumber; sl@0: } sl@0: sl@0: //Override base class Preamble sl@0: TVerdict RTestStepAviPlayCtrlSetScrnPlay::DoTestStepPreambleL(void) sl@0: { sl@0: RTestStepAviCtrlBase::DoTestStepPreambleL(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: This is from MMMFControllerEventMonitorObserver.which handles all the events from AviPlayController. sl@0: Base class version is overridden to avoid starting the active schedular twice. sl@0: */ sl@0: void RTestStepAviPlayCtrlSetScrnPlay::HandleEvent(const TMMFEvent& aEvent) sl@0: { sl@0: TInt errorCode = 0; sl@0: if (aEvent.iEventType==KMMFEventCategoryPlaybackComplete) sl@0: { sl@0: if(aEvent.iErrorCode == KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("PlayCompletion is passed with %d "), aEvent.iErrorCode); sl@0: iTestStepResult = EPass; sl@0: } sl@0: else sl@0: { sl@0: iTestStepResult = EFail; sl@0: INFO_PRINTF2(_L("PlayCompletion is failed with %d "), aEvent.iErrorCode); sl@0: } sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete) sl@0: { sl@0: if((aEvent.iErrorCode == KErrNone) || (aEvent.iErrorCode == KErrEof)) sl@0: { sl@0: //add code here to set display window and to update display region. sl@0: RMMFVideoPlayControllerCustomCommands thePlayCommander(iController); sl@0: errorCode = thePlayCommander.SetDisplayWindow(iScreenRect,iClipRect); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetDisplayWindow failed with %d "), errorCode); sl@0: iTestStepResult = EFail; sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: errorCode = thePlayCommander.UpdateDisplayRegion(iRegion); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("UpdateDisplayRegion failed with %d "), errorCode); sl@0: iTestStepResult = EFail; sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: INFO_PRINTF2(_L("Open completion is passed with %d "), aEvent.iErrorCode); sl@0: errorCode = thePlayCommander.Prepare(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prepare failed with %d "), errorCode); sl@0: iTestStepResult = EFail; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: iTestStepResult = EFail; sl@0: INFO_PRINTF2(_L("Video open complete is failed with %d "), aEvent.iErrorCode); sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete) sl@0: { sl@0: if((aEvent.iErrorCode == KErrNone) || (aEvent.iErrorCode == KErrEof)) sl@0: { sl@0: INFO_PRINTF2(_L("Prepare completion is passed with %d "), aEvent.iErrorCode); sl@0: errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: iTestStepResult = EFail; sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() is failed with %d "), errorCode); sl@0: iTestStepResult = EFail; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: iTestStepResult = EFail; sl@0: INFO_PRINTF2(_L("PrepareComplete is failed with %d "),aEvent.iErrorCode); sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Unexpected Event from the Controller")); sl@0: iTestStepResult = EFail; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: sl@0: } sl@0: sl@0: /** sl@0: This test step plays the video on the primary or secondary screen depending the value of screen number passed during its construction. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetScrnPlay::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF2(_L("this step plays an avi file on screen %d using RMMFVideoSetInitScreenCustomCommands"), iScreenNumber); sl@0: iTestStepResult = EFail; sl@0: TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: iControllerEventMonitor->Start(); sl@0: if(!SetupReadFileConfigL()) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: RMMFVideoSetInitScreenCustomCommands setInitScrn(iController); sl@0: errorCode = setInitScrn.SetInitScreenNumber(iScreenNumber); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetInitScreenNumber failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8); sl@0: #ifdef __EABI__ //we dont have secondary screen support on hardware. So fail gracefully. sl@0: if(errorCode == KErrNotSupported && iScreenNumber == KSecondaryScreenNo) sl@0: { sl@0: INFO_PRINTF1(_L("No support for secondary display")); sl@0: return EKnownFailure; sl@0: } sl@0: #endif sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSink failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig()); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: CActiveScheduler::Start(); sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name, input filename and the screen number. sl@0: */ sl@0: RTestStepAviPlayCtrlSetInvalidScrn::RTestStepAviPlayCtrlSetInvalidScrn(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid, TInt aScreenNumber) sl@0: :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: iScreenNumber = aScreenNumber; sl@0: } sl@0: sl@0: //Override base class Preamble sl@0: TVerdict RTestStepAviPlayCtrlSetInvalidScrn::DoTestStepPreambleL(void) sl@0: { sl@0: RTestStepAviCtrlBase::DoTestStepPreambleL(); sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: This test step tries to set an invalid screen on AviPlayController and expects AddDataSink to fail with KErrNotSupported.. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSetInvalidScrn::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tries to set an invalid screen number on the AviPlayController")); sl@0: TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: iControllerEventMonitor->Start(); sl@0: if(!SetupReadFileConfigL()) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: RMMFVideoSetInitScreenCustomCommands setInitScrn(iController); sl@0: errorCode = setInitScrn.SetInitScreenNumber(iScreenNumber); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetInitScreenNumber failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSink failed to return KErrNotSupported but returned %d with an invalid screen"), errorCode); sl@0: return EFail; sl@0: } sl@0: return EPass; sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name, input filename and the screen number. sl@0: */ sl@0: RTestStepAviPlayCtrlAddDataSinkTwice::RTestStepAviPlayCtrlAddDataSinkTwice(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid, TInt aScreenNumber) sl@0: :RTestStepAviPlayCtrlSetScrnPlay(aTestName, aSectName, aKeyName, aControllerUid, aScreenNumber) sl@0: { sl@0: } sl@0: /** sl@0: This test step tries to set an invalid screen after calling AddDataSink on AviController and tries playing. sl@0: It resets the controller after the play is successful and tries to call AddDataSink again and expects sl@0: it to fail with KErrNotSupported. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlAddDataSinkTwice::DoTestStepPreambleL(void) sl@0: { sl@0: RTestStepAviCtrlBase::DoTestStepPreambleL(); sl@0: return EPass; sl@0: } sl@0: sl@0: TVerdict RTestStepAviPlayCtrlAddDataSinkTwice::DoTestStepL(void) sl@0: { sl@0: INFO_PRINTF1(_L("this step tries to add data sink twice.Second time invalid screen")); sl@0: iTestStepResult = EFail; sl@0: TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: iControllerEventMonitor->Start(); sl@0: if(!SetupReadFileConfigL()) sl@0: { sl@0: return EInconclusive; sl@0: } sl@0: errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSink failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: RMMFVideoSetInitScreenCustomCommands setInitScrn(iController); sl@0: errorCode = setInitScrn.SetInitScreenNumber(iScreenNumber); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("SetInitScreenNumber failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig()); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode); sl@0: User::LeaveIfError( errorCode ); sl@0: } sl@0: CActiveScheduler::Start(); sl@0: if(iTestStepResult == EFail) sl@0: { sl@0: return iTestStepResult; sl@0: } sl@0: errorCode = iController.Reset(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Reset is failed with %d "), errorCode); sl@0: return EFail; sl@0: } sl@0: errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8); sl@0: if(errorCode != KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("AddDataSink failed to return KErrNotSupported but returned %d with an invalid screen"), errorCode); sl@0: return EFail; sl@0: } sl@0: return iTestStepResult; sl@0: } sl@0: sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap:: sl@0: RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap(const TDesC& aTestName, sl@0: const TDesC& aSectName, sl@0: const TDesC& aKeyName, sl@0: TUid aControllerUid) sl@0: : sl@0: RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), sl@0: iTestState(EStateDefault), sl@0: iRChunk(), sl@0: iKickoff01(NULL), sl@0: iKickoff02(NULL), sl@0: iKickoff03(NULL), sl@0: iKickoff04(NULL), sl@0: iKickoff05(NULL), sl@0: iKickoff06(NULL) sl@0: { sl@0: } sl@0: sl@0: sl@0: /** sl@0: Do the test step. This test check that under low memory conditions the xvid sl@0: codec may leave and DevVideo will be notified by the codec and and in turn sl@0: AviPlayController will be notified too by DevVideo using the FatalError sl@0: callbacks. Once the low memory conditions return to normal, the test case sl@0: Primes the AviPlayController and Plays an avi file to its completion and checks sl@0: for the proper play completion. This will prove that DevVideo is destroyed and sl@0: then recreated after a FatalError occurs. sl@0: sl@0: The idea here is : sl@0: sl@0: 1.- To allocate enough memory with the aim of leaving around KMaxFreeRamForTest sl@0: bytes available for the rest of the test case. sl@0: sl@0: 2.- After that, the testcase Primes the AviPlayController and Plays an avi sl@0: file. Play is expected to fail with KErrTooBig (in the play completion event). sl@0: sl@0: 3.- Then returns memory back to the system. sl@0: sl@0: 4.- Then try to play the video file again, this time everything will work sl@0: fine...With this we test that DevVideo's been recreated... sl@0: sl@0: */ sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::KickoffTestL() sl@0: { sl@0: iTestState = EStateLoadKickoffTestLComplete; sl@0: sl@0: INFO_PRINTF1(_L("this step plays an avi file under low memory conditions for the xvid decoder ")); sl@0: sl@0: // This will install two callbacks sl@0: RAsyncTestStepAviCtrlPlayBase::KickoffTestL(); sl@0: sl@0: // STEP 1: The idea here is to allocate enough memory with the aim of sl@0: // leaving around KMaxFreeRamForTest bytes available for the rest of the sl@0: // step. That will make the xvid decoder to fail the frame decoding as the sl@0: // decoder heap will not be large enough. sl@0: TCallBack callback01 (AllocChunkCallBack, this); sl@0: delete iKickoff01; sl@0: iKickoff01 = NULL; sl@0: iKickoff01 = new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow); sl@0: sl@0: sl@0: // STEP 2: Prime the controller... sl@0: TCallBack callback02 (PrimeControllerCallBack, this); sl@0: delete iKickoff02; sl@0: iKickoff02 = NULL; sl@0: iKickoff02 = new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow); sl@0: sl@0: // STEP 3: play is expected to fail with KErrTooBig (in the play completion event ) ... sl@0: TCallBack callback03 (PlayControllerCallBack, this); sl@0: delete iKickoff03; sl@0: iKickoff03 = NULL; sl@0: iKickoff03 = new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow); sl@0: sl@0: // STEP 4: Return memory back to system here... sl@0: TCallBack callback04 (ReturnChunckAndStopControllerCallBack, this); sl@0: delete iKickoff04; sl@0: iKickoff04 = NULL; sl@0: iKickoff04 = new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow); sl@0: sl@0: // Repeat prime.... sl@0: TCallBack callback05 (PrimeControllerCallBack, this); sl@0: delete iKickoff05; sl@0: iKickoff05 = NULL; sl@0: iKickoff05 = new (ELeave) CAsyncCallBack (callback05, CActive::EPriorityLow); sl@0: sl@0: // ...and repeat play sl@0: TCallBack callback06 (PlayControllerCallBack, this); sl@0: delete iKickoff06; sl@0: iKickoff06 = NULL; sl@0: iKickoff06 = new (ELeave) CAsyncCallBack (callback06, CActive::EPriorityLow); sl@0: sl@0: // Start allocate chunck callback. sl@0: iKickoff01->Call(); sl@0: } sl@0: sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::CloseTest() sl@0: { sl@0: delete iKickoff01; // no need to Cancel sl@0: iKickoff01 = NULL; sl@0: delete iKickoff02; // no need to Cancel sl@0: iKickoff02 = NULL; sl@0: delete iKickoff03; // no need to Cancel sl@0: iKickoff03 = NULL; sl@0: delete iKickoff04; // no need to Cancel sl@0: iKickoff04 = NULL; sl@0: delete iKickoff05; // no need to Cancel sl@0: iKickoff05 = NULL; sl@0: delete iKickoff06; // no need to Cancel sl@0: iKickoff06 = NULL; sl@0: sl@0: RAsyncTestStepAviCtrlPlayBase::CloseTest(); sl@0: } sl@0: sl@0: sl@0: TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::AllocChunkCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self = sl@0: static_cast (aPtr); sl@0: self->DoAllocChunkCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoAllocChunkCallBack() sl@0: { sl@0: // Check simple FSM sl@0: if (iTestState != EStateLoadKickoffTestLComplete) sl@0: { sl@0: INFO_PRINTF1(_L("FSM error in DoAllocChunkCallBack")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: sl@0: iTestState = EStateAllocChunkCallBackComplete; sl@0: sl@0: TInt freeRam = 0; sl@0: sl@0: TInt halError = KErrNone; sl@0: if ((halError = HAL::Get(HALData::EMemoryRAMFree, freeRam)) != KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("Unable to obtain the amount of free ram available ")); sl@0: StopTest(halError, EInconclusive); sl@0: return; sl@0: } sl@0: sl@0: if (freeRam > KMaxFreeRamForTest) sl@0: { sl@0: TInt memToAllocate = freeRam - KMaxFreeRamForTest; sl@0: INFO_PRINTF3(_L("freeRam = %d bytes, before allocating %d bytes"), sl@0: freeRam, memToAllocate); sl@0: TInt chunkError = KErrNone; sl@0: //We have calculated the amount of memory to allocate sl@0: //start by allocating half of that amount sl@0: sl@0: if((chunkError=iRChunk[0].CreateLocal(memToAllocate/2, memToAllocate/2 + 1))!=KErrNone) sl@0: { sl@0: INFO_PRINTF3(_L("At least %d mem bytes are needed for this test (err=%d)"), sl@0: KMaxFreeRamForTest, chunkError); sl@0: StopTest(chunkError, EInconclusive); sl@0: return; sl@0: } sl@0: //WDP: we are allocating on paged memory. So keep allocating chunks till you are Out of Memory sl@0: //Now allocate smaller chunks. Only half of memToAllocate has been allocated yet sl@0: //In every iteration we try to allocate KMaxFreeRamForTest/2 sl@0: //Calculate the max loop value till which we should run, add some extra iterations so that this loop goes on till OOM for sure sl@0: //Number of iterations is (0.5*memToAllocate)/(0.5*KMaxFreeRamForTest) sl@0: TInt loopValue=(memToAllocate/KMaxFreeRamForTest)+KExtraIterations; sl@0: if(loopValue>KMaxChunks) sl@0: { sl@0: //We should not get here. sl@0: INFO_PRINTF1(_L("Cannot Create so many chunks")); sl@0: StopTest(chunkError, EInconclusive); sl@0: return; sl@0: } sl@0: for(iNumAllocatedChunks=1;iNumAllocatedChunks0) sl@0: { sl@0: iRChunk[--iNumAllocatedChunks].Close(); sl@0: } sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: //Unexpected error sl@0: INFO_PRINTF1(_L("Received Unexpected error")); sl@0: StopTest(chunkError, EInconclusive); sl@0: return; sl@0: } sl@0: } sl@0: } sl@0: if(chunkError!=KErrNoMemory) sl@0: { sl@0: //We are out of the loop and still not out of memory. This is not expected sl@0: INFO_PRINTF2(_L("Expecting -4 by now but still not out of memory. Allocated chunks %d"),iNumAllocatedChunks); sl@0: StopTest(chunkError, EInconclusive); sl@0: return; sl@0: } sl@0: sl@0: iKickoff02->Call(); // Start prime sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("At least %d mem bytes are needed for this test "), KMaxFreeRamForTest); sl@0: StopTest(KErrGeneral, EInconclusive); sl@0: } sl@0: } sl@0: sl@0: sl@0: TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::PrimeControllerCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self = sl@0: static_cast (aPtr); sl@0: self->DoPrimeControllerCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoPrimeControllerCallBack() sl@0: { sl@0: sl@0: // Check simple fsm sl@0: switch (iTestState) sl@0: { sl@0: case EStateAllocChunkCallBackComplete: sl@0: { sl@0: iTestState = EStatePrimeControllerCallBackComplete1; sl@0: iKickoff03->Call(); // Start 1st playback sl@0: break; sl@0: } sl@0: case EStateReturnChunckAndStopControllerCallBackComplete: sl@0: { sl@0: iTestState = EStatePrimeControllerCallBackComplete2; sl@0: iKickoff06->Call(); // Start 2nd playback sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: INFO_PRINTF1(_L("FSM error in DoPrimeControllerCallBack")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: }; sl@0: sl@0: INFO_PRINTF1(_L("iController.Prime()")); sl@0: sl@0: TInt errorCode = iController.Prime(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Prime is failed with %d "), errorCode); sl@0: StopTest(errorCode, EFail); sl@0: } sl@0: } sl@0: sl@0: sl@0: TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::PlayControllerCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self = sl@0: static_cast (aPtr); sl@0: self->DoPlayControllerCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoPlayControllerCallBack() sl@0: { sl@0: sl@0: // Check simple fsm sl@0: switch (iTestState) sl@0: { sl@0: case EStatePrimeControllerCallBackComplete1: sl@0: { sl@0: iTestState = EStatePlayControllerCallBackComplete1; sl@0: break; sl@0: } sl@0: case EStatePrimeControllerCallBackComplete2: sl@0: { sl@0: iTestState = EStatePlayControllerCallBackComplete2; sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: INFO_PRINTF1(_L("FSM error in DoPlayControllerCallBack")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: }; sl@0: sl@0: INFO_PRINTF1(_L("iController.Play()")); sl@0: sl@0: TInt errorCode = iController.Play(); sl@0: if(errorCode) sl@0: { sl@0: INFO_PRINTF2(_L("Play() failed with error %d"), errorCode); sl@0: StopTest(errorCode, EFail); sl@0: } sl@0: } sl@0: sl@0: TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::ReturnChunckAndStopControllerCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self = sl@0: static_cast (aPtr); sl@0: self->DoReturnChunckAndStopControllerCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoReturnChunckAndStopControllerCallBack() sl@0: { sl@0: // Check simple fsm sl@0: if (iTestState != EStatePlayControllerCallBackComplete1) sl@0: { sl@0: INFO_PRINTF1(_L("FSM error in DoReturnChunckAndStopControllerCallBack")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: iTestState = EStateReturnChunckAndStopControllerCallBackComplete; sl@0: sl@0: INFO_PRINTF1(_L("Returning memory back to the system")); sl@0: sl@0: for(TInt i=0;iCall(); // call prime again sl@0: } sl@0: sl@0: sl@0: /** sl@0: This is from MMMFControllerEventMonitorObserver.which handles all the events sl@0: from AviPlayController. Base class version is overridden to avoid starting the sl@0: active schedular twice. sl@0: */ sl@0: void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::HandleEvent(const TMMFEvent& aEvent) sl@0: { sl@0: INFO_PRINTF2(_L("HandleEvent aEvent.iEventType %d "), sl@0: aEvent.iEventType); sl@0: INFO_PRINTF2(_L("::HandleEvent aEvent.iErrorCode %d "), sl@0: aEvent.iErrorCode); sl@0: sl@0: if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete) sl@0: { sl@0: if(aEvent.iErrorCode == KErrNone) sl@0: { sl@0: iTestStepResult = EPass; sl@0: INFO_PRINTF2(_L("PlayCompletion is passed with %d "), sl@0: aEvent.iErrorCode); sl@0: } sl@0: else sl@0: { sl@0: iTestStepResult = EFail; sl@0: INFO_PRINTF2(_L("PlayCompletion is failed with %d "), sl@0: aEvent.iErrorCode); sl@0: } sl@0: sl@0: // sl@0: // Match fsm state with play completion event just processed sl@0: // sl@0: switch(iTestState) sl@0: { sl@0: case EStatePlayControllerCallBackComplete1: sl@0: { sl@0: if (iTestStepResult == EPass) sl@0: { sl@0: INFO_PRINTF1(_L("Error: completion event was expected to be failed at this point")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: sl@0: iKickoff04->Call(); // Return memory sl@0: break; sl@0: } sl@0: case EStatePlayControllerCallBackComplete2: sl@0: { sl@0: if (iTestStepResult == EFail) sl@0: { sl@0: INFO_PRINTF1(_L("Error: PlayCompletion event was expected to pass at this point")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: else sl@0: { sl@0: // Test has finished succesfully at this point sl@0: INFO_PRINTF1(_L("Test successfully completed")); sl@0: StopTest(); sl@0: return; sl@0: } sl@0: } sl@0: default: sl@0: { sl@0: INFO_PRINTF1(_L("FSM error in HandleEvent")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: }; sl@0: } sl@0: else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete) sl@0: { sl@0: if(aEvent.iErrorCode != KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("Video open complete is failed with %d "), aEvent.iErrorCode); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Unexpected Event from the Controller")); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlMemAlloc1::RTestStepAviPlayCtrlMemAlloc1(const TDesC& aTestName, sl@0: const TDesC& aSectName, sl@0: const TDesC& aKeyName, sl@0: TUid aControllerUid) sl@0: : RTestStepAviCtrlBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Do the test step. This test issue a custom command to the custom AviPlay controller sl@0: and runs the OOM test within the controller. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlMemAlloc1::DoTestStepL() sl@0: { sl@0: TVerdict result = EPass; sl@0: sl@0: Log( _L("Memory Allocation Test 1") ); sl@0: sl@0: Log( _L("This test checks memory allocation of the plugin") ); sl@0: sl@0: TInt errorCode = iController.Open(KUidCustomTestAviPlayPlugin, iPriority); sl@0: User::LeaveIfError( errorCode ); sl@0: sl@0: //[ send the custom command to the custom audio controller ] sl@0: TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId); sl@0: sl@0: //[ send memory alloc test to the custom plugin ] sl@0: //[ we have only ensured that the controller is loaded into memory sl@0: // and that all add sources etc will be don sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KMemoryAllocTest1, sl@0: KNullDesC8, sl@0: KNullDesC8); sl@0: sl@0: //[ ensure the controller is unloaded so that it does sl@0: // not interfere with the following test ] sl@0: // There is a bug in this code and the stop followed by reset sl@0: // ensure the controller resources are released. sl@0: iController.Stop(); sl@0: iController.Reset(); sl@0: iController.Close(); sl@0: sl@0: User::LeaveIfError( errorCode ); sl@0: return result ; sl@0: } sl@0: sl@0: /** sl@0: This is from MMMFControllerEventMonitorObserver.which handles all the events sl@0: from AviPlayController. Base class version is overridden to avoid starting the sl@0: active schedular twice. sl@0: */ sl@0: void RTestStepAviPlayCtrlMemAlloc1::HandleEvent(const TMMFEvent& aEvent) sl@0: { sl@0: (void)aEvent; sl@0: }; sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlMemAlloc2::RTestStepAviPlayCtrlMemAlloc2(const TDesC& aTestName, sl@0: const TDesC& aSectName, sl@0: const TDesC& aKeyName, sl@0: TUid aControllerUid) sl@0: : RTestStepAviCtrlBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Do the test step. This test issue a custom command to the custom AviPlay controller sl@0: and runs the OOM test within the controller. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlMemAlloc2::DoTestStepL() sl@0: { sl@0: TVerdict result = EPass; sl@0: sl@0: Log( _L("Memory Allocation Test 2") ); sl@0: sl@0: Log( _L("This test checks memory allocation of the plugin") ); sl@0: sl@0: TInt errorCode = iController.Open(KUidCustomTestAviPlayPlugin, iPriority); sl@0: User::LeaveIfError( errorCode ); sl@0: sl@0: //[ send the custom command to the custom audio controller ] sl@0: TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId); sl@0: sl@0: //[ set the prime OOM test mode ] sl@0: //[ we have only ensured that the controller is loaded into memory sl@0: // and that all add sources etc will be don sl@0: TPckgBuf primeTestEnable(ETrue); sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KOOMPrimeTestEnable, sl@0: primeTestEnable, sl@0: KNullDesC8); sl@0: if (errorCode == KErrNone) sl@0: { sl@0: TInt failCount = 1; sl@0: for (;;) sl@0: { sl@0: TPckgBuf primeTestFailCount(failCount); sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KOOMPrimeTestFailCount, sl@0: primeTestFailCount, sl@0: KNullDesC8); sl@0: if (errorCode != KErrNone) sl@0: { sl@0: result = EInconclusive; sl@0: break; sl@0: } sl@0: sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KMemoryAllocTest2, sl@0: KNullDesC8, sl@0: KNullDesC8); sl@0: if (errorCode != KErrNone) sl@0: { sl@0: result = EInconclusive; sl@0: break; sl@0: } sl@0: sl@0: errorCode = iController.Prime(); sl@0: if (errorCode == KErrNone) sl@0: { sl@0: result = EPass; sl@0: break; sl@0: } sl@0: else if (errorCode != KErrNoMemory) sl@0: { sl@0: result = EFail; sl@0: break; sl@0: } sl@0: sl@0: iController.Reset(); sl@0: failCount++; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: result = EInconclusive; sl@0: } sl@0: sl@0: primeTestEnable() = EFalse; sl@0: iController.CustomCommandSync(destinationPckg, sl@0: KOOMPrimeTestEnable, sl@0: primeTestEnable, sl@0: KNullDesC8); sl@0: sl@0: //[ ensure the controller is unloaded so that it does sl@0: // not interfere with the following test ] sl@0: // There is a bug in this code and the stop followed by reset sl@0: // ensure the controller resources are released. sl@0: iController.Stop(); sl@0: iController.Reset(); sl@0: iController.Close(); sl@0: sl@0: return result ; sl@0: } sl@0: sl@0: /** sl@0: This is from MMMFControllerEventMonitorObserver.which handles all the events sl@0: from AviPlayController. Base class version is overridden to avoid starting the sl@0: active schedular twice. sl@0: */ sl@0: void RTestStepAviPlayCtrlMemAlloc2::HandleEvent(const TMMFEvent& aEvent) sl@0: { sl@0: (void)aEvent; sl@0: }; sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename sl@0: */ sl@0: RTestStepAviPlayCtrlMemAlloc3::RTestStepAviPlayCtrlMemAlloc3(const TDesC& aTestName, sl@0: const TDesC& aSectName, sl@0: const TDesC& aKeyName, sl@0: TUid aControllerUid) sl@0: : RTestStepAviCtrlBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: Do the test step. This test issue a custom command to the custom AviPlay controller sl@0: and runs the OOM test within the controller. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlMemAlloc3::DoTestStepL() sl@0: { sl@0: TVerdict result = EPass; sl@0: sl@0: Log( _L("Memory Allocation Test 3") ); sl@0: sl@0: Log( _L("This test checks memory allocation of the plugin") ); sl@0: sl@0: TInt errorCode = iController.Open(KUidCustomTestAviPlayPlugin, iPriority); sl@0: User::LeaveIfError( errorCode ); sl@0: sl@0: //[ send the custom command to the custom audio controller ] sl@0: TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId); sl@0: sl@0: TInt failCount = 1; sl@0: for (;;) sl@0: { sl@0: TPckgBuf primeTestFailCount(failCount); sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KOOMPrimeTestFailCount, sl@0: primeTestFailCount, sl@0: KNullDesC8); sl@0: if (errorCode != KErrNone) sl@0: { sl@0: result = EInconclusive; sl@0: break; sl@0: } sl@0: sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KMemoryAllocTest2, sl@0: KNullDesC8, sl@0: KNullDesC8); sl@0: if (errorCode != KErrNone) sl@0: { sl@0: result = EInconclusive; sl@0: break; sl@0: } sl@0: sl@0: errorCode = iController.Prime(); sl@0: if (errorCode != KErrNone) sl@0: { sl@0: result = EInconclusive; sl@0: break; sl@0: } sl@0: sl@0: errorCode = iController.CustomCommandSync(destinationPckg, sl@0: KMemoryAllocTest3, sl@0: KNullDesC8, sl@0: KNullDesC8); sl@0: sl@0: if (errorCode == KErrNone) sl@0: { sl@0: result = EPass; sl@0: break; sl@0: } sl@0: else if (errorCode != KErrNoMemory) sl@0: { sl@0: result = EFail; sl@0: break; sl@0: } sl@0: sl@0: iController.Reset(); sl@0: failCount++; sl@0: } sl@0: sl@0: //[ ensure the controller is unloaded so that it does sl@0: // not interfere with the following test ] sl@0: // There is a bug in this code and the stop followed by reset sl@0: // ensure the controller resources are released. sl@0: iController.Stop(); sl@0: iController.Reset(); sl@0: iController.Close(); sl@0: sl@0: return result ; sl@0: } sl@0: sl@0: /** sl@0: This is from MMMFControllerEventMonitorObserver.which handles all the events sl@0: from AviPlayController. Base class version is overridden to avoid starting the sl@0: active schedular twice. sl@0: */ sl@0: void RTestStepAviPlayCtrlMemAlloc3::HandleEvent(const TMMFEvent& aEvent) sl@0: { sl@0: (void)aEvent; sl@0: }; sl@0: sl@0: #ifdef SYMBIAN_BUILD_GCE sl@0: sl@0: /** sl@0: Test step constructor. It initialises its own name and the input filename. sl@0: */ sl@0: RTestStepAviPlayCtrlSurfaceSupport::RTestStepAviPlayCtrlSurfaceSupport(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController) sl@0: { sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceSupport::KickoffTestL() sl@0: { sl@0: // Allow parent to create some call backs for its initialization. sl@0: // Should open the video controller, set the filename, add the source and add the sink. sl@0: RAsyncTestStepAviCtrlPlayBase::KickoffTestL(); sl@0: sl@0: iSurfaceCreated = EFalse; sl@0: sl@0: // Call UseSurfaces sl@0: TCallBack callbackUseSurfaces(UseSurfacesCallBack, this); sl@0: delete iKickoffUseSurfaces; sl@0: iKickoffUseSurfaces = NULL; sl@0: iKickoffUseSurfaces = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow); sl@0: iKickoffUseSurfaces->Call(); sl@0: sl@0: // Call UseSurfaces again. This should not fail or cause any other subsequent step to fail. sl@0: delete iKickoffUseSurfaces2; sl@0: iKickoffUseSurfaces2 = NULL; sl@0: iKickoffUseSurfaces2 = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow); sl@0: iKickoffUseSurfaces2->Call(); sl@0: sl@0: // Prime the controller sl@0: TCallBack callbackPrimeController(PrimeControllerCallBack, this); sl@0: delete iKickoffPrimeController; sl@0: iKickoffPrimeController = NULL; sl@0: iKickoffPrimeController = new (ELeave) CAsyncCallBack(callbackPrimeController, CActive::EPriorityLow); sl@0: iKickoffPrimeController->Call(); sl@0: sl@0: TCallBack callbackPlayController(PlayControllerCallBack, this); sl@0: delete iKickoffPlayController; sl@0: iKickoffPlayController = NULL; sl@0: iKickoffPlayController = new (ELeave) CAsyncCallBack(callbackPlayController, CActive::EPriorityLow); sl@0: iKickoffPlayController->Call(); sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceSupport::CloseTest() sl@0: { sl@0: // no need to Cancel before deleting. sl@0: delete iKickoffUseSurfaces; sl@0: iKickoffUseSurfaces = NULL; sl@0: delete iKickoffUseSurfaces2; sl@0: iKickoffUseSurfaces2 = NULL; sl@0: delete iKickoffPrimeController; sl@0: iKickoffPrimeController = NULL; sl@0: sl@0: RAsyncTestStepAviCtrlPlayBase::CloseTest(); sl@0: } sl@0: sl@0: /** sl@0: Check if we have passed the test. We need to make sure that we have received all the event sl@0: messages that we expect. sl@0: */ sl@0: TVerdict RTestStepAviPlayCtrlSurfaceSupport::CheckTestResult() sl@0: { sl@0: // Only report that we have not received all expected events if everything else passes. sl@0: // We don't expect the event generators to work properly if something else failed (and those sl@0: // other error codes and reasons should be more useful). We won't see these events if GCE is sl@0: // not enabled. So, if GCE is disabled, do not fail because we didn't see these events. sl@0: if (Result() == EPass && !iSurfaceCreated && iGceEnabled) sl@0: { sl@0: if (!iSurfaceCreated) sl@0: { sl@0: ERR_PRINTF1(_L("Failed to receive surface created event")); sl@0: } sl@0: sl@0: return EFail; sl@0: } sl@0: sl@0: return RAsyncTestStepAviCtrlPlayBase::CheckTestResult(); sl@0: } sl@0: sl@0: /** sl@0: This is from MMMFControllerEventMonitorObserver.which handles all the events sl@0: from AviPlayController. Base class version is overridden to avoid starting the sl@0: active schedular twice. sl@0: */ sl@0: void RTestStepAviPlayCtrlSurfaceSupport::HandleEvent(const TMMFEvent& aEvent) sl@0: { sl@0: if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete) sl@0: { sl@0: if(aEvent.iErrorCode != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Video open complete has failed with %d "), aEvent.iErrorCode); sl@0: StopTest(KErrGeneral, EInconclusive); sl@0: return; sl@0: } sl@0: } sl@0: else if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceCreated) sl@0: { sl@0: if (!iGceEnabled) sl@0: { sl@0: ERR_PRINTF1(_L("Surface events should not be generated when GCE is not enabled")); sl@0: StopTest(KErrGeneral, EFail); sl@0: return; sl@0: } sl@0: sl@0: // The error code is actually the display for which a surface has been created. sl@0: if (aEvent.iErrorCode != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Video surface created event has error %d."), aEvent.iErrorCode); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: sl@0: // Now that the surface has been created we can check if can retrieve the surface parameters sl@0: TRect cropRect; sl@0: TVideoAspectRatio pixelAspectRatio; sl@0: sl@0: TInt error = iVpsCommands.GetSurfaceParameters(iSurfaceId, cropRect, pixelAspectRatio); sl@0: if (error) sl@0: { sl@0: ERR_PRINTF2(_L("GetSurfaceParameters failed with code %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: sl@0: iSurfaceCreated = ETrue; sl@0: } sl@0: else if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete) sl@0: { sl@0: if(aEvent.iErrorCode == KErrNone) sl@0: { sl@0: if(iGceEnabled) sl@0: { sl@0: TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId); sl@0: if (error) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed with code %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: } sl@0: StopTest(); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("Video playback complete has failed with %d "), aEvent.iErrorCode); sl@0: StopTest(KErrGeneral, EInconclusive); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("Unexpected Event from the Controller: type %d error: %d"), aEvent.iEventType, aEvent.iErrorCode); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceSupport::UseSurfacesCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceSupport* self = sl@0: static_cast (aPtr); sl@0: self->DoUseSurfacesCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceSupport::DoUseSurfacesCallBack() sl@0: { sl@0: TInt error = iVpsCommands.UseSurfaces(); sl@0: sl@0: if (iGceEnabled && error != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UseSurfaces failed with code %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("UseSurfaces failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceSupport::PrimeControllerCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceSupport* self = sl@0: static_cast (aPtr); sl@0: self->DoPrimeControllerCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceSupport::DoPrimeControllerCallBack() sl@0: { sl@0: TInt error = iController.Prime(); sl@0: if (error != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Prime failed with %d "), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceSupport::PlayControllerCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceSupport* self = sl@0: static_cast (aPtr); sl@0: self->DoPlayControllerCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceSupport::DoPlayControllerCallBack() sl@0: { sl@0: TInt error = iController.Play(); sl@0: if (error != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Play failed with %d "), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: } sl@0: sl@0: RTestStepAviPlayCtrlSurfaceRemovedNoUS::RTestStepAviPlayCtrlSurfaceRemovedNoUS(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController) sl@0: { sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNoUS::KickoffTestL() sl@0: { sl@0: // Allow parent to create some call backs for its initialization. sl@0: // Should open the video controller, set the filename, add the source and add the sink. sl@0: RAsyncTestStepAviCtrlPlayBase::KickoffTestL(); sl@0: sl@0: // Call SurfaceRemoved sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: sl@0: TCallBack callbackSurfaceRemoved(SurfaceRemovedCallBack, this); sl@0: delete iKickoffSurfaceRemoved; sl@0: iKickoffSurfaceRemoved = NULL; sl@0: iKickoffSurfaceRemoved = new (ELeave) CAsyncCallBack(callbackSurfaceRemoved, CActive::EPriorityLow); sl@0: iKickoffSurfaceRemoved->Call(); sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNoUS::CloseTest() sl@0: { sl@0: // no need to Cancel before deleting. sl@0: delete iKickoffSurfaceRemoved; sl@0: iKickoffSurfaceRemoved = NULL; sl@0: sl@0: RAsyncTestStepAviCtrlPlayBase::CloseTest(); sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceRemovedNoUS::SurfaceRemovedCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceRemovedNoUS* self = sl@0: static_cast (aPtr); sl@0: self->DoSurfaceRemovedCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNoUS::DoSurfaceRemovedCallBack() sl@0: { sl@0: TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId); sl@0: sl@0: if (iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed to return error KErrNotSupported. Actual error was %d "), error); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else sl@0: { sl@0: StopTest(); sl@0: } sl@0: } sl@0: sl@0: RTestStepAviPlayCtrlGetSurfaceParametersNoUS::RTestStepAviPlayCtrlGetSurfaceParametersNoUS(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController) sl@0: { sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlGetSurfaceParametersNoUS::KickoffTestL() sl@0: { sl@0: // Allow parent to create some call backs for its initialization. sl@0: // Should open the video controller, set the filename, add the source and add the sink. sl@0: RAsyncTestStepAviCtrlPlayBase::KickoffTestL(); sl@0: sl@0: // Get the surface parameters. sl@0: TCallBack callbackGetSurfaceParameters(GetSurfaceParametersCallBack, this); sl@0: delete iKickoffGetSurfaceParameters; sl@0: iKickoffGetSurfaceParameters = NULL; sl@0: iKickoffGetSurfaceParameters = new (ELeave) CAsyncCallBack(callbackGetSurfaceParameters, CActive::EPriorityLow); sl@0: iKickoffGetSurfaceParameters->Call(); sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlGetSurfaceParametersNoUS::CloseTest() sl@0: { sl@0: // no need to Cancel before deleting. sl@0: delete iKickoffGetSurfaceParameters; sl@0: iKickoffGetSurfaceParameters = NULL; sl@0: sl@0: RAsyncTestStepAviCtrlPlayBase::CloseTest(); sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlGetSurfaceParametersNoUS::GetSurfaceParametersCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlGetSurfaceParametersNoUS* self = sl@0: static_cast (aPtr); sl@0: self->DoGetSurfaceParametersCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlGetSurfaceParametersNoUS::DoGetSurfaceParametersCallBack() sl@0: { sl@0: TSurfaceId surfaceID; sl@0: TRect cropRect; sl@0: TVideoAspectRatio pixelAspectRatio; sl@0: sl@0: TInt error = iVpsCommands.GetSurfaceParameters(surfaceID, cropRect, pixelAspectRatio); sl@0: sl@0: if (iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("GetSurfaceParameters failed to return error KErrNotSupported. Actual error was %d "), error); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("GetSurfaceParameters failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else sl@0: { sl@0: StopTest(); sl@0: } sl@0: } sl@0: sl@0: RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController) sl@0: { sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::KickoffTestL() sl@0: { sl@0: // Allow parent to create some call backs for its initialization. sl@0: // Should open the video controller, set the filename, add the source and add the sink. sl@0: RAsyncTestStepAviCtrlPlayBase::KickoffTestL(); sl@0: sl@0: // Call UseSurfaces sl@0: TCallBack callbackUseSurfaces(UseSurfacesCallBack, this); sl@0: delete iKickoffUseSurfaces; sl@0: iKickoffUseSurfaces = NULL; sl@0: iKickoffUseSurfaces = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow); sl@0: iKickoffUseSurfaces->Call(); sl@0: sl@0: // Call SurfaceRemoved sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: sl@0: TCallBack callbackSurfaceRemoved(SurfaceRemovedCallBack, this); sl@0: delete iKickoffSurfaceRemoved; sl@0: iKickoffSurfaceRemoved = NULL; sl@0: iKickoffSurfaceRemoved = new (ELeave) CAsyncCallBack(callbackSurfaceRemoved, CActive::EPriorityLow); sl@0: iKickoffSurfaceRemoved->Call(); sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::CloseTest() sl@0: { sl@0: // no need to Cancel before deleting. sl@0: delete iKickoffSurfaceRemoved; sl@0: iKickoffSurfaceRemoved = NULL; sl@0: sl@0: RAsyncTestStepAviCtrlPlayBase::CloseTest(); sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::SurfaceRemovedCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId* self = sl@0: static_cast (aPtr); sl@0: self->DoSurfaceRemovedCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::DoSurfaceRemovedCallBack() sl@0: { sl@0: TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId); sl@0: sl@0: if (iGceEnabled && error != KErrArgument) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed to return error KErrArgument. Actual error was %d "), error); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else sl@0: { sl@0: StopTest(); sl@0: } sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::UseSurfacesCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId* self = sl@0: static_cast (aPtr); sl@0: self->DoUseSurfacesCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::DoUseSurfacesCallBack() sl@0: { sl@0: TInt error = iVpsCommands.UseSurfaces(); sl@0: sl@0: if (iGceEnabled && error != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UseSurfaces failed with code %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("UseSurfaces failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: } sl@0: sl@0: RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController) sl@0: { sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::KickoffTestL() sl@0: { sl@0: // Allow parent to create some call backs for its initialization. sl@0: // Should open the video controller, set the filename, add the source and add the sink. sl@0: RAsyncTestStepAviCtrlPlayBase::KickoffTestL(); sl@0: sl@0: // Call UseSurfaces sl@0: TCallBack callbackUseSurfaces(UseSurfacesCallBack, this); sl@0: delete iKickoffUseSurfaces; sl@0: iKickoffUseSurfaces = NULL; sl@0: iKickoffUseSurfaces = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow); sl@0: iKickoffUseSurfaces->Call(); sl@0: sl@0: // Call SurfaceRemoved sl@0: iSurfaceId.iInternal[0] = 1111; sl@0: iSurfaceId.iInternal[1] = 1111; sl@0: iSurfaceId.iInternal[2] = 1111; sl@0: iSurfaceId.iInternal[3] = 1111; sl@0: sl@0: TCallBack callbackSurfaceRemoved(SurfaceRemovedCallBack, this); sl@0: delete iKickoffSurfaceRemoved; sl@0: iKickoffSurfaceRemoved = NULL; sl@0: iKickoffSurfaceRemoved = new (ELeave) CAsyncCallBack(callbackSurfaceRemoved, CActive::EPriorityLow); sl@0: iKickoffSurfaceRemoved->Call(); sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::CloseTest() sl@0: { sl@0: // no need to Cancel before deleting. sl@0: delete iKickoffSurfaceRemoved; sl@0: iKickoffSurfaceRemoved = NULL; sl@0: sl@0: RAsyncTestStepAviCtrlPlayBase::CloseTest(); sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::SurfaceRemovedCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId* self = sl@0: static_cast (aPtr); sl@0: self->DoSurfaceRemovedCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::DoSurfaceRemovedCallBack() sl@0: { sl@0: TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId); sl@0: sl@0: if (iGceEnabled && error != KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed to return error KErrNotReady. Actual error was %d "), error); sl@0: StopTest(KErrGeneral, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("SurfaceRemoved failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else sl@0: { sl@0: StopTest(); sl@0: } sl@0: } sl@0: sl@0: TInt RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::UseSurfacesCallBack(TAny* aPtr) sl@0: { sl@0: RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId* self = sl@0: static_cast (aPtr); sl@0: self->DoUseSurfacesCallBack(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::DoUseSurfacesCallBack() sl@0: { sl@0: TInt error = iVpsCommands.UseSurfaces(); sl@0: sl@0: if (iGceEnabled && error != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UseSurfaces failed with code %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: else if (!iGceEnabled && error != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("UseSurfaces failed to return KErrNotSupported. Actual result: %d."), error); sl@0: StopTest(error, EFail); sl@0: } sl@0: } sl@0: sl@0: #endif // SYMBIAN_BUILD_GCE sl@0: sl@0: #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT sl@0: sl@0: // sl@0: // RAsyncTestSubtitlePlay sl@0: // sl@0: RAsyncTestSubtitlePlay::RAsyncTestSubtitlePlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(1); sl@0: } sl@0: sl@0: void RAsyncTestSubtitlePlay::OnOpenCompleteL() sl@0: { sl@0: CheckAndEnableSubtitlesL(); sl@0: AddDefaultSubtitleConfL(); sl@0: sl@0: RArray languages; sl@0: CleanupClosePushL(languages); sl@0: TRAPD(err, iSubtitleCommands.GetSupportedSubtitleLanguagesL(languages)); sl@0: sl@0: if (err != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF3(_L("GetSupportedSubtitleLanguagesL left with %d; expected %d"), err, KErrNotSupported); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: if (languages.Count() != 0) sl@0: { sl@0: ERR_PRINTF2(_L("GetSupportedSubtitleLanguagesL returned %d languages"), languages.Count()); sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(); // languages sl@0: sl@0: TLanguage language = ELangNone; sl@0: err = iSubtitleCommands.GetSubtitleLanguage(language); sl@0: sl@0: if (err != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF3(_L("GetSubtitleLanguage failed with %d; expected %d"), err, KErrNotSupported); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: if (language != ELangNone) sl@0: { sl@0: ERR_PRINTF3(_L("GetSubtitleLanguage returned %d, expected %d"), language, ELangNone); sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: err = iSubtitleCommands.SetSubtitleLanguage(ELangCanadianEnglish); sl@0: sl@0: if (err != KErrNotSupported) sl@0: { sl@0: ERR_PRINTF3(_L("SetSubtitleLanguage failed with %d, expected %d"), err, KErrNotSupported); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitlePlay::OnPlayCompleteL() sl@0: { sl@0: RemoveConfigDisableL(); sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleUpdateConfig sl@0: // sl@0: RAsyncTestSubtitleUpdateConfig::RAsyncTestSubtitleUpdateConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(2); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateConfig::OnOpenCompleteL() sl@0: { sl@0: CheckAndEnableSubtitlesL(); sl@0: AddDefaultSubtitleConfL(); sl@0: sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdValid; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationClockwise90; sl@0: config.iWindowClipRect = KWindowClipRectAlt1; sl@0: TInt err = iSubtitleCommands.UpdateSubtitleConfig(config); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UpdateSubtitleConfig failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateConfig::OnPlayCompleteL() sl@0: { sl@0: RemoveConfigDisableL(); sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleUpdateDuring sl@0: // sl@0: sl@0: CCallBackTimer* CCallBackTimer::NewL(const TCallBack& aCallBack, TInt aPriority) sl@0: { sl@0: CCallBackTimer* self = new (ELeave) CCallBackTimer(aCallBack, aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: CCallBackTimer::CCallBackTimer(const TCallBack& aCallBack, TInt aPriority) sl@0: : CTimer(aPriority), iCallBack(aCallBack) sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: void CCallBackTimer::RunL() sl@0: { sl@0: User::LeaveIfError(iCallBack.CallBack()); sl@0: } sl@0: sl@0: RAsyncTestSubtitleUpdateDuring::RAsyncTestSubtitleUpdateDuring(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(2); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateDuring::KickoffTestL() sl@0: { sl@0: TCallBack callBack(DuringPlaybackCallBack, this); sl@0: iCallBackTimer = CCallBackTimer::NewL(callBack, CTimer::EPriorityStandard); sl@0: iHasUpdated = EFalse; sl@0: RAsyncTestStepSubtitleBase::KickoffTestL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateDuring::CloseTest() sl@0: { sl@0: delete iCallBackTimer; sl@0: iCallBackTimer = NULL; sl@0: RAsyncTestStepSubtitleBase::CloseTest(); sl@0: } sl@0: sl@0: TInt RAsyncTestSubtitleUpdateDuring::DuringPlaybackCallBack(TAny* aPtr) sl@0: { sl@0: RAsyncTestSubtitleUpdateDuring* self = static_cast(aPtr); sl@0: self->OnDuringPlayback(); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateDuring::OnOpenCompleteL() sl@0: { sl@0: CheckAndEnableSubtitlesL(); sl@0: AddDefaultSubtitleConfL(); sl@0: sl@0: // Start the call back timer. Will trigger the during playback handler. sl@0: iCallBackTimer->After(2500000); sl@0: sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateDuring::OnDuringPlayback() sl@0: { sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdValid; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationClockwise90; sl@0: config.iWindowClipRect = KWindowClipRectAlt1; sl@0: TInt err = iSubtitleCommands.UpdateSubtitleConfig(config); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("UpdateSubtitleConfig during playback failed with %d"), err); sl@0: StopTest(err, EFail); sl@0: } sl@0: else sl@0: { sl@0: iHasUpdated = ETrue; sl@0: } sl@0: } sl@0: sl@0: void RAsyncTestSubtitleUpdateDuring::OnPlayCompleteL() sl@0: { sl@0: RemoveConfigDisableL(); sl@0: sl@0: if (!iHasUpdated) sl@0: { sl@0: ERR_PRINTF1(_L("Subtitle configuration was not updated during playback.")); sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleRemoveAdd sl@0: // sl@0: RAsyncTestSubtitleRemoveAdd::RAsyncTestSubtitleRemoveAdd(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(2); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleRemoveAdd::OnOpenCompleteL() sl@0: { sl@0: CheckAndEnableSubtitlesL(); sl@0: AddDefaultSubtitleConfL(); sl@0: sl@0: TInt err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdValid); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("RemoveSubtitleConfig failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdValid; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationClockwise270; sl@0: config.iWindowClipRect = KWindowClipRectAlt2; sl@0: err = iSubtitleCommands.AddSubtitleConfig(config); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("AddSubtitleConfig failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleRemoveAdd::OnPlayCompleteL() sl@0: { sl@0: RemoveConfigDisableL(); sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleNotEnabled sl@0: // sl@0: RAsyncTestSubtitleNotEnabled::RAsyncTestSubtitleNotEnabled(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(0); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleNotEnabled::OnOpenCompleteL() sl@0: { sl@0: // Make sure that subtitles are available: sl@0: TBool available = EFalse; sl@0: TInt err = iSubtitleCommands.GetSubtitlesAvailable(available); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("GetSubtitlesAvailable failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: if (!available) sl@0: { sl@0: ERR_PRINTF1(_L("Subtitles unavailable")); sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: // Perform severy subtitle related functions without enabling subtitles. sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdValid; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationNone; sl@0: config.iWindowClipRect = KWindowClipRectFull; sl@0: sl@0: err = iSubtitleCommands.AddSubtitleConfig(config); sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.UpdateSubtitleConfig(config); sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("UpdateSubtitleConfig returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: RArray languages; sl@0: TRAP(err, iSubtitleCommands.GetSupportedSubtitleLanguagesL(languages)); sl@0: languages.Close(); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("GetSupportedSubtitleLanguagesL left with %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: TLanguage language = ELangNone; sl@0: err = iSubtitleCommands.GetSubtitleLanguage(language); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("GetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.SetSubtitleLanguage(ELangCanadianEnglish); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("SetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleNotEnabled::OnPlayCompleteL() sl@0: { sl@0: TInt err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdValid); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("RemoveSubtitleConfig returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.DisableSubtitles(); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF3(_L("DisableSubtitles returned %d; expected %d"), err, KErrNone); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleNotAvailable sl@0: // sl@0: RAsyncTestSubtitleNotAvailable::RAsyncTestSubtitleNotAvailable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(0); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleNotAvailable::OnOpenCompleteL() sl@0: { sl@0: // Make sure that subtitles are available: sl@0: TBool available = EFalse; sl@0: TInt err = iSubtitleCommands.GetSubtitlesAvailable(available); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("GetSubtitlesAvailable failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: if (available) sl@0: { sl@0: ERR_PRINTF1(_L("Subtitles available, but should not be")); sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: err = iSubtitleCommands.EnableSubtitles(); sl@0: sl@0: if (err != KErrNotFound) sl@0: { sl@0: ERR_PRINTF3(_L("EnableSubtitles returned %d; expected %d"), err, KErrNotFound); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: // Perform severy subtitle related functions without enabling subtitles. sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdValid; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationNone; sl@0: config.iWindowClipRect = KWindowClipRectFull; sl@0: sl@0: err = iSubtitleCommands.AddSubtitleConfig(config); sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.UpdateSubtitleConfig(config); sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("UpdateSubtitleConfig returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: RArray languages; sl@0: TRAP(err, iSubtitleCommands.GetSupportedSubtitleLanguagesL(languages)); sl@0: languages.Close(); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("GetSupportedSubtitleLanguagesL left with %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: TLanguage language = ELangNone; sl@0: err = iSubtitleCommands.GetSubtitleLanguage(language); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("GetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.SetSubtitleLanguage(ELangCanadianEnglish); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("SetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleNotAvailable::OnPlayCompleteL() sl@0: { sl@0: TInt err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdValid); sl@0: sl@0: if (err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF3(_L("RemoveSubtitleConfig returned %d; expected %d"), err, KErrNotReady); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.DisableSubtitles(); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF3(_L("DisableSubtitles returned %d; expected %d"), err, KErrNone); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleMismatchedId sl@0: // sl@0: RAsyncTestSubtitleMismatchedId::RAsyncTestSubtitleMismatchedId(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(1); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleMismatchedId::OnOpenCompleteL() sl@0: { sl@0: CheckAndEnableSubtitlesL(); sl@0: AddDefaultSubtitleConfL(); sl@0: sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdMismatched; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationClockwise90; sl@0: config.iWindowClipRect = KWindowClipRectAlt1; sl@0: sl@0: TInt err = iSubtitleCommands.UpdateSubtitleConfig(config); sl@0: if (err != KErrNotFound) sl@0: { sl@0: ERR_PRINTF3(_L("UpdateSubtitleConfig returned %d; expected %d"), err, KErrNotFound); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdMismatched); sl@0: if (err != KErrNotFound) sl@0: { sl@0: ERR_PRINTF3(_L("RemoveSubtitleConfig returned %d; expected %d"), err, KErrNotFound); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: TWsGraphicId id(TWsGraphicId::EUninitialized); sl@0: TRect rect; sl@0: err = iSubtitleCommands.GetCrpParameters(KWindowIdMismatched, id, rect); sl@0: if (err != KErrNotFound) sl@0: { sl@0: ERR_PRINTF3(_L("GetCrpParameters returned %d; expected %d"), err, KErrNotFound); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: // If we haven't left yet then the test passes. sl@0: StopTest(); sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleDoubleCall sl@0: // sl@0: RAsyncTestSubtitleDoubleCall::RAsyncTestSubtitleDoubleCall(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(1); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleDoubleCall::OnOpenCompleteL() sl@0: { sl@0: TBool available = EFalse; sl@0: sl@0: TInt err = iSubtitleCommands.GetSubtitlesAvailable(available); sl@0: sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("GetSubtitlesAvailable failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: if (!available) sl@0: { sl@0: ERR_PRINTF1(_L("Subtitles unavailable")); sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: sl@0: // Disable subtitles when they are not enabled. sl@0: err = iSubtitleCommands.DisableSubtitles(); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DisableSubtitles failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: err = iSubtitleCommands.EnableSubtitles(); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("EnableSubtitles failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: // Enable subtitles when they are already enabled. sl@0: err = iSubtitleCommands.EnableSubtitles(); sl@0: if (err != KErrInUse) sl@0: { sl@0: ERR_PRINTF3(_L("EnableSubtitles failed with %d; expecting %d when already enabled."), err, KErrInUse); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: AddDefaultSubtitleConfL(); sl@0: StartPlaybackL(); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleDoubleCall::OnPlayCompleteL() sl@0: { sl@0: RemoveConfigDisableL(); sl@0: sl@0: // Disable subtitles when they are not enabled. sl@0: TInt err = iSubtitleCommands.DisableSubtitles(); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DisableSubtitles failed with %d"), err); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: sl@0: // sl@0: // RAsyncTestSubtitleMultipleConfigs sl@0: // sl@0: RAsyncTestSubtitleMultipleConfigs::RAsyncTestSubtitleMultipleConfigs(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid) sl@0: :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid) sl@0: { sl@0: SetExpectedCrpReadyCount(1); sl@0: } sl@0: sl@0: void RAsyncTestSubtitleMultipleConfigs::OnOpenCompleteL() sl@0: { sl@0: CheckAndEnableSubtitlesL(); sl@0: AddDefaultSubtitleConfL(); sl@0: sl@0: TMMFSubtitleWindowConfig config; sl@0: config.iWindowId = KWindowIdValid; sl@0: config.iDisplayMode = EColor16MA; sl@0: config.iRotation = EVideoRotationClockwise90; sl@0: config.iWindowClipRect = KWindowClipRectAlt1; sl@0: sl@0: // Add a config with the same window ID. sl@0: TInt err = iSubtitleCommands.AddSubtitleConfig(config); sl@0: if (err != KErrArgument) sl@0: { sl@0: ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrArgument); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: // Add a config with a different ID. sl@0: config.iWindowId = KWindowIdValidAlt; sl@0: err = iSubtitleCommands.AddSubtitleConfig(config); sl@0: if (err != KErrInUse) sl@0: { sl@0: ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrInUse); sl@0: User::Leave(err == KErrNone ? KErrGeneral : err); sl@0: } sl@0: sl@0: // If we haven't left yet then the test passes. sl@0: StopTest(); sl@0: } sl@0: sl@0: #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT