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