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