os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TSU_MMF_VCLNT_01/src/TestStepVidPlayerOpen.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 // EPOC includes
    17 #include <e32base.h>
    18 #include <e32test.h>
    19 #include <e32keys.h>
    20 #include <c32comm.h>
    21 #include <f32file.h>
    22 #include <etel.h>
    23 #include <etelmm.h>
    24 #include <testframework.h>
    25 
    26 // Test system includes
    27 #include <testframework.h>
    28 
    29 #include <mmf/common/mmfstandardcustomcommands.h>  
    30 #include <mmf/common/mmfvideo.h>
    31 #include <mmf/server/mmfdes.h>
    32 #include <mmf/server/mmffile.h>
    33 #include <mmf/common/mmfdurationinfocustomcommands.h>
    34 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    35 #include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
    36 #include <mmf/common/mmfdurationinfocustomcommandsenums.h>
    37 #endif
    38 
    39 #include <mmf/common/mmfcontroller.h>
    40 #include <videoplayer.h>
    41 #include <videorecorder.h>
    42 
    43 #ifdef SYMBIAN_BUILD_GCE
    44 #include <videoplayer2.h>
    45 #endif
    46 
    47 // Specific includes for this test suite
    48 #include "TestStepUnitMMFVidClient.h"
    49 #include "TestSuiteUnitMMFVidClient.h"
    50 #include "TestStepVidPlayer.h"
    51 #include "TS_Codes.h"
    52 
    53 
    54 
    55 _LIT(KClockFileName,"C:\\mm\\mmf\\testfiles\\vclnt\\clock.dummy");
    56 
    57 //
    58 // --------------------------------------------
    59 //
    60 /**
    61  *
    62  * Static constructor for CTestStepVidPlayerOpenFile.
    63  *
    64  *
    65  * @return	"CTestStepVidPlayerOpenFile*"
    66  *			The constructed CTestStepVidPlayerOpenFile
    67  */
    68 CTestStepVidPlayerOpenFile* CTestStepVidPlayerOpenFile::NewL(const TDesC& aTestName, const TTest aTest)
    69 	{
    70 	CTestStepVidPlayerOpenFile* self = new(ELeave) CTestStepVidPlayerOpenFile(aTestName, aTest);
    71 	return self;
    72 	}
    73 
    74 /**
    75  *
    76  * Test step constructor.
    77  * Each test step initialises its own name.
    78  */
    79 CTestStepVidPlayerOpenFile::CTestStepVidPlayerOpenFile(const TDesC& aTestName, const TTest aTest) 
    80 	{
    81 	// This is the test case name that is used by the script file.
    82 	iTestStepName = aTestName;
    83 	iTest = aTest;
    84 	iTestStepResult = EPass;
    85 	if (iTestStepName == _L("MM-MMF-VCLNT-U-0803-CP") ||
    86 		iTestStepName == _L("MM-MMF-VCLNT-U-0809-CP") ||
    87 		iTestStepName == _L("MM-MMF-VCLNT-U-0811-CP") )
    88 		{
    89 		iVpu2 = ETrue;
    90 		iSurfaceMode = ETrue;
    91 		}
    92 	if (iTestStepName == _L("MM-MMF-VCLNT-U-0850-CP") || iTestStepName == _L("MM-MMF-VCLNT-U-0853-CP"))
    93 		{
    94 		iVpu2 = ETrue;
    95 		iSurfaceMode = EFalse;
    96 		}	
    97 	}
    98 
    99 /**
   100  *
   101  * Test step destructor.
   102  */
   103 CTestStepVidPlayerOpenFile::~CTestStepVidPlayerOpenFile()
   104 	{
   105 	}
   106 
   107 /**
   108  * Implementation of the MVideoRecorderUtilityObserver interface functions
   109  **/
   110 void CTestStepVidPlayerOpenFile::MvpuoOpenComplete(TInt aError)
   111 	{
   112 	iError = aError;
   113 	CActiveScheduler::Stop(); // check if asynchronous
   114 	}
   115 
   116 void CTestStepVidPlayerOpenFile::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
   117 	{
   118 	}
   119 
   120 void CTestStepVidPlayerOpenFile::MvpuoPlayComplete(TInt aError)
   121 	{
   122 	iError = aError;
   123 	CActiveScheduler::Stop(); // check if asynchronous
   124 	}
   125 	
   126 void CTestStepVidPlayerOpenFile::MvpuoPrepareComplete(TInt aError)
   127 	{
   128 	iError = aError;
   129 	CActiveScheduler::Stop(); // check if asynchronous
   130 	}
   131 
   132 	
   133 void CTestStepVidPlayerOpenFile::MvpuoEvent(const TMMFEvent& /*aEvent*/)
   134 	{
   135 	}
   136 
   137 /**
   138  *
   139  * Test step Preamble.
   140  */
   141 enum TVerdict CTestStepVidPlayerOpenFile::DoTestStepPreambleL(void)
   142 	{
   143 	enum TVerdict verdict;
   144 	// this installs the scheduler
   145 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
   146 	if (verdict != EPass)
   147 		{
   148 		return verdict;
   149 		}
   150 
   151 	iFileName.Set(KClockFileName);
   152 
   153 	// Printing to the console and log file
   154 	INFO_PRINTF2(_L("%S"), &iTestStepName);
   155 	if (iVpu2 && iSurfaceMode)
   156 		{
   157 		if (iTest == EFileName)
   158 			{
   159 			INFO_PRINTF1(_L("this test is opening a file name with a CVideoPlayerUtility2::OpenFileL()"));
   160 			}
   161 		if (iTest == EFileHandle)
   162 			{	
   163 			INFO_PRINTF1(_L("this test is opening a file handle with a CVideoPlayerUtility2::OpenFileL()"));
   164 			}
   165 		if (iTest == EFileSource)
   166 			{
   167 			INFO_PRINTF1(_L("this test is opening a TMMFileSource with a CVideoPlayerUtility2::OpenFileL()"));
   168 			}
   169 		}
   170 	else if (iVpu2 && !iSurfaceMode)
   171 		{
   172 		if (iTest == EFileName)
   173 			{
   174 			INFO_PRINTF1(_L("this is a negative test for opening a file name with a CVideoPlayerUtility2::OpenFileL()"));
   175 			}
   176 		if (iTest == EFileHandle)
   177 			{
   178 			INFO_PRINTF1(_L("this is a negative test for opening a file handle with a CVideoPlayerUtility2::OpenFileL()"));
   179 			}
   180 		}
   181 	else
   182 		{
   183 		if (iTest == EFileName)
   184 			{
   185 			INFO_PRINTF1(_L("this test is opening a filename with a CVideoPlayerUtility::OpenFileL()"));
   186 			}
   187 		if (iTest == EFileHandle)
   188 			{
   189 			INFO_PRINTF1(_L("this test is opening a file handle with a CVideoPlayerUtility::OpenFileL()"));
   190 			}
   191 		if (iTest == EFileSource)
   192 			{
   193 			INFO_PRINTF1(_L("this test is opening a TMMFileSource with a CVideoPlayerUtility::OpenFileL()"));
   194 			}
   195 		if (iTest == EFileHandleSource)
   196 			{
   197 			INFO_PRINTF1(_L("this test is opening a TMMFileHandleSource with a CVideoPlayerUtility::OpenFileL()"));
   198 			}
   199 		}
   200 	
   201 	iError = KErrNone;
   202 
   203 	return verdict;
   204 	}
   205 
   206 /**
   207  *
   208  * Test step Postamble.
   209  */
   210 enum TVerdict CTestStepVidPlayerOpenFile::DoTestStepPostambleL(void)
   211 	{
   212 	if (!iVpu2)
   213 		{
   214 		delete iPlayer;
   215 		iPlayer = NULL;
   216 		}
   217 #ifdef SYMBIAN_BUILD_GCE
   218 	else
   219 		{
   220 		delete iPlayer2;
   221 		iPlayer2 = NULL;
   222 		}
   223 #endif
   224 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
   225 	}
   226 
   227 /**
   228  *
   229  * Do the test step.
   230  * Each test step must supply an implementation for DoTestStepL.
   231  *
   232  * @return	"TVerdict"
   233  *			The result of the test step
   234  */
   235 TVerdict CTestStepVidPlayerOpenFile::DoTestStepL()
   236 	{
   237 	TInt err = KErrNone;
   238 	iError = KErrNone;
   239 
   240 	InitWservL();
   241 
   242 	if (!iVpu2)
   243 		{
   244 		TRect rect, clipRect;
   245 		iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
   246 										iWs, *iScreen, *iWindow, rect, clipRect);
   247 		}
   248 #ifdef SYMBIAN_BUILD_GCE
   249 	else
   250 		{
   251 		iPlayer2 = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
   252 		}
   253 #endif
   254 
   255 	if ( !PlayerStateStopped() )
   256 		{
   257 		return EInconclusive;
   258 		}
   259 
   260 	switch (iTest)
   261 		{
   262 		case EFileName:
   263 			TRAP(err, OpenAndStartSchedulerL());
   264 			break;
   265 		
   266 		case EFileHandle:
   267 			TRAP(err, OpenAndStartSchedulerL(ETrue));
   268 			break;
   269 		
   270 		case EFileSource:
   271 			{
   272 			TMMFileSource fileSource(iFileName);
   273 			TRAP(err, OpenAndStartSchedulerL(fileSource));
   274 			}
   275 			break;
   276 		
   277 		case EFileHandleSource:
   278 			{
   279 			User::LeaveIfError(iFs.Connect());
   280 			User::LeaveIfError(iFs.ShareProtected());
   281 			User::LeaveIfError(iFile.Open(iFs, iFileName, EFileRead));
   282 			TMMFileHandleSource fileSource(iFile);
   283 			TRAP(err, OpenAndStartSchedulerL(fileSource));
   284 			}
   285 			break;
   286 		
   287 		default:
   288 			ASSERT(0);
   289 			break;
   290 		}
   291 
   292 	if (!iSurfaceMode && iVpu2 && err == KErrNone && iError == KErrNotSupported)
   293 		{
   294 		INFO_PRINTF2(_L("This test is when the controller doesn't support graphics surfaces. Expected: %d"), err);
   295 		return EPass;
   296 		}
   297 
   298 	if (err == KErrNotFound)
   299 		{
   300 		iTestStepResult = EInconclusive;
   301 		}	
   302 	else if (  err == KErrNone && iError == KErrNone )
   303 		{
   304 #ifdef SYMBIAN_BUILD_GCE
   305 		SurfaceSupported();
   306 #endif
   307 		if (iSurfaceSupported)
   308 			{
   309 			if (iVpu2)
   310 				{
   311 				iTestStepResult = ControllerCalled(_L8("MvpssUseSurfacesL Called"));
   312 				}
   313 			}
   314 		else 
   315 			{
   316 			iTestStepResult = ControllerCalled(_L8("SetDisplayWindowL called"));
   317 			}
   318 		}
   319 	else 
   320 		{
   321 		iTestStepResult = EFail;
   322 		}
   323 
   324 	if (!iVpu2)
   325 		{
   326 		delete iPlayer;
   327 		iPlayer = NULL;
   328 		}
   329 #ifdef SYMBIAN_BUILD_GCE
   330 	else
   331 		{
   332 		delete iPlayer2;
   333 		iPlayer2 = NULL;
   334 		}
   335 #endif
   336 	INFO_PRINTF1(_L("finished with this test step"));
   337 	// test steps return a result
   338 	return iTestStepResult;
   339 	}
   340 
   341 //
   342 // --------------------------------------------
   343 //
   344 /**
   345  *
   346  * Static constructor for CTestStepVidPlayerOpenDesc.
   347  *
   348  *
   349  * @return	"CTestStepVidPlayerOpenDesc*"
   350  *			The constructed CTestStepVidPlayerOpenDesc
   351  */
   352 CTestStepVidPlayerOpenDesc* CTestStepVidPlayerOpenDesc::NewL(TInt aUseSurface)
   353 	{
   354 	CTestStepVidPlayerOpenDesc* self = new(ELeave) CTestStepVidPlayerOpenDesc(aUseSurface);
   355 	return self;
   356 	}
   357 
   358 /**
   359  *
   360  * Test step constructor.
   361  * Each test step initialises its own name.
   362  */
   363 CTestStepVidPlayerOpenDesc::CTestStepVidPlayerOpenDesc(TInt aUseSurface) 
   364 	{
   365 	iTestStepResult = EPass;
   366 	// store the name of this test case
   367 	// this is the name that is used by the script file
   368 	iVpu2 = EFalse;
   369 	if (aUseSurface == CTestStepUnitMMFVidClient::ENotSurfaceMode)
   370 		{
   371 		iTestStepName = _L("MM-MMF-VCLNT-U-0005-CP");
   372 		}
   373 	if (aUseSurface == CTestStepUnitMMFVidClient::ESurfaceMode)
   374 		{
   375 		iVpu2 = ETrue;
   376 		iSurfaceMode = ETrue;
   377 		iTestStepName = _L("MM-MMF-VCLNT-U-0805-CP");
   378 		}
   379 	if (aUseSurface == CTestStepUnitMMFVidClient::ESurfaceModeNotSupported)
   380 		{
   381 		iVpu2 = ETrue;
   382 		iSurfaceMode = EFalse;
   383 		iTestStepName = _L("MM-MMF-VCLNT-U-0851-CP");
   384 		}
   385 
   386 	iHeapSize = 150000;
   387 	}
   388 
   389 /**
   390  *
   391  * Test step destructor.
   392  */
   393 CTestStepVidPlayerOpenDesc::~CTestStepVidPlayerOpenDesc()
   394 	{
   395 	}
   396 
   397 /**
   398  * Implementation of the MVideoRecorderUtilityObserver interface functions
   399  **/
   400 void CTestStepVidPlayerOpenDesc::MvpuoOpenComplete(TInt aError)
   401 	{
   402 	iError = aError;
   403 	CActiveScheduler::Stop(); // check if asynchronous
   404 	}
   405 
   406 void CTestStepVidPlayerOpenDesc::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
   407 	{
   408 	}
   409 
   410 void CTestStepVidPlayerOpenDesc::MvpuoPlayComplete(TInt aError)
   411 	{
   412 	iError = aError;
   413 	CActiveScheduler::Stop(); // check if asynchronous
   414 	}
   415 	
   416 void CTestStepVidPlayerOpenDesc::MvpuoPrepareComplete(TInt aError)
   417 	{
   418 	iError = aError;
   419 	CActiveScheduler::Stop(); // check if asynchronous
   420 	}
   421 
   422 	
   423 void CTestStepVidPlayerOpenDesc::MvpuoEvent(const TMMFEvent& /*aEvent*/)
   424 	{
   425 	}
   426 
   427 
   428 /**
   429  *
   430  * Test step Preamble.
   431  */
   432 enum TVerdict CTestStepVidPlayerOpenDesc::DoTestStepPreambleL(void)
   433 	{
   434 	enum TVerdict verdict;
   435 	// this installs the scheduler
   436 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
   437 	if (verdict != EPass)
   438 		{
   439 		return verdict;
   440 		}
   441 
   442 	iFileName.Set(KClockFileName);
   443 
   444 	TInt fSize;
   445 	iFs.Connect();
   446 	if ( iFile.Open(iFs, iFileName, EFileRead) != KErrNone )
   447 		{
   448 		return EInconclusive;
   449 		}
   450 		
   451 	iFile.Size(fSize);
   452 	// load the sound from the file to a Descriptor
   453 	iBuf = HBufC8::NewL( fSize );
   454 	TPtr8 des = iBuf->Des();
   455 	iFile.Read(des);
   456 
   457 	iFile.Close();
   458 	iFs.Close();
   459 
   460 	// Printing to the console and log file
   461 	INFO_PRINTF2(_L("%S"), &iTestStepName);
   462 	if (!iVpu2)
   463 		{
   464 		INFO_PRINTF1(_L("this test is opening a descriptor with a CVideoPlayerUtility::OpenDesL()"));
   465 		}
   466 	else
   467 		{
   468 		INFO_PRINTF1(_L("this test is opening a descriptor with a CVideoPlayerUtility2::OpenDesL()"));
   469 		}
   470 		
   471 	return verdict;
   472 	}
   473 
   474 /**
   475  *
   476  * Test step Postamble.
   477  */
   478 enum TVerdict CTestStepVidPlayerOpenDesc::DoTestStepPostambleL(void)
   479 	{
   480 	if (!iVpu2)
   481 		{
   482 		delete iPlayer;
   483 		iPlayer = NULL;
   484 		}
   485 #ifdef SYMBIAN_BUILD_GCE
   486 	else
   487 		{
   488 		delete iPlayer2;
   489 		iPlayer2 = NULL;
   490 		}
   491 #endif
   492 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
   493 	}
   494 
   495 void CTestStepVidPlayerOpenDesc::OpenDescAndStartSchedulerL()
   496 	{
   497 	if (!iVpu2)
   498 		{
   499 		iPlayer->OpenDesL(iBuf->Des());
   500 		}
   501 #ifdef SYMBIAN_BUILD_GCE
   502 	else
   503 		{
   504 		iPlayer2->OpenDesL(iBuf->Des());
   505 		}
   506 #endif
   507 	CActiveScheduler::Start();
   508 }
   509 /**
   510  *
   511  * Do the test step.
   512  * Each test step must supply an implementation for DoTestStepL.
   513  *
   514  * @return	"TVerdict"
   515  *			The result of the test step
   516  */
   517 TVerdict CTestStepVidPlayerOpenDesc::DoTestStepL()
   518 	{
   519 	TInt err = KErrNone;
   520 	iError = KErrNone;
   521 
   522 	InitWservL();
   523 
   524 	if (!iVpu2)
   525 		{
   526 		TRect rect, clipRect;
   527 		iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
   528 										iWs, *iScreen, *iWindow, rect, clipRect);
   529 		}
   530 #ifdef SYMBIAN_BUILD_GCE
   531 	else
   532 		{
   533 		iPlayer2 = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
   534 		}
   535 #endif
   536 
   537 	if (!PlayerStateStopped() )
   538 		{
   539 		return EInconclusive;
   540 		}
   541 	
   542 	TRAP(err, OpenDescAndStartSchedulerL() );
   543 
   544 	
   545 #ifdef _TYPHOON_TEST_
   546 	//Typhoon fix, video is not supported
   547 	if (err == KErrNotSupported)
   548 		{
   549 		return EPass;
   550 		}
   551 #endif
   552 
   553 	if (!iSurfaceMode && iVpu2 && err == KErrNone && iError == KErrNotSupported)
   554 		{
   555 		INFO_PRINTF2(_L("This test is when the controller doesn't support graphics surfaces. Expected: %d"), err);
   556 		return EPass;
   557 		}
   558 		
   559 	if (err == KErrNotFound)
   560 		{
   561 		iTestStepResult = EInconclusive;
   562 		}
   563 	else if (  err == KErrNone && iError == KErrNone )
   564 		{
   565 #ifdef SYMBIAN_BUILD_GCE
   566 		SurfaceSupported();
   567 #endif
   568 		if (iSurfaceSupported)
   569 			{
   570 			iTestStepResult = ControllerCalled(_L8("SetDisplayWindowL called"), EFalse);
   571 			}
   572 		else 
   573 			{
   574 			iTestStepResult = ControllerCalled(_L8("SetDisplayWindowL called"));
   575 			}
   576 		}
   577 	else 
   578 		{
   579 		INFO_PRINTF3(_L("OpenDescAndStartSchedulerL() left with %d.  Error code iError is %d"), err, iError);
   580 		iTestStepResult = EFail;
   581 		}
   582 
   583 	if (!iVpu2)
   584 		{
   585 		delete iPlayer;
   586 		iPlayer = NULL;
   587 		}
   588 #ifdef SYMBIAN_BUILD_GCE
   589 	else
   590 		{
   591 		delete iPlayer2;
   592 		iPlayer2 = NULL;
   593 		}
   594 #endif
   595 
   596 	INFO_PRINTF1(_L("finished with this test step"));
   597 	// test steps return a result
   598 	return iTestStepResult;
   599 	}
   600 
   601 //
   602 // --------------------------------------------
   603 //
   604 /**
   605  *
   606  * Static constructor for CTestStepVidPlayerOpenUrl.
   607  *
   608  *
   609  * @return	"CTestStepVidPlayerOpenUrl*"
   610  *			The constructed CTestStepVidPlayerOpenUrl
   611  */
   612 CTestStepVidPlayerOpenUrl* CTestStepVidPlayerOpenUrl::NewL(TInt aUseSurface)
   613 	{
   614 	CTestStepVidPlayerOpenUrl* self = new(ELeave) CTestStepVidPlayerOpenUrl(aUseSurface);
   615 	return self;
   616 	}
   617 
   618 /**
   619  *
   620  * Test step constructor.
   621  * Each test step initialises its own name.
   622  */
   623 CTestStepVidPlayerOpenUrl::CTestStepVidPlayerOpenUrl(TInt aUseSurface) 
   624 	{
   625 	iTestStepResult = EPass;
   626 	// store the name of this test case
   627 	// this is the name that is used by the script file
   628 	iVpu2 = EFalse;
   629 	if (aUseSurface == CTestStepUnitMMFVidClient::ENotSurfaceMode)
   630 		{
   631 		iTestStepName = _L("MM-MMF-VCLNT-U-0006-CP");
   632 		}
   633 	if (aUseSurface == CTestStepUnitMMFVidClient::ESurfaceMode)
   634 		{
   635 		iVpu2 = ETrue;
   636 		iSurfaceMode = ETrue;
   637 		iTestStepName = _L("MM-MMF-VCLNT-U-0807-CP");
   638 		}
   639 	if (aUseSurface == CTestStepUnitMMFVidClient::ESurfaceModeNotSupported)
   640 		{
   641 		iVpu2 = ETrue;
   642 		iSurfaceMode = EFalse;
   643 		iTestStepName = _L("MM-MMF-VCLNT-U-0852-CP");
   644 		}
   645 	}
   646 
   647 /**
   648  *
   649  * Test step destructor.
   650  */
   651 CTestStepVidPlayerOpenUrl::~CTestStepVidPlayerOpenUrl()
   652 	{
   653 	}
   654 
   655 /**
   656  * Implementation of the MVideoRecorderUtilityObserver interface functions
   657  **/
   658 void CTestStepVidPlayerOpenUrl::MvpuoOpenComplete(TInt aError)
   659 	{
   660 	iError = aError;
   661 	CActiveScheduler::Stop(); // check if asynchronous
   662 	}
   663 
   664 void CTestStepVidPlayerOpenUrl::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
   665 	{
   666 	}
   667 
   668 void CTestStepVidPlayerOpenUrl::MvpuoPlayComplete(TInt aError)
   669 	{
   670 	iError = aError;
   671 	CActiveScheduler::Stop(); // check if asynchronous
   672 	}
   673 	
   674 void CTestStepVidPlayerOpenUrl::MvpuoPrepareComplete(TInt aError)
   675 	{
   676 	iError = aError;
   677 	CActiveScheduler::Stop(); // check if asynchronous
   678 	}
   679 
   680 	
   681 void CTestStepVidPlayerOpenUrl::MvpuoEvent(const TMMFEvent& /*aEvent*/)
   682 	{
   683 	}
   684 
   685 
   686 /**
   687  *
   688  * Test step Preamble.
   689  */
   690 enum TVerdict CTestStepVidPlayerOpenUrl::DoTestStepPreambleL(void)
   691 	{
   692 	enum TVerdict verdict;
   693 	// this installs the scheduler
   694 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
   695 	if (verdict != EPass)
   696 		{
   697 		return verdict;
   698 		}
   699 
   700 	_LIT8(KMimeType, "video/msvideo");
   701 
   702 	iFileName.Set(KTestURL);
   703 	iMimeType.Set(KMimeType);
   704 
   705 	// Printing to the console and log file
   706 	INFO_PRINTF2(_L("%S"), &iTestStepName);
   707 	if (!iVpu2)
   708 		{
   709 		INFO_PRINTF1(_L("this test is opening a file with a CVideoPlayerUtility::OpenUrlL()"));
   710 		}
   711 	else
   712 		{
   713 		INFO_PRINTF1(_L("this test is opening a file with a CVideoPlayerUtility2::OpenUrlL()"));
   714 		}
   715 	
   716 	InitWservL();
   717 	
   718 		if (!iVpu2)
   719 		{
   720 		TRect rect, clipRect;
   721 		iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
   722 										iWs, *iScreen, *iWindow, rect, clipRect);
   723 		}
   724 #ifdef SYMBIAN_BUILD_GCE
   725 	else
   726 		{
   727 		iPlayer2 = CVideoPlayerUtility2::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);
   728 		}
   729 #endif
   730 
   731 	if (!PlayerStateStopped() )
   732 		{
   733 		return EInconclusive;
   734 		}
   735 
   736 	return verdict;
   737 	}
   738 
   739 /**
   740  *
   741  * Test step Postamble.
   742  */
   743 enum TVerdict CTestStepVidPlayerOpenUrl::DoTestStepPostambleL(void)
   744 	{
   745 	if (!iVpu2)
   746 		{
   747 		delete iPlayer;
   748 		iPlayer = NULL;
   749 		}
   750 #ifdef SYMBIAN_BUILD_GCE
   751 	else
   752 		{
   753 		delete iPlayer2;
   754 		iPlayer2 = NULL;
   755 		}
   756 #endif
   757 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
   758 	}
   759 
   760 void CTestStepVidPlayerOpenUrl::OpenUrlAndStartSchedulerL()
   761 	{
   762 	if (!iVpu2)
   763 		{
   764 		iPlayer->OpenUrlL(iFileName,KTestIap,iMimeType);
   765 		}
   766 #ifdef SYMBIAN_BUILD_GCE
   767 	else
   768 		{
   769 		iPlayer2->OpenUrlL(iFileName,KTestIap,iMimeType);
   770 		}
   771 #endif	
   772 	CActiveScheduler::Start();
   773 }
   774 /**
   775  *
   776  * Do the test step.
   777  * Each test step must supply an implementation for DoTestStepL.
   778  *
   779  * @return	"TVerdict"
   780  *			The result of the test step
   781  */
   782 TVerdict CTestStepVidPlayerOpenUrl::DoTestStepL()
   783 	{
   784 	TInt err = KErrNone;
   785 	iError = KErrNone;
   786 
   787 	TRAP(err, OpenUrlAndStartSchedulerL() );
   788 	
   789 	if (!iSurfaceMode && iVpu2 && iError == KErrNotSupported && err == KErrNone)
   790 		{
   791 		INFO_PRINTF2(_L("This test is when the controller doesn't support graphics surfaces. Expected: %d"), err);
   792 		return EPass;
   793 		}
   794 		
   795  	if (err == KErrNotFound)
   796  		{
   797 		iTestStepResult = EInconclusive;
   798  		}
   799 	else if ( (err == KErrNone) && (iError == KErrNone))
   800 		{
   801 		
   802 		// now use a special custom command to check the sending of these parameters
   803 		TUid uid = TUid::Uid(0x101f72B4);
   804 		TMMFMessageDestinationPckg destPckg(uid);
   805 		
   806 		if (!iVpu2)
   807 			{
   808 			err = iPlayer->CustomCommandSync(destPckg,
   809 						 					EMMFTestCustomCommandCheckUrl,
   810 											KNullDesC8,
   811 											KNullDesC8);
   812 			}
   813 #ifdef SYMBIAN_BUILD_GCE
   814 		else
   815 			{
   816 			err = iPlayer2->CustomCommandSync(destPckg,
   817 						 					EMMFTestCustomCommandCheckUrl,
   818 											KNullDesC8,
   819 											KNullDesC8);
   820 			}
   821 #endif
   822 		if (err==KErrNone)
   823 			{
   824 #ifdef SYMBIAN_BUILD_GCE
   825 			SurfaceSupported();
   826 #endif
   827 			if (iSurfaceSupported)
   828 				{
   829 				iTestStepResult = ControllerCalled(_L8("SetDisplayWindowL called"), EFalse);
   830 				}
   831 			else 
   832 				{
   833 				iTestStepResult = ControllerCalled(_L8("SetDisplayWindowL called"));
   834 				}
   835 			}
   836 		else
   837 			{
   838 			iTestStepResult = EFail;
   839 			}
   840 		}
   841 	else 
   842 		{
   843 		iTestStepResult = EFail;
   844 		}
   845 
   846 	if (!iVpu2)
   847 		{
   848 		delete iPlayer;
   849 		iPlayer = NULL;
   850 		}
   851 #ifdef SYMBIAN_BUILD_GCE
   852 	else
   853 		{
   854 		delete iPlayer2;
   855 		iPlayer2 = NULL;
   856 		}
   857 #endif
   858 	INFO_PRINTF1(_L("finished with this test step"));
   859 	// test steps return a result
   860 	return iTestStepResult;
   861 	}
   862 	
   863 //
   864 // --------------------------------------------
   865 //
   866 /**
   867  *
   868  * Static constructor for CTestStepVidPlayerOpenviaUriTag.
   869  *
   870  *
   871  * @return	"CTestStepVidPlayerOpenviaUriTag*"
   872  *			The constructed CTestStepVidPlayerOpenviaUriTag
   873  */
   874 CTestStepVidPlayerOpenviaUriTag* CTestStepVidPlayerOpenviaUriTag::NewL()
   875 	{
   876 	CTestStepVidPlayerOpenviaUriTag* self = new(ELeave) CTestStepVidPlayerOpenviaUriTag;
   877 	return self;
   878 	}
   879 
   880 /**
   881  *
   882  * Test step constructor.
   883  * Each test step initialises its own name.
   884  */
   885 CTestStepVidPlayerOpenviaUriTag::CTestStepVidPlayerOpenviaUriTag() 
   886 	{
   887 	iTestStepResult = EPass;
   888 	// store the name of this test case
   889 	// this is the name that is used by the script file
   890 	iTestStepName = _L("MM-MMF-VCLNT-U-0313-CP");
   891 	}
   892 
   893 /**
   894  *
   895  * Test step destructor.
   896  */
   897 CTestStepVidPlayerOpenviaUriTag::~CTestStepVidPlayerOpenviaUriTag()
   898 	{
   899 	}
   900 
   901 /**
   902  * Implementation of the MVideoRecorderUtilityObserver interface functions
   903  **/
   904 void CTestStepVidPlayerOpenviaUriTag::MvpuoOpenComplete(TInt aError)
   905 	{
   906 	iError = aError;
   907 	CActiveScheduler::Stop(); // check if asynchronous
   908 	}
   909 
   910 void CTestStepVidPlayerOpenviaUriTag::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
   911 	{
   912 	}
   913 
   914 void CTestStepVidPlayerOpenviaUriTag::MvpuoPlayComplete(TInt aError)
   915 	{
   916 	iError = aError;
   917 	CActiveScheduler::Stop(); // check if asynchronous
   918 	}
   919 	
   920 void CTestStepVidPlayerOpenviaUriTag::MvpuoPrepareComplete(TInt aError)
   921 	{
   922 	iError = aError;
   923 	CActiveScheduler::Stop(); // check if asynchronous
   924 	}
   925 
   926 void CTestStepVidPlayerOpenviaUriTag::MvpuoEvent(const TMMFEvent& /*aEvent*/)
   927 	{
   928 	}
   929 
   930 
   931 /**
   932  *
   933  * Test step Preamble.
   934  */
   935 enum TVerdict CTestStepVidPlayerOpenviaUriTag::DoTestStepPreambleL(void)
   936 	{
   937 	enum TVerdict verdict;
   938 	// this installs the scheduler
   939 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
   940 	if (verdict != EPass)
   941 		{
   942 		return verdict;
   943 		}
   944 
   945 	_LIT8(KMimeType, "");
   946 	_LIT(KTestURiTag, "rttp://www.symbian.com/test");
   947 
   948 	iFileName.Set(KTestURiTag);
   949 	iMimeType.Set(KMimeType);
   950 
   951 	// Printing to the console and log file
   952 	INFO_PRINTF1(_L("MM-MMF-VCLNT-U-0313-CP"));
   953 	INFO_PRINTF1(_L("this test is opening a file with a CVideoPlayerUtility::OpenUrlL()"));
   954 
   955 	InitWservL();
   956 
   957 	TRect rect, clipRect;
   958 	iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
   959 										iWs, *iScreen, *iWindow, rect, clipRect);
   960 
   961 	if (iPlayer == NULL || !PlayerStateStopped() )
   962 		{
   963 		return EInconclusive;
   964 		}
   965 	
   966 	return verdict;
   967 	}
   968 
   969 /**
   970  *
   971  * Test step Postamble.
   972  */
   973 enum TVerdict CTestStepVidPlayerOpenviaUriTag::DoTestStepPostambleL(void)
   974 	{
   975 	delete iPlayer;
   976 	iPlayer = NULL;
   977 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
   978 	}
   979 
   980 void CTestStepVidPlayerOpenviaUriTag::OpenUrlAndStartSchedulerL()
   981 	{
   982 	iPlayer->OpenUrlL(iFileName,KTestIap,iMimeType);
   983 	CActiveScheduler::Start();
   984 	}
   985 /**
   986  *
   987  * Do the test step.
   988  * Each test step must supply an implementation for DoTestStepL.
   989  *
   990  * @return	"TVerdict"
   991  *			The result of the test step
   992  */
   993 TVerdict CTestStepVidPlayerOpenviaUriTag::DoTestStepL()
   994 	{
   995 	TInt err = KErrNone;
   996 	iError = KErrNone;
   997 
   998 	TRAP(err, OpenUrlAndStartSchedulerL() );
   999 	
  1000 	if (err == KErrNotFound)
  1001 		{
  1002 		return EInconclusive;
  1003 		}
  1004 			
  1005 	if(iError != KErrExtensionNotSupported)
  1006 		{
  1007 		iTestStepResult = EFail;
  1008 		}
  1009 	else
  1010 		{
  1011 		iTestStepResult = EPass;
  1012 		}
  1013 
  1014 	delete iPlayer;
  1015 	iPlayer = NULL;
  1016 
  1017 	INFO_PRINTF1(_L("finished with this test step"));
  1018 	// test steps return a result
  1019 	return iTestStepResult;
  1020 	}
  1021 
  1022 
  1023 //
  1024 // --------------------------------------------
  1025 //
  1026 /**
  1027  *
  1028  * Static constructor for CTestStepVidPlayerOpenTryNextCtrl.
  1029  *
  1030  *
  1031  * @return	"CTestStepVidPlayerOpenTryNextCtrl*"
  1032  *			The constructed CTestStepVidPlayerOpenTryNextCtrl
  1033  */
  1034 CTestStepVidPlayerOpenTryNextCtrl* CTestStepVidPlayerOpenTryNextCtrl::NewL()
  1035 	{
  1036 	CTestStepVidPlayerOpenTryNextCtrl* self = new(ELeave) CTestStepVidPlayerOpenTryNextCtrl;
  1037 	return self;
  1038 	}
  1039 
  1040 /**
  1041  *
  1042  * Test step constructor.
  1043  * Each test step initialises its own name.
  1044  */
  1045 CTestStepVidPlayerOpenTryNextCtrl::CTestStepVidPlayerOpenTryNextCtrl() 
  1046 	{
  1047 	iTestStepResult = EPass;
  1048 	// store the name of this test case
  1049 	// this is the name that is used by the script file
  1050 	iTestStepName = _L("MM-MMF-VCLNT-U-0314-CP");
  1051 	}
  1052 
  1053 /**
  1054  *
  1055  * Test step destructor.
  1056  */
  1057 CTestStepVidPlayerOpenTryNextCtrl::~CTestStepVidPlayerOpenTryNextCtrl()
  1058 	{
  1059 	}
  1060 
  1061 /**
  1062  * Implementation of the MVideoRecorderUtilityObserver interface functions
  1063  **/
  1064 void CTestStepVidPlayerOpenTryNextCtrl::MvpuoOpenComplete(TInt aError)
  1065 	{
  1066 	iError = aError;
  1067 	CActiveScheduler::Stop(); // check if asynchronous
  1068 	}
  1069 
  1070 void CTestStepVidPlayerOpenTryNextCtrl::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
  1071 	{
  1072 	}
  1073 
  1074 void CTestStepVidPlayerOpenTryNextCtrl::MvpuoPlayComplete(TInt aError)
  1075 	{
  1076 	iError = aError;
  1077 	CActiveScheduler::Stop(); // check if asynchronous
  1078 	}
  1079 	
  1080 void CTestStepVidPlayerOpenTryNextCtrl::MvpuoPrepareComplete(TInt aError)
  1081 	{
  1082 	iError = aError;
  1083 	CActiveScheduler::Stop(); // check if asynchronous
  1084 	}
  1085 	
  1086 void CTestStepVidPlayerOpenTryNextCtrl::MvpuoEvent(const TMMFEvent& /*aEvent*/)
  1087 	{
  1088 	}
  1089 
  1090 
  1091 /**
  1092  *
  1093  * Test step Preamble.
  1094  */
  1095 enum TVerdict CTestStepVidPlayerOpenTryNextCtrl::DoTestStepPreambleL(void)
  1096 	{
  1097 	enum TVerdict verdict;
  1098 	// this installs the scheduler
  1099 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
  1100 	if (verdict != EPass)
  1101 		{
  1102 		return verdict;
  1103 		}
  1104 
  1105 	_LIT8(KMimeType, "");
  1106 	_LIT(KTestURL1, "rttp://www.symbian.com/clock.dummy");
  1107 	iFileName.Set(KTestURL1);
  1108 	iMimeType.Set(KMimeType);
  1109 
  1110 	// Printing to the console and log file
  1111 	INFO_PRINTF1(_L("MM-MMF-VCLNT-U-0314-CP"));
  1112 	INFO_PRINTF1(_L("this test is opening a file with a CVideoPlayerUtility::OpenUrlL()"));
  1113 
  1114 	InitWservL();
  1115 
  1116 	TRect rect, clipRect;
  1117 	iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
  1118 										iWs, *iScreen, *iWindow, rect, clipRect);
  1119 
  1120 	if (iPlayer == NULL || !PlayerStateStopped() )
  1121 		{
  1122 		return EInconclusive;
  1123 		}
  1124 	
  1125 	return verdict;
  1126 	}
  1127 
  1128 /**
  1129  *
  1130  * Test step Postamble.
  1131  */
  1132 enum TVerdict CTestStepVidPlayerOpenTryNextCtrl::DoTestStepPostambleL(void)
  1133 	{
  1134 	delete iPlayer;
  1135 	iPlayer = NULL;
  1136 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
  1137 	}
  1138 
  1139 void CTestStepVidPlayerOpenTryNextCtrl::OpenUrlAndStartSchedulerL()
  1140 	{
  1141 	iPlayer->OpenUrlL(iFileName,KTestIap,iMimeType);
  1142 	CActiveScheduler::Start();
  1143 	}
  1144 /**
  1145  *
  1146  * Do the test step.
  1147  * Each test step must supply an implementation for DoTestStepL.
  1148  *
  1149  * @return	"TVerdict"
  1150  *			The result of the test step
  1151  */
  1152 TVerdict CTestStepVidPlayerOpenTryNextCtrl::DoTestStepL()
  1153 	{
  1154 	TInt err = KErrNone;
  1155 	iError = KErrNone;
  1156 
  1157 	TRAP(err, OpenUrlAndStartSchedulerL() );
  1158 	
  1159 	if (err == KErrNotFound)
  1160 		{
  1161 		return EInconclusive;
  1162 		}
  1163 		
  1164 	//need to remove <n>yes tag from 101f7D2D.RSS to really check for Trying Next Ctrl.
  1165 	//in that case, KErrNone returned
  1166 	if(iError != KErrExtensionNotSupported)
  1167 		{
  1168 		iTestStepResult = EFail;
  1169 		}
  1170 	else
  1171 		{
  1172 		iTestStepResult = EPass;
  1173 		}
  1174 
  1175 	delete iPlayer;
  1176 	iPlayer = NULL;
  1177 
  1178 	INFO_PRINTF1(_L("finished with this test step"));
  1179 	// test steps return a result
  1180 	return iTestStepResult;
  1181 	}
  1182 	
  1183 //
  1184 // --------------------------------------------
  1185 //
  1186 /**
  1187  *
  1188  * Static constructor for CTestStepVidPlayerClose.
  1189  *
  1190  *
  1191  * @return	"CTestStepVidPlayerClose*"
  1192  *			The constructed CTestStepVidPlayerClose
  1193  */
  1194 CTestStepVidPlayerClose* CTestStepVidPlayerClose::NewL()
  1195 	{
  1196 	CTestStepVidPlayerClose* self = new(ELeave) CTestStepVidPlayerClose;
  1197 	return self;
  1198 	}
  1199 
  1200 /**
  1201  *
  1202  * Test step constructor.
  1203  * Each test step initialises its own name.
  1204  */
  1205 CTestStepVidPlayerClose::CTestStepVidPlayerClose() 
  1206 	{
  1207 	iTestStepResult = EPass;
  1208 	// store the name of this test case
  1209 	// this is the name that is used by the script file
  1210 	iTestStepName = _L("MM-MMF-VCLNT-U-0010-CP");
  1211 	}
  1212 
  1213 /**
  1214  *
  1215  * Test step destructor.
  1216  */
  1217 CTestStepVidPlayerClose::~CTestStepVidPlayerClose()
  1218 	{
  1219 	}
  1220 
  1221 /**
  1222  * Implementation of the MVideoRecorderUtilityObserver interface functions
  1223  **/
  1224 void CTestStepVidPlayerClose::MvpuoOpenComplete(TInt aError)
  1225 	{
  1226 	iError = aError;
  1227 	CActiveScheduler::Stop(); // check if asynchronous
  1228 	}
  1229 
  1230 void CTestStepVidPlayerClose::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
  1231 	{
  1232 	}
  1233 
  1234 void CTestStepVidPlayerClose::MvpuoPlayComplete(TInt aError)
  1235 	{
  1236 	iError = aError;
  1237 	CActiveScheduler::Stop(); // check if asynchronous
  1238 	}
  1239 	
  1240 void CTestStepVidPlayerClose::MvpuoPrepareComplete(TInt aError)
  1241 	{
  1242 	iError = aError;
  1243 	CActiveScheduler::Stop(); // check if asynchronous
  1244 	}
  1245 
  1246 	
  1247 void CTestStepVidPlayerClose::MvpuoEvent(const TMMFEvent& /*aEvent*/)
  1248 	{
  1249 	}
  1250 
  1251 
  1252 /**
  1253  *
  1254  * Test step Preamble.
  1255  */
  1256 enum TVerdict CTestStepVidPlayerClose::DoTestStepPreambleL(void)
  1257 	{
  1258 	enum TVerdict verdict;
  1259 	// this installs the scheduler
  1260 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
  1261 	if (verdict != KErrNone)
  1262 		{
  1263 		return EInconclusive;
  1264 		}
  1265 
  1266 	iFileName.Set(KClockFileName);
  1267 
  1268 	// Printing to the console and log file
  1269 	INFO_PRINTF1(_L("MM-MMF-VCLNT-U-0010-CP"));
  1270 	INFO_PRINTF1(_L("this test is closing a source with CVideoPlayerUtility::Close()"));
  1271 
  1272 	iError = KErrNone; //KErrTimedOut;
  1273 
  1274 
  1275 	return verdict;
  1276 
  1277 	}
  1278 
  1279 /**
  1280  *
  1281  * Test step Postamble.
  1282  */
  1283 enum TVerdict CTestStepVidPlayerClose::DoTestStepPostambleL(void)
  1284 	{
  1285 	delete iPlayer;
  1286 	iPlayer = NULL;
  1287 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
  1288 	}
  1289 
  1290 /**
  1291  *
  1292  * Do the test step.
  1293  * Each test step must supply an implementation for DoTestStepL.
  1294  *
  1295  * @return	"TVerdict"
  1296  *			The result of the test step
  1297  */
  1298 TVerdict CTestStepVidPlayerClose::DoTestStepL()
  1299 	{
  1300 	InitWservL();
  1301 
  1302 	TRect rect, clipRect;
  1303 	iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
  1304 										iWs, *iScreen, *iWindow, rect, clipRect);
  1305 
  1306 	if (!iPlayer || !PlayerStateStopped())
  1307 		{
  1308 		return EInconclusive;
  1309 		}
  1310 
  1311 	TInt err = KErrNone;
  1312 	TRAP(err, OpenAndStartSchedulerL() );
  1313 
  1314 #ifdef _TYPHOON_TEST_
  1315 	//Typhoon fix, video is not supported
  1316 	if (err == KErrNotSupported)
  1317 		{
  1318 		return EPass;
  1319 		}
  1320 #endif
  1321 
  1322 	if (err != KErrNone) 
  1323 		{
  1324 		return EInconclusive;
  1325 		}
  1326 
  1327 
  1328 	iPlayer->Close();
  1329 
  1330 #ifdef _TYPHOON_TEST_
  1331 	//Typhoon fix, video is not supported
  1332 	if (err == KErrNotSupported)
  1333 		{
  1334 		return EPass;
  1335 		}
  1336 #endif
  1337 
  1338 	if (err != KErrNone) // we can check the duration if it's 0, or the file handle if we could access it....
  1339 		{	
  1340 		return EFail;
  1341 		}
  1342 
  1343 	delete iPlayer;
  1344 	iPlayer = NULL;
  1345 
  1346 
  1347 	INFO_PRINTF1(_L("finished with this test step"));
  1348 	// test steps return a result
  1349 	return iTestStepResult;
  1350 	}
  1351 
  1352 /**
  1353  *
  1354  * Static constructor for CTestStepVidPlayerOpenDurationCustomCommand.
  1355  *
  1356  *
  1357  * @return	"CTestStepVidPlayerOpenDurationCustomCommand*"
  1358  *			The constructed CTestStepVidPlayerOpenDurationCustomCommand
  1359  */
  1360 CTestStepVidPlayerOpenDurationCustomCommand* CTestStepVidPlayerOpenDurationCustomCommand::NewL()
  1361 	{
  1362 	CTestStepVidPlayerOpenDurationCustomCommand* self = new(ELeave) CTestStepVidPlayerOpenDurationCustomCommand;
  1363 	return self;
  1364 	}
  1365 
  1366 /**
  1367  *
  1368  * Test step constructor.
  1369  * Each test step initialises its own name.
  1370  */
  1371 CTestStepVidPlayerOpenDurationCustomCommand::CTestStepVidPlayerOpenDurationCustomCommand() 
  1372 	{
  1373 	iTestStepResult = EPass;
  1374 	// store the name of this test case
  1375 	// this is the name that is used by the script file
  1376 	iTestStepName = _L("MM-MMF-VCLNT-U-0256-HP");
  1377 	}
  1378 
  1379 /**
  1380  *
  1381  * Test step destructor.
  1382  */
  1383 CTestStepVidPlayerOpenDurationCustomCommand::~CTestStepVidPlayerOpenDurationCustomCommand()
  1384 	{
  1385 	}
  1386 
  1387 
  1388 /**
  1389  *
  1390  * Test step Preamble.
  1391  */
  1392 TVerdict CTestStepVidPlayerOpenDurationCustomCommand::DoTestStepPreambleL(void)
  1393 	{
  1394 	enum TVerdict verdict;
  1395 	// this installs the scheduler
  1396 	verdict = CTestStepUnitMMFVidClient::DoTestStepPreambleL();
  1397 	if (verdict != EPass)
  1398 		{
  1399 		return verdict;
  1400 		}
  1401 		
  1402 	_LIT8(KMimeType, "video/msvideo");
  1403 	iFileName.Set(KTestURL);
  1404 	iMimeType.Set(KMimeType);
  1405 
  1406 	// Printing to the console and log file
  1407 	INFO_PRINTF1(_L("MM-MMF-VCLNT-U-0256-HP")); 
  1408 	INFO_PRINTF1(_L("This test opens a file with a CVideoPlayerUtility::OpenUrlL() and then tests"));
  1409 	INFO_PRINTF1(_L("the custom command: EMMFGetDurationInfo.  The custom command parser for this test case"));
  1410 	INFO_PRINTF1(_L("is implemented in the video test controller: TInt CMMFTestController::GetDurationInfo(TMMFDurationInfo& aDurationInfo)"));
  1411 	
  1412 	InitWservL(); 
  1413 	TRect rect, clipRect; 
  1414 	iPlayer = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality,
  1415 										iWs, *iScreen, *iWindow, rect, clipRect); 
  1416 	if (iPlayer == NULL ||!PlayerStateStopped())
  1417 		{
  1418 		return EInconclusive;
  1419 		}
  1420 	return verdict;
  1421 	}
  1422 	
  1423 void CTestStepVidPlayerOpenDurationCustomCommand::OpenUrlAndStartSchedulerL()
  1424 	{
  1425 	iPlayer->OpenUrlL(iFileName,KTestIap,iMimeType);
  1426 	CActiveScheduler::Start();
  1427     }
  1428 
  1429 /**
  1430  *
  1431  * Do the test step.
  1432  * Each test step must supply an implementation for DoTestStepL.
  1433  *
  1434  * @return	"TVerdict"
  1435  *			The result of the test step
  1436  */
  1437 TVerdict CTestStepVidPlayerOpenDurationCustomCommand::DoTestStepL()
  1438 	{
  1439 	TInt err = KErrNone;
  1440 	
  1441 	TRAP(err,OpenUrlAndStartSchedulerL());
  1442 	if(err == KErrNotFound)
  1443 		{
  1444 		return EInconclusive;
  1445 		}
  1446 		
  1447 	// Now the player is open we can check that the duration custom command parser is working correctly
  1448 	// The test controller is hard coded to always return TMMFDurationInfo::EMMFDurationInfoInfinite
  1449 	TUid uid = TUid::Uid(0x10273812);
  1450 	TMMFMessageDestinationPckg destPckg(uid);
  1451 	TPckgBuf<TMMFDurationInfo> enumPckg;
  1452 	iPlayer->CustomCommandSync(destPckg, EMMFGetDurationInfo, KNullDesC8, KNullDesC8, enumPckg);
  1453 	
  1454 	if(enumPckg()!=EMMFDurationInfoInfinite)
  1455 		{
  1456 		iTestStepResult=EFail;
  1457 		}
  1458 		
  1459     INFO_PRINTF1(_L("Finished with this test step"));
  1460     return iTestStepResult;
  1461 	}
  1462 
  1463 /**
  1464  *
  1465  * Test step Postamble.
  1466  */
  1467 TVerdict CTestStepVidPlayerOpenDurationCustomCommand::DoTestStepPostambleL(void)
  1468 	{
  1469 	delete iPlayer;
  1470 	iPlayer = NULL;
  1471 	return CTestStepUnitMMFVidClient::DoTestStepPostambleL();
  1472 	}
  1473 
  1474 // from MVideoPlayerUtilityObserver
  1475 void CTestStepVidPlayerOpenDurationCustomCommand::MvpuoOpenComplete(TInt aError)
  1476 	{
  1477 	iError = aError;
  1478 	CActiveScheduler::Stop();
  1479 	}
  1480 
  1481 void CTestStepVidPlayerOpenDurationCustomCommand::MvpuoFrameReady(CFbsBitmap& /*aFrame*/, TInt /*aError*/)
  1482 	{
  1483 	}
  1484 
  1485 void CTestStepVidPlayerOpenDurationCustomCommand::MvpuoPlayComplete(TInt aError)
  1486 	{
  1487 	iError = aError;
  1488 	CActiveScheduler::Stop();
  1489 	}
  1490 	
  1491 void CTestStepVidPlayerOpenDurationCustomCommand::MvpuoPrepareComplete(TInt aError)
  1492 	{
  1493 	iError = aError;
  1494 	CActiveScheduler::Stop();
  1495 	}
  1496 	
  1497 void CTestStepVidPlayerOpenDurationCustomCommand::MvpuoEvent(const TMMFEvent& /*aEvent*/)
  1498 	{
  1499 	}
  1500