os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaacdecoderconfig.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaacdecoderconfig.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,212 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "teststepciaacdecoderconfig.h"
    1.20 +
    1.21 +
    1.22 +TVerdict CTestStepCIAacDecoderConfig::DoTestStepL()
    1.23 +	{
    1.24 +	iTestStepResult = ETestSuiteError;
    1.25 +
    1.26 +	INFO_PRINTF1(_L("Initializing test CI device"));
    1.27 +	
    1.28 +	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0004-HP")) == 0)
    1.29 +		{
    1.30 +		iTestStepResult = DoTestStep0004L();
    1.31 +		}
    1.32 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0005-HP")) == 0)
    1.33 +		{
    1.34 +		iTestStepResult = DoTestStep0005L();
    1.35 +		}
    1.36 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0093-HP")) == 0)
    1.37 +		{
    1.38 +		iTestStepResult = DoTestStep0093L();
    1.39 +		}
    1.40 +		
    1.41 +	return iTestStepResult;
    1.42 +	}
    1.43 +
    1.44 +
    1.45 +TVerdict CTestStepCIAacDecoderConfig::DoTestStep0004L()
    1.46 +	{
    1.47 +	iTestStepResult = EFail;
    1.48 +
    1.49 +	INFO_PRINTF1(_L("AacDecoderConfig - Instantiating"));
    1.50 +
    1.51 +	//Initialize - with the UID of our test HwDevice
    1.52 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.53 +	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
    1.54 +	#else
    1.55 +	TFourCC testUID('T','0','0','8');
    1.56 +	#endif
    1.57 +
    1.58 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    1.59 +	
    1.60 +	if (iTestStepResult != EPass)
    1.61 +		{
    1.62 +		return EInconclusive;
    1.63 +		}
    1.64 +	
    1.65 +	// reset the value as previous test is pass
    1.66 +	iTestStepResult = EFail;  
    1.67 +	
    1.68 +	// KUidCustomInterfaceDevSoundAacConfig
    1.69 +	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
    1.70 +
    1.71 +	if (ptr)
    1.72 +		{
    1.73 +		INFO_PRINTF1(_L("MAacDecoderConfig initialized successfully"));
    1.74 +
    1.75 +		iTestStepResult = EPass;
    1.76 +		}
    1.77 +	else
    1.78 +		{
    1.79 +		ERR_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
    1.80 +		}
    1.81 +		
    1.82 +	return iTestStepResult;
    1.83 +	}
    1.84 +
    1.85 +
    1.86 +TVerdict CTestStepCIAacDecoderConfig::DoTestStep0005L()
    1.87 +	{
    1.88 +	iTestStepResult = EFail;
    1.89 +	TInt result = KErrGeneral;	
    1.90 +
    1.91 +	INFO_PRINTF1(_L("AacDecoderConfig - SetAudioConfig"));
    1.92 +
    1.93 +	//Initialize - with the UID of our test HwDevice
    1.94 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.95 +	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
    1.96 +	#else
    1.97 +	TFourCC testUID('T','0','0','8');
    1.98 +	#endif
    1.99 +	
   1.100 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.101 +
   1.102 +	if (iTestStepResult != EPass)
   1.103 +		{
   1.104 +		return EInconclusive;
   1.105 +		}
   1.106 +	
   1.107 +	// reset the value as previous test is pass
   1.108 +	iTestStepResult = EFail;  
   1.109 +	
   1.110 +	// KUidCustomInterfaceDevSoundAacConfig
   1.111 +	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
   1.112 +
   1.113 +	if (ptr)
   1.114 +		{
   1.115 +		MAacDecoderConfig::TAudioConfig audioConfig;
   1.116 +
   1.117 +		// Set values before call.
   1.118 +		audioConfig.iAudioObjectType = MAacDecoderConfig::TAudioConfig::EAacSsr;
   1.119 +		
   1.120 +		result = ptr->SetAudioConfig(audioConfig); // call method
   1.121 +		
   1.122 +		if (result == KErrNone)
   1.123 +			{
   1.124 +			TInt retAudioConfig;
   1.125 +
   1.126 +			// This file is created by the test stub, the plugin device
   1.127 +			_LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
   1.128 +
   1.129 +			ReadFileL(KFileName, retAudioConfig);
   1.130 +
   1.131 +			if (retAudioConfig == audioConfig.iAudioObjectType)
   1.132 +				{
   1.133 +				INFO_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig finished successfully"));
   1.134 +
   1.135 +				iTestStepResult = EPass;
   1.136 +				}
   1.137 +			else
   1.138 +				{
   1.139 +				ERR_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig failed - expected and received mismatch"));
   1.140 +				}
   1.141 +			}
   1.142 +		}
   1.143 +	else
   1.144 +		{
   1.145 +		INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
   1.146 +		iTestStepResult = EInconclusive;
   1.147 +		}
   1.148 +
   1.149 +	return iTestStepResult;	
   1.150 +	}
   1.151 +
   1.152 +
   1.153 +TVerdict CTestStepCIAacDecoderConfig::DoTestStep0093L()
   1.154 +	{
   1.155 +	iTestStepResult = EFail;
   1.156 +	TInt result = KErrGeneral;	
   1.157 +
   1.158 +	INFO_PRINTF1(_L("AacDecoderConfig - GetSupportedAudioConfigs"));
   1.159 +
   1.160 +	//Initialize - with the UID of our test HwDevice
   1.161 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.162 +	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
   1.163 +	#else
   1.164 +	TFourCC testUID('T','0','0','8');
   1.165 +	#endif
   1.166 +	
   1.167 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.168 +
   1.169 +	if (iTestStepResult != EPass)
   1.170 +		{
   1.171 +		return EInconclusive;
   1.172 +		}
   1.173 +	
   1.174 +	// reset the value as previous test is pass
   1.175 +	iTestStepResult = EFail;  
   1.176 +	
   1.177 +	// KUidCustomInterfaceDevSoundAacConfig
   1.178 +	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
   1.179 +
   1.180 +	if (ptr)
   1.181 +		{
   1.182 +		RArray<MAacDecoderConfig::TAudioConfig> audioConfig;
   1.183 +		
   1.184 +		result = ptr->GetSupportedAudioConfigs(audioConfig); // call method
   1.185 +		
   1.186 +		if (result == KErrNone)
   1.187 +			{
   1.188 +			if ( (audioConfig[0].iAudioObjectType == MAacDecoderConfig::TAudioConfig::ESbr)		&&
   1.189 +				 (audioConfig[1].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLtp)	&&
   1.190 +				 (audioConfig[2].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacSsr)	&&
   1.191 +				 (audioConfig[3].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLc)	&&
   1.192 +				 (audioConfig[4].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacMain) )
   1.193 +				{
   1.194 +				INFO_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs finished successfully"));
   1.195 +
   1.196 +				iTestStepResult = EPass;
   1.197 +				}
   1.198 +			else
   1.199 +				{
   1.200 +				ERR_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed - expected and received mismatch"));
   1.201 +				}
   1.202 +			}
   1.203 +		else
   1.204 +			{
   1.205 +			ERR_PRINTF2(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed with result %d"), result);
   1.206 +			}		
   1.207 +		}
   1.208 +	else
   1.209 +		{
   1.210 +		INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
   1.211 +		iTestStepResult = EInconclusive;
   1.212 +		}
   1.213 +
   1.214 +	return iTestStepResult;	
   1.215 +	}