os/mm/mmlibs/mmfw/tsrc/mmfunittest/oggctrl/teststepoggctrlplay.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "teststepoggctrlplay.h"
sl@0
    17
sl@0
    18
/**
sl@0
    19
 *
sl@0
    20
 * Test step constructor.
sl@0
    21
 * It initialises its own name and the input filename
sl@0
    22
 *
sl@0
    23
 */
sl@0
    24
RTestStepOggCtrlPlay::RTestStepOggCtrlPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
    25
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
    26
	{
sl@0
    27
	}
sl@0
    28
/**
sl@0
    29
 * Do the test step.
sl@0
    30
 * This test Primes the OggPlayController and Plays an Ogg file to its completion
sl@0
    31
 * and checks for the proper play completion
sl@0
    32
 */
sl@0
    33
TVerdict RTestStepOggCtrlPlay::DoTestStepL( void )
sl@0
    34
	{
sl@0
    35
	INFO_PRINTF1(_L("this step plays an Ogg file "));
sl@0
    36
	TInt errorCode = iController.Prime();
sl@0
    37
	if(errorCode)
sl@0
    38
		{
sl@0
    39
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
    40
		return EFail;
sl@0
    41
		}
sl@0
    42
	errorCode = iController.Play();
sl@0
    43
	if(errorCode)
sl@0
    44
		{
sl@0
    45
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
    46
		return EFail;
sl@0
    47
		}
sl@0
    48
	CActiveScheduler::Start();
sl@0
    49
	return iTestStepResult;
sl@0
    50
	}
sl@0
    51
sl@0
    52
/**
sl@0
    53
 *
sl@0
    54
 * Test step constructor.
sl@0
    55
 * It initialises its own name and the input filename
sl@0
    56
 *
sl@0
    57
 */
sl@0
    58
RTestStepOggCtrlVolume::RTestStepOggCtrlVolume(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
    59
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
    60
	{
sl@0
    61
	}
sl@0
    62
sl@0
    63
/**
sl@0
    64
 * Do the test step.
sl@0
    65
 * This tests setting the volume on OggPlayController in Stopped, Primed and Playing 
sl@0
    66
 * states and checks if the volume set is same as the volume got.
sl@0
    67
 */
sl@0
    68
TVerdict RTestStepOggCtrlVolume::DoTestStepL( void )
sl@0
    69
	{
sl@0
    70
	INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of OggPlayController "));
sl@0
    71
	RMMFAudioPlayDeviceCustomCommands theCommander( iController );
sl@0
    72
	TInt maxVolume(0);
sl@0
    73
	TInt errorCode =theCommander.GetMaxVolume( maxVolume );
sl@0
    74
	if(errorCode)
sl@0
    75
		{
sl@0
    76
		INFO_PRINTF2(_L("GetMaxVolume() is failed with  %d "), errorCode);
sl@0
    77
		return EInconclusive;
sl@0
    78
		}
sl@0
    79
	
sl@0
    80
	TInt theVolume = maxVolume /2;
sl@0
    81
	//try setting volume in Stopped State
sl@0
    82
	errorCode =theCommander.SetVolume(theVolume);
sl@0
    83
	if(errorCode)
sl@0
    84
		{
sl@0
    85
		INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with  %d "), errorCode);
sl@0
    86
		return EFail;
sl@0
    87
		}
sl@0
    88
	TInt theNewVolume (0);
sl@0
    89
	errorCode =theCommander.GetVolume(theNewVolume);
sl@0
    90
	if(errorCode)
sl@0
    91
		{
sl@0
    92
		INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with  %d "), errorCode);
sl@0
    93
		return EFail;
sl@0
    94
		}
sl@0
    95
	if( theNewVolume != theVolume )
sl@0
    96
		{
sl@0
    97
        INFO_PRINTF1(_L("Set and Get Volumes are different during Stopped State"));
sl@0
    98
        return EFail;
sl@0
    99
		}
sl@0
   100
	errorCode = iController.Prime();
sl@0
   101
	if(errorCode)
sl@0
   102
		{
sl@0
   103
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   104
		return EInconclusive;
sl@0
   105
		}
sl@0
   106
	//try setting volume in Primed State
sl@0
   107
	errorCode =theCommander.SetVolume(theVolume);
sl@0
   108
	if(errorCode)
sl@0
   109
		{
sl@0
   110
		INFO_PRINTF2(_L("SetVolume() during Primed State is failed with  %d "), errorCode);
sl@0
   111
		return EFail;
sl@0
   112
		}
sl@0
   113
	errorCode =theCommander.GetVolume(theNewVolume);
sl@0
   114
	if(errorCode)
sl@0
   115
		{
sl@0
   116
		INFO_PRINTF2(_L("GetVolume() during Primed State is failed with  %d "), errorCode);
sl@0
   117
		return EFail;
sl@0
   118
		}
sl@0
   119
	if( theNewVolume != theVolume )
sl@0
   120
		{
sl@0
   121
        INFO_PRINTF1(_L("Set and Get Volumes are different during Primed State"));
sl@0
   122
        return EFail;
sl@0
   123
		}
sl@0
   124
	errorCode = iController.Play();
sl@0
   125
	if(errorCode)
sl@0
   126
		{
sl@0
   127
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
   128
		return EInconclusive;
sl@0
   129
		}
sl@0
   130
	//try setting volume in Playing State
sl@0
   131
	errorCode =theCommander.SetVolume(theVolume);
sl@0
   132
	if(errorCode)
sl@0
   133
		{
sl@0
   134
		INFO_PRINTF2(_L("SetVolume() during Playing State is failed with  %d "), errorCode);
sl@0
   135
		iController.Stop();
sl@0
   136
		return EFail;
sl@0
   137
		}
sl@0
   138
	errorCode =theCommander.GetVolume(theNewVolume);
sl@0
   139
	if(errorCode)
sl@0
   140
		{
sl@0
   141
		INFO_PRINTF2(_L("GetVolume() during Playing State is failed with  %d "), errorCode);
sl@0
   142
		iController.Stop();
sl@0
   143
		return EFail;
sl@0
   144
		}
sl@0
   145
	if(theNewVolume != theVolume)
sl@0
   146
		{
sl@0
   147
        //stop the controller
sl@0
   148
        INFO_PRINTF1(_L("Set and Get Volumes are different during Playing State"));
sl@0
   149
        iController.Stop();
sl@0
   150
        return EFail;
sl@0
   151
		}
sl@0
   152
	//get the play completion event
sl@0
   153
	CActiveScheduler::Start();
sl@0
   154
	return iTestStepResult;
sl@0
   155
	}
sl@0
   156
sl@0
   157
/**
sl@0
   158
 *
sl@0
   159
 * Test step constructor.
sl@0
   160
 * It initialises its own name and the input filename
sl@0
   161
 *
sl@0
   162
 */
sl@0
   163
RTestStepOggCtrlPlayBalance::RTestStepOggCtrlPlayBalance(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   164
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   165
	{
sl@0
   166
	}
sl@0
   167
sl@0
   168
/**
sl@0
   169
 * Do the test step.
sl@0
   170
 * This tests setting the PlayBalance on OggPlayController in Stopped, Primed and Playing 
sl@0
   171
 * states and checks if the PlayBalance set is same as the PlayBalance got.
sl@0
   172
 */
sl@0
   173
TVerdict RTestStepOggCtrlPlayBalance::DoTestStepL( void )
sl@0
   174
	{
sl@0
   175
	INFO_PRINTF1(_L("this step tests SetBalance/GetBalance() APIs of OggPlayController "));
sl@0
   176
	RMMFAudioPlayDeviceCustomCommands theCommander( iController );
sl@0
   177
	TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
sl@0
   178
	TInt errorCode = theCommander.SetBalance( theBalance );
sl@0
   179
	if(errorCode)
sl@0
   180
		{
sl@0
   181
		INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with  %d "), errorCode);
sl@0
   182
		return EFail;
sl@0
   183
		}
sl@0
   184
	TInt theNewBalance (0);
sl@0
   185
	errorCode =theCommander.GetBalance( theNewBalance );
sl@0
   186
	if(errorCode)
sl@0
   187
		{
sl@0
   188
		INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with  %d "), errorCode);
sl@0
   189
		return EFail;
sl@0
   190
		}
sl@0
   191
	if( theNewBalance != theBalance )
sl@0
   192
		{
sl@0
   193
        INFO_PRINTF1(_L("Set and Get Balances are different during Stopped State"));
sl@0
   194
        return EFail;
sl@0
   195
		}
sl@0
   196
	errorCode = iController.Prime();
sl@0
   197
	if(errorCode)
sl@0
   198
		{
sl@0
   199
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   200
		return EInconclusive;
sl@0
   201
		}
sl@0
   202
	errorCode = theCommander.SetBalance( theBalance );
sl@0
   203
	if(errorCode)
sl@0
   204
		{
sl@0
   205
		INFO_PRINTF2(_L("SetBalance() during Primed State is failed with  %d "), errorCode);
sl@0
   206
		return EFail;
sl@0
   207
		}
sl@0
   208
	errorCode =theCommander.GetBalance( theNewBalance );
sl@0
   209
	if(errorCode)
sl@0
   210
		{
sl@0
   211
		INFO_PRINTF2(_L("GetBalance() during Primed State is failed with  %d "), errorCode);
sl@0
   212
		return EFail;
sl@0
   213
		}
sl@0
   214
	if( theNewBalance != theBalance )
sl@0
   215
		{
sl@0
   216
        INFO_PRINTF1(_L("Set and Get Balances are different during Primed State"));
sl@0
   217
        return EFail;
sl@0
   218
		}
sl@0
   219
	errorCode = iController.Play();
sl@0
   220
	if(errorCode)
sl@0
   221
		{
sl@0
   222
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
   223
		return EInconclusive;
sl@0
   224
		}
sl@0
   225
	errorCode =theCommander.SetBalance(theBalance);
sl@0
   226
	if(errorCode)
sl@0
   227
		{
sl@0
   228
		INFO_PRINTF2(_L("SetBalance() during Playing State is failed with  %d "), errorCode);
sl@0
   229
		iController.Stop();
sl@0
   230
		return EFail;
sl@0
   231
		}
sl@0
   232
	errorCode =theCommander.GetBalance(theNewBalance);
sl@0
   233
	if(errorCode)
sl@0
   234
		{
sl@0
   235
		INFO_PRINTF2(_L("GetBalance() during Playing State is failed with  %d "), errorCode);
sl@0
   236
		iController.Stop();
sl@0
   237
		return EFail;
sl@0
   238
		}
sl@0
   239
	if(theNewBalance != theBalance)
sl@0
   240
		{
sl@0
   241
        //stop the controller
sl@0
   242
        INFO_PRINTF1(_L("Set and Get Balances are different during Playing State"));
sl@0
   243
        iController.Stop();
sl@0
   244
        return EFail;
sl@0
   245
		}
sl@0
   246
	//get the play completion event
sl@0
   247
	CActiveScheduler::Start();
sl@0
   248
	return iTestStepResult;
sl@0
   249
	}
sl@0
   250
sl@0
   251
/**
sl@0
   252
 *
sl@0
   253
 * Test step constructor.
sl@0
   254
 * It initialises its own name and the input filename
sl@0
   255
 *
sl@0
   256
 */
sl@0
   257
RTestStepOggCtrlPosition::RTestStepOggCtrlPosition(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   258
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   259
	{
sl@0
   260
	}
sl@0
   261
sl@0
   262
/**
sl@0
   263
 * Do the test step.
sl@0
   264
 * This tests setting the Position on OggPlayController in Stopped, Primed and Playing 
sl@0
   265
 * states and checks if the Position set is same as the Position got. It expects KErrNotReady
sl@0
   266
 * error during Stopped state.
sl@0
   267
 */
sl@0
   268
TVerdict RTestStepOggCtrlPosition::DoTestStepL(void)
sl@0
   269
	{
sl@0
   270
	INFO_PRINTF1(_L("this step tests SetPosition/GetPosition() APIs of OggPlayController "));
sl@0
   271
	TTimeIntervalMicroSeconds theDuration;
sl@0
   272
	TInt errorCode = iController.GetDuration(theDuration);
sl@0
   273
	if(errorCode)
sl@0
   274
		{
sl@0
   275
		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
sl@0
   276
		return EInconclusive;
sl@0
   277
		}
sl@0
   278
	TInt64 duration = theDuration. Int64();
sl@0
   279
	TTimeIntervalMicroSeconds thePosition(duration/2);
sl@0
   280
	errorCode = iController.SetPosition(thePosition);
sl@0
   281
	if(errorCode != KErrNotReady)
sl@0
   282
		{
sl@0
   283
		INFO_PRINTF2(_L("SetPosition() during Stopped State is failed to return KErrNotReady but returned  %d "), errorCode);
sl@0
   284
		return EFail;
sl@0
   285
		}
sl@0
   286
	errorCode = iController.Prime();
sl@0
   287
	if(errorCode)
sl@0
   288
		{
sl@0
   289
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   290
		return EInconclusive;
sl@0
   291
		}
sl@0
   292
	errorCode = iController.SetPosition(thePosition);
sl@0
   293
	if(errorCode)
sl@0
   294
		{
sl@0
   295
		INFO_PRINTF2(_L("SetPosition() during Primed State is failed with  %d "), errorCode);
sl@0
   296
		return EFail;
sl@0
   297
		}
sl@0
   298
	TTimeIntervalMicroSeconds theNewPosition;
sl@0
   299
	errorCode = iController.GetPosition(theNewPosition);
sl@0
   300
	if(errorCode)
sl@0
   301
		{
sl@0
   302
		INFO_PRINTF2(_L("GetPosition() during Primed State is failed with  %d "), errorCode);
sl@0
   303
		return EFail;
sl@0
   304
		}
sl@0
   305
	/* There is a limitation in the repositioning in the vorbis stream. The position passed by the 
sl@0
   306
	client is converted into granulePos that is nearer to the positon passed. So when GetPosition is called
sl@0
   307
	we may not get the exact position we have set using the setposition(). This is because granulePos 
sl@0
   308
	is same all through an oggPage and an oggPage will be of average size 6k. So the positioning is not that 
sl@0
   309
	precise. So the KDeviationInTime. 
sl@0
   310
	*/
sl@0
   311
	if(!TimeComparison(theNewPosition.Int64(), thePosition.Int64(), KDeviationInTime))
sl@0
   312
		{
sl@0
   313
		INFO_PRINTF1(_L("Set and Get Positions are different during Primed State"));
sl@0
   314
		return EFail;
sl@0
   315
		}
sl@0
   316
	//Reset back to the beginning before play
sl@0
   317
	iController.SetPosition(TTimeIntervalMicroSeconds(0));
sl@0
   318
	errorCode = iController.Play();
sl@0
   319
	if(errorCode)
sl@0
   320
		{
sl@0
   321
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
   322
		return EInconclusive;
sl@0
   323
		}
sl@0
   324
	User::After(KTwoSeconds);
sl@0
   325
	errorCode = iController.SetPosition(thePosition);
sl@0
   326
	if(errorCode)
sl@0
   327
		{
sl@0
   328
		INFO_PRINTF2(_L("SetPosition() during Playing State is failed with  %d "), errorCode);
sl@0
   329
		return EFail;
sl@0
   330
		}
sl@0
   331
	errorCode = iController.GetPosition(theNewPosition);
sl@0
   332
	if(errorCode)
sl@0
   333
		{
sl@0
   334
		INFO_PRINTF2(_L("GetPosition() during Playing State is failed with  %d "), errorCode);
sl@0
   335
		return EFail;
sl@0
   336
		}
sl@0
   337
	if(!TimeComparison(theNewPosition.Int64(), thePosition.Int64(), KDeviationInTime))
sl@0
   338
		{
sl@0
   339
        //stop the controller
sl@0
   340
        INFO_PRINTF1(_L("Current Position is lessthan the Postion Set in Playing State"));
sl@0
   341
        iController.Stop();
sl@0
   342
        return EFail;
sl@0
   343
		}
sl@0
   344
	//get the play completion event
sl@0
   345
	CActiveScheduler::Start();
sl@0
   346
	return iTestStepResult;
sl@0
   347
	}
sl@0
   348
sl@0
   349
/**
sl@0
   350
 *
sl@0
   351
 * Test step constructor.
sl@0
   352
 * It initialises its own name and the input filename
sl@0
   353
 *
sl@0
   354
 */
sl@0
   355
RTestStepOggCtrlDuration::RTestStepOggCtrlDuration(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   356
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   357
	{
sl@0
   358
	}
sl@0
   359
sl@0
   360
/**
sl@0
   361
 * Do the test step.
sl@0
   362
 * This tests setting the Position on OggPlayController in Stopped, Primed and Playing 
sl@0
   363
 * states and checks if the Position set is same as the Postion got. It expects KErrNotReady
sl@0
   364
 * error during Stopped state.
sl@0
   365
 */
sl@0
   366
TVerdict RTestStepOggCtrlDuration::DoTestStepL(void)
sl@0
   367
	{
sl@0
   368
	INFO_PRINTF1(_L("this step tests GetDuration() API of OggPlayController "));
sl@0
   369
	TTimeIntervalMicroSeconds expectedtheDuration(6002426);
sl@0
   370
	TTimeIntervalMicroSeconds theDuration;
sl@0
   371
	TInt errorCode = iController.GetDuration(theDuration);
sl@0
   372
	if(errorCode)
sl@0
   373
		{
sl@0
   374
		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
sl@0
   375
		return EFail;
sl@0
   376
		}
sl@0
   377
	else if(theDuration != expectedtheDuration)
sl@0
   378
		{
sl@0
   379
		INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
sl@0
   380
		return EFail;
sl@0
   381
		}
sl@0
   382
	errorCode = iController.Prime();
sl@0
   383
	if(errorCode)
sl@0
   384
		{
sl@0
   385
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   386
		return EInconclusive;
sl@0
   387
		}
sl@0
   388
	errorCode = iController.GetDuration(theDuration);
sl@0
   389
	if(errorCode)
sl@0
   390
		{
sl@0
   391
		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
sl@0
   392
		return EFail;
sl@0
   393
		}
sl@0
   394
	else if(theDuration != expectedtheDuration)
sl@0
   395
		{
sl@0
   396
		INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
sl@0
   397
		return EFail;
sl@0
   398
		}
sl@0
   399
	errorCode = iController.Play();
sl@0
   400
	if(errorCode)
sl@0
   401
		{
sl@0
   402
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
   403
		return EInconclusive;
sl@0
   404
		}
sl@0
   405
	errorCode = iController.GetDuration(theDuration);
sl@0
   406
	if(errorCode)
sl@0
   407
		{
sl@0
   408
		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
sl@0
   409
		iController.Stop();
sl@0
   410
		return EFail;
sl@0
   411
		}
sl@0
   412
	else if(theDuration != expectedtheDuration)
sl@0
   413
		{
sl@0
   414
		INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), theDuration. Int64());
sl@0
   415
		iController.Stop();
sl@0
   416
		return EFail;
sl@0
   417
		}
sl@0
   418
	return EPass;
sl@0
   419
	}
sl@0
   420
/**
sl@0
   421
 *
sl@0
   422
 * Test step constructor.
sl@0
   423
 * It initialises its own name and the input filename
sl@0
   424
 *
sl@0
   425
 */
sl@0
   426
RTestStepOggCtrlPause::RTestStepOggCtrlPause(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   427
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   428
	{
sl@0
   429
	}
sl@0
   430
sl@0
   431
/**
sl@0
   432
 * Do the test step.
sl@0
   433
 * This tests the Pause functionality of the OggPlayController in Stopped, Primed and Playing 
sl@0
   434
 * states and checks if the Play starts from the current position. It expects KErrNotReady
sl@0
   435
 * error if Pause is called during Stopped and Primed states.
sl@0
   436
 * 
sl@0
   437
 * This test may fail as the position after pause-play may vary due to granularity and recalculation of the buffer.
sl@0
   438
 */
sl@0
   439
TVerdict RTestStepOggCtrlPause::DoTestStepL(void)
sl@0
   440
	{
sl@0
   441
	INFO_PRINTF1(_L("this step tests Pause() API of OggPlayController "));
sl@0
   442
	TInt errorCode = iController.Pause();
sl@0
   443
	if(errorCode != KErrNotReady)
sl@0
   444
		{
sl@0
   445
		INFO_PRINTF2(_L("Pause() during Stopped State is failed to return KErrNotReady but returned %d "), errorCode);
sl@0
   446
		return EFail;
sl@0
   447
		}
sl@0
   448
	errorCode = iController.Prime();
sl@0
   449
	if(errorCode)
sl@0
   450
		{
sl@0
   451
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   452
		return EInconclusive;
sl@0
   453
		}
sl@0
   454
	errorCode = iController.Pause();
sl@0
   455
	if(errorCode != KErrNotReady)
sl@0
   456
		{
sl@0
   457
		INFO_PRINTF2(_L("Pause() during Primed State is failed to return KErrNotReady but returned %d "), errorCode);
sl@0
   458
		return EFail;
sl@0
   459
		}
sl@0
   460
	INFO_PRINTF1(_L("Play"));
sl@0
   461
	errorCode = iController.Play();
sl@0
   462
	if(errorCode)
sl@0
   463
		{
sl@0
   464
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
   465
		return EInconclusive;
sl@0
   466
		}
sl@0
   467
	INFO_PRINTF1(_L("Pause"));
sl@0
   468
	errorCode = iController.Pause();
sl@0
   469
	if(errorCode)
sl@0
   470
		{
sl@0
   471
		INFO_PRINTF2(_L("Pause() during Playing State is failed with  %d "), errorCode);
sl@0
   472
		return EFail;
sl@0
   473
		}
sl@0
   474
	INFO_PRINTF1(_L("GetPosition - thePosition"));
sl@0
   475
	TTimeIntervalMicroSeconds thePosition;
sl@0
   476
	errorCode = iController.GetPosition(thePosition);
sl@0
   477
	if(errorCode)
sl@0
   478
		{
sl@0
   479
		INFO_PRINTF2(_L("GetPosition() after Pause is failed with  %d "), errorCode);
sl@0
   480
		return EFail;
sl@0
   481
		}
sl@0
   482
	INFO_PRINTF1(_L("Play"));
sl@0
   483
	errorCode = iController.Play();
sl@0
   484
	if(errorCode)
sl@0
   485
		{
sl@0
   486
		INFO_PRINTF2(_L("Play() after Pause() is failed with  %d "), errorCode);
sl@0
   487
		return EInconclusive;
sl@0
   488
		}
sl@0
   489
	INFO_PRINTF1(_L("GetPosition - theNewPosition"));
sl@0
   490
	TTimeIntervalMicroSeconds theNewPosition;
sl@0
   491
	errorCode = iController.GetPosition(theNewPosition);
sl@0
   492
    INFO_PRINTF2(_L("  Paused: %d"), I64INT(thePosition.Int64()));
sl@0
   493
    INFO_PRINTF2(_L("  Current: %d"), I64INT(theNewPosition.Int64()));
sl@0
   494
sl@0
   495
	if(theNewPosition < thePosition)
sl@0
   496
		{
sl@0
   497
        //stop the controller
sl@0
   498
        INFO_PRINTF1(_L("Current Position is lessthan the Paused Postion"));
sl@0
   499
        ERR_PRINTF2(_L("  Paused: %d"), I64INT(thePosition.Int64()));
sl@0
   500
        ERR_PRINTF2(_L("  Current: %d"), I64INT(theNewPosition.Int64()));
sl@0
   501
        iController.Stop();
sl@0
   502
        return EFail;
sl@0
   503
		}
sl@0
   504
	//get the play completion event
sl@0
   505
	CActiveScheduler::Start();
sl@0
   506
	return iTestStepResult;
sl@0
   507
	}
sl@0
   508
/**
sl@0
   509
 *
sl@0
   510
 * Test step constructor.
sl@0
   511
 * It initialises its own name and the input filename
sl@0
   512
 *
sl@0
   513
 */
sl@0
   514
RTestStepOggCtrlStop::RTestStepOggCtrlStop(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   515
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   516
	{
sl@0
   517
	}
sl@0
   518
sl@0
   519
/**
sl@0
   520
 * Do the test step.
sl@0
   521
 * This tests the Stop functionality of the OggPlayController in Stopped, Primed and Playing 
sl@0
   522
 * states It expects KErrNotReady error if Stop is called during Stopped state.
sl@0
   523
 */
sl@0
   524
TVerdict RTestStepOggCtrlStop::DoTestStepL(void)
sl@0
   525
	{
sl@0
   526
	INFO_PRINTF1(_L("this step tests Stop() API of OggPlayController "));
sl@0
   527
	TInt errorCode = iController.Stop();
sl@0
   528
	if(errorCode)
sl@0
   529
		{
sl@0
   530
		INFO_PRINTF2(_L("Stop() during Stopped State is failed with %d "), errorCode);
sl@0
   531
		return EFail;
sl@0
   532
		}
sl@0
   533
	errorCode = iController.Prime();
sl@0
   534
	if(errorCode)
sl@0
   535
		{
sl@0
   536
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   537
		return EInconclusive;
sl@0
   538
		}
sl@0
   539
	errorCode = iController.Stop();
sl@0
   540
	if(errorCode)
sl@0
   541
		{
sl@0
   542
		INFO_PRINTF2(_L("Stop() during Primed State is failed with %d "), errorCode);
sl@0
   543
		return EFail;
sl@0
   544
		}
sl@0
   545
	errorCode = iController.Prime();
sl@0
   546
	if(errorCode)
sl@0
   547
		{
sl@0
   548
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   549
		return EInconclusive;
sl@0
   550
		}
sl@0
   551
	errorCode = iController.Play();
sl@0
   552
	if(errorCode)
sl@0
   553
		{
sl@0
   554
		INFO_PRINTF2(_L("Play() is failed with  %d "), errorCode);
sl@0
   555
		return EInconclusive;
sl@0
   556
		}
sl@0
   557
	User::After(KTwoSeconds);
sl@0
   558
	errorCode = iController.Stop();
sl@0
   559
	if(errorCode)
sl@0
   560
		{
sl@0
   561
		INFO_PRINTF2(_L("Stop() during Playing State is failed with  %d "), errorCode);
sl@0
   562
		return EFail;
sl@0
   563
		}
sl@0
   564
	errorCode = iController.Prime();
sl@0
   565
	if(errorCode)
sl@0
   566
		{
sl@0
   567
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   568
		return EInconclusive;
sl@0
   569
		}
sl@0
   570
	errorCode = iController.Play();
sl@0
   571
	if(errorCode)
sl@0
   572
		{
sl@0
   573
		INFO_PRINTF2(_L("Play() after Stop() is failed with  %d "), errorCode);
sl@0
   574
		return EInconclusive;
sl@0
   575
		}
sl@0
   576
	//get the play completion event
sl@0
   577
	CActiveScheduler::Start();
sl@0
   578
	return iTestStepResult;
sl@0
   579
	}
sl@0
   580
/**
sl@0
   581
 *
sl@0
   582
 * Test step constructor.
sl@0
   583
 * It initialises its own name and the input filename
sl@0
   584
 *
sl@0
   585
 */
sl@0
   586
RTestStepOggCtrlMetaData::RTestStepOggCtrlMetaData(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   587
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   588
	{
sl@0
   589
	}
sl@0
   590
sl@0
   591
/**
sl@0
   592
 * Do the test step.
sl@0
   593
 * This test tries to fetch the metadata from the Ogg file.
sl@0
   594
 * 
sl@0
   595
 */
sl@0
   596
TVerdict RTestStepOggCtrlMetaData::DoTestStepL(void)
sl@0
   597
	{
sl@0
   598
	INFO_PRINTF1(_L("this step tests GetNumberOfMetaDataEntries/GetMetaDataEntryL() APIs of OggPlayController "));
sl@0
   599
	TInt numEntries = 0;
sl@0
   600
	TInt errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
sl@0
   601
	CMMFMetaDataEntry* metaEntry = NULL;
sl@0
   602
	if(errorCode)
sl@0
   603
		{
sl@0
   604
		INFO_PRINTF2(_L("GetNumberOfMetaDataEntries() is failed with  %d "), errorCode);
sl@0
   605
		return EFail;
sl@0
   606
	 	}
sl@0
   607
	if(numEntries == 0)
sl@0
   608
		{
sl@0
   609
		INFO_PRINTF1(_L("File does not have meta entries "));
sl@0
   610
		}
sl@0
   611
	else
sl@0
   612
		{
sl@0
   613
		for(TInt counter = 0; counter < numEntries; ++counter)
sl@0
   614
        	{
sl@0
   615
        	TRAP(errorCode, metaEntry =  iController.GetMetaDataEntryL(counter));
sl@0
   616
        	if(errorCode)
sl@0
   617
        		{
sl@0
   618
        		INFO_PRINTF2(_L("GetMetaDataEntryL is failed with  %d "), errorCode);
sl@0
   619
        		return EFail;
sl@0
   620
        		}
sl@0
   621
        	INFO_PRINTF3(_L("%S    %S"), &metaEntry->Name(), &metaEntry->Value());
sl@0
   622
        	}
sl@0
   623
		}
sl@0
   624
	return EPass;
sl@0
   625
	}
sl@0
   626
/**
sl@0
   627
 *
sl@0
   628
 * Test step constructor.
sl@0
   629
 * It initialises its own name and the input filename
sl@0
   630
 *
sl@0
   631
 */
sl@0
   632
RTestStepOggCtrlPlayWindow::RTestStepOggCtrlPlayWindow(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   633
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   634
	{
sl@0
   635
	}
sl@0
   636
sl@0
   637
/**
sl@0
   638
 * Do the test step.
sl@0
   639
 * This tests the PlayWindow functionality of the OggPlayController.
sl@0
   640
 * Sequence : Prime -> SetPlayWindow -> Play(check if the current position > PlayStart)
sl@0
   641
 *            Stop  -> Prime -> Play(check if the current position > PlayStart)
sl@0
   642
 *			  Stop  -> Prime -> DeletePlayWindow -> Play(check if the current position <= PlayStart)
sl@0
   643
 */
sl@0
   644
TVerdict RTestStepOggCtrlPlayWindow::DoTestStepL(void)
sl@0
   645
	{
sl@0
   646
	INFO_PRINTF1(_L("this step tests SetPlaybackWindow/DeletePlaybackWindow() API of OggPlayController "));
sl@0
   647
	TInt errorCode = iController.Prime();
sl@0
   648
	if(errorCode)
sl@0
   649
		{
sl@0
   650
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
   651
		return EInconclusive;
sl@0
   652
		}
sl@0
   653
	TTimeIntervalMicroSeconds theDuration;
sl@0
   654
	errorCode = iController.GetDuration(theDuration);
sl@0
   655
	if(errorCode)
sl@0
   656
		{
sl@0
   657
		INFO_PRINTF2(_L("DurationL() is failed with  %d "), errorCode);
sl@0
   658
		return EInconclusive;
sl@0
   659
		}
sl@0
   660
	TInt64 duration = theDuration. Int64();
sl@0
   661
	TTimeIntervalMicroSeconds thePlayStart(duration/2);
sl@0
   662
	TTimeIntervalMicroSeconds thePlayEnd(duration);
sl@0
   663
	RMMFAudioPlayControllerCustomCommands theCommander(iController);
sl@0
   664
	errorCode = theCommander.SetPlaybackWindow(thePlayStart, thePlayEnd);
sl@0
   665
	if(errorCode)
sl@0
   666
		{
sl@0
   667
		INFO_PRINTF2(_L("SetPlaybackWindow() is failed with  %d "), errorCode);
sl@0
   668
		return EFail;
sl@0
   669
		}
sl@0
   670
	errorCode = iController.Play();
sl@0
   671
	if(errorCode)
sl@0
   672
		{
sl@0
   673
		INFO_PRINTF2(_L("Play() after SetPlayWindow() is failed with  %d "), errorCode);
sl@0
   674
		return EInconclusive;
sl@0
   675
		}
sl@0
   676
	TTimeIntervalMicroSeconds theNewPosition;
sl@0
   677
	errorCode = iController.GetPosition(theNewPosition);
sl@0
   678
	if(!TimeComparison(theNewPosition.Int64(), thePlayStart.Int64(), KDeviationInTime))
sl@0
   679
		{
sl@0
   680
        //stop the controller
sl@0
   681
        INFO_PRINTF1(_L("Current Position is lessthan the PlayWindowStart"));
sl@0
   682
        iController.Stop();
sl@0
   683
        return EFail;
sl@0
   684
		}
sl@0
   685
	User::After(KTwoSeconds);
sl@0
   686
	errorCode = iController.Stop();
sl@0
   687
	if(errorCode)
sl@0
   688
		{
sl@0
   689
		INFO_PRINTF2(_L("Stop() with PlayWindow set is failed with %d "), errorCode);
sl@0
   690
		return EFail;
sl@0
   691
		}
sl@0
   692
	errorCode = iController.Prime();
sl@0
   693
	if(errorCode)
sl@0
   694
		{
sl@0
   695
		INFO_PRINTF2(_L("Prime with PlayWindow set is failed with  %d "), errorCode);
sl@0
   696
		return EInconclusive;
sl@0
   697
		}
sl@0
   698
	errorCode = iController.Play();
sl@0
   699
	if(errorCode)
sl@0
   700
		{
sl@0
   701
		INFO_PRINTF2(_L("Play() with PlayWindow is failed with  %d "), errorCode);
sl@0
   702
		return EInconclusive;
sl@0
   703
		}
sl@0
   704
	errorCode = iController.GetPosition(theNewPosition);
sl@0
   705
	if(!TimeComparison(theNewPosition.Int64(), thePlayStart.Int64(), KDeviationInTime))
sl@0
   706
		{
sl@0
   707
        //stop the controller
sl@0
   708
        INFO_PRINTF1(_L("Current Position is lessthan the PlayWindowStart(Second Play)"));
sl@0
   709
        iController.Stop();
sl@0
   710
        return EFail;
sl@0
   711
		}
sl@0
   712
	User::After(KTwoSeconds);
sl@0
   713
	errorCode = iController.Stop();
sl@0
   714
	if(errorCode)
sl@0
   715
		{
sl@0
   716
		INFO_PRINTF2(_L("Stop() with PlayWindow set is failed with  %d "), errorCode);
sl@0
   717
		return EFail;
sl@0
   718
		}
sl@0
   719
	errorCode = iController.Prime();
sl@0
   720
	if(errorCode)
sl@0
   721
		{
sl@0
   722
		INFO_PRINTF2(_L("Prime with PlayWindow set is failed with  %d "), errorCode);
sl@0
   723
		return EFail;
sl@0
   724
		}
sl@0
   725
	errorCode = theCommander.DeletePlaybackWindow();
sl@0
   726
	if(errorCode)
sl@0
   727
		{
sl@0
   728
		INFO_PRINTF2(_L("DeletePlaybackWindow() is failed with  %d "), errorCode);
sl@0
   729
		return EFail;
sl@0
   730
		}
sl@0
   731
	errorCode = iController.Play();
sl@0
   732
	if(errorCode)
sl@0
   733
		{
sl@0
   734
		INFO_PRINTF2(_L("Play() after DeletePlaybackWindow is failed with  %d "), errorCode);
sl@0
   735
		return EFail;
sl@0
   736
		}
sl@0
   737
	errorCode = iController.GetPosition(theNewPosition);
sl@0
   738
	if(theNewPosition > thePlayStart)
sl@0
   739
		{
sl@0
   740
        //stop the controller
sl@0
   741
        INFO_PRINTF1(_L("PlaybackWindow is not deleted properly"));
sl@0
   742
        iController.Stop();
sl@0
   743
        return EFail;
sl@0
   744
		}
sl@0
   745
	//get the play completion event
sl@0
   746
	CActiveScheduler::Start();
sl@0
   747
	return iTestStepResult;
sl@0
   748
	}
sl@0
   749
sl@0
   750
/**
sl@0
   751
 *
sl@0
   752
 * Test step constructor.
sl@0
   753
 * It initialises its own name and the input filename
sl@0
   754
 *
sl@0
   755
 */	
sl@0
   756
RTestStepOggCtrlGetSetConfig::RTestStepOggCtrlGetSetConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   757
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   758
	{
sl@0
   759
	}
sl@0
   760
sl@0
   761
/**
sl@0
   762
 * Do the test step.
sl@0
   763
 * This test tries to fetch the audio configuration from the Ogg file
sl@0
   764
 * and compares with the expected configuration.
sl@0
   765
 */
sl@0
   766
TVerdict RTestStepOggCtrlGetSetConfig::DoTestStepL(void)
sl@0
   767
	{
sl@0
   768
	INFO_PRINTF1(_L("this step tests setting and getting audio configuration on OggPlayController "));
sl@0
   769
	RMMFAudioControllerCustomCommands theCommander( iController );
sl@0
   770
	TUint theRate = 0;
sl@0
   771
	const TUint KExpectedBitRate = 128000;
sl@0
   772
	const TUint KExpectedSampleRate = 44100;
sl@0
   773
	const TUint KExpectedSourceChannels = 2;
sl@0
   774
	TInt errorCode = theCommander.GetSourceBitRate(theRate);
sl@0
   775
	if(errorCode)
sl@0
   776
		{
sl@0
   777
		INFO_PRINTF2(_L("GetSourceBitRate() is failed with  %d "), errorCode);
sl@0
   778
		return EFail;
sl@0
   779
		}
sl@0
   780
	else if(theRate != KExpectedBitRate)
sl@0
   781
		{
sl@0
   782
		INFO_PRINTF2(_L("GetSourceBitRate() returned the wrong bitrate %d "), theRate);
sl@0
   783
		return EFail;
sl@0
   784
		}
sl@0
   785
	errorCode = theCommander.GetSourceSampleRate(theRate);
sl@0
   786
	if(errorCode)
sl@0
   787
		{
sl@0
   788
		INFO_PRINTF2(_L("GetSourceSampleRate() is failed with  %d "), errorCode);
sl@0
   789
		return EFail;
sl@0
   790
		}
sl@0
   791
	else if(theRate != KExpectedSampleRate)
sl@0
   792
		{
sl@0
   793
		INFO_PRINTF2(_L("GetSourceBitRate() returned the wrong samplerate %d "), theRate);
sl@0
   794
		return EFail;
sl@0
   795
		}
sl@0
   796
	errorCode = theCommander.GetSourceNumChannels(theRate);
sl@0
   797
	if(errorCode)
sl@0
   798
		{
sl@0
   799
		INFO_PRINTF2(_L("GetSourceNumChannels() is failed with  %d "), errorCode);
sl@0
   800
		return EFail;
sl@0
   801
		}
sl@0
   802
	else if(theRate != KExpectedSourceChannels)
sl@0
   803
		{
sl@0
   804
		INFO_PRINTF2(_L("GetSourceNumChannels() returned the wrong value %d "), theRate);
sl@0
   805
		return EFail;
sl@0
   806
		}
sl@0
   807
	TUid formatUid;
sl@0
   808
	errorCode = theCommander.GetSourceFormat(formatUid);
sl@0
   809
	if(errorCode)
sl@0
   810
		{
sl@0
   811
		INFO_PRINTF2(_L("GetSourceFormat(() during Stopped State is failed with  %d "), errorCode);
sl@0
   812
		return EFail;
sl@0
   813
		}
sl@0
   814
	if(formatUid != KOggDecodeUid)
sl@0
   815
		{
sl@0
   816
		INFO_PRINTF2(_L("GetSourceFormat() returned the wrong value %d "), formatUid.iUid);
sl@0
   817
		return EFail;
sl@0
   818
		}
sl@0
   819
	TFourCC dataType(0);
sl@0
   820
	errorCode =theCommander.GetSourceDataType(dataType);
sl@0
   821
	if(errorCode)
sl@0
   822
		{
sl@0
   823
		INFO_PRINTF2(_L("GetSourceDataType() during Stopped State is failed with  %d "), errorCode);
sl@0
   824
		return EFail;
sl@0
   825
		}
sl@0
   826
	if( dataType != TFourCC('V', 'O', 'R', 'B') )
sl@0
   827
		{
sl@0
   828
        INFO_PRINTF1(_L("GetSourceDataType() returned datatype different from VORB "));
sl@0
   829
        return EFail;
sl@0
   830
		}
sl@0
   831
	/*
sl@0
   832
	 Setting configurations during playing is not possible because the file has to be played at a configuration  
sl@0
   833
	 which is same as that of when it was recorded. However, if the client tries to set the configuration which 
sl@0
   834
	 is same as the configutation of the file, all the SetXXX() custom commands will return KErrNone. We dont check 
sl@0
   835
	 GetXXX() after SetXXX() here for this reason. 
sl@0
   836
	 */
sl@0
   837
	errorCode = theCommander.SetSourceBitRate(KExpectedBitRate);
sl@0
   838
	if(errorCode)
sl@0
   839
		{
sl@0
   840
		INFO_PRINTF2(_L("SetSourceBitRate() is failed with  %d "), errorCode);
sl@0
   841
		return EFail;
sl@0
   842
		}
sl@0
   843
	errorCode = theCommander.SetSourceSampleRate(KExpectedSampleRate);
sl@0
   844
	if(errorCode)
sl@0
   845
		{
sl@0
   846
		INFO_PRINTF2(_L("SetSourceSampleRate() is failed with  %d "), errorCode);
sl@0
   847
		return EFail;
sl@0
   848
		}
sl@0
   849
	errorCode = theCommander.SetSourceNumChannels(KExpectedSourceChannels);
sl@0
   850
	if(errorCode)
sl@0
   851
		{
sl@0
   852
		INFO_PRINTF2(_L("SetSourceNumChannels() is failed with  %d "), errorCode);
sl@0
   853
		return EFail;
sl@0
   854
		}
sl@0
   855
	TFourCC theCodec('V', 'O', 'R', 'B');
sl@0
   856
	errorCode = theCommander.SetSourceDataType(theCodec);
sl@0
   857
	if(errorCode)
sl@0
   858
		{
sl@0
   859
		INFO_PRINTF2(_L("SetSourceDataType() is failed with  %d "), errorCode);
sl@0
   860
		return EFail;
sl@0
   861
		}
sl@0
   862
	errorCode = theCommander.SetCodec(theCodec, theCodec);
sl@0
   863
	if(errorCode)
sl@0
   864
		{
sl@0
   865
		INFO_PRINTF2(_L("SetCodec() is failed with  %d "), errorCode);
sl@0
   866
		return EFail;
sl@0
   867
		}
sl@0
   868
	errorCode = theCommander.SetSourceFormat(KOggDecodeUid);
sl@0
   869
	if(errorCode)
sl@0
   870
		{
sl@0
   871
		INFO_PRINTF2(_L("SetSourceFormat() is failed with  %d "), errorCode);
sl@0
   872
		return EFail;
sl@0
   873
		}
sl@0
   874
	return EPass;
sl@0
   875
	}
sl@0
   876
sl@0
   877
//Negative Tests
sl@0
   878
/**
sl@0
   879
 *
sl@0
   880
 * Test step constructor.
sl@0
   881
 * It initialises its own name and the input filename
sl@0
   882
 *
sl@0
   883
 */
sl@0
   884
RTestStepOggCtrlPlayInvalid::RTestStepOggCtrlPlayInvalid(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   885
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   886
	{
sl@0
   887
	}
sl@0
   888
sl@0
   889
TVerdict RTestStepOggCtrlPlayInvalid::DoTestStepPreambleL(void)
sl@0
   890
	{
sl@0
   891
	return EPass;
sl@0
   892
	}
sl@0
   893
sl@0
   894
/**
sl@0
   895
 * Do the test step(Negative Test).
sl@0
   896
 * This test tries to open an invalid file. Expects KErrCurrupt from OggPlayController
sl@0
   897
 */
sl@0
   898
TVerdict RTestStepOggCtrlPlayInvalid::DoTestStepL(void)
sl@0
   899
	{
sl@0
   900
	INFO_PRINTF1(_L("This test tries to open an invalid file using OggPlayController"));
sl@0
   901
	iScheduler = new(ELeave)CActiveScheduler;
sl@0
   902
    CleanupStack::PushL(iScheduler );
sl@0
   903
	CActiveScheduler::Install(iScheduler );
sl@0
   904
	CleanupStack::Pop();
sl@0
   905
	iPriority.iPriority = 11;  // set the priority to some default value
sl@0
   906
	iPriority.iPref = EMdaPriorityPreferenceQuality;
sl@0
   907
	iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
sl@0
   908
	TInt errorCode = iController.Open(KOggPlayControllerUid, iPriority);
sl@0
   909
	if(errorCode)
sl@0
   910
		{
sl@0
   911
		INFO_PRINTF2(_L("Failed to load the controller  %d "), errorCode);
sl@0
   912
		return EInconclusive;
sl@0
   913
		}
sl@0
   914
	iControllerEventMonitor->Start();
sl@0
   915
	SetupReadFileConfigL();
sl@0
   916
	errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
sl@0
   917
	if(errorCode != KErrCorrupt)
sl@0
   918
		{
sl@0
   919
		INFO_PRINTF2(_L("AddDataSource failed with  %d "), errorCode);
sl@0
   920
		return EFail;
sl@0
   921
		}
sl@0
   922
	return EPass;
sl@0
   923
	}
sl@0
   924
/**
sl@0
   925
 *
sl@0
   926
 * Test step constructor.
sl@0
   927
 * It initialises its own name and the input filename
sl@0
   928
 *
sl@0
   929
 */
sl@0
   930
RTestStepOggCtrlSetInvalidConfig::RTestStepOggCtrlSetInvalidConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   931
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   932
	{
sl@0
   933
	}
sl@0
   934
sl@0
   935
/**
sl@0
   936
 * Do the test step(Negative Test).
sl@0
   937
 * This tests setting the an invalid SourceDataType on OggPlayController 
sl@0
   938
 * checks if the OggPlayController returns KErrNotSupported
sl@0
   939
 */
sl@0
   940
TVerdict RTestStepOggCtrlSetInvalidConfig::DoTestStepL( void )
sl@0
   941
	{
sl@0
   942
	INFO_PRINTF1(_L("This tests setting an invalid SourceDataType on OggPlayController "));
sl@0
   943
	RMMFAudioControllerCustomCommands theCommander( iController );
sl@0
   944
	TFourCC theCodec(KMMFFourCCCodeIMAD);
sl@0
   945
	TInt errorCode = theCommander.SetSourceDataType(theCodec);
sl@0
   946
	if(errorCode != KErrNotSupported)
sl@0
   947
		{
sl@0
   948
		INFO_PRINTF2(_L("SetSourceDataType() with non vorbis failed to return KErrNotSupported but returned %d "), errorCode);
sl@0
   949
		return EFail;
sl@0
   950
		}
sl@0
   951
	TUint newBitRate = 224000;
sl@0
   952
	TUint newSampleRate = 8000;
sl@0
   953
	TUint newSourceChannels = 1;
sl@0
   954
	errorCode = theCommander.SetSourceBitRate(newBitRate);
sl@0
   955
	if(errorCode != KErrNotSupported)
sl@0
   956
		{
sl@0
   957
		INFO_PRINTF2(_L("SetSourceBitRate() returned wrong error  %d "), errorCode);
sl@0
   958
		return EFail;
sl@0
   959
		}
sl@0
   960
	errorCode = theCommander.SetSourceSampleRate(newSampleRate);
sl@0
   961
	if(errorCode != KErrNotSupported)
sl@0
   962
		{
sl@0
   963
		INFO_PRINTF2(_L("SetSourceSampleRate() returned wrong error  %d "), errorCode);
sl@0
   964
		return EFail;
sl@0
   965
		}
sl@0
   966
	errorCode = theCommander.SetSourceNumChannels(newSourceChannels);
sl@0
   967
	if(errorCode != KErrNotSupported)
sl@0
   968
		{
sl@0
   969
		INFO_PRINTF2(_L("SetSourceNumChannels() returned wrong error  %d "), errorCode);
sl@0
   970
		return EFail;
sl@0
   971
		}
sl@0
   972
	errorCode = theCommander.SetSourceFormat(KOggEncodeUid);
sl@0
   973
	if(errorCode != KErrNotSupported)
sl@0
   974
		{
sl@0
   975
		INFO_PRINTF2(_L("SetSourceFormat() returned wrong error  %d "), errorCode);
sl@0
   976
		return EFail;
sl@0
   977
		}
sl@0
   978
	return EPass;
sl@0
   979
	}
sl@0
   980
sl@0
   981
/**
sl@0
   982
 *
sl@0
   983
 * Test step constructor.
sl@0
   984
 * It initialises its own name and the input filename
sl@0
   985
 *
sl@0
   986
 */
sl@0
   987
RTestStepOggCtrlPositionNegative::RTestStepOggCtrlPositionNegative(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
sl@0
   988
	:RTestStepOggCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
sl@0
   989
	{
sl@0
   990
	}
sl@0
   991
sl@0
   992
/**
sl@0
   993
 * Do the test step(Negative Test).
sl@0
   994
 * This tests setting the Negative Position on OggPlayController
sl@0
   995
 * checks if the Position set is to 0. 
sl@0
   996
 */
sl@0
   997
TVerdict RTestStepOggCtrlPositionNegative::DoTestStepL(void)
sl@0
   998
	{
sl@0
   999
	INFO_PRINTF1(_L("This tests setting the Negative Position on OggPlayController"));
sl@0
  1000
	TInt errorCode = iController.Prime();
sl@0
  1001
	if(errorCode)
sl@0
  1002
		{
sl@0
  1003
		INFO_PRINTF2(_L("Prime is failed with  %d "), errorCode);
sl@0
  1004
		return EInconclusive;
sl@0
  1005
		}
sl@0
  1006
	errorCode = iController.SetPosition(-1);
sl@0
  1007
	if(errorCode)
sl@0
  1008
		{
sl@0
  1009
		INFO_PRINTF2(_L("SetPosition() during Primed State is failed with  %d "), errorCode);
sl@0
  1010
		return EFail;
sl@0
  1011
		}
sl@0
  1012
	TTimeIntervalMicroSeconds theNewPosition;
sl@0
  1013
	errorCode = iController.GetPosition(theNewPosition);
sl@0
  1014
	if(errorCode)
sl@0
  1015
		{
sl@0
  1016
		INFO_PRINTF2(_L("GetPosition() during Primed State is failed with  %d "), errorCode);
sl@0
  1017
		return EFail;
sl@0
  1018
		}
sl@0
  1019
	
sl@0
  1020
	if(theNewPosition != 0)
sl@0
  1021
		{
sl@0
  1022
		INFO_PRINTF1(_L("Get Position is failed to return 0 when the position is set to a negative value"));
sl@0
  1023
		return EFail;
sl@0
  1024
		}
sl@0
  1025
	return EPass;
sl@0
  1026
	}