os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig729encoderconfig.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 "teststepcig729encoderconfig.h"
19 TVerdict CTestStepCIG729EncoderConfig::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0051-HP")) == 0)
27 iTestStepResult = DoTestStep0051L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0052-HP")) == 0)
31 iTestStepResult = DoTestStep0052L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0053-HP")) == 0)
35 iTestStepResult = DoTestStep0053L();
38 return iTestStepResult;
42 TVerdict CTestStepCIG729EncoderConfig::DoTestStep0051L()
44 iTestStepResult = EFail;
46 INFO_PRINTF1(_L("G729EncoderIntfc - Instantiating"));
48 //Initialize - with the UID of our test HwDevice
49 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
50 TUid testUID = {KUidG729EncoderConfigTestDevice};
52 TFourCC testUID('T','0','1','0');
55 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
57 if (iTestStepResult != EPass)
59 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
63 // reset the value as previous test is pass
64 iTestStepResult = EFail;
66 // KUidG729EncoderIntfc
67 MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
71 INFO_PRINTF1(_L("MG729EncoderIntfc instantiated successfully"));
73 iTestStepResult = EPass;
77 ERR_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
80 return iTestStepResult;
84 TVerdict CTestStepCIG729EncoderConfig::DoTestStep0052L()
86 iTestStepResult = EFail;
87 TInt result = KErrGeneral;
89 INFO_PRINTF1(_L("G729EncoderIntfc - SetVadMode"));
91 //Initialize - with the UID of our test HwDevice
92 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
93 TUid testUID = {KUidG729EncoderConfigTestDevice};
95 TFourCC testUID('T','0','1','0');
98 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
100 if (iTestStepResult != EPass)
102 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
103 return EInconclusive;
106 // reset the value as previous test is pass
107 iTestStepResult = EFail;
109 // KUidG729EncoderIntfc
110 MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
114 TBool vadModeOn = EFalse;
116 result = ptr->SetVadMode(ETrue); // call method
118 if (result == KErrNone)
120 result = ptr->GetVadMode(vadModeOn);
122 if ( (result == KErrNone) && vadModeOn)
124 INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
129 ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
134 ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
139 INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
140 iTestStepResult = EInconclusive;
143 return iTestStepResult;
147 TVerdict CTestStepCIG729EncoderConfig::DoTestStep0053L()
149 iTestStepResult = EFail;
150 TInt result = KErrGeneral;
152 INFO_PRINTF1(_L("G729EncoderIntfc - GetVadMode"));
154 //Initialize - with the UID of our test HwDevice
155 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
156 TUid testUID = {KUidG729EncoderConfigTestDevice};
158 TFourCC testUID('T','0','1','0');
161 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
163 if (iTestStepResult != EPass)
165 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
166 return EInconclusive;
169 // reset the value as previous test is pass
170 iTestStepResult = EFail;
172 // KUidG729EncoderIntfc
173 MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
177 TBool vadModeOn = EFalse;
179 result = ptr->SetVadMode(ETrue); // call method
181 if (result == KErrNone)
183 INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully"));
185 result = ptr->GetVadMode(vadModeOn);
187 if ( (result == KErrNone) && vadModeOn)
189 INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
191 result = ptr->SetVadMode(EFalse);
193 if (result == KErrNone)
195 INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully"));
197 result = ptr->GetVadMode(vadModeOn);
199 if ( (result == KErrNone) && !vadModeOn)
201 INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
203 iTestStepResult = EPass;
207 ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
212 ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
217 ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
222 ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
227 INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
228 iTestStepResult = EInconclusive;
231 return iTestStepResult;