os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiodspcontrol.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/teststepciaudiodspcontrol.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,253 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "teststepciaudiodspcontrol.h"
1.20 +
1.21 +
1.22 +TVerdict CTestStepCIAudioDspControl::DoTestStepL()
1.23 + {
1.24 + iTestStepResult = ETestSuiteError;
1.25 +
1.26 + INFO_PRINTF1(_L("Initializing test CI device"));
1.27 +
1.28 + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0076-HP")) == 0)
1.29 + {
1.30 + iTestStepResult = DoTestStep0076L();
1.31 + }
1.32 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0077-HP")) == 0)
1.33 + {
1.34 + iTestStepResult = DoTestStep0077L();
1.35 + }
1.36 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0078-HP")) == 0)
1.37 + {
1.38 + iTestStepResult = DoTestStep0078L();
1.39 + }
1.40 + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0079-HP")) == 0)
1.41 + {
1.42 + iTestStepResult = DoTestStep0079L();
1.43 + }
1.44 +
1.45 + return iTestStepResult;
1.46 + }
1.47 +
1.48 +
1.49 +TVerdict CTestStepCIAudioDspControl::DoTestStep0076L()
1.50 + {
1.51 + iTestStepResult = EFail;
1.52 +
1.53 + INFO_PRINTF1(_L("AudioDSPControl - Instantiating"));
1.54 +
1.55 + //Initialize - with the UID of our test HwDevice
1.56 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.57 + TUid testUID = {KUidAudioDspControlTestDevice};
1.58 + #else
1.59 + TFourCC testUID('T','0','1','3');
1.60 + #endif
1.61 +
1.62 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.63 +
1.64 + if (iTestStepResult != EPass)
1.65 + {
1.66 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.67 + return EInconclusive;
1.68 + }
1.69 +
1.70 + // reset the value as previous test is pass
1.71 + iTestStepResult = EFail;
1.72 +
1.73 + // KUidMMFDSPControl
1.74 + MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
1.75 +
1.76 + if (ptr)
1.77 + {
1.78 + INFO_PRINTF1(_L("MMMFDSPControl instantiated successfully"));
1.79 +
1.80 + iTestStepResult = EPass;
1.81 + }
1.82 + else
1.83 + {
1.84 + ERR_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
1.85 + }
1.86 +
1.87 + return iTestStepResult;
1.88 + }
1.89 +
1.90 +
1.91 +TVerdict CTestStepCIAudioDspControl::DoTestStep0077L()
1.92 + {
1.93 + iTestStepResult = EFail;
1.94 +
1.95 + INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptRecordBuffersInvalidFollowingStop"));
1.96 +
1.97 + //Initialize - with the UID of our test HwDevice
1.98 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.99 + TUid testUID = {KUidAudioDspControlTestDevice};
1.100 + #else
1.101 + TFourCC testUID('T','0','1','3');
1.102 + #endif
1.103 +
1.104 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.105 +
1.106 + if (iTestStepResult != EPass)
1.107 + {
1.108 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.109 + return EInconclusive;
1.110 + }
1.111 +
1.112 + // reset the value as previous test is pass
1.113 + iTestStepResult = EFail;
1.114 +
1.115 + // KUidMMFDSPControl
1.116 + MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
1.117 +
1.118 + if (ptr)
1.119 + {
1.120 + TInt result = KErrGeneral;
1.121 +
1.122 + result = ptr->MmdspcAcceptRecordBuffersInvalidFollowingStop();
1.123 +
1.124 + if (result == KErrNone)
1.125 + {
1.126 + INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop finished successfully"));
1.127 +
1.128 + iTestStepResult = EPass;
1.129 + }
1.130 + else
1.131 + {
1.132 + ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop failed with result %d"), result);
1.133 + }
1.134 + }
1.135 + else
1.136 + {
1.137 + INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
1.138 + iTestStepResult = EInconclusive;
1.139 + }
1.140 +
1.141 + return iTestStepResult;
1.142 + }
1.143 +
1.144 +
1.145 +TVerdict CTestStepCIAudioDspControl::DoTestStep0078L()
1.146 + {
1.147 + iTestStepResult = EFail;
1.148 +
1.149 + INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptPlaybackBuffersInvalidFollowingStop"));
1.150 +
1.151 + //Initialize - with the UID of our test HwDevice
1.152 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.153 + TUid testUID = {KUidAudioDspControlTestDevice};
1.154 + #else
1.155 + TFourCC testUID('T','0','1','3');
1.156 + #endif
1.157 +
1.158 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.159 +
1.160 + if (iTestStepResult != EPass)
1.161 + {
1.162 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.163 + return EInconclusive;
1.164 + }
1.165 +
1.166 + // reset the value as previous test is pass
1.167 + iTestStepResult = EFail;
1.168 +
1.169 + // KUidMMFDSPControl
1.170 + MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
1.171 +
1.172 + if (ptr)
1.173 + {
1.174 + TInt result = KErrGeneral;
1.175 +
1.176 + result = ptr->MmdspcAcceptPlaybackBuffersInvalidFollowingStop();
1.177 +
1.178 + if (result == KErrNone)
1.179 + {
1.180 + INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop finished successfully"));
1.181 +
1.182 + iTestStepResult = EPass;
1.183 + }
1.184 + else
1.185 + {
1.186 + ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop failed with result %d"), result);
1.187 + }
1.188 + }
1.189 + else
1.190 + {
1.191 + INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
1.192 + iTestStepResult = EInconclusive;
1.193 + }
1.194 +
1.195 + return iTestStepResult;
1.196 + }
1.197 +
1.198 +
1.199 +TVerdict CTestStepCIAudioDspControl::DoTestStep0079L()
1.200 + {
1.201 + iTestStepResult = EFail;
1.202 +
1.203 + INFO_PRINTF1(_L("AudioDSPControl - MmdspcGetAudioPlaybackInfo"));
1.204 +
1.205 + //Initialize - with the UID of our test HwDevice
1.206 + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.207 + TUid testUID = {KUidAudioDspControlTestDevice};
1.208 + #else
1.209 + TFourCC testUID('T','0','1','3');
1.210 + #endif
1.211 +
1.212 + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
1.213 +
1.214 + if (iTestStepResult != EPass)
1.215 + {
1.216 + INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
1.217 + return EInconclusive;
1.218 + }
1.219 +
1.220 + // reset the value as previous test is pass
1.221 + iTestStepResult = EFail;
1.222 +
1.223 + // KUidMMFDSPControl
1.224 + MMMFDSPControl* ptr = static_cast <MMMFDSPControl*> (iMMFDevSound->CustomInterface(KUidDSPControl));
1.225 +
1.226 + if (ptr)
1.227 + {
1.228 + TInt result = KErrGeneral;
1.229 + TInt64 samplesPlayed = 0;
1.230 + TInt64 systemTime = 0;
1.231 + TUint bytesDecoderConsumed = 0;
1.232 + TUint bytesDecoderDecoded = 0;
1.233 +
1.234 + result = ptr->MmdspcGetAudioPlaybackInfo (samplesPlayed, systemTime, bytesDecoderConsumed, bytesDecoderDecoded); // call method
1.235 +
1.236 + if ( (result == KErrNone) &&
1.237 + (samplesPlayed == 999) && (systemTime == 999) &&
1.238 + (bytesDecoderConsumed == 999) && (bytesDecoderDecoded == 999) )
1.239 + {
1.240 + INFO_PRINTF1(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo finished successfully"));
1.241 +
1.242 + iTestStepResult = EPass;
1.243 + }
1.244 + else
1.245 + {
1.246 + ERR_PRINTF2(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo failed with result %d"), result);
1.247 + }
1.248 + }
1.249 + else
1.250 + {
1.251 + INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface"));
1.252 + iTestStepResult = EInconclusive;
1.253 + }
1.254 +
1.255 + return iTestStepResult;
1.256 + }