os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciadvancedaacencodesettings.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 "teststepciadvancedaacencodesettings.h"
    17 #include "cidefine.h"
    18 
    19 /*****************************************************************************/
    20 CTestStepCICreateAdvancedAacEncodeSettings::CTestStepCICreateAdvancedAacEncodeSettings()
    21 	{
    22 	iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0006-HP");
    23 	}
    24 
    25 /*****************************************************************************/
    26 TVerdict CTestStepCICreateAdvancedAacEncodeSettings::DoTestStepL()
    27 	{
    28 	iTestStepResult = EFail;
    29 
    30 	INFO_PRINTF1(_L("Initializing test CI device"));
    31 	
    32 	//Initialize - with the UID of our test HwDevice
    33 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    34 	TUid testUID = {KUidAdvancedAacEncodeSettingsTestDevice};
    35 	#else
    36 	TFourCC testUID('T','0','0','5');
    37 	#endif
    38 
    39 	MMMFAdvancedAACEncodeSettings* interface = NULL;
    40 	interface = static_cast<MMMFAdvancedAACEncodeSettings*>(
    41 							InitializeAndInstantiateInterfaceL(testUID, KUidAdvancedAACEncoderSettings));
    42 
    43 	if (interface)
    44 		{
    45 		iTestStepResult = EPass;
    46 		INFO_PRINTF1(_L("Successfully retrieved the interface."));
    47 		}
    48 	else
    49 		{
    50 		iTestStepResult = EFail;
    51 		ERR_PRINTF1(_L("Failed to retrieve the interface"));
    52 		}
    53 
    54 	return iTestStepResult;
    55 	}
    56 
    57 /*****************************************************************************/
    58 CTestStepCIAdvancedAacEncodeSettings::CTestStepCIAdvancedAacEncodeSettings(TBool aIsGetTest)
    59 									: iIsGetTest(aIsGetTest)
    60 	{
    61 	if (iIsGetTest)
    62 		{		
    63 		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0099-HP");
    64 		}
    65 	else
    66 		{
    67 		iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0007-HP");	
    68 		}
    69 	}
    70 
    71 /*****************************************************************************/
    72 TVerdict CTestStepCIAdvancedAacEncodeSettings::DoTestStepL()
    73 	{
    74 	iTestStepResult = EFail;
    75 
    76 	INFO_PRINTF1(_L("Initializing test CI device"));
    77 	
    78 	//Initialize - with the UID of our test HwDevice
    79 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    80 	TUid testUID = {KUidAdvancedAacEncodeSettingsTestDevice};
    81 	#else
    82 	TFourCC testUID('T','0','0','5');
    83 	#endif
    84 	
    85 	MMMFAdvancedAACEncodeSettings* interface = NULL;
    86 	interface = static_cast<MMMFAdvancedAACEncodeSettings*>(
    87 							InitializeAndInstantiateInterfaceL(testUID, KUidAdvancedAACEncoderSettings));
    88 
    89 	if (interface)
    90 		{
    91 		MMMFAdvancedAACEncodeSettings::TAACBitrateMode bitrateMode = MMMFAdvancedAACEncodeSettings::EAACBitrateModeFixed;
    92 		INFO_PRINTF1(_L("Calling test CI method"));
    93 		TInt err = interface->SetAACEncodeBitrateMode(bitrateMode);
    94 		
    95 		if (iIsGetTest)
    96 			{
    97 			INFO_PRINTF1(_L("Testing GetAACEncodeBitrateMode"));
    98 			}
    99 		else
   100 			{
   101 			INFO_PRINTF1(_L("Testing SetAACEncodeBitrateMode"));
   102 			}
   103 			
   104 		if (err == KErrNone)
   105 			{
   106 			// Successfully set the mode
   107 			INFO_PRINTF1(_L("Set the mode successfully"));
   108 			
   109 			MMMFAdvancedAACEncodeSettings::TAACBitrateMode testMode;
   110 			
   111 			err = interface->GetAACEncodeBitrateMode(testMode);
   112 			
   113 			iTestStepResult = EFail;
   114 			if ((err == KErrNone) && (testMode == bitrateMode))
   115 				{
   116 				INFO_PRINTF1(_L("Test CI method call was successful"));
   117 				iTestStepResult = EPass;
   118 				}
   119 			else
   120 				{
   121 				ERR_PRINTF4(_L("Test CI method failed, error: %d, expected value: %d, actual value: %d"), \
   122 								err, bitrateMode, testMode);
   123 				}			
   124 			}
   125 		else
   126 			{
   127 			ERR_PRINTF2(_L("Test CI method failed, error"), err);
   128 			}
   129 		}
   130 	else
   131 		{
   132 		WARN_PRINTF1(_L("Failed to retrieve the custom interface."));
   133 		iTestStepResult = EInconclusive;
   134 		}
   135 
   136 	return iTestStepResult;
   137 	}