mmlibs/mmfw/tsrc/mmfintegrationtest/vclnt/TS_MMFVCLNTsuite.cpp
changeset 24 2672ba96448e
parent 21 1c0a769d0cc5
child 33 0267baa9dea9
equal deleted inserted replaced
21:1c0a769d0cc5 24:2672ba96448e
     1 
       
     2 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 // All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 //
       
     9 // Initial Contributors:
       
    10 // Nokia Corporation - initial contribution.
       
    11 //
       
    12 // Contributors:
       
    13 //
       
    14 // Description:
       
    15 // This main DLL entry point for the TS_WP5.dll
       
    16 // 
       
    17 //
       
    18 
       
    19 
       
    20 // EPOC includes
       
    21 #include <e32base.h>
       
    22 
       
    23 // Test system includes
       
    24 #include <testframework.h>
       
    25 
       
    26 #include "TSI_MMFVCLNT.h"
       
    27 #include "TS_MMFVCLNTSuite.h"
       
    28 #include "TestPlayer.h"
       
    29 #include "TestRecord.h"
       
    30 #include "DRMTestVidPlayer.h"
       
    31 #include "OpenFileByHandle0034.h"
       
    32 #include "OpenFileByHandle0036.h"
       
    33 #include "OpenFileByHandle0522.h"
       
    34 #include "OpenFileByHandle0523.h"
       
    35 #include "OpenFileByHandle0524.h"
       
    36 #include "OpenFileByHandle1011.h"
       
    37 #include "OpenFileByHandle_PlayText.h"
       
    38 #include "OpenFileByHandle1511.h"
       
    39 #include "OpenFileByHandle1512.h"
       
    40 #include "OpenFileByHandle1513.h"
       
    41 
       
    42 
       
    43 
       
    44 /**
       
    45  * NewTestSuite is exported at ordinal 1
       
    46  * this provides the interface to allow schedule test
       
    47  * to create instances of this test suite
       
    48  */
       
    49 EXPORT_C CTestSuite* NewTestSuiteL()
       
    50     {
       
    51 	CTestMmfVclntSuite* result = new (ELeave) CTestMmfVclntSuite;
       
    52 	CleanupStack::PushL(result);
       
    53 	result->ConstructL();
       
    54 	CleanupStack::Pop(); // result
       
    55 	return result;
       
    56     }
       
    57 
       
    58 /**
       
    59  * destructor
       
    60  */
       
    61 CTestMmfVclntSuite::~CTestMmfVclntSuite()
       
    62 	{
       
    63 	}
       
    64 
       
    65 /**
       
    66  * make a version string available for test system
       
    67  * @return version string
       
    68  */
       
    69 TPtrC CTestMmfVclntSuite::GetVersion()
       
    70 	{
       
    71 	_LIT(KTxtVersion,"1.0");
       
    72 	return KTxtVersion();
       
    73 	}
       
    74 
       
    75 /**
       
    76  * Add a test step into the suite
       
    77  *
       
    78  * @param test step pointer to add
       
    79  */
       
    80 void CTestMmfVclntSuite::AddTestStepL( CTestMmfVclntStep* aPtrTestStep )
       
    81 	{
       
    82 	// test steps contain a pointer back to the suite which owns them
       
    83 	aPtrTestStep->SetTestSuite(this);
       
    84 	// add the step using tyhe base class method
       
    85 	CTestSuite::AddTestStepL(aPtrTestStep);
       
    86 	}
       
    87 
       
    88 /**
       
    89  * Constructor for test suite
       
    90  * this creates all the test steps and 
       
    91  * stores them inside CTestMmfVclntSuite 
       
    92  */
       
    93 void CTestMmfVclntSuite::InitialiseL()
       
    94 	{
       
    95 #ifdef __WINS__
       
    96 	// Check that the window server is ready for us
       
    97 	// This is so that the call to CDirectScreenAccess::StartL does not leave with KErrNotReady
       
    98 	if (!WaitUntilWindowServerReadyL())
       
    99 		{
       
   100 		INFO_PRINTF1(_L("TestSuite error: error receiving window server redraw event"));
       
   101 		return;
       
   102 		}
       
   103 #endif // __WINS__
       
   104 
       
   105 	// store the name of this test suite 
       
   106 	iSuiteName = _L("MMF_VCLNT");
       
   107 
       
   108 	TTimeIntervalMicroSeconds position = TInt64(0);
       
   109 
       
   110 	//Play video file
       
   111 	AddTestStepL( CTestVclntVideoFile::NewL( _L("MM-MMF-VCLNT-I-0001-CP"), _L("SectionOne"), _L("filename"), ETrue) );
       
   112 	
       
   113 	// Play video descriptor
       
   114 	AddTestStepL( CTestVclntVideoDes::NewL( _L("MM-MMF-VCLNT-I-0002-CP"), _L("SectionOne"), _L("filename"), ETrue) );
       
   115 	
       
   116 	AddTestStepL( CTestVclntEnqFrameRate::NewL( _L("MM-MMF-VCLNT-I-0010-CP"), _L("SectionOne"), _L("filename"), 10) );
       
   117 	AddTestStepL( CTestVclntPosition::NewL( _L("MM-MMF-VCLNT-I-0011-CP"), _L("SectionOne"), _L("filename"), position)  ); 
       
   118 	AddTestStepL( CTestVclntPriority::NewL( _L("MM-MMF-VCLNT-I-0012-CP"), _L("SectionOne"), _L("filename"), -1/*EPriorityMin*/) );
       
   119 	AddTestStepL( CTestVclntDuration::NewL( _L("MM-MMF-VCLNT-I-0015-HP"), _L("SectionOne"), _L("filename"), position) );
       
   120 	AddTestStepL( CTestVclntVolume::NewL( _L("MM-MMF-VCLNT-I-0016-HP"), _L("SectionOne"), _L("filename"), -1) );
       
   121 	AddTestStepL( CTestVclntCloseOpen::NewL( _L("MM-MMF-VCLNT-I-0017-HP"), _L("SectionOne"), _L("filename")) );
       
   122 	AddTestStepL( CTestVclntPause::NewL( _L("MM-MMF-VCLNT-I-0018-HP"), _L("SectionOne"), _L("filename")) );
       
   123 	AddTestStepL( CTestVclntBalance::NewL( _L("MM-MMF-VCLNT-I-0019-HP"), _L("SectionOne"), _L("filename"),-10) );
       
   124 	AddTestStepL( CTestVclntPlayWindow::NewL( _L("MM-MMF-VCLNT-I-0020-HP"), _L("SectionOne"), _L("filename"), position , position) );
       
   125 	AddTestStepL( CTestVclntMeta::NewL( _L("MM-MMF-VCLNT-I-0021-HP"), _L("SectionOne"), _L("filename")) );
       
   126 	AddTestStepL( CTestVclntFrameSize::NewL( _L("MM-MMF-VCLNT-I-0022-HP"), _L("SectionOne"), _L("filename"),12) );
       
   127 	AddTestStepL( CTestVclntRepeat::NewL( _L("MM-MMF-VCLNT-I-0023-HP"), _L("SectionOne"), _L("filename"),3) );
       
   128 	AddTestStepL( CTestVclntMimeType::NewL( _L("MM-MMF-VCLNT-I-0031-LP"), _L("SectionOne"), _L("filename")) );
       
   129 	AddTestStepL( CTestVclntRebuffering::NewL( _L("MM-MMF-VCLNT-I-0032-LP"), _L("SectionOne"), _L("filename")) );
       
   130 
       
   131 	// RecorderUtils
       
   132 
       
   133 	AddTestStepL( CTestVclntRecordVideoFile::NewL( _L("MM-MMF-VCLNT-I-0502-CP"), _L("SectionTwo"), _L("filename"), ETrue) );
       
   134 	AddTestStepL( CTestVclntRecorderVideoDes::NewL( _L("MM-MMF-VCLNT-I-0503-CP"), _L("SectionTwo"), _L("filename"), ETrue) );
       
   135 	AddTestStepL( CTestVclntRecorderVideoUrl::NewL( _L("MM-MMF-VCLNT-I-0504-LP"), _L("SectionTwo"), _L("filename"), ETrue) );
       
   136 	AddTestStepL( CTestVclntRecordCloseOpen::NewL( _L("MM-MMF-VCLNT-I-0505-HP"), _L("SectionTwo"), _L("filename")) );
       
   137 	AddTestStepL( CTestVclntRecordConfig::NewL( _L("MM-MMF-VCLNT-I-0506-CP")) );
       
   138 	AddTestStepL( CTestVclntRecordPause::NewL( _L("MM-MMF-VCLNT-I-0507-HP"), _L("SectionTwo"), _L("filename")) );
       
   139 
       
   140 	AddTestStepL( CTestVclntRecordDuration::NewL( _L("MM-MMF-VCLNT-I-0509-HP"), _L("SectionTwo"), _L("filename"), position) );
       
   141 	AddTestStepL( CTestVclntRecordTime::NewL( _L("MM-MMF-VCLNT-I-0510-HP"), _L("SectionTwo"), _L("filename"), 10) ); 
       
   142 	AddTestStepL( CTestVclntRecordCrop::NewL( _L("MM-MMF-VCLNT-I-0511-HP"), _L("SectionTwo"), _L("filename"), ETrue) );
       
   143 	AddTestStepL( CTestVclntRecordGain::NewL( _L("MM-MMF-VCLNT-I-0512-HP"), _L("SectionTwo"), _L("filename"), 10) );
       
   144 	AddTestStepL( CTestVclntRecordMeta::NewL( _L("MM-MMF-VCLNT-I-0513-LP"), _L("SectionTwo"), _L("filename")) );
       
   145 	AddTestStepL( CTestVclntRecordPriority::NewL( _L("MM-MMF-VCLNT-I-0514-LP"), _L("SectionOne"), _L("filename"), -1/*EPriorityMin*/) );
       
   146 	AddTestStepL( CTestVclntRecordBalance::NewL( _L("MM-MMF-VCLNT-I-0515-HP"), _L("SectionTwo"), _L("filename"), -10) );
       
   147 	AddTestStepL( CTestVclntRecordSize::NewL( _L("MM-MMF-VCLNT-I-0516-LP"), _L("SectionTwo"), _L("filename")) );
       
   148 	AddTestStepL( CTestVclntRecordTypes::NewL( _L("MM-MMF-VCLNT-I-0521-LP"), _L("SectionTwo"), _L("filename")) );
       
   149 
       
   150 //
       
   151 // NEGATIVE TEST 
       
   152 //
       
   153 
       
   154 	AddTestStepL( CTestVclntDelete::NewL( _L("MM-MMF-VCLNT-I-1001-CP"), _L("SectionOne"), _L("filename")) );
       
   155 	AddTestStepL( CTestVclntFrameSize::NewL( _L("MM-MMF-VCLNT-I-1002-CP"), _L("SectionOne"), _L("filename"),-12) );
       
   156 	position = 103423423;
       
   157 	AddTestStepL( CTestVclntPosition::NewL( _L("MM-MMF-VCLNT-I-1003-CP"), _L("SectionOne"), _L("filename"), position) ); 
       
   158 	position = -12;
       
   159 	AddTestStepL( CTestVclntPosition::NewL( _L("MM-MMF-VCLNT-I-1004-CP"), _L("SectionOne"), _L("filename"), position) ); 
       
   160 	AddTestStepL( CTestVclntVolume::NewL( _L("MM-MMF-VCLNT-I-1005-HP"), _L("SectionOne"), _L("filename"), 1000400) );
       
   161 	AddTestStepL( CTestVclntVolume::NewL( _L("MM-MMF-VCLNT-I-1010-HP"), _L("SectionOne"), _L("filename"), -100) );
       
   162 	AddTestStepL( CTestVclntBalance::NewL( _L("MM-MMF-VCLNT-I-1006-HP"), _L("SectionOne"), _L("filename"),200) );
       
   163 	AddTestStepL( CTestVclntBalance::NewL( _L("MM-MMF-VCLNT-I-1011-HP"), _L("SectionOne"), _L("filename"),-200) );
       
   164 	position = 2000000;
       
   165 	AddTestStepL( CTestVclntPlayWindow::NewL( _L("MM-MMF-VCLNT-I-1007-HP"), _L("SectionOne"), _L("filename"), position , position) );
       
   166 	AddTestStepL( CTestVclntVideoFile::NewL( _L("MM-MMF-VCLNT-I-1008-HP"), _L("SectionOne"), _L("corruptFile"), ETrue) );
       
   167 	AddTestStepL( CTestVclntVideoFile::NewL( _L("MM-MMF-VCLNT-I-1009-HP"), _L("SectionOne"), _L("NoCodecFile"), ETrue) );
       
   168 
       
   169 	// RecorderUtils
       
   170 
       
   171 	AddTestStepL( CTestVclntRecordVideoFile::NewL( _L("MM-MMF-VCLNT-I-1501-HP"), _L("SectionTwo"), _L("unsupported"), ETrue) );
       
   172 	AddTestStepL( CTestVclntRecordDelete::NewL( _L("MM-MMF-VCLNT-I-1502-LP"), _L("SectionTwo"), _L("unsupported")) );
       
   173 	AddTestStepL( CTestVclntRecordGain::NewL( _L("MM-MMF-VCLNT-I-1503-HP"), _L("SectionTwo"), _L("filename"), 1005670) );
       
   174 	AddTestStepL( CTestVclntRecordGain::NewL( _L("MM-MMF-VCLNT-I-1504-HP"), _L("SectionTwo"), _L("filename"), -10) );
       
   175 	
       
   176 	AddTestStepL( CTestVclntRecordBalance::NewL( _L("MM-MMF-VCLNT-I-1507-HP"), _L("SectionTwo"), _L("filename"), -200) );
       
   177 	AddTestStepL( CTestVclntRecordBalance::NewL( _L("MM-MMF-VCLNT-I-1508-HP"), _L("SectionTwo"), _L("filename"), 200) );
       
   178 	AddTestStepL( CTestVclntRecordSize::NewL( _L("MM-MMF-VCLNT-I-1510-LP"), _L("SectionTwo"), _L("filename")) );
       
   179 
       
   180 	//DRM
       
   181 	//GetFrame unprotected file 
       
   182 	AddTestStepL( CTestStepVidPlayerDRMGetFrame::NewL( _L("MM-MMF-VCLNT-I-1600-LP"), _L("SectionDRM"), _L("filename")) );
       
   183 	
       
   184 	//Getframe from DRM protect file, with rights play count set to zero
       
   185 	AddTestStepL( CTestStepVidPlayerDRMGetFrameProtected::NewL( _L("MM-MMF-VCLNT-I-1601-LP"), _L("SectionDRM"), _L("DRMFile")) );
       
   186 	
       
   187 	// Open unprotected file and play it no rights
       
   188 	AddTestStepL( CTestStepVidPlayerDRMPlayNoRights::NewL( _L("MM-MMF-VCLNT-I-1602-LP"), _L("SectionDRM"), _L("DRMFile")) );
       
   189 	
       
   190 	//Open DRM protected video and play it with rights set and Agent providing MIME type 
       
   191 	AddTestStepL( CTestStepVidPlayerDRMPlayRights::NewL( _L("MM-MMF-VCLNT-I-1603-LP"), _L("SectionDRM"), _L("DRMFile")) );
       
   192 
       
   193 	//Media Access by Handle
       
   194 	AddTestStepL( CTestMmfVclntOpenFile0034::NewL( _L("MM-MMF-VCLNT-I-0034-CP"), _L("SectionOne"), _L("filename"), ETrue ) );
       
   195 	AddTestStepL( CTestMmfVclntOpenFile0036::NewL( _L("MM-MMF-VCLNT-I-0036-CP"), _L("SectionOne"), _L("filename"), ETrue ) );
       
   196 	AddTestStepL( CTestMmfVclntOpenFile0522::NewL( _L("MM-MMF-VCLNT-I-0522-CP"), _L("SectionTwo"), _L("filename"), ETrue ) );
       
   197 	AddTestStepL( CTestMmfVclntOpenFile0523::NewL( _L("MM-MMF-VCLNT-I-0523-CP"), _L("SectionTwo"), _L("filename"), ETrue ) );
       
   198 	AddTestStepL( CTestMmfVclntOpenFile0524::NewL( _L("MM-MMF-VCLNT-I-0524-CP"), _L("SectionTwo"), _L("filename"), ETrue ) );
       
   199 	AddTestStepL( CTestMmfVclntOpenFile1011::NewL( _L("MM-MMF-VCLNT-I-1011-CP"), _L("SectionTwo"), _L("filename"), ETrue ) );
       
   200 	AddTestStepL( CTestMmfVclntOpenFilePlayTextFile::NewL( _L("MM-MMF-VCLNT-I-1010-CP"), _L("SectionOne"), _L("textFile"), ETrue ) );
       
   201 
       
   202 	AddTestStepL( CTestMmfVclntOpenFile1511::NewL( _L("MM-MMF-VCLNT-I-1511-CP"), _L("SectionTwo"), _L("filename"), ETrue ) );
       
   203 	AddTestStepL( CTestMmfVclntOpenFile1512::NewL( _L("MM-MMF-VCLNT-I-1512-CP"), _L("SectionTwo"), _L("filename"), ETrue ) );
       
   204 	AddTestStepL( CTestMmfVclntOpenFile1513::NewL( _L("MM-MMF-VCLNT-I-1513-CP"), _L("SectionTwo"), _L("textFile"), ETrue ) );
       
   205 	}
       
   206 
       
   207 #ifdef __WINS__
       
   208 //
       
   209 // Wait synchronously for the first WS redraw event...
       
   210 //
       
   211 TBool CTestMmfVclntSuite::WaitUntilWindowServerReadyL()
       
   212 	{
       
   213 	InitWservL();
       
   214 
       
   215 	TWsRedrawEvent event;
       
   216 	TRequestStatus status;
       
   217 	iWs.RedrawReady(&status);
       
   218 	User::WaitForRequest(status);
       
   219 	iWs.GetRedraw(event);
       
   220 
       
   221 	DeInitWserv();
       
   222 
       
   223 	return (status.Int() == KErrNone);
       
   224 	}
       
   225 
       
   226 void CTestMmfVclntSuite::InitWservL()
       
   227 	{
       
   228 	TInt err = iWs.Connect();
       
   229 	if (err != KErrNone)
       
   230 		{
       
   231 		// Access violation if ws is null
       
   232 		INFO_PRINTF1(_L("TestSuite error: Cannot test, no window server available"));
       
   233 		User::Leave(err);
       
   234 		}
       
   235 
       
   236 	iScreen = new (ELeave) CWsScreenDevice(iWs); // make device for this session
       
   237 	User::LeaveIfError(iScreen->Construct()); // and complete its construction
       
   238 
       
   239 	iRootWindow = RWindowGroup(iWs);
       
   240 	User::LeaveIfError(iRootWindow.Construct((TUint32)this, ETrue));
       
   241 
       
   242 	iWindow = new(ELeave) RWindow(iWs);
       
   243 	User::LeaveIfError(((RWindow*)iWindow)->Construct(iRootWindow,((TUint32)(this)) + 1));
       
   244 	iWindow->SetExtent(TPoint(0,0), TSize(400,200));
       
   245 	iWindow->SetVisible(ETrue);
       
   246 	iWindow->Activate();
       
   247 	iWs.Flush();
       
   248 	}
       
   249 
       
   250 void CTestMmfVclntSuite::DeInitWserv()
       
   251 	{
       
   252 	if (iWindow)
       
   253 		{
       
   254 		iWindow->Close();
       
   255 		delete iWindow;
       
   256 		iWindow = NULL;
       
   257 		}
       
   258 	iRootWindow.Close();
       
   259 	delete iScreen;
       
   260 	iScreen = NULL;
       
   261 	iWs.Flush();
       
   262 	iWs.Close();
       
   263 	}
       
   264 #endif // __WINS__
       
   265