os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig729encoderconfig.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/teststepcig729encoderconfig.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,232 @@
     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 "teststepcig729encoderconfig.h"
    1.20 +
    1.21 +
    1.22 +TVerdict CTestStepCIG729EncoderConfig::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-0051-HP")) == 0)
    1.29 +		{
    1.30 +		iTestStepResult = DoTestStep0051L();
    1.31 +		}
    1.32 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0052-HP")) == 0)
    1.33 +		{
    1.34 +		iTestStepResult = DoTestStep0052L();
    1.35 +		}
    1.36 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0053-HP")) == 0)
    1.37 +		{
    1.38 +		iTestStepResult = DoTestStep0053L();
    1.39 +		}
    1.40 +
    1.41 +	return iTestStepResult;
    1.42 +	}
    1.43 +
    1.44 +
    1.45 +TVerdict CTestStepCIG729EncoderConfig::DoTestStep0051L()
    1.46 +	{
    1.47 +	iTestStepResult = EFail;
    1.48 +
    1.49 +	INFO_PRINTF1(_L("G729EncoderIntfc - Instantiating"));
    1.50 +
    1.51 +	//Initialize - with the UID of our test HwDevice
    1.52 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.53 +	TUid testUID = {KUidG729EncoderConfigTestDevice};
    1.54 +	#else
    1.55 +	TFourCC testUID('T','0','1','0');
    1.56 +	#endif
    1.57 +
    1.58 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    1.59 +
    1.60 +	if (iTestStepResult != EPass)
    1.61 +		{
    1.62 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    1.63 +		return EInconclusive;
    1.64 +		}
    1.65 +
    1.66 +	// reset the value as previous test is pass
    1.67 +	iTestStepResult = EFail;  
    1.68 +
    1.69 +	// KUidG729EncoderIntfc
    1.70 +	MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
    1.71 +
    1.72 +	if (ptr)
    1.73 +		{
    1.74 +		INFO_PRINTF1(_L("MG729EncoderIntfc instantiated successfully"));
    1.75 +
    1.76 +		iTestStepResult = EPass;
    1.77 +		}
    1.78 +	else
    1.79 +		{
    1.80 +		ERR_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
    1.81 +		}
    1.82 +
    1.83 +	return iTestStepResult;
    1.84 +	}
    1.85 +
    1.86 +
    1.87 +TVerdict CTestStepCIG729EncoderConfig::DoTestStep0052L()
    1.88 +	{
    1.89 +	iTestStepResult = EFail;
    1.90 +	TInt result = KErrGeneral;
    1.91 +
    1.92 +	INFO_PRINTF1(_L("G729EncoderIntfc - SetVadMode"));
    1.93 +
    1.94 +	//Initialize - with the UID of our test HwDevice
    1.95 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.96 +	TUid testUID = {KUidG729EncoderConfigTestDevice};
    1.97 +	#else
    1.98 +	TFourCC testUID('T','0','1','0');
    1.99 +	#endif
   1.100 +	
   1.101 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.102 +
   1.103 +	if (iTestStepResult != EPass)
   1.104 +		{
   1.105 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.106 +		return EInconclusive;
   1.107 +		}
   1.108 +
   1.109 +	// reset the value as previous test is pass
   1.110 +	iTestStepResult = EFail;
   1.111 +
   1.112 +	// KUidG729EncoderIntfc
   1.113 +	MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
   1.114 +
   1.115 +	if (ptr)
   1.116 +		{
   1.117 +		TBool vadModeOn = EFalse;
   1.118 +
   1.119 +		result = ptr->SetVadMode(ETrue); // call method
   1.120 +		
   1.121 +		if (result == KErrNone)
   1.122 +			{
   1.123 +			result = ptr->GetVadMode(vadModeOn);
   1.124 +
   1.125 +			if ( (result == KErrNone) && vadModeOn)
   1.126 +				{
   1.127 +				INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
   1.128 +				return EPass;
   1.129 +				}
   1.130 +			else
   1.131 +				{
   1.132 +				ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   1.133 +				}
   1.134 +			}
   1.135 +		else
   1.136 +			{
   1.137 +			ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
   1.138 +			}
   1.139 +		}
   1.140 +	else
   1.141 +		{
   1.142 +		INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
   1.143 +		iTestStepResult = EInconclusive;
   1.144 +		}
   1.145 +
   1.146 +	return iTestStepResult;
   1.147 +	}
   1.148 +
   1.149 +
   1.150 +TVerdict CTestStepCIG729EncoderConfig::DoTestStep0053L()
   1.151 +	{
   1.152 +	iTestStepResult = EFail;
   1.153 +	TInt result = KErrGeneral;
   1.154 +
   1.155 +	INFO_PRINTF1(_L("G729EncoderIntfc - GetVadMode"));
   1.156 +
   1.157 +	//Initialize - with the UID of our test HwDevice
   1.158 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.159 +	TUid testUID = {KUidG729EncoderConfigTestDevice};
   1.160 +	#else
   1.161 +	TFourCC testUID('T','0','1','0');
   1.162 +	#endif
   1.163 +	
   1.164 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.165 +
   1.166 +	if (iTestStepResult != EPass)
   1.167 +		{
   1.168 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.169 +		return EInconclusive;
   1.170 +		}
   1.171 +
   1.172 +	// reset the value as previous test is pass
   1.173 +	iTestStepResult = EFail;
   1.174 +
   1.175 +	// KUidG729EncoderIntfc
   1.176 +	MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
   1.177 +
   1.178 +	if (ptr)
   1.179 +		{
   1.180 +		TBool vadModeOn = EFalse;
   1.181 +		
   1.182 +		result = ptr->SetVadMode(ETrue); // call method
   1.183 +		
   1.184 +		if (result == KErrNone)
   1.185 +			{
   1.186 +			INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully"));
   1.187 +			
   1.188 +			result = ptr->GetVadMode(vadModeOn);
   1.189 +
   1.190 +			if ( (result == KErrNone) && vadModeOn)
   1.191 +				{
   1.192 +				INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
   1.193 +				
   1.194 +				result = ptr->SetVadMode(EFalse);
   1.195 +				
   1.196 +				if (result == KErrNone)
   1.197 +					{
   1.198 +					INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully"));
   1.199 +					
   1.200 +					result = ptr->GetVadMode(vadModeOn);
   1.201 +
   1.202 +					if ( (result == KErrNone) && !vadModeOn)
   1.203 +						{
   1.204 +						INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
   1.205 +
   1.206 +						iTestStepResult = EPass;
   1.207 +						}
   1.208 +					else
   1.209 +						{
   1.210 +						ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   1.211 +						}
   1.212 +					}
   1.213 +				else
   1.214 +					{
   1.215 +					ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
   1.216 +					}
   1.217 +				}
   1.218 +			else
   1.219 +				{
   1.220 +				ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   1.221 +				}
   1.222 +			}
   1.223 +		else
   1.224 +			{
   1.225 +			ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
   1.226 +			}
   1.227 +		}
   1.228 +	else
   1.229 +		{
   1.230 +		INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
   1.231 +		iTestStepResult = EInconclusive;
   1.232 +		}
   1.233 +
   1.234 +	return iTestStepResult;
   1.235 +	}