os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaacdecoderconfig.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
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 "teststepciaacdecoderconfig.h"
sl@0
    17
sl@0
    18
sl@0
    19
TVerdict CTestStepCIAacDecoderConfig::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-0004-HP")) == 0)
sl@0
    26
		{
sl@0
    27
		iTestStepResult = DoTestStep0004L();
sl@0
    28
		}
sl@0
    29
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0005-HP")) == 0)
sl@0
    30
		{
sl@0
    31
		iTestStepResult = DoTestStep0005L();
sl@0
    32
		}
sl@0
    33
	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0093-HP")) == 0)
sl@0
    34
		{
sl@0
    35
		iTestStepResult = DoTestStep0093L();
sl@0
    36
		}
sl@0
    37
		
sl@0
    38
	return iTestStepResult;
sl@0
    39
	}
sl@0
    40
sl@0
    41
sl@0
    42
TVerdict CTestStepCIAacDecoderConfig::DoTestStep0004L()
sl@0
    43
	{
sl@0
    44
	iTestStepResult = EFail;
sl@0
    45
sl@0
    46
	INFO_PRINTF1(_L("AacDecoderConfig - Instantiating"));
sl@0
    47
sl@0
    48
	//Initialize - with the UID of our test HwDevice
sl@0
    49
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    50
	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
sl@0
    51
	#else
sl@0
    52
	TFourCC testUID('T','0','0','8');
sl@0
    53
	#endif
sl@0
    54
sl@0
    55
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
    56
	
sl@0
    57
	if (iTestStepResult != EPass)
sl@0
    58
		{
sl@0
    59
		return EInconclusive;
sl@0
    60
		}
sl@0
    61
	
sl@0
    62
	// reset the value as previous test is pass
sl@0
    63
	iTestStepResult = EFail;  
sl@0
    64
	
sl@0
    65
	// KUidCustomInterfaceDevSoundAacConfig
sl@0
    66
	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
sl@0
    67
sl@0
    68
	if (ptr)
sl@0
    69
		{
sl@0
    70
		INFO_PRINTF1(_L("MAacDecoderConfig initialized successfully"));
sl@0
    71
sl@0
    72
		iTestStepResult = EPass;
sl@0
    73
		}
sl@0
    74
	else
sl@0
    75
		{
sl@0
    76
		ERR_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
sl@0
    77
		}
sl@0
    78
		
sl@0
    79
	return iTestStepResult;
sl@0
    80
	}
sl@0
    81
sl@0
    82
sl@0
    83
TVerdict CTestStepCIAacDecoderConfig::DoTestStep0005L()
sl@0
    84
	{
sl@0
    85
	iTestStepResult = EFail;
sl@0
    86
	TInt result = KErrGeneral;	
sl@0
    87
sl@0
    88
	INFO_PRINTF1(_L("AacDecoderConfig - SetAudioConfig"));
sl@0
    89
sl@0
    90
	//Initialize - with the UID of our test HwDevice
sl@0
    91
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
    92
	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
sl@0
    93
	#else
sl@0
    94
	TFourCC testUID('T','0','0','8');
sl@0
    95
	#endif
sl@0
    96
	
sl@0
    97
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
    98
sl@0
    99
	if (iTestStepResult != EPass)
sl@0
   100
		{
sl@0
   101
		return EInconclusive;
sl@0
   102
		}
sl@0
   103
	
sl@0
   104
	// reset the value as previous test is pass
sl@0
   105
	iTestStepResult = EFail;  
sl@0
   106
	
sl@0
   107
	// KUidCustomInterfaceDevSoundAacConfig
sl@0
   108
	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
sl@0
   109
sl@0
   110
	if (ptr)
sl@0
   111
		{
sl@0
   112
		MAacDecoderConfig::TAudioConfig audioConfig;
sl@0
   113
sl@0
   114
		// Set values before call.
sl@0
   115
		audioConfig.iAudioObjectType = MAacDecoderConfig::TAudioConfig::EAacSsr;
sl@0
   116
		
sl@0
   117
		result = ptr->SetAudioConfig(audioConfig); // call method
sl@0
   118
		
sl@0
   119
		if (result == KErrNone)
sl@0
   120
			{
sl@0
   121
			TInt retAudioConfig;
sl@0
   122
sl@0
   123
			// This file is created by the test stub, the plugin device
sl@0
   124
			_LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
sl@0
   125
sl@0
   126
			ReadFileL(KFileName, retAudioConfig);
sl@0
   127
sl@0
   128
			if (retAudioConfig == audioConfig.iAudioObjectType)
sl@0
   129
				{
sl@0
   130
				INFO_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig finished successfully"));
sl@0
   131
sl@0
   132
				iTestStepResult = EPass;
sl@0
   133
				}
sl@0
   134
			else
sl@0
   135
				{
sl@0
   136
				ERR_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig failed - expected and received mismatch"));
sl@0
   137
				}
sl@0
   138
			}
sl@0
   139
		}
sl@0
   140
	else
sl@0
   141
		{
sl@0
   142
		INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
sl@0
   143
		iTestStepResult = EInconclusive;
sl@0
   144
		}
sl@0
   145
sl@0
   146
	return iTestStepResult;	
sl@0
   147
	}
sl@0
   148
sl@0
   149
sl@0
   150
TVerdict CTestStepCIAacDecoderConfig::DoTestStep0093L()
sl@0
   151
	{
sl@0
   152
	iTestStepResult = EFail;
sl@0
   153
	TInt result = KErrGeneral;	
sl@0
   154
sl@0
   155
	INFO_PRINTF1(_L("AacDecoderConfig - GetSupportedAudioConfigs"));
sl@0
   156
sl@0
   157
	//Initialize - with the UID of our test HwDevice
sl@0
   158
	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
sl@0
   159
	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
sl@0
   160
	#else
sl@0
   161
	TFourCC testUID('T','0','0','8');
sl@0
   162
	#endif
sl@0
   163
	
sl@0
   164
	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
sl@0
   165
sl@0
   166
	if (iTestStepResult != EPass)
sl@0
   167
		{
sl@0
   168
		return EInconclusive;
sl@0
   169
		}
sl@0
   170
	
sl@0
   171
	// reset the value as previous test is pass
sl@0
   172
	iTestStepResult = EFail;  
sl@0
   173
	
sl@0
   174
	// KUidCustomInterfaceDevSoundAacConfig
sl@0
   175
	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
sl@0
   176
sl@0
   177
	if (ptr)
sl@0
   178
		{
sl@0
   179
		RArray<MAacDecoderConfig::TAudioConfig> audioConfig;
sl@0
   180
		
sl@0
   181
		result = ptr->GetSupportedAudioConfigs(audioConfig); // call method
sl@0
   182
		
sl@0
   183
		if (result == KErrNone)
sl@0
   184
			{
sl@0
   185
			if ( (audioConfig[0].iAudioObjectType == MAacDecoderConfig::TAudioConfig::ESbr)		&&
sl@0
   186
				 (audioConfig[1].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLtp)	&&
sl@0
   187
				 (audioConfig[2].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacSsr)	&&
sl@0
   188
				 (audioConfig[3].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLc)	&&
sl@0
   189
				 (audioConfig[4].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacMain) )
sl@0
   190
				{
sl@0
   191
				INFO_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs finished successfully"));
sl@0
   192
sl@0
   193
				iTestStepResult = EPass;
sl@0
   194
				}
sl@0
   195
			else
sl@0
   196
				{
sl@0
   197
				ERR_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed - expected and received mismatch"));
sl@0
   198
				}
sl@0
   199
			}
sl@0
   200
		else
sl@0
   201
			{
sl@0
   202
			ERR_PRINTF2(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed with result %d"), result);
sl@0
   203
			}		
sl@0
   204
		}
sl@0
   205
	else
sl@0
   206
		{
sl@0
   207
		INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
sl@0
   208
		iTestStepResult = EInconclusive;
sl@0
   209
		}
sl@0
   210
sl@0
   211
	return iTestStepResult;	
sl@0
   212
	}