os/mm/mmlibs/mmfw/tsrc/mmfunittest/oggctrl/teststepoggctrlplay.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/oggctrl/teststepoggctrlplay.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1026 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "teststepoggctrlplay.h"
    1.20 +
    1.21 +/**
    1.22 + *
    1.23 + * Test step constructor.
    1.24 + * It initialises its own name and the input filename
    1.25 + *
    1.26 + */
    1.27 +RTestStepOggCtrlPlay::RTestStepOggCtrlPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
    1.28 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
    1.29 +	{
    1.30 +	}
    1.31 +/**
    1.32 + * Do the test step.
    1.33 + * This test Primes the OggPlayController and Plays an Ogg file to its completion
    1.34 + * and checks for the proper play completion
    1.35 + */
    1.36 +TVerdict RTestStepOggCtrlPlay::DoTestStepL( void )
    1.37 +	{
    1.38 +	INFO_PRINTF1(_L("this step plays an Ogg file "));
    1.39 +	TInt errorCode = iController.Prime();
    1.40 +	if(errorCode)
    1.41 +		{
    1.42 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
    1.43 +		return EFail;
    1.44 +		}
    1.45 +	errorCode = iController.Play();
    1.46 +	if(errorCode)
    1.47 +		{
    1.48 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
    1.49 +		return EFail;
    1.50 +		}
    1.51 +	CActiveScheduler::Start();
    1.52 +	return iTestStepResult;
    1.53 +	}
    1.54 +
    1.55 +/**
    1.56 + *
    1.57 + * Test step constructor.
    1.58 + * It initialises its own name and the input filename
    1.59 + *
    1.60 + */
    1.61 +RTestStepOggCtrlVolume::RTestStepOggCtrlVolume(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
    1.62 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
    1.63 +	{
    1.64 +	}
    1.65 +
    1.66 +/**
    1.67 + * Do the test step.
    1.68 + * This tests setting the volume on OggPlayController in Stopped, Primed and Playing 
    1.69 + * states and checks if the volume set is same as the volume got.
    1.70 + */
    1.71 +TVerdict RTestStepOggCtrlVolume::DoTestStepL( void )
    1.72 +	{
    1.73 +	INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of OggPlayController "));
    1.74 +	RMMFAudioPlayDeviceCustomCommands theCommander( iController );
    1.75 +	TInt maxVolume(0);
    1.76 +	TInt errorCode =theCommander.GetMaxVolume( maxVolume );
    1.77 +	if(errorCode)
    1.78 +		{
    1.79 +		INFO_PRINTF2(_L("GetMaxVolume() is failed with  %d "), errorCode);
    1.80 +		return EInconclusive;
    1.81 +		}
    1.82 +	
    1.83 +	TInt theVolume = maxVolume /2;
    1.84 +	//try setting volume in Stopped State
    1.85 +	errorCode =theCommander.SetVolume(theVolume);
    1.86 +	if(errorCode)
    1.87 +		{
    1.88 +		INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with  %d "), errorCode);
    1.89 +		return EFail;
    1.90 +		}
    1.91 +	TInt theNewVolume (0);
    1.92 +	errorCode =theCommander.GetVolume(theNewVolume);
    1.93 +	if(errorCode)
    1.94 +		{
    1.95 +		INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with  %d "), errorCode);
    1.96 +		return EFail;
    1.97 +		}
    1.98 +	if( theNewVolume != theVolume )
    1.99 +		{
   1.100 +        INFO_PRINTF1(_L("Set and Get Volumes are different during Stopped State"));
   1.101 +        return EFail;
   1.102 +		}
   1.103 +	errorCode = iController.Prime();
   1.104 +	if(errorCode)
   1.105 +		{
   1.106 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.107 +		return EInconclusive;
   1.108 +		}
   1.109 +	//try setting volume in Primed State
   1.110 +	errorCode =theCommander.SetVolume(theVolume);
   1.111 +	if(errorCode)
   1.112 +		{
   1.113 +		INFO_PRINTF2(_L("SetVolume() during Primed State is failed with  %d "), errorCode);
   1.114 +		return EFail;
   1.115 +		}
   1.116 +	errorCode =theCommander.GetVolume(theNewVolume);
   1.117 +	if(errorCode)
   1.118 +		{
   1.119 +		INFO_PRINTF2(_L("GetVolume() during Primed State is failed with  %d "), errorCode);
   1.120 +		return EFail;
   1.121 +		}
   1.122 +	if( theNewVolume != theVolume )
   1.123 +		{
   1.124 +        INFO_PRINTF1(_L("Set and Get Volumes are different during Primed State"));
   1.125 +        return EFail;
   1.126 +		}
   1.127 +	errorCode = iController.Play();
   1.128 +	if(errorCode)
   1.129 +		{
   1.130 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
   1.131 +		return EInconclusive;
   1.132 +		}
   1.133 +	//try setting volume in Playing State
   1.134 +	errorCode =theCommander.SetVolume(theVolume);
   1.135 +	if(errorCode)
   1.136 +		{
   1.137 +		INFO_PRINTF2(_L("SetVolume() during Playing State is failed with  %d "), errorCode);
   1.138 +		iController.Stop();
   1.139 +		return EFail;
   1.140 +		}
   1.141 +	errorCode =theCommander.GetVolume(theNewVolume);
   1.142 +	if(errorCode)
   1.143 +		{
   1.144 +		INFO_PRINTF2(_L("GetVolume() during Playing State is failed with  %d "), errorCode);
   1.145 +		iController.Stop();
   1.146 +		return EFail;
   1.147 +		}
   1.148 +	if(theNewVolume != theVolume)
   1.149 +		{
   1.150 +        //stop the controller
   1.151 +        INFO_PRINTF1(_L("Set and Get Volumes are different during Playing State"));
   1.152 +        iController.Stop();
   1.153 +        return EFail;
   1.154 +		}
   1.155 +	//get the play completion event
   1.156 +	CActiveScheduler::Start();
   1.157 +	return iTestStepResult;
   1.158 +	}
   1.159 +
   1.160 +/**
   1.161 + *
   1.162 + * Test step constructor.
   1.163 + * It initialises its own name and the input filename
   1.164 + *
   1.165 + */
   1.166 +RTestStepOggCtrlPlayBalance::RTestStepOggCtrlPlayBalance(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.167 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.168 +	{
   1.169 +	}
   1.170 +
   1.171 +/**
   1.172 + * Do the test step.
   1.173 + * This tests setting the PlayBalance on OggPlayController in Stopped, Primed and Playing 
   1.174 + * states and checks if the PlayBalance set is same as the PlayBalance got.
   1.175 + */
   1.176 +TVerdict RTestStepOggCtrlPlayBalance::DoTestStepL( void )
   1.177 +	{
   1.178 +	INFO_PRINTF1(_L("this step tests SetBalance/GetBalance() APIs of OggPlayController "));
   1.179 +	RMMFAudioPlayDeviceCustomCommands theCommander( iController );
   1.180 +	TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
   1.181 +	TInt errorCode = theCommander.SetBalance( theBalance );
   1.182 +	if(errorCode)
   1.183 +		{
   1.184 +		INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with  %d "), errorCode);
   1.185 +		return EFail;
   1.186 +		}
   1.187 +	TInt theNewBalance (0);
   1.188 +	errorCode =theCommander.GetBalance( theNewBalance );
   1.189 +	if(errorCode)
   1.190 +		{
   1.191 +		INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with  %d "), errorCode);
   1.192 +		return EFail;
   1.193 +		}
   1.194 +	if( theNewBalance != theBalance )
   1.195 +		{
   1.196 +        INFO_PRINTF1(_L("Set and Get Balances are different during Stopped State"));
   1.197 +        return EFail;
   1.198 +		}
   1.199 +	errorCode = iController.Prime();
   1.200 +	if(errorCode)
   1.201 +		{
   1.202 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.203 +		return EInconclusive;
   1.204 +		}
   1.205 +	errorCode = theCommander.SetBalance( theBalance );
   1.206 +	if(errorCode)
   1.207 +		{
   1.208 +		INFO_PRINTF2(_L("SetBalance() during Primed State is failed with  %d "), errorCode);
   1.209 +		return EFail;
   1.210 +		}
   1.211 +	errorCode =theCommander.GetBalance( theNewBalance );
   1.212 +	if(errorCode)
   1.213 +		{
   1.214 +		INFO_PRINTF2(_L("GetBalance() during Primed State is failed with  %d "), errorCode);
   1.215 +		return EFail;
   1.216 +		}
   1.217 +	if( theNewBalance != theBalance )
   1.218 +		{
   1.219 +        INFO_PRINTF1(_L("Set and Get Balances are different during Primed State"));
   1.220 +        return EFail;
   1.221 +		}
   1.222 +	errorCode = iController.Play();
   1.223 +	if(errorCode)
   1.224 +		{
   1.225 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
   1.226 +		return EInconclusive;
   1.227 +		}
   1.228 +	errorCode =theCommander.SetBalance(theBalance);
   1.229 +	if(errorCode)
   1.230 +		{
   1.231 +		INFO_PRINTF2(_L("SetBalance() during Playing State is failed with  %d "), errorCode);
   1.232 +		iController.Stop();
   1.233 +		return EFail;
   1.234 +		}
   1.235 +	errorCode =theCommander.GetBalance(theNewBalance);
   1.236 +	if(errorCode)
   1.237 +		{
   1.238 +		INFO_PRINTF2(_L("GetBalance() during Playing State is failed with  %d "), errorCode);
   1.239 +		iController.Stop();
   1.240 +		return EFail;
   1.241 +		}
   1.242 +	if(theNewBalance != theBalance)
   1.243 +		{
   1.244 +        //stop the controller
   1.245 +        INFO_PRINTF1(_L("Set and Get Balances are different during Playing State"));
   1.246 +        iController.Stop();
   1.247 +        return EFail;
   1.248 +		}
   1.249 +	//get the play completion event
   1.250 +	CActiveScheduler::Start();
   1.251 +	return iTestStepResult;
   1.252 +	}
   1.253 +
   1.254 +/**
   1.255 + *
   1.256 + * Test step constructor.
   1.257 + * It initialises its own name and the input filename
   1.258 + *
   1.259 + */
   1.260 +RTestStepOggCtrlPosition::RTestStepOggCtrlPosition(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.261 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.262 +	{
   1.263 +	}
   1.264 +
   1.265 +/**
   1.266 + * Do the test step.
   1.267 + * This tests setting the Position on OggPlayController in Stopped, Primed and Playing 
   1.268 + * states and checks if the Position set is same as the Position got. It expects KErrNotReady
   1.269 + * error during Stopped state.
   1.270 + */
   1.271 +TVerdict RTestStepOggCtrlPosition::DoTestStepL(void)
   1.272 +	{
   1.273 +	INFO_PRINTF1(_L("this step tests SetPosition/GetPosition() APIs of OggPlayController "));
   1.274 +	TTimeIntervalMicroSeconds theDuration;
   1.275 +	TInt errorCode = iController.GetDuration(theDuration);
   1.276 +	if(errorCode)
   1.277 +		{
   1.278 +		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
   1.279 +		return EInconclusive;
   1.280 +		}
   1.281 +	TInt64 duration = theDuration. Int64();
   1.282 +	TTimeIntervalMicroSeconds thePosition(duration/2);
   1.283 +	errorCode = iController.SetPosition(thePosition);
   1.284 +	if(errorCode != KErrNotReady)
   1.285 +		{
   1.286 +		INFO_PRINTF2(_L("SetPosition() during Stopped State is failed to return KErrNotReady but returned  %d "), errorCode);
   1.287 +		return EFail;
   1.288 +		}
   1.289 +	errorCode = iController.Prime();
   1.290 +	if(errorCode)
   1.291 +		{
   1.292 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.293 +		return EInconclusive;
   1.294 +		}
   1.295 +	errorCode = iController.SetPosition(thePosition);
   1.296 +	if(errorCode)
   1.297 +		{
   1.298 +		INFO_PRINTF2(_L("SetPosition() during Primed State is failed with  %d "), errorCode);
   1.299 +		return EFail;
   1.300 +		}
   1.301 +	TTimeIntervalMicroSeconds theNewPosition;
   1.302 +	errorCode = iController.GetPosition(theNewPosition);
   1.303 +	if(errorCode)
   1.304 +		{
   1.305 +		INFO_PRINTF2(_L("GetPosition() during Primed State is failed with  %d "), errorCode);
   1.306 +		return EFail;
   1.307 +		}
   1.308 +	/* There is a limitation in the repositioning in the vorbis stream. The position passed by the 
   1.309 +	client is converted into granulePos that is nearer to the positon passed. So when GetPosition is called
   1.310 +	we may not get the exact position we have set using the setposition(). This is because granulePos 
   1.311 +	is same all through an oggPage and an oggPage will be of average size 6k. So the positioning is not that 
   1.312 +	precise. So the KDeviationInTime. 
   1.313 +	*/
   1.314 +	if(!TimeComparison(theNewPosition.Int64(), thePosition.Int64(), KDeviationInTime))
   1.315 +		{
   1.316 +		INFO_PRINTF1(_L("Set and Get Positions are different during Primed State"));
   1.317 +		return EFail;
   1.318 +		}
   1.319 +	//Reset back to the beginning before play
   1.320 +	iController.SetPosition(TTimeIntervalMicroSeconds(0));
   1.321 +	errorCode = iController.Play();
   1.322 +	if(errorCode)
   1.323 +		{
   1.324 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
   1.325 +		return EInconclusive;
   1.326 +		}
   1.327 +	User::After(KTwoSeconds);
   1.328 +	errorCode = iController.SetPosition(thePosition);
   1.329 +	if(errorCode)
   1.330 +		{
   1.331 +		INFO_PRINTF2(_L("SetPosition() during Playing State is failed with  %d "), errorCode);
   1.332 +		return EFail;
   1.333 +		}
   1.334 +	errorCode = iController.GetPosition(theNewPosition);
   1.335 +	if(errorCode)
   1.336 +		{
   1.337 +		INFO_PRINTF2(_L("GetPosition() during Playing State is failed with  %d "), errorCode);
   1.338 +		return EFail;
   1.339 +		}
   1.340 +	if(!TimeComparison(theNewPosition.Int64(), thePosition.Int64(), KDeviationInTime))
   1.341 +		{
   1.342 +        //stop the controller
   1.343 +        INFO_PRINTF1(_L("Current Position is lessthan the Postion Set in Playing State"));
   1.344 +        iController.Stop();
   1.345 +        return EFail;
   1.346 +		}
   1.347 +	//get the play completion event
   1.348 +	CActiveScheduler::Start();
   1.349 +	return iTestStepResult;
   1.350 +	}
   1.351 +
   1.352 +/**
   1.353 + *
   1.354 + * Test step constructor.
   1.355 + * It initialises its own name and the input filename
   1.356 + *
   1.357 + */
   1.358 +RTestStepOggCtrlDuration::RTestStepOggCtrlDuration(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.359 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.360 +	{
   1.361 +	}
   1.362 +
   1.363 +/**
   1.364 + * Do the test step.
   1.365 + * This tests setting the Position on OggPlayController in Stopped, Primed and Playing 
   1.366 + * states and checks if the Position set is same as the Postion got. It expects KErrNotReady
   1.367 + * error during Stopped state.
   1.368 + */
   1.369 +TVerdict RTestStepOggCtrlDuration::DoTestStepL(void)
   1.370 +	{
   1.371 +	INFO_PRINTF1(_L("this step tests GetDuration() API of OggPlayController "));
   1.372 +	TTimeIntervalMicroSeconds expectedtheDuration(6002426);
   1.373 +	TTimeIntervalMicroSeconds theDuration;
   1.374 +	TInt errorCode = iController.GetDuration(theDuration);
   1.375 +	if(errorCode)
   1.376 +		{
   1.377 +		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
   1.378 +		return EFail;
   1.379 +		}
   1.380 +	else if(theDuration != expectedtheDuration)
   1.381 +		{
   1.382 +		INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
   1.383 +		return EFail;
   1.384 +		}
   1.385 +	errorCode = iController.Prime();
   1.386 +	if(errorCode)
   1.387 +		{
   1.388 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.389 +		return EInconclusive;
   1.390 +		}
   1.391 +	errorCode = iController.GetDuration(theDuration);
   1.392 +	if(errorCode)
   1.393 +		{
   1.394 +		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
   1.395 +		return EFail;
   1.396 +		}
   1.397 +	else if(theDuration != expectedtheDuration)
   1.398 +		{
   1.399 +		INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
   1.400 +		return EFail;
   1.401 +		}
   1.402 +	errorCode = iController.Play();
   1.403 +	if(errorCode)
   1.404 +		{
   1.405 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
   1.406 +		return EInconclusive;
   1.407 +		}
   1.408 +	errorCode = iController.GetDuration(theDuration);
   1.409 +	if(errorCode)
   1.410 +		{
   1.411 +		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
   1.412 +		iController.Stop();
   1.413 +		return EFail;
   1.414 +		}
   1.415 +	else if(theDuration != expectedtheDuration)
   1.416 +		{
   1.417 +		INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
   1.418 +		iController.Stop();
   1.419 +		return EFail;
   1.420 +		}
   1.421 +	return EPass;
   1.422 +	}
   1.423 +/**
   1.424 + *
   1.425 + * Test step constructor.
   1.426 + * It initialises its own name and the input filename
   1.427 + *
   1.428 + */
   1.429 +RTestStepOggCtrlPause::RTestStepOggCtrlPause(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.430 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.431 +	{
   1.432 +	}
   1.433 +
   1.434 +/**
   1.435 + * Do the test step.
   1.436 + * This tests the Pause functionality of the OggPlayController in Stopped, Primed and Playing 
   1.437 + * states and checks if the Play starts from the current position. It expects KErrNotReady
   1.438 + * error if Pause is called during Stopped and Primed states.
   1.439 + * 
   1.440 + * This test may fail as the position after pause-play may vary due to granularity and recalculation of the buffer.
   1.441 + */
   1.442 +TVerdict RTestStepOggCtrlPause::DoTestStepL(void)
   1.443 +	{
   1.444 +	INFO_PRINTF1(_L("this step tests Pause() API of OggPlayController "));
   1.445 +	TInt errorCode = iController.Pause();
   1.446 +	if(errorCode != KErrNotReady)
   1.447 +		{
   1.448 +		INFO_PRINTF2(_L("Pause() during Stopped State is failed to return KErrNotReady but returned %d "), errorCode);
   1.449 +		return EFail;
   1.450 +		}
   1.451 +	errorCode = iController.Prime();
   1.452 +	if(errorCode)
   1.453 +		{
   1.454 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.455 +		return EInconclusive;
   1.456 +		}
   1.457 +	errorCode = iController.Pause();
   1.458 +	if(errorCode != KErrNotReady)
   1.459 +		{
   1.460 +		INFO_PRINTF2(_L("Pause() during Primed State is failed to return KErrNotReady but returned %d "), errorCode);
   1.461 +		return EFail;
   1.462 +		}
   1.463 +	INFO_PRINTF1(_L("Play"));
   1.464 +	errorCode = iController.Play();
   1.465 +	if(errorCode)
   1.466 +		{
   1.467 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
   1.468 +		return EInconclusive;
   1.469 +		}
   1.470 +	INFO_PRINTF1(_L("Pause"));
   1.471 +	errorCode = iController.Pause();
   1.472 +	if(errorCode)
   1.473 +		{
   1.474 +		INFO_PRINTF2(_L("Pause() during Playing State is failed with  %d "), errorCode);
   1.475 +		return EFail;
   1.476 +		}
   1.477 +	INFO_PRINTF1(_L("GetPosition - thePosition"));
   1.478 +	TTimeIntervalMicroSeconds thePosition;
   1.479 +	errorCode = iController.GetPosition(thePosition);
   1.480 +	if(errorCode)
   1.481 +		{
   1.482 +		INFO_PRINTF2(_L("GetPosition() after Pause is failed with  %d "), errorCode);
   1.483 +		return EFail;
   1.484 +		}
   1.485 +	INFO_PRINTF1(_L("Play"));
   1.486 +	errorCode = iController.Play();
   1.487 +	if(errorCode)
   1.488 +		{
   1.489 +		INFO_PRINTF2(_L("Play() after Pause() is failed with  %d "), errorCode);
   1.490 +		return EInconclusive;
   1.491 +		}
   1.492 +	INFO_PRINTF1(_L("GetPosition - theNewPosition"));
   1.493 +	TTimeIntervalMicroSeconds theNewPosition;
   1.494 +	errorCode = iController.GetPosition(theNewPosition);
   1.495 +    INFO_PRINTF2(_L("  Paused: %d"), I64INT(thePosition.Int64()));
   1.496 +    INFO_PRINTF2(_L("  Current: %d"), I64INT(theNewPosition.Int64()));
   1.497 +
   1.498 +	if(theNewPosition < thePosition)
   1.499 +		{
   1.500 +        //stop the controller
   1.501 +        INFO_PRINTF1(_L("Current Position is lessthan the Paused Postion"));
   1.502 +        ERR_PRINTF2(_L("  Paused: %d"), I64INT(thePosition.Int64()));
   1.503 +        ERR_PRINTF2(_L("  Current: %d"), I64INT(theNewPosition.Int64()));
   1.504 +        iController.Stop();
   1.505 +        return EFail;
   1.506 +		}
   1.507 +	//get the play completion event
   1.508 +	CActiveScheduler::Start();
   1.509 +	return iTestStepResult;
   1.510 +	}
   1.511 +/**
   1.512 + *
   1.513 + * Test step constructor.
   1.514 + * It initialises its own name and the input filename
   1.515 + *
   1.516 + */
   1.517 +RTestStepOggCtrlStop::RTestStepOggCtrlStop(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.518 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.519 +	{
   1.520 +	}
   1.521 +
   1.522 +/**
   1.523 + * Do the test step.
   1.524 + * This tests the Stop functionality of the OggPlayController in Stopped, Primed and Playing 
   1.525 + * states It expects KErrNotReady error if Stop is called during Stopped state.
   1.526 + */
   1.527 +TVerdict RTestStepOggCtrlStop::DoTestStepL(void)
   1.528 +	{
   1.529 +	INFO_PRINTF1(_L("this step tests Stop() API of OggPlayController "));
   1.530 +	TInt errorCode = iController.Stop();
   1.531 +	if(errorCode)
   1.532 +		{
   1.533 +		INFO_PRINTF2(_L("Stop() during Stopped State is failed with %d "), errorCode);
   1.534 +		return EFail;
   1.535 +		}
   1.536 +	errorCode = iController.Prime();
   1.537 +	if(errorCode)
   1.538 +		{
   1.539 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.540 +		return EInconclusive;
   1.541 +		}
   1.542 +	errorCode = iController.Stop();
   1.543 +	if(errorCode)
   1.544 +		{
   1.545 +		INFO_PRINTF2(_L("Stop() during Primed State is failed with %d "), errorCode);
   1.546 +		return EFail;
   1.547 +		}
   1.548 +	errorCode = iController.Prime();
   1.549 +	if(errorCode)
   1.550 +		{
   1.551 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.552 +		return EInconclusive;
   1.553 +		}
   1.554 +	errorCode = iController.Play();
   1.555 +	if(errorCode)
   1.556 +		{
   1.557 +		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
   1.558 +		return EInconclusive;
   1.559 +		}
   1.560 +	User::After(KTwoSeconds);
   1.561 +	errorCode = iController.Stop();
   1.562 +	if(errorCode)
   1.563 +		{
   1.564 +		INFO_PRINTF2(_L("Stop() during Playing State is failed with  %d "), errorCode);
   1.565 +		return EFail;
   1.566 +		}
   1.567 +	errorCode = iController.Prime();
   1.568 +	if(errorCode)
   1.569 +		{
   1.570 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.571 +		return EInconclusive;
   1.572 +		}
   1.573 +	errorCode = iController.Play();
   1.574 +	if(errorCode)
   1.575 +		{
   1.576 +		INFO_PRINTF2(_L("Play() after Stop() is failed with  %d "), errorCode);
   1.577 +		return EInconclusive;
   1.578 +		}
   1.579 +	//get the play completion event
   1.580 +	CActiveScheduler::Start();
   1.581 +	return iTestStepResult;
   1.582 +	}
   1.583 +/**
   1.584 + *
   1.585 + * Test step constructor.
   1.586 + * It initialises its own name and the input filename
   1.587 + *
   1.588 + */
   1.589 +RTestStepOggCtrlMetaData::RTestStepOggCtrlMetaData(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.590 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.591 +	{
   1.592 +	}
   1.593 +
   1.594 +/**
   1.595 + * Do the test step.
   1.596 + * This test tries to fetch the metadata from the Ogg file.
   1.597 + * 
   1.598 + */
   1.599 +TVerdict RTestStepOggCtrlMetaData::DoTestStepL(void)
   1.600 +	{
   1.601 +	INFO_PRINTF1(_L("this step tests GetNumberOfMetaDataEntries/GetMetaDataEntryL() APIs of OggPlayController "));
   1.602 +	TInt numEntries = 0;
   1.603 +	TInt errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
   1.604 +	CMMFMetaDataEntry* metaEntry = NULL;
   1.605 +	if(errorCode)
   1.606 +		{
   1.607 +		INFO_PRINTF2(_L("GetNumberOfMetaDataEntries() is failed with  %d "), errorCode);
   1.608 +		return EFail;
   1.609 +	 	}
   1.610 +	if(numEntries == 0)
   1.611 +		{
   1.612 +		INFO_PRINTF1(_L("File does not have meta entries "));
   1.613 +		}
   1.614 +	else
   1.615 +		{
   1.616 +		for(TInt counter = 0; counter < numEntries; ++counter)
   1.617 +        	{
   1.618 +        	TRAP(errorCode, metaEntry =  iController.GetMetaDataEntryL(counter));
   1.619 +        	if(errorCode)
   1.620 +        		{
   1.621 +        		INFO_PRINTF2(_L("GetMetaDataEntryL is failed with  %d "), errorCode);
   1.622 +        		return EFail;
   1.623 +        		}
   1.624 +        	INFO_PRINTF3(_L("%S    %S"), &metaEntry->Name(), &metaEntry->Value());
   1.625 +        	}
   1.626 +		}
   1.627 +	return EPass;
   1.628 +	}
   1.629 +/**
   1.630 + *
   1.631 + * Test step constructor.
   1.632 + * It initialises its own name and the input filename
   1.633 + *
   1.634 + */
   1.635 +RTestStepOggCtrlPlayWindow::RTestStepOggCtrlPlayWindow(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.636 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.637 +	{
   1.638 +	}
   1.639 +
   1.640 +/**
   1.641 + * Do the test step.
   1.642 + * This tests the PlayWindow functionality of the OggPlayController.
   1.643 + * Sequence : Prime -> SetPlayWindow -> Play(check if the current position > PlayStart)
   1.644 + *            Stop  -> Prime -> Play(check if the current position > PlayStart)
   1.645 + *			  Stop  -> Prime -> DeletePlayWindow -> Play(check if the current position <= PlayStart)
   1.646 + */
   1.647 +TVerdict RTestStepOggCtrlPlayWindow::DoTestStepL(void)
   1.648 +	{
   1.649 +	INFO_PRINTF1(_L("this step tests SetPlaybackWindow/DeletePlaybackWindow() API of OggPlayController "));
   1.650 +	TInt errorCode = iController.Prime();
   1.651 +	if(errorCode)
   1.652 +		{
   1.653 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
   1.654 +		return EInconclusive;
   1.655 +		}
   1.656 +	TTimeIntervalMicroSeconds theDuration;
   1.657 +	errorCode = iController.GetDuration(theDuration);
   1.658 +	if(errorCode)
   1.659 +		{
   1.660 +		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
   1.661 +		return EInconclusive;
   1.662 +		}
   1.663 +	TInt64 duration = theDuration. Int64();
   1.664 +	TTimeIntervalMicroSeconds thePlayStart(duration/2);
   1.665 +	TTimeIntervalMicroSeconds thePlayEnd(duration);
   1.666 +	RMMFAudioPlayControllerCustomCommands theCommander(iController);
   1.667 +	errorCode = theCommander.SetPlaybackWindow(thePlayStart, thePlayEnd);
   1.668 +	if(errorCode)
   1.669 +		{
   1.670 +		INFO_PRINTF2(_L("SetPlaybackWindow() is failed with  %d "), errorCode);
   1.671 +		return EFail;
   1.672 +		}
   1.673 +	errorCode = iController.Play();
   1.674 +	if(errorCode)
   1.675 +		{
   1.676 +		INFO_PRINTF2(_L("Play() after SetPlayWindow() is failed with  %d "), errorCode);
   1.677 +		return EInconclusive;
   1.678 +		}
   1.679 +	TTimeIntervalMicroSeconds theNewPosition;
   1.680 +	errorCode = iController.GetPosition(theNewPosition);
   1.681 +	if(!TimeComparison(theNewPosition.Int64(), thePlayStart.Int64(), KDeviationInTime))
   1.682 +		{
   1.683 +        //stop the controller
   1.684 +        INFO_PRINTF1(_L("Current Position is lessthan the PlayWindowStart"));
   1.685 +        iController.Stop();
   1.686 +        return EFail;
   1.687 +		}
   1.688 +	User::After(KTwoSeconds);
   1.689 +	errorCode = iController.Stop();
   1.690 +	if(errorCode)
   1.691 +		{
   1.692 +		INFO_PRINTF2(_L("Stop() with PlayWindow set is failed with %d "), errorCode);
   1.693 +		return EFail;
   1.694 +		}
   1.695 +	errorCode = iController.Prime();
   1.696 +	if(errorCode)
   1.697 +		{
   1.698 +		INFO_PRINTF2(_L("Prime with PlayWindow set is failed with  %d "), errorCode);
   1.699 +		return EInconclusive;
   1.700 +		}
   1.701 +	errorCode = iController.Play();
   1.702 +	if(errorCode)
   1.703 +		{
   1.704 +		INFO_PRINTF2(_L("Play() with PlayWindow is failed with  %d "), errorCode);
   1.705 +		return EInconclusive;
   1.706 +		}
   1.707 +	errorCode = iController.GetPosition(theNewPosition);
   1.708 +	if(!TimeComparison(theNewPosition.Int64(), thePlayStart.Int64(), KDeviationInTime))
   1.709 +		{
   1.710 +        //stop the controller
   1.711 +        INFO_PRINTF1(_L("Current Position is lessthan the PlayWindowStart(Second Play)"));
   1.712 +        iController.Stop();
   1.713 +        return EFail;
   1.714 +		}
   1.715 +	User::After(KTwoSeconds);
   1.716 +	errorCode = iController.Stop();
   1.717 +	if(errorCode)
   1.718 +		{
   1.719 +		INFO_PRINTF2(_L("Stop() with PlayWindow set is failed with  %d "), errorCode);
   1.720 +		return EFail;
   1.721 +		}
   1.722 +	errorCode = iController.Prime();
   1.723 +	if(errorCode)
   1.724 +		{
   1.725 +		INFO_PRINTF2(_L("Prime with PlayWindow set is failed with  %d "), errorCode);
   1.726 +		return EFail;
   1.727 +		}
   1.728 +	errorCode = theCommander.DeletePlaybackWindow();
   1.729 +	if(errorCode)
   1.730 +		{
   1.731 +		INFO_PRINTF2(_L("DeletePlaybackWindow() is failed with  %d "), errorCode);
   1.732 +		return EFail;
   1.733 +		}
   1.734 +	errorCode = iController.Play();
   1.735 +	if(errorCode)
   1.736 +		{
   1.737 +		INFO_PRINTF2(_L("Play() after DeletePlaybackWindow is failed with  %d "), errorCode);
   1.738 +		return EFail;
   1.739 +		}
   1.740 +	errorCode = iController.GetPosition(theNewPosition);
   1.741 +	if(theNewPosition > thePlayStart)
   1.742 +		{
   1.743 +        //stop the controller
   1.744 +        INFO_PRINTF1(_L("PlaybackWindow is not deleted properly"));
   1.745 +        iController.Stop();
   1.746 +        return EFail;
   1.747 +		}
   1.748 +	//get the play completion event
   1.749 +	CActiveScheduler::Start();
   1.750 +	return iTestStepResult;
   1.751 +	}
   1.752 +
   1.753 +/**
   1.754 + *
   1.755 + * Test step constructor.
   1.756 + * It initialises its own name and the input filename
   1.757 + *
   1.758 + */	
   1.759 +RTestStepOggCtrlGetSetConfig::RTestStepOggCtrlGetSetConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.760 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.761 +	{
   1.762 +	}
   1.763 +
   1.764 +/**
   1.765 + * Do the test step.
   1.766 + * This test tries to fetch the audio configuration from the Ogg file
   1.767 + * and compares with the expected configuration.
   1.768 + */
   1.769 +TVerdict RTestStepOggCtrlGetSetConfig::DoTestStepL(void)
   1.770 +	{
   1.771 +	INFO_PRINTF1(_L("this step tests setting and getting audio configuration on OggPlayController "));
   1.772 +	RMMFAudioControllerCustomCommands theCommander( iController );
   1.773 +	TUint theRate = 0;
   1.774 +	const TUint KExpectedBitRate = 128000;
   1.775 +	const TUint KExpectedSampleRate = 44100;
   1.776 +	const TUint KExpectedSourceChannels = 2;
   1.777 +	TInt errorCode = theCommander.GetSourceBitRate(theRate);
   1.778 +	if(errorCode)
   1.779 +		{
   1.780 +		INFO_PRINTF2(_L("GetSourceBitRate() is failed with  %d "), errorCode);
   1.781 +		return EFail;
   1.782 +		}
   1.783 +	else if(theRate != KExpectedBitRate)
   1.784 +		{
   1.785 +		INFO_PRINTF2(_L("GetSourceBitRate() returned the wrong bitrate %d "), theRate);
   1.786 +		return EFail;
   1.787 +		}
   1.788 +	errorCode = theCommander.GetSourceSampleRate(theRate);
   1.789 +	if(errorCode)
   1.790 +		{
   1.791 +		INFO_PRINTF2(_L("GetSourceSampleRate() is failed with  %d "), errorCode);
   1.792 +		return EFail;
   1.793 +		}
   1.794 +	else if(theRate != KExpectedSampleRate)
   1.795 +		{
   1.796 +		INFO_PRINTF2(_L("GetSourceBitRate() returned the wrong samplerate %d "), theRate);
   1.797 +		return EFail;
   1.798 +		}
   1.799 +	errorCode = theCommander.GetSourceNumChannels(theRate);
   1.800 +	if(errorCode)
   1.801 +		{
   1.802 +		INFO_PRINTF2(_L("GetSourceNumChannels() is failed with  %d "), errorCode);
   1.803 +		return EFail;
   1.804 +		}
   1.805 +	else if(theRate != KExpectedSourceChannels)
   1.806 +		{
   1.807 +		INFO_PRINTF2(_L("GetSourceNumChannels() returned the wrong value %d "), theRate);
   1.808 +		return EFail;
   1.809 +		}
   1.810 +	TUid formatUid;
   1.811 +	errorCode = theCommander.GetSourceFormat(formatUid);
   1.812 +	if(errorCode)
   1.813 +		{
   1.814 +		INFO_PRINTF2(_L("GetSourceFormat(() during Stopped State is failed with  %d "), errorCode);
   1.815 +		return EFail;
   1.816 +		}
   1.817 +	if(formatUid != KOggDecodeUid)
   1.818 +		{
   1.819 +		INFO_PRINTF2(_L("GetSourceFormat() returned the wrong value %d "), formatUid.iUid);
   1.820 +		return EFail;
   1.821 +		}
   1.822 +	TFourCC dataType(0);
   1.823 +	errorCode =theCommander.GetSourceDataType(dataType);
   1.824 +	if(errorCode)
   1.825 +		{
   1.826 +		INFO_PRINTF2(_L("GetSourceDataType() during Stopped State is failed with  %d "), errorCode);
   1.827 +		return EFail;
   1.828 +		}
   1.829 +	if( dataType != TFourCC('V', 'O', 'R', 'B') )
   1.830 +		{
   1.831 +        INFO_PRINTF1(_L("GetSourceDataType() returned datatype different from VORB "));
   1.832 +        return EFail;
   1.833 +		}
   1.834 +	/*
   1.835 +	 Setting configurations during playing is not possible because the file has to be played at a configuration  
   1.836 +	 which is same as that of when it was recorded. However, if the client tries to set the configuration which 
   1.837 +	 is same as the configutation of the file, all the SetXXX() custom commands will return KErrNone. We dont check 
   1.838 +	 GetXXX() after SetXXX() here for this reason. 
   1.839 +	 */
   1.840 +	errorCode = theCommander.SetSourceBitRate(KExpectedBitRate);
   1.841 +	if(errorCode)
   1.842 +		{
   1.843 +		INFO_PRINTF2(_L("SetSourceBitRate() is failed with  %d "), errorCode);
   1.844 +		return EFail;
   1.845 +		}
   1.846 +	errorCode = theCommander.SetSourceSampleRate(KExpectedSampleRate);
   1.847 +	if(errorCode)
   1.848 +		{
   1.849 +		INFO_PRINTF2(_L("SetSourceSampleRate() is failed with  %d "), errorCode);
   1.850 +		return EFail;
   1.851 +		}
   1.852 +	errorCode = theCommander.SetSourceNumChannels(KExpectedSourceChannels);
   1.853 +	if(errorCode)
   1.854 +		{
   1.855 +		INFO_PRINTF2(_L("SetSourceNumChannels() is failed with  %d "), errorCode);
   1.856 +		return EFail;
   1.857 +		}
   1.858 +	TFourCC theCodec('V', 'O', 'R', 'B');
   1.859 +	errorCode = theCommander.SetSourceDataType(theCodec);
   1.860 +	if(errorCode)
   1.861 +		{
   1.862 +		INFO_PRINTF2(_L("SetSourceDataType() is failed with  %d "), errorCode);
   1.863 +		return EFail;
   1.864 +		}
   1.865 +	errorCode = theCommander.SetCodec(theCodec, theCodec);
   1.866 +	if(errorCode)
   1.867 +		{
   1.868 +		INFO_PRINTF2(_L("SetCodec() is failed with  %d "), errorCode);
   1.869 +		return EFail;
   1.870 +		}
   1.871 +	errorCode = theCommander.SetSourceFormat(KOggDecodeUid);
   1.872 +	if(errorCode)
   1.873 +		{
   1.874 +		INFO_PRINTF2(_L("SetSourceFormat() is failed with  %d "), errorCode);
   1.875 +		return EFail;
   1.876 +		}
   1.877 +	return EPass;
   1.878 +	}
   1.879 +
   1.880 +//Negative Tests
   1.881 +/**
   1.882 + *
   1.883 + * Test step constructor.
   1.884 + * It initialises its own name and the input filename
   1.885 + *
   1.886 + */
   1.887 +RTestStepOggCtrlPlayInvalid::RTestStepOggCtrlPlayInvalid(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.888 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.889 +	{
   1.890 +	}
   1.891 +
   1.892 +TVerdict RTestStepOggCtrlPlayInvalid::DoTestStepPreambleL(void)
   1.893 +	{
   1.894 +	return EPass;
   1.895 +	}
   1.896 +
   1.897 +/**
   1.898 + * Do the test step(Negative Test).
   1.899 + * This test tries to open an invalid file. Expects KErrCurrupt from OggPlayController
   1.900 + */
   1.901 +TVerdict RTestStepOggCtrlPlayInvalid::DoTestStepL(void)
   1.902 +	{
   1.903 +	INFO_PRINTF1(_L("This test tries to open an invalid file using OggPlayController"));
   1.904 +	iScheduler = new(ELeave)CActiveScheduler;
   1.905 +    CleanupStack::PushL(iScheduler );
   1.906 +	CActiveScheduler::Install(iScheduler );
   1.907 +	CleanupStack::Pop();
   1.908 +	iPriority.iPriority = 11;  // set the priority to some default value
   1.909 +	iPriority.iPref = EMdaPriorityPreferenceQuality;
   1.910 +	iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
   1.911 +	TInt errorCode = iController.Open(KOggPlayControllerUid, iPriority);
   1.912 +	if(errorCode)
   1.913 +		{
   1.914 +		INFO_PRINTF2(_L("Failed to load the controller  %d "), errorCode);
   1.915 +		return EInconclusive;
   1.916 +		}
   1.917 +	iControllerEventMonitor->Start();
   1.918 +	SetupReadFileConfigL();
   1.919 +	errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
   1.920 +	if(errorCode != KErrCorrupt)
   1.921 +		{
   1.922 +		INFO_PRINTF2(_L("AddDataSource failed with  %d "), errorCode);
   1.923 +		return EFail;
   1.924 +		}
   1.925 +	return EPass;
   1.926 +	}
   1.927 +/**
   1.928 + *
   1.929 + * Test step constructor.
   1.930 + * It initialises its own name and the input filename
   1.931 + *
   1.932 + */
   1.933 +RTestStepOggCtrlSetInvalidConfig::RTestStepOggCtrlSetInvalidConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.934 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.935 +	{
   1.936 +	}
   1.937 +
   1.938 +/**
   1.939 + * Do the test step(Negative Test).
   1.940 + * This tests setting the an invalid SourceDataType on OggPlayController 
   1.941 + * checks if the OggPlayController returns KErrNotSupported
   1.942 + */
   1.943 +TVerdict RTestStepOggCtrlSetInvalidConfig::DoTestStepL( void )
   1.944 +	{
   1.945 +	INFO_PRINTF1(_L("This tests setting an invalid SourceDataType on OggPlayController "));
   1.946 +	RMMFAudioControllerCustomCommands theCommander( iController );
   1.947 +	TFourCC theCodec(KMMFFourCCCodeIMAD);
   1.948 +	TInt errorCode = theCommander.SetSourceDataType(theCodec);
   1.949 +	if(errorCode != KErrNotSupported)
   1.950 +		{
   1.951 +		INFO_PRINTF2(_L("SetSourceDataType() with non vorbis failed to return KErrNotSupported but returned %d "), errorCode);
   1.952 +		return EFail;
   1.953 +		}
   1.954 +	TUint newBitRate = 224000;
   1.955 +	TUint newSampleRate = 8000;
   1.956 +	TUint newSourceChannels = 1;
   1.957 +	errorCode = theCommander.SetSourceBitRate(newBitRate);
   1.958 +	if(errorCode != KErrNotSupported)
   1.959 +		{
   1.960 +		INFO_PRINTF2(_L("SetSourceBitRate() returned wrong error  %d "), errorCode);
   1.961 +		return EFail;
   1.962 +		}
   1.963 +	errorCode = theCommander.SetSourceSampleRate(newSampleRate);
   1.964 +	if(errorCode != KErrNotSupported)
   1.965 +		{
   1.966 +		INFO_PRINTF2(_L("SetSourceSampleRate() returned wrong error  %d "), errorCode);
   1.967 +		return EFail;
   1.968 +		}
   1.969 +	errorCode = theCommander.SetSourceNumChannels(newSourceChannels);
   1.970 +	if(errorCode != KErrNotSupported)
   1.971 +		{
   1.972 +		INFO_PRINTF2(_L("SetSourceNumChannels() returned wrong error  %d "), errorCode);
   1.973 +		return EFail;
   1.974 +		}
   1.975 +	errorCode = theCommander.SetSourceFormat(KOggEncodeUid);
   1.976 +	if(errorCode != KErrNotSupported)
   1.977 +		{
   1.978 +		INFO_PRINTF2(_L("SetSourceFormat() returned wrong error  %d "), errorCode);
   1.979 +		return EFail;
   1.980 +		}
   1.981 +	return EPass;
   1.982 +	}
   1.983 +
   1.984 +/**
   1.985 + *
   1.986 + * Test step constructor.
   1.987 + * It initialises its own name and the input filename
   1.988 + *
   1.989 + */
   1.990 +RTestStepOggCtrlPositionNegative::RTestStepOggCtrlPositionNegative(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
   1.991 +	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
   1.992 +	{
   1.993 +	}
   1.994 +
   1.995 +/**
   1.996 + * Do the test step(Negative Test).
   1.997 + * This tests setting the Negative Position on OggPlayController
   1.998 + * checks if the Position set is to 0. 
   1.999 + */
  1.1000 +TVerdict RTestStepOggCtrlPositionNegative::DoTestStepL(void)
  1.1001 +	{
  1.1002 +	INFO_PRINTF1(_L("This tests setting the Negative Position on OggPlayController"));
  1.1003 +	TInt errorCode = iController.Prime();
  1.1004 +	if(errorCode)
  1.1005 +		{
  1.1006 +		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
  1.1007 +		return EInconclusive;
  1.1008 +		}
  1.1009 +	errorCode = iController.SetPosition(-1);
  1.1010 +	if(errorCode)
  1.1011 +		{
  1.1012 +		INFO_PRINTF2(_L("SetPosition() during Primed State is failed with  %d "), errorCode);
  1.1013 +		return EFail;
  1.1014 +		}
  1.1015 +	TTimeIntervalMicroSeconds theNewPosition;
  1.1016 +	errorCode = iController.GetPosition(theNewPosition);
  1.1017 +	if(errorCode)
  1.1018 +		{
  1.1019 +		INFO_PRINTF2(_L("GetPosition() during Primed State is failed with  %d "), errorCode);
  1.1020 +		return EFail;
  1.1021 +		}
  1.1022 +	
  1.1023 +	if(theNewPosition != 0)
  1.1024 +		{
  1.1025 +		INFO_PRINTF1(_L("Get Position is failed to return 0 when the position is set to a negative value"));
  1.1026 +		return EFail;
  1.1027 +		}
  1.1028 +	return EPass;
  1.1029 +	}