os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciilbcencoderconfig.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 "teststepciilbcencoderconfig.h"
    17 
    18 
    19 TVerdict CTestStepCIIlbcEncoderConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0058-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0058L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0059-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0059L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0060-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0060L();
    36 		}
    37 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0061-HP")) == 0)
    38 		{
    39 		iTestStepResult = DoTestStep0061L();
    40 		}
    41 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0096-HP")) == 0)
    42 		{
    43 		iTestStepResult = DoTestStep0096L();
    44 		}
    45 
    46 	return iTestStepResult;
    47 	}
    48 
    49 
    50 TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0058L()
    51 	{
    52 	iTestStepResult = EFail;
    53 
    54 	INFO_PRINTF1(_L("IlbcEncoderIntfc - Instantiating"));
    55 
    56 	//Initialize - with the UID of our test HwDevice
    57 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    58 	TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
    59 	#else
    60 	TFourCC testUID('T','0','1','8');
    61 	#endif
    62 		
    63 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    64 
    65 	if (iTestStepResult != EPass)
    66 		{
    67 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    68 		return EInconclusive;
    69 		}
    70 
    71 	// reset the value as previous test is pass
    72 	iTestStepResult = EFail;  
    73 
    74 	// KUidCustomInterfaceDevSoundIlbcEncoderConfig
    75 	MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
    76 
    77 	if (ptr)
    78 		{
    79 		INFO_PRINTF1(_L("MIlbcEncoderIntfc instantiated successfully"));
    80 
    81 		iTestStepResult = EPass;
    82 		}
    83 	else
    84 		{
    85 		ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
    86 		}
    87 
    88 	return iTestStepResult;
    89 	}
    90 
    91 
    92 TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0059L()
    93 	{
    94 	iTestStepResult = EFail;
    95 	TInt result = KErrGeneral;
    96 
    97 	INFO_PRINTF1(_L("IlbcEncoderIntfc - SetEncoderMode"));
    98 
    99 	//Initialize - with the UID of our test HwDevice
   100 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   101 	TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
   102 	#else
   103 	TFourCC testUID('T','0','1','8');
   104 	#endif
   105 	
   106 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   107 
   108 	if (iTestStepResult != EPass)
   109 		{
   110 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   111 		return EInconclusive;
   112 		}
   113 
   114 	// reset the value as previous test is pass
   115 	iTestStepResult = EFail;
   116 
   117 	// KUidIlbcEncoderIntfc
   118 	MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
   119 
   120 	if (ptr)
   121 		{
   122 		MIlbcEncoderIntfc::TEncodeMode encodeMode = MIlbcEncoderIntfc::E30msFrame;
   123 
   124 		result = ptr->SetEncoderMode(MIlbcEncoderIntfc::E20msFrame); // call method
   125 
   126 		if (result == KErrNone)
   127 			{
   128 			INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetEncoderMode finished successfully"));
   129 
   130 			result = ptr->GetEncoderMode(encodeMode);
   131 
   132 			if (MIlbcEncoderIntfc::E20msFrame == encodeMode)
   133 				{
   134 				INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetEncoderMode finished successfully"));
   135 
   136 				iTestStepResult = EPass;
   137 				}
   138 			else
   139 				{
   140 				ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetEncoderMode failed with result %d  encodeMode %d"), result, encodeMode);
   141 				}
   142 			}
   143 		else
   144 			{
   145 			ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with result %d"), result);
   146 			}
   147 		}
   148 	else
   149 		{
   150 		ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
   151 		iTestStepResult = EInconclusive;
   152 		}
   153 
   154 	return iTestStepResult;
   155 	}
   156 
   157 
   158 TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0096L()
   159 	{
   160 	iTestStepResult = EFail;
   161 	TInt result = KErrGeneral;
   162 
   163 	INFO_PRINTF1(_L("IlbcEncoderIntfc - GetEncoderMode"));
   164 
   165 	//Initialize - with the UID of our test HwDevice
   166 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   167 	TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
   168 	#else
   169 	TFourCC testUID('T','0','1','8');
   170 	#endif
   171 	
   172 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   173 
   174 	if (iTestStepResult != EPass)
   175 		{
   176 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   177 		return EInconclusive;
   178 		}
   179 
   180 	// reset the value as previous test is pass
   181 	iTestStepResult = EFail;
   182 
   183 	// KUidIlbcEncoderIntfc
   184 	MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
   185 
   186 	if (ptr)
   187 		{
   188 		MIlbcEncoderIntfc::TEncodeMode encodeMode = MIlbcEncoderIntfc::E20msFrame;
   189 
   190 		result = ptr->SetEncoderMode(MIlbcEncoderIntfc::E30msFrame);
   191 
   192 		if (result == KErrNone)
   193 			{
   194 			INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetEncoderMode finished successfully"));
   195 
   196 			result = ptr->GetEncoderMode(encodeMode); // call method
   197 
   198 			if (MIlbcEncoderIntfc::E30msFrame == encodeMode)
   199 				{
   200 				INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetEncoderMode finished successfully"));
   201 
   202 				iTestStepResult = EPass;
   203 				}
   204 			else
   205 				{
   206 				ERR_PRINTF2(_L("MIlbcEncoderIntfc::GetEncoderMode failed with encodeMode %d"), encodeMode);
   207 				}
   208 			}
   209 		else
   210 			{
   211 			ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with result %d"), result);
   212 			}
   213 		}
   214 	else
   215 		{
   216 		ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
   217 		iTestStepResult = EInconclusive;
   218 		}
   219 
   220 	return iTestStepResult;
   221 	}
   222 
   223 
   224 TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0060L()
   225 	{
   226 	iTestStepResult = EFail;
   227 	TInt result = KErrGeneral;
   228 
   229 	INFO_PRINTF1(_L("IlbcEncoderIntfc - SetVadMode"));
   230 
   231 	//Initialize - with the UID of our test HwDevice
   232 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   233 	TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
   234 	#else
   235 	TFourCC testUID('T','0','1','8');
   236 	#endif
   237 	
   238 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   239 
   240 	if (iTestStepResult != EPass)
   241 		{
   242 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   243 		return EInconclusive;
   244 		}
   245 
   246 	// reset the value as previous test is pass
   247 	iTestStepResult = EFail;
   248 
   249 	// KUidIlbcEncoderIntfc
   250 	MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
   251 
   252 	if (ptr)
   253 		{
   254 		TBool vadModeOn = EFalse;
   255 
   256 		result = ptr->SetVadMode(ETrue); // call method
   257 		
   258 		if (result == KErrNone)
   259 			{
   260 			INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully"));
   261 			
   262 			result = ptr->GetVadMode(vadModeOn);
   263 
   264 			if ( (result == KErrNone) && vadModeOn)
   265 				{
   266 				INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully"));
   267 
   268 				iTestStepResult = EPass;
   269 				}
   270 			else
   271 				{
   272 				ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   273 				}
   274 			}
   275 		else
   276 			{
   277 			ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);	
   278 			}
   279 		}
   280 	else
   281 		{
   282 		INFO_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
   283 		iTestStepResult = EInconclusive;
   284 		}
   285 
   286 	return iTestStepResult;
   287 	}
   288 
   289 
   290 TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0061L()
   291 	{
   292 	iTestStepResult = EFail;
   293 	TInt result = KErrGeneral;
   294 
   295 	INFO_PRINTF1(_L("IlbcEncoderIntfc - GetVadMode"));
   296 
   297 	//Initialize - with the UID of our test HwDevice
   298 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   299 	TUid testUID = {KUidIlbcEncoderIntfcTestDevice};
   300 	#else
   301 	TFourCC testUID('T','0','1','8');
   302 	#endif
   303 	
   304 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   305 
   306 	if (iTestStepResult != EPass)
   307 		{
   308 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   309 		return EInconclusive;
   310 		}
   311 
   312 	// reset the value as previous test is pass
   313 	iTestStepResult = EFail;
   314 
   315 	// KUidIlbcEncoderIntfc
   316 	MIlbcEncoderIntfc* ptr = static_cast <MIlbcEncoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc));
   317 
   318 	if (ptr)
   319 		{
   320 		TBool vadModeOn = EFalse;
   321 
   322 		result = ptr->SetVadMode(ETrue); // call method
   323 
   324 		if (result == KErrNone)
   325 			{
   326 			INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully"));
   327 
   328 			result = ptr->GetVadMode(vadModeOn);
   329 
   330 			if ( (result == KErrNone) && vadModeOn)
   331 				{
   332 				INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully"));
   333 
   334 				result = ptr->SetVadMode(EFalse);
   335 
   336 				if (result == KErrNone)
   337 					{
   338 					INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully"));
   339 
   340 					result = ptr->GetVadMode(vadModeOn);
   341 
   342 					if ( (result == KErrNone) && !vadModeOn)
   343 						{
   344 						INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully"));
   345 
   346 						iTestStepResult = EPass;
   347 						}
   348 					else
   349 						{
   350 						ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   351 						}
   352 					}
   353 				else
   354 					{
   355 					ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   356 					}
   357 				}
   358 			else
   359 				{
   360 				ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   361 				}
   362 			}
   363 		else
   364 			{
   365 			ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   366 			}
   367 		}
   368 	else
   369 		{
   370 		INFO_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface"));
   371 		iTestStepResult = EInconclusive;
   372 		}
   373 
   374 	return iTestStepResult;
   375 	}