os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciilbcdecoderconfig.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 "teststepciilbcdecoderconfig.h"
    17 
    18 
    19 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0054-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0054L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0055-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0055L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0056-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0056L();
    36 		}
    37 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0057-HP")) == 0)
    38 		{
    39 		iTestStepResult = DoTestStep0057L();
    40 		}
    41 
    42 	return iTestStepResult;
    43 	}
    44 
    45 
    46 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0054L()
    47 	{
    48 	iTestStepResult = EFail;
    49 	
    50 	INFO_PRINTF1(_L("IlbcDecoderIntfc - Instantiating"));
    51 
    52 	//Initialize - with the UID of our test HwDevice
    53 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    54 	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
    55 	#else
    56 	TFourCC testUID('T','0','1','7');
    57 	#endif
    58 
    59 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    60 
    61 	if (iTestStepResult != EPass)
    62 		{
    63 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    64 		return EInconclusive;
    65 		}
    66 
    67 	// reset the value as previous test is pass
    68 	iTestStepResult = EFail;  
    69 
    70 	// KUidIlbcDecoderIntfc
    71 	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
    72 
    73 	if (ptr)
    74 		{
    75 		INFO_PRINTF1(_L("MIlbcDecoderIntfc instantiated successfully"));
    76 
    77 		iTestStepResult = EPass;
    78 		}
    79 	else
    80 		{
    81 		ERR_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
    82 		}
    83 
    84 	return iTestStepResult;
    85 	}
    86 
    87 
    88 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0055L()
    89 	{
    90 	iTestStepResult = EFail;
    91 	TInt result = KErrGeneral;
    92 
    93 	INFO_PRINTF1(_L("IlbcDecoderIntfc - SetDecoderMode"));
    94 
    95 	//Initialize - with the UID of our test HwDevice
    96 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    97 	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
    98 	#else
    99 	TFourCC testUID('T','0','1','7');
   100 	#endif
   101 	
   102 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   103 
   104 	if (iTestStepResult != EPass)
   105 		{
   106 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   107 		return EInconclusive;
   108 		}
   109 
   110 	// reset the value as previous test is pass
   111 	iTestStepResult = EFail;  
   112 
   113 	// KUidIlbcDecoderIntfc
   114 	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
   115 
   116 	if (ptr)
   117 		{
   118 		MIlbcDecoderIntfc::TDecodeMode decodeMode = MIlbcDecoderIntfc::E30msFrame;
   119 		TInt setDecodeMode = MIlbcDecoderIntfc::E20msFrame;
   120 
   121 		result = ptr->SetDecoderMode(decodeMode); // call method
   122 
   123 		// This file is created by the test stub, the plugin device
   124 		_LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt");
   125 
   126 		ReadFileL(KFileName, setDecodeMode);
   127 
   128 		if (result == KErrNone)
   129 			{
   130 			if (static_cast<MIlbcDecoderIntfc::TDecodeMode>(setDecodeMode) == decodeMode)
   131 				{
   132 				INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetDecoderMode finished successfully"));
   133 
   134 				iTestStepResult = EPass;
   135 				}
   136 			else
   137 				{
   138 				ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with decodeMode %d"), decodeMode);
   139 				}
   140 			}
   141 		else
   142 			{
   143 			ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with error %d"), result);
   144 			}
   145 		}
   146 	else
   147 		{
   148 		INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
   149 		iTestStepResult = EInconclusive;
   150 		}
   151 
   152 	return iTestStepResult;
   153 	}
   154 
   155 
   156 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0056L()
   157 	{
   158 	iTestStepResult = EFail;
   159 	TInt result = KErrGeneral;
   160 
   161 	INFO_PRINTF1(_L("IlbcDecoderIntfc - SetComfortNoiseGeneration"));
   162 
   163 	//Initialize - with the UID of our test HwDevice
   164 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   165 	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
   166 	#else
   167 	TFourCC testUID('T','0','1','7');
   168 	#endif
   169 	
   170 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   171 
   172 	if (iTestStepResult != EPass)
   173 		{
   174 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   175 		return EInconclusive;
   176 		}
   177 
   178 	// reset the value as previous test is pass
   179 	iTestStepResult = EFail;  
   180 
   181 	// KUidIlbcDecoderIntfc
   182 	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
   183 
   184 	if (ptr)
   185 		{
   186 		TBool cng = ETrue;
   187 
   188 		result = ptr->SetComfortNoiseGeneration(cng); // call method
   189 		
   190 		if (result == KErrNone)
   191 			{
   192 			INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   193 
   194 			result = ptr->GetComfortNoiseGeneration(cng);
   195 
   196 			if ( (result == KErrNone) && cng)
   197 				{
   198 				INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   199 
   200 				result = ptr->SetComfortNoiseGeneration(EFalse);
   201 
   202 				if (result == KErrNone)
   203 					{
   204 					INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   205 
   206 					result = ptr->GetComfortNoiseGeneration(cng);
   207 
   208 					if ( (result == KErrNone) && !cng)
   209 						{
   210 						INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   211 
   212 						iTestStepResult = EPass;
   213 						}
   214 					else
   215 						{
   216 						ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   217 						}
   218 					}
   219 				else
   220 					{
   221 					ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   222 					}
   223 				}
   224 			else
   225 				{
   226 				ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   227 				}
   228 			}
   229 		else
   230 			{
   231 			ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   232 			}
   233 		}
   234 	else
   235 		{
   236 		INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
   237 		iTestStepResult = EInconclusive;
   238 		}
   239 
   240 	return iTestStepResult;
   241 	}
   242 
   243 
   244 TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0057L()
   245 	{
   246 	iTestStepResult = EFail;
   247 	TInt result = KErrGeneral;
   248 
   249 	INFO_PRINTF1(_L("IlbcDecoderIntfc - GetComfortNoiseGeneration"));
   250 
   251 	//Initialize - with the UID of our test HwDevice
   252 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   253 	TUid testUID = {KUidIlbcDecoderIntfcTestDevice};
   254 	#else
   255 	TFourCC testUID('T','0','1','7');
   256 	#endif
   257 	
   258 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   259 
   260 	if (iTestStepResult != EPass)
   261 		{
   262 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   263 		return EInconclusive;
   264 		}
   265 
   266 	// reset the value as previous test is pass
   267 	iTestStepResult = EFail;  
   268 
   269 	// KUidIlbcDecoderIntfc
   270 	MIlbcDecoderIntfc* ptr = static_cast <MIlbcDecoderIntfc*> (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc));
   271 
   272 	if (ptr)
   273 		{
   274 		TBool cng = ETrue;
   275 
   276 		result = ptr->SetComfortNoiseGeneration(cng); // call method
   277 		
   278 		if (result == KErrNone)
   279 			{
   280 			INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetCng finished successfully"));
   281 			
   282 			result = ptr->GetComfortNoiseGeneration(cng);
   283 
   284 			if ( (result == KErrNone) && cng)
   285 				{
   286 				INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   287 				
   288 				result = ptr->SetComfortNoiseGeneration(EFalse);
   289 				
   290 				if (result == KErrNone)
   291 					{
   292 					INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully"));
   293 					
   294 					result = ptr->GetComfortNoiseGeneration(cng);
   295 
   296 					if ( (result == KErrNone) && !cng)
   297 						{
   298 						INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully"));
   299 						
   300 						iTestStepResult = EPass;
   301 						}
   302 					else
   303 						{
   304 						ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d  cng %d"), result, cng);
   305 						}
   306 					}
   307 				else
   308 					{
   309 					ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result);
   310 					}
   311 				}
   312 			else
   313 				{
   314 				ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetCng failed with result %d  cng %d"), result, cng);
   315 				}
   316 			}
   317 		else
   318 			{
   319 			ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetCng failed with result %d"), result);
   320 			}
   321 		}
   322 	else
   323 		{
   324 		INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface"));
   325 		iTestStepResult = EInconclusive;
   326 		}
   327 
   328 	return iTestStepResult;
   329 	}