devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiodspcontrol.cpp
changeset 0 79dd3e2336a0
equal deleted inserted replaced
-1:000000000000 0:79dd3e2336a0
       
     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 "teststepciaudiodspcontrol.h"
       
    17 
       
    18 
       
    19 TVerdict CTestStepCIAudioDspControl::DoTestStepL()
       
    20 	{
       
    21 	iTestStepResult = ETestSuiteError;
       
    22 
       
    23 	INFO_PRINTF1(_L("Initializing test CI device"));
       
    24 
       
    25 	if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0076-HP")) == 0)
       
    26 		{
       
    27 		iTestStepResult = DoTestStep0076L();
       
    28 		}
       
    29 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0077-HP")) == 0)
       
    30 		{
       
    31 		iTestStepResult = DoTestStep0077L();
       
    32 		}
       
    33 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0078-HP")) == 0)
       
    34 		{
       
    35 		iTestStepResult = DoTestStep0078L();
       
    36 		}
       
    37 	else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0079-HP")) == 0)
       
    38 		{
       
    39 		iTestStepResult = DoTestStep0079L();
       
    40 		}
       
    41 
       
    42 	return iTestStepResult;
       
    43 	}
       
    44 
       
    45 
       
    46 TVerdict CTestStepCIAudioDspControl::DoTestStep0076L()
       
    47 	{
       
    48 	iTestStepResult = EFail;
       
    49 
       
    50 	INFO_PRINTF1(_L("AudioDSPControl - Instantiating"));
       
    51 
       
    52 	//Initialize - with the UID of our test HwDevice
       
    53 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
       
    54 	TUid testUID = {KUidAudioDspControlTestDevice};
       
    55 	#else
       
    56 	TFourCC testUID('T','0','1','3');
       
    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 	// KUidMMFDSPControl
       
    71 	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
       
    72 
       
    73 	if (ptr)
       
    74 		{
       
    75 		INFO_PRINTF1(_L("MMMFDSPControl instantiated successfully"));
       
    76 
       
    77 		iTestStepResult = EPass;
       
    78 		}
       
    79 	else
       
    80 		{
       
    81 		ERR_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
       
    82 		}
       
    83 
       
    84 	return iTestStepResult;
       
    85 	}
       
    86 
       
    87 
       
    88 TVerdict CTestStepCIAudioDspControl::DoTestStep0077L()
       
    89 	{
       
    90 	iTestStepResult = EFail;
       
    91 
       
    92 	INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptRecordBuffersInvalidFollowingStop"));
       
    93 
       
    94 	//Initialize - with the UID of our test HwDevice
       
    95 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
       
    96 	TUid testUID = {KUidAudioDspControlTestDevice};
       
    97 	#else
       
    98 	TFourCC testUID('T','0','1','3');
       
    99 	#endif
       
   100 	 
       
   101 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
       
   102 
       
   103 	if (iTestStepResult != EPass)
       
   104 		{
       
   105 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
       
   106 		return EInconclusive;
       
   107 		}
       
   108 
       
   109 	// reset the value as previous test is pass
       
   110 	iTestStepResult = EFail;
       
   111 
       
   112 	// KUidMMFDSPControl
       
   113 	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
       
   114 
       
   115 	if (ptr)
       
   116 		{
       
   117 		TInt result = KErrGeneral;
       
   118 
       
   119 		result = ptr->MmdspcAcceptRecordBuffersInvalidFollowingStop();
       
   120 
       
   121 		if (result == KErrNone)
       
   122 			{
       
   123 			INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop finished successfully"));
       
   124 
       
   125 			iTestStepResult = EPass;
       
   126 			}
       
   127 		else
       
   128 			{
       
   129 			ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop failed with result %d"), result);
       
   130 			}
       
   131 		}
       
   132 	else
       
   133 		{
       
   134 		INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
       
   135 		iTestStepResult = EInconclusive;
       
   136 		}
       
   137 
       
   138 	return iTestStepResult;
       
   139 	}
       
   140 
       
   141 
       
   142 TVerdict CTestStepCIAudioDspControl::DoTestStep0078L()
       
   143 	{
       
   144 	iTestStepResult = EFail;
       
   145 
       
   146 	INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptPlaybackBuffersInvalidFollowingStop"));
       
   147 
       
   148 	//Initialize - with the UID of our test HwDevice
       
   149 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
       
   150 	TUid testUID = {KUidAudioDspControlTestDevice};
       
   151 	#else
       
   152 	TFourCC testUID('T','0','1','3');
       
   153 	#endif
       
   154 	
       
   155 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
       
   156 
       
   157 	if (iTestStepResult != EPass)
       
   158 		{
       
   159 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
       
   160 		return EInconclusive;
       
   161 		}
       
   162 
       
   163 	// reset the value as previous test is pass
       
   164 	iTestStepResult = EFail;
       
   165 
       
   166 	// KUidMMFDSPControl
       
   167 	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
       
   168 
       
   169 	if (ptr)
       
   170 		{
       
   171 		TInt result = KErrGeneral;
       
   172 
       
   173 		result = ptr->MmdspcAcceptPlaybackBuffersInvalidFollowingStop();
       
   174 
       
   175 		if (result == KErrNone)
       
   176 			{
       
   177 			INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop finished successfully"));
       
   178 
       
   179 			iTestStepResult = EPass;
       
   180 			}
       
   181 		else
       
   182 			{
       
   183 			ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop failed with result %d"), result);
       
   184 			}
       
   185 		}
       
   186 	else
       
   187 		{
       
   188 		INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
       
   189 		iTestStepResult = EInconclusive;
       
   190 		}
       
   191 
       
   192 	return iTestStepResult;
       
   193 	}
       
   194 
       
   195 
       
   196 TVerdict CTestStepCIAudioDspControl::DoTestStep0079L()
       
   197 	{
       
   198 	iTestStepResult = EFail;
       
   199 
       
   200 	INFO_PRINTF1(_L("AudioDSPControl - MmdspcGetAudioPlaybackInfo"));
       
   201 
       
   202 	//Initialize - with the UID of our test HwDevice
       
   203 	#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
       
   204 	TUid testUID = {KUidAudioDspControlTestDevice};
       
   205 	#else
       
   206 	TFourCC testUID('T','0','1','3');
       
   207 	#endif
       
   208 	
       
   209 	iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
       
   210 
       
   211 	if (iTestStepResult != EPass)
       
   212 		{
       
   213 		INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
       
   214 		return EInconclusive;
       
   215 		}
       
   216 
       
   217 	// reset the value as previous test is pass
       
   218 	iTestStepResult = EFail;
       
   219 
       
   220 	// KUidMMFDSPControl
       
   221 	MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
       
   222 
       
   223 	if (ptr)
       
   224 		{
       
   225 		TInt result = KErrGeneral;
       
   226 		TInt64 samplesPlayed = 0;
       
   227 		TInt64 systemTime = 0;
       
   228 		TUint  bytesDecoderConsumed = 0;
       
   229 		TUint  bytesDecoderDecoded = 0;
       
   230 
       
   231 		result = ptr->MmdspcGetAudioPlaybackInfo (samplesPlayed, systemTime, bytesDecoderConsumed, bytesDecoderDecoded); // call method
       
   232 
       
   233 		if ( (result == KErrNone) &&
       
   234 			 (samplesPlayed == 999)	&& (systemTime == 999) &&
       
   235 			 (bytesDecoderConsumed == 999) && (bytesDecoderDecoded == 999) )
       
   236 			{
       
   237 			INFO_PRINTF1(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo finished successfully"));
       
   238 
       
   239 			iTestStepResult = EPass;
       
   240 			}
       
   241 		else
       
   242 			{
       
   243 			ERR_PRINTF2(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo failed with result %d"), result);
       
   244 			}
       
   245 		}
       
   246 	else
       
   247 		{
       
   248 		INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
       
   249 		iTestStepResult = EInconclusive;
       
   250 		}
       
   251 
       
   252 	return iTestStepResult;
       
   253 	}