os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaacdecoderconfig.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "teststepciaacdecoderconfig.h"
19 TVerdict CTestStepCIAacDecoderConfig::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0004-HP")) == 0)
27 iTestStepResult = DoTestStep0004L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0005-HP")) == 0)
31 iTestStepResult = DoTestStep0005L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0093-HP")) == 0)
35 iTestStepResult = DoTestStep0093L();
38 return iTestStepResult;
42 TVerdict CTestStepCIAacDecoderConfig::DoTestStep0004L()
44 iTestStepResult = EFail;
46 INFO_PRINTF1(_L("AacDecoderConfig - Instantiating"));
48 //Initialize - with the UID of our test HwDevice
49 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
50 TUid testUID = {KUidAacDecoderConfigTestDevice};
52 TFourCC testUID('T','0','0','8');
55 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
57 if (iTestStepResult != EPass)
62 // reset the value as previous test is pass
63 iTestStepResult = EFail;
65 // KUidCustomInterfaceDevSoundAacConfig
66 MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
70 INFO_PRINTF1(_L("MAacDecoderConfig initialized successfully"));
72 iTestStepResult = EPass;
76 ERR_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
79 return iTestStepResult;
83 TVerdict CTestStepCIAacDecoderConfig::DoTestStep0005L()
85 iTestStepResult = EFail;
86 TInt result = KErrGeneral;
88 INFO_PRINTF1(_L("AacDecoderConfig - SetAudioConfig"));
90 //Initialize - with the UID of our test HwDevice
91 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
92 TUid testUID = {KUidAacDecoderConfigTestDevice};
94 TFourCC testUID('T','0','0','8');
97 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
99 if (iTestStepResult != EPass)
101 return EInconclusive;
104 // reset the value as previous test is pass
105 iTestStepResult = EFail;
107 // KUidCustomInterfaceDevSoundAacConfig
108 MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
112 MAacDecoderConfig::TAudioConfig audioConfig;
114 // Set values before call.
115 audioConfig.iAudioObjectType = MAacDecoderConfig::TAudioConfig::EAacSsr;
117 result = ptr->SetAudioConfig(audioConfig); // call method
119 if (result == KErrNone)
123 // This file is created by the test stub, the plugin device
124 _LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
126 ReadFileL(KFileName, retAudioConfig);
128 if (retAudioConfig == audioConfig.iAudioObjectType)
130 INFO_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig finished successfully"));
132 iTestStepResult = EPass;
136 ERR_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig failed - expected and received mismatch"));
142 INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
143 iTestStepResult = EInconclusive;
146 return iTestStepResult;
150 TVerdict CTestStepCIAacDecoderConfig::DoTestStep0093L()
152 iTestStepResult = EFail;
153 TInt result = KErrGeneral;
155 INFO_PRINTF1(_L("AacDecoderConfig - GetSupportedAudioConfigs"));
157 //Initialize - with the UID of our test HwDevice
158 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
159 TUid testUID = {KUidAacDecoderConfigTestDevice};
161 TFourCC testUID('T','0','0','8');
164 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
166 if (iTestStepResult != EPass)
168 return EInconclusive;
171 // reset the value as previous test is pass
172 iTestStepResult = EFail;
174 // KUidCustomInterfaceDevSoundAacConfig
175 MAacDecoderConfig* ptr = static_cast <MAacDecoderConfig*> (iMMFDevSound->CustomInterface(KUidAacDecoderConfig));
179 RArray<MAacDecoderConfig::TAudioConfig> audioConfig;
181 result = ptr->GetSupportedAudioConfigs(audioConfig); // call method
183 if (result == KErrNone)
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) )
191 INFO_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs finished successfully"));
193 iTestStepResult = EPass;
197 ERR_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed - expected and received mismatch"));
202 ERR_PRINTF2(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed with result %d"), result);
207 INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize"));
208 iTestStepResult = EInconclusive;
211 return iTestStepResult;