os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciilbcdecoderconfig.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/teststepciilbcdecoderconfig.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,329 @@
     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 "teststepciilbcdecoderconfig.h"
    1.20 +
    1.21 +
    1.22 +TVerdict CTestStepCIIlbcDecoderConfig::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-0054-HP")) == 0)
    1.29 +		{
    1.30 +		iTestStepResult = DoTestStep0054L();
    1.31 +		}
    1.32 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0055-HP")) == 0)
    1.33 +		{
    1.34 +		iTestStepResult = DoTestStep0055L();
    1.35 +		}
    1.36 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0056-HP")) == 0)
    1.37 +		{
    1.38 +		iTestStepResult = DoTestStep0056L();
    1.39 +		}
    1.40 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0057-HP")) == 0)
    1.41 +		{
    1.42 +		iTestStepResult = DoTestStep0057L();
    1.43 +		}
    1.44 +
    1.45 +	return iTestStepResult;
    1.46 +	}
    1.47 +
    1.48 +
    1.49 +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0054L()
    1.50 +	{
    1.51 +	iTestStepResult = EFail;
    1.52 +	
    1.53 +	INFO_PRINTF1(_L("IlbcDecoderIntfc - Instantiating"));
    1.54 +
    1.55 +	//Initialize - with the UID of our test HwDevice
    1.56 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.57 +	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
    1.58 +	#else
    1.59 +	TFourCC testUID('T','0','1','7');
    1.60 +	#endif
    1.61 +
    1.62 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    1.63 +
    1.64 +	if (iTestStepResult != EPass)
    1.65 +		{
    1.66 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    1.67 +		return EInconclusive;
    1.68 +		}
    1.69 +
    1.70 +	// reset the value as previous test is pass
    1.71 +	iTestStepResult = EFail;  
    1.72 +
    1.73 +	// KUidIlbcDecoderIntfc
    1.74 +	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
    1.75 +
    1.76 +	if (ptr)
    1.77 +		{
    1.78 +		INFO_PRINTF1(_L("MIlbcDecoderIntfc instantiated successfully"));
    1.79 +
    1.80 +		iTestStepResult = EPass;
    1.81 +		}
    1.82 +	else
    1.83 +		{
    1.84 +		ERR_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
    1.85 +		}
    1.86 +
    1.87 +	return iTestStepResult;
    1.88 +	}
    1.89 +
    1.90 +
    1.91 +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0055L()
    1.92 +	{
    1.93 +	iTestStepResult = EFail;
    1.94 +	TInt result = KErrGeneral;
    1.95 +
    1.96 +	INFO_PRINTF1(_L("IlbcDecoderIntfc - SetDecoderMode"));
    1.97 +
    1.98 +	//Initialize - with the UID of our test HwDevice
    1.99 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.100 +	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
   1.101 +	#else
   1.102 +	TFourCC testUID('T','0','1','7');
   1.103 +	#endif
   1.104 +	
   1.105 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.106 +
   1.107 +	if (iTestStepResult != EPass)
   1.108 +		{
   1.109 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.110 +		return EInconclusive;
   1.111 +		}
   1.112 +
   1.113 +	// reset the value as previous test is pass
   1.114 +	iTestStepResult = EFail;  
   1.115 +
   1.116 +	// KUidIlbcDecoderIntfc
   1.117 +	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
   1.118 +
   1.119 +	if (ptr)
   1.120 +		{
   1.121 +		MIlbcDecoderIntfc::TDecodeMode decodeMode = MIlbcDecoderIntfc::E30msFrame;
   1.122 +		TInt setDecodeMode = MIlbcDecoderIntfc::E20msFrame;
   1.123 +
   1.124 +		result = ptr->SetDecoderMode(decodeMode); // call method
   1.125 +
   1.126 +		// This file is created by the test stub, the plugin device
   1.127 +		_LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt");
   1.128 +
   1.129 +		ReadFileL(KFileName, setDecodeMode);
   1.130 +
   1.131 +		if (result == KErrNone)
   1.132 +			{
   1.133 +			if (static_cast<MIlbcDecoderIntfc::TDecodeMode>(setDecodeMode) == decodeMode)
   1.134 +				{
   1.135 +				INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetDecoderMode finished successfully"));
   1.136 +
   1.137 +				iTestStepResult = EPass;
   1.138 +				}
   1.139 +			else
   1.140 +				{
   1.141 +				ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with decodeMode %d"), decodeMode);
   1.142 +				}
   1.143 +			}
   1.144 +		else
   1.145 +			{
   1.146 +			ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with error %d"), result);
   1.147 +			}
   1.148 +		}
   1.149 +	else
   1.150 +		{
   1.151 +		INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
   1.152 +		iTestStepResult = EInconclusive;
   1.153 +		}
   1.154 +
   1.155 +	return iTestStepResult;
   1.156 +	}
   1.157 +
   1.158 +
   1.159 +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0056L()
   1.160 +	{
   1.161 +	iTestStepResult = EFail;
   1.162 +	TInt result = KErrGeneral;
   1.163 +
   1.164 +	INFO_PRINTF1(_L("IlbcDecoderIntfc - SetComfortNoiseGeneration"));
   1.165 +
   1.166 +	//Initialize - with the UID of our test HwDevice
   1.167 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.168 +	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
   1.169 +	#else
   1.170 +	TFourCC testUID('T','0','1','7');
   1.171 +	#endif
   1.172 +	
   1.173 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.174 +
   1.175 +	if (iTestStepResult != EPass)
   1.176 +		{
   1.177 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.178 +		return EInconclusive;
   1.179 +		}
   1.180 +
   1.181 +	// reset the value as previous test is pass
   1.182 +	iTestStepResult = EFail;  
   1.183 +
   1.184 +	// KUidIlbcDecoderIntfc
   1.185 +	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
   1.186 +
   1.187 +	if (ptr)
   1.188 +		{
   1.189 +		TBool cng = ETrue;
   1.190 +
   1.191 +		result = ptr->SetComfortNoiseGeneration(cng); // call method
   1.192 +		
   1.193 +		if (result == KErrNone)
   1.194 +			{
   1.195 +			INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   1.196 +
   1.197 +			result = ptr->GetComfortNoiseGeneration(cng);
   1.198 +
   1.199 +			if ( (result == KErrNone) && cng)
   1.200 +				{
   1.201 +				INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.202 +
   1.203 +				result = ptr->SetComfortNoiseGeneration(EFalse);
   1.204 +
   1.205 +				if (result == KErrNone)
   1.206 +					{
   1.207 +					INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   1.208 +
   1.209 +					result = ptr->GetComfortNoiseGeneration(cng);
   1.210 +
   1.211 +					if ( (result == KErrNone) && !cng)
   1.212 +						{
   1.213 +						INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.214 +
   1.215 +						iTestStepResult = EPass;
   1.216 +						}
   1.217 +					else
   1.218 +						{
   1.219 +						ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   1.220 +						}
   1.221 +					}
   1.222 +				else
   1.223 +					{
   1.224 +					ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   1.225 +					}
   1.226 +				}
   1.227 +			else
   1.228 +				{
   1.229 +				ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   1.230 +				}
   1.231 +			}
   1.232 +		else
   1.233 +			{
   1.234 +			ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   1.235 +			}
   1.236 +		}
   1.237 +	else
   1.238 +		{
   1.239 +		INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
   1.240 +		iTestStepResult = EInconclusive;
   1.241 +		}
   1.242 +
   1.243 +	return iTestStepResult;
   1.244 +	}
   1.245 +
   1.246 +
   1.247 +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0057L()
   1.248 +	{
   1.249 +	iTestStepResult = EFail;
   1.250 +	TInt result = KErrGeneral;
   1.251 +
   1.252 +	INFO_PRINTF1(_L("IlbcDecoderIntfc - GetComfortNoiseGeneration"));
   1.253 +
   1.254 +	//Initialize - with the UID of our test HwDevice
   1.255 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.256 +	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
   1.257 +	#else
   1.258 +	TFourCC testUID('T','0','1','7');
   1.259 +	#endif
   1.260 +	
   1.261 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.262 +
   1.263 +	if (iTestStepResult != EPass)
   1.264 +		{
   1.265 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.266 +		return EInconclusive;
   1.267 +		}
   1.268 +
   1.269 +	// reset the value as previous test is pass
   1.270 +	iTestStepResult = EFail;  
   1.271 +
   1.272 +	// KUidIlbcDecoderIntfc
   1.273 +	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
   1.274 +
   1.275 +	if (ptr)
   1.276 +		{
   1.277 +		TBool cng = ETrue;
   1.278 +
   1.279 +		result = ptr->SetComfortNoiseGeneration(cng); // call method
   1.280 +		
   1.281 +		if (result == KErrNone)
   1.282 +			{
   1.283 +			INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetCng finished successfully"));
   1.284 +			
   1.285 +			result = ptr->GetComfortNoiseGeneration(cng);
   1.286 +
   1.287 +			if ( (result == KErrNone) && cng)
   1.288 +				{
   1.289 +				INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.290 +				
   1.291 +				result = ptr->SetComfortNoiseGeneration(EFalse);
   1.292 +				
   1.293 +				if (result == KErrNone)
   1.294 +					{
   1.295 +					INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   1.296 +					
   1.297 +					result = ptr->GetComfortNoiseGeneration(cng);
   1.298 +
   1.299 +					if ( (result == KErrNone) && !cng)
   1.300 +						{
   1.301 +						INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   1.302 +						
   1.303 +						iTestStepResult = EPass;
   1.304 +						}
   1.305 +					else
   1.306 +						{
   1.307 +						ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   1.308 +						}
   1.309 +					}
   1.310 +				else
   1.311 +					{
   1.312 +					ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   1.313 +					}
   1.314 +				}
   1.315 +			else
   1.316 +				{
   1.317 +				ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetCng failed with result %d  cng %d"), result, cng);
   1.318 +				}
   1.319 +			}
   1.320 +		else
   1.321 +			{
   1.322 +			ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetCng failed with result %d"), result);
   1.323 +			}
   1.324 +		}
   1.325 +	else
   1.326 +		{
   1.327 +		INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
   1.328 +		iTestStepResult = EInconclusive;
   1.329 +		}
   1.330 +
   1.331 +	return iTestStepResult;
   1.332 +	}