os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiodspcontrol.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) 2007-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 "teststepciaudiodspcontrol.h"
sl@0
    17
sl@0
    18
sl@0
    19
TVerdict CTestStepCIAudioDspControl::DoTestStepL()
sl@0
    20
	{
sl@0
    21
	iTestStepResult = ETestSuiteError;
sl@0
    22
sl@0
    23
	INFO_PRINTF1(_L("Initializing test CI device"));
sl@0
    24
sl@0
    25
	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0076-HP")) == 0)
sl@0
    26
		{
sl@0
    27
		iTestStepResult = DoTestStep0076L();
sl@0
    28
		}
sl@0
    29
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0077-HP")) == 0)
sl@0
    30
		{
sl@0
    31
		iTestStepResult = DoTestStep0077L();
sl@0
    32
		}
sl@0
    33
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0078-HP")) == 0)
sl@0
    34
		{
sl@0
    35
		iTestStepResult = DoTestStep0078L();
sl@0
    36
		}
sl@0
    37
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0079-HP")) == 0)
sl@0
    38
		{
sl@0
    39
		iTestStepResult = DoTestStep0079L();
sl@0
    40
		}
sl@0
    41
sl@0
    42
	return iTestStepResult;
sl@0
    43
	}
sl@0
    44
sl@0
    45
sl@0
    46
TVerdict CTestStepCIAudioDspControl::DoTestStep0076L()
sl@0
    47
	{
sl@0
    48
	iTestStepResult = EFail;
sl@0
    49
sl@0
    50
	INFO_PRINTF1(_L("AudioDSPControl - Instantiating"));
sl@0
    51
sl@0
    52
	//Initialize - with the UID of our test HwDevice
sl@0
    53
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    54
	TUid testUID = {KUidAudioDspControlTestDevice};
sl@0
    55
	#else
sl@0
    56
	TFourCC testUID('T','0','1','3');
sl@0
    57
	#endif
sl@0
    58
	
sl@0
    59
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
    60
sl@0
    61
	if (iTestStepResult != EPass)
sl@0
    62
		{
sl@0
    63
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
    64
		return EInconclusive;
sl@0
    65
		}
sl@0
    66
sl@0
    67
	// reset the value as previous test is pass
sl@0
    68
	iTestStepResult = EFail;
sl@0
    69
sl@0
    70
	// KUidMMFDSPControl
sl@0
    71
	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
sl@0
    72
sl@0
    73
	if (ptr)
sl@0
    74
		{
sl@0
    75
		INFO_PRINTF1(_L("MMMFDSPControl instantiated successfully"));
sl@0
    76
sl@0
    77
		iTestStepResult = EPass;
sl@0
    78
		}
sl@0
    79
	else
sl@0
    80
		{
sl@0
    81
		ERR_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
sl@0
    82
		}
sl@0
    83
sl@0
    84
	return iTestStepResult;
sl@0
    85
	}
sl@0
    86
sl@0
    87
sl@0
    88
TVerdict CTestStepCIAudioDspControl::DoTestStep0077L()
sl@0
    89
	{
sl@0
    90
	iTestStepResult = EFail;
sl@0
    91
sl@0
    92
	INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptRecordBuffersInvalidFollowingStop"));
sl@0
    93
sl@0
    94
	//Initialize - with the UID of our test HwDevice
sl@0
    95
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    96
	TUid testUID = {KUidAudioDspControlTestDevice};
sl@0
    97
	#else
sl@0
    98
	TFourCC testUID('T','0','1','3');
sl@0
    99
	#endif
sl@0
   100
	 
sl@0
   101
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
   102
sl@0
   103
	if (iTestStepResult != EPass)
sl@0
   104
		{
sl@0
   105
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
   106
		return EInconclusive;
sl@0
   107
		}
sl@0
   108
sl@0
   109
	// reset the value as previous test is pass
sl@0
   110
	iTestStepResult = EFail;
sl@0
   111
sl@0
   112
	// KUidMMFDSPControl
sl@0
   113
	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
sl@0
   114
sl@0
   115
	if (ptr)
sl@0
   116
		{
sl@0
   117
		TInt result = KErrGeneral;
sl@0
   118
sl@0
   119
		result = ptr->MmdspcAcceptRecordBuffersInvalidFollowingStop();
sl@0
   120
sl@0
   121
		if (result == KErrNone)
sl@0
   122
			{
sl@0
   123
			INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop finished successfully"));
sl@0
   124
sl@0
   125
			iTestStepResult = EPass;
sl@0
   126
			}
sl@0
   127
		else
sl@0
   128
			{
sl@0
   129
			ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop failed with result %d"), result);
sl@0
   130
			}
sl@0
   131
		}
sl@0
   132
	else
sl@0
   133
		{
sl@0
   134
		INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
sl@0
   135
		iTestStepResult = EInconclusive;
sl@0
   136
		}
sl@0
   137
sl@0
   138
	return iTestStepResult;
sl@0
   139
	}
sl@0
   140
sl@0
   141
sl@0
   142
TVerdict CTestStepCIAudioDspControl::DoTestStep0078L()
sl@0
   143
	{
sl@0
   144
	iTestStepResult = EFail;
sl@0
   145
sl@0
   146
	INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptPlaybackBuffersInvalidFollowingStop"));
sl@0
   147
sl@0
   148
	//Initialize - with the UID of our test HwDevice
sl@0
   149
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   150
	TUid testUID = {KUidAudioDspControlTestDevice};
sl@0
   151
	#else
sl@0
   152
	TFourCC testUID('T','0','1','3');
sl@0
   153
	#endif
sl@0
   154
	
sl@0
   155
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
   156
sl@0
   157
	if (iTestStepResult != EPass)
sl@0
   158
		{
sl@0
   159
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
   160
		return EInconclusive;
sl@0
   161
		}
sl@0
   162
sl@0
   163
	// reset the value as previous test is pass
sl@0
   164
	iTestStepResult = EFail;
sl@0
   165
sl@0
   166
	// KUidMMFDSPControl
sl@0
   167
	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
sl@0
   168
sl@0
   169
	if (ptr)
sl@0
   170
		{
sl@0
   171
		TInt result = KErrGeneral;
sl@0
   172
sl@0
   173
		result = ptr->MmdspcAcceptPlaybackBuffersInvalidFollowingStop();
sl@0
   174
sl@0
   175
		if (result == KErrNone)
sl@0
   176
			{
sl@0
   177
			INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop finished successfully"));
sl@0
   178
sl@0
   179
			iTestStepResult = EPass;
sl@0
   180
			}
sl@0
   181
		else
sl@0
   182
			{
sl@0
   183
			ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop failed with result %d"), result);
sl@0
   184
			}
sl@0
   185
		}
sl@0
   186
	else
sl@0
   187
		{
sl@0
   188
		INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
sl@0
   189
		iTestStepResult = EInconclusive;
sl@0
   190
		}
sl@0
   191
sl@0
   192
	return iTestStepResult;
sl@0
   193
	}
sl@0
   194
sl@0
   195
sl@0
   196
TVerdict CTestStepCIAudioDspControl::DoTestStep0079L()
sl@0
   197
	{
sl@0
   198
	iTestStepResult = EFail;
sl@0
   199
sl@0
   200
	INFO_PRINTF1(_L("AudioDSPControl - MmdspcGetAudioPlaybackInfo"));
sl@0
   201
sl@0
   202
	//Initialize - with the UID of our test HwDevice
sl@0
   203
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   204
	TUid testUID = {KUidAudioDspControlTestDevice};
sl@0
   205
	#else
sl@0
   206
	TFourCC testUID('T','0','1','3');
sl@0
   207
	#endif
sl@0
   208
	
sl@0
   209
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
   210
sl@0
   211
	if (iTestStepResult != EPass)
sl@0
   212
		{
sl@0
   213
		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
sl@0
   214
		return EInconclusive;
sl@0
   215
		}
sl@0
   216
sl@0
   217
	// reset the value as previous test is pass
sl@0
   218
	iTestStepResult = EFail;
sl@0
   219
sl@0
   220
	// KUidMMFDSPControl
sl@0
   221
	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
sl@0
   222
sl@0
   223
	if (ptr)
sl@0
   224
		{
sl@0
   225
		TInt result = KErrGeneral;
sl@0
   226
		TInt64 samplesPlayed = 0;
sl@0
   227
		TInt64 systemTime = 0;
sl@0
   228
		TUint  bytesDecoderConsumed = 0;
sl@0
   229
		TUint  bytesDecoderDecoded = 0;
sl@0
   230
sl@0
   231
		result = ptr->MmdspcGetAudioPlaybackInfo (samplesPlayed, systemTime, bytesDecoderConsumed, bytesDecoderDecoded); // call method
sl@0
   232
sl@0
   233
		if ( (result == KErrNone) &&
sl@0
   234
			 (samplesPlayed == 999)	&& (systemTime == 999) &&
sl@0
   235
			 (bytesDecoderConsumed == 999) && (bytesDecoderDecoded == 999) )
sl@0
   236
			{
sl@0
   237
			INFO_PRINTF1(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo finished successfully"));
sl@0
   238
sl@0
   239
			iTestStepResult = EPass;
sl@0
   240
			}
sl@0
   241
		else
sl@0
   242
			{
sl@0
   243
			ERR_PRINTF2(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo failed with result %d"), result);
sl@0
   244
			}
sl@0
   245
		}
sl@0
   246
	else
sl@0
   247
		{
sl@0
   248
		INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
sl@0
   249
		iTestStepResult = EInconclusive;
sl@0
   250
		}
sl@0
   251
sl@0
   252
	return iTestStepResult;
sl@0
   253
	}