os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaacdecoderconfig.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "teststepciaacdecoderconfig.h"
    17 
    18 
    19 TVerdict CTestStepCIAacDecoderConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 	
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0004-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0004L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0005-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0005L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0093-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0093L();
    36 		}
    37 		
    38 	return iTestStepResult;
    39 	}
    40 
    41 
    42 TVerdict CTestStepCIAacDecoderConfig::DoTestStep0004L()
    43 	{
    44 	iTestStepResult = EFail;
    45 
    46 	INFO_PRINTF1(_L("AacDecoderConfig - Instantiating"));
    47 
    48 	//Initialize - with the UID of our test HwDevice
    49 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    50 	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
    51 	#else
    52 	TFourCC testUID('T','0','0','8');
    53 	#endif
    54 
    55 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    56 	
    57 	if (iTestStepResult != EPass)
    58 		{
    59 		return EInconclusive;
    60 		}
    61 	
    62 	// reset the value as previous test is pass
    63 	iTestStepResult = EFail;  
    64 	
    65 	// KUidCustomInterfaceDevSoundAacConfig
    66 	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
    67 
    68 	if (ptr)
    69 		{
    70 		INFO_PRINTF1(_L("MAacDecoderConfig initialized successfully"));
    71 
    72 		iTestStepResult = EPass;
    73 		}
    74 	else
    75 		{
    76 		ERR_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
    77 		}
    78 		
    79 	return iTestStepResult;
    80 	}
    81 
    82 
    83 TVerdict CTestStepCIAacDecoderConfig::DoTestStep0005L()
    84 	{
    85 	iTestStepResult = EFail;
    86 	TInt result = KErrGeneral;	
    87 
    88 	INFO_PRINTF1(_L("AacDecoderConfig - SetAudioConfig"));
    89 
    90 	//Initialize - with the UID of our test HwDevice
    91 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    92 	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
    93 	#else
    94 	TFourCC testUID('T','0','0','8');
    95 	#endif
    96 	
    97 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    98 
    99 	if (iTestStepResult != EPass)
   100 		{
   101 		return EInconclusive;
   102 		}
   103 	
   104 	// reset the value as previous test is pass
   105 	iTestStepResult = EFail;  
   106 	
   107 	// KUidCustomInterfaceDevSoundAacConfig
   108 	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
   109 
   110 	if (ptr)
   111 		{
   112 		MAacDecoderConfig::TAudioConfig audioConfig;
   113 
   114 		// Set values before call.
   115 		audioConfig.iAudioObjectType = MAacDecoderConfig::TAudioConfig::EAacSsr;
   116 		
   117 		result = ptr->SetAudioConfig(audioConfig); // call method
   118 		
   119 		if (result == KErrNone)
   120 			{
   121 			TInt retAudioConfig;
   122 
   123 			// This file is created by the test stub, the plugin device
   124 			_LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
   125 
   126 			ReadFileL(KFileName, retAudioConfig);
   127 
   128 			if (retAudioConfig == audioConfig.iAudioObjectType)
   129 				{
   130 				INFO_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig finished successfully"));
   131 
   132 				iTestStepResult = EPass;
   133 				}
   134 			else
   135 				{
   136 				ERR_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig failed - expected and received mismatch"));
   137 				}
   138 			}
   139 		}
   140 	else
   141 		{
   142 		INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
   143 		iTestStepResult = EInconclusive;
   144 		}
   145 
   146 	return iTestStepResult;	
   147 	}
   148 
   149 
   150 TVerdict CTestStepCIAacDecoderConfig::DoTestStep0093L()
   151 	{
   152 	iTestStepResult = EFail;
   153 	TInt result = KErrGeneral;	
   154 
   155 	INFO_PRINTF1(_L("AacDecoderConfig - GetSupportedAudioConfigs"));
   156 
   157 	//Initialize - with the UID of our test HwDevice
   158 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   159 	TUid testUID = {KUidAacDecoderConfigTestDevice}; 
   160 	#else
   161 	TFourCC testUID('T','0','0','8');
   162 	#endif
   163 	
   164 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   165 
   166 	if (iTestStepResult != EPass)
   167 		{
   168 		return EInconclusive;
   169 		}
   170 	
   171 	// reset the value as previous test is pass
   172 	iTestStepResult = EFail;  
   173 	
   174 	// KUidCustomInterfaceDevSoundAacConfig
   175 	MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
   176 
   177 	if (ptr)
   178 		{
   179 		RArray<MAacDecoderConfig::TAudioConfig> audioConfig;
   180 		
   181 		result = ptr->GetSupportedAudioConfigs(audioConfig); // call method
   182 		
   183 		if (result == KErrNone)
   184 			{
   185 			if ( (audioConfig[0].iAudioObjectType == MAacDecoderConfig::TAudioConfig::ESbr)		&&
   186 				 (audioConfig[1].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLtp)	&&
   187 				 (audioConfig[2].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacSsr)	&&
   188 				 (audioConfig[3].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLc)	&&
   189 				 (audioConfig[4].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacMain) )
   190 				{
   191 				INFO_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs finished successfully"));
   192 
   193 				iTestStepResult = EPass;
   194 				}
   195 			else
   196 				{
   197 				ERR_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed - expected and received mismatch"));
   198 				}
   199 			}
   200 		else
   201 			{
   202 			ERR_PRINTF2(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed with result %d"), result);
   203 			}		
   204 		}
   205 	else
   206 		{
   207 		INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
   208 		iTestStepResult = EInconclusive;
   209 		}
   210 
   211 	return iTestStepResult;	
   212 	}