os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcig729encoderconfig.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 "teststepcig729encoderconfig.h"
    17 
    18 
    19 TVerdict CTestStepCIG729EncoderConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0051-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0051L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0052-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0052L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0053-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0053L();
    36 		}
    37 
    38 	return iTestStepResult;
    39 	}
    40 
    41 
    42 TVerdict CTestStepCIG729EncoderConfig::DoTestStep0051L()
    43 	{
    44 	iTestStepResult = EFail;
    45 
    46 	INFO_PRINTF1(_L("G729EncoderIntfc - Instantiating"));
    47 
    48 	//Initialize - with the UID of our test HwDevice
    49 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    50 	TUid testUID = {KUidG729EncoderConfigTestDevice};
    51 	#else
    52 	TFourCC testUID('T','0','1','0');
    53 	#endif
    54 
    55 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    56 
    57 	if (iTestStepResult != EPass)
    58 		{
    59 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
    60 		return EInconclusive;
    61 		}
    62 
    63 	// reset the value as previous test is pass
    64 	iTestStepResult = EFail;  
    65 
    66 	// KUidG729EncoderIntfc
    67 	MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
    68 
    69 	if (ptr)
    70 		{
    71 		INFO_PRINTF1(_L("MG729EncoderIntfc instantiated successfully"));
    72 
    73 		iTestStepResult = EPass;
    74 		}
    75 	else
    76 		{
    77 		ERR_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
    78 		}
    79 
    80 	return iTestStepResult;
    81 	}
    82 
    83 
    84 TVerdict CTestStepCIG729EncoderConfig::DoTestStep0052L()
    85 	{
    86 	iTestStepResult = EFail;
    87 	TInt result = KErrGeneral;
    88 
    89 	INFO_PRINTF1(_L("G729EncoderIntfc - SetVadMode"));
    90 
    91 	//Initialize - with the UID of our test HwDevice
    92 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    93 	TUid testUID = {KUidG729EncoderConfigTestDevice};
    94 	#else
    95 	TFourCC testUID('T','0','1','0');
    96 	#endif
    97 	
    98 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
    99 
   100 	if (iTestStepResult != EPass)
   101 		{
   102 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   103 		return EInconclusive;
   104 		}
   105 
   106 	// reset the value as previous test is pass
   107 	iTestStepResult = EFail;
   108 
   109 	// KUidG729EncoderIntfc
   110 	MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
   111 
   112 	if (ptr)
   113 		{
   114 		TBool vadModeOn = EFalse;
   115 
   116 		result = ptr->SetVadMode(ETrue); // call method
   117 		
   118 		if (result == KErrNone)
   119 			{
   120 			result = ptr->GetVadMode(vadModeOn);
   121 
   122 			if ( (result == KErrNone) && vadModeOn)
   123 				{
   124 				INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
   125 				return EPass;
   126 				}
   127 			else
   128 				{
   129 				ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   130 				}
   131 			}
   132 		else
   133 			{
   134 			ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
   135 			}
   136 		}
   137 	else
   138 		{
   139 		INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
   140 		iTestStepResult = EInconclusive;
   141 		}
   142 
   143 	return iTestStepResult;
   144 	}
   145 
   146 
   147 TVerdict CTestStepCIG729EncoderConfig::DoTestStep0053L()
   148 	{
   149 	iTestStepResult = EFail;
   150 	TInt result = KErrGeneral;
   151 
   152 	INFO_PRINTF1(_L("G729EncoderIntfc - GetVadMode"));
   153 
   154 	//Initialize - with the UID of our test HwDevice
   155 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   156 	TUid testUID = {KUidG729EncoderConfigTestDevice};
   157 	#else
   158 	TFourCC testUID('T','0','1','0');
   159 	#endif
   160 	
   161 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   162 
   163 	if (iTestStepResult != EPass)
   164 		{
   165 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   166 		return EInconclusive;
   167 		}
   168 
   169 	// reset the value as previous test is pass
   170 	iTestStepResult = EFail;
   171 
   172 	// KUidG729EncoderIntfc
   173 	MG729EncoderIntfc* ptr = static_cast <MG729EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc));
   174 
   175 	if (ptr)
   176 		{
   177 		TBool vadModeOn = EFalse;
   178 		
   179 		result = ptr->SetVadMode(ETrue); // call method
   180 		
   181 		if (result == KErrNone)
   182 			{
   183 			INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully"));
   184 			
   185 			result = ptr->GetVadMode(vadModeOn);
   186 
   187 			if ( (result == KErrNone) && vadModeOn)
   188 				{
   189 				INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
   190 				
   191 				result = ptr->SetVadMode(EFalse);
   192 				
   193 				if (result == KErrNone)
   194 					{
   195 					INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully"));
   196 					
   197 					result = ptr->GetVadMode(vadModeOn);
   198 
   199 					if ( (result == KErrNone) && !vadModeOn)
   200 						{
   201 						INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully"));
   202 
   203 						iTestStepResult = EPass;
   204 						}
   205 					else
   206 						{
   207 						ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   208 						}
   209 					}
   210 				else
   211 					{
   212 					ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
   213 					}
   214 				}
   215 			else
   216 				{
   217 				ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d  vadModeOn %d"), result, vadModeOn);
   218 				}
   219 			}
   220 		else
   221 			{
   222 			ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result);
   223 			}
   224 		}
   225 	else
   226 		{
   227 		INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface"));
   228 		iTestStepResult = EInconclusive;
   229 		}
   230 
   231 	return iTestStepResult;
   232 	}