os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcispeechencoderconfig.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/teststepcispeechencoderconfig.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,206 @@
     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 "teststepcispeechencoderconfig.h"
    1.20 +
    1.21 +
    1.22 +TVerdict CTestStepCISpeechEncoderConfig::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-0001-HP")) == 0)
    1.29 +		{
    1.30 +		iTestStepResult = DoTestStep0001L();
    1.31 +		}
    1.32 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0002-HP")) == 0)
    1.33 +		{
    1.34 +		iTestStepResult = DoTestStep0002L();
    1.35 +		}
    1.36 +	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0003-HP")) == 0)
    1.37 +		{
    1.38 +		iTestStepResult = DoTestStep0003L();
    1.39 +		}
    1.40 +
    1.41 +	return iTestStepResult;
    1.42 +	}
    1.43 +
    1.44 +
    1.45 +TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0001L()
    1.46 +	{
    1.47 +	iTestStepResult = EFail;
    1.48 +
    1.49 +	INFO_PRINTF1(_L("SpeechEncoderConfig - Instantiating"));
    1.50 +
    1.51 +	//Initialize - with the UID of our test HwDevice
    1.52 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.53 +	TUid testUID = {KUidSpeechEncoderConfigTestDevice};
    1.54 +	#else
    1.55 +	TFourCC testUID('T','0','1','4');
    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 +	// KUidSpeechEncoderConfig
    1.70 +	MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
    1.71 +
    1.72 +	if (ptr)
    1.73 +		{
    1.74 +		INFO_PRINTF1(_L("MSpeechEncoderConfig instantiated successfully"));
    1.75 +
    1.76 +		iTestStepResult = EPass;
    1.77 +		}
    1.78 +	else
    1.79 +		{
    1.80 +		ERR_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
    1.81 +		}
    1.82 +
    1.83 +	return iTestStepResult;
    1.84 +	}
    1.85 +
    1.86 +
    1.87 +TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0002L()
    1.88 +	{
    1.89 +	iTestStepResult = EFail;
    1.90 +	TInt result = KErrGeneral;
    1.91 +
    1.92 +	INFO_PRINTF1(_L("SpeechEncoderConfig - SetVadMode"));
    1.93 +
    1.94 +	//Initialize - with the UID of our test HwDevice
    1.95 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    1.96 +	TUid testUID = {KUidSpeechEncoderConfigTestDevice};
    1.97 +	#else
    1.98 +	TFourCC testUID('T','0','1','4');
    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 +	// KUidSpeechEncoderConfig
   1.113 +	MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
   1.114 +
   1.115 +	if (ptr)
   1.116 +		{
   1.117 +		TBool vadModeOn = EFalse;
   1.118 +
   1.119 +		result = ptr->SetVadMode(vadModeOn); // call method
   1.120 +		
   1.121 +		if (result == KErrNone)
   1.122 +			{
   1.123 +			INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully"));
   1.124 +
   1.125 +			iTestStepResult = EPass;
   1.126 +			}
   1.127 +		else
   1.128 +			{
   1.129 +			ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result);
   1.130 +			}
   1.131 +		}
   1.132 +	else
   1.133 +		{
   1.134 +		INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
   1.135 +		iTestStepResult = EInconclusive;
   1.136 +		}
   1.137 +
   1.138 +	return iTestStepResult;
   1.139 +	}
   1.140 +
   1.141 +
   1.142 +TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0003L()
   1.143 +	{
   1.144 +	iTestStepResult = EFail;
   1.145 +	TInt result = KErrGeneral;
   1.146 +
   1.147 +	INFO_PRINTF1(_L("SpeechEncoderConfig - GetVadMode"));
   1.148 +
   1.149 +	//Initialize - with the UID of our test HwDevice
   1.150 +	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   1.151 +	TUid testUID = {KUidSpeechEncoderConfigTestDevice};
   1.152 +	#else
   1.153 +	TFourCC testUID('T','0','1','4');
   1.154 +	#endif
   1.155 +	
   1.156 +	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   1.157 +
   1.158 +	if (iTestStepResult != EPass)
   1.159 +		{
   1.160 +		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   1.161 +		return EInconclusive;
   1.162 +		}
   1.163 +
   1.164 +	// reset the value as previous test is pass
   1.165 +	iTestStepResult = EFail;
   1.166 +
   1.167 +	// KUidSpeechEncoderConfig
   1.168 +	MSpeechEncoderConfig* ptr = static_cast <MSpeechEncoderConfig*> (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig));
   1.169 +
   1.170 +	if (ptr)
   1.171 +		{
   1.172 +		TBool vadModeOn = ETrue;
   1.173 +
   1.174 +		result = ptr->SetVadMode(vadModeOn); // call method
   1.175 +		
   1.176 +		if (result == KErrNone)
   1.177 +			{
   1.178 +			INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully"));
   1.179 +
   1.180 +			result = ptr->GetVadMode(vadModeOn);
   1.181 +			
   1.182 +			if ( (result == KErrNone) && vadModeOn )
   1.183 +				{
   1.184 +				INFO_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode finished successfully"));
   1.185 +
   1.186 +				iTestStepResult = EPass;
   1.187 +				}
   1.188 +			else if (result != KErrNone)
   1.189 +				{
   1.190 +				INFO_PRINTF2(_L("MSpeechEncoderConfig::GetVadMode failed with error %d"), result);
   1.191 +				}
   1.192 +			else
   1.193 +				{
   1.194 +				ERR_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode failed - expected and received mismatch"));
   1.195 +				}
   1.196 +			}
   1.197 +		else
   1.198 +			{
   1.199 +			ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result);
   1.200 +			}
   1.201 +		}
   1.202 +	else
   1.203 +		{
   1.204 +		INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface"));
   1.205 +		iTestStepResult = EInconclusive;
   1.206 +		}
   1.207 +
   1.208 +	return iTestStepResult;
   1.209 +	}