Update contrib.
1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "testvideoplayer.h"
19 #include <mmf/common/mmfvideo.h>
22 #ifdef SYMBIAN_BUILD_GCE
23 #include <gceavailable.h>
26 const TInt KFrameWidth = 100;
27 const TInt KFrameHeight = 50;
29 const TInt KCropRegionRectTop = 1;
30 const TInt KCropRegionRectLeft = 3;
31 const TInt KCropRegionRectRight = 5;
32 const TInt KCropRegionRectBottom = 7;
33 const TUint KCacheSize = 1000000; //1MB
34 const TUint KMaxCacheSize = 30000000; //30MB
37 // RTestVclntPlayAviFile
41 * RTestVclntPlayAviFile::Constructor
43 RTestVclntPlayAviFile::RTestVclntPlayAviFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay)
44 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay)
46 iHeapSize = 2000000; //-2MB
50 * RTestVclntPlayAviFile::NewL
52 RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
54 RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
59 * RTestVclntPlayAviFile::NewLC
61 RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
63 RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
64 CleanupStack::PushL(self);
69 * RTestVclntPlayAviFile::DoTestStepL
71 TVerdict RTestVclntPlayAviFile::DoTestStepL()
73 // WDP:We are going to start the test now
74 // Ensure we set paging memory to appropriate cache size for tests which need it
76 TVerdict verdict=SetCacheSize();
82 // Call the state handler from IDLE state
84 User::LeaveIfError(iError);
85 // Start the scheduler - Done only once !
86 CActiveScheduler::Start();
88 return iTestStepResult;
91 //Default SetCache size
92 TVerdict RTestVclntPlayAviFile::SetCacheSize()
94 //Do not try to increase cache size for tests which dont need it
100 * RTestVclntPlayAviFile::FsmL
102 void RTestVclntPlayAviFile::FsmL(TVclntTestPlayEvents aEventCode)
104 if (FsmCheck(aEventCode))
106 //TInt err = KErrNone;
111 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
112 TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
113 PrepareState(EVPOpenComplete, KErrNone);
115 case EVPOpenComplete:
116 // Prepare iVideoPlayer
117 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
118 iVideoPlayer->Prepare();
119 PrepareState(EVPPrepareComplete, KErrNone);
121 case EVPPrepareComplete:
122 iTestStepResult = DoTestL(iVideoPlayer);
124 case EVPPlayComplete:
125 iTestStepResult = EPass;
126 CActiveScheduler::Stop();
133 * RTestVclntPlayAviFile::DoTestL
135 TVerdict RTestVclntPlayAviFile::DoTestL(CVideoPlayerUtility* /*aPlayer*/)
137 TVerdict ret = EFail;
141 iError = KErrTimedOut;
142 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
143 PrepareState(EVPPlayComplete, KErrNone);
144 iVideoPlayer->Play();
148 CActiveScheduler::Stop();
156 // RTestVclntPlayAviDes
160 * RTestVclntPlayAviDes::Constructor
162 RTestVclntPlayAviDes::RTestVclntPlayAviDes(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay)
163 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay)
169 * RTestVclntPlayAviDes::NewL
171 RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
173 RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
178 * RTestVclntPlayAviDes::NewLC
180 RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
182 RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
183 CleanupStack::PushL(self);
188 * RTestVclntPlayAviDes::DoTestStepPreambleL
190 TVerdict RTestVclntPlayAviDes::DoTestStepPreambleL()
195 // Base DoTestStepPreambleL
196 preamRes = RTestVclntAviPlayerStep::DoTestStepPreambleL();
197 if (preamRes != EPass)
206 // connect to file system and open file
207 User::LeaveIfError(fs.Connect());
208 CleanupClosePushL(fs);
209 User::LeaveIfError(file.Open(fs,iFilename,EFileRead));
210 CleanupClosePushL(file);
213 User::LeaveIfError(file.Size(size));
214 INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143
216 iVideo = HBufC8::NewMaxL(size);
218 // read data into Hbuf
219 TPtr8 bufferDes(iVideo->Des());
220 User::LeaveIfError(file.Read(bufferDes));
222 CleanupStack::PopAndDestroy(2); //fs, file
228 * RTestVclntPlayAviDes::DoTestStepPostambleL
230 TVerdict RTestVclntPlayAviDes::DoTestStepPostambleL()
234 return RTestVclntAviPlayerStep::DoTestStepPostambleL();
238 * Load and initialise an video descriptor.
240 TVerdict RTestVclntPlayAviDes::DoTestStepL()
242 iTestStepResult = EFail;
243 // Call the state handler from IDLE state
244 TRAPD(err, FsmL(EVPIdle));
247 CActiveScheduler::Start();
249 // Start the scheduler - Done only once !
250 return iTestStepResult;
254 * RTestVclntPlayAviDes::FsmL
256 void RTestVclntPlayAviDes::FsmL(TVclntTestPlayEvents aEventCode)
258 if (FsmCheck(aEventCode))
260 //TInt err = KErrNone;
265 INFO_PRINTF2(_L("iVideoPlayer->OpenDesL() %S"), &iFilename);
266 TRAP(iError, iVideoPlayer->OpenDesL(iVideo->Des(), ControllerUid()));
267 PrepareState(EVPOpenComplete, KErrNone);
269 case EVPOpenComplete:
270 // Prepare iVideoPlayer
271 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
272 iVideoPlayer->Prepare();
273 PrepareState(EVPPrepareComplete, KErrNone);
275 case EVPPrepareComplete:
276 iTestStepResult = DoTestL(iVideoPlayer);
278 case EVPPlayComplete:
279 iTestStepResult = EPass;
280 CActiveScheduler::Stop();
287 * RTestVclntPlayAviDes::DoTestL
289 TVerdict RTestVclntPlayAviDes::DoTestL(CVideoPlayerUtility* aPlayer)
291 TVerdict ret = EFail;
295 iError = KErrTimedOut;
296 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
297 PrepareState(EVPPlayComplete, KErrNone);
302 CActiveScheduler::Stop();
311 // RTestVclntPlayAviUrl
315 * RTestVclntPlayAviUrl::Constructor
318 RTestVclntPlayAviUrl::RTestVclntPlayAviUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
319 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay)
324 * RTestVclntPlayAviUrl::NewL
327 RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
329 RTestVclntPlayAviUrl* self = RTestVclntPlayAviUrl::NewLC(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
335 * RTestVclntPlayAviUrl::NewLC
338 RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
340 RTestVclntPlayAviUrl* self = new (ELeave) RTestVclntPlayAviUrl(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
341 CleanupStack::PushL(self);
346 * RTestVclntPlayAviUrl::Constructor
349 TVerdict RTestVclntPlayAviUrl::DoTestStepL()
351 // Call the state handler from IDLE state
354 // Start the scheduler - Done only once !
355 CActiveScheduler::Start();
357 return iTestStepResult;
361 * RTestVclntPlayAviUrl::FsmL
364 void RTestVclntPlayAviUrl::FsmL(TVclntTestPlayEvents aEventCode)
366 if (FsmCheck(aEventCode))
373 INFO_PRINTF2(_L("iVideoPlayer->OpenUrlL() %S"), &iFilename);
374 TRAP(iError,iVideoPlayer->OpenUrlL(iFilename, KUseDefaultIap, KNullDesC8, ControllerUid()));
375 PrepareState(EVPOpenComplete, KErrNone);
377 case EVPOpenComplete:
378 // Prepare iVideoPlayer
379 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
380 iVideoPlayer->Prepare();
381 PrepareState(EVPPrepareComplete, KErrNone);
383 case EVPPrepareComplete:
384 iTestStepResult = DoTestL(iVideoPlayer);
386 case EVPPlayComplete:
387 CActiveScheduler::Stop();
388 iTestStepResult = EPass;
395 * RTestVclntPlayAviUrl::Constructor
398 TVerdict RTestVclntPlayAviUrl::DoTestL(CVideoPlayerUtility* aPlayer)
400 TVerdict ret = EFail;
404 iError = KErrTimedOut;
405 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
406 PrepareState(EVPPlayComplete, KErrNone);
411 CActiveScheduler::Stop();
420 // RTestVclntEnqFrameRate
424 * RTestVclntEnqFrameRate::Constructor
426 RTestVclntEnqFrameRate::RTestVclntEnqFrameRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate)
427 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
429 iFrameRate = aFrameRate;
433 * RTestVclntEnqFrameRate::Constructor
435 RTestVclntEnqFrameRate* RTestVclntEnqFrameRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate)
437 RTestVclntEnqFrameRate* self = new (ELeave) RTestVclntEnqFrameRate(aTestName, aSectName, aKeyName, aExpectedError, aFrameRate);
442 * RTestVclntEnqFrameRate::Constructor
444 TVerdict RTestVclntEnqFrameRate::DoTestL(CVideoPlayerUtility* aPlayer)
446 INFO_PRINTF1(_L("Test : Video Player - Enquire Frame Rate"));
448 TVerdict ret = EFail;
450 TReal32 theFrameRate = 0.0;
451 TRAPD(err, theFrameRate = aPlayer->VideoFrameRateL());
452 INFO_PRINTF3(_L("iVideoPlayer->VideoFrameRateL() = %d...error =%d"), TInt(theFrameRate), err);
454 // if we get here, we pass. The iVideoPlayer does not have a SetVideoFrameRate()
455 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
456 PrepareState(EVPPlayComplete, KErrNone);
464 // RTestVclntPosition
468 * RTestVclntPosition::Constructor
470 RTestVclntPosition::RTestVclntPosition(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition)
471 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
473 iPosition = aPosition;
477 * RTestVclntPosition::NewL
479 RTestVclntPosition* RTestVclntPosition::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition)
481 RTestVclntPosition* self = new (ELeave) RTestVclntPosition(aTestName, aSectName, aKeyName, aExpectedError, aPosition);
486 * RTestVclntPosition::DoTestL
488 TVerdict RTestVclntPosition::DoTestL(CVideoPlayerUtility* aPlayer)
490 // NB test video controller is stubbing certain functions. May have to rewrite this
491 // for AVI Controller
493 TVerdict ret = EFail;
495 TTimeIntervalMicroSeconds pos;
497 INFO_PRINTF1(_L("Test : Video Player - Position"));
498 INFO_PRINTF3(_L("Set Position = %d, Duration = %d"), I64INT(iPosition.Int64()), I64INT(aPlayer->DurationL().Int64()));
500 // Set position: middle of clip.
501 if (I64INT(iPosition.Int64()) == 0)
503 iPosition = I64INT(aPlayer->DurationL().Int64()) / 2;
506 // Set position: end of clip.
507 if (I64INT(iPosition.Int64()) == -1)
509 iPosition = aPlayer->DurationL();
512 // Position is beyond the end of the clips duration, so check that the value is clipped.
513 if(aPlayer->DurationL() < iPosition)
515 INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64()));
516 TRAP(err, aPlayer->SetPositionL(iPosition));
517 if (err == KErrNotSupported)
519 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported"));
521 TRAP(err, pos = aPlayer->PositionL());
522 if (err == KErrNotReady)
524 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady"));
526 INFO_PRINTF3(_L("Set Position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(aPlayer->DurationL().Int64()));
529 // Position is negative, so check that the value is clipped.
530 else if (I64INT(iPosition.Int64()) < 0)
532 INFO_PRINTF2(_L("Negative value : Setting position to %d"), I64INT(iPosition.Int64()));
533 TRAP(err, aPlayer->SetPositionL(iPosition));
534 if (err == KErrNotSupported)
536 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported"));
538 TRAP(err, pos = aPlayer->PositionL());
539 if (err == KErrNotReady)
541 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady"));
543 INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), I64INT(pos.Int64()));
547 INFO_PRINTF2(_L("Normal : Setting position to %d"), I64INT(iPosition.Int64()));
548 TRAP(err, aPlayer->SetPositionL(iPosition));
549 if (err == KErrNotSupported)
551 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported"));
553 TRAP(err, pos = aPlayer->PositionL());
554 if (err == KErrNotReady)
556 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady"));
558 INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(iPosition.Int64()));
561 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
562 PrepareState(EVPPlayComplete, KErrNone);
566 TRAP(err, pos = aPlayer->PositionL());
569 INFO_PRINTF2(_L("PositionL() left with Error - %d"), err);
578 // RTestVclntPriority
582 * RTestVclntPriority::Constructor
584 RTestVclntPriority::RTestVclntPriority(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority)
585 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
587 iPriority = aPriority;
591 * RTestVclntRecordAviFile::Constructor
593 RTestVclntPriority* RTestVclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority)
595 RTestVclntPriority* self = new (ELeave) RTestVclntPriority(aTestName, aSectName, aKeyName, aExpectedError, aPriority);
600 * RTestVclntRecordAviFile::Constructor
602 TVerdict RTestVclntPriority::DoTestL(CVideoPlayerUtility* aPlayer)
604 TVerdict ret = EFail;
606 INFO_PRINTF1(_L("Test : Video Player - Priority"));
608 aPlayer->SetPriorityL(iPriority, EMdaPriorityPreferenceNone);
609 TInt thePriority = 0;
610 TMdaPriorityPreference thePref;
611 aPlayer->PriorityL(thePriority, thePref);
612 INFO_PRINTF3(_L("Priority = %d (expecting %d)"), thePriority, iPriority);
613 INFO_PRINTF3(_L("Pref = %d (expecting %d)"), thePref, EMdaPriorityPreferenceNone);
615 if( (thePriority == iPriority) && (thePref == EMdaPriorityPreferenceNone) )
620 CActiveScheduler::Stop();
627 // RTestVclntDuration
631 * RTestVclntDuration::Constructor
633 RTestVclntDuration::RTestVclntDuration(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration)
634 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
636 iDuration = aDuration;
640 * RTestVclntDuration::Constructor
642 RTestVclntDuration* RTestVclntDuration::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration)
644 RTestVclntDuration* self = new (ELeave) RTestVclntDuration(aTestName, aSectName, aKeyName, aExpectedError, aDuration);
649 * RTestVclntDuration::Constructor
651 TVerdict RTestVclntDuration::DoTestL(CVideoPlayerUtility* aPlayer)
653 TVerdict ret = EFail;
655 INFO_PRINTF1(_L("Test : Video Player - Duration"));
657 if (I64INT(iDuration.Int64()) == 0)
659 TInt duration = I64INT(aPlayer->DurationL().Int64());
660 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
661 PrepareState(EVPPlayComplete, KErrNone);
665 CActiveScheduler::Start();
669 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
671 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
672 iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
673 if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation)))
680 if(aPlayer->DurationL() == iDuration)
686 CActiveScheduler::Stop();
687 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)iCurrentCacheSize.iMinSize,(TAny*)iCurrentCacheSize.iMaxSize);
688 if(CheckCacheError(error)==EInconclusive)
690 return EInconclusive;
692 INFO_PRINTF3(_L("Setting Cache Min Size to %d,Setting Cache Max Size is %d"),iCurrentCacheSize.iMinSize,iCurrentCacheSize.iMaxSize);
696 TVerdict RTestVclntDuration::SetCacheSize()
699 //save the default cache sizes, set the cache size back these values after the test
700 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalGetCacheSize,&iCurrentCacheSize,0);
701 ret=CheckCacheError(error);
704 error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize);
705 ret=CheckCacheError(error);
710 TVerdict RTestVclntDuration::CheckCacheError(TInt aError)
712 TVerdict verdict=EPass;
714 //Winscw does not support getting cache size. Ignoring -5 error
717 if(aError!=KErrNotSupported)
719 INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
720 return EInconclusive;
725 {//For ARMV5 we stop for all errors
726 INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
727 return EInconclusive;
738 * RTestVclntVolume::Constructor
740 RTestVclntVolume::RTestVclntVolume(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume)
741 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
747 * RTestVclntVolume::Constructor
749 RTestVclntVolume* RTestVclntVolume::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume)
751 RTestVclntVolume* self = new (ELeave) RTestVclntVolume(aTestName, aSectName, aKeyName, aExpectedError, aVolume);
756 * RTestVclntVolume::Constructor
758 TVerdict RTestVclntVolume::DoTestL(CVideoPlayerUtility* aPlayer)
760 TVerdict ret = EFail;
763 INFO_PRINTF1(_L("Test : Video Player - Volume"));
765 // see if audio is enabled
766 if (aPlayer->AudioEnabledL())
768 INFO_PRINTF1(_L("AudioEnabledL() returned True"));
772 INFO_PRINTF1(_L("AudioEnabledL() returned False"));
775 // Check maxvolume function
778 iVolume = aPlayer->MaxVolume();
779 TRAP(err, aPlayer->SetVolumeL(iVolume));
780 INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err);
781 INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), aPlayer->MaxVolume());
782 if(aPlayer->Volume() == aPlayer->MaxVolume())
787 // Volume should truncated to maxvolume
788 else if(iVolume > aPlayer->MaxVolume())
790 TRAP(err, aPlayer->SetVolumeL(iVolume));
791 INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err);
792 INFO_PRINTF3(_L("Volume = %d, MaxVolume = %d"), aPlayer->Volume(), aPlayer->MaxVolume());
793 if(aPlayer->Volume() == aPlayer->MaxVolume())
798 // Volume is truncated to 0
801 TRAP(err, aPlayer->SetVolumeL(iVolume));
802 INFO_PRINTF2(_L("Volume should be set to Min Volume.Returned with %d"), err);
803 INFO_PRINTF2(_L("Volume = %d (expecting 0)"), aPlayer->Volume());
804 if(aPlayer->Volume() == 0)
809 // Set volume and check
812 TRAP(err, aPlayer->SetVolumeL(iVolume));
813 INFO_PRINTF2(_L("Volume should be set to the desired value. Retuned with %d"), err);
814 INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), iVolume);
815 if(aPlayer->Volume() == iVolume)
821 CActiveScheduler::Stop();
827 // RTestVclntCloseOpen
831 * RTestVclntCloseOpen::Constructor
833 RTestVclntCloseOpen::RTestVclntCloseOpen(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
834 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
840 * RTestVclntCloseOpen::Constructor
842 RTestVclntCloseOpen* RTestVclntCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
844 RTestVclntCloseOpen* self = new (ELeave) RTestVclntCloseOpen(aTestName, aSectName, aKeyName, aExpectedError);
849 * RTestVclntCloseOpen::DoTestStepL
851 TVerdict RTestVclntCloseOpen::DoTestStepL()
853 // Call the state handler from IDLE state
856 // Start the scheduler - Done only once !
857 CActiveScheduler::Start();
859 return iTestStepResult;
863 * RTestVclntCloseOpen::FsmL
865 void RTestVclntCloseOpen::FsmL(TVclntTestPlayEvents aEventCode)
867 if (FsmCheck(aEventCode))
872 // Open iVideoPlayer First time
874 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
875 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
876 PrepareState(EVPOpenComplete, KErrNone);
878 case EVPOpenComplete:
881 // Prepare iVideoPlayer
882 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
883 iVideoPlayer->Prepare();
884 PrepareState(EVPPrepareComplete, KErrNone);
888 CActiveScheduler::Stop();
889 iTestStepResult = EPass;
893 case EVPPrepareComplete:
894 // Close iVideoPlayer
895 CActiveScheduler::Stop();
896 INFO_PRINTF1(_L("iVideoPlayer->Close()"));
897 iVideoPlayer->Close();
898 User::After(KOneSecond);
899 // Open iVideoPlayer Second time
901 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
902 iVideoPlayer->OpenFileL(iFilename, ControllerUid());
903 PrepareState(EVPOpenComplete, KErrNone);
904 CActiveScheduler::Start();
915 * RTestVclntPause::Constructor
917 RTestVclntPause::RTestVclntPause(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
918 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
922 * RTestVclntPause::NewL
924 RTestVclntPause* RTestVclntPause::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
926 RTestVclntPause* self = new (ELeave) RTestVclntPause(aTestName, aSectName, aKeyName, aExpectedError);
931 * RTestVclntPause::DoTestStepL
933 TVerdict RTestVclntPause::DoTestStepL()
935 // Call the state handler from IDLE state
938 // Start the scheduler - Done only once !
939 CActiveScheduler::Start();
941 return iTestStepResult;
945 * RTestVclntPause::FsmL
947 void RTestVclntPause::FsmL(TVclntTestPlayEvents aEventCode)
952 if (FsmCheck(aEventCode))
958 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
959 TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
960 PrepareState(EVPOpenComplete, KErrNone);
962 case EVPOpenComplete:
963 // Prepare iVideoPlayer
964 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
965 iVideoPlayer->Prepare();
966 PrepareState(EVPPrepareComplete, KErrNone);
968 case EVPPrepareComplete:
970 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
971 PrepareState(EVPPlayComplete, KErrNone);
972 iVideoPlayer->Play();
973 // Pause iVideoPlayer
974 INFO_PRINTF1(_L("iVideoPlayer->Pause()"));
975 TRAPD(err,iVideoPlayer->PauseL());
976 if (err == KErrNotSupported)
978 INFO_PRINTF1(_L("Pause not supported presently"));
982 INFO_PRINTF2(_L("Pause() returns with error : %d"),err);
983 iTestStepResult = EFail;
984 CActiveScheduler::Stop();
988 INFO_PRINTF1(_L("iVideoPlayer->Stop()"));
989 iVideoPlayer->Stop();
990 // Get the duration of the file.
991 iPlayerDuration = I64INT(iVideoPlayer->DurationL().Int64());
992 // Resume play iVideoPlayer
993 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
994 iVideoPlayer->Play();
995 // Note the start time
998 case EVPPlayComplete:
999 // Note the stop time
1001 // Get the actual duration
1002 iActualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
1003 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d PlayerDuration = %d ActualDuration = %d"),
1004 iError, I64INT(start.Int64()), I64INT(stop.Int64()), iPlayerDuration, iActualDuration);
1005 // Check the results
1006 if((iError == KErrNone) && (TimeComparison(iActualDuration, iPlayerDuration, KExpectedDeviation)))
1008 iTestStepResult = EPass;
1010 CActiveScheduler::Stop();
1017 // RTestVclntBalance
1021 * RTestVclntBalance::Constructor
1023 RTestVclntBalance::RTestVclntBalance(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance)
1024 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
1026 iBalance = aBalance;
1030 * RTestVclntBalance::NewL
1032 RTestVclntBalance* RTestVclntBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance)
1034 RTestVclntBalance* self = new (ELeave) RTestVclntBalance(aTestName, aSectName, aKeyName, aExpectedError, aBalance);
1039 * RTestVclntBalance::DoTestL
1041 TVerdict RTestVclntBalance::DoTestL(CVideoPlayerUtility* aPlayer)
1043 TVerdict ret = EFail;
1044 TInt err = KErrNone;
1046 INFO_PRINTF1(_L("Test : Video Player - Balance"));
1048 // see if audio is enabled
1049 if (aPlayer->AudioEnabledL())
1051 INFO_PRINTF1(_L("AudioEnabledL() returned True"));
1055 INFO_PRINTF1(_L("AudioEnabledL() returned False"));
1059 TRAP(err, aPlayer->SetBalanceL(iBalance));
1060 INFO_PRINTF2(_L("SetBalanceL() left with Error - %d"), err);
1062 // check for the valid balance
1063 if (iBalance < KMinBalance)
1065 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMinBalance);
1066 if(aPlayer->Balance() == KMinBalance)
1071 else if (iBalance > KMaxBalance)
1073 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMaxBalance);
1074 if(aPlayer->Balance() == KMaxBalance)
1081 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), iBalance);
1082 if(aPlayer->Balance() == iBalance)
1088 CActiveScheduler::Stop();
1095 // RTestVclntPlayWindow
1099 * RTestVclntPlayWindow::Constructor
1101 RTestVclntPlayWindow::RTestVclntPlayWindow(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
1102 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
1109 * RTestVclntPlayWindow::Constructor
1111 RTestVclntPlayWindow* RTestVclntPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
1113 RTestVclntPlayWindow* self = new (ELeave) RTestVclntPlayWindow(aTestName, aSectName, aKeyName, aExpectedError, aStart, aEnd);
1118 * RTestVclntPlayWindow::Constructor
1120 TVerdict RTestVclntPlayWindow::DoTestL(CVideoPlayerUtility* aPlayer)
1122 TVerdict ret = EFail;
1124 INFO_PRINTF1(_L("Test : Video Player - Window"));
1126 TPoint rectOrigin(10, 10);
1127 TSize rectSize(176, 144);
1128 TRect rect(rectOrigin, rectSize);
1130 TPoint clipOrigin(10, 10);
1131 TSize clipSize(176, 144);
1132 TRect clipRect(clipOrigin, clipSize);
1134 // first call tests creation of display instance
1135 TRAPD(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect));
1136 INFO_PRINTF1(_L("Test : Made first call to SetDisplayWindowL()"));
1139 ERR_PRINTF2(_L("First call to SetDisplayWindowL() failed, error %d"), err);
1140 CActiveScheduler::Stop();
1144 // second call tests update of display instance
1145 TRAP(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect));
1146 INFO_PRINTF1(_L("Test : Made second call to SetDisplayWindowL()"));
1149 ERR_PRINTF2(_L("Second call to SetDisplayWindowL() failed, error %d"), err);
1157 CActiveScheduler::Stop();
1167 * RTestVclntMeta::Constructor
1169 RTestVclntMeta::RTestVclntMeta(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1170 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
1174 * RTestVclntMeta::Constructor
1176 RTestVclntMeta* RTestVclntMeta::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1178 RTestVclntMeta* self = new (ELeave) RTestVclntMeta(aTestName, aSectName, aKeyName, aExpectedError);
1183 * RTestVclntMeta::Constructor
1185 TVerdict RTestVclntMeta::DoTestL(CVideoPlayerUtility* aPlayer)
1187 INFO_PRINTF1(_L("Test : Video Player - Metadata"));
1189 CActiveScheduler::Stop();
1191 // there are zero meta entries now.
1192 TInt numOfMeta = -1;
1193 TRAPD(err, numOfMeta = aPlayer->NumberOfMetaDataEntriesL() );
1194 INFO_PRINTF3(_L("Error : %d Entries = %d"), err, numOfMeta);
1195 if (err != KErrNotSupported || numOfMeta != -1)
1200 // attempt to get an entry when no entry exists.
1201 CMMFMetaDataEntry* theEntry=NULL;
1202 TRAP(err, theEntry = aPlayer->MetaDataEntryL(1));
1203 INFO_PRINTF2(_L("Error : %d"), err);
1204 if (err != KErrNotSupported)
1217 // RTestVclntFrameSize
1221 * RTestVclntFrameSize::Constructor
1223 RTestVclntFrameSize::RTestVclntFrameSize(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1224 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
1226 iFrameSize.iWidth = 0;
1227 iFrameSize.iHeight = 0;
1231 * RTestVclntFrameSize::NewL
1233 RTestVclntFrameSize* RTestVclntFrameSize::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1235 RTestVclntFrameSize* self = new (ELeave) RTestVclntFrameSize(aTestName, aSectName, aKeyName, aExpectedError);
1240 * RTestVclntFrameSize::DoTestL
1242 TVerdict RTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer)
1244 TVerdict ret = EFail;
1246 INFO_PRINTF1(_L("Test : Video Player - Get Frame Size"));
1248 TRAP(err, aPlayer->VideoFrameSizeL(iFrameSize));
1250 INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, iFrameSize.iWidth, iFrameSize.iHeight);
1251 if (err == KErrNone && iFrameSize.iWidth >= 0 && iFrameSize.iHeight >= 0 )
1256 CActiveScheduler::Stop();
1262 // RTestVclntMimeType
1266 * RTestVclntMimeType::Constructor
1268 RTestVclntMimeType::RTestVclntMimeType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1269 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
1274 * RTestVclntMimeType::Constructor
1276 RTestVclntMimeType* RTestVclntMimeType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1278 RTestVclntMimeType* self = new (ELeave) RTestVclntMimeType(aTestName, aSectName, aKeyName, aExpectedError);
1283 * RTestVclntMimeType::Constructor
1285 TVerdict RTestVclntMimeType::DoTestL(CVideoPlayerUtility* aPlayer)
1288 TVerdict ret = EFail;
1290 INFO_PRINTF1(_L("Test : Video Player - MimeType"));
1292 // Get the Video Mime type
1293 TPtrC8 mimeType = aPlayer->VideoFormatMimeType();
1295 // take it to a 16-bit string
1296 TBuf<64> mimeType16;
1297 mimeType16.Copy(mimeType);
1298 INFO_PRINTF2(_L("Mime type : \'%S\'"), &mimeType16);
1300 // Check if its valid
1301 if (mimeType16.Compare(_L("XVID")) == 0)
1303 INFO_PRINTF1(_L("MIME Types match"));
1307 CActiveScheduler::Stop();
1317 * RTestVclntScale::Constructor
1319 RTestVclntScale::RTestVclntScale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1320 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
1325 * RTestVclntScale::Constructor
1327 RTestVclntScale* RTestVclntScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1329 RTestVclntScale* self = new (ELeave) RTestVclntScale(aTestName, aSectName, aKeyName, aExpectedError);
1334 * RTestVclntScale::Constructor
1336 TVerdict RTestVclntScale::DoTestL(CVideoPlayerUtility* aPlayer)
1338 INFO_PRINTF1(_L("Test : Video Player - Scale Values test"));
1340 CActiveScheduler::Stop();
1342 // Set the scale factor using values set #1
1343 INFO_PRINTF1(_L("iVideoPlayer->SetScaleFactorL() #1"));
1344 TRAPD(err, aPlayer->SetScaleFactorL(100, 100, ETrue));
1346 #ifdef SYMBIAN_BUILD_GCE
1347 TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone;
1349 TInt expected = KErrNotSupported;
1352 if (err != expected)
1354 ERR_PRINTF2(_L("iVideoPlayer->SetScaleFactorL() encountered error : %d"), err);
1366 * RTestVclntCrop::Constructor
1368 RTestVclntCrop::RTestVclntCrop(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1369 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
1374 * RTestVclntCrop::Constructor
1376 RTestVclntCrop* RTestVclntCrop::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1378 RTestVclntCrop* self = new (ELeave) RTestVclntCrop(aTestName, aSectName, aKeyName, aExpectedError);
1383 * RTestVclntCrop::Constructor
1385 TVerdict RTestVclntCrop::DoTestL(CVideoPlayerUtility* aPlayer)
1387 TRect cropRegion(KCropRegionRectLeft, KCropRegionRectTop, KCropRegionRectRight, KCropRegionRectBottom);
1390 INFO_PRINTF1(_L("Test : Video Player - Crop Values"));
1392 CActiveScheduler::Stop();
1394 // Set the Crop Region
1395 INFO_PRINTF1(_L("iVideoPlayer->SetCropRegionL()"));
1396 TRAPD(err, aPlayer->SetCropRegionL(cropRegion));
1398 #ifdef SYMBIAN_BUILD_GCE
1399 TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone;
1401 TInt expected = KErrNotSupported;
1404 if (err != expected)
1406 ERR_PRINTF2(_L("iVideoPlayer->SetCropRegionL() encountered error : %d"), err);
1413 #ifdef SYMBIAN_BUILD_GCE
1415 RTestVclntAutoScale::RTestVclntAutoScale(const TDesC& aTestName)
1416 : RTestVclntPlayAviFile(aTestName, KNullDesC, KNullDesC, KErrNone, EFalse)
1421 * RTestVclntCrop::Constructor
1423 RTestVclntAutoScale* RTestVclntAutoScale::NewL(const TDesC& aTestName)
1425 RTestVclntAutoScale* self = new (ELeave) RTestVclntAutoScale(aTestName);
1430 * RTestVclntCrop::Constructor
1432 TVerdict RTestVclntAutoScale::DoTestL(CVideoPlayerUtility* aPlayer)
1434 INFO_PRINTF1(_L("Test : Video Player - AutoScale Values"));
1436 CActiveScheduler::Stop();
1439 INFO_PRINTF1(_L("iVideoPlayer->SetAutoScaleL()"));
1440 TRAPD(err, aPlayer->SetAutoScaleL(EAutoScaleBestFit));
1442 if (err != KErrNone)
1444 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
1448 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleNone));
1450 if (err != KErrNone)
1452 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
1456 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleClip));
1458 if (err != KErrNone)
1460 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
1464 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleStretch, EHorizontalAlignLeft, EVerticalAlignBottom));
1466 if (err != KErrNone)
1468 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
1475 #endif // SYMBIAN_BUILD_GCE
1478 // RTestVclntGetFrame
1482 * RTestVclntGetFrame::Constructor
1484 RTestVclntGetFrame::RTestVclntGetFrame(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI)
1485 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse), iUseIntentAPI(aUseIntentAPI)
1490 * RTestVclntGetFrame::Constructor
1492 RTestVclntGetFrame* RTestVclntGetFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI)
1494 RTestVclntGetFrame* self = new (ELeave) RTestVclntGetFrame(aTestName, aSectName, aKeyName, aExpectedError, aUseIntentAPI);
1499 * RTestVclntGetFrame::DoTestStepL
1501 TVerdict RTestVclntGetFrame::DoTestStepL()
1503 // Call the state handler from IDLE state
1506 // Start the scheduler - Done only once !
1507 CActiveScheduler::Start();
1509 return iTestStepResult;
1513 * RTestVclntGetFrame::FsmL
1515 void RTestVclntGetFrame::FsmL(TVclntTestPlayEvents aEventCode)
1517 if (FsmCheck(aEventCode))
1522 // Open iVideoPlayer
1523 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
1524 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
1525 PrepareState(EVPOpenComplete, KErrNone);
1527 case EVPOpenComplete:
1528 // Prepare iVideoPlayer
1529 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
1530 iVideoPlayer->Prepare();
1531 PrepareState(EVPPrepareComplete, KErrNone);
1533 case EVPPrepareComplete:
1534 // Play iVideoPlayer
1535 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
1536 iVideoPlayer->Play();
1540 INFO_PRINTF1(_L("iVideoPlayer->GetFrameL() with EPeek Intent"));
1541 TRAP(iError, iVideoPlayer->GetFrameL(EColor16M, ContentAccess::EPeek));
1542 INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError);
1546 INFO_PRINTF1(_L("iVideoPlayer->GetFrameL()"));
1547 TRAP(iError, iVideoPlayer->GetFrameL(EColor16M));
1548 INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError);
1550 PrepareState(EVPFrameReady, KErrNone);
1552 // Stop iVideoPlayer
1553 iVideoPlayer->Stop();
1554 CActiveScheduler::Stop();
1555 iTestStepResult = EPass;
1562 * RTestVclntGetFrame::MvpuoFrameReady
1563 * Overriding the callback method here, to check the bitmap..
1565 void RTestVclntGetFrame::MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError)
1567 if (aError!=KErrNone)
1571 else if (aFrame.Handle() == NULL || aFrame.SizeInPixels() != TSize(KFrameWidth, KFrameHeight) )
1573 iError = KErrArgument;
1574 ERR_PRINTF1(_L("The Frame returned is either NULL or there is a mismatch in the size.."));
1576 TRAP(iError, FsmL(EVPFrameReady));
1577 INFO_PRINTF2(_L("Error code : %d"),iError);
1582 // RTestVclntRebuffering
1586 * RTestVclntRebuffering::Constructor
1588 RTestVclntRebuffering::RTestVclntRebuffering(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1589 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
1594 * RTestVclntRebuffering::NewL
1596 RTestVclntRebuffering* RTestVclntRebuffering::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1598 RTestVclntRebuffering* self = new (ELeave) RTestVclntRebuffering(aTestName, aSectName, aKeyName, aExpectedError);
1603 * RTestVclntRebuffering::DoTestL
1605 TVerdict RTestVclntRebuffering::DoTestL(CVideoPlayerUtility* aPlayer)
1607 INFO_PRINTF1(_L("Test : Video Player - Rebuffering"));
1609 aPlayer->RegisterForVideoLoadingNotification(*this);
1611 INFO_PRINTF1(_L("Rebuffering request completed"));
1613 CActiveScheduler::Stop();
1619 * RTestVclntRebuffering::MvloLoadingStarted
1621 void RTestVclntRebuffering::MvloLoadingStarted()
1623 INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingStarted"));
1627 * RTestVclntRebuffering::MvloLoadingComplete
1629 void RTestVclntRebuffering::MvloLoadingComplete()
1631 INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingComplete"));
1639 * RTestVclntRepeat::Constructor
1641 RTestVclntRepeat::RTestVclntRepeat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat)
1642 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
1648 * RTestVclntRepeat::NewL
1650 RTestVclntRepeat* RTestVclntRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat)
1652 RTestVclntRepeat* self = new (ELeave) RTestVclntRepeat(aTestName, aSectName, aKeyName, aExpectedError, aRepeat);
1657 * RTestVclntRepeat::DoTestL
1659 //The commented lines are kept for future implementation
1661 TVerdict RTestVclntRepeat::DoTestL(CVideoPlayerUtility* aPlayer)
1663 TVerdict ret = EFail;
1665 INFO_PRINTF1(_L("Test : Video Player - Repeats"));
1667 INFO_PRINTF1(_L("Warning : SetRepeats() does not exist in iVideoPlayer API. Repeat count set to 1"));
1669 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
1670 PrepareState(EVPPlayComplete, KErrNone);
1673 CActiveScheduler::Start();
1675 if(iError == KErrNotSupported || iRepeat == 1)
1678 INFO_PRINTF2(_L("Repeat not supported currently : err : %d"),iError);
1683 INFO_PRINTF2(_L("Returned with : err : %d"),iError);
1686 CActiveScheduler::Stop();
1696 * RTestVclntDelete::Constructor
1698 RTestVclntDelete::RTestVclntDelete(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1699 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
1703 * RTestVclntDelete::NewL
1705 RTestVclntDelete* RTestVclntDelete::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
1707 RTestVclntDelete* self = new (ELeave) RTestVclntDelete(aTestName, aSectName, aKeyName, aExpectedError);
1712 * RTestVclntDelete::DoTestStepL
1714 TVerdict RTestVclntDelete::DoTestStepL()
1716 // Call the state handler from IDLE state
1719 // Start the scheduler - Done only once !
1720 CActiveScheduler::Start();
1722 return iTestStepResult;
1726 * RTestVclntDelete::FsmL
1728 void RTestVclntDelete::FsmL(TVclntTestPlayEvents aEventCode)
1730 if (FsmCheck(aEventCode))
1735 // Open iVideoPlayer
1736 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
1737 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
1738 PrepareState(EVPOpenComplete, KErrNone);
1740 case EVPOpenComplete:
1741 // Prepare iVideoPlayer
1742 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
1743 iVideoPlayer->Prepare();
1744 PrepareState(EVPPrepareComplete, KErrNone);
1746 case EVPPrepareComplete:
1747 // Play iVideoPlayer
1748 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
1749 iVideoPlayer->Play();
1750 PrepareState(EVPPlayComplete, KErrNone);
1751 INFO_PRINTF1(_L("delete iVideoPlayer before Play completes"));
1753 iVideoPlayer = NULL;
1754 delete iVideoPlayer; // destroy iVideoPlayer before play has completed
1756 CActiveScheduler::Stop();
1757 iTestStepResult = EPass;
1764 // RTestVclntPlayAviFileHandle
1768 * RTestVclntPlayAviFileHandle::Constructor
1770 RTestVclntPlayAviFileHandle::RTestVclntPlayAviFileHandle(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc)
1771 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iAlloc(aAlloc)
1777 * RTestVclntPlayAviFileHandle::NewL
1779 RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc)
1781 RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc);
1786 * RTestVclntPlayAviFileHandle::NewLC
1788 RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc)
1790 RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc);
1791 CleanupStack::PushL(self);
1796 * RTestVclntPlayAviFileHandle::DoTestStepL()
1798 TVerdict RTestVclntPlayAviFileHandle::DoTestStepL()
1800 if(SetCacheSize()!=KErrNone)
1802 return EInconclusive;
1807 TVerdict iAllocTestStepResult=EPass;
1808 TInt err = KErrNone;
1809 TBool result = EFalse;
1811 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
1812 if( PerformTestStepL() != EPass )
1817 if (err != KErrNone)
1819 INFO_PRINTF2(_L("Test error, returned error code = %d"), err);
1824 //Check the iAllocTestStepResult
1825 if (iAllocTestStepResult != EPass)
1832 TBool completed = EFalse;
1833 iAllocTestStepResult = EPass; // XXX check?? assume pass
1834 TBool reachedEnd = EFalse; // Note: declare outside loop to help with debugging
1837 __UHEAP_SETFAIL(RHeap::EFailNext, failCount);
1840 //INFO_PRINTF2(_L("CVideoPlayerUtility: Alloc Test Loop: %d"), failCount);
1841 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
1842 TVerdict verdict = EFail;
1843 TRAP(err, verdict = PerformTestStepL());
1844 if (err == KErrNone && verdict != EPass)
1850 if (err == KErrNone)
1852 TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
1853 if (testAlloc == NULL)
1860 User::Free(testAlloc);
1863 //Check the iAllocTestStepResult
1864 if (iAllocTestStepResult != EPass)
1869 completed = reachedEnd || result;
1871 else if (err != KErrNoMemory) // bad error code
1878 __UHEAP_SETFAIL(RHeap::ENone, 0);
1888 failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc
1890 if (err != KErrNone || result)
1892 iAllocTestStepResult = EFail;
1896 format.Format(_L(" Bad result with %d memory allocations tested\n"), failCount);
1900 format.Format(_L(" Error(%d) with %d memory allocations tested\n"), err, failCount);
1907 format.Format(_L(" Completed OK with %d memory allocations tested\n"), failCount);
1910 TUint defaultCacheSize = 0;
1911 //Done with the test. Setting 0 makes the cache size revert back to boot up values
1912 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)defaultCacheSize,(TAny*)defaultCacheSize);
1913 if(CheckCacheError(error)!=KErrNone)
1915 INFO_PRINTF1(_L("Could not revert the cache size to default"));
1916 iAllocTestStepResult=EInconclusive;
1918 return iAllocTestStepResult;
1922 return( PerformTestStepL() );
1927 * RTestVclntPlayAviFileHandle::PerformTestStepL()
1929 TVerdict RTestVclntPlayAviFileHandle::PerformTestStepL()
1931 INFO_PRINTF1(_L("Test : Video Player - OpenFileL(RFile&)"));
1934 User::LeaveIfError(iFs.Connect());
1935 User::LeaveIfError(iFs.ShareProtected());
1936 CleanupClosePushL(iFs);
1939 User::LeaveIfError(iFile.Open(iFs, iFilename, EFileRead));
1940 CleanupClosePushL(iFile);
1942 // Call the state handler from IDLE state
1944 PrepareState(EVPIdle, KErrNone);
1947 // Start the scheduler - Done only once !
1948 CActiveScheduler::Start();
1950 CleanupStack::PopAndDestroy(2);
1952 // Leave if the Expected error is KErrNone
1953 if (iTestExpectedError == KErrNone)
1955 User::LeaveIfError(iError);
1958 return iTestStepResult;
1963 * RTestVclntPlayAviFileHandle::FsmL()
1965 void RTestVclntPlayAviFileHandle::FsmL(TVclntTestPlayEvents aEventCode)
1967 if (FsmCheck(aEventCode))
1972 // Open iVideoPlayer
1973 if ((iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-1013-HP")) == 0) ||
1974 (iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-9113-HP")) == 0))
1976 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S with Invalid Controller UID"), &iFilename);
1977 TRAP(iError, iVideoPlayer->OpenFileL(iFile, KVideoInvalidControllerUid));
1978 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() returned error - %d"), iError);
1979 PrepareState(EVPOpenComplete, KErrNone);
1983 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
1984 iVideoPlayer->OpenFileL(iFile, ControllerUid());
1985 PrepareState(EVPOpenComplete, KErrNone);
1988 case EVPOpenComplete:
1989 iIsOpen = ETrue; //-set iIsOpen flag (for closing Player, in case of Underflow)...
1990 // Prepare iVideoPlayer
1991 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
1992 PrepareState(EVPPrepareComplete, KErrNone);
1993 iVideoPlayer->Prepare();
1995 case EVPPrepareComplete:
1996 // Play iVideoPlayer
1997 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
1998 iVideoPlayer->Play();
1999 PrepareState(EVPPlayComplete, KErrNone);
2001 case EVPPlayComplete:
2002 iVideoPlayer->Stop();
2003 iVideoPlayer->Close();
2004 CActiveScheduler::Stop();
2005 iTestStepResult = EPass;
2011 iVideoPlayer->Close();
2015 TInt RTestVclntPlayAviFileHandle::SetCacheSize()
2017 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize);
2018 TInt ret=CheckCacheError(error);
2023 TInt RTestVclntPlayAviFileHandle::CheckCacheError(TInt aError)
2027 //Winscw does not support getting cache size. Ignoring -5 error
2028 if(aError!=KErrNone)
2030 if(aError!=KErrNotSupported)
2032 INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
2037 if(aError!=KErrNone)
2038 {//For ARMV5 we stop for all errors
2039 INFO_PRINTF2(_L("Could not get the cache size %d"),aError);
2048 // RTestVideoPlayCapabilityVelocity
2052 RTestVideoPlayCapabilityVelocity::Constructor
2054 RTestVideoPlayCapabilityVelocity::RTestVideoPlayCapabilityVelocity(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
2055 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
2060 RTestVideoPlayCapabilityVelocity::NewL
2062 RTestVideoPlayCapabilityVelocity* RTestVideoPlayCapabilityVelocity::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2064 RTestVideoPlayCapabilityVelocity* self = new (ELeave) RTestVideoPlayCapabilityVelocity(aTestName, aSectName, aKeyName, aExpectedError);
2069 RTestVideoPlayCapabilityVelocity::DoTestStepL()
2071 TVerdict RTestVideoPlayCapabilityVelocity::DoTestStepL()
2073 // Call the state handler from IDLE state
2074 TRAPD(err, FsmL(EVPIdle));
2075 if (err == KErrNone)
2077 // Start the scheduler - Done only once !
2078 CActiveScheduler::Start();
2080 return iTestStepResult;
2083 RTestVideoPlayCapabilityVelocity::FsmL()
2085 void RTestVideoPlayCapabilityVelocity::FsmL(TVclntTestPlayEvents aEventCode)
2087 const TUint KVelocityDefault = 100;
2088 const TUint KVelocityMinPositive = 1;
2089 const TInt KVelocityMinNegative = -1;
2090 const TUint KVelocityPositive = 200;
2091 const TUint KVelocityBigPositive = 500;
2092 const TInt KVelocityNegative = -200;
2093 const TInt KVelocityBigNegative= -500;
2094 //Set default value for PlayRateCapability
2095 iVideoPlayRateCapabilities.iStepForward = 1;
2096 iVideoPlayRateCapabilities.iPlayBackward = 0;
2097 if (FsmCheck(aEventCode))
2103 //Calling GetPlayRateCapabilitiesL() before opening should return KErrNotReady.
2104 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()"));
2105 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities));
2106 if( err != KErrNotReady)
2108 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned wrong err= %d"), err);
2109 iTestStepResult = EFail;
2110 CActiveScheduler::Stop();
2113 iPlayVelocity = KVelocityDefault;
2114 //Calling SetPlayVelocityL() before opening should return KErrNotReady.
2115 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity);
2116 TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity));
2117 if(KErrNotReady != err)
2119 INFO_PRINTF2(_L("SetPlayVelocityL returned wrong err= %d"), err);
2120 iTestStepResult = EFail;
2121 CActiveScheduler::Stop();
2125 //calling PlayVelocityL before opening should result in error KErrNotReady
2126 INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()"));
2127 TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL());
2128 if( err != KErrNotReady)
2130 INFO_PRINTF2(_L("PlayVelocityL returned wrong err= %d"), err);
2131 iTestStepResult = EFail;
2132 CActiveScheduler::Stop();
2136 // Open iVideoPlayer
2137 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
2138 iVideoPlayer->OpenFileL(iFilename);
2139 PrepareState(EVPOpenComplete, KErrNone);
2141 case EVPOpenComplete:
2142 //Get playrate capabilities
2143 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()"));
2144 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities));
2145 if( err != KErrNone)
2147 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err);
2148 INFO_PRINTF1(_L("invalid TPlayRateCapabilities"));
2149 iTestStepResult = EFail;
2150 CActiveScheduler::Stop();
2153 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayForward= %d"), iVideoPlayRateCapabilities.iPlayForward);
2154 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayBackward= %d"), iVideoPlayRateCapabilities.iPlayBackward);
2155 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepForward= %d"), iVideoPlayRateCapabilities.iStepForward);
2156 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepBackward= %d"), iVideoPlayRateCapabilities.iStepBackward);
2157 if ((iVideoPlayRateCapabilities.iPlayForward != 0) && (iVideoPlayRateCapabilities.iPlayForward != 1)||
2158 (iVideoPlayRateCapabilities.iPlayBackward != 0) && (iVideoPlayRateCapabilities.iPlayBackward != 1)||
2159 (iVideoPlayRateCapabilities.iStepForward != 0) && (iVideoPlayRateCapabilities.iStepForward != 1)||
2160 (iVideoPlayRateCapabilities.iStepBackward != 0) && (iVideoPlayRateCapabilities.iStepBackward != 1) )
2162 INFO_PRINTF1(_L("invalid TPlayRateCapabilities"));
2163 iTestStepResult = EFail;
2164 CActiveScheduler::Stop();
2168 //Get default play velocity, it shall be 100.
2169 INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()"));
2170 TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL());
2171 if( err != KErrNone)
2173 INFO_PRINTF2(_L("PlayVelocityL returned err= %d"), err);
2174 INFO_PRINTF1(_L("invalid TPlayRateCapabilities"));
2175 iTestStepResult = EFail;
2176 CActiveScheduler::Stop();
2180 if( iPlayVelocity != KVelocityDefault )
2182 INFO_PRINTF2(_L("invalid default play velocity =%d"), iPlayVelocity);
2183 iTestStepResult = EFail;
2184 CActiveScheduler::Stop();
2188 // Prepare iVideoPlayer
2189 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
2190 PrepareState(EVPPrepareComplete, KErrNone);
2191 iVideoPlayer->Prepare();
2193 case EVPPrepareComplete:
2194 //Try to set different play velocities and play.
2195 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity);
2196 TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity));
2197 if(KErrNotSupported == err)
2199 if(iVideoPlayRateCapabilities.iPlayForward || iVideoPlayRateCapabilities.iPlayBackward)
2201 INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err);
2202 iTestStepResult = EFail;
2203 CActiveScheduler::Stop();
2206 INFO_PRINTF1(_L("SetPlayVelocityL returned err KErrNotSupported"));
2208 else if( err != KErrNone)
2210 INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err);
2211 iTestStepResult = EFail;
2212 CActiveScheduler::Stop();
2215 // Play iVideoPlayer
2216 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
2217 iVideoPlayer->Play();
2218 PrepareState(EVPPlayComplete, KErrNone);
2220 case EVPPlayComplete:
2221 //Try to set different play velocities and play.
2222 if (iVideoPlayRateCapabilities.iPlayForward )
2224 if (iPlayVelocity == KVelocityDefault)
2226 iPlayVelocity = KVelocityMinPositive;
2228 else if(iPlayVelocity == KVelocityMinPositive)
2230 iPlayVelocity = KVelocityPositive;
2232 else if(iPlayVelocity == KVelocityPositive)
2234 iPlayVelocity = KVelocityBigPositive;
2237 if (iVideoPlayRateCapabilities.iPlayBackward )
2239 if (iPlayVelocity == KVelocityBigPositive)
2241 iPlayVelocity = KVelocityMinNegative;
2243 else if(iPlayVelocity == KVelocityMinNegative)
2245 iPlayVelocity = KVelocityNegative;
2247 else if(iPlayVelocity == KVelocityNegative)
2249 iPlayVelocity = KVelocityBigNegative;
2251 else if(iPlayVelocity == KVelocityBigNegative)
2253 iVideoPlayer->Close();
2254 CActiveScheduler::Stop();
2255 iTestStepResult = EPass;
2261 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity);
2262 TRAP(err,iVideoPlayer->SetPlayVelocityL(iPlayVelocity));
2263 if ( err == KErrNotSupported )
2265 INFO_PRINTF1(_L("iVideoPlayer->SetPlayVelocityL returned KErrNotSupported"));
2266 if( (iPlayVelocity >0) && iVideoPlayRateCapabilities.iPlayForward)
2268 INFO_PRINTF1(_L("PlayVelocity and capabilities are valid, still returned KErrNotSupported!!"));
2271 else if( (iPlayVelocity <0) && iVideoPlayRateCapabilities.iPlayBackward)
2273 INFO_PRINTF1(_L("PlayVelocity and capabilities are valid still returned KErrNotSupported!!"));
2278 // Play The file once again to test with different play velocity.
2279 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
2280 iVideoPlayer->Play();
2281 PrepareState(EVPPlayComplete, KErrNone);
2284 else if (err != KErrNone)
2286 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL returned (%d)"),err);
2291 // Play The file once again to test with different play velocity.
2292 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
2293 iVideoPlayer->Play();
2294 PrepareState(EVPPlayComplete, KErrNone);
2297 if ((!iVideoPlayRateCapabilities.iPlayForward ) && (!iVideoPlayRateCapabilities.iPlayBackward ))
2299 INFO_PRINTF1(_L("Both forward and backward is not supported"));
2300 INFO_PRINTF1(_L("Pass the test, error checking for API SetPlayVelocity is already done."));
2301 iVideoPlayer->Close();
2302 CActiveScheduler::Stop();
2303 iTestStepResult = EPass;
2313 // RTestVideoPlayStepFrame
2317 RTestVideoPlayStepFrame::Constructor
2319 RTestVideoPlayStepFrame::RTestVideoPlayStepFrame(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
2320 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iTimer(NULL)
2325 RTestVideoPlayStepFrame::NewL
2327 RTestVideoPlayStepFrame* RTestVideoPlayStepFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2329 RTestVideoPlayStepFrame* self = new (ELeave) RTestVideoPlayStepFrame(aTestName, aSectName, aKeyName, aExpectedError);
2334 RTestVideoPlayStepFrame::DoTestStepL()
2336 TVerdict RTestVideoPlayStepFrame::DoTestStepL()
2338 iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
2339 // Call the state handler from IDLE state
2340 TRAPD(err, FsmL(EVPIdle));
2341 if (err == KErrNone)
2343 // Start the scheduler - Done only once !
2344 CActiveScheduler::Start();
2347 return iTestStepResult;
2351 RTestVideoPlayStepFrame::FsmL()
2353 void RTestVideoPlayStepFrame::FsmL(TVclntTestPlayEvents aEventCode)
2355 if (FsmCheck(aEventCode))
2357 TInt err = KErrNone;
2359 TBool pauseSupported = ETrue;
2360 const TUint KStepForwardZeroFrame = 0;
2361 const TUint KStepForwardOneFrame = 1;
2362 const TInt KStepBackwardOneFrame = -1;
2363 const TUint KStepForwardFourFrames = 4;
2364 const TInt KStepBackwardFourFrames = -4;
2369 // Calling StepFrameL() before Opeing file should result KErrNotReady.
2370 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1);
2371 TRAP(err,iVideoPlayer->StepFrameL(1));
2372 if(err != KErrNotReady)
2374 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady);
2375 iTestStepResult = EFail;
2376 CActiveScheduler::Stop();
2380 // Open iVideoPlayer
2381 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
2382 iVideoPlayer->OpenFileL(iFilename);
2383 PrepareState(EVPOpenComplete, KErrNone);
2385 case EVPOpenComplete:
2386 //Get playrate capabilities
2387 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()"));
2388 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities));
2389 if( err != KErrNone)
2391 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err);
2392 iTestStepResult = EFail;
2393 CActiveScheduler::Stop();
2396 // Calling StepFrameL() in non-pause state should result KErrNotReady.
2397 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1);
2398 TRAP(err,iVideoPlayer->StepFrameL(1));
2399 if(err != KErrNotReady)
2401 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady);
2402 iTestStepResult = EFail;
2403 CActiveScheduler::Stop();
2407 // Prepare iVideoPlayer
2408 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
2409 PrepareState(EVPPrepareComplete, KErrNone);
2410 iVideoPlayer->Prepare();
2412 case EVPPrepareComplete:
2413 // Play iVideoPlayer
2414 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
2415 iVideoPlayer->Play();
2417 //wait for 1Second to pause the playback.
2418 INFO_PRINTF1(_L("calling User::After(KOneSecond);"));
2419 User::After(KOneSecond);
2422 Pause the playback, if pause is not supported wait for play to complete.
2423 In case of any other err fail the test with appropriate error code.
2425 TRAP(err, iVideoPlayer->PauseL());
2427 if( err == KErrNotSupported)
2429 pauseSupported = EFalse;
2430 PrepareState(EVPPlayComplete, KErrNone);
2432 else if( err != KErrNone)
2434 INFO_PRINTF2(_L("PauseL has returned error =%d"), err);
2435 iVideoPlayer->Stop();
2436 iVideoPlayer->Close();
2437 CActiveScheduler::Stop();
2438 iTestStepResult = EFail;
2442 INFO_PRINTF1(_L("Playback paused"));
2444 //Call StepFrameL with different step values.
2448 frame = KStepForwardZeroFrame;
2449 else if (frame == KStepForwardZeroFrame)
2450 frame = KStepForwardOneFrame;
2451 else if (frame == KStepForwardOneFrame)
2452 frame = KStepForwardFourFrames;
2453 else if (frame == KStepForwardFourFrames)
2454 frame = KStepBackwardOneFrame;
2455 else if (frame == KStepBackwardOneFrame)
2456 frame = KStepBackwardFourFrames;
2457 else if (frame == KStepBackwardFourFrames)
2459 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2460 iVideoPlayer->Stop();
2461 iVideoPlayer->Close();
2462 CActiveScheduler::Stop();
2463 iTestStepResult = EPass;
2464 return; //Break the while loop
2466 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),frame);
2467 TRAP(err,iVideoPlayer->StepFrameL(frame));
2468 if(err == KErrNotSupported)
2470 if( ((iVideoPlayRateCapabilities.iStepForward) && (frame>0)) ||
2471 ((iVideoPlayRateCapabilities.iStepBackward) && (frame<0)) )
2473 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), err);
2474 iTestStepResult = EFail;
2475 CActiveScheduler::Stop();
2478 INFO_PRINTF1(_L("StepFrameL returned KErrNotSupported"));
2481 else if( (err == KErrNotReady) && (!pauseSupported) )
2483 INFO_PRINTF1(_L("pause is not supported in controller plugin. Returned correct err(KErrNotReady)"));
2486 else if( err != KErrNone)
2488 INFO_PRINTF2(_L("StepFrameL returned err= %d"), err);
2489 iTestStepResult = EFail;
2490 CActiveScheduler::Stop();
2495 case EVPPlayComplete:
2496 INFO_PRINTF1(_L("Plyback completed before pausing!!"));
2497 INFO_PRINTF1(_L("Video clip is too small to run this test step"));
2498 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2499 iVideoPlayer->Stop();
2500 iVideoPlayer->Close();
2501 CActiveScheduler::Stop();
2502 iTestStepResult = EInconclusive;
2509 // RTestVideoPlayAudVidEnable.
2513 * RTestVideoPlayAudVidEnable::Constructor
2515 RTestVideoPlayAudVidEnable::RTestVideoPlayAudVidEnable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
2516 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
2521 * RTestVideoPlayAudVidEnable::NewL
2523 RTestVideoPlayAudVidEnable* RTestVideoPlayAudVidEnable::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2525 RTestVideoPlayAudVidEnable* self = new (ELeave) RTestVideoPlayAudVidEnable(aTestName, aSectName, aKeyName, aExpectedError);
2530 * RTestVideoPlayAudVidEnable::DoTestStepL()
2532 TVerdict RTestVideoPlayAudVidEnable::DoTestStepL()
2534 // Call the state handler from IDLE state
2535 TRAPD(err, FsmL(EVPIdle));
2536 if (err == KErrNone)
2538 // Start the scheduler - Done only once !
2539 CActiveScheduler::Start();
2541 return iTestStepResult;
2544 * RTestVideoPlayAudVidEnable::FsmL()
2546 void RTestVideoPlayAudVidEnable::FsmL(TVclntTestPlayEvents aEventCode)
2548 if (FsmCheck(aEventCode))
2550 TInt err = KErrNone;
2551 TBool enableFlag = EFalse;
2556 //Calling SetAudioEnabledL() before opening file should return KErrNotReady
2557 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));
2558 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
2559 if (err != KErrNotReady)
2561 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
2562 iTestStepResult = EFail;
2563 CActiveScheduler::Stop();
2566 //Calling SetVideoEnabledL() before opening file should return KErrNotReady
2567 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));
2568 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
2569 if (err != KErrNotReady)
2571 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
2572 iTestStepResult = EFail;
2573 CActiveScheduler::Stop();
2576 //Calling VideoEnabledL() before opening file should return KErrNotReady
2577 INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()"));
2578 TRAP(err, iVideoPlayer->VideoEnabledL());
2579 if(err != KErrNotReady)
2581 INFO_PRINTF2(_L("VideoEnabledL returned wrong error code= %d"), err);
2582 iTestStepResult = EFail;
2583 CActiveScheduler::Stop();
2586 // Open iVideoPlayer
2587 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
2588 iVideoPlayer->OpenFileL(iFilename);
2589 PrepareState(EVPOpenComplete, KErrNone);
2591 case EVPOpenComplete:
2592 //Check that by default audio is enabled.
2593 INFO_PRINTF1(_L("iVideoPlayer->AudioEnabledL()"));
2594 TRAP(err,enableFlag = iVideoPlayer->AudioEnabledL());
2595 if( (err != KErrNone) || (enableFlag != (TBool)ETrue) )
2597 INFO_PRINTF3(_L("AudioEnabledL Leave err= %d, returned:%d"), err,enableFlag);
2598 iTestStepResult = EFail;
2599 CActiveScheduler::Stop();
2603 //Check that by default video is enabled.
2604 INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()"));
2605 TRAP(err,enableFlag = iVideoPlayer->VideoEnabledL());
2606 if( (err != KErrNone) || (enableFlag != (TBool)ETrue) )
2608 INFO_PRINTF3(_L("VideoEnabledL Leave err= %d, returned:%d"), err,enableFlag);
2609 iTestStepResult = EFail;
2610 CActiveScheduler::Stop();
2614 //Try to disable audio, It shall leave with notsupported error.
2615 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));
2616 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
2617 if (err != KErrNotSupported)
2619 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
2620 iTestStepResult = EFail;
2621 CActiveScheduler::Stop();
2625 //Try to disable video, It shall leave with notsupported error.
2626 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));
2627 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
2628 if (err != KErrNotSupported)
2630 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
2631 iTestStepResult = EFail;
2632 CActiveScheduler::Stop();
2636 // Prepare iVideoPlayer
2637 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
2638 PrepareState(EVPPrepareComplete, KErrNone);
2639 iVideoPlayer->Prepare();
2641 case EVPPrepareComplete:
2642 //Enabling/disabling audio after prepare() shall return KErrNotSupported error.
2643 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));
2644 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
2645 if(err != KErrNotSupported)
2647 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
2648 iTestStepResult = EFail;
2649 CActiveScheduler::Stop();
2653 //Enabling/disabling video after prepare() shll return KErrNotSupported error.
2654 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));
2655 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
2656 if(err != KErrNotSupported)
2658 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
2659 iTestStepResult = EFail;
2660 CActiveScheduler::Stop();
2664 // Play iVideoPlayer
2665 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
2666 iVideoPlayer->Play();
2667 PrepareState(EVPPlayComplete, KErrNone);
2669 //calling SetAudioEnabledL while playing should return KErrNotReady
2670 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));
2671 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
2672 if (err != KErrNotReady)
2674 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
2675 iTestStepResult = EFail;
2676 iVideoPlayer->Stop();
2677 iVideoPlayer->Close();
2678 CActiveScheduler::Stop();
2682 //calling SetVideoEnabledL while playing should return KErrNotReady
2683 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));
2684 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
2685 if (err != KErrNotReady)
2687 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
2688 iTestStepResult = EFail;
2689 iVideoPlayer->Stop();
2690 iVideoPlayer->Close();
2691 CActiveScheduler::Stop();
2696 case EVPPlayComplete:
2697 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2698 iVideoPlayer->Stop();
2699 iVideoPlayer->Close();
2700 CActiveScheduler::Stop();
2701 iTestStepResult = EPass;
2709 // RTestVideoPlayAutoScale.
2713 * RTestVideoPlayAutoScale::Constructor
2715 RTestVideoPlayAutoScale::RTestVideoPlayAutoScale(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
2716 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
2721 * RTestVideoPlayAutoScale::NewL
2723 RTestVideoPlayAutoScale* RTestVideoPlayAutoScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
2725 RTestVideoPlayAutoScale* self = new (ELeave) RTestVideoPlayAutoScale(aTestName, aSectName, aKeyName, aExpectedError);
2730 * RTestVideoPlayAutoScale::DoTestStepL()
2732 TVerdict RTestVideoPlayAutoScale::DoTestStepL()
2734 // Call the state handler from IDLE state
2735 TRAPD(err, FsmL(EVPIdle));
2736 if (err == KErrNone)
2738 // Start the scheduler - Done only once !
2739 CActiveScheduler::Start();
2741 return iTestStepResult;
2744 * RTestVideoPlayAutoScale::FsmL()
2746 void RTestVideoPlayAutoScale::FsmL(TVclntTestPlayEvents aEventCode)
2748 if (FsmCheck(aEventCode))
2750 TInt err = KErrNone;
2751 TAutoScaleType scaleType = EAutoScaleNone;
2752 THorizontalAlign horizontalAlign = EHorizontalAlignCenter;
2753 TVerticalAlign verticalAlign = EVerticalAlignCenter;
2758 //Calling SetAutoScaleL() before opening file should return KErrNotReady error.
2759 INFO_PRINTF1(_L("Calling SetAutoScaleL(EAutoScaleNone);"));
2760 TRAP(err, iVideoPlayer->SetAutoScaleL(EAutoScaleNone));
2761 if( err != KErrNotReady)
2763 INFO_PRINTF2(_L("SetAutoScaleL() returned wrong error=%d"),err);
2764 CActiveScheduler::Stop();
2765 iTestStepResult = EFail;
2769 // Open iVideoPlayer
2770 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
2771 iVideoPlayer->OpenFileL(iFilename);
2772 PrepareState(EVPOpenComplete, KErrNone);
2774 case EVPOpenComplete:
2775 // Prepare iVideoPlayer
2776 INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
2777 PrepareState(EVPPrepareComplete, KErrNone);
2778 iVideoPlayer->Prepare();
2780 case EVPPrepareComplete:
2781 // Play iVideoPlayer
2782 INFO_PRINTF1(_L("iVideoPlayer->Play()"));
2783 iVideoPlayer->Play();
2784 PrepareState(EVPPlayComplete, KErrNone);
2787 Wait for 1/4th of a second each time and call SetAutoScaleL multiple times
2788 with different scale parameters.
2789 This loop tests only "void SetAutoScaleL(TAutoScaleType aScaleType);"
2796 case EAutoScaleNone:
2797 scaleType = EAutoScaleBestFit;
2799 case EAutoScaleBestFit:
2800 scaleType = EAutoScaleClip;
2802 case EAutoScaleClip:
2803 scaleType = EAutoScaleStretch;
2805 case EAutoScaleStretch:
2806 scaleType = EAutoScaleNone;
2809 INFO_PRINTF1(_L("calling User::After(KOneSecond/4);"));
2810 User::After(KOneSecond/4);
2812 INFO_PRINTF1(_L("Calling SetAutoScaleL();"));
2813 TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType));
2815 #ifdef SYMBIAN_BUILD_GCE
2816 const TInt KExpected = GCEAvailable() ? KErrNone : KErrNotSupported;
2818 const TInt KExpected = KErrNotSupported;
2821 if( err == KExpected)
2823 INFO_PRINTF3(_L("SetAutoScaleL(%d) successfully returned %d"), scaleType, err);
2827 INFO_PRINTF4(_L("SetAutoScaleL(%d) returned error= %d. Expected %d"),scaleType, err, KExpected);
2828 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2829 iVideoPlayer->Stop();
2830 iVideoPlayer->Close();
2831 CActiveScheduler::Stop();
2832 iTestStepResult = EFail;
2835 if( scaleType == EAutoScaleNone )
2837 break;//Break the forever while loop;
2842 Wait for half second each time and call SetAutoScaleL multiple times
2843 with all combinations of TAutoScaleType, THorizontalAlign, and TVerticalAlign.
2850 case EAutoScaleNone:
2851 scaleType = EAutoScaleBestFit;
2853 case EAutoScaleBestFit:
2854 scaleType = EAutoScaleClip;
2856 case EAutoScaleClip:
2857 scaleType = EAutoScaleStretch;
2859 case EAutoScaleStretch:
2860 scaleType = EAutoScaleNone;
2865 if( horizontalAlign == EHorizontalAlignCenter)
2867 horizontalAlign = EHorizontalAlignLeft;
2869 else if( horizontalAlign == EHorizontalAlignLeft)
2871 horizontalAlign = EHorizontalAlignRight;
2873 else if( horizontalAlign == EHorizontalAlignRight)
2875 horizontalAlign = EHorizontalAlignCenter;
2879 if( verticalAlign == EVerticalAlignCenter)
2881 verticalAlign = EVerticalAlignTop;
2883 else if( verticalAlign == EVerticalAlignTop)
2885 verticalAlign = EVerticalAlignBottom;
2887 else if( verticalAlign == EVerticalAlignBottom)
2889 verticalAlign = EVerticalAlignCenter;
2892 INFO_PRINTF1(_L("calling User::After(KOneSecond/4);"));
2893 User::After(KOneSecond/4);
2896 INFO_PRINTF1(_L("Calling SetAutoScaleL();"));
2897 TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType,horizontalAlign,verticalAlign));
2898 if( err == KErrNotSupported)
2900 INFO_PRINTF4(_L("SetAutoScaleL(%d,%d, %d) returned KErrNotSupported"),scaleType, horizontalAlign,verticalAlign);
2902 else if( err == KErrNone)
2904 INFO_PRINTF1(_L("Success calling SetAutoScaleL()"));
2908 INFO_PRINTF3(_L("SetAutoScaleL(%d) returned error= %d"),scaleType, err);
2909 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2910 iVideoPlayer->Stop();
2911 iVideoPlayer->Close();
2912 CActiveScheduler::Stop();
2913 iTestStepResult = EFail;
2917 if( verticalAlign == EVerticalAlignCenter )
2919 break;//Break the forever while loop;
2922 if( horizontalAlign == EHorizontalAlignCenter )
2924 break;//Break the forever while loop;
2927 if( scaleType == EAutoScaleNone )
2929 break;//Break the forever while loop;
2933 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2934 iVideoPlayer->Stop();
2935 iVideoPlayer->Close();
2936 CActiveScheduler::Stop();
2937 iTestStepResult = EPass;
2939 case EVPPlayComplete:
2940 INFO_PRINTF1(_L("Clip is too small to run the test"));
2941 INFO_PRINTF1(_L("iVideoPlayer->Stop"));
2942 iVideoPlayer->Stop();
2943 iVideoPlayer->Close();
2944 CActiveScheduler::Stop();
2945 iTestStepResult = EInconclusive;