os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciilbcdecoderconfig.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 "teststepciilbcdecoderconfig.h"
19 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0054-HP")) == 0)
27 iTestStepResult = DoTestStep0054L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0055-HP")) == 0)
31 iTestStepResult = DoTestStep0055L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0056-HP")) == 0)
35 iTestStepResult = DoTestStep0056L();
37 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0057-HP")) == 0)
39 iTestStepResult = DoTestStep0057L();
42 return iTestStepResult;
46 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0054L()
48 iTestStepResult = EFail;
50 INFO_PRINTF1(_L("IlbcDecoderIntfc - Instantiating"));
52 //Initialize - with the UID of our test HwDevice
53 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
54 TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
56 TFourCC testUID('T','0','1','7');
59 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
61 if (iTestStepResult != EPass)
63 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
67 // reset the value as previous test is pass
68 iTestStepResult = EFail;
70 // KUidIlbcDecoderIntfc
71 MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
75 INFO_PRINTF1(_L("MIlbcDecoderIntfc instantiated successfully"));
77 iTestStepResult = EPass;
81 ERR_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
84 return iTestStepResult;
88 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0055L()
90 iTestStepResult = EFail;
91 TInt result = KErrGeneral;
93 INFO_PRINTF1(_L("IlbcDecoderIntfc - SetDecoderMode"));
95 //Initialize - with the UID of our test HwDevice
96 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
97 TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
99 TFourCC testUID('T','0','1','7');
102 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
104 if (iTestStepResult != EPass)
106 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
107 return EInconclusive;
110 // reset the value as previous test is pass
111 iTestStepResult = EFail;
113 // KUidIlbcDecoderIntfc
114 MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
118 MIlbcDecoderIntfc::TDecodeMode decodeMode = MIlbcDecoderIntfc::E30msFrame;
119 TInt setDecodeMode = MIlbcDecoderIntfc::E20msFrame;
121 result = ptr->SetDecoderMode(decodeMode); // call method
123 // This file is created by the test stub, the plugin device
124 _LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt");
126 ReadFileL(KFileName, setDecodeMode);
128 if (result == KErrNone)
130 if (static_cast<MIlbcDecoderIntfc::TDecodeMode>(setDecodeMode) == decodeMode)
132 INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetDecoderMode finished successfully"));
134 iTestStepResult = EPass;
138 ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with decodeMode %d"), decodeMode);
143 ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with error %d"), result);
148 INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
149 iTestStepResult = EInconclusive;
152 return iTestStepResult;
156 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0056L()
158 iTestStepResult = EFail;
159 TInt result = KErrGeneral;
161 INFO_PRINTF1(_L("IlbcDecoderIntfc - SetComfortNoiseGeneration"));
163 //Initialize - with the UID of our test HwDevice
164 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
165 TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
167 TFourCC testUID('T','0','1','7');
170 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
172 if (iTestStepResult != EPass)
174 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
175 return EInconclusive;
178 // reset the value as previous test is pass
179 iTestStepResult = EFail;
181 // KUidIlbcDecoderIntfc
182 MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
188 result = ptr->SetComfortNoiseGeneration(cng); // call method
190 if (result == KErrNone)
192 INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
194 result = ptr->GetComfortNoiseGeneration(cng);
196 if ( (result == KErrNone) && cng)
198 INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
200 result = ptr->SetComfortNoiseGeneration(EFalse);
202 if (result == KErrNone)
204 INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
206 result = ptr->GetComfortNoiseGeneration(cng);
208 if ( (result == KErrNone) && !cng)
210 INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
212 iTestStepResult = EPass;
216 ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng);
221 ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
226 ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng);
231 ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
236 INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
237 iTestStepResult = EInconclusive;
240 return iTestStepResult;
244 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0057L()
246 iTestStepResult = EFail;
247 TInt result = KErrGeneral;
249 INFO_PRINTF1(_L("IlbcDecoderIntfc - GetComfortNoiseGeneration"));
251 //Initialize - with the UID of our test HwDevice
252 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
253 TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
255 TFourCC testUID('T','0','1','7');
258 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
260 if (iTestStepResult != EPass)
262 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
263 return EInconclusive;
266 // reset the value as previous test is pass
267 iTestStepResult = EFail;
269 // KUidIlbcDecoderIntfc
270 MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
276 result = ptr->SetComfortNoiseGeneration(cng); // call method
278 if (result == KErrNone)
280 INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetCng finished successfully"));
282 result = ptr->GetComfortNoiseGeneration(cng);
284 if ( (result == KErrNone) && cng)
286 INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
288 result = ptr->SetComfortNoiseGeneration(EFalse);
290 if (result == KErrNone)
292 INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
294 result = ptr->GetComfortNoiseGeneration(cng);
296 if ( (result == KErrNone) && !cng)
298 INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
300 iTestStepResult = EPass;
304 ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng);
309 ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
314 ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetCng failed with result %d cng %d"), result, cng);
319 ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetCng failed with result %d"), result);
324 INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
325 iTestStepResult = EInconclusive;
328 return iTestStepResult;