Update contrib.
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 
     2 // All rights reserved.
 
     3 // This component and the accompanying materials are made available
 
     4 // under the terms of "Eclipse Public License v1.0"
 
     5 // which accompanies this distribution, and is available
 
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 
     8 // Initial Contributors:
 
     9 // Nokia Corporation - initial contribution.
 
    17 #include <testframework.h>
 
    18 #include "tsu_mmf_avictrl_testsuite.h"
 
    19 #include "tsu_mmf_avictrl_teststep.h"
 
    20 #include "tsu_mmf_avictrlplay.h"
 
    21 #include "tsu_mmf_avictrlrecord.h"
 
    22 #include "tsu_mmf_avictrltestids.h"
 
    24 _LIT(KTextVersion,"0.1");
 
    25 _LIT(KTestCameraPluginName, "C:\\102070cc.txt");
 
    26 _LIT(KMMCameraPluginName, "C:\\mmcameraclientplugin.txt");
 
    30 Required for all DLLs but not used
 
    32 GLDEF_C TInt E32Dll(enum TDllReason)
 
    39 NewTestSuite is exported at ordinal 1this provides the interface to allow schedule test to create instances of this test suite.
 
    40 @return CTestSuiteAviCtrl*
 
    42 EXPORT_C CTestSuiteAviCtrl* NewTestSuiteAviCtrlL()
 
    44 	CTestSuiteAviCtrl* self = new (ELeave) CTestSuiteAviCtrl;
 
    45 	CleanupStack::PushL(self);
 
    53 CTestSuiteAviCtrl::~CTestSuiteAviCtrl()
 
    55 	RemoveDependencyFile();
 
    59 Make a version string available for test system
 
    62 TPtrC CTestSuiteAviCtrl::GetVersion()
 
    64 	return KTextVersion();
 
    68 Add a test step into the suite
 
    71 void CTestSuiteAviCtrl::AddTestStepL(RTestStepAviCtrlBase* aPtrTestStep)
 
    74 	aPtrTestStep->SetSuite(this); 
 
    75 	CTestSuite::AddTestStepL(aPtrTestStep);
 
    79 Add a RAsyncTestStep based test step into the suite 
 
    82 void CTestSuiteAviCtrl::AddTestStepL(RAsyncTestStepAviCtrlBase* aPtrTestStep)
 
    85 	aPtrTestStep->SetSuite(this); 
 
    86 	CTestSuite::AddTestStepL(aPtrTestStep);
 
    90  Constructor for test suite this creates all the test steps and  stores them inside CTestSuiteAviCtrl 
 
    92 void CTestSuiteAviCtrl::InitialiseL( void )
 
    95 	// Create the dependancy files.
 
    96 	CreateDependencyFileL();
 
    97 	iSuiteName = _L("tsu_mmf_avictrl");
 
    98 	//Steps to test PlayController
 
    99 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlPlay(_L("MM-MMF-AVICTRL-U-0001-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   100 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlVolume(_L("MM-MMF-AVICTRL-U-0002-HP"), _L("SectionPlayer"), _L("aud_vid"), KAviPlayControllerUid));
 
   101 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlPlayBalance(_L("MM-MMF-AVICTRL-U-0003-HP"), _L("SectionPlayer"), _L("aud_vid"), KAviPlayControllerUid));
 
   102 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlDuration(_L("MM-MMF-AVICTRL-U-0004-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   103 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlPause(_L("MM-MMF-AVICTRL-U-0005-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   104 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlStop(_L("MM-MMF-AVICTRL-U-0006-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   105 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetGetCropRegion(_L("MM-MMF-AVICTRL-U-0007-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   106 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetGetFrameRate(_L("MM-MMF-AVICTRL-U-0008-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   107 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlGetFrameSize(_L("MM-MMF-AVICTRL-U-0009-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   108 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlGetAudioDataType(_L("MM-MMF-AVICTRL-U-0010-HP"), _L("SectionPlayer"), _L("aud_vid"), KAviPlayControllerUid));
 
   109 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlGetVideoDataType(_L("MM-MMF-AVICTRL-U-0011-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   110 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlMetaData(_L("MM-MMF-AVICTRL-U-0012-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   111 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetGetRotation(_L("MM-MMF-AVICTRL-U-0013-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   112 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetGetScaling(_L("MM-MMF-AVICTRL-U-0014-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   113 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetPosition(_L("MM-MMF-AVICTRL-U-0015-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   114 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlGetVideoBitrate(_L("MM-MMF-AVICTRL-U-0016-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   115 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlGetAudioBitrate(_L("MM-MMF-AVICTRL-U-0017-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   116 	AddTestStepL( new(ELeave) RTestStepAviCtrlPlayInvalid(_L("MM-MMF-AVICTRL-U-0018-HP"), _L("SectionPlayer"), _L("invalid"), KAviPlayControllerUid));
 
   117 	AddTestStepL( new(ELeave) RTestStepAviCtrlNotAudioEnabled(_L("MM-MMF-AVICTRL-U-0019-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   118 	AddTestStepL( new(ELeave) RTestStepAviCtrlDirectScreenAccess(_L("MM-MMF-AVICTRL-U-0020-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   119 	// TODO: MM-MMF-AVICTRL-U-0021-HP identifier is duplicated, should be fixed
 
   120 	AddTestStepL( new(ELeave) RTestStepAviCtrlSetPlayWindow(_L("MM-MMF-AVICTRL-U-0021-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   121 	// NOTE: More PlayController test steps follow at the bottom...
 
   124 	//Steps to test RecordController
 
   125 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlRecord(_L("MM-MMF-AVICTRL-U-0021-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   126 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGain(_L("MM-MMF-AVICTRL-U-0022-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   127 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlRecordBalance(_L("MM-MMF-AVICTRL-U-0023-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   128 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetMaxFileSize(_L("MM-MMF-AVICTRL-U-0024-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   129 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlRecordTimeAvailable(_L("MM-MMF-AVICTRL-U-0025-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   130 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetGetFrameRate(_L("MM-MMF-AVICTRL-U-0026-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   131 	AddTestStepL( new(ELeave) RTestStepAviRecirdCtrlSetGetFrameSize(_L("MM-MMF-AVICTRL-U-0027-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   132 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGetSetAudioDataType(_L("MM-MMF-AVICTRL-U-0028-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   133 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGetSetVideoDataType(_L("MM-MMF-AVICTRL-U-0029-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   134 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGetSetMetaData(_L("MM-MMF-AVICTRL-U-0030-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   135 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlDuration(_L("MM-MMF-AVICTRL-U-0031-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   136 	AddTestStepL( new(ELeave) RTestStepAviRecordNotAudioEnabled(_L("MM-MMF-AVICTRL-U-0032-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   137 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlPosition(_L("MM-MMF-AVICTRL-U-0033-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   138 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlPause(_L("MM-MMF-AVICTRL-U-0034-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   139 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlDurationNewClip(_L("MM-MMF-AVICTRL-U-0035-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   141 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetGetPixelAspectRatio(_L("MM-MMF-AVICTRL-U-0045-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   142 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGetSupportedPixelAspectRatios(_L("MM-MMF-AVICTRL-U-0046-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   143 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetGetAudioSampleRate(_L("MM-MMF-AVICTRL-U-0047-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   144 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGetSupportedAudioSampleRate(_L("MM-MMF-AVICTRL-U-0048-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   145 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetGetAudioChannels(_L("MM-MMF-AVICTRL-U-0049-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   146 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlGetSupportedAudioChannels(_L("MM-MMF-AVICTRL-U-0050-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   148 	// Steps to test RecordController: Negative Testing
 
   150 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetInvalidPixelAspectRatio(_L("MM-MMF-AVICTRL-U-0051-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   151 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetInvalidAudioSampleRate(_L("MM-MMF-AVICTRL-U-0052-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   152 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlSetInvalidAudioChannels(_L("MM-MMF-AVICTRL-U-0053-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   153 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlInvalidStateSetPixelAspectRatio(_L("MM-MMF-AVICTRL-U-0054-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   154 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlInvalidStateSetAudioSampleRate(_L("MM-MMF-AVICTRL-U-0055-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));
 
   155 	AddTestStepL( new(ELeave) RTestStepAviRecordCtrlInvalidStateSetAudioChannels(_L("MM-MMF-AVICTRL-U-0056-HP"), _L("SectionRecorder"), _L("record"), KAviRecordControllerUid));	
 
   157 	//Steps to test setting Screen device on AviPlayController - CR0779
 
   158 	//Play on primary screen
 
   159 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetScrnPlay(_L("MM-MMF-AVICTRL-U-0041-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid, KPrimaryScreenNo));
 
   160 	//Play on secondary screen
 
   161 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetScrnPlay(_L("MM-MMF-AVICTRL-U-0042-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid, KSecondaryScreenNo));
 
   162 	//try setting an invalid screen id
 
   163 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlSetInvalidScrn(_L("MM-MMF-AVICTRL-U-0043-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid, KInvalidScreenNo));
 
   164 	//Add data sink twice
 
   165 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlAddDataSinkTwice(_L("MM-MMF-AVICTRL-U-0044-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid, KInvalidScreenNo));
 
   167 	// More PlayController test steps here...
 
   168 	AddTestStepL( new(ELeave) RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap(_L("MM-MMF-AVICTRL-U-0057-HP"), _L("SectionPlayer"), _L("long_video"), KAviPlayControllerUid));
 
   169 	// INC112128 : To test if AVI Files with Video Property Header are played correctly
 
   170 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlPlay(_L("MM-MMF-AVICTRL-U-0058-HP"), _L("SectionPlayer"), _L("videoprophdr"), KAviPlayControllerUid));
 
   172 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlMemAlloc1(_L("MM-MMF-AVICTRL-U-0070-HP"), _L("SectionPlayer"), _L("aud_vid"), KUidCustomTestAviPlayPlugin));
 
   173 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlMemAlloc2(_L("MM-MMF-AVICTRL-U-0071-HP"), _L("SectionPlayer"), _L("aud_vid"), KUidCustomTestAviPlayPlugin));
 
   174 	AddTestStepL( new(ELeave) RTestStepAviPlayCtrlMemAlloc3(_L("MM-MMF-AVICTRL-U-0072-HP"), _L("SectionPlayer"), _L("aud_vid"), KUidCustomTestAviPlayPlugin));
 
   176 #ifdef SYMBIAN_BUILD_GCE
 
   177 	// PlayController test steps for surface support here:
 
   178 	AddTestStepL(new (ELeave) RTestStepAviPlayCtrlSurfaceSupport(_L("MM-MMF-AVICTRL-U-0059-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   179 	AddTestStepL(new (ELeave) RTestStepAviPlayCtrlGetSurfaceParametersNoUS(_L("MM-MMF-AVICTRL-U-0064-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   180 	AddTestStepL(new (ELeave) RTestStepAviPlayCtrlSurfaceRemovedNoUS(_L("MM-MMF-AVICTRL-U-0073-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   181 	AddTestStepL(new (ELeave) RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId(_L("MM-MMF-AVICTRL-U-0074-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   182 	AddTestStepL(new (ELeave) RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId(_L("MM-MMF-AVICTRL-U-0075-HP"), _L("SectionPlayer"), _L("video_only"), KAviPlayControllerUid));
 
   183 #endif // SYMBIAN_BUILD_GCE
 
   185 #ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
 
   186 	// AVI play controller test steps for subtitle support.
 
   187 	AddTestStepL(new (ELeave) RAsyncTestSubtitlePlay(_L("MM-MMF-AVICTRL-U-0100-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   188 	AddTestStepL(new (ELeave) RAsyncTestSubtitleUpdateConfig(_L("MM-MMF-AVICTRL-U-0101-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   189 	AddTestStepL(new (ELeave) RAsyncTestSubtitleUpdateDuring(_L("MM-MMF-AVICTRL-U-0102-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   190 	AddTestStepL(new (ELeave) RAsyncTestSubtitleRemoveAdd(_L("MM-MMF-AVICTRL-U-0103-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   191 	AddTestStepL(new (ELeave) RAsyncTestSubtitleNotEnabled(_L("MM-MMF-AVICTRL-U-0200-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   192 	AddTestStepL(new (ELeave) RAsyncTestSubtitleNotAvailable(_L("MM-MMF-AVICTRL-U-0201-HP"), _L("SectionPlayer"), _L("srt_unavailable"), KAviPlayControllerUid));
 
   193 	AddTestStepL(new (ELeave) RAsyncTestSubtitleMismatchedId(_L("MM-MMF-AVICTRL-U-0202-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   194 	AddTestStepL(new (ELeave) RAsyncTestSubtitleDoubleCall(_L("MM-MMF-AVICTRL-U-0203-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   195 	AddTestStepL(new (ELeave) RAsyncTestSubtitleMultipleConfigs(_L("MM-MMF-AVICTRL-U-0204-HP"), _L("SectionPlayer"), _L("srt_available"), KAviPlayControllerUid));
 
   196 #endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
 
   200 Initialises the system path. 
 
   202 void CTestSuiteAviCtrl::InitSystemPath()
 
   204 	_LIT(KTestSourcePathOnC,"c:\\mm\\mmf\\testfiles\\avictrl\\");
 
   207 	TInt ret = fs.Connect();
 
   208 	__ASSERT_ALWAYS(ret == KErrNone,User::Panic(_L("Sys path not setup"),ret));
 
   209 	if (fs.Att(KTestSourcePathOnC, att) == KErrNone)
 
   211 		iDefaultPath = KTestSourcePathOnC;
 
   215 		User::Panic(_L("Test files not found"),KErrNotFound);	
 
   220 const TDesC& CTestSuiteAviCtrl::DefaultPath() const
 
   227  * Creates the dependency file for test camera
 
   229 void CTestSuiteAviCtrl::CreateDependencyFileL()
 
   231 	// enforce dependency
 
   232 	// create the file the plugin depends on.
 
   233 	User::LeaveIfError(ifsSession.Connect());
 
   235 	ifsSession.Delete(KMMCameraPluginName);
 
   238 	TInt err = file.Replace(ifsSession, KTestCameraPluginName, EFileShareAny);
 
   242 	    	User::LeaveIfError(KErrNotSupported);
 
   247  * Removes the dependency file for test camera
 
   249 void CTestSuiteAviCtrl::RemoveDependencyFile()
 
   251 	ifsSession.Delete(KTestCameraPluginName);