os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciilbcencoderconfig.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciilbcencoderconfig.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,375 @@
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 "teststepciilbcencoderconfig.h"
1.20 +
1.21 +
1.22 +TVerdict CTestStepCIIlbcEncoderConfig::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-0058-HP")) == 0)
1.29 + {
1.30 + iTestStepResult = DoTestStep0058L();
1.31 + }
1.32 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0059-HP")) == 0)
1.33 + {
1.34 + iTestStepResult = DoTestStep0059L();
1.35 + }
1.36 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0060-HP")) == 0)
1.37 + {
1.38 + iTestStepResult = DoTestStep0060L();
1.39 + }
1.40 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0061-HP")) == 0)
1.41 + {
1.42 + iTestStepResult = DoTestStep0061L();
1.43 + }
1.44 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0096-HP")) == 0)
1.45 + {
1.46 + iTestStepResult = DoTestStep0096L();
1.47 + }
1.48 +
1.49 + return iTestStepResult;
1.50 + }
1.51 +
1.52 +
1.53 +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0058L()
1.54 + {
1.55 + iTestStepResult = EFail;
1.56 +
1.57 + INFO_PRINTF1(_L("IlbcEncoderIntfc - Instantiating"));
1.58 +
1.59 + //Initialize - with the UID of our test HwDevice
1.60 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.61 + TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
1.62 + #else
1.63 + TFourCC testUID('T','0','1','8');
1.64 + #endif
1.65 +
1.66 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.67 +
1.68 + if (iTestStepResult != EPass)
1.69 + {
1.70 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.71 + return EInconclusive;
1.72 + }
1.73 +
1.74 + // reset the value as previous test is pass
1.75 + iTestStepResult = EFail;
1.76 +
1.77 + // KUidCustomInterfaceDevSoundIlbcEncoderConfig
1.78 + MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
1.79 +
1.80 + if (ptr)
1.81 + {
1.82 + INFO_PRINTF1(_L("MIlbcEncoderIntfc instantiated successfully"));
1.83 +
1.84 + iTestStepResult = EPass;
1.85 + }
1.86 + else
1.87 + {
1.88 + ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
1.89 + }
1.90 +
1.91 + return iTestStepResult;
1.92 + }
1.93 +
1.94 +
1.95 +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0059L()
1.96 + {
1.97 + iTestStepResult = EFail;
1.98 + TInt result = KErrGeneral;
1.99 +
1.100 + INFO_PRINTF1(_L("IlbcEncoderIntfc - SetEncoderMode"));
1.101 +
1.102 + //Initialize - with the UID of our test HwDevice
1.103 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.104 + TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
1.105 + #else
1.106 + TFourCC testUID('T','0','1','8');
1.107 + #endif
1.108 +
1.109 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.110 +
1.111 + if (iTestStepResult != EPass)
1.112 + {
1.113 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.114 + return EInconclusive;
1.115 + }
1.116 +
1.117 + // reset the value as previous test is pass
1.118 + iTestStepResult = EFail;
1.119 +
1.120 + // KUidIlbcEncoderIntfc
1.121 + MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
1.122 +
1.123 + if (ptr)
1.124 + {
1.125 + MIlbcEncoderIntfc::TEncodeMode encodeMode = MIlbcEncoderIntfc::E30msFrame;
1.126 +
1.127 + result = ptr->SetEncoderMode(MIlbcEncoderIntfc::E20msFrame); // call method
1.128 +
1.129 + if (result == KErrNone)
1.130 + {
1.131 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetEncoderMode finished successfully"));
1.132 +
1.133 + result = ptr->GetEncoderMode(encodeMode);
1.134 +
1.135 + if (MIlbcEncoderIntfc::E20msFrame == encodeMode)
1.136 + {
1.137 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetEncoderMode finished successfully"));
1.138 +
1.139 + iTestStepResult = EPass;
1.140 + }
1.141 + else
1.142 + {
1.143 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetEncoderMode failed with result %d encodeMode %d"), result, encodeMode);
1.144 + }
1.145 + }
1.146 + else
1.147 + {
1.148 + ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with result %d"), result);
1.149 + }
1.150 + }
1.151 + else
1.152 + {
1.153 + ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
1.154 + iTestStepResult = EInconclusive;
1.155 + }
1.156 +
1.157 + return iTestStepResult;
1.158 + }
1.159 +
1.160 +
1.161 +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0096L()
1.162 + {
1.163 + iTestStepResult = EFail;
1.164 + TInt result = KErrGeneral;
1.165 +
1.166 + INFO_PRINTF1(_L("IlbcEncoderIntfc - GetEncoderMode"));
1.167 +
1.168 + //Initialize - with the UID of our test HwDevice
1.169 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.170 + TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
1.171 + #else
1.172 + TFourCC testUID('T','0','1','8');
1.173 + #endif
1.174 +
1.175 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.176 +
1.177 + if (iTestStepResult != EPass)
1.178 + {
1.179 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.180 + return EInconclusive;
1.181 + }
1.182 +
1.183 + // reset the value as previous test is pass
1.184 + iTestStepResult = EFail;
1.185 +
1.186 + // KUidIlbcEncoderIntfc
1.187 + MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
1.188 +
1.189 + if (ptr)
1.190 + {
1.191 + MIlbcEncoderIntfc::TEncodeMode encodeMode = MIlbcEncoderIntfc::E20msFrame;
1.192 +
1.193 + result = ptr->SetEncoderMode(MIlbcEncoderIntfc::E30msFrame);
1.194 +
1.195 + if (result == KErrNone)
1.196 + {
1.197 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetEncoderMode finished successfully"));
1.198 +
1.199 + result = ptr->GetEncoderMode(encodeMode); // call method
1.200 +
1.201 + if (MIlbcEncoderIntfc::E30msFrame == encodeMode)
1.202 + {
1.203 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetEncoderMode finished successfully"));
1.204 +
1.205 + iTestStepResult = EPass;
1.206 + }
1.207 + else
1.208 + {
1.209 + ERR_PRINTF2(_L("MIlbcEncoderIntfc::GetEncoderMode failed with encodeMode %d"), encodeMode);
1.210 + }
1.211 + }
1.212 + else
1.213 + {
1.214 + ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with result %d"), result);
1.215 + }
1.216 + }
1.217 + else
1.218 + {
1.219 + ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
1.220 + iTestStepResult = EInconclusive;
1.221 + }
1.222 +
1.223 + return iTestStepResult;
1.224 + }
1.225 +
1.226 +
1.227 +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0060L()
1.228 + {
1.229 + iTestStepResult = EFail;
1.230 + TInt result = KErrGeneral;
1.231 +
1.232 + INFO_PRINTF1(_L("IlbcEncoderIntfc - SetVadMode"));
1.233 +
1.234 + //Initialize - with the UID of our test HwDevice
1.235 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.236 + TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
1.237 + #else
1.238 + TFourCC testUID('T','0','1','8');
1.239 + #endif
1.240 +
1.241 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.242 +
1.243 + if (iTestStepResult != EPass)
1.244 + {
1.245 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.246 + return EInconclusive;
1.247 + }
1.248 +
1.249 + // reset the value as previous test is pass
1.250 + iTestStepResult = EFail;
1.251 +
1.252 + // KUidIlbcEncoderIntfc
1.253 + MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
1.254 +
1.255 + if (ptr)
1.256 + {
1.257 + TBool vadModeOn = EFalse;
1.258 +
1.259 + result = ptr->SetVadMode(ETrue); // call method
1.260 +
1.261 + if (result == KErrNone)
1.262 + {
1.263 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully"));
1.264 +
1.265 + result = ptr->GetVadMode(vadModeOn);
1.266 +
1.267 + if ( (result == KErrNone) && vadModeOn)
1.268 + {
1.269 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully"));
1.270 +
1.271 + iTestStepResult = EPass;
1.272 + }
1.273 + else
1.274 + {
1.275 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.276 + }
1.277 + }
1.278 + else
1.279 + {
1.280 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.281 + }
1.282 + }
1.283 + else
1.284 + {
1.285 + INFO_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
1.286 + iTestStepResult = EInconclusive;
1.287 + }
1.288 +
1.289 + return iTestStepResult;
1.290 + }
1.291 +
1.292 +
1.293 +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0061L()
1.294 + {
1.295 + iTestStepResult = EFail;
1.296 + TInt result = KErrGeneral;
1.297 +
1.298 + INFO_PRINTF1(_L("IlbcEncoderIntfc - GetVadMode"));
1.299 +
1.300 + //Initialize - with the UID of our test HwDevice
1.301 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.302 + TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
1.303 + #else
1.304 + TFourCC testUID('T','0','1','8');
1.305 + #endif
1.306 +
1.307 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.308 +
1.309 + if (iTestStepResult != EPass)
1.310 + {
1.311 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.312 + return EInconclusive;
1.313 + }
1.314 +
1.315 + // reset the value as previous test is pass
1.316 + iTestStepResult = EFail;
1.317 +
1.318 + // KUidIlbcEncoderIntfc
1.319 + MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
1.320 +
1.321 + if (ptr)
1.322 + {
1.323 + TBool vadModeOn = EFalse;
1.324 +
1.325 + result = ptr->SetVadMode(ETrue); // call method
1.326 +
1.327 + if (result == KErrNone)
1.328 + {
1.329 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully"));
1.330 +
1.331 + result = ptr->GetVadMode(vadModeOn);
1.332 +
1.333 + if ( (result == KErrNone) && vadModeOn)
1.334 + {
1.335 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully"));
1.336 +
1.337 + result = ptr->SetVadMode(EFalse);
1.338 +
1.339 + if (result == KErrNone)
1.340 + {
1.341 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully"));
1.342 +
1.343 + result = ptr->GetVadMode(vadModeOn);
1.344 +
1.345 + if ( (result == KErrNone) && !vadModeOn)
1.346 + {
1.347 + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully"));
1.348 +
1.349 + iTestStepResult = EPass;
1.350 + }
1.351 + else
1.352 + {
1.353 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.354 + }
1.355 + }
1.356 + else
1.357 + {
1.358 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.359 + }
1.360 + }
1.361 + else
1.362 + {
1.363 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.364 + }
1.365 + }
1.366 + else
1.367 + {
1.368 + ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d vadModeOn %d"), result, vadModeOn);
1.369 + }
1.370 + }
1.371 + else
1.372 + {
1.373 + INFO_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
1.374 + iTestStepResult = EInconclusive;
1.375 + }
1.376 +
1.377 + return iTestStepResult;
1.378 + }