os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiodspcontrol.cpp
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "teststepciaudiodspcontrol.h"
19 TVerdict CTestStepCIAudioDspControl::DoTestStepL()
21 iTestStepResult = ETestSuiteError;
23 INFO_PRINTF1(_L("Initializing test CI device"));
25 if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0076-HP")) == 0)
27 iTestStepResult = DoTestStep0076L();
29 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0077-HP")) == 0)
31 iTestStepResult = DoTestStep0077L();
33 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0078-HP")) == 0)
35 iTestStepResult = DoTestStep0078L();
37 else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0079-HP")) == 0)
39 iTestStepResult = DoTestStep0079L();
42 return iTestStepResult;
46 TVerdict CTestStepCIAudioDspControl::DoTestStep0076L()
48 iTestStepResult = EFail;
50 INFO_PRINTF1(_L("AudioDSPControl - Instantiating"));
52 //Initialize - with the UID of our test HwDevice
53 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
54 TUid testUID = {KUidAudioDspControlTestDevice};
56 TFourCC testUID('T','0','1','3');
59 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
61 if (iTestStepResult != EPass)
63 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
67 // reset the value as previous test is pass
68 iTestStepResult = EFail;
71 MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
75 INFO_PRINTF1(_L("MMMFDSPControl instantiated successfully"));
77 iTestStepResult = EPass;
81 ERR_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
84 return iTestStepResult;
88 TVerdict CTestStepCIAudioDspControl::DoTestStep0077L()
90 iTestStepResult = EFail;
92 INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptRecordBuffersInvalidFollowingStop"));
94 //Initialize - with the UID of our test HwDevice
95 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
96 TUid testUID = {KUidAudioDspControlTestDevice};
98 TFourCC testUID('T','0','1','3');
101 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
103 if (iTestStepResult != EPass)
105 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
106 return EInconclusive;
109 // reset the value as previous test is pass
110 iTestStepResult = EFail;
113 MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
117 TInt result = KErrGeneral;
119 result = ptr->MmdspcAcceptRecordBuffersInvalidFollowingStop();
121 if (result == KErrNone)
123 INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop finished successfully"));
125 iTestStepResult = EPass;
129 ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop failed with result %d"), result);
134 INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
135 iTestStepResult = EInconclusive;
138 return iTestStepResult;
142 TVerdict CTestStepCIAudioDspControl::DoTestStep0078L()
144 iTestStepResult = EFail;
146 INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptPlaybackBuffersInvalidFollowingStop"));
148 //Initialize - with the UID of our test HwDevice
149 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
150 TUid testUID = {KUidAudioDspControlTestDevice};
152 TFourCC testUID('T','0','1','3');
155 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
157 if (iTestStepResult != EPass)
159 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
160 return EInconclusive;
163 // reset the value as previous test is pass
164 iTestStepResult = EFail;
167 MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
171 TInt result = KErrGeneral;
173 result = ptr->MmdspcAcceptPlaybackBuffersInvalidFollowingStop();
175 if (result == KErrNone)
177 INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop finished successfully"));
179 iTestStepResult = EPass;
183 ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop failed with result %d"), result);
188 INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
189 iTestStepResult = EInconclusive;
192 return iTestStepResult;
196 TVerdict CTestStepCIAudioDspControl::DoTestStep0079L()
198 iTestStepResult = EFail;
200 INFO_PRINTF1(_L("AudioDSPControl - MmdspcGetAudioPlaybackInfo"));
202 //Initialize - with the UID of our test HwDevice
203 #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
204 TUid testUID = {KUidAudioDspControlTestDevice};
206 TFourCC testUID('T','0','1','3');
209 iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
211 if (iTestStepResult != EPass)
213 INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
214 return EInconclusive;
217 // reset the value as previous test is pass
218 iTestStepResult = EFail;
221 MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
225 TInt result = KErrGeneral;
226 TInt64 samplesPlayed = 0;
227 TInt64 systemTime = 0;
228 TUint bytesDecoderConsumed = 0;
229 TUint bytesDecoderDecoded = 0;
231 result = ptr->MmdspcGetAudioPlaybackInfo (samplesPlayed, systemTime, bytesDecoderConsumed, bytesDecoderDecoded); // call method
233 if ( (result == KErrNone) &&
234 (samplesPlayed == 999) && (systemTime == 999) &&
235 (bytesDecoderConsumed == 999) && (bytesDecoderDecoded == 999) )
237 INFO_PRINTF1(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo finished successfully"));
239 iTestStepResult = EPass;
243 ERR_PRINTF2(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo failed with result %d"), result);
248 INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
249 iTestStepResult = EInconclusive;
252 return iTestStepResult;