os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepcigsmconfig.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 "teststepcigsmconfig.h"
    17 
    18 
    19 TVerdict CTestStepCIGsmConfig::DoTestStepL()
    20 	{
    21 	iTestStepResult = ETestSuiteError;
    22 
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
    24 
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0088-HP")) == 0)
    26 		{
    27 		iTestStepResult = DoTestStep0088L();
    28 		}
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0089-HP")) == 0)
    30 		{
    31 		iTestStepResult = DoTestStep0089L();
    32 		}
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0090-HP")) == 0)
    34 		{
    35 		iTestStepResult = DoTestStep0090L();
    36 		}
    37 
    38 	return iTestStepResult;
    39 	}
    40 
    41 
    42 TVerdict CTestStepCIGsmConfig::DoTestStep0088L()
    43 	{
    44 	iTestStepResult = EFail;
    45 
    46 	INFO_PRINTF1(_L("GsmConfig - Instantiating"));
    47 
    48 	//Initialize - with the UID of our test HwDevice
    49 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    50 	TUid testUID = {KUidGsmConfigTestDevice};
    51 	#else
    52 	TFourCC testUID('T','0','2','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 	// KUidGsmConfig
    67 	MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
    68 
    69 	if (ptr)
    70 		{
    71 		INFO_PRINTF1(_L("MMMFGsmConfig instantiated successfully"));
    72 
    73 		iTestStepResult = EPass;
    74 		}
    75 	else
    76 		{
    77 		ERR_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
    78 		}
    79 
    80 	return iTestStepResult;
    81 	}
    82 
    83 
    84 TVerdict CTestStepCIGsmConfig::DoTestStep0089L()
    85 	{
    86 	iTestStepResult = EFail;
    87 	TInt result = KErrGeneral;
    88 
    89 	INFO_PRINTF1(_L("GsmConfig - SetConversionFormat"));
    90 
    91 	//Initialize - with the UID of our test HwDevice
    92 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
    93 	TUid testUID = {KUidGsmConfigTestDevice};
    94 	#else
    95 	TFourCC testUID('T','0','2','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 	// KUidGsmConfig
   110 	MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
   111 
   112 	if (ptr)
   113 		{
   114 		result = ptr->SetConversionFormat(MMMFGsmConfig::ENone); // call method
   115 		
   116 		if (result == KErrNone)
   117 			{
   118 			INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully"));
   119 
   120 			iTestStepResult = EPass;
   121 			}
   122 		else
   123 			{
   124 			ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result);
   125 			}
   126 		}
   127 	else
   128 		{
   129 		INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
   130 		iTestStepResult = EInconclusive;
   131 		}
   132 
   133 	return iTestStepResult;
   134 	}
   135 
   136 
   137 TVerdict CTestStepCIGsmConfig::DoTestStep0090L()
   138 	{
   139 	iTestStepResult = EFail;
   140 	TInt result = KErrGeneral;
   141 
   142 	INFO_PRINTF1(_L("GsmConfig - ConversionFormat"));
   143 
   144 	//Initialize - with the UID of our test HwDevice
   145 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   146 	TUid testUID = {KUidGsmConfigTestDevice};
   147 	#else
   148 	TFourCC testUID('T','0','2','0');
   149 	#endif
   150 	
   151 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
   152 
   153 	if (iTestStepResult != EPass)
   154 		{
   155 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
   156 		return EInconclusive;
   157 		}
   158 
   159 	// reset the value as previous test is pass
   160 	iTestStepResult = EFail;
   161 
   162 	// KUidGsmConfig
   163 	MMMFGsmConfig* ptr = static_cast <MMMFGsmConfig*> (iMMFDevSound->CustomInterface(KUidGsmConfig));
   164 		
   165 	if (ptr)
   166 		{
   167 		MMMFGsmConfig::TMMFGsmConversionFormat convFormat = MMMFGsmConfig::ENone;
   168 
   169 		result = ptr->SetConversionFormat(MMMFGsmConfig::EAlawPCM); // call method
   170 		
   171 		if (result == KErrNone)
   172 			{
   173 			INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully"));
   174 
   175 			result = ptr->ConversionFormat(convFormat);
   176 			
   177 			if ( (result == KErrNone) && (MMMFGsmConfig::EAlawPCM == convFormat) )
   178 				{
   179 				INFO_PRINTF1(_L("MMMFGsmConfig::ConversionFormat finished successfully"));
   180 
   181 				iTestStepResult = EPass;
   182 				}
   183 			else
   184 				{
   185 				ERR_PRINTF3(_L("MMMFGsmConfig::SetConversionFormat failed with result %d  convFormat"), result, convFormat);
   186 				}
   187 			}
   188 		else
   189 			{
   190 			ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result);
   191 			}
   192 		}
   193 	else
   194 		{
   195 		INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface"));
   196 		iTestStepResult = EInconclusive;
   197 		}
   198 
   199 	return iTestStepResult;
   200 	}