1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/playtruepause.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,943 @@
1.4 +// Copyright (c) 2008-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 +// Part of the TSI_MMFACLNT suite that tests CR1566 (TruePause) on AudioPlayerUtility
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file PlayTruePause.cpp
1.23 +*/
1.24 +
1.25 +#include "playtruepause.h"
1.26 +
1.27 +/*
1.28 + *
1.29 + * RMdaPlayerUtilityTestBase - Test step constructor
1.30 + *
1.31 + */
1.32 +RMdaPlayerUtilityTestBase::RMdaPlayerUtilityTestBase(const TDesC& aTestName, const TDesC& aSectName)
1.33 + : iAudioUtilityState(EStateInitial),
1.34 + iPlayerUtility(NULL),
1.35 + iTimer(NULL),
1.36 + iFilename(KNullDesC),
1.37 + iStop(EFalse),
1.38 + iQuery(EFalse),
1.39 + iVolume(0),
1.40 + iBalance(0),
1.41 + iResume(EFalse),
1.42 + iPauseResumeTimes(0),
1.43 + iPauseApplied(0),
1.44 + iDuration(0),
1.45 + iAllFormat(0),
1.46 + iPositionSupported(EFalse),
1.47 + iMiliSec(EFalse)
1.48 + {
1.49 + iTestStepName = aTestName;
1.50 + iSectName = aSectName;
1.51 + }
1.52 +
1.53 +/*
1.54 + *
1.55 + * ~RMdaPlayerUtilityTestBase - Test step destructor
1.56 + *
1.57 + */
1.58 +RMdaPlayerUtilityTestBase::~RMdaPlayerUtilityTestBase()
1.59 + {
1.60 + if (iPlayerUtility)
1.61 + {
1.62 + delete iPlayerUtility;
1.63 + }
1.64 + if(iTimer)
1.65 + {
1.66 + delete iTimer;
1.67 + }
1.68 + }
1.69 +
1.70 +/*
1.71 + *
1.72 + * KickoffTestL - Starts the test
1.73 + *
1.74 + */
1.75 +void RMdaPlayerUtilityTestBase::KickoffTestL()
1.76 + {
1.77 + INFO_PRINTF1(_L("__________ Creating Player Utility object ___________"));
1.78 + TRAPD(err, iPlayerUtility = CMdaAudioPlayerUtility::NewL(*this));
1.79 + if (err != KErrNone)
1.80 + {
1.81 + ERR_PRINTF2(_L("Could not create Player Utility object. Error = %d"), err);
1.82 + StopTest(err);
1.83 + return;
1.84 + }
1.85 + INFO_PRINTF1(_L("Player Utility State: EStateCreated"));
1.86 + iAudioUtilityState = EStateCreated;
1.87 + DoKickoffTestL();
1.88 + INFO_PRINTF1(_L("Audio Player Utility Event: EEventInitialize"));
1.89 + Fsm(EEventInitialize, KErrNone);
1.90 + }
1.91 +
1.92 +/*
1.93 + *
1.94 + * CloseTest
1.95 + *
1.96 + */
1.97 +void RMdaPlayerUtilityTestBase::CloseTest()
1.98 + {
1.99 + INFO_PRINTF1(KMsgDelete);
1.100 + delete iPlayerUtility;
1.101 + delete iTimer;
1.102 + }
1.103 +
1.104 +/*
1.105 + *
1.106 + * StartTimer - Starts timer and timer callback
1.107 + *
1.108 + */
1.109 +void RMdaPlayerUtilityTestBase::StartTimer(TTimeIntervalMicroSeconds32 aWaitTime)
1.110 + {
1.111 + TTimeIntervalMicroSeconds32 timeInterval;
1.112 +
1.113 + if(aWaitTime <= TTimeIntervalMicroSeconds32(0))
1.114 + {
1.115 + timeInterval = KMicroSecInOneSec;
1.116 + }
1.117 + else
1.118 + {
1.119 + timeInterval = aWaitTime;
1.120 + }
1.121 + TCallBack callback (TimerCallback, this);
1.122 + iTimer->Start(timeInterval, timeInterval, callback);
1.123 + INFO_PRINTF1(_L("Timer has been started"));
1.124 + }
1.125 +
1.126 +/*
1.127 + *
1.128 + * TimerCallback
1.129 + *
1.130 + */
1.131 +TInt RMdaPlayerUtilityTestBase::TimerCallback(TAny* aPtr)
1.132 + {
1.133 + static_cast<RMdaPlayerUtilityTestBase*>(aPtr)->DoTimerCallback();
1.134 + return KErrNone;
1.135 + }
1.136 +
1.137 +/*
1.138 + *
1.139 + * DoTimerCallback
1.140 + *
1.141 + */
1.142 +void RMdaPlayerUtilityTestBase::DoTimerCallback()
1.143 + {
1.144 + INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete"));
1.145 + Fsm (EEventTimerComplete, KErrNone);
1.146 + }
1.147 +
1.148 +/*
1.149 + *
1.150 + * Fsm - Executes playing events of AudioPlayerUtility in sequence
1.151 + *
1.152 + */
1.153 +void RMdaPlayerUtilityTestBase::Fsm(TMdaAudioUtilityEvent aMdaAudioUtilityEvent, TInt aError)
1.154 + {
1.155 + switch (iAudioUtilityState)
1.156 + {
1.157 + case EStateCreated:
1.158 + {
1.159 + __ASSERT_ALWAYS((aError == KErrNone), Panic(iTestStepName.Right(KPanicLength), EFsmIncorrectErrorPassed));
1.160 + if (aMdaAudioUtilityEvent == EEventInitialize)
1.161 + {
1.162 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::OpenFileL"));
1.163 + TRAPD(err,iPlayerUtility->OpenFileL(iFilename));
1.164 + if(err)
1.165 + {
1.166 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::OpenFileL left with err = %d"),err);
1.167 + StopTest(err);
1.168 + break;
1.169 + }
1.170 + INFO_PRINTF1(_L("AudioPlayerUtility State: EStateInitializing"));
1.171 + iAudioUtilityState = EStateInitializing;
1.172 + }
1.173 + else
1.174 + {
1.175 + ERR_PRINTF2(_L("MdaAudioUtility EEventInitialize not received as expected. Received event: %d"), aMdaAudioUtilityEvent);
1.176 + StopTest(aError, EFail);
1.177 + }
1.178 + break;
1.179 + }
1.180 + case EStateInitializing:
1.181 + {
1.182 + if (aMdaAudioUtilityEvent == EEventInitComplete && aError == KErrNone)
1.183 + {
1.184 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::Play"));
1.185 + iPlayerUtility->Play();
1.186 + INFO_PRINTF1(_L("AudioPlayerUtility State: EStatePlaying"));
1.187 + iAudioUtilityState = EStatePlaying;
1.188 + if(iMiliSec)
1.189 + {
1.190 + StartTimer(iDuration*KMiliSecInOneSec);
1.191 + }
1.192 + else
1.193 + {
1.194 + StartTimer(iDuration*KMicroSecInOneSec);
1.195 + }
1.196 + }
1.197 + else if (aMdaAudioUtilityEvent == EEventInitComplete && aError != KErrNone)
1.198 + {
1.199 + ERR_PRINTF2(_L("MapcInitComplete returned with error = %d"), aError);
1.200 + StopTest(aError);
1.201 + }
1.202 + else
1.203 + {
1.204 + ERR_PRINTF2(_L("MdaAudioUtility EEventInitComplete not received as expected. Received event: %d"), aMdaAudioUtilityEvent);
1.205 + StopTest(aError, EFail);
1.206 + }
1.207 + break;
1.208 + }
1.209 + case EStatePlaying:
1.210 + {
1.211 + if(aMdaAudioUtilityEvent == EEventTimerComplete)
1.212 + {
1.213 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::Pause"));
1.214 + TInt err = iPlayerUtility->Pause();
1.215 + iPauseApplied = ETrue;
1.216 + INFO_PRINTF1(_L("AudioPlayerUtility State: EStatePause"));
1.217 + iAudioUtilityState = EStatePause;
1.218 + }
1.219 + else
1.220 + {
1.221 + ERR_PRINTF2(_L("MdaAudioUtility EEventTimerComplete not received as expected. Received event: %d"), aMdaAudioUtilityEvent);
1.222 + StopTest(aError, EFail);
1.223 + }
1.224 + break;
1.225 + }
1.226 + case EStatePause:
1.227 + {
1.228 + if (aMdaAudioUtilityEvent == EEventTimerComplete)
1.229 + {
1.230 + if(iQuery)
1.231 + {
1.232 + INFO_PRINTF2(_L("Setting AudioPlayerUtility volume = %d"), iVolume);
1.233 + TInt err = iPlayerUtility->SetVolume(iVolume);
1.234 + if (err != KErrNone)
1.235 + {
1.236 + ERR_PRINTF2(_L("Setting volume failed. It returned with error = %d"), err);
1.237 + StopTest(err);
1.238 + break;
1.239 + }
1.240 + TInt volume = 0;
1.241 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::GetVolume for verifying"));
1.242 + err = iPlayerUtility->GetVolume(volume);
1.243 + if (err != KErrNone)
1.244 + {
1.245 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetVolume returned with error = %d"), err);
1.246 + StopTest(err);
1.247 + break;
1.248 + }
1.249 + if(iVolume != volume)
1.250 + {
1.251 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::SetVolume returned different set value = %d"), volume);
1.252 + StopTest(KErrGeneral);
1.253 + break;
1.254 + }
1.255 + INFO_PRINTF2(_L("Setting AudioPlayerUtility balance = %d"), iBalance);
1.256 + err = iPlayerUtility->SetBalance(iBalance);
1.257 + if (err != KErrNone)
1.258 + {
1.259 + ERR_PRINTF2(_L("Setting balance failed. It returned with error = %d"), err);
1.260 + StopTest(err);
1.261 + break;
1.262 + }
1.263 + TInt balance = 0;
1.264 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::GetBalance for verifying"));
1.265 + err = iPlayerUtility->GetBalance(balance);
1.266 + if (err != KErrNone)
1.267 + {
1.268 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetBalance returned with error = %d"), err);
1.269 + StopTest(err);
1.270 + break;
1.271 + }
1.272 + if(Abs(iBalance - balance)<KBalanceTolerance)
1.273 + {
1.274 + INFO_PRINTF2(_L("CMdaAudioPlayerUtility::SetBalance returned expected set value %d"),iBalance);
1.275 + }
1.276 + else
1.277 + {
1.278 + ERR_PRINTF3(_L("CMdaAudioPlayerUtility::SetBalance returned different set value %d. Retrieved %d"), iBalance, balance);
1.279 + StopTest(KErrGeneral);
1.280 + break;
1.281 + }
1.282 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::Play"));
1.283 + iPlayerUtility->Play();
1.284 + iTimer->Cancel();
1.285 + INFO_PRINTF1(_L("Audio Player Utility State: EStatePlaying"));
1.286 + iAudioUtilityState = EStatePlaying;
1.287 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::GetVolume for verifying"));
1.288 + err = iPlayerUtility->GetVolume(volume);
1.289 + if (err != KErrNone)
1.290 + {
1.291 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetVolume returned with error = %d"), err);
1.292 + StopTest(err);
1.293 + break;
1.294 + }
1.295 + if (volume == iVolume)
1.296 + {
1.297 + INFO_PRINTF1(_L("CMdaAudioPlayerUtility::GetVolume returned equal previous set value as expected"));
1.298 + }
1.299 + else
1.300 + {
1.301 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetVolume returned different set value = %d"), iVolume);
1.302 + StopTest (KErrGeneral);
1.303 + break;
1.304 + }
1.305 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::GetBalance for verifying"));
1.306 + err = iPlayerUtility->GetBalance(balance);
1.307 + if (err != KErrNone)
1.308 + {
1.309 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetBalance returned with error = %d"), err);
1.310 + StopTest(err);
1.311 + break;
1.312 + }
1.313 + if(Abs(iBalance - balance)<KBalanceTolerance)
1.314 + {
1.315 + INFO_PRINTF2(_L("CMdaAudioPlayerUtility::GetBalance returned expected set value %d"),iBalance);
1.316 + }
1.317 + else
1.318 + {
1.319 + ERR_PRINTF3(_L("CMdaAudioPlayerUtility::GetBalance returned different set value = %d. Retrieved %d"), iBalance, balance);
1.320 + StopTest(KErrGeneral);
1.321 + break;
1.322 + }
1.323 + }
1.324 + if(iResume || iStop)
1.325 + {
1.326 + TTimeIntervalMicroSeconds position1 = 0;
1.327 + if(iPositionSupported)
1.328 + {
1.329 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::GetPosition"));
1.330 + TInt err = iPlayerUtility->GetPosition(position1);
1.331 + if(err)
1.332 + {
1.333 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetPosition returned with err = %d"), err);
1.334 + StopTest(err);
1.335 + break;
1.336 + }
1.337 + INFO_PRINTF2(_L("AudioPlayerUtility position = %Ld"), position1.Int64());
1.338 + if(position1.Int64() == 0)
1.339 + {
1.340 + INFO_PRINTF1(_L("AudioPlayerUtility position must be longer than 0"));
1.341 + StopTest(KErrGeneral);
1.342 + break;
1.343 + }
1.344 + }
1.345 + if(iStop)
1.346 + {
1.347 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::Stop"));
1.348 + iPlayerUtility->Stop();
1.349 + }
1.350 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::Play"));
1.351 + iPlayerUtility->Play();
1.352 + if((--iPauseResumeTimes) <= 0)
1.353 + {
1.354 + iTimer->Cancel();
1.355 + }
1.356 + INFO_PRINTF1(_L("AudioPlayerUtility State: EStatePlaying"));
1.357 + iAudioUtilityState = EStatePlaying;
1.358 + TTimeIntervalMicroSeconds position2 = 0;
1.359 + if(iPositionSupported)
1.360 + {
1.361 + INFO_PRINTF1(_L("Calling CMdaAudioPlayerUtility::GetPosition"));
1.362 + TInt err = iPlayerUtility->GetPosition(position2);
1.363 + if(err)
1.364 + {
1.365 + ERR_PRINTF2(_L("CMdaAudioPlayerUtility::GetPosition returned with err = %d"), err);
1.366 + StopTest(err);
1.367 + break;
1.368 + }
1.369 + INFO_PRINTF2(_L(" AudioPlayerUtility position = %Ld"), position2.Int64());
1.370 + }
1.371 + if(iStop)
1.372 + {
1.373 + if(position2.Int64() == 0)
1.374 + {
1.375 + INFO_PRINTF1(_L("AudioPlayerUtility position was reset as expected"));
1.376 + }
1.377 + else
1.378 + {
1.379 + INFO_PRINTF1(_L("AudioPlayerUtility position was not reset"));
1.380 + StopTest(KErrGeneral);
1.381 + break;
1.382 + }
1.383 + }
1.384 + else if(iPositionSupported)
1.385 + {
1.386 + if(Abs(position2.Int64() - position1.Int64()) <= KOneSecond/2)
1.387 + {
1.388 + INFO_PRINTF2(_L("AudioPlayerUtility position continued from expected position %Ld"),position2.Int64());
1.389 + }
1.390 + else
1.391 + {
1.392 + ERR_PRINTF3(_L("Playback did not resume from expected position. Expected %Ld Retrieved %Ld"),position1.Int64(),position2.Int64());
1.393 + StopTest(KErrGeneral);
1.394 + break;
1.395 + }
1.396 + }
1.397 + else
1.398 + {
1.399 + INFO_PRINTF1(_L("AudioPlayerUtility continue playing "));
1.400 + }
1.401 +
1.402 + }
1.403 + }
1.404 + else
1.405 + {
1.406 + ERR_PRINTF2(_L("MdaAudioUtility EEventTimerComplete not received as expected. Received event: %d"), aMdaAudioUtilityEvent);
1.407 + StopTest(aError, EFail);
1.408 + }
1.409 + break;
1.410 + }
1.411 + default:
1.412 + {
1.413 + ERR_PRINTF2(_L("Invalid MdaAudioUtility state received: %d"), aMdaAudioUtilityEvent);
1.414 + StopTest(KErrGeneral);
1.415 + }
1.416 + }
1.417 + }
1.418 +
1.419 +/*
1.420 + *
1.421 + * MapcInitComplete - From MMdaAudioPlayerCallback
1.422 + *
1.423 + */
1.424 +void RMdaPlayerUtilityTestBase::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
1.425 + {
1.426 + INFO_PRINTF1(_L("========== Audio Player Utility MapcInitComplete() callback =========="));
1.427 + if(iAudioUtilityState == EStateInitializing)
1.428 + {
1.429 + INFO_PRINTF1(_L(" Audio Player Utility Event: EEventInitComplete"));
1.430 + Fsm(EEventInitComplete, aError);
1.431 + }
1.432 + }
1.433 +
1.434 +/*
1.435 + *
1.436 + * MapcPlayComplete - From MMdaAudioPlayerCallback
1.437 + *
1.438 + */
1.439 +void RMdaPlayerUtilityTestBase::MapcPlayComplete(TInt aError)
1.440 + {
1.441 + INFO_PRINTF1(_L("========== Audio Player Utility MapcPlayComplete() callback =========="));
1.442 + if (aError == KErrNone)
1.443 + {
1.444 + INFO_PRINTF2(_L("AudioPlayerUtility called MapcPlayComplete with error = %d as expected"), aError);
1.445 + StopTest();
1.446 + }
1.447 + else
1.448 + {
1.449 + ERR_PRINTF2(_L("AudioPlayerUtility called MapcPlayComplete with error = %d"), aError);
1.450 + ERR_PRINTF2(_L("Expected error = %d"), KErrNone);
1.451 + StopTest(aError);
1.452 + }
1.453 + }
1.454 +
1.455 +/*
1.456 + *
1.457 + * Panic
1.458 + *
1.459 + */
1.460 +void RMdaPlayerUtilityTestBase::Panic(const TDesC &aCategory, TInt aReason)
1.461 + {
1.462 + User::Panic(aCategory, aReason);
1.463 + }
1.464 +
1.465 +/*
1.466 + *========================================================================================================
1.467 + * MM-MMF-ACLNT-I-0185-HP
1.468 + *========================================================================================================
1.469 + */
1.470 +RMdaPlayerUtiliyPauseStopAndPlayWavTest::RMdaPlayerUtiliyPauseStopAndPlayWavTest(const TDesC& aTestName, const TDesC& aSectName)
1.471 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.472 + {
1.473 + iStop = ETrue;
1.474 + iPositionSupported = ETrue;
1.475 + }
1.476 +
1.477 +/*
1.478 + *
1.479 + * NewL
1.480 + *
1.481 + */
1.482 +RMdaPlayerUtiliyPauseStopAndPlayWavTest* RMdaPlayerUtiliyPauseStopAndPlayWavTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.483 + {
1.484 + RMdaPlayerUtiliyPauseStopAndPlayWavTest * self = new(ELeave)RMdaPlayerUtiliyPauseStopAndPlayWavTest(aTestName, aSectName);
1.485 + return self;
1.486 + }
1.487 +
1.488 +/*
1.489 + *
1.490 + * DoKickoffTestL
1.491 + *
1.492 + */
1.493 +void RMdaPlayerUtiliyPauseStopAndPlayWavTest::DoKickoffTestL()
1.494 + {
1.495 + TPtrC filename;
1.496 + // Get the filename of the audio file to play
1.497 + if (!GetStringFromConfig(iSectName, KFilenameWAV, filename))
1.498 + {
1.499 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.500 + StopTest(KErrNotFound);
1.501 + return;
1.502 + }
1.503 + // open using RFile for playback
1.504 + iFilename.Copy(filename);
1.505 + INFO_PRINTF2(_L("File under test -> %S"), &iFilename);
1.506 + if (!GetIntFromConfig(iSectName, KDuration1, iDuration))
1.507 + {
1.508 + ERR_PRINTF2(KMsgErrorGetParameter, &KDuration1);
1.509 + StopTest(KErrNotFound);
1.510 + return;
1.511 + }
1.512 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.513 + }
1.514 +/*
1.515 + *========================================================================================================
1.516 + * MM-MMF-ACLNT-I-0186-HP
1.517 + *========================================================================================================
1.518 + */
1.519 +RMdaPlayerUtilityQueryPauseAndPlayWavTest::RMdaPlayerUtilityQueryPauseAndPlayWavTest(const TDesC& aTestName, const TDesC& aSectName)
1.520 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.521 + {
1.522 + iQuery = ETrue;
1.523 + }
1.524 +
1.525 +/*
1.526 + *
1.527 + * NewL
1.528 + *
1.529 + */
1.530 +RMdaPlayerUtilityQueryPauseAndPlayWavTest* RMdaPlayerUtilityQueryPauseAndPlayWavTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.531 + {
1.532 + RMdaPlayerUtilityQueryPauseAndPlayWavTest * self = new(ELeave)RMdaPlayerUtilityQueryPauseAndPlayWavTest(aTestName, aSectName);
1.533 + return self;
1.534 + }
1.535 +
1.536 +/*
1.537 + *
1.538 + * DoKickoffTestL
1.539 + *
1.540 + */
1.541 +void RMdaPlayerUtilityQueryPauseAndPlayWavTest::DoKickoffTestL()
1.542 + {
1.543 + TPtrC filename;
1.544 + // Get the filename of the audio file to play
1.545 + if (!GetStringFromConfig(iSectName, KFilenameWAV, filename))
1.546 + {
1.547 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.548 + StopTest(KErrNotFound);
1.549 + return;
1.550 + }
1.551 + // open using RFile for playback
1.552 + iFilename.Copy(filename);
1.553 + INFO_PRINTF2(_L("File under test -> %S"), &iFilename);
1.554 + if (!GetIntFromConfig(iSectName, KVolume, iVolume))
1.555 + {
1.556 + ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
1.557 + StopTest(KErrNotFound);
1.558 + return;
1.559 + }
1.560 + if (!GetIntFromConfig(iSectName, KBalance, iBalance))
1.561 + {
1.562 + ERR_PRINTF2(KMsgErrorGetParameter, &KBalance);
1.563 + StopTest(KErrNotFound);
1.564 + return;
1.565 + }
1.566 + if (!GetIntFromConfig(iSectName, KDuration1, iDuration))
1.567 + {
1.568 + ERR_PRINTF2(KMsgErrorGetParameter, &KDuration1);
1.569 + StopTest(KErrNotFound);
1.570 + return;
1.571 + }
1.572 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.573 + }
1.574 +
1.575 +/*
1.576 + *========================================================================================================
1.577 + * MM-MMF-ACLNT-I-0187-HP
1.578 + *========================================================================================================
1.579 + */
1.580 +RMdaPlayerUtilityPauseAndPlaySqnTest::RMdaPlayerUtilityPauseAndPlaySqnTest(const TDesC& aTestName, const TDesC& aSectName)
1.581 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.582 + {
1.583 + iResume = ETrue;
1.584 + }
1.585 +
1.586 +/*
1.587 + *
1.588 + * NewL
1.589 + *
1.590 + */
1.591 +RMdaPlayerUtilityPauseAndPlaySqnTest* RMdaPlayerUtilityPauseAndPlaySqnTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.592 + {
1.593 + RMdaPlayerUtilityPauseAndPlaySqnTest * self = new(ELeave)RMdaPlayerUtilityPauseAndPlaySqnTest(aTestName, aSectName);
1.594 + return self;
1.595 + }
1.596 +
1.597 +/*
1.598 + *
1.599 + * DoKickoffTestL
1.600 + *
1.601 + */
1.602 +void RMdaPlayerUtilityPauseAndPlaySqnTest::DoKickoffTestL()
1.603 + {
1.604 + TPtrC filename;
1.605 + // Get the filename of the audio file to play
1.606 + if (!GetStringFromConfig(iSectName, KFilenameSQN, filename))
1.607 + {
1.608 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.609 + StopTest(KErrNotFound);
1.610 + return;
1.611 + }
1.612 + // open using RFile for playback
1.613 + iFilename.Copy(filename);
1.614 + INFO_PRINTF2(_L("File under test -> %S"), &iFilename);
1.615 + if (!GetIntFromConfig(iSectName, KDuration1, iDuration))
1.616 + {
1.617 + ERR_PRINTF2(KMsgErrorGetParameter, &KDuration1);
1.618 + StopTest(KErrNotFound);
1.619 + return;
1.620 + }
1.621 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.622 + }
1.623 +
1.624 +/*
1.625 + *========================================================================================================
1.626 + * MM-MMF-ACLNT-I-0188-HP
1.627 + *========================================================================================================
1.628 + */
1.629 +RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest::RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest(const TDesC& aTestName, const TDesC& aSectName)
1.630 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.631 + {
1.632 + iResume = ETrue;
1.633 + iPauseResumeTimes = KRepeatThrice;
1.634 + }
1.635 +
1.636 +/*
1.637 + *
1.638 + * NewL
1.639 + *
1.640 + */
1.641 +RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest* RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.642 + {
1.643 + RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest * self = new(ELeave)RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest(aTestName, aSectName);
1.644 + return self;
1.645 + }
1.646 +
1.647 +/*
1.648 + *
1.649 + * DoKickoffTestL
1.650 + *
1.651 + */
1.652 +void RMdaPlayerUtilityPauseAndPlayThreeTimesSqnTest::DoKickoffTestL()
1.653 + {
1.654 + TPtrC filename;
1.655 + // Get the filename of the audio file to play
1.656 + if (!GetStringFromConfig(iSectName, KFilenameSQN, filename))
1.657 + {
1.658 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.659 + StopTest(KErrNotFound);
1.660 + return;
1.661 + }
1.662 + // open using RFile for playback
1.663 + iFilename.Copy(filename);
1.664 + INFO_PRINTF2(_L("File under test -> %S"), &iFilename);
1.665 + if (!GetIntFromConfig(iSectName, KDuration1, iDuration))
1.666 + {
1.667 + ERR_PRINTF2(KMsgErrorGetParameter, &KDuration1);
1.668 + StopTest(KErrNotFound);
1.669 + return;
1.670 + }
1.671 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.672 + }
1.673 +
1.674 +/*
1.675 + *========================================================================================================
1.676 + * MM-MMF-ACLNT-I-0189-HP
1.677 + *========================================================================================================
1.678 + */
1.679 +RMdaPlayerUtilityPauseStopAndPlaySqnTest::RMdaPlayerUtilityPauseStopAndPlaySqnTest(const TDesC& aTestName, const TDesC& aSectName)
1.680 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.681 + {
1.682 + iStop = ETrue;
1.683 + }
1.684 +
1.685 +/*
1.686 + *
1.687 + * NewL
1.688 + *
1.689 + */
1.690 +RMdaPlayerUtilityPauseStopAndPlaySqnTest* RMdaPlayerUtilityPauseStopAndPlaySqnTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.691 + {
1.692 + RMdaPlayerUtilityPauseStopAndPlaySqnTest * self = new(ELeave)RMdaPlayerUtilityPauseStopAndPlaySqnTest(aTestName, aSectName);
1.693 + return self;
1.694 + }
1.695 +
1.696 +/*
1.697 + *
1.698 + * DoKickoffTestL
1.699 + *
1.700 + */
1.701 +void RMdaPlayerUtilityPauseStopAndPlaySqnTest::DoKickoffTestL()
1.702 + {
1.703 + TPtrC filename;
1.704 + // Get the filename of the audio file to play
1.705 + if (!GetStringFromConfig(iSectName, KFilenameSQN, filename))
1.706 + {
1.707 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.708 + StopTest(KErrNotFound);
1.709 + return;
1.710 + }
1.711 + // open using RFile for playback
1.712 + iFilename.Copy(filename);
1.713 + INFO_PRINTF2(_L("File under test -> %S"), &iFilename);
1.714 + if (!GetIntFromConfig(iSectName, KDuration1, iDuration))
1.715 + {
1.716 + ERR_PRINTF2(KMsgErrorGetParameter, &KDuration1);
1.717 + StopTest(KErrNotFound);
1.718 + return;
1.719 + }
1.720 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.721 + }
1.722 +
1.723 +/*
1.724 + *========================================================================================================
1.725 + * MM-MMF-ACLNT-I-0190-HP
1.726 + *========================================================================================================
1.727 + */
1.728 +RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest::RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest(const TDesC& aTestName, const TDesC& aSectName)
1.729 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.730 + {
1.731 + iQuery = ETrue;
1.732 + }
1.733 +
1.734 +/*
1.735 + *
1.736 + * NewL
1.737 + *
1.738 + */
1.739 +RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest* RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.740 + {
1.741 + RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest * self = new(ELeave)RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest(aTestName, aSectName);
1.742 + return self;
1.743 + }
1.744 +
1.745 +/*
1.746 + *
1.747 + * DoKickoffTestL
1.748 + *
1.749 + */
1.750 +void RMdaPlayerUtilityGetVolumeAndBalancePauseAndPlaySqnTest::DoKickoffTestL()
1.751 + {
1.752 + TPtrC filename;
1.753 + // Get the filename of the audio file to play
1.754 + if (!GetStringFromConfig(iSectName, KFilenameSQN, filename))
1.755 + {
1.756 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.757 + StopTest(KErrNotFound);
1.758 + return;
1.759 + }
1.760 + // open using RFile for playback
1.761 + iFilename.Copy(filename);
1.762 + INFO_PRINTF2(_L("File under test -> %S"), &iFilename);
1.763 + if (!GetIntFromConfig(iSectName, KVolume, iVolume))
1.764 + {
1.765 + ERR_PRINTF2(KMsgErrorGetParameter, &KVolume);
1.766 + StopTest(KErrNotFound);
1.767 + return;
1.768 + }
1.769 + if (!GetIntFromConfig(iSectName, KBalance, iBalance))
1.770 + {
1.771 + ERR_PRINTF2(KMsgErrorGetParameter, &KBalance);
1.772 + StopTest(KErrNotFound);
1.773 + return;
1.774 + }
1.775 + if (!GetIntFromConfig(iSectName, KDuration1, iDuration))
1.776 + {
1.777 + ERR_PRINTF2(KMsgErrorGetParameter, &KDuration1);
1.778 + StopTest(KErrNotFound);
1.779 + return;
1.780 + }
1.781 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.782 + }
1.783 +
1.784 +/*
1.785 + *========================================================================================================
1.786 + * MM-MMF-ACLNT-I-0191-HP
1.787 + *========================================================================================================
1.788 + */
1.789 +RMdaPlayerUtilityPauseAndPlayFormatsTest::RMdaPlayerUtilityPauseAndPlayFormatsTest(const TDesC& aTestName, const TDesC& aSectName)
1.790 + : RMdaPlayerUtilityTestBase(aTestName, aSectName)
1.791 + {
1.792 + iResume = ETrue;
1.793 + iPositionSupported = ETrue;
1.794 + iMiliSec = ETrue;
1.795 + }
1.796 +
1.797 +/*
1.798 + *
1.799 + * NewL
1.800 + *
1.801 + */
1.802 +RMdaPlayerUtilityPauseAndPlayFormatsTest* RMdaPlayerUtilityPauseAndPlayFormatsTest::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.803 + {
1.804 + RMdaPlayerUtilityPauseAndPlayFormatsTest * self = new(ELeave)RMdaPlayerUtilityPauseAndPlayFormatsTest(aTestName, aSectName);
1.805 + return self;
1.806 + }
1.807 +
1.808 +/*
1.809 + *
1.810 + * DoKickoffTestL
1.811 + *
1.812 + */
1.813 +void RMdaPlayerUtilityPauseAndPlayFormatsTest::DoKickoffTestL()
1.814 + {
1.815 + TPtrC filename;
1.816 + // Get the filename of the audio file to play
1.817 + if (!GetStringFromConfig(iSectName, KFilenamePCM16, filename))
1.818 + {
1.819 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.820 + StopTest(KErrNotFound);
1.821 + return;
1.822 + }
1.823 + // open using RFile for playback
1.824 + iFilename.Copy(filename);
1.825 + INFO_PRINTF2(_L("File \"PCM16\" under test -> %S"), &iFilename);
1.826 + if (!GetIntFromConfig(iSectName, KDurationMiliSec, iDuration))
1.827 + {
1.828 + ERR_PRINTF2(KMsgErrorGetParameter, &KDurationMiliSec);
1.829 + StopTest(KErrNotFound);
1.830 + return;
1.831 + }
1.832 + iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
1.833 + }
1.834 +
1.835 +/*
1.836 + *
1.837 + * MapcPlayComplete - From MMdaAudioPlayerCallback
1.838 + *
1.839 + */
1.840 +void RMdaPlayerUtilityPauseAndPlayFormatsTest::MapcPlayComplete(TInt aError)
1.841 + {
1.842 + INFO_PRINTF1(_L("========== Audio Player Utility MapcPlayComplete() callback =========="));
1.843 + if (aError == KErrNone)
1.844 + {
1.845 + if(iPauseApplied)
1.846 + {
1.847 + INFO_PRINTF2(_L("AudioPlayerUtility called MapcPlayComplete with error = %d as expected"), aError);
1.848 + TBuf<KFileFormatSize> fileFormat;
1.849 + switch(iAllFormat)
1.850 + {
1.851 + case EPCM8Format:
1.852 + {
1.853 + fileFormat.Copy(KFilenamePCM8);
1.854 + INFO_PRINTF2(_L("File \"PCM8\" under test -> %S"), &fileFormat);
1.855 + break;
1.856 + }
1.857 + case EPCMU16Format:
1.858 + {
1.859 + fileFormat.Copy(KFilenamePCMU16);
1.860 + INFO_PRINTF2(_L("File \"PCMU16\" under test -> %S"), &fileFormat);
1.861 + break;
1.862 + }
1.863 + case EPCMU16BEFormat:
1.864 + {
1.865 + fileFormat.Copy(KFilenamePCMU16BE);
1.866 + INFO_PRINTF2(_L("File \"PCMU16BE\" under test -> %S"), &fileFormat);
1.867 + break;
1.868 + }
1.869 + case EALAWFormat:
1.870 + {
1.871 + fileFormat.Copy(KFilenameAlaw);
1.872 + INFO_PRINTF2(_L("File \"ALAW\" under test -> %S"), &fileFormat);
1.873 + break;
1.874 + }
1.875 + case EMULAWFormat:
1.876 + {
1.877 + fileFormat.Copy(KFilenameMulaw);
1.878 + INFO_PRINTF2(_L("File \"MULAW\" under test -> %S"), &fileFormat);
1.879 + break;
1.880 + }
1.881 + case EGSM610Format:
1.882 + {
1.883 + fileFormat.Copy(KFilenameGSM610);
1.884 + INFO_PRINTF2(_L("File \"GSM610\" under test -> %S"), &fileFormat);
1.885 + break;
1.886 + }
1.887 + case EIMADFormat:
1.888 + {
1.889 + fileFormat.Copy(KFilenameIMAD);
1.890 + INFO_PRINTF2(_L("File \"IMAD\" under test -> %S"), &fileFormat);
1.891 + break;
1.892 + }
1.893 + case EPCMU8Format:
1.894 + {
1.895 + fileFormat.Copy(KFilenamePCMU8);
1.896 + INFO_PRINTF2(_L("File \"PCMU8\" under test -> %S"), &fileFormat);
1.897 + break;
1.898 + }
1.899 + case EOGGFormat:
1.900 + {
1.901 + fileFormat.Copy(KFilenameOGG);
1.902 + INFO_PRINTF2(_L("File \"OGG\" under test -> %S"), &fileFormat);
1.903 + break;
1.904 + }
1.905 + default:
1.906 + {
1.907 + break;
1.908 + }
1.909 + }
1.910 + if(iAllFormat > EOGGFormat)
1.911 + {
1.912 + StopTest();
1.913 + }
1.914 + else
1.915 + {
1.916 + ++iAllFormat;
1.917 + iPauseApplied = EFalse;
1.918 + TPtrC filename;
1.919 + if (!GetStringFromConfig(iSectName, fileFormat, filename))
1.920 + {
1.921 + ERR_PRINTF1(_L("Filename could not be retrieved from ini file"));
1.922 + StopTest(KErrNotFound);
1.923 + return;
1.924 + }
1.925 + iFilename.Copy(filename);
1.926 + INFO_PRINTF1(_L("Player Utility State: EStateCreated"));
1.927 + iAudioUtilityState = EStateCreated;
1.928 + INFO_PRINTF1(_L("Audio Player Utility Event: EEventInitialize"));
1.929 + Fsm(EEventInitialize, KErrNone);
1.930 + }
1.931 + }
1.932 + else
1.933 + {
1.934 + ERR_PRINTF2(_L("AudioPlayerUtility called MapcPlayComplete with error = %d"), aError);
1.935 + ERR_PRINTF1(_L("Audio file was finished before continuing"));
1.936 + StopTest(KErrGeneral);
1.937 + }
1.938 + }
1.939 + else
1.940 + {
1.941 + ERR_PRINTF2(_L("AudioPlayerUtility called MapcPlayComplete with error = %d"), aError);
1.942 + ERR_PRINTF2(_L("Expected error = %d"), KErrNone);
1.943 + StopTest(aError);
1.944 + }
1.945 + }
1.946 +