1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/TestPlayerUtilsARN.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2732 @@
1.4 +// Copyright (c) 2005-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 +// CPP file: Audio Resource Notification tests for Audio Player.
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file TestPlayerUtilsARN.cpp
1.23 +*/
1.24 +
1.25 +#include "TestAudioClientUtilitiesARN.h"
1.26 +
1.27 +//------------------------------------------------------------------------------
1.28 +//********************PREQ 797 - Audio Resource Notification********************
1.29 +//------------------------------------------------------------------------------
1.30 +
1.31 +//
1.32 +//CTestMdaAudioPlayerCallbackSupport
1.33 +//
1.34 +
1.35 +/**
1.36 + * NewL
1.37 + */
1.38 +CTestMdaAudioPlayerCallbackSupport* CTestMdaAudioPlayerCallbackSupport::NewL(MTestAudioPlayerCallback& aCallback)
1.39 + {
1.40 + return new(ELeave) CTestMdaAudioPlayerCallbackSupport(aCallback);
1.41 + }
1.42 +
1.43 +/**
1.44 + * MapcInitComplete
1.45 + */
1.46 +void CTestMdaAudioPlayerCallbackSupport::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
1.47 + {
1.48 + iCallback.MapcInitCompleteTest(aError, aDuration, *this);
1.49 + }
1.50 +
1.51 +/**
1.52 + * MapcPlayComplete
1.53 + */
1.54 +void CTestMdaAudioPlayerCallbackSupport::MapcPlayComplete(TInt aError)
1.55 + {
1.56 + iCallback.MapcPlayCompleteTest(aError, *this);
1.57 + }
1.58 +
1.59 +/**
1.60 + * MarncResourceAvailable
1.61 + */
1.62 +void CTestMdaAudioPlayerCallbackSupport::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData)
1.63 + {
1.64 + iCallback.MarncResourceAvailableTest(aNotificationEventId, aNotificationData, *this);
1.65 + }
1.66 +
1.67 +/**
1.68 + * Constructor
1.69 + */
1.70 +CTestMdaAudioPlayerCallbackSupport::CTestMdaAudioPlayerCallbackSupport(MTestAudioPlayerCallback& aCallback):iCallback(aCallback)
1.71 + {
1.72 +
1.73 + }
1.74 +
1.75 +//
1.76 +//CTestMmfAclntAudioPlayerARN
1.77 +//
1.78 +
1.79 +/**
1.80 + * Constructor
1.81 + */
1.82 +CTestMmfAclntAudioPlayerARN::CTestMmfAclntAudioPlayerARN(const TDesC& aTestName, const TDesC& aSectName)
1.83 + {
1.84 + // store the name of this test case
1.85 + iTestStepName=aTestName;
1.86 + iHeapSize = 3600000;
1.87 + iSectName = aSectName;
1.88 + }
1.89 +
1.90 +
1.91 +/**
1.92 + * MapcInitCompleteTest
1.93 + */
1.94 +void CTestMmfAclntAudioPlayerARN::MapcInitCompleteTest(TInt aError, const TTimeIntervalMicroSeconds& aDuration, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1.95 + {
1.96 + iDuration = aDuration;
1.97 + if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1.98 + {
1.99 + INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError);
1.100 + TRAP(iError, FsmL(EMapcInitComplete1, aError));
1.101 + }
1.102 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1.103 + {
1.104 + INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError);
1.105 + TRAP(iError, FsmL(EMapcInitComplete2, aError));
1.106 + }
1.107 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1.108 + {
1.109 + INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback InitComplete (%d)"),aError);
1.110 + TRAP(iError, FsmL(EMapcInitComplete3, aError));
1.111 + }
1.112 + }
1.113 +
1.114 +
1.115 +/**
1.116 + * MapcPlayCompleteTest
1.117 + */
1.118 +void CTestMmfAclntAudioPlayerARN::MapcPlayCompleteTest(TInt aError, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1.119 + {
1.120 + if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1.121 + {
1.122 + INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1.123 + TRAP(iError, FsmL(EMapcPlayComplete1, aError));
1.124 + }
1.125 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1.126 + {
1.127 + INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1.128 + TRAP(iError, FsmL(EMapcPlayComplete2, aError));
1.129 + }
1.130 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1.131 + {
1.132 + INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1.133 + TRAP(iError, FsmL(EMapcPlayComplete3, aError));
1.134 + }
1.135 + }
1.136 +
1.137 +
1.138 +/**
1.139 + * MarncResourceAvailableTest
1.140 + */
1.141 +void CTestMmfAclntAudioPlayerARN::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1.142 + {
1.143 + if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
1.144 + {
1.145 + INFO_PRINTF1(_L("iAudioPlayer::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable"));
1.146 +
1.147 + //Convert TDesc8 to TInt64
1.148 + TMMFTimeIntervalMicroSecondsPckg timeIntvbuf;
1.149 + timeIntvbuf.Copy(aNotificationData);
1.150 + TTimeIntervalMicroSeconds intPos = timeIntvbuf();
1.151 + iPosition = intPos;
1.152 + if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1.153 + {
1.154 + INFO_PRINTF1(_L("iAudioPlayer1 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable..waiting for playcomplete"));
1.155 + TRAP(iError, FsmL(EMarncResourceAvailable1, KErrNone));
1.156 + }
1.157 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1.158 + {
1.159 + INFO_PRINTF1(_L("iAudioPlayer2 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
1.160 + TRAP(iError, FsmL(EMarncResourceAvailable2, KErrNone));
1.161 + }
1.162 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1.163 + {
1.164 + INFO_PRINTF1(_L("iAudioPlayer3 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
1.165 + TRAP(iError, FsmL(EMarncResourceAvailable3, KErrNone));
1.166 + }
1.167 + }
1.168 + else
1.169 + {
1.170 + INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable"));
1.171 + }
1.172 + }
1.173 +
1.174 +/**
1.175 + * DoTestStepPreambleL
1.176 + */
1.177 +TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepPreambleL()
1.178 + {
1.179 + TPtrC filename;
1.180 + TVerdict ret = EPass;
1.181 +
1.182 + // Call base DoTestStepPreambleL()
1.183 + ret = CTestMmfAclntStep::DoTestStepPreambleL();
1.184 + if (ret == EFail)
1.185 + {
1.186 + return ret;
1.187 + }
1.188 +
1.189 + // Get 1st file name
1.190 + if(!GetStringFromConfig(iSectName, _L("playerAudioFile1"), filename))
1.191 + {
1.192 + return EInconclusive;
1.193 + }
1.194 + GetDriveName(iFilename1);
1.195 + iFilename1.Append(filename);
1.196 +
1.197 + iEventChecker = CMultiEventChecker::NewL();
1.198 + // Initialise 1st Audio Player
1.199 + INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility1 : EMdaPriorityNormal"));
1.200 + iMdaAudioPlayerCallbackSupport1 = CTestMdaAudioPlayerCallbackSupport::NewL(*this);
1.201 + iTestAudioPlayer1 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport1, EMdaPriorityNormal);
1.202 +
1.203 + // Get 2nd file name
1.204 + if(!GetStringFromConfig(iSectName, _L("playerAudioFile2"), filename))
1.205 + {
1.206 + return EInconclusive;
1.207 + }
1.208 + GetDriveName(iFilename2);
1.209 + iFilename2.Append(filename);
1.210 +
1.211 + // Initialise 2nd Audio Player
1.212 + INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility2 : EMdaPriorityMax"));
1.213 + iMdaAudioPlayerCallbackSupport2 = CTestMdaAudioPlayerCallbackSupport::NewL(*this);
1.214 + iTestAudioPlayer2 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport2, EMdaPriorityMax);
1.215 +
1.216 + // Get 3rd file name
1.217 + if(!GetStringFromConfig(iSectName, _L("playerAudioFile3"), filename))
1.218 + {
1.219 + return EInconclusive;
1.220 + }
1.221 + GetDriveName(iFilename3);
1.222 + iFilename3.Append(filename);
1.223 +
1.224 + // Initialise 3rd Audio Player
1.225 + INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility3 : EMdaPriorityMin"));
1.226 + iMdaAudioPlayerCallbackSupport3 = CTestMdaAudioPlayerCallbackSupport::NewL(*this);
1.227 + iTestAudioPlayer3 = CMdaAudioPlayerUtility::NewL(*iMdaAudioPlayerCallbackSupport3, EMdaPriorityMin);
1.228 +
1.229 + // Initialise the CCallBackTimer.
1.230 + iCallBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler));
1.231 +
1.232 + return ret;
1.233 + }
1.234 +
1.235 +/**
1.236 + * DoTestStepPostambleL
1.237 + */
1.238 +TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepPostambleL()
1.239 + {
1.240 + // Delete all the iTestAudioPlayer utilities.
1.241 + iTestAudioPlayer1->Close();
1.242 + delete iTestAudioPlayer1;
1.243 + iTestAudioPlayer1=NULL;
1.244 + iTestAudioPlayer2->Close();
1.245 + delete iTestAudioPlayer2;
1.246 + iTestAudioPlayer2=NULL;
1.247 + iTestAudioPlayer3->Close();
1.248 + delete iTestAudioPlayer3;
1.249 + iTestAudioPlayer3=NULL;
1.250 + // Delete CTestMdaAudioPlayerCallbackSupport
1.251 + delete iMdaAudioPlayerCallbackSupport1;
1.252 + delete iMdaAudioPlayerCallbackSupport2;
1.253 + delete iMdaAudioPlayerCallbackSupport3;
1.254 + // Delete the CCallBackTimer.
1.255 + delete iCallBackTimer;
1.256 + iCallBackTimer=NULL;
1.257 + delete iEventChecker;
1.258 + // Base Postamble.
1.259 + return CTestMmfAclntStep::DoTestStepPostambleL();
1.260 + }
1.261 +
1.262 +/**
1.263 + * DoTestStepL
1.264 + */
1.265 +TVerdict CTestMmfAclntAudioPlayerARN::DoTestStepL()
1.266 + {
1.267 + return( DoTestL() );
1.268 + }
1.269 +
1.270 +/**
1.271 + * StateInit
1.272 + */
1.273 +void CTestMmfAclntAudioPlayerARN::StateInit()
1.274 + {
1.275 + iExpectedEvent=EIdlePlayer;
1.276 + iExpectedError=KErrNone;
1.277 + iState=EStateBegin;
1.278 + }
1.279 +
1.280 +/**
1.281 + * StateChange
1.282 + */
1.283 +void CTestMmfAclntAudioPlayerARN::StateChange(TMmfAudioPlayerState aState, TMmfAudioPlayerEvents aExpectedEvent, TInt aExpectedError)
1.284 + {
1.285 + iExpectedEvent=aExpectedEvent;
1.286 + iExpectedError=aExpectedError;
1.287 + iState=aState;
1.288 + }
1.289 +
1.290 +/**
1.291 + * FsmCheck
1.292 + */
1.293 +TBool CTestMmfAclntAudioPlayerARN::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.294 + {
1.295 + TBool retFsmCheck = EFalse;
1.296 + if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1.297 + {
1.298 + INFO_PRINTF1(_L("Underflow !"));
1.299 + }
1.300 + else if (iExpectedEvent != aEventCode)
1.301 + {
1.302 + ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1.303 + iTestStepResult = EFail;
1.304 + CActiveScheduler::Stop();
1.305 + }
1.306 + else if (iExpectedError != aError)
1.307 + {
1.308 + ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1.309 + iTestStepResult = EFail;
1.310 + CActiveScheduler::Stop();
1.311 + }
1.312 + else
1.313 + {
1.314 + retFsmCheck = ETrue;
1.315 + }
1.316 + return retFsmCheck;
1.317 + }
1.318 +
1.319 +//
1.320 +//POSITIVE TESTS//
1.321 +//
1.322 +
1.323 +//
1.324 +//CTestMmfAclntARN8101
1.325 +//
1.326 +
1.327 +/**
1.328 + * Constructor
1.329 + */
1.330 +CTestMmfAclntARN8101::CTestMmfAclntARN8101(const TDesC& aTestName, const TDesC& aSectName)
1.331 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.332 + {}
1.333 +
1.334 +/**
1.335 + * NewL
1.336 + */
1.337 +CTestMmfAclntARN8101* CTestMmfAclntARN8101::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.338 + {
1.339 + CTestMmfAclntARN8101* self = new (ELeave) CTestMmfAclntARN8101(aTestName, aSectName);
1.340 + return self;
1.341 + }
1.342 +
1.343 +/**
1.344 + * DoTestL
1.345 + */
1.346 +TVerdict CTestMmfAclntARN8101::DoTestL()
1.347 + {
1.348 + return( PerformTestL() );
1.349 + }
1.350 +
1.351 +/**
1.352 + * FsmL
1.353 + */
1.354 +void CTestMmfAclntARN8101::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.355 + {
1.356 + if (FsmCheck(aEventCode, aError))
1.357 + {
1.358 + TInt retErr = KErrNone;
1.359 + switch (iState)
1.360 + {
1.361 + case EStateBegin:
1.362 + // Open iTestAudioPlayer#1
1.363 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.364 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.365 + // Set ExpectedEvent and change the State
1.366 + StateChange(EStateOpenPlayer2, EMapcInitComplete1);
1.367 + break;
1.368 + case EStateOpenPlayer2:
1.369 + // Register iTestAudioPlayer#1 for Notification
1.370 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.371 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.372 + if( retErr != KErrNone )
1.373 + {
1.374 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.375 + iTestStepResult = EFail;
1.376 + CActiveScheduler::Stop();
1.377 + break;
1.378 + }
1.379 + // Open iTestAudioPlayer#2
1.380 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.381 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.382 + // Set ExpectedEvent and change the State
1.383 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.384 + break;
1.385 + case EStatePlaying2:
1.386 + // Play iTestAudioPlayer#2
1.387 + iTestAudioPlayer2->Play();
1.388 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.389 + // Set ExpectedEvent and change the State
1.390 + StateChange(EStateEndPlay2, EMapcPlayComplete2);
1.391 + break;
1.392 + case EStateEndPlay2:
1.393 + // Timer to check if Notification Event Occurs.
1.394 + iCallBackTimer->After(2000000);
1.395 + iTestStepResult = EPass;
1.396 + // Set ExpectedEvent and change the State
1.397 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.398 + break;
1.399 + case EStateNotifiedPlayer1:
1.400 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.401 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.402 + iTestStepResult = EFail;
1.403 + CActiveScheduler::Stop();
1.404 + break;
1.405 + }
1.406 + }
1.407 + }
1.408 +
1.409 +/**
1.410 + * PerformTestL
1.411 + */
1.412 +TVerdict CTestMmfAclntARN8101::PerformTestL()
1.413 + {
1.414 + INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
1.415 + iTestStepResult = EFail;
1.416 +
1.417 + // Initialise the state variables
1.418 + StateInit();
1.419 +
1.420 + // Begin the process
1.421 + FsmL(EIdlePlayer, KErrNone);
1.422 +
1.423 + // Start the scheduler - Done only once !
1.424 + CActiveScheduler::Start();
1.425 +
1.426 + return iTestStepResult;
1.427 + }
1.428 +
1.429 +//
1.430 +//CTestMmfAclntARN8102
1.431 +//
1.432 +
1.433 +/**
1.434 + * Constructor
1.435 + */
1.436 +CTestMmfAclntARN8102::CTestMmfAclntARN8102(const TDesC& aTestName, const TDesC& aSectName)
1.437 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.438 + {}
1.439 +
1.440 +/**
1.441 + * NewL
1.442 + */
1.443 +CTestMmfAclntARN8102* CTestMmfAclntARN8102::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.444 + {
1.445 + CTestMmfAclntARN8102* self = new (ELeave) CTestMmfAclntARN8102(aTestName, aSectName);
1.446 + return self;
1.447 + }
1.448 +
1.449 +/**
1.450 + * DoTestL
1.451 + */
1.452 +TVerdict CTestMmfAclntARN8102::DoTestL()
1.453 + {
1.454 + return( PerformTestL() );
1.455 + }
1.456 +
1.457 +/**
1.458 + * FsmL
1.459 + */
1.460 +void CTestMmfAclntARN8102::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.461 + {
1.462 + if (FsmCheck(aEventCode, aError))
1.463 + {
1.464 + TInt retErr = KErrNone;
1.465 + switch (iState)
1.466 + {
1.467 + case EStateBegin:
1.468 + // Open iTestAudioPlayer#1
1.469 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.470 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.471 + // Set ExpectedEvent and change the State
1.472 + StateChange(EStateOpenPlayer2, EMapcInitComplete1);
1.473 + break;
1.474 + case EStateOpenPlayer2:
1.475 + // Register iTestAudioPlayer#1 for Notification
1.476 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.477 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.478 + if( retErr != KErrNone )
1.479 + {
1.480 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.481 + iTestStepResult = EFail;
1.482 + CActiveScheduler::Stop();
1.483 + break;
1.484 + }
1.485 + // Open iTestAudioPlayer#2
1.486 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.487 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.488 + // Set ExpectedEvent and change the State
1.489 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.490 + break;
1.491 + case EStatePlaying2:
1.492 + // Play iTestAudioPlayer#2
1.493 + iTestAudioPlayer2->Play();
1.494 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.495 + // Play iTestAudioPlayer#1
1.496 + iTestAudioPlayer1->Play();
1.497 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.498 + // Set ExpectedEvent and change the State
1.499 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.500 + break;
1.501 + case EStateErrInUsePlayer1:
1.502 + // Close iTestAudioPlayer#2
1.503 + WaitWithTimeout(iRequestStatus,1000000);
1.504 + iTestAudioPlayer2->Stop();
1.505 + INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()"));
1.506 + iTestAudioPlayer2->Close();
1.507 + INFO_PRINTF1(_L("iTestAudioPlayer2->Close()"));
1.508 + // Timer to check if Notification Event Occurs.
1.509 + iCallBackTimer->After(2000000);
1.510 + // Set ExpectedEvent and change the State
1.511 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.512 + break;
1.513 + case EStateNotifiedPlayer1:
1.514 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.515 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.516 + iTestStepResult = EPass;
1.517 + CActiveScheduler::Stop();
1.518 + break;
1.519 + }
1.520 + }
1.521 + }
1.522 +
1.523 +/**
1.524 + * PerformTestL
1.525 + */
1.526 +TVerdict CTestMmfAclntARN8102::PerformTestL()
1.527 + {
1.528 + INFO_PRINTF1(_L("Register (b4 play, after Open) and Receive Notification of a Resource Available Event."));
1.529 + INFO_PRINTF1(_L("(when audio resource is currently unavailable and then available)"));
1.530 + iTestStepResult = EFail;
1.531 +
1.532 + // Initialise the state variables
1.533 + StateInit();
1.534 +
1.535 + // Begin the process
1.536 + FsmL(EIdlePlayer, KErrNone);
1.537 +
1.538 + // Start the scheduler - Done only once !
1.539 + CActiveScheduler::Start();
1.540 +
1.541 + return iTestStepResult;
1.542 + }
1.543 +
1.544 +//
1.545 +//CTestMmfAclntARN8103
1.546 +//
1.547 +
1.548 +/**
1.549 + * Constructor
1.550 + */
1.551 +CTestMmfAclntARN8103::CTestMmfAclntARN8103(const TDesC& aTestName, const TDesC& aSectName)
1.552 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.553 + {}
1.554 +
1.555 +/**
1.556 + * NewL
1.557 + */
1.558 +CTestMmfAclntARN8103* CTestMmfAclntARN8103::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.559 + {
1.560 + CTestMmfAclntARN8103* self = new (ELeave) CTestMmfAclntARN8103(aTestName, aSectName);
1.561 + return self;
1.562 + }
1.563 +
1.564 +/**
1.565 + * DoTestL
1.566 + */
1.567 +TVerdict CTestMmfAclntARN8103::DoTestL()
1.568 + {
1.569 + return( PerformTestL() );
1.570 + }
1.571 +
1.572 +/**
1.573 + * FsmCheck
1.574 + */
1.575 +TBool CTestMmfAclntARN8103::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.576 + {
1.577 + TBool retFsmCheck = EFalse;
1.578 + if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1.579 + {
1.580 + INFO_PRINTF1(_L("Underflow !"));
1.581 + }
1.582 + else if (iExpectedEvent != aEventCode)
1.583 + {
1.584 + if ((aEventCode == EMapcPlayComplete2))
1.585 + {
1.586 + retFsmCheck = ETrue;
1.587 + if (iEventOccured == EMarncResourceAvailable1)
1.588 + {
1.589 + return retFsmCheck;
1.590 + }
1.591 + else
1.592 + {
1.593 + iEventOccured = EMapcPlayComplete2;
1.594 + }
1.595 + }
1.596 + else if (aEventCode == EMarncResourceAvailable1)
1.597 + {
1.598 + retFsmCheck = ETrue;
1.599 + if (iEventOccured == EMapcPlayComplete2)
1.600 + {
1.601 + return retFsmCheck;
1.602 + }
1.603 + else
1.604 + {
1.605 + iEventOccured = EMarncResourceAvailable1;
1.606 + }
1.607 + }
1.608 + else
1.609 + {
1.610 + ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1.611 + iTestStepResult = EFail;
1.612 + CActiveScheduler::Stop();
1.613 + }
1.614 + }
1.615 + else if (iExpectedError != aError)
1.616 + {
1.617 + ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1.618 + iTestStepResult = EFail;
1.619 + CActiveScheduler::Stop();
1.620 + }
1.621 + else
1.622 + {
1.623 + retFsmCheck = ETrue;
1.624 + }
1.625 + return retFsmCheck;
1.626 + }
1.627 +
1.628 +/**
1.629 + * FsmL
1.630 + */
1.631 +void CTestMmfAclntARN8103::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.632 + {
1.633 + if (FsmCheck(aEventCode, aError))
1.634 + {
1.635 + TInt retErr = KErrNone;
1.636 + switch (iState)
1.637 + {
1.638 + case EStateBegin:
1.639 + // Open iTestAudioPlayer#1
1.640 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.641 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.642 + // Set ExpectedEvent and change the State
1.643 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.644 + break;
1.645 + case EStatePlaying1:
1.646 + // Play iTestAudioPlayer#1
1.647 + iTestAudioPlayer1->Play();
1.648 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.649 + // Register iTestAudioPlayer#1 for Notification
1.650 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.651 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.652 + if( retErr != KErrNone )
1.653 + {
1.654 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.655 + iTestStepResult = EFail;
1.656 + CActiveScheduler::Stop();
1.657 + break;
1.658 + }
1.659 + // Open iTestAudioPlayer#2
1.660 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.661 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.662 + // Set ExpectedEvent and change the State
1.663 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.664 + break;
1.665 + case EStatePlaying2:
1.666 + // Play iTestAudioPlayer#2
1.667 + iTestAudioPlayer2->Play();
1.668 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.669 + // Set ExpectedEvent and change the State
1.670 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.671 + break;
1.672 + case EStateErrInUsePlayer1:
1.673 + // Set ExpectedEvent and change the State
1.674 + StateChange(EStateEndPlay2, EMapcPlayComplete2);
1.675 + break;
1.676 + case EStateEndPlay2:
1.677 + // Timer to check if Notification Event Occurs.
1.678 + iCallBackTimer->After(2000000);
1.679 + // Set ExpectedEvent and change the State
1.680 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.681 + break;
1.682 + case EStateNotifiedPlayer1:
1.683 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.684 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.685 + iTestStepResult = EPass;
1.686 + CActiveScheduler::Stop();
1.687 + break;
1.688 + }
1.689 + }
1.690 + }
1.691 +
1.692 +/**
1.693 + * PerformTestL
1.694 + */
1.695 +TVerdict CTestMmfAclntARN8103::PerformTestL()
1.696 + {
1.697 + INFO_PRINTF1(_L("Register (at the time of Play) and Receive Notification of a Resource Available Event."));
1.698 + INFO_PRINTF1(_L("(when audio resource is currently available and subsequently unavailable, and then available)"));
1.699 + iTestStepResult = EFail;
1.700 +
1.701 + // Initialise the state variables
1.702 + StateInit();
1.703 +
1.704 + // Begin the process
1.705 + FsmL(EIdlePlayer, KErrNone);
1.706 +
1.707 + // Start the scheduler - Done only once !
1.708 + CActiveScheduler::Start();
1.709 +
1.710 + return iTestStepResult;
1.711 + }
1.712 +
1.713 +//
1.714 +//CTestMmfAclntARN8104
1.715 +//
1.716 +
1.717 +/**
1.718 + * Constructor
1.719 + */
1.720 +CTestMmfAclntARN8104::CTestMmfAclntARN8104(const TDesC& aTestName, const TDesC& aSectName)
1.721 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.722 + {}
1.723 +
1.724 +/**
1.725 + * NewL
1.726 + */
1.727 +CTestMmfAclntARN8104* CTestMmfAclntARN8104::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.728 + {
1.729 + CTestMmfAclntARN8104* self = new (ELeave) CTestMmfAclntARN8104(aTestName, aSectName);
1.730 + return self;
1.731 + }
1.732 +
1.733 +/**
1.734 + * DoTestL
1.735 + */
1.736 +TVerdict CTestMmfAclntARN8104::DoTestL()
1.737 + {
1.738 + return( PerformTestL() );
1.739 + }
1.740 +
1.741 +/**
1.742 + * FsmL
1.743 + */
1.744 +void CTestMmfAclntARN8104::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.745 + {
1.746 + if (FsmCheck(aEventCode, aError))
1.747 + {
1.748 + TInt canErr = KErrNone;
1.749 + switch (iState)
1.750 + {
1.751 + case EStateBegin:
1.752 + // Open iTestAudioPlayer#1
1.753 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.754 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.755 + // Set ExpectedEvent and change the State
1.756 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.757 + break;
1.758 + case EStatePlaying1:
1.759 + // Play iTestAudioPlayer#1
1.760 + iTestAudioPlayer1->Play();
1.761 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.762 + // Open iTestAudioPlayer#2
1.763 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.764 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.765 + // Set ExpectedEvent and change the State
1.766 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.767 + break;
1.768 + case EStatePlaying2:
1.769 + // Play iTestAudioPlayer#2
1.770 + iTestAudioPlayer2->Play();
1.771 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.772 + // Set ExpectedEvent and change the State
1.773 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.774 + break;
1.775 + case EStateErrInUsePlayer1:
1.776 + // Cancel notification for iTestAudioPlayer#1
1.777 + canErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
1.778 + INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification()"));
1.779 + if( canErr != KErrNone )
1.780 + {
1.781 + ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), canErr);
1.782 + iTestStepResult = EFail;
1.783 + CActiveScheduler::Stop();
1.784 + break;
1.785 + }
1.786 + // Close iTestAudioPlayer#2
1.787 + WaitWithTimeout(iRequestStatus,1000000);
1.788 + iTestAudioPlayer2->Stop();
1.789 + INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()"));
1.790 + iTestAudioPlayer2->Close();
1.791 + INFO_PRINTF1(_L("iTestAudioPlayer2->Close()"));
1.792 + // Timer to check if Notification Event Occurs.
1.793 + iCallBackTimer->After(2000000);
1.794 + iTestStepResult = EPass;
1.795 + // Set ExpectedEvent and change the State
1.796 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.797 + break;
1.798 + case EStateNotifiedPlayer1:
1.799 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.800 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.801 + iTestStepResult = EFail;
1.802 + CActiveScheduler::Stop();
1.803 + break;
1.804 + }
1.805 + }
1.806 + }
1.807 +
1.808 +/**
1.809 + * PerformTestL
1.810 + */
1.811 +TVerdict CTestMmfAclntARN8104::PerformTestL()
1.812 + {
1.813 + INFO_PRINTF1(_L("Registration (b4 File Open) and Cancellation of the notification request"));
1.814 + iTestStepResult = EFail;
1.815 +
1.816 + // Initialise the state variables
1.817 + StateInit();
1.818 +
1.819 + // Register iTestAudioPlayer#1 for Notification
1.820 + TInt retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.821 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.822 + if( retErr != KErrNone )
1.823 + {
1.824 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.825 + return EFail;
1.826 + }
1.827 +
1.828 + // Begin the process
1.829 + FsmL(EIdlePlayer, KErrNone);
1.830 +
1.831 + // Start the scheduler - Done only once !
1.832 + CActiveScheduler::Start();
1.833 +
1.834 + return iTestStepResult;
1.835 + }
1.836 +
1.837 +//
1.838 +//CTestMmfAclntARN8105
1.839 +//
1.840 +
1.841 +/**
1.842 + * Constructor
1.843 + */
1.844 +CTestMmfAclntARN8105::CTestMmfAclntARN8105(const TDesC& aTestName, const TDesC& aSectName)
1.845 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.846 + {}
1.847 +
1.848 +/**
1.849 + * NewL
1.850 + */
1.851 +CTestMmfAclntARN8105* CTestMmfAclntARN8105::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.852 + {
1.853 + CTestMmfAclntARN8105* self = new (ELeave) CTestMmfAclntARN8105(aTestName, aSectName);
1.854 + return self;
1.855 + }
1.856 +
1.857 +/**
1.858 + * DoTestL
1.859 + */
1.860 +TVerdict CTestMmfAclntARN8105::DoTestL()
1.861 + {
1.862 + return( PerformTestL() );
1.863 + }
1.864 +
1.865 +/**
1.866 + * FsmCheck
1.867 + */
1.868 +TBool CTestMmfAclntARN8105::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.869 + {
1.870 + TBool retFsmCheck = EFalse;
1.871 + if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1.872 + {
1.873 + INFO_PRINTF1(_L("Underflow !"));
1.874 + }
1.875 + else if (iExpectedEvent != aEventCode)
1.876 + {
1.877 + if ((aEventCode == EMapcPlayComplete2))
1.878 + {
1.879 + retFsmCheck = ETrue;
1.880 + if (iEventOccured == EMarncResourceAvailable1)
1.881 + {
1.882 + return retFsmCheck;
1.883 + }
1.884 + else
1.885 + {
1.886 + iEventOccured = EMapcPlayComplete2;
1.887 + }
1.888 + }
1.889 + else if (aEventCode == EMarncResourceAvailable1)
1.890 + {
1.891 + retFsmCheck = ETrue;
1.892 + if (iEventOccured == EMapcPlayComplete2)
1.893 + {
1.894 + return retFsmCheck;
1.895 + }
1.896 + else
1.897 + {
1.898 + iEventOccured = EMarncResourceAvailable1;
1.899 + }
1.900 + }
1.901 + else
1.902 + {
1.903 + ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1.904 + iTestStepResult = EFail;
1.905 + CActiveScheduler::Stop();
1.906 + }
1.907 + }
1.908 + else if (iExpectedError != aError)
1.909 + {
1.910 + ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1.911 + iTestStepResult = EFail;
1.912 + CActiveScheduler::Stop();
1.913 + }
1.914 + else
1.915 + {
1.916 + retFsmCheck = ETrue;
1.917 + }
1.918 + return retFsmCheck;
1.919 + }
1.920 +
1.921 +/**
1.922 + * FsmL
1.923 + */
1.924 +void CTestMmfAclntARN8105::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.925 + {
1.926 + if (FsmCheck(aEventCode, aError))
1.927 + {
1.928 + TInt retErr = KErrNone;
1.929 + switch (iState)
1.930 + {
1.931 + case EStateBegin:
1.932 + // Open iTestAudioPlayer#1
1.933 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.934 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.935 + // Set ExpectedEvent and change the State
1.936 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.937 + break;
1.938 + case EStatePlaying1:
1.939 + // Play iTestAudioPlayer#1
1.940 + iTestAudioPlayer1->Play();
1.941 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.942 + // Open iTestAudioPlayer#2
1.943 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.944 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.945 + // Set ExpectedEvent and change the State
1.946 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.947 + break;
1.948 + case EStatePlaying2:
1.949 + // Play iTestAudioPlayer#2
1.950 + iTestAudioPlayer2->Play();
1.951 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.952 + // Set ExpectedEvent and change the State
1.953 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.954 + break;
1.955 + case EStateErrInUsePlayer1:
1.956 + //Get Position of iTestAudioPlayer#1
1.957 + retErr = iTestAudioPlayer1->GetPosition(iPositionStop);
1.958 + INFO_PRINTF1(_L("iTestAudioPlayer1->GetPosition()"));
1.959 + if( retErr != KErrNone )
1.960 + {
1.961 + ERR_PRINTF2(_L("iTestAudioPlayer1->GetPosition - Failed with Error : %d"), retErr);
1.962 + iTestStepResult = EFail;
1.963 + CActiveScheduler::Stop();
1.964 + break;
1.965 + }
1.966 + INFO_PRINTF2(_L("value of iPositionStop = %d"),iPositionStop.Int64());//Statement Changed under DEF105143
1.967 +
1.968 + // Register iTestAudioPlayer#1 for Notification
1.969 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.970 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.971 + if( retErr != KErrNone )
1.972 + {
1.973 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.974 + iTestStepResult = EFail;
1.975 + CActiveScheduler::Stop();
1.976 + break;
1.977 + }
1.978 + // Set ExpectedEvent and change the State
1.979 + StateChange(EStateEndPlay2, EMapcPlayComplete2);
1.980 + break;
1.981 + case EStateEndPlay2:
1.982 + // Timer to check if Notification Event Occurs.
1.983 + iCallBackTimer->After(2000000);
1.984 + // Set ExpectedEvent and change the State
1.985 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.986 + break;
1.987 + case EStateNotifiedPlayer1:
1.988 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.989 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.990 + iPositionResume = iPosition;
1.991 + CActiveScheduler::Stop();
1.992 + // Check for the Position.
1.993 + if (iPositionResume >= iPositionStop)
1.994 + {
1.995 + INFO_PRINTF3(_L("iTestAudioPlayer1->Audio Resource iPositionResume >= iPositionStop, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
1.996 + iTestStepResult=EPass;
1.997 + }
1.998 + else
1.999 + {
1.1000 + ERR_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position is NOT iPositionResume >= iPositionStop, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
1.1001 + iTestStepResult=EFail;
1.1002 + }
1.1003 + break;
1.1004 + }
1.1005 + }
1.1006 + }
1.1007 +
1.1008 +/**
1.1009 + * PerformTestL
1.1010 + */
1.1011 +TVerdict CTestMmfAclntARN8105::PerformTestL()
1.1012 + {
1.1013 + INFO_PRINTF1(_L("Register (after Play Error) and Get the actual position from where the paused audio can be resumed. Low priority client is played first."));
1.1014 + iTestStepResult = EFail;
1.1015 +
1.1016 + // Initialise the state variables
1.1017 + StateInit();
1.1018 +
1.1019 + // Begin the process
1.1020 + FsmL(EIdlePlayer, KErrNone);
1.1021 +
1.1022 + // Start the scheduler - Done only once !
1.1023 + CActiveScheduler::Start();
1.1024 +
1.1025 + return iTestStepResult;
1.1026 + }
1.1027 +
1.1028 +//
1.1029 +//CTestMmfAclntARN8106
1.1030 +//
1.1031 +
1.1032 +/**
1.1033 + * Constructor
1.1034 + */
1.1035 +CTestMmfAclntARN8106::CTestMmfAclntARN8106(const TDesC& aTestName, const TDesC& aSectName)
1.1036 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.1037 + {}
1.1038 +
1.1039 +/**
1.1040 + * NewL
1.1041 + */
1.1042 +CTestMmfAclntARN8106* CTestMmfAclntARN8106::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.1043 + {
1.1044 + CTestMmfAclntARN8106* self = new (ELeave) CTestMmfAclntARN8106(aTestName, aSectName);
1.1045 + return self;
1.1046 + }
1.1047 +
1.1048 +/**
1.1049 + * DoTestL
1.1050 + */
1.1051 +TVerdict CTestMmfAclntARN8106::DoTestL()
1.1052 + {
1.1053 + return( PerformTestL() );
1.1054 + }
1.1055 +
1.1056 +/**
1.1057 + * FsmCheck
1.1058 + */
1.1059 +TBool CTestMmfAclntARN8106::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1060 + {
1.1061 + TBool retFsmCheck = EFalse;
1.1062 + if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1.1063 + {
1.1064 + INFO_PRINTF1(_L("Underflow !"));
1.1065 + }
1.1066 + else if (iExpectedEvent != aEventCode)
1.1067 + {
1.1068 + if ((aEventCode == EMapcPlayComplete2))
1.1069 + {
1.1070 + retFsmCheck = ETrue;
1.1071 + if (iEventOccured == EMarncResourceAvailable1)
1.1072 + {
1.1073 + return retFsmCheck;
1.1074 + }
1.1075 + else
1.1076 + {
1.1077 + iEventOccured = EMapcPlayComplete2;
1.1078 + }
1.1079 + }
1.1080 + else if (aEventCode == EMarncResourceAvailable1)
1.1081 + {
1.1082 + retFsmCheck = ETrue;
1.1083 + if (iEventOccured == EMapcPlayComplete2)
1.1084 + {
1.1085 + return retFsmCheck;
1.1086 + }
1.1087 + else
1.1088 + {
1.1089 + iEventOccured = EMarncResourceAvailable1;
1.1090 + }
1.1091 + }
1.1092 + else
1.1093 + {
1.1094 + ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1.1095 + iTestStepResult = EFail;
1.1096 + CActiveScheduler::Stop();
1.1097 + }
1.1098 + }
1.1099 + else if (iExpectedError != aError)
1.1100 + {
1.1101 + ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1.1102 + iTestStepResult = EFail;
1.1103 + CActiveScheduler::Stop();
1.1104 + }
1.1105 + else
1.1106 + {
1.1107 + retFsmCheck = ETrue;
1.1108 + }
1.1109 + return retFsmCheck;
1.1110 + }
1.1111 +
1.1112 +/**
1.1113 + * FsmL
1.1114 + */
1.1115 +void CTestMmfAclntARN8106::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1116 + {
1.1117 + if (FsmCheck(aEventCode, aError))
1.1118 + {
1.1119 + TInt retErr = KErrNone;
1.1120 + switch (iState)
1.1121 + {
1.1122 + case EStateBegin:
1.1123 + // Open iTestAudioPlayer#2
1.1124 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.1125 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.1126 + // Set ExpectedEvent and change the State
1.1127 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.1128 + break;
1.1129 + case EStatePlaying2:
1.1130 + // Play iTestAudioPlayer#2
1.1131 + iTestAudioPlayer2->Play();
1.1132 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.1133 + // Open iTestAudioPlayer#1
1.1134 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.1135 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.1136 + // Set ExpectedEvent and change the State
1.1137 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.1138 + break;
1.1139 + case EStatePlaying1:
1.1140 + // Play iTestAudioPlayer#1
1.1141 + iTestAudioPlayer1->Play();
1.1142 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.1143 + // Set ExpectedEvent and change the State
1.1144 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.1145 + break;
1.1146 + case EStateErrInUsePlayer1:
1.1147 + //Get Position of iTestAudioPlayer#1
1.1148 + retErr = iTestAudioPlayer1->GetPosition(iPositionStop);
1.1149 + INFO_PRINTF1(_L("iTestAudioPlayer1->GetPosition()"));
1.1150 + if( retErr != KErrNone )
1.1151 + {
1.1152 + ERR_PRINTF2(_L("iTestAudioPlayer1->GetPosition - Failed with Error : %d"), retErr);
1.1153 + iTestStepResult = EFail;
1.1154 + CActiveScheduler::Stop();
1.1155 + break;
1.1156 + }
1.1157 + // Register iTestAudioPlayer#1 for Notification
1.1158 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.1159 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.1160 + if( retErr != KErrNone )
1.1161 + {
1.1162 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.1163 + iTestStepResult = EFail;
1.1164 + CActiveScheduler::Stop();
1.1165 + break;
1.1166 + }
1.1167 + // Set ExpectedEvent and change the State
1.1168 + StateChange(EStateEndPlay2, EMapcPlayComplete2);
1.1169 + break;
1.1170 + case EStateEndPlay2:
1.1171 + // Timer to check if Notification Event Occurs.
1.1172 + iCallBackTimer->After(2000000);
1.1173 + // Set ExpectedEvent and change the State
1.1174 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.1175 + break;
1.1176 + case EStateNotifiedPlayer1:
1.1177 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1178 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.1179 + iPositionResume = iPosition;
1.1180 + CActiveScheduler::Stop();
1.1181 + // Check for the Position
1.1182 + if (iPositionResume >= iPositionStop)
1.1183 + {
1.1184 + INFO_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position Matches, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
1.1185 + iTestStepResult=EPass;
1.1186 + }
1.1187 + else
1.1188 + {
1.1189 + ERR_PRINTF3(_L("iTestAudioPlayer1->Audio Resource Position does NOT Match, Expected=%Ld, Actual=%Ld"), iPositionStop.Int64(), iPositionResume.Int64());
1.1190 + iTestStepResult=EFail;
1.1191 + }
1.1192 + break;
1.1193 + }
1.1194 + }
1.1195 + }
1.1196 +
1.1197 +/**
1.1198 + * PerformTestL
1.1199 + */
1.1200 +TVerdict CTestMmfAclntARN8106::PerformTestL()
1.1201 + {
1.1202 + INFO_PRINTF1(_L("Register (after Play Error) and Get the actual position from where the paused audio can be resumed. High priority client is played first."));
1.1203 + iTestStepResult = EFail;
1.1204 +
1.1205 + // Initialise the state variables
1.1206 + StateInit();
1.1207 +
1.1208 + // Begin the process
1.1209 + FsmL(EIdlePlayer, KErrNone);
1.1210 +
1.1211 + // Start the scheduler - Done only once !
1.1212 + CActiveScheduler::Start();
1.1213 +
1.1214 + return iTestStepResult;
1.1215 + }
1.1216 +
1.1217 +//
1.1218 +//CTestMmfAclntARN8107
1.1219 +//
1.1220 +
1.1221 +/**
1.1222 + * Constructor
1.1223 + */
1.1224 +CTestMmfAclntARN8107::CTestMmfAclntARN8107(const TDesC& aTestName, const TDesC& aSectName)
1.1225 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.1226 + {}
1.1227 +
1.1228 +/**
1.1229 + * NewL
1.1230 + */
1.1231 +CTestMmfAclntARN8107* CTestMmfAclntARN8107::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.1232 + {
1.1233 + CTestMmfAclntARN8107* self = new (ELeave) CTestMmfAclntARN8107(aTestName, aSectName);
1.1234 + return self;
1.1235 + }
1.1236 +
1.1237 +/**
1.1238 + * DoTestL
1.1239 + */
1.1240 +TVerdict CTestMmfAclntARN8107::DoTestL()
1.1241 + {
1.1242 + return( PerformTestL() );
1.1243 + }
1.1244 +
1.1245 +/**
1.1246 + * FsmCheck
1.1247 + */
1.1248 +TBool CTestMmfAclntARN8107::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1249 + {
1.1250 + TBool retFsmCheck = EFalse;
1.1251 + if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1.1252 + {
1.1253 + INFO_PRINTF1(_L("Underflow !"));
1.1254 + }
1.1255 + else if (iExpectedEvent != aEventCode)
1.1256 + {
1.1257 + if ((aEventCode == EMapcPlayComplete2))
1.1258 + {
1.1259 + retFsmCheck = ETrue;
1.1260 + if (iEventOccured == EMarncResourceAvailable1)
1.1261 + {
1.1262 + return retFsmCheck;
1.1263 + }
1.1264 + else
1.1265 + {
1.1266 + iEventOccured = EMapcPlayComplete2;
1.1267 + }
1.1268 + }
1.1269 + else if (aEventCode == EMarncResourceAvailable1)
1.1270 + {
1.1271 + retFsmCheck = ETrue;
1.1272 + if (iEventOccured == EMapcPlayComplete2)
1.1273 + {
1.1274 + return retFsmCheck;
1.1275 + }
1.1276 + else
1.1277 + {
1.1278 + iEventOccured = EMarncResourceAvailable1;
1.1279 + }
1.1280 + }
1.1281 + else
1.1282 + {
1.1283 + ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1.1284 + iTestStepResult = EFail;
1.1285 + CActiveScheduler::Stop();
1.1286 + }
1.1287 + }
1.1288 + else if (iExpectedError != aError)
1.1289 + {
1.1290 + ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1.1291 + iTestStepResult = EFail;
1.1292 + CActiveScheduler::Stop();
1.1293 + }
1.1294 + else
1.1295 + {
1.1296 + retFsmCheck = ETrue;
1.1297 + }
1.1298 + return retFsmCheck;
1.1299 + }
1.1300 +
1.1301 +/**
1.1302 + * FsmL
1.1303 + */
1.1304 +void CTestMmfAclntARN8107::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1305 + {
1.1306 + if (FsmCheck(aEventCode, aError))
1.1307 + {
1.1308 + TInt retErr = KErrNone;
1.1309 + switch (iState)
1.1310 + {
1.1311 + case EStateBegin:
1.1312 + // Open iTestAudioPlayer#1
1.1313 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.1314 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.1315 + // Set ExpectedEvent and change the State
1.1316 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.1317 + break;
1.1318 + case EStatePlaying1:
1.1319 + // Play iTestAudioPlayer#1
1.1320 + iTestAudioPlayer1->Play();
1.1321 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.1322 + // Register iTestAudioPlayer#1 for Notification
1.1323 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.1324 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.1325 + if( retErr != KErrNone )
1.1326 + {
1.1327 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.1328 + iTestStepResult = EFail;
1.1329 + CActiveScheduler::Stop();
1.1330 + break;
1.1331 + }
1.1332 + // Open iTestAudioPlayer#2
1.1333 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.1334 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.1335 + // Set ExpectedEvent and change the State
1.1336 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.1337 + break;
1.1338 + case EStatePlaying2:
1.1339 + // Play iTestAudioPlayer#2
1.1340 + iTestAudioPlayer2->Play();
1.1341 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.1342 + // Set ExpectedEvent and change the State
1.1343 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.1344 + break;
1.1345 + case EStateErrInUsePlayer1:
1.1346 + // Set ExpectedEvent and change the State
1.1347 + StateChange(EStateEndPlay2, EMapcPlayComplete2);
1.1348 + break;
1.1349 + case EStateEndPlay2:
1.1350 + // Timer to check if Notification Event Occurs.
1.1351 + iCallBackTimer->After(2000000);
1.1352 + // Set ExpectedEvent and change the State
1.1353 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.1354 + break;
1.1355 + case EStateNotifiedPlayer1:
1.1356 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1357 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived => 1"));
1.1358 + retErr = iTestAudioPlayer1->WillResumePlay();
1.1359 + INFO_PRINTF1(_L("iTestAudioPlayer1->WillResumePlay()"));
1.1360 + if( retErr != KErrNone )
1.1361 + {
1.1362 + ERR_PRINTF2(_L("iTestAudioPlayer1->WillResumePlay() - Failed with Error : %d"), retErr);
1.1363 + iTestStepResult = EFail;
1.1364 + CActiveScheduler::Stop();
1.1365 + break;
1.1366 + }
1.1367 + iTestAudioPlayer1->SetPosition(iPosition);
1.1368 + // Play iTestAudioPlayer#1
1.1369 + iTestAudioPlayer1->Play();
1.1370 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.1371 + // Open iTestAudioPlayer#2
1.1372 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.1373 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.1374 + // Set ExpectedEvent and change the State
1.1375 + StateChange(EStatePlaying2A, EMapcInitComplete2);
1.1376 + break;
1.1377 + case EStatePlaying2A:
1.1378 + // Play iTestAudioPlayer#2
1.1379 + iTestAudioPlayer2->Play();
1.1380 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.1381 + // Set ExpectedEvent and change the State
1.1382 + StateChange(EStateErrInUsePlayer1A, EMapcPlayComplete1, KErrInUse);
1.1383 + break;
1.1384 + case EStateErrInUsePlayer1A:
1.1385 + // Set ExpectedEvent and change the State
1.1386 + StateChange(EStateEndPlay2A, EMapcPlayComplete2);
1.1387 + break;
1.1388 + case EStateEndPlay2A:
1.1389 + // Timer to check if Notification Event Occurs.
1.1390 + iCallBackTimer->After(2000000);
1.1391 + // Set ExpectedEvent and change the State
1.1392 + StateChange(EStateNotifiedPlayer1A, EMarncResourceAvailable1);
1.1393 + break;
1.1394 + case EStateNotifiedPlayer1A:
1.1395 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1396 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived => 2"));
1.1397 + iTestStepResult = EPass;
1.1398 + CActiveScheduler::Stop();
1.1399 + break;
1.1400 + }
1.1401 + }
1.1402 + }
1.1403 +
1.1404 +/**
1.1405 + * PerformTestL
1.1406 + */
1.1407 +TVerdict CTestMmfAclntARN8107::PerformTestL()
1.1408 + {
1.1409 + INFO_PRINTF1(_L("Client does not need to Re-register for the same event when the event is received i.e API is not one shot."));
1.1410 + iTestStepResult = EFail;
1.1411 +
1.1412 + // Initialise the state variables
1.1413 + StateInit();
1.1414 +
1.1415 + // Begin the process
1.1416 + FsmL(EIdlePlayer, KErrNone);
1.1417 +
1.1418 + // Start the scheduler - Done only once !
1.1419 + CActiveScheduler::Start();
1.1420 +
1.1421 + return iTestStepResult;
1.1422 + }
1.1423 +
1.1424 +//
1.1425 +//CTestMmfAclntARN8108
1.1426 +//
1.1427 +
1.1428 +/**
1.1429 + * NewL
1.1430 + */
1.1431 +CTestMmfAclntARN8108* CTestMmfAclntARN8108::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.1432 + {
1.1433 + CTestMmfAclntARN8108* self = new (ELeave) CTestMmfAclntARN8108(aTestName, aSectName);
1.1434 + return self;
1.1435 + }
1.1436 +
1.1437 +/**
1.1438 + * Constructor
1.1439 + */
1.1440 +CTestMmfAclntARN8108::CTestMmfAclntARN8108(const TDesC& aTestName, const TDesC& aSectName)
1.1441 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.1442 + {}
1.1443 +
1.1444 +
1.1445 +/**
1.1446 + * DoTestL
1.1447 + */
1.1448 +TVerdict CTestMmfAclntARN8108::DoTestL()
1.1449 + {
1.1450 + return( PerformTestL() );
1.1451 + }
1.1452 +
1.1453 +void CTestMmfAclntARN8108::DecideFsmState(TInt aClientNumber,CMultiEventChecker::TClientUtilityType aClientType, TInt aEventCode, TInt aError)
1.1454 + {
1.1455 + if (iEventChecker->CheckFsm(aClientNumber, aClientType, aEventCode, aError))
1.1456 + {
1.1457 + iTestStepResult = (this->*(iStateHandlers[iEventChecker->NextState()]))();
1.1458 + if(iTestStepResult != EPass)
1.1459 + {
1.1460 + iEventChecker->StopTest();
1.1461 + }
1.1462 + }
1.1463 + }
1.1464 +
1.1465 +void CTestMmfAclntARN8108::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1466 + {
1.1467 + if (aEventCode == EMapcInitComplete1 || aEventCode == EMapcPlayComplete1 || aEventCode == EMarncResourceAvailable1)
1.1468 + { //Client 1
1.1469 + DecideFsmState(1,CMultiEventChecker::EAudioPlayer,aEventCode,aError);
1.1470 + }
1.1471 + if (aEventCode == EMapcInitComplete2 || aEventCode == EMapcPlayComplete2 || aEventCode == EMarncResourceAvailable2)
1.1472 + { //Client 2
1.1473 + DecideFsmState(2,CMultiEventChecker::EAudioPlayer,aEventCode,aError);
1.1474 + }
1.1475 + if (aEventCode == EMapcInitComplete3 || aEventCode == EMapcPlayComplete3 || aEventCode == EMarncResourceAvailable3)
1.1476 + { //Client 3
1.1477 + DecideFsmState(3,CMultiEventChecker::EAudioPlayer,aEventCode,aError);
1.1478 + }
1.1479 + }
1.1480 +
1.1481 +
1.1482 +void CTestMmfAclntARN8108::InitTest()
1.1483 + {
1.1484 + iStateHandlers[EStateOpenPlayer1]=&CTestMmfAclntARN8108::HandleStateOpenPlayer1;
1.1485 + iStateHandlers[EStateOpenPlayer3]=&CTestMmfAclntARN8108::HandleStateOpenPlayer3;
1.1486 + iStateHandlers[EStateOpenPlayer2]=&CTestMmfAclntARN8108::HandleStateOpenPlayer2;
1.1487 + iStateHandlers[EStateErrInUsePlayer1]=&CTestMmfAclntARN8108::HandleStateErrInUsePlayer1;
1.1488 + iStateHandlers[EStateErrInUsePlayer3]=&CTestMmfAclntARN8108::HandleStateErrInUsePlayer3;
1.1489 + iStateHandlers[EStateNotifiedPlayer1]=&CTestMmfAclntARN8108::HandleStateNotifiedPlayer1;
1.1490 + iStateHandlers[EStateNotifiedPlayer3]=&CTestMmfAclntARN8108::HandleStateNotifiedPlayer3;
1.1491 + iStateHandlers[EStatePlaying1]=&CTestMmfAclntARN8108::HandleStatePlaying1;
1.1492 + }
1.1493 +
1.1494 +void CTestMmfAclntARN8108::StartTestL()
1.1495 + {
1.1496 + // Open iTestAudioPlayer#1
1.1497 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.1498 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.1499 + iEventChecker->SetExpectedEvent(1,EMapcInitComplete1,KErrNone);
1.1500 + iEventChecker->SetExpectedState(EStateOpenPlayer1);
1.1501 + }
1.1502 +
1.1503 +TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer1()
1.1504 + {
1.1505 + TInt retErr;
1.1506 + // Play iTestAudioPlayer#1
1.1507 + iTestAudioPlayer1->Play();
1.1508 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.1509 + // Register iTestAudioPlayer#1 for Notification
1.1510 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.1511 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.1512 + if( retErr != KErrNone )
1.1513 + {
1.1514 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.1515 + iTestStepResult = EFail;
1.1516 + CActiveScheduler::Stop();
1.1517 + return EFail;
1.1518 + }
1.1519 + // Register iTestAudioPlayer#3 for Notification
1.1520 + retErr = iTestAudioPlayer3->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport3, KMMFEventCategoryAudioResourceAvailable);
1.1521 + INFO_PRINTF1(_L("iTestAudioPlayer3->RegisterAudioResourceNotification()"));
1.1522 + if( retErr != KErrNone )
1.1523 + {
1.1524 + ERR_PRINTF2(_L("iTestAudioPlayer3->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.1525 + iTestStepResult = EFail;
1.1526 + CActiveScheduler::Stop();
1.1527 + return EFail;
1.1528 + }
1.1529 + // Open iTestAudioPlayer#3
1.1530 + iTestAudioPlayer3->OpenFileL(iFilename3);
1.1531 + INFO_PRINTF1(_L("iTestAudioPlayer3->OpenFileL()"));
1.1532 + // Set ExpectedEvent and change the State
1.1533 + iEventChecker->SetExpectedEvent(3,EMapcInitComplete3,KErrNone);
1.1534 + iEventChecker->SetExpectedState(EStateOpenPlayer3);
1.1535 + return EPass;
1.1536 + }
1.1537 +
1.1538 +TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer3()
1.1539 + {
1.1540 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.1541 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.1542 + // Set ExpectedEvent and change the State
1.1543 + iEventChecker->SetExpectedEvent(2,EMapcInitComplete2,KErrNone);
1.1544 + iEventChecker->SetExpectedState(EStateOpenPlayer2);
1.1545 + return EPass;
1.1546 + }
1.1547 +
1.1548 +TVerdict CTestMmfAclntARN8108::HandleStateOpenPlayer2()
1.1549 + {
1.1550 + // Play iTestAudioPlayer#2
1.1551 + iTestAudioPlayer2->Play();
1.1552 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.1553 + // Set ExpectedEvent and change the State
1.1554 + iEventChecker->SetExpectedEvent(1,EMapcPlayComplete1,KErrInUse);
1.1555 + iEventChecker->SetExpectedState(EStateErrInUsePlayer1);
1.1556 + return EPass;
1.1557 + }
1.1558 +TVerdict CTestMmfAclntARN8108::HandleStateErrInUsePlayer1()
1.1559 + {
1.1560 + // Play iTestAudioPlayer#3
1.1561 + iTestAudioPlayer3->Play();
1.1562 + INFO_PRINTF1(_L("iTestAudioPlayer3->Play()"));
1.1563 + // Set ExpectedEvent and change the State
1.1564 + iEventChecker->SetExpectedEvent(3,EMapcPlayComplete3,KErrInUse);
1.1565 + iEventChecker->SetExpectedState(EStateErrInUsePlayer3);
1.1566 + return EPass;
1.1567 + }
1.1568 +
1.1569 +TVerdict CTestMmfAclntARN8108::HandleStateErrInUsePlayer3()
1.1570 + {
1.1571 + // Close iTestAudioPlayer#2
1.1572 + WaitWithTimeout(iRequestStatus,1000000);
1.1573 + iTestAudioPlayer2->Stop();
1.1574 + INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()"));
1.1575 + iTestAudioPlayer2->Close();
1.1576 + INFO_PRINTF1(_L("iTestAudioPlayer2->Close()"));
1.1577 + // Timer to check if Notification Event Occurs.
1.1578 + iCallBackTimer->After(2000000);
1.1579 + // Set ExpectedEvent and change the State
1.1580 + iEventChecker->SetExpectedEvent(1,EMarncResourceAvailable1,KErrNone);
1.1581 + iEventChecker->SetExpectedState(EStateNotifiedPlayer1);
1.1582 + return EPass;
1.1583 + }
1.1584 +
1.1585 +TVerdict CTestMmfAclntARN8108::HandleStateNotifiedPlayer1()
1.1586 + {
1.1587 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1588 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.1589 + TInt retErr = iTestAudioPlayer1->WillResumePlay();
1.1590 + INFO_PRINTF1(_L("iTestAudioPlayer1->WillResumePlay()"));
1.1591 + if( retErr != KErrNone )
1.1592 + {
1.1593 + ERR_PRINTF2(_L("iTestAudioPlayer1->WillResumePlay() - Failed with Error : %d"), retErr);
1.1594 + iTestStepResult = EFail;
1.1595 + CActiveScheduler::Stop();
1.1596 + return EFail;
1.1597 + }
1.1598 + iTestAudioPlayer1->SetPosition(iPosition);
1.1599 + // Play iTestAudioPlayer#1
1.1600 + iTestAudioPlayer1->Play();
1.1601 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.1602 + // Set ExpectedEvent and change the State
1.1603 + iEventChecker->RegisterClientEventToMonitor(1,EMapcPlayComplete1,KErrNone,EStateNotifiedPlayer3);
1.1604 + iEventChecker->RegisterClientEventToMonitor(3,EMarncResourceAvailable3,KErrNone,EStatePlaying1);
1.1605 + iEventChecker->EnableMultipleEventMonitor();
1.1606 + return EPass;
1.1607 + }
1.1608 +
1.1609 +TVerdict CTestMmfAclntARN8108::HandleStateNotifiedPlayer3()
1.1610 + {
1.1611 + INFO_PRINTF1(_L("iTestAudioPlayer3->NotificationReceived"));
1.1612 + if(iEventChecker->IsMonitoringFinished())
1.1613 + {
1.1614 + iTestStepResult = EPass;
1.1615 + iCallBackTimer->Cancel();
1.1616 + iEventChecker->StopTest();
1.1617 + }
1.1618 + else
1.1619 + {
1.1620 + iEventChecker->EnableMultipleEventMonitor();
1.1621 + }
1.1622 + return EPass;
1.1623 + }
1.1624 +
1.1625 +TVerdict CTestMmfAclntARN8108::HandleStatePlaying1()
1.1626 + {
1.1627 + INFO_PRINTF1(_L("iTestAudioPlayer1->AudioPlayerComplete"));
1.1628 + iCallBackTimer->After(2000000);
1.1629 + if(iEventChecker->IsMonitoringFinished())
1.1630 + {
1.1631 + iTestStepResult = EPass;
1.1632 + iCallBackTimer->Cancel();
1.1633 + iEventChecker->StopTest();
1.1634 + }
1.1635 + else
1.1636 + {
1.1637 + iEventChecker->EnableMultipleEventMonitor();
1.1638 + }
1.1639 + return EPass;
1.1640 + }
1.1641 +
1.1642 +TVerdict CTestMmfAclntARN8108::PerformTestL()
1.1643 + {
1.1644 + INFO_PRINTF1(_L("Call WillResumePlay()."));
1.1645 + iTestStepResult = EFail;
1.1646 +
1.1647 + // Initialise the handler functions
1.1648 + InitTest();
1.1649 +
1.1650 + // Initiate the process
1.1651 + StartTestL();
1.1652 +
1.1653 + // Start the scheduler - Done only once !
1.1654 + CActiveScheduler::Start();
1.1655 +
1.1656 + return iTestStepResult;
1.1657 + }
1.1658 +
1.1659 +
1.1660 +//
1.1661 +//CTestMmfAclntARN8109
1.1662 +//
1.1663 +
1.1664 +/**
1.1665 + * NewL
1.1666 + */
1.1667 +CTestMmfAclntARN8109* CTestMmfAclntARN8109::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.1668 + {
1.1669 + CTestMmfAclntARN8109* self = new (ELeave) CTestMmfAclntARN8109(aTestName, aSectName);
1.1670 + return self;
1.1671 + }
1.1672 +
1.1673 +/**
1.1674 + * Constructor
1.1675 + */
1.1676 +CTestMmfAclntARN8109::CTestMmfAclntARN8109(const TDesC& aTestName, const TDesC& aSectName)
1.1677 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName), iPlayComplete2(EFalse), iResourceAvailable1(EFalse)
1.1678 + {}
1.1679 +
1.1680 +
1.1681 +/**
1.1682 + * DoTestL
1.1683 + */
1.1684 +TVerdict CTestMmfAclntARN8109::DoTestL()
1.1685 + {
1.1686 + return( PerformTestL() );
1.1687 + }
1.1688 +/**
1.1689 + * MapcPlayCompleteTest
1.1690 + */
1.1691 +void CTestMmfAclntARN8109::MapcPlayCompleteTest(TInt aError, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1.1692 + {
1.1693 + if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1.1694 + {
1.1695 + INFO_PRINTF2(_L("iAudioPlayer1 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1.1696 + TRAP(iError, FsmL(EMapcPlayComplete1, aError));
1.1697 + }
1.1698 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1.1699 + {
1.1700 + INFO_PRINTF2(_L("iAudioPlayer2 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1.1701 + iPlayComplete2= ETrue;
1.1702 + TRAP(iError, FsmL(EMapcPlayComplete2, aError));
1.1703 + }
1.1704 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1.1705 + {
1.1706 + INFO_PRINTF2(_L("iAudioPlayer3 -> MMdaAudioPlayerCallback PlayComplete (%d)"), aError);
1.1707 + TRAP(iError, FsmL(EMapcPlayComplete3, aError));
1.1708 + }
1.1709 + }
1.1710 +
1.1711 +
1.1712 +/**
1.1713 + * MarncResourceAvailableTest
1.1714 + */
1.1715 +void CTestMmfAclntARN8109::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioPlayerCallbackSupport& aMdaAudioPlayerCallbackSupport)
1.1716 + {
1.1717 + if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable)
1.1718 + {
1.1719 + INFO_PRINTF1(_L("iAudioPlayer::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable"));
1.1720 +
1.1721 + //Convert TDesc8 to TInt64
1.1722 + TMMFTimeIntervalMicroSecondsPckg timeIntvbuf;
1.1723 + timeIntvbuf.Copy(aNotificationData);
1.1724 + TTimeIntervalMicroSeconds intPos = timeIntvbuf();
1.1725 + iPosition = intPos;
1.1726 + if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport1)
1.1727 + {
1.1728 + INFO_PRINTF1(_L("iAudioPlayer1 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable..waiting for playcomplete"));
1.1729 + iResourceAvailable1 = ETrue;
1.1730 + TRAP(iError, FsmL(EMarncResourceAvailable1, KErrNone));
1.1731 + }
1.1732 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport2)
1.1733 + {
1.1734 + INFO_PRINTF1(_L("iAudioPlayer2 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
1.1735 + TRAP(iError, FsmL(EMarncResourceAvailable2, KErrNone));
1.1736 + }
1.1737 + else if (&aMdaAudioPlayerCallbackSupport == iMdaAudioPlayerCallbackSupport3)
1.1738 + {
1.1739 + INFO_PRINTF1(_L("iAudioPlayer3 -> MMMFAudioResourceNotificationCallback : AudioResourceAvailable"));
1.1740 + TRAP(iError, FsmL(EMarncResourceAvailable3, KErrNone));
1.1741 + }
1.1742 + }
1.1743 + else
1.1744 + {
1.1745 + INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable"));
1.1746 + }
1.1747 + }
1.1748 +
1.1749 +/**
1.1750 + * FsmCheck
1.1751 + */
1.1752 +TBool CTestMmfAclntARN8109::FsmCheck(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1753 + {
1.1754 + TBool retFsmCheck = EFalse;
1.1755 + if (((aEventCode == EMapcPlayComplete1) || (aEventCode == EMapcPlayComplete2)) && (aError == KErrUnderflow))
1.1756 + {
1.1757 + INFO_PRINTF1(_L("Underflow !"));
1.1758 + }
1.1759 + else if (iExpectedEvent != aEventCode)
1.1760 + {
1.1761 + if(aEventCode == EMarncResourceAvailable1)
1.1762 + {
1.1763 + retFsmCheck = EFalse;
1.1764 + }
1.1765 + else
1.1766 + {
1.1767 + ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode);
1.1768 + iTestStepResult = EFail;
1.1769 + CActiveScheduler::Stop();
1.1770 + }
1.1771 + }
1.1772 + else if (iExpectedError != aError)
1.1773 + {
1.1774 + ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError);
1.1775 + iTestStepResult = EFail;
1.1776 + CActiveScheduler::Stop();
1.1777 + }
1.1778 + else
1.1779 + {
1.1780 + retFsmCheck = ETrue;
1.1781 + }
1.1782 + return retFsmCheck;
1.1783 + }
1.1784 +/**
1.1785 + * FsmL
1.1786 + */
1.1787 +void CTestMmfAclntARN8109::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1788 + {
1.1789 + if (FsmCheck(aEventCode, aError))
1.1790 + {
1.1791 + TTimeIntervalMicroSeconds silence(0); // 3 sec of silence
1.1792 + TInt retErr = KErrNone;
1.1793 + switch (iState)
1.1794 + {
1.1795 +
1.1796 + case EStateBegin:
1.1797 + // Open iTestAudioPlayer#1
1.1798 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.1799 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.1800 + // Set ExpectedEvent and change the State
1.1801 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.1802 + break;
1.1803 + case EStatePlaying1:
1.1804 + // Play iTestAudioPlayer#1
1.1805 + iTestAudioPlayer1->Play();
1.1806 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.1807 + // Register iTestAudioPlayer#1 for Notification
1.1808 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.1809 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.1810 + if( retErr != KErrNone )
1.1811 + {
1.1812 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.1813 + iTestStepResult = EFail;
1.1814 + CActiveScheduler::Stop();
1.1815 + break;
1.1816 + }
1.1817 + // Open iTestAudioPlayer#2
1.1818 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.1819 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.1820 + // Set ExpectedEvent and change the State
1.1821 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.1822 + break;
1.1823 + case EStatePlaying2:
1.1824 + // Play iTestAudioPlayer#2
1.1825 + iDuration = I64INT(iTestAudioPlayer2->Duration().Int64());
1.1826 + INFO_PRINTF1( _L("SetRepeats CMdaAudioPlayerUtility"));
1.1827 + INFO_PRINTF2( _L("Repeats = %d\n"),NUMBER_OF_REPEATS);
1.1828 + iTestAudioPlayer2->SetRepeats(NUMBER_OF_REPEATS,silence);
1.1829 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.1830 +
1.1831 + iTestAudioPlayer2->Play();
1.1832 + iStart.HomeTime();
1.1833 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.1834 + // Set ExpectedEvent and change the State
1.1835 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.1836 + break;
1.1837 + case EStateErrInUsePlayer1:
1.1838 + // Set ExpectedEvent and change the State
1.1839 + StateChange(EStateEndPlay2, EMapcPlayComplete2);
1.1840 + break;
1.1841 + case EStateEndPlay2:
1.1842 + iStop.HomeTime();
1.1843 + iActualDuration = I64INT(iStop.MicroSecondsFrom(iStart).Int64());
1.1844 + INFO_PRINTF2( _L("Clip Duration = %d "),iDuration);
1.1845 + INFO_PRINTF2( _L("Actual Duration = %u "),iActualDuration);
1.1846 + INFO_PRINTF2( _L("Expected Duration = %d "),iDuration *(NUMBER_OF_REPEATS));
1.1847 + if(iPlayComplete2 && iResourceAvailable1)
1.1848 + {
1.1849 + #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.1850 + if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1.1851 + KExpectedDeviation))
1.1852 + {
1.1853 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1854 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.1855 + iTestStepResult = EPass;
1.1856 + CActiveScheduler::Stop();
1.1857 + }
1.1858 + else
1.1859 + {
1.1860 + iTestStepResult = EFail;
1.1861 + CActiveScheduler::Stop();
1.1862 + }
1.1863 + #else
1.1864 + if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1.1865 + KExpectedDeviation*NUMBER_OF_REPEATS))
1.1866 + {
1.1867 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1868 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.1869 + iTestStepResult = EPass;
1.1870 + CActiveScheduler::Stop();
1.1871 + // Timer to check if Notification Event Occurs.
1.1872 + }
1.1873 + else
1.1874 + {
1.1875 + iTestStepResult = EFail;
1.1876 + CActiveScheduler::Stop();
1.1877 + }
1.1878 + #endif
1.1879 + }
1.1880 + else if(iPlayComplete2 && ! iResourceAvailable1)
1.1881 + {
1.1882 + #ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
1.1883 + if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1.1884 + KExpectedDeviation))
1.1885 + {
1.1886 + // Timer to check if Notification Event Occurs.
1.1887 + iCallBackTimer->After(2000000);
1.1888 + // Set ExpectedEvent and change the State
1.1889 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.1890 + }
1.1891 + else
1.1892 + {
1.1893 + iTestStepResult = EFail;
1.1894 + CActiveScheduler::Stop();
1.1895 + }
1.1896 + #else
1.1897 + if(TimeComparison(iActualDuration, iDuration * (NUMBER_OF_REPEATS + 1),
1.1898 + KExpectedDeviation*NUMBER_OF_REPEATS))
1.1899 + {
1.1900 + // Timer to check if Notification Event Occurs.
1.1901 + iCallBackTimer->After(2000000);
1.1902 + // Set ExpectedEvent and change the State
1.1903 + StateChange(EStateNotifiedPlayer1, EMarncResourceAvailable1);
1.1904 + // Timer to check if Notification Event Occurs.
1.1905 + }
1.1906 + else
1.1907 + {
1.1908 + iTestStepResult = EFail;
1.1909 + CActiveScheduler::Stop();
1.1910 + }
1.1911 + #endif
1.1912 + }
1.1913 + break;
1.1914 + case EStateNotifiedPlayer1:
1.1915 + iCallBackTimer->Cancel(); // in case something else stopped the AS
1.1916 + INFO_PRINTF1(_L("iTestAudioPlayer1->NotificationReceived"));
1.1917 + iTestStepResult = EPass;
1.1918 + CActiveScheduler::Stop();
1.1919 + break;
1.1920 + }
1.1921 + }
1.1922 + }
1.1923 +TBool CTestMmfAclntARN8109::TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDeviation)
1.1924 + {
1.1925 + // save unnessary conditions
1.1926 + if(aActual == aExpected)
1.1927 + return ETrue;
1.1928 +
1.1929 + // Prevent unsigned wrapping errors
1.1930 + TUint difference;
1.1931 + if(aActual > aExpected)
1.1932 + difference = aActual - aExpected;
1.1933 + else
1.1934 + difference = aExpected - aActual;
1.1935 +
1.1936 + // comapare
1.1937 + if(difference < aDeviation)
1.1938 + return ETrue;
1.1939 + return EFalse;
1.1940 + }
1.1941 +/**
1.1942 + * PerformTestL
1.1943 + */
1.1944 +TVerdict CTestMmfAclntARN8109::PerformTestL()
1.1945 + {
1.1946 + INFO_PRINTF1(_L("High priority client plays with repeats and low priority client doesn't get resources."));
1.1947 + iTestStepResult = EFail;
1.1948 +
1.1949 + // Initialise the state variables
1.1950 + StateInit();
1.1951 +
1.1952 + // Begin the process
1.1953 + FsmL(EIdlePlayer, KErrNone);
1.1954 +
1.1955 + // Start the scheduler - Done only once !
1.1956 + CActiveScheduler::Start();
1.1957 +
1.1958 + return iTestStepResult;
1.1959 + }
1.1960 +
1.1961 +
1.1962 +//
1.1963 +//CTestMmfAclntARN8110 //test to cover CR id:
1.1964 +//
1.1965 +
1.1966 +/**
1.1967 + * Constructor
1.1968 + */
1.1969 +CTestMmfAclntARN8110::CTestMmfAclntARN8110(const TDesC& aTestName, const TDesC& aSectName)
1.1970 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.1971 + {}
1.1972 +
1.1973 +/**
1.1974 + * NewL
1.1975 + */
1.1976 +CTestMmfAclntARN8110* CTestMmfAclntARN8110::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.1977 + {
1.1978 + CTestMmfAclntARN8110* self = new (ELeave) CTestMmfAclntARN8110(aTestName, aSectName);
1.1979 + return self;
1.1980 + }
1.1981 +
1.1982 +/**
1.1983 + * DoTestL
1.1984 + */
1.1985 +TVerdict CTestMmfAclntARN8110::DoTestL()
1.1986 + {
1.1987 + return( PerformTestL() );
1.1988 + }
1.1989 +
1.1990 +/**
1.1991 + * FsmL
1.1992 + */
1.1993 +void CTestMmfAclntARN8110::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.1994 + {
1.1995 + if (FsmCheck(aEventCode, aError))
1.1996 + {
1.1997 + TTimeIntervalMicroSeconds32 wait2secs(2000000);
1.1998 + TTimeIntervalMicroSeconds oneNhalf(MAKE_TINT64(0,1500000));
1.1999 + TInt retErr = KErrNone;
1.2000 + switch (iState)
1.2001 + {
1.2002 + case EStateBegin:
1.2003 + // Open iTestAudioPlayer#1 // next event to play iTestAudioPlayer#1
1.2004 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2005 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2006 + // Set ExpectedEvent and change the State
1.2007 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.2008 + break;
1.2009 + case EStatePlaying1:
1.2010 + // Play iTestAudioPlayer#1
1.2011 + iTestAudioPlayer1->Play();
1.2012 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.2013 + // Open iTestAudioPlayer#2
1.2014 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.2015 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.2016 + // Set ExpectedEvent and change the State
1.2017 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.2018 + break;
1.2019 + case EStatePlaying2:
1.2020 + // Play iTestAudioPlayer#2
1.2021 + User::After(wait2secs);
1.2022 + iTestAudioPlayer2->Play();
1.2023 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.2024 + // Set ExpectedEvent and change the State
1.2025 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.2026 + break;
1.2027 + case EStateErrInUsePlayer1:
1.2028 + retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
1.2029 + if(retErr != KErrNone)
1.2030 + {
1.2031 + ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
1.2032 + iTestStepResult = EFail;
1.2033 + CActiveScheduler::Stop();
1.2034 + break;
1.2035 + }
1.2036 + INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
1.2037 + //using 1.5 sec for comparison as sometimes playback is slow.
1.2038 + if(iPlayer1Pos < oneNhalf)
1.2039 + {
1.2040 + iTestStepResult = EFail;
1.2041 + CActiveScheduler::Stop();
1.2042 + break;
1.2043 + }
1.2044 + // Set ExpectedEvent and change the State
1.2045 + StateChange(EStateEndPlay2, EMapcPlayComplete2 );
1.2046 + break;
1.2047 + case EStateEndPlay2:
1.2048 + iTestStepResult = EPass;
1.2049 + // Play iTestAudioPlayer#1 again
1.2050 + TTimeIntervalMicroSeconds pos;
1.2051 + INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
1.2052 + retErr = iTestAudioPlayer1->GetPosition(pos);
1.2053 + if(retErr != KErrNone)
1.2054 + {
1.2055 + ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
1.2056 + iTestStepResult = EFail;
1.2057 + CActiveScheduler::Stop();
1.2058 + break;
1.2059 + }
1.2060 + if(pos == 0 || pos != iPlayer1Pos )
1.2061 + {
1.2062 + iTestStepResult = EFail;
1.2063 + CActiveScheduler::Stop();
1.2064 + break;
1.2065 + }
1.2066 + iTestAudioPlayer1->Play();
1.2067 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.2068 + retErr = iTestAudioPlayer1->GetPosition(pos);
1.2069 + if(retErr != KErrNone)
1.2070 + {
1.2071 + ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
1.2072 + iTestStepResult = EFail;
1.2073 + CActiveScheduler::Stop();
1.2074 + break;
1.2075 + }
1.2076 + INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
1.2077 + if(pos < iPlayer1Pos)
1.2078 + {
1.2079 + iTestStepResult = EFail;
1.2080 + CActiveScheduler::Stop();
1.2081 + break;
1.2082 + }
1.2083 + iTestAudioPlayer1->Stop();
1.2084 + INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()"));
1.2085 + iTestStepResult = EPass;
1.2086 + CActiveScheduler::Stop();
1.2087 + // Set ExpectedEvent and change the State
1.2088 + break;
1.2089 + }
1.2090 + }
1.2091 + }
1.2092 +
1.2093 +/**
1.2094 + * PerformTestL
1.2095 + */
1.2096 +TVerdict CTestMmfAclntARN8110::PerformTestL()
1.2097 + {
1.2098 + INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
1.2099 + iTestStepResult = EFail;
1.2100 +
1.2101 + // Initialise the state variables
1.2102 + StateInit();
1.2103 +
1.2104 + // Begin the process
1.2105 + FsmL(EIdlePlayer, KErrNone);
1.2106 +
1.2107 + // Start the scheduler - Done only once !
1.2108 + CActiveScheduler::Start();
1.2109 +
1.2110 + return iTestStepResult;
1.2111 + }
1.2112 +
1.2113 +
1.2114 +//
1.2115 +//CTestMmfAclntARN8111 //test to cover CR id:
1.2116 +//
1.2117 +
1.2118 +/**
1.2119 + * Constructor
1.2120 + */
1.2121 +CTestMmfAclntARN8111::CTestMmfAclntARN8111(const TDesC& aTestName, const TDesC& aSectName)
1.2122 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.2123 + {}
1.2124 +
1.2125 +/**
1.2126 + * NewL
1.2127 + */
1.2128 +CTestMmfAclntARN8111* CTestMmfAclntARN8111::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.2129 + {
1.2130 + CTestMmfAclntARN8111* self = new (ELeave) CTestMmfAclntARN8111(aTestName, aSectName);
1.2131 + return self;
1.2132 + }
1.2133 +
1.2134 +/**
1.2135 + * DoTestL
1.2136 + */
1.2137 +TVerdict CTestMmfAclntARN8111::DoTestL()
1.2138 + {
1.2139 + return( PerformTestL() );
1.2140 + }
1.2141 +
1.2142 +/**
1.2143 + * FsmL
1.2144 + */
1.2145 +void CTestMmfAclntARN8111::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.2146 + {
1.2147 + if (FsmCheck(aEventCode, aError))
1.2148 + {
1.2149 + TTimeIntervalMicroSeconds32 wait2secs(2000000);
1.2150 + TTimeIntervalMicroSeconds oneNhalf(MAKE_TINT64(0,1500000));
1.2151 + TTimeIntervalMicroSeconds zeroSecs(MAKE_TINT64(0,0));
1.2152 + TInt retErr = KErrNone;
1.2153 + switch (iState)
1.2154 + {
1.2155 + case EStateBegin:
1.2156 + // Open iTestAudioPlayer#1 // next event to play iTestAudioPlayer#1
1.2157 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2158 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2159 + // Set ExpectedEvent and change the State
1.2160 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.2161 + break;
1.2162 + case EStatePlaying1:
1.2163 + // Play iTestAudioPlayer#1
1.2164 + iTestAudioPlayer1->Play();
1.2165 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.2166 + // Open iTestAudioPlayer#2
1.2167 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.2168 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.2169 + // Set ExpectedEvent and change the State
1.2170 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.2171 + break;
1.2172 + case EStatePlaying2:
1.2173 + // Play iTestAudioPlayer#2
1.2174 + User::After(wait2secs);
1.2175 + iTestAudioPlayer2->Play();
1.2176 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.2177 + // Set ExpectedEvent and change the State
1.2178 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.2179 + break;
1.2180 + case EStateErrInUsePlayer1:
1.2181 + retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
1.2182 + if(retErr != KErrNone)
1.2183 + {
1.2184 + ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
1.2185 + iTestStepResult = EFail;
1.2186 + CActiveScheduler::Stop();
1.2187 + break;
1.2188 + }
1.2189 + INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
1.2190 + //using 1.5 sec for comparison as sometimes playback is slow.
1.2191 + if(iPlayer1Pos < oneNhalf)
1.2192 + {
1.2193 + iTestStepResult = EFail;
1.2194 + CActiveScheduler::Stop();
1.2195 + break;
1.2196 + }
1.2197 + //stop the iTestAudioPlayer#1 after pre-emption and check if the position is reset.
1.2198 + iTestAudioPlayer1->Stop();
1.2199 + INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()"));
1.2200 + retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
1.2201 + if(retErr != KErrNone)
1.2202 + {
1.2203 + ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
1.2204 + iTestStepResult = EFail;
1.2205 + CActiveScheduler::Stop();
1.2206 + break;
1.2207 + }
1.2208 + INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
1.2209 + if(iPlayer1Pos != zeroSecs)
1.2210 + {
1.2211 + iTestStepResult = EFail;
1.2212 + CActiveScheduler::Stop();
1.2213 + break;
1.2214 + }
1.2215 + // Set ExpectedEvent and change the State
1.2216 + StateChange(EStateEndPlay2, EMapcPlayComplete2 );
1.2217 + break;
1.2218 + case EStateEndPlay2:
1.2219 + iTestStepResult = EPass;
1.2220 + // Play iTestAudioPlayer#1 again
1.2221 + iTestAudioPlayer1->Play();
1.2222 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.2223 + User::After(wait2secs);
1.2224 + iTestAudioPlayer1->Stop();
1.2225 + INFO_PRINTF1(_L("iTestAudioPlayer1->Stop()"));
1.2226 + CActiveScheduler::Stop();
1.2227 + // Set ExpectedEvent and change the State
1.2228 + break;
1.2229 + }
1.2230 + }
1.2231 + }
1.2232 +
1.2233 +/**
1.2234 + * PerformTestL
1.2235 + */
1.2236 +TVerdict CTestMmfAclntARN8111::PerformTestL()
1.2237 + {
1.2238 + INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
1.2239 + iTestStepResult = EFail;
1.2240 +
1.2241 + // Initialise the state variables
1.2242 + StateInit();
1.2243 +
1.2244 + // Begin the process
1.2245 + FsmL(EIdlePlayer, KErrNone);
1.2246 +
1.2247 + // Start the scheduler - Done only once !
1.2248 + CActiveScheduler::Start();
1.2249 +
1.2250 + return iTestStepResult;
1.2251 + }
1.2252 +
1.2253 +//
1.2254 +//CTestMmfAclntARN8112 //test to cover CR id:
1.2255 +//
1.2256 +
1.2257 +/**
1.2258 + * Constructor
1.2259 + */
1.2260 +CTestMmfAclntARN8112::CTestMmfAclntARN8112(const TDesC& aTestName, const TDesC& aSectName)
1.2261 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.2262 + {}
1.2263 +
1.2264 +/**
1.2265 + * NewL
1.2266 + */
1.2267 +CTestMmfAclntARN8112* CTestMmfAclntARN8112::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.2268 + {
1.2269 + CTestMmfAclntARN8112* self = new (ELeave) CTestMmfAclntARN8112(aTestName, aSectName);
1.2270 + return self;
1.2271 + }
1.2272 +
1.2273 +/**
1.2274 + * DoTestL
1.2275 + */
1.2276 +TVerdict CTestMmfAclntARN8112::DoTestL()
1.2277 + {
1.2278 + return( PerformTestL() );
1.2279 + }
1.2280 +
1.2281 +/**
1.2282 + * FsmL
1.2283 + */
1.2284 +void CTestMmfAclntARN8112::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.2285 + {
1.2286 + if (FsmCheck(aEventCode, aError))
1.2287 + {
1.2288 + TTimeIntervalMicroSeconds32 wait1secs(1000000);
1.2289 + TTimeIntervalMicroSeconds zeroSecs(MAKE_TINT64(0,0));
1.2290 + TInt retErr = KErrNone;
1.2291 + switch (iState)
1.2292 + {
1.2293 + case EStateBegin:
1.2294 + // Open iTestAudioPlayer#2 // next event to play iTestAudioPlayer#2
1.2295 + iTestAudioPlayer2->OpenFileL(iFilename2);
1.2296 + INFO_PRINTF1(_L("iTestAudioPlayer2->OpenFileL()"));
1.2297 + // Set ExpectedEvent and change the State
1.2298 + StateChange(EStatePlaying2, EMapcInitComplete2);
1.2299 + break;
1.2300 + case EStatePlaying2:
1.2301 + // Play iTestAudioPlayer#1
1.2302 + iTestAudioPlayer2->Play();
1.2303 + INFO_PRINTF1(_L("iTestAudioPlayer2->Play()"));
1.2304 + // Open iTestAudioPlayer#1
1.2305 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2306 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2307 + // Set ExpectedEvent and change the State
1.2308 + StateChange(EStatePlaying1, EMapcInitComplete1);
1.2309 + break;
1.2310 + case EStatePlaying1:
1.2311 + // Play iTestAudioPlayer#1
1.2312 + User::After(wait1secs);
1.2313 + iTestAudioPlayer1->Play();
1.2314 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.2315 + // Set ExpectedEvent and change the State
1.2316 + StateChange(EStateErrInUsePlayer1, EMapcPlayComplete1, KErrInUse);
1.2317 + break;
1.2318 + case EStateErrInUsePlayer1:
1.2319 + retErr = iTestAudioPlayer1->GetPosition(iPlayer1Pos);
1.2320 + if(retErr != KErrNone)
1.2321 + {
1.2322 + ERR_PRINTF2(_L("iTestAudioPlayer1->Position() - Failed with Error : %d"), retErr);
1.2323 + iTestStepResult = EFail;
1.2324 + CActiveScheduler::Stop();
1.2325 + break;
1.2326 + }
1.2327 + INFO_PRINTF1(_L("iTestAudioPlayer1->Position()"));
1.2328 + if(iPlayer1Pos != zeroSecs)
1.2329 + {
1.2330 + iTestStepResult = EFail;
1.2331 + CActiveScheduler::Stop();
1.2332 + break;
1.2333 + }
1.2334 + //stop the iTestAudioPlayer#1 after pre-emption and check if the position is reset.
1.2335 + iTestAudioPlayer2->Stop();
1.2336 + INFO_PRINTF1(_L("iTestAudioPlayer2->Stop()"));
1.2337 + iTestAudioPlayer1->Play();
1.2338 + INFO_PRINTF1(_L("iTestAudioPlayer1->Play()"));
1.2339 +
1.2340 + // Set ExpectedEvent and change the State
1.2341 + StateChange(EStateEndPlay1, EMapcPlayComplete1 );
1.2342 + break;
1.2343 + case EStateEndPlay1:
1.2344 + iTestStepResult = EPass;
1.2345 + // Play iTestAudioPlayer#1 again
1.2346 + CActiveScheduler::Stop();
1.2347 + // Set ExpectedEvent and change the State
1.2348 + break;
1.2349 + }
1.2350 + }
1.2351 + }
1.2352 +
1.2353 +/**
1.2354 + * PerformTestL
1.2355 + */
1.2356 +TVerdict CTestMmfAclntARN8112::PerformTestL()
1.2357 + {
1.2358 + INFO_PRINTF1(_L("Register for notification, but make no request to play audio"));
1.2359 + iTestStepResult = EFail;
1.2360 +
1.2361 + // Initialise the state variables
1.2362 + StateInit();
1.2363 +
1.2364 + // Begin the process
1.2365 + FsmL(EIdlePlayer, KErrNone);
1.2366 +
1.2367 + // Start the scheduler - Done only once !
1.2368 + CActiveScheduler::Start();
1.2369 +
1.2370 + return iTestStepResult;
1.2371 + }
1.2372 +
1.2373 +//
1.2374 +//NEGATIVE TESTS//
1.2375 +//
1.2376 +
1.2377 +//
1.2378 +//CTestMmfAclntARN1301
1.2379 +//
1.2380 +
1.2381 +/**
1.2382 + * Constructor
1.2383 + */
1.2384 +CTestMmfAclntARN1301::CTestMmfAclntARN1301(const TDesC& aTestName, const TDesC& aSectName)
1.2385 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.2386 + {}
1.2387 +
1.2388 +/**
1.2389 + * NewL
1.2390 + */
1.2391 +CTestMmfAclntARN1301* CTestMmfAclntARN1301::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.2392 + {
1.2393 + CTestMmfAclntARN1301* self = new (ELeave) CTestMmfAclntARN1301(aTestName, aSectName);
1.2394 + return self;
1.2395 + }
1.2396 +
1.2397 +/**
1.2398 + * DoTestL
1.2399 + */
1.2400 +TVerdict CTestMmfAclntARN1301::DoTestL()
1.2401 + {
1.2402 + return( PerformTestL() );
1.2403 + }
1.2404 +
1.2405 +/**
1.2406 + * FsmL
1.2407 + */
1.2408 +void CTestMmfAclntARN1301::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.2409 + {
1.2410 + if (FsmCheck(aEventCode, aError))
1.2411 + {
1.2412 + TInt retErr = KErrNone;
1.2413 + switch (iState)
1.2414 + {
1.2415 + case EStateBegin:
1.2416 + // Open iTestAudioPlayer#1
1.2417 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2418 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2419 + // Set ExpectedEvent and change the State
1.2420 + StateChange(EStateOpenPlayer1, EMapcInitComplete1);
1.2421 + break;
1.2422 + case EStateOpenPlayer1:
1.2423 + // Register iTestAudioPlayer#1 for Notification
1.2424 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryPlaybackComplete);
1.2425 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete)"));
1.2426 + if( retErr == KErrNotSupported )
1.2427 + {
1.2428 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Returned KErrNotSupported ") );
1.2429 + iTestStepResult = EPass;
1.2430 + }
1.2431 + else
1.2432 + {
1.2433 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.2434 + iTestStepResult = EFail;
1.2435 + }
1.2436 + CActiveScheduler::Stop();
1.2437 + break;
1.2438 + }
1.2439 + }
1.2440 + }
1.2441 +
1.2442 +/**
1.2443 + * PerformTestL
1.2444 + */
1.2445 +TVerdict CTestMmfAclntARN1301::PerformTestL()
1.2446 + {
1.2447 + INFO_PRINTF1(_L("Register for notification with an unsupported event type."));
1.2448 + iTestStepResult = EFail;
1.2449 +
1.2450 + // Initialise the state variables
1.2451 + StateInit();
1.2452 +
1.2453 + // Begin the process
1.2454 + FsmL(EIdlePlayer, KErrNone);
1.2455 +
1.2456 + // Start the scheduler - Done only once !
1.2457 + CActiveScheduler::Start();
1.2458 +
1.2459 + return iTestStepResult;
1.2460 + }
1.2461 +
1.2462 +//
1.2463 +//CTestMmfAclntARN1302
1.2464 +//
1.2465 +
1.2466 +/**
1.2467 + * Constructor
1.2468 + */
1.2469 +CTestMmfAclntARN1302::CTestMmfAclntARN1302(const TDesC& aTestName, const TDesC& aSectName)
1.2470 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.2471 + {}
1.2472 +
1.2473 +/**
1.2474 + * NewL
1.2475 + */
1.2476 +CTestMmfAclntARN1302* CTestMmfAclntARN1302::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.2477 + {
1.2478 + CTestMmfAclntARN1302* self = new (ELeave) CTestMmfAclntARN1302(aTestName, aSectName);
1.2479 + return self;
1.2480 + }
1.2481 +
1.2482 +/**
1.2483 + * DoTestL
1.2484 + */
1.2485 +TVerdict CTestMmfAclntARN1302::DoTestL()
1.2486 + {
1.2487 + return( PerformTestL() );
1.2488 + }
1.2489 +
1.2490 +/**
1.2491 + * FsmL
1.2492 + */
1.2493 +void CTestMmfAclntARN1302::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.2494 + {
1.2495 + if (FsmCheck(aEventCode, aError))
1.2496 + {
1.2497 + TInt retErr = KErrNone;
1.2498 + switch (iState)
1.2499 + {
1.2500 + case EStateBegin:
1.2501 + // Open iTestAudioPlayer#1
1.2502 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2503 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2504 + // Set ExpectedEvent and change the State
1.2505 + StateChange(EStateOpenPlayer1, EMapcInitComplete1);
1.2506 + break;
1.2507 + case EStateOpenPlayer1:
1.2508 + // Register iTestAudioPlayer#1 for Notification
1.2509 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.2510 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()"));
1.2511 + if( retErr != KErrNone )
1.2512 + {
1.2513 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.2514 + iTestStepResult = EFail;
1.2515 + CActiveScheduler::Stop();
1.2516 + break;
1.2517 + }
1.2518 + // Cancel notification for iTestAudioPlayer#1
1.2519 + retErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete);
1.2520 + INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete)"));
1.2521 + if( retErr == KErrNotSupported )
1.2522 + {
1.2523 + ERR_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Returned KErrNotSupported ") );
1.2524 + iTestStepResult = EPass;
1.2525 + }
1.2526 + else
1.2527 + {
1.2528 + ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.2529 + iTestStepResult = EFail;
1.2530 + }
1.2531 + CActiveScheduler::Stop();
1.2532 + break;
1.2533 + }
1.2534 + }
1.2535 + }
1.2536 +
1.2537 +/**
1.2538 + * PerformTestL
1.2539 + */
1.2540 +TVerdict CTestMmfAclntARN1302::PerformTestL()
1.2541 + {
1.2542 + INFO_PRINTF1(_L("Cancel the request for notification with an unsupported event type."));
1.2543 + iTestStepResult = EFail;
1.2544 +
1.2545 + // Initialise the state variables
1.2546 + StateInit();
1.2547 +
1.2548 + // Begin the process
1.2549 + FsmL(EIdlePlayer, KErrNone);
1.2550 +
1.2551 + // Start the scheduler - Done only once !
1.2552 + CActiveScheduler::Start();
1.2553 +
1.2554 + return iTestStepResult;
1.2555 + }
1.2556 +
1.2557 +//
1.2558 +//CTestMmfAclntARN1303
1.2559 +//
1.2560 +
1.2561 +/**
1.2562 + * Constructor
1.2563 + */
1.2564 +CTestMmfAclntARN1303::CTestMmfAclntARN1303(const TDesC& aTestName, const TDesC& aSectName)
1.2565 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.2566 + {}
1.2567 +
1.2568 +/**
1.2569 + * NewL
1.2570 + */
1.2571 +CTestMmfAclntARN1303* CTestMmfAclntARN1303::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.2572 + {
1.2573 + CTestMmfAclntARN1303* self = new (ELeave) CTestMmfAclntARN1303(aTestName, aSectName);
1.2574 + return self;
1.2575 + }
1.2576 +
1.2577 +/**
1.2578 + * DoTestL
1.2579 + */
1.2580 +TVerdict CTestMmfAclntARN1303::DoTestL()
1.2581 + {
1.2582 + return( PerformTestL() );
1.2583 + }
1.2584 +
1.2585 +/**
1.2586 + * FsmL
1.2587 + */
1.2588 +void CTestMmfAclntARN1303::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.2589 + {
1.2590 + if (FsmCheck(aEventCode, aError))
1.2591 + {
1.2592 + TInt retErr = KErrNone;
1.2593 + switch (iState)
1.2594 + {
1.2595 + case EStateBegin:
1.2596 + // Open iTestAudioPlayer#1
1.2597 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2598 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2599 + // Set ExpectedEvent and change the State
1.2600 + StateChange(EStateOpenPlayer1, EMapcInitComplete1);
1.2601 + break;
1.2602 + case EStateOpenPlayer1:
1.2603 + // Cancel notification for iTestAudioPlayer#1
1.2604 + retErr = iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable);
1.2605 + INFO_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable)"));
1.2606 + if( retErr == KErrCancel )
1.2607 + {
1.2608 + ERR_PRINTF1(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Returned KErrCancel ") );
1.2609 + iTestStepResult = EPass;
1.2610 + }
1.2611 + else
1.2612 + {
1.2613 + ERR_PRINTF2(_L("iTestAudioPlayer1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), retErr);
1.2614 + iTestStepResult = EFail;
1.2615 + }
1.2616 + CActiveScheduler::Stop();
1.2617 + break;
1.2618 + }
1.2619 + }
1.2620 + }
1.2621 +
1.2622 +/**
1.2623 + * PerformTestL
1.2624 + */
1.2625 +TVerdict CTestMmfAclntARN1303::PerformTestL()
1.2626 + {
1.2627 + INFO_PRINTF1(_L("Cancel when no resource Notification is requested."));
1.2628 + iTestStepResult = EFail;
1.2629 +
1.2630 + // Initialise the state variables
1.2631 + StateInit();
1.2632 +
1.2633 + // Begin the process
1.2634 + FsmL(EIdlePlayer, KErrNone);
1.2635 +
1.2636 + // Start the scheduler - Done only once !
1.2637 + CActiveScheduler::Start();
1.2638 +
1.2639 + return iTestStepResult;
1.2640 + }
1.2641 +
1.2642 +//
1.2643 +//CTestMmfAclntARN1304
1.2644 +//
1.2645 +
1.2646 +/**
1.2647 + * Constructor
1.2648 + */
1.2649 +CTestMmfAclntARN1304::CTestMmfAclntARN1304(const TDesC& aTestName, const TDesC& aSectName)
1.2650 + : CTestMmfAclntAudioPlayerARN(aTestName, aSectName)
1.2651 + {}
1.2652 +
1.2653 +/**
1.2654 + * NewL
1.2655 + */
1.2656 +CTestMmfAclntARN1304* CTestMmfAclntARN1304::NewL(const TDesC& aTestName, const TDesC& aSectName)
1.2657 + {
1.2658 + CTestMmfAclntARN1304* self = new (ELeave) CTestMmfAclntARN1304(aTestName, aSectName);
1.2659 + return self;
1.2660 + }
1.2661 +
1.2662 +/**
1.2663 + * DoTestL
1.2664 + */
1.2665 +TVerdict CTestMmfAclntARN1304::DoTestL()
1.2666 + {
1.2667 + return( PerformTestL() );
1.2668 + }
1.2669 +
1.2670 +/**
1.2671 + * FsmL
1.2672 + */
1.2673 +void CTestMmfAclntARN1304::FsmL(TMmfAudioPlayerEvents aEventCode, TInt aError)
1.2674 + {
1.2675 + if (FsmCheck(aEventCode, aError))
1.2676 + {
1.2677 + TInt retErr = KErrNone;
1.2678 + switch (iState)
1.2679 + {
1.2680 + case EStateBegin:
1.2681 + // Open iTestAudioPlayer#1
1.2682 + iTestAudioPlayer1->OpenFileL(iFilename1);
1.2683 + INFO_PRINTF1(_L("iTestAudioPlayer1->OpenFileL()"));
1.2684 + // Set ExpectedEvent and change the State
1.2685 + StateChange(EStateOpenPlayer1, EMapcInitComplete1);
1.2686 + break;
1.2687 + case EStateOpenPlayer1:
1.2688 + // Register iTestAudioPlayer#1 for Notification
1.2689 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.2690 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()#1"));
1.2691 + if( retErr != KErrNone )
1.2692 + {
1.2693 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #1 - Failed with Error : %d"), retErr);
1.2694 + iTestStepResult = EFail;
1.2695 + CActiveScheduler::Stop();
1.2696 + break;
1.2697 + }
1.2698 + // Register iTestAudioPlayer#1 for Notification (AGAIN)
1.2699 + retErr = iTestAudioPlayer1->RegisterAudioResourceNotification(*iMdaAudioPlayerCallbackSupport1, KMMFEventCategoryAudioResourceAvailable);
1.2700 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification()#2"));
1.2701 + if( retErr == KErrAlreadyExists )
1.2702 + {
1.2703 + INFO_PRINTF1(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #2 - Returned KErrAlreadyExists ") );
1.2704 + iTestStepResult = EPass;
1.2705 + }
1.2706 + else
1.2707 + {
1.2708 + ERR_PRINTF2(_L("iTestAudioPlayer1->RegisterAudioResourceNotification #2 - Failed with Error : %d"), retErr);
1.2709 + iTestStepResult = EFail;
1.2710 + }
1.2711 + CActiveScheduler::Stop();
1.2712 + break;
1.2713 + }
1.2714 + }
1.2715 + }
1.2716 +
1.2717 +/**
1.2718 + * PerformTestL
1.2719 + */
1.2720 +TVerdict CTestMmfAclntARN1304::PerformTestL()
1.2721 + {
1.2722 + INFO_PRINTF1(_L("Multiple Registration for notification for the same event type."));
1.2723 + iTestStepResult = EFail;
1.2724 +
1.2725 + // Initialise the state variables
1.2726 + StateInit();
1.2727 +
1.2728 + // Begin the process
1.2729 + FsmL(EIdlePlayer, KErrNone);
1.2730 +
1.2731 + // Start the scheduler - Done only once !
1.2732 + CActiveScheduler::Start();
1.2733 +
1.2734 + return iTestStepResult;
1.2735 + }