1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/avictrl/tsu_mmf_avictrlplay.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,3662 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <hal.h>
1.20 +#include <hal_data.h>
1.21 +
1.22 +// Specific includes for this test code
1.23 +#include <mmf/common/mmfstandardcustomcommands.h>
1.24 +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
1.25 +#include <mmf/common/mmfstandardcustomcommandsenums.h>
1.26 +#include <mmf/common/mmfstandardcustomcommandsimpl.h>
1.27 +#endif
1.28 +#include "tsu_mmf_avictrl_teststep.h"
1.29 +#include "tsu_mmf_avictrl_testsuite.h"
1.30 +#include "tsu_mmf_avictrlplay.h"
1.31 +#include "tsu_mmf_avictrltestids.h"
1.32 +#define KExtraIterations 5
1.33 +
1.34 +const TUint RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::KMaxFreeRamForTest;
1.35 +
1.36 +/**
1.37 +Test step constructor. It initialises its own name and the input filename
1.38 +*/
1.39 +RTestStepAviPlayCtrlPlay::RTestStepAviPlayCtrlPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.40 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.41 + {
1.42 + }
1.43 +
1.44 +/**
1.45 +Do the test step. This test Primes the AviPlayController and Plays an avi file to its completion
1.46 +and checks for the proper play completion
1.47 +*/
1.48 +TVerdict RTestStepAviPlayCtrlPlay::DoTestStepL()
1.49 + {
1.50 + INFO_PRINTF1(_L("this step plays an avi file "));
1.51 + TInt errorCode = iController.Prime();
1.52 + if(errorCode)
1.53 + {
1.54 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.55 + return EFail;
1.56 + }
1.57 + errorCode = iController.Play();
1.58 + if(errorCode)
1.59 + {
1.60 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.61 + return EFail;
1.62 + }
1.63 + CActiveScheduler::Start();
1.64 + return iTestStepResult;
1.65 + }
1.66 +
1.67 +/**
1.68 +Test step constructor. It initialises its own name and the input filename
1.69 +*/
1.70 +RTestStepAviPlayCtrlVolume::RTestStepAviPlayCtrlVolume(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.71 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.72 + {
1.73 + }
1.74 +
1.75 +/**
1.76 +Do the test step.This tests setting the volume on AviPlayController in Stopped, Primed and Playing
1.77 +states and checks if the volume set is same as the volume got.
1.78 +*/
1.79 +TVerdict RTestStepAviPlayCtrlVolume::DoTestStepL( void )
1.80 + {
1.81 + TInt errorCode = 0;
1.82 + RMMFVideoPlayControllerCustomCommands thePlayCommander(iController);
1.83 + TBool enabled = EFalse;
1.84 + thePlayCommander.GetAudioEnabled(enabled);
1.85 + if(!enabled)
1.86 + {
1.87 + INFO_PRINTF2(_L("GetAudioEnabled() is failed with %d "), errorCode);
1.88 + return EInconclusive;
1.89 + }
1.90 + INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of AviPlayController"));
1.91 + RMMFAudioPlayDeviceCustomCommands theAudioDevice(iController);
1.92 + TInt maxVolume(0);
1.93 + errorCode =theAudioDevice.GetMaxVolume(maxVolume);
1.94 + if(errorCode)
1.95 + {
1.96 + INFO_PRINTF2(_L("GetMaxVolume() is failed with %d "), errorCode);
1.97 + return EInconclusive;
1.98 + }
1.99 + TInt theVolume = maxVolume /2;
1.100 + TTimeIntervalMicroSeconds ramp(100);
1.101 + //try setting volume in Stopped State
1.102 + errorCode =theAudioDevice.SetVolume(theVolume);
1.103 + if(errorCode)
1.104 + {
1.105 + INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with %d "), errorCode);
1.106 + return EFail;
1.107 + }
1.108 + TInt theNewVolume (0);
1.109 + errorCode =theAudioDevice.GetVolume(theNewVolume);
1.110 + if(errorCode)
1.111 + {
1.112 + INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with %d "), errorCode);
1.113 + return EFail;
1.114 + }
1.115 + if( theNewVolume != theVolume )
1.116 + {
1.117 + INFO_PRINTF1(_L("Set and Get Volumes are different during Stopped State"));
1.118 + return EFail;
1.119 + }
1.120 + errorCode =theAudioDevice.SetVolumeRamp(ramp);
1.121 + if(errorCode)
1.122 + {
1.123 + INFO_PRINTF2(_L("SetVolumeRamp() during Stopped State is failed with %d "), errorCode);
1.124 + return EFail;
1.125 + }
1.126 + errorCode = iController.Prime();
1.127 + if(errorCode)
1.128 + {
1.129 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.130 + return EInconclusive;
1.131 + }
1.132 + //try setting volume in Primed State
1.133 + errorCode =theAudioDevice.SetVolume(theVolume);
1.134 + if(errorCode)
1.135 + {
1.136 + INFO_PRINTF2(_L("SetVolume() during Primed State is failed with %d "), errorCode);
1.137 + return EFail;
1.138 + }
1.139 + errorCode =theAudioDevice.GetVolume(theNewVolume);
1.140 + if(errorCode)
1.141 + {
1.142 + INFO_PRINTF2(_L("GetVolume() during Primed State is failed with %d "), errorCode);
1.143 + return EFail;
1.144 + }
1.145 + if( theNewVolume != theVolume )
1.146 + {
1.147 + INFO_PRINTF1(_L("Set and Get Volumes are different during Primed State"));
1.148 + return EFail;
1.149 + }
1.150 + errorCode =theAudioDevice.SetVolumeRamp(ramp);
1.151 + if(errorCode)
1.152 + {
1.153 + INFO_PRINTF2(_L("SetVolumeRamp() during primed State is failed with %d "), errorCode);
1.154 + return EFail;
1.155 + }
1.156 + errorCode = iController.Play();
1.157 + if(errorCode)
1.158 + {
1.159 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.160 + return EInconclusive;
1.161 + }
1.162 + //try setting volume in Playing State
1.163 + errorCode =theAudioDevice.SetVolume(theVolume);
1.164 + if(errorCode)
1.165 + {
1.166 + INFO_PRINTF2(_L("SetVolume() during Playing State is failed with %d "), errorCode);
1.167 + iController.Stop();
1.168 + return EFail;
1.169 + }
1.170 + errorCode =theAudioDevice.GetVolume(theNewVolume);
1.171 + if(errorCode)
1.172 + {
1.173 + INFO_PRINTF2(_L("GetVolume() during Playing State is failed with %d "), errorCode);
1.174 + iController.Stop();
1.175 + return EFail;
1.176 + }
1.177 + if(theNewVolume != theVolume)
1.178 + {
1.179 + //stop the controller
1.180 + INFO_PRINTF1(_L("Set and Get Volumes are different during Playing State"));
1.181 + iController.Stop();
1.182 + return EFail;
1.183 + }
1.184 + errorCode =theAudioDevice.SetVolumeRamp(ramp);
1.185 + if(errorCode)
1.186 + {
1.187 + INFO_PRINTF2(_L("SetVolumeRamp() during play State is failed with %d "), errorCode);
1.188 + return EFail;
1.189 + }
1.190 + //get the play completion event
1.191 + CActiveScheduler::Start();
1.192 + return iTestStepResult;
1.193 + }
1.194 +
1.195 +
1.196 +/**
1.197 +Test step constructor. It initialises its own name and the input filename
1.198 +*/
1.199 +RTestStepAviPlayCtrlPlayBalance::RTestStepAviPlayCtrlPlayBalance(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.200 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.201 + {
1.202 + }
1.203 +
1.204 +/**
1.205 +Do the test step.This tests setting the PlayBalance on AviPlayController in Stopped, Primed and Playing
1.206 +states and checks if the PlayBalance set is same as the PlayBalance got.
1.207 +*/
1.208 +TVerdict RTestStepAviPlayCtrlPlayBalance::DoTestStepL( void )
1.209 + {
1.210 + TInt errorCode=0;
1.211 + INFO_PRINTF1(_L("this checks if audio is enabled on the sample.avi file"));
1.212 + RMMFVideoPlayControllerCustomCommands thePlayCommander(iController);
1.213 + TBool enabled = EFalse;
1.214 + thePlayCommander.GetAudioEnabled(enabled);
1.215 + if(!enabled)
1.216 + {
1.217 + INFO_PRINTF2(_L("GetAudioEnabled() is failed with %d "), errorCode);
1.218 + return EInconclusive;
1.219 + }
1.220 + INFO_PRINTF1(_L("this step tests SetBalance/GetBalance() APIs of AviPlayController "));
1.221 + RMMFAudioPlayDeviceCustomCommands theAudioDevice( iController );
1.222 + TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
1.223 + errorCode = theAudioDevice.SetBalance(theBalance);
1.224 + if(errorCode)
1.225 + {
1.226 + INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with %d "), errorCode);
1.227 + return EFail;
1.228 + }
1.229 + TInt theNewBalance (0);
1.230 + errorCode =theAudioDevice.GetBalance(theNewBalance);
1.231 + if(errorCode)
1.232 + {
1.233 + INFO_PRINTF2(_L("GetBalance() during Stopped State is failed with %d "), errorCode);
1.234 + return EFail;
1.235 + }
1.236 + if( theNewBalance != theBalance )
1.237 + {
1.238 + INFO_PRINTF1(_L("Set and Get Balances are different during Stopped State"));
1.239 + return EFail;
1.240 + }
1.241 + errorCode = iController.Prime();
1.242 + if(errorCode)
1.243 + {
1.244 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.245 + return EInconclusive;
1.246 + }
1.247 + errorCode = theAudioDevice.SetBalance( theBalance );
1.248 + if(errorCode)
1.249 + {
1.250 + INFO_PRINTF2(_L("SetBalance() during Primed State is failed with %d "), errorCode);
1.251 + return EFail;
1.252 + }
1.253 + errorCode =theAudioDevice.GetBalance( theNewBalance );
1.254 + if(errorCode)
1.255 + {
1.256 + INFO_PRINTF2(_L("GetBalance() during Primed State is failed with %d "), errorCode);
1.257 + return EFail;
1.258 + }
1.259 + if( theNewBalance != theBalance )
1.260 + {
1.261 + INFO_PRINTF1(_L("Set and Get Balances are different during Primed State"));
1.262 + return EFail;
1.263 + }
1.264 + errorCode = iController.Play();
1.265 + if(errorCode)
1.266 + {
1.267 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.268 + return EInconclusive;
1.269 + }
1.270 + errorCode =theAudioDevice.SetBalance(theBalance);
1.271 + if(errorCode)
1.272 + {
1.273 + INFO_PRINTF2(_L("SetBalance() during Playing State is failed with %d "), errorCode);
1.274 + iController.Stop();
1.275 + return EFail;
1.276 + }
1.277 + errorCode =theAudioDevice.GetBalance(theNewBalance);
1.278 + if(errorCode)
1.279 + {
1.280 + INFO_PRINTF2(_L("GetBalance() during Playing State is failed with %d "), errorCode);
1.281 + iController.Stop();
1.282 + return EFail;
1.283 + }
1.284 + if(theNewBalance != theBalance)
1.285 + {
1.286 + //stop the controller
1.287 + INFO_PRINTF1(_L("Set and Get Balances are different during Playing State"));
1.288 + iController.Stop();
1.289 + return EFail;
1.290 + }
1.291 + //get the play completion event
1.292 + CActiveScheduler::Start();
1.293 + return iTestStepResult;
1.294 + }
1.295 +
1.296 +/**
1.297 +Test step constructor. It initialises its own name and the input filename
1.298 +*/
1.299 +RTestStepAviPlayCtrlDuration::RTestStepAviPlayCtrlDuration(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.300 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.301 + {
1.302 +
1.303 + }
1.304 +
1.305 +/**
1.306 + Do the test step.This tests checks for the duration of the file in Stopped, Primed and Playing states.
1.307 +*/
1.308 +TVerdict RTestStepAviPlayCtrlDuration::DoTestStepL(void)
1.309 + {
1.310 + const TTimeIntervalMicroSeconds KExpectedDuration = 6300000;
1.311 + INFO_PRINTF1(_L("this step checks for duration of the file"));
1.312 + TTimeIntervalMicroSeconds expectedDuration(KExpectedDuration);
1.313 + TTimeIntervalMicroSeconds currentDuration;
1.314 + TInt errorCode = iController.GetDuration(currentDuration);
1.315 + if(errorCode)
1.316 + {
1.317 + INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
1.318 + return EFail;
1.319 + }
1.320 + else if(currentDuration != expectedDuration)
1.321 + {
1.322 + INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), currentDuration. Int64());
1.323 + return EFail;
1.324 + }
1.325 + errorCode = iController.Prime();
1.326 + if(errorCode)
1.327 + {
1.328 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.329 + return EInconclusive;
1.330 + }
1.331 + errorCode = iController.GetDuration(currentDuration);
1.332 + if(errorCode)
1.333 + {
1.334 + INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
1.335 + return EFail;
1.336 + }
1.337 + else if(currentDuration != expectedDuration)
1.338 + {
1.339 + INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), currentDuration. Int64());
1.340 + return EFail;
1.341 + }
1.342 + errorCode = iController.Play();
1.343 + if(errorCode)
1.344 + {
1.345 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.346 + return EInconclusive;
1.347 + }
1.348 + errorCode = iController.GetDuration(currentDuration);
1.349 + if(errorCode)
1.350 + {
1.351 + INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
1.352 + iController.Stop();
1.353 + return EFail;
1.354 + }
1.355 + else if(currentDuration != expectedDuration)
1.356 + {
1.357 + INFO_PRINTF2(_L("GetDuration() returned the wrong duration %d "), currentDuration. Int64());
1.358 + iController.Stop();
1.359 + return EFail;
1.360 + }
1.361 + return EPass;
1.362 + }
1.363 +
1.364 +/**
1.365 +Test step constructor. It initialises its own name and the input filename
1.366 +*/
1.367 +RTestStepAviPlayCtrlPause::RTestStepAviPlayCtrlPause(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.368 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.369 + {
1.370 +
1.371 + }
1.372 +
1.373 +/**
1.374 +Do the test step. This tests the Pause functionality of the AviPlayController in Stopped, Primed and Playing
1.375 +states and checks if it returns KErrNot Supported.
1.376 +*/
1.377 +TVerdict RTestStepAviPlayCtrlPause::DoTestStepL(void)
1.378 + {
1.379 + INFO_PRINTF1(_L("this step tests Pause() API of AviPlayController "));
1.380 + TInt errorCode = iController.Pause();
1.381 + if(errorCode != KErrNotSupported)
1.382 + {
1.383 + INFO_PRINTF2(_L("Pause() during Stopped State is failed to return KErrNotSupported but returned %d "), errorCode);
1.384 + return EFail;
1.385 + }
1.386 + errorCode = iController.Prime();
1.387 + if(errorCode)
1.388 + {
1.389 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.390 + return EInconclusive;
1.391 + }
1.392 + errorCode = iController.Pause();
1.393 + if(errorCode != KErrNotSupported)
1.394 + {
1.395 + INFO_PRINTF2(_L("Pause() during Primed State is failed to return KErrNotSupported but returned %d "), errorCode);
1.396 + return EFail;
1.397 + }
1.398 + errorCode = iController.Play();
1.399 + if(errorCode)
1.400 + {
1.401 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.402 + return EInconclusive;
1.403 + }
1.404 + errorCode = iController.Pause();
1.405 + if(errorCode != KErrNotSupported)
1.406 + {
1.407 + INFO_PRINTF2(_L("Pause() during Playing State is failed with %d "), errorCode);
1.408 + return EFail;
1.409 + }
1.410 + errorCode = iController.Play();
1.411 + if(errorCode != KErrNotReady)
1.412 + {
1.413 + INFO_PRINTF2(_L("Play() after Pause() is failed with %d "), errorCode);
1.414 + return EFail;
1.415 + }
1.416 + //get the play completion event
1.417 + CActiveScheduler::Start();
1.418 + return iTestStepResult;
1.419 + }
1.420 +
1.421 +/**
1.422 +Test step constructor. It initialises its own name and the input filename
1.423 +*/
1.424 +RTestStepAviPlayCtrlStop::RTestStepAviPlayCtrlStop(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.425 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.426 + {
1.427 +
1.428 + }
1.429 +
1.430 +/**
1.431 +Do the test step. This tests the Stop functionality of the AviPlayController in Stopped, Primed and Playing
1.432 +states It expects KErrNotReady error if Stop is called during Stopped state.
1.433 +*/
1.434 +TVerdict RTestStepAviPlayCtrlStop::DoTestStepL(void)
1.435 + {
1.436 + INFO_PRINTF1(_L("this step tests Stop() API of AviPlayController "));
1.437 + TInt errorCode = iController.Stop();
1.438 + if(errorCode)
1.439 + {
1.440 + INFO_PRINTF2(_L("Stop() during Stopped State is failed with %d "), errorCode);
1.441 + return EFail;
1.442 + }
1.443 + errorCode = iController.Prime();
1.444 + if(errorCode)
1.445 + {
1.446 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.447 + return EInconclusive;
1.448 + }
1.449 + errorCode = iController.Stop();
1.450 + if(errorCode)
1.451 + {
1.452 + INFO_PRINTF2(_L("Stop() during Primed State is failed with %d "), errorCode);
1.453 + return EFail;
1.454 + }
1.455 + errorCode = iController.Prime();
1.456 + if(errorCode)
1.457 + {
1.458 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.459 + return EInconclusive;
1.460 + }
1.461 + errorCode = iController.Play();
1.462 + if(errorCode)
1.463 + {
1.464 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.465 + return EInconclusive;
1.466 + }
1.467 + User::After(2000000);
1.468 + errorCode = iController.Stop();
1.469 + if(errorCode)
1.470 + {
1.471 + INFO_PRINTF2(_L("Stop() during Playing State is failed with %d "), errorCode);
1.472 + return EFail;
1.473 + }
1.474 + errorCode = iController.Prime();
1.475 + if(errorCode)
1.476 + {
1.477 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.478 + return EInconclusive;
1.479 + }
1.480 + errorCode = iController.Play();
1.481 + if(errorCode)
1.482 + {
1.483 + INFO_PRINTF2(_L("Play() after Stop() is failed with %d "), errorCode);
1.484 + iController.Stop();
1.485 + return EInconclusive;
1.486 + }
1.487 + //get the play completion event
1.488 + CActiveScheduler::Start();
1.489 + return iTestStepResult;
1.490 + }
1.491 +
1.492 +
1.493 +/**
1.494 +Test step constructor. It initialises its own name and the input filename
1.495 +*/
1.496 +RTestStepAviPlayCtrlSetGetCropRegion::RTestStepAviPlayCtrlSetGetCropRegion(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.497 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.498 + {
1.499 +
1.500 + }
1.501 +
1.502 +/**
1.503 +Do the test step.This test tries to set and get the crop region for the file.
1.504 +*/
1.505 + TVerdict RTestStepAviPlayCtrlSetGetCropRegion::DoTestStepL(void)
1.506 + {
1.507 + INFO_PRINTF1(_L("this step tests GetCropRegion() APIs of AviPlayController"));
1.508 + TRect cropRegion(1,3,5,7);
1.509 + TRect newCropRegion(1,3,5,7);
1.510 + RMMFVideoPlayControllerCustomCommands thePlayCommander(iController);
1.511 + TInt errorCode =thePlayCommander.SetCropRegion(cropRegion);
1.512 + if(errorCode != KErrNotSupported)
1.513 + {
1.514 + INFO_PRINTF2(_L("SetCropRegion() during Stopped State is failed with %d "), errorCode);
1.515 + return EFail;
1.516 + }
1.517 + errorCode =thePlayCommander.GetCropRegion(newCropRegion);
1.518 + if(errorCode != KErrNotSupported)
1.519 + {
1.520 + INFO_PRINTF2(_L("GetCropRegion() during Stopped State is failed with %d "), errorCode);
1.521 + return EFail;
1.522 + }
1.523 + errorCode = iController.Prime();
1.524 + if(errorCode)
1.525 + {
1.526 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.527 + return EInconclusive;
1.528 + }
1.529 + errorCode =thePlayCommander.SetCropRegion(cropRegion);
1.530 + if(errorCode != KErrNotSupported)
1.531 + {
1.532 + INFO_PRINTF2(_L("SetCropRegion() during primed State is failed with %d "), errorCode);
1.533 + return EFail;
1.534 + }
1.535 + errorCode =thePlayCommander.GetCropRegion(newCropRegion);
1.536 + if(errorCode != KErrNotSupported)
1.537 + {
1.538 + INFO_PRINTF2(_L("GetCropRegion() during primed State is failed with %d "), errorCode);
1.539 + return EFail;
1.540 + }
1.541 + errorCode = iController.Play();
1.542 + if(errorCode)
1.543 + {
1.544 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.545 + return EInconclusive;
1.546 + }
1.547 + errorCode =thePlayCommander.SetCropRegion(cropRegion);
1.548 + if(errorCode != KErrNotSupported)
1.549 + {
1.550 + INFO_PRINTF2(_L("SetCropRegion() during play State is failed with %d "), errorCode);
1.551 + iController.Stop();
1.552 + return EFail;
1.553 + }
1.554 + errorCode =thePlayCommander.GetCropRegion(newCropRegion);
1.555 + if(errorCode != KErrNotSupported)
1.556 + {
1.557 + INFO_PRINTF2(_L("GetCropRegion() during play State is failed with %d "), errorCode);
1.558 + iController.Stop();
1.559 + return EFail;
1.560 + }
1.561 + CActiveScheduler::Start();
1.562 + return EPass;
1.563 + }
1.564 +
1.565 +/**
1.566 +Test step constructor. It initialises its own name and the input filename
1.567 +*/
1.568 +RTestStepAviPlayCtrlSetGetFrameRate::RTestStepAviPlayCtrlSetGetFrameRate(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.569 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.570 + {
1.571 +
1.572 + }
1.573 +
1.574 +/**
1.575 +Do the test step.This test tries to set and get the framerate for the file
1.576 +*/
1.577 +TVerdict RTestStepAviPlayCtrlSetGetFrameRate::DoTestStepL(void)
1.578 + {
1.579 + INFO_PRINTF1(_L("this step tests SetFrameRate/GetFrameRate() APIs of AviPlayController"));
1.580 + TInt KFrameRate = 10;
1.581 + TReal32 frameRate(KFrameRate);
1.582 + TReal32 expectedFrameRate(KFrameRate) ;
1.583 + RMMFVideoControllerCustomCommands theVideoCommander(iController);
1.584 + TInt errorCode =theVideoCommander.SetFrameRate(frameRate);
1.585 + if(errorCode != KErrNotSupported)
1.586 + {
1.587 + INFO_PRINTF2(_L("SetFrameRate() during Stopped State is failed with %d "), errorCode);
1.588 + return EFail;
1.589 + }
1.590 + errorCode =theVideoCommander.GetFrameRate(expectedFrameRate);
1.591 + if(errorCode)
1.592 + {
1.593 + INFO_PRINTF2(_L("GetFrameRate() during Stopped State is failed with %d "), errorCode);
1.594 + return EFail;
1.595 + }
1.596 + if(expectedFrameRate != KFrameRate)
1.597 + {
1.598 + INFO_PRINTF1(_L("Set and Get Framerates are different during Stopped State"));
1.599 + return EFail;
1.600 + }
1.601 + errorCode = iController.Prime();
1.602 + if(errorCode)
1.603 + {
1.604 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.605 + return EInconclusive;
1.606 + }
1.607 + errorCode =theVideoCommander.SetFrameRate(frameRate);
1.608 + if(errorCode != KErrNotSupported)
1.609 + {
1.610 + INFO_PRINTF2(_L("SetFrameRate() during Primed State is failed with %d "), errorCode);
1.611 + return EFail;
1.612 + }
1.613 + errorCode =theVideoCommander.GetFrameRate(expectedFrameRate);
1.614 + if(errorCode)
1.615 + {
1.616 + INFO_PRINTF2(_L("GetFrameRate() during Primed State is failed with %d "), errorCode);
1.617 + return EFail;
1.618 + }
1.619 + if(expectedFrameRate != KFrameRate)
1.620 + {
1.621 + INFO_PRINTF1(_L("Set and Get Framerates are different during Primed State"));
1.622 + return EFail;
1.623 + }
1.624 + errorCode = iController.Play();
1.625 + if(errorCode)
1.626 + {
1.627 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.628 + iController.Stop();
1.629 + return EInconclusive;
1.630 + }
1.631 + //try getting framerate inPlaying State
1.632 + errorCode =theVideoCommander.SetFrameRate(frameRate);
1.633 + if(errorCode != KErrNotSupported)
1.634 + {
1.635 + INFO_PRINTF2(_L("SetFrameRate() during Playing State is failed with %d "), errorCode);
1.636 + iController.Stop();
1.637 + return EFail;
1.638 + }
1.639 + errorCode =theVideoCommander.GetFrameRate(expectedFrameRate);
1.640 + if(errorCode)
1.641 + {
1.642 + INFO_PRINTF2(_L("GetFrameRate() during Playing State is failed with %d "), errorCode);
1.643 + iController.Stop();
1.644 + return EFail;
1.645 + }
1.646 + if(expectedFrameRate != KFrameRate)
1.647 + {
1.648 + INFO_PRINTF1(_L("Set and Get Framerates are different during Playing State"));
1.649 + return EFail;
1.650 + }
1.651 + CActiveScheduler::Start();
1.652 + return EPass;
1.653 + }
1.654 +
1.655 +
1.656 +/**
1.657 +Test step constructor. It initialises its own name and the input filename
1.658 +*/
1.659 +RTestStepAviPlayCtrlGetFrameSize::RTestStepAviPlayCtrlGetFrameSize(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.660 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.661 + {
1.662 +
1.663 + }
1.664 +
1.665 +/**
1.666 +Do the test step.This test tries to get the framesize from the file.
1.667 +*/
1.668 +TVerdict RTestStepAviPlayCtrlGetFrameSize::DoTestStepL(void)
1.669 + {
1.670 + INFO_PRINTF1(_L("this step tests GetFrameSize() APIs of AviPlayController"));
1.671 + TSize frameSize(0,0);
1.672 + TSize expectedFrameSize(176,144);
1.673 + RMMFVideoControllerCustomCommands theVideoCommander(iController);
1.674 + TInt errorCode =theVideoCommander.GetVideoFrameSize(frameSize);
1.675 + if(errorCode)
1.676 + {
1.677 + INFO_PRINTF2(_L("GetFrameSize() during Stopped State is failed with %d "), errorCode);
1.678 + return EFail;
1.679 + }
1.680 + if(frameSize != expectedFrameSize)
1.681 + {
1.682 + INFO_PRINTF1(_L("Frame sizes are different during Stopped states"));
1.683 + return EFail;
1.684 + }
1.685 + errorCode = iController.Prime();
1.686 + if(errorCode)
1.687 + {
1.688 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.689 + return EInconclusive;
1.690 + }
1.691 + errorCode =theVideoCommander.GetVideoFrameSize(frameSize);
1.692 + if(errorCode)
1.693 + {
1.694 + INFO_PRINTF2(_L("GetFrameSize() during primed State is failed with %d "), errorCode);
1.695 + return EFail;
1.696 + }
1.697 + if( frameSize != expectedFrameSize )
1.698 + {
1.699 + INFO_PRINTF1(_L("Frame sizes are different during Primed state"));
1.700 + return EFail;
1.701 + }
1.702 + errorCode = iController.Play();
1.703 + if(errorCode)
1.704 + {
1.705 + INFO_PRINTF2(_L("Play is failed with %d "), errorCode);
1.706 + iController.Stop();
1.707 + return EInconclusive;
1.708 + }
1.709 + errorCode =theVideoCommander.GetVideoFrameSize(frameSize);
1.710 + if(errorCode)
1.711 + {
1.712 + INFO_PRINTF2(_L("GetFrameSize() during play State is failed with %d "), errorCode);
1.713 + iController.Stop();
1.714 + return EFail;
1.715 + }
1.716 + if( frameSize != expectedFrameSize )
1.717 + {
1.718 + INFO_PRINTF1(_L("Frame sizes are different during play state"));
1.719 + iController.Stop();
1.720 + return EFail;
1.721 + }
1.722 + //get the play completion event
1.723 + CActiveScheduler::Start();
1.724 + return EPass;
1.725 + }
1.726 +
1.727 +
1.728 +/**
1.729 +Test step constructor. It initialises its own name and the input filename
1.730 +*/
1.731 +RTestStepAviPlayCtrlGetAudioDataType::RTestStepAviPlayCtrlGetAudioDataType(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.732 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.733 + {
1.734 +
1.735 + }
1.736 +
1.737 +/**
1.738 +Do the test step.This test tries to get the audio data type from the avi file.
1.739 +*/
1.740 + TVerdict RTestStepAviPlayCtrlGetAudioDataType::DoTestStepL()
1.741 + {
1.742 + INFO_PRINTF1(_L("this step tests GetAudioType() and GetAudioBitRate() APIs of AviPlayController"));
1.743 + TFourCC audioCodec;
1.744 + TFourCC expectedAudioCodec(KMMFFourCCCodePCM16);
1.745 + TInt errorCode = 0;
1.746 + TInt bitRate = 705600;
1.747 + TInt newBitRate =0;
1.748 + RMMFVideoPlayControllerCustomCommands thePlayCommander(iController);
1.749 + TBool enabled(EFalse);
1.750 + thePlayCommander.GetAudioEnabled(enabled);
1.751 + if(!enabled)
1.752 + {
1.753 + INFO_PRINTF2(_L("GetAudioEnabled() is failed with %d "), errorCode);
1.754 + return EInconclusive;
1.755 + }
1.756 + RMMFVideoControllerCustomCommands theCommander(iController);
1.757 + errorCode =theCommander.GetAudioCodec(audioCodec);
1.758 + if(errorCode)
1.759 + {
1.760 + INFO_PRINTF2(_L("GetAudioCodec() during Stopped State is failed with %d "), errorCode);
1.761 + return EFail;
1.762 + }
1.763 + if( audioCodec != expectedAudioCodec )
1.764 + {
1.765 + INFO_PRINTF1(_L("Wrong audio codec was returned"));
1.766 + return EFail;
1.767 + }
1.768 + errorCode = theCommander.GetAudioBitRate(newBitRate);
1.769 + if(errorCode)
1.770 + {
1.771 + INFO_PRINTF2(_L("GetAudioBitRate() during Stopped State is failed with %d "), errorCode);
1.772 + return EFail;
1.773 + }
1.774 + if(newBitRate != bitRate )
1.775 + {
1.776 + INFO_PRINTF1(_L("Wrong audio bitrate was returned"));
1.777 + return EFail;
1.778 + }
1.779 + errorCode = iController.Prime();
1.780 + if(errorCode)
1.781 + {
1.782 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.783 + return EInconclusive;
1.784 + }
1.785 + //Check for audio codec
1.786 + errorCode =theCommander.GetAudioCodec(audioCodec);
1.787 + if(errorCode)
1.788 + {
1.789 + INFO_PRINTF2(_L("GetAudioCodec() during primed State is failed with %d "), errorCode);
1.790 + return EFail;
1.791 + }
1.792 + if( audioCodec != expectedAudioCodec )
1.793 + {
1.794 + INFO_PRINTF1(_L("Wrong audio codec was returned"));
1.795 + return EFail;
1.796 + }
1.797 + errorCode = theCommander.GetAudioBitRate(newBitRate);
1.798 + if(errorCode)
1.799 + {
1.800 + INFO_PRINTF2(_L("GetAudioBitRate() during primed State is failed with %d "), errorCode);
1.801 + return EFail;
1.802 + }
1.803 + if(newBitRate != bitRate )
1.804 + {
1.805 + INFO_PRINTF1(_L("Wrong audio bitrate was returned"));
1.806 + return EFail;
1.807 + }
1.808 + errorCode = iController.Play();
1.809 + //Check for audio codec
1.810 + errorCode =theCommander.GetAudioCodec(audioCodec);
1.811 + if(errorCode)
1.812 + {
1.813 + INFO_PRINTF2(_L("GetAudioCodec() during play State is failed with %d "), errorCode);
1.814 + iController.Stop();
1.815 + return EFail;
1.816 + }
1.817 + if( audioCodec != expectedAudioCodec )
1.818 + {
1.819 + INFO_PRINTF1(_L("Wrong audio codec was returned"));
1.820 + iController.Stop();
1.821 + return EFail;
1.822 + }
1.823 + errorCode = theCommander.GetAudioBitRate(newBitRate);
1.824 + if(errorCode)
1.825 + {
1.826 + INFO_PRINTF2(_L("GetAudioBitRate() during play State is failed with %d "), errorCode);
1.827 + iController.Stop();
1.828 + return EFail;
1.829 + }
1.830 + if(newBitRate != bitRate )
1.831 + {
1.832 + INFO_PRINTF1(_L("Wrong audio bitrate was returned"));
1.833 + iController.Stop();
1.834 + return EFail;
1.835 + }
1.836 + CActiveScheduler::Start();
1.837 + return EPass;
1.838 + }
1.839 +
1.840 +
1.841 +/**
1.842 +Test step constructor. It initialises its own name and the input filename
1.843 +*/
1.844 +RTestStepAviPlayCtrlGetVideoDataType::RTestStepAviPlayCtrlGetVideoDataType(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.845 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.846 + {
1.847 +
1.848 + }
1.849 +/**
1.850 +Do the test step.This test tries to get the video mime type
1.851 +*/
1.852 +TVerdict RTestStepAviPlayCtrlGetVideoDataType::DoTestStepL(void)
1.853 + {
1.854 + const TInt KBufferSize = 256;
1.855 + INFO_PRINTF1(_L("this step tests GetVideoMimeType() APIs of AviPlayController"));
1.856 + HBufC8* iMimeType = HBufC8::NewL(KBufferSize);
1.857 + TPtr8 des = iMimeType->Des();
1.858 + TInt errorCode = 0;
1.859 + char xv[]="XVID";
1.860 + TUint8* p = (TUint8*)xv;
1.861 + TPtrC8 temp(p);
1.862 + RMMFVideoControllerCustomCommands theCommander(iController);
1.863 + errorCode =theCommander.GetVideoMimeType(des);
1.864 + if(errorCode)
1.865 + {
1.866 + INFO_PRINTF2(_L("GetVideoMimeType() during Stopped State is failed with %d "), errorCode);
1.867 + return EFail;
1.868 + }
1.869 + if (des.Compare(temp))
1.870 + {
1.871 + INFO_PRINTF1(_L("Wrong video mime type returned"));
1.872 + return EFail;
1.873 + }
1.874 + else
1.875 + {
1.876 + INFO_PRINTF1(_L("Correct video mime type returned"));
1.877 + }
1.878 + errorCode = iController.Prime();
1.879 + if(errorCode)
1.880 + {
1.881 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.882 + return EInconclusive;
1.883 + }
1.884 + errorCode =theCommander.GetVideoMimeType(des);
1.885 + if(errorCode)
1.886 + {
1.887 + INFO_PRINTF2(_L("GetVideoMimeType() during primed State is failed with %d "), errorCode);
1.888 + return EFail;
1.889 + }
1.890 + if (des.Compare(temp))
1.891 + {
1.892 + INFO_PRINTF1(_L("Wrong video mime type returned"));
1.893 + return EFail;
1.894 + }
1.895 + else
1.896 + {
1.897 + INFO_PRINTF1(_L("Correct video mime type returned"));
1.898 + }
1.899 +
1.900 + errorCode = iController.Play();
1.901 + if(errorCode)
1.902 + {
1.903 + INFO_PRINTF2(_L("Play is failed with %d "), errorCode);
1.904 + return EInconclusive;
1.905 + }
1.906 + errorCode =theCommander.GetVideoMimeType(des);
1.907 + if(errorCode)
1.908 + {
1.909 + INFO_PRINTF2(_L("GetVideoMimeType() during play State is failed with %d "), errorCode);
1.910 + return EFail;
1.911 + }
1.912 + if (des.Compare(temp))
1.913 + {
1.914 + INFO_PRINTF1(_L("Wrong video mime type returned"));
1.915 + return EFail;
1.916 + }
1.917 + else
1.918 + {
1.919 + INFO_PRINTF1(_L("Correct video mime type returned"));
1.920 + }
1.921 + CActiveScheduler::Start();
1.922 + return EPass;
1.923 + }
1.924 +
1.925 +
1.926 +/**
1.927 +Test step constructor. It initialises its own name and the input filename
1.928 +*/
1.929 +RTestStepAviPlayCtrlMetaData::RTestStepAviPlayCtrlMetaData(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.930 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.931 + {
1.932 +
1.933 + }
1.934 +
1.935 +/**
1.936 +Do the test step.This test tries to fetch the metadata from the avi file.
1.937 +*/
1.938 +TVerdict RTestStepAviPlayCtrlMetaData::DoTestStepL(void)
1.939 + {
1.940 + INFO_PRINTF1(_L("this step tests GetNumberOfMetaDataEntries/GetMetaDataEntryL() APIs of AviPlayController "));
1.941 + TInt numEntries = 0;
1.942 + TInt errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
1.943 + CMMFMetaDataEntry* metaEntry = NULL;
1.944 + if(errorCode != KErrNotSupported)
1.945 + {
1.946 + INFO_PRINTF2(_L("GetNumberOfMetaDataEntries() is failed with %d "), errorCode);
1.947 + return EFail;
1.948 + }
1.949 + if(numEntries == 0)
1.950 + {
1.951 + INFO_PRINTF1(_L("File does not have meta entries "));
1.952 + }
1.953 + else
1.954 + {
1.955 + for(TInt counter = 0; counter < numEntries; ++counter)
1.956 + {
1.957 + TRAP(errorCode, metaEntry = iController.GetMetaDataEntryL(counter));
1.958 + if(errorCode)
1.959 + {
1.960 + INFO_PRINTF2(_L("GetMetaDataEntryL is failed with %d "), errorCode);
1.961 + return EFail;
1.962 + }
1.963 + INFO_PRINTF3(_L("%S %S"), &metaEntry->Name(), &metaEntry->Value());
1.964 + }
1.965 + }
1.966 + return EPass;
1.967 + }
1.968 +
1.969 +/**
1.970 +Test step constructor. It initialises its own name and the input filename
1.971 +*/
1.972 +RTestStepAviPlayCtrlSetGetRotation::RTestStepAviPlayCtrlSetGetRotation(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.973 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.974 + {
1.975 +
1.976 + }
1.977 +
1.978 +/**
1.979 +Do the test step.This test tries to set and get the rotation
1.980 +*/
1.981 +TVerdict RTestStepAviPlayCtrlSetGetRotation::DoTestStepL(void)
1.982 + {
1.983 + INFO_PRINTF1(_L("this step tests SetRotation/GetRotation() APIs of AviPlayController"));
1.984 + TVideoRotation aRotation;
1.985 + RMMFVideoPlayControllerCustomCommands theVideoPlayCommander(iController);
1.986 + TInt errorCode = theVideoPlayCommander.SetRotation(EVideoRotationClockwise90);
1.987 + if(errorCode != KErrNotSupported)
1.988 + {
1.989 + INFO_PRINTF2(_L("SetRotation() during Stopped State is failed with %d "), errorCode);
1.990 + return EFail;
1.991 + }
1.992 + errorCode =theVideoPlayCommander.GetRotation(aRotation);
1.993 + if(errorCode != KErrNotSupported)
1.994 + {
1.995 + INFO_PRINTF2(_L("GetRotation() during Stopped State is failed with %d "), errorCode);
1.996 + return EFail;
1.997 + }
1.998 + errorCode = iController.Prime();
1.999 + if(errorCode)
1.1000 + {
1.1001 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1002 + return EInconclusive;
1.1003 + }
1.1004 + errorCode =theVideoPlayCommander.SetRotation(EVideoRotationClockwise90);
1.1005 + if(errorCode != KErrNotSupported)
1.1006 + {
1.1007 + INFO_PRINTF2(_L("SetRotation() during Primed State is failed with %d "), errorCode);
1.1008 + return EFail;
1.1009 + }
1.1010 + errorCode =theVideoPlayCommander.GetRotation(aRotation);
1.1011 + if(errorCode != KErrNotSupported)
1.1012 + {
1.1013 + INFO_PRINTF2(_L("GetRotation() during Primed State is failed with %d "), errorCode);
1.1014 + return EFail;
1.1015 + }
1.1016 + errorCode = iController.Play();
1.1017 + if(errorCode)
1.1018 + {
1.1019 + INFO_PRINTF2(_L("Play is failed with %d "), errorCode);
1.1020 + return EInconclusive;
1.1021 + }
1.1022 + errorCode =theVideoPlayCommander.SetRotation(EVideoRotationClockwise90);
1.1023 + if(errorCode != KErrNotSupported)
1.1024 + {
1.1025 + INFO_PRINTF2(_L("SetRotation() during Play State is failed with %d "), errorCode);
1.1026 + return EFail;
1.1027 + }
1.1028 + errorCode =theVideoPlayCommander.GetRotation(aRotation);
1.1029 + if(errorCode != KErrNotSupported)
1.1030 + {
1.1031 + INFO_PRINTF2(_L("GetRotation() during Play State is failed with %d "), errorCode);
1.1032 + iController.Stop();
1.1033 + return EFail;
1.1034 + }
1.1035 + CActiveScheduler::Start();
1.1036 + return EPass;
1.1037 + }
1.1038 +
1.1039 +/**
1.1040 +Test step constructor. It initialises its own name and the input filename
1.1041 +*/
1.1042 +RTestStepAviPlayCtrlSetGetScaling::RTestStepAviPlayCtrlSetGetScaling(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1043 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1044 + {
1.1045 +
1.1046 + }
1.1047 +
1.1048 +/**
1.1049 +* Do the test step.This test tries to do the scaling and expect KErrNotsupported
1.1050 +*/
1.1051 +TVerdict RTestStepAviPlayCtrlSetGetScaling::DoTestStepL(void)
1.1052 + {
1.1053 + INFO_PRINTF1(_L("this step tests SetScaling/GetScaling() APIs of AviPlayController"));
1.1054 + TReal32 aWidthPercentage = .75;
1.1055 + TReal32 aHeightPercentage = .3;
1.1056 + TBool aAntiAliasFiltering = EFalse;
1.1057 +
1.1058 + RMMFVideoPlayControllerCustomCommands theVideoPlayCommander(iController);
1.1059 + TInt errorCode = theVideoPlayCommander.SetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering);
1.1060 + if(errorCode != KErrNotSupported)
1.1061 + {
1.1062 + INFO_PRINTF2(_L("SetScaleFactor() during Stopped State is failed with %d "), errorCode);
1.1063 + return EFail;
1.1064 + }
1.1065 + errorCode =theVideoPlayCommander.GetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering);
1.1066 + if(errorCode != KErrNotSupported)
1.1067 + {
1.1068 + INFO_PRINTF2(_L("GetScaleFactor() during Stopped State is failed with %d "), errorCode);
1.1069 + return EFail;
1.1070 + }
1.1071 + errorCode = iController.Prime();
1.1072 + if(errorCode)
1.1073 + {
1.1074 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1075 + return EInconclusive;
1.1076 + }
1.1077 + errorCode = theVideoPlayCommander.SetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering);
1.1078 + if(errorCode != KErrNotSupported)
1.1079 + {
1.1080 + INFO_PRINTF2(_L("SetScaleFactor() during primed State is failed with %d "), errorCode);
1.1081 + return EFail;
1.1082 + }
1.1083 + errorCode =theVideoPlayCommander.GetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering);
1.1084 + if(errorCode != KErrNotSupported)
1.1085 + {
1.1086 + INFO_PRINTF2(_L("GetScaleFactor() during primed State is failed with %d "), errorCode);
1.1087 + return EFail;
1.1088 + }
1.1089 + errorCode = iController.Play();
1.1090 + if(errorCode)
1.1091 + {
1.1092 + INFO_PRINTF2(_L("Play is failed with %d "), errorCode);
1.1093 + return EInconclusive;
1.1094 + }
1.1095 + errorCode = theVideoPlayCommander.SetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering);
1.1096 + if(errorCode != KErrNotSupported)
1.1097 + {
1.1098 + INFO_PRINTF2(_L("SetScaleFactor() during play State is failed with %d "), errorCode);
1.1099 + return EFail;
1.1100 + }
1.1101 + errorCode =theVideoPlayCommander.GetScaleFactor(aWidthPercentage,aHeightPercentage,aAntiAliasFiltering);
1.1102 + if(errorCode != KErrNotSupported)
1.1103 + {
1.1104 + INFO_PRINTF2(_L("GetScaleFactor() during play State is failed with %d "), errorCode);
1.1105 + iController.Stop();
1.1106 + return EFail;
1.1107 + }
1.1108 + CActiveScheduler::Start();
1.1109 + return EPass;
1.1110 + }
1.1111 +
1.1112 +/**
1.1113 +Test step constructor. It initialises its own name and the input filename
1.1114 +*/
1.1115 +RTestStepAviPlayCtrlSetPosition::RTestStepAviPlayCtrlSetPosition(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1116 + :RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1117 + {
1.1118 +
1.1119 + }
1.1120 +
1.1121 +/**
1.1122 + Do the test step.This test tries to set the position in the file and expect KErrNotSupported
1.1123 + */
1.1124 +TVerdict RTestStepAviPlayCtrlSetPosition::DoTestStepL(void)
1.1125 + {
1.1126 + INFO_PRINTF1(_L("this step tests SetPosition() APIs of AviPlayController"));
1.1127 + TTimeIntervalMicroSeconds aPosition;
1.1128 + TInt errorCode = KErrNone;
1.1129 + errorCode = iController.SetPosition(aPosition);
1.1130 + if(errorCode != KErrNotSupported)
1.1131 + {
1.1132 + INFO_PRINTF2(_L("SetPosition() during Stopped State is failed with %d "), errorCode);
1.1133 + return EFail;
1.1134 + }
1.1135 + errorCode = iController.Prime();
1.1136 + if(errorCode)
1.1137 + {
1.1138 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1139 + return EInconclusive;
1.1140 + }
1.1141 + errorCode = iController.SetPosition(aPosition);
1.1142 + if(errorCode != KErrNotSupported)
1.1143 + {
1.1144 + INFO_PRINTF2(_L("SetPosition() during Primed State is failed with %d "), errorCode);
1.1145 + return EFail;
1.1146 + }
1.1147 + errorCode = iController.Play();
1.1148 + if(errorCode)
1.1149 + {
1.1150 + INFO_PRINTF2(_L("Play is failed with %d "), errorCode);
1.1151 + return EInconclusive;
1.1152 + }
1.1153 + errorCode = iController.SetPosition(aPosition);
1.1154 + if(errorCode != KErrNotSupported)
1.1155 + {
1.1156 + INFO_PRINTF2(_L("SetPosition() during Playing State is failed with %d "), errorCode);
1.1157 + iController.Stop();
1.1158 + return EFail;
1.1159 + }
1.1160 + CActiveScheduler::Start();
1.1161 + return EPass;
1.1162 + }
1.1163 +
1.1164 +
1.1165 +/**
1.1166 +Test step constructor. It initialises its own name and the input filename
1.1167 +*/
1.1168 +RTestStepAviPlayCtrlGetVideoBitrate::RTestStepAviPlayCtrlGetVideoBitrate(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1169 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1170 + {
1.1171 +
1.1172 + }
1.1173 +
1.1174 +/**
1.1175 +Do the test step.This test tries to get the bitrate from the file
1.1176 +*/
1.1177 +TVerdict RTestStepAviPlayCtrlGetVideoBitrate::DoTestStepL(void)
1.1178 + {
1.1179 + INFO_PRINTF1(_L("this step tests GetVideoBitrate() APIs of AviPlayController"));
1.1180 + TInt aBitRate;
1.1181 + RMMFVideoControllerCustomCommands theVideoCommander(iController);
1.1182 + TInt errorCode =theVideoCommander.GetVideoBitRate(aBitRate);
1.1183 + if(errorCode != KErrNotSupported)
1.1184 + {
1.1185 + INFO_PRINTF2(_L("GetVideoBitRate() during Stopped State is failed with %d "), errorCode);
1.1186 + return EFail;
1.1187 + }
1.1188 + else
1.1189 + {
1.1190 + INFO_PRINTF2(_L("GetVideoBitRate() during Stopped State returned KErrNotSupported %d "), errorCode);
1.1191 + }
1.1192 + errorCode = iController.Prime();
1.1193 + if(errorCode)
1.1194 + {
1.1195 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1196 + return EInconclusive;
1.1197 + }
1.1198 + errorCode =theVideoCommander.GetVideoBitRate(aBitRate);
1.1199 + if(errorCode != KErrNotSupported)
1.1200 + {
1.1201 + INFO_PRINTF2(_L("GetVideoBitRate() during Primed State is failed with %d "), errorCode);
1.1202 + return EFail;
1.1203 + }
1.1204 + else
1.1205 + {
1.1206 + INFO_PRINTF2(_L("GetVideoBitRate() during Primed State returned KErrNotSupported %d "), errorCode);
1.1207 + }
1.1208 + errorCode = iController.Play();
1.1209 + if(errorCode)
1.1210 + {
1.1211 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.1212 + iController.Stop();
1.1213 + return EInconclusive;
1.1214 + }
1.1215 + errorCode =theVideoCommander.GetVideoBitRate(aBitRate);
1.1216 + if(errorCode != KErrNotSupported)
1.1217 + {
1.1218 + INFO_PRINTF2(_L("GetVideoBitRate() during Playing State is failed with %d "), errorCode);
1.1219 + iController.Stop();
1.1220 + return EFail;
1.1221 + }
1.1222 + else
1.1223 + {
1.1224 + INFO_PRINTF2(_L("GetVideoBitRate() during Play State returned KErrNotSupported %d "), errorCode);
1.1225 + }
1.1226 + CActiveScheduler::Start();
1.1227 + return EPass;
1.1228 + }
1.1229 +
1.1230 +/**
1.1231 +Test step constructor. It initialises its own name and the input filename
1.1232 +*/
1.1233 +RTestStepAviPlayCtrlGetAudioBitrate::RTestStepAviPlayCtrlGetAudioBitrate(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1234 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1235 + {
1.1236 +
1.1237 + }
1.1238 +
1.1239 +/**
1.1240 +Do the test step.This test tries to fetch the audio bit rate.
1.1241 +*/
1.1242 +TVerdict RTestStepAviPlayCtrlGetAudioBitrate::DoTestStepL(void)
1.1243 + {
1.1244 + INFO_PRINTF1(_L("this step tests GetAudioBitrate() APIs of AviPlayController"));
1.1245 + TInt audioBitRate;
1.1246 + RMMFVideoControllerCustomCommands theVideoCommander(iController);
1.1247 + TInt errorCode =theVideoCommander.GetAudioBitRate(audioBitRate);
1.1248 + if(errorCode != KErrNotSupported)
1.1249 + {
1.1250 + INFO_PRINTF2(_L("GetAudioBitRate() during Stopped State is failed with %d "), errorCode);
1.1251 + return EFail;
1.1252 + }
1.1253 + else
1.1254 + {
1.1255 + INFO_PRINTF2(_L("GetAudioBitRate() during Stopped State returned KErrNotSupported %d "), errorCode);
1.1256 + }
1.1257 + errorCode = iController.Prime();
1.1258 + if(errorCode)
1.1259 + {
1.1260 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1261 + return EInconclusive;
1.1262 + }
1.1263 + else
1.1264 + {
1.1265 + INFO_PRINTF2(_L("GetAudioBitRate() during Primed State returned KErrNotSupported %d "), errorCode);
1.1266 + }
1.1267 + errorCode =theVideoCommander.GetAudioBitRate(audioBitRate);
1.1268 + if(errorCode != KErrNotSupported)
1.1269 + {
1.1270 + INFO_PRINTF2(_L("GetAudioBitRate() during Primed State is failed with %d "), errorCode);
1.1271 + return EFail;
1.1272 + }
1.1273 + errorCode = iController.Play();
1.1274 + if(errorCode)
1.1275 + {
1.1276 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.1277 + iController.Stop();
1.1278 + return EInconclusive;
1.1279 + }
1.1280 + //try getting framerate inPlaying State
1.1281 + errorCode =theVideoCommander.GetAudioBitRate(audioBitRate);
1.1282 + if(errorCode != KErrNotSupported)
1.1283 + {
1.1284 + INFO_PRINTF2(_L("GetAudioBitRate() during Playing State is failed with %d "), errorCode);
1.1285 + iController.Stop();
1.1286 + return EFail;
1.1287 + }
1.1288 + else
1.1289 + {
1.1290 + INFO_PRINTF2(_L("GetAudioBitRate() during Playing State returned KErrNotSupported %d "), errorCode);
1.1291 + }
1.1292 + CActiveScheduler::Start();
1.1293 + return EPass;
1.1294 + }
1.1295 +
1.1296 +/**
1.1297 +Test step constructor. It initialises its own name and the input filename
1.1298 +*/
1.1299 +RTestStepAviCtrlDirectScreenAccess::RTestStepAviCtrlDirectScreenAccess(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1300 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1301 + {
1.1302 +
1.1303 + }
1.1304 +
1.1305 +/**
1.1306 +This test code tries to check the direct screen access property.
1.1307 +*/
1.1308 +TVerdict RTestStepAviCtrlDirectScreenAccess::DoTestStepL(void)
1.1309 + {
1.1310 + INFO_PRINTF1(_L("this step tests DirectScreenAccessL of AviPlayController when audio not enabled"));
1.1311 + RMMFVideoPlayControllerCustomCommands theVideoCommander(iController);
1.1312 + TMMFDSAEvent dsaEvent1 = EAbortDSA;
1.1313 + TMMFDSAEvent dsaEvent2 = EResumeDSA;
1.1314 + TInt errorCode = iController.Prime();
1.1315 + if(errorCode)
1.1316 + {
1.1317 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1318 + return EInconclusive;
1.1319 + }
1.1320 + errorCode = theVideoCommander.DirectScreenAccessEvent(dsaEvent2);
1.1321 + if(errorCode)
1.1322 + {
1.1323 + INFO_PRINTF2(_L("DirectScreenAccessEvent() is failed during primed state %d "), errorCode);
1.1324 + return EInconclusive;
1.1325 + }
1.1326 + errorCode = iController.Play();
1.1327 + if(errorCode)
1.1328 + {
1.1329 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.1330 + return EInconclusive;
1.1331 + }
1.1332 + errorCode = theVideoCommander.DirectScreenAccessEvent(dsaEvent1);
1.1333 + if(errorCode)
1.1334 + {
1.1335 + INFO_PRINTF2(_L("DirectScreenAccessEvent() is failed during primed state %d "), errorCode);
1.1336 + return EInconclusive;
1.1337 + }
1.1338 + CActiveScheduler::Start();
1.1339 + return iTestStepResult;
1.1340 + }
1.1341 +
1.1342 +/**
1.1343 +Test step constructor. It initialises its own name and the input filename
1.1344 +*/
1.1345 +RTestStepAviCtrlSetPlayWindow::RTestStepAviCtrlSetPlayWindow(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1346 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1347 + {
1.1348 + }
1.1349 +
1.1350 +/**
1.1351 +This test code tries to set the set playwindow and expects KErrNotSupported
1.1352 +*/
1.1353 +TVerdict RTestStepAviCtrlSetPlayWindow::DoTestStepL(void)
1.1354 + {
1.1355 + INFO_PRINTF1(_L("this step plays an avi file "));
1.1356 + TInt errorCode = iController.Prime();
1.1357 + if(errorCode)
1.1358 + {
1.1359 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1360 + return EFail;
1.1361 + }
1.1362 + RMMFVideoPlayControllerCustomCommands theVideoCommander(iController);
1.1363 + TTimeIntervalMicroSeconds theDuration;
1.1364 + errorCode = iController.GetDuration(theDuration);
1.1365 + if(errorCode)
1.1366 + {
1.1367 + INFO_PRINTF2(_L("DurationL() is failed with %d "), errorCode);
1.1368 + return EInconclusive;
1.1369 + }
1.1370 + TInt64 duration = theDuration. Int64();
1.1371 + TTimeIntervalMicroSeconds thePlayStart(duration/2);
1.1372 + TTimeIntervalMicroSeconds thePlayEnd(duration);
1.1373 + errorCode = theVideoCommander.Play(thePlayStart, thePlayEnd);
1.1374 + if(errorCode != KErrNotSupported)
1.1375 + {
1.1376 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.1377 + return EFail;
1.1378 + }
1.1379 + errorCode = iController.Play();
1.1380 + if(errorCode)
1.1381 + {
1.1382 + INFO_PRINTF2(_L("Play() after SetPlayWindow() is failed with %d "), errorCode);
1.1383 + return EInconclusive;
1.1384 + }
1.1385 + CActiveScheduler::Start();
1.1386 + return iTestStepResult;
1.1387 + }
1.1388 +
1.1389 +//Negative Tests
1.1390 +/**
1.1391 +Test step constructor. It initialises its own name and the input filename
1.1392 +*/
1.1393 +RTestStepAviCtrlPlayInvalid::RTestStepAviCtrlPlayInvalid(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1394 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1395 + {
1.1396 +
1.1397 + }
1.1398 +
1.1399 +TVerdict RTestStepAviCtrlPlayInvalid::DoTestStepPreambleL(void)
1.1400 + {
1.1401 + return EPass;
1.1402 + }
1.1403 +
1.1404 +/**
1.1405 +Do the test step(Negative Test).This test tries to open an invalid file. Expects KErrCurrupt from AviPlayController
1.1406 +*/
1.1407 +TVerdict RTestStepAviCtrlPlayInvalid::DoTestStepL(void)
1.1408 + {
1.1409 + const TUid KAviPlayControllerUid = {0x102737A5};
1.1410 + INFO_PRINTF1(_L("This test tries to open an invalid file using AviPlayController"));
1.1411 + iScheduler = new(ELeave)CActiveScheduler;
1.1412 + CleanupStack::PushL(iScheduler );
1.1413 + CActiveScheduler::Install(iScheduler );
1.1414 + CleanupStack::Pop();
1.1415 + iPriority.iPriority = 11; // set the priority to some default value
1.1416 + iPriority.iPref = EMdaPriorityPreferenceQuality;
1.1417 + iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
1.1418 + TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority);
1.1419 + if(errorCode)
1.1420 + {
1.1421 + INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode);
1.1422 + return EInconclusive;
1.1423 + }
1.1424 + iControllerEventMonitor->Start();
1.1425 + SetupReadFileConfigL();
1.1426 + errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1.1427 + if(errorCode != KErrCorrupt)
1.1428 + {
1.1429 + INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode);
1.1430 + return EFail;
1.1431 + }
1.1432 + else
1.1433 + {
1.1434 + INFO_PRINTF2(_L("AddDataSource() returned KErrCorrupt with invalid .avi file %d "), errorCode);
1.1435 + return EPass;
1.1436 + }
1.1437 + }
1.1438 +
1.1439 +/**
1.1440 +Test step constructor. It initialises its own name and the input filename
1.1441 +*/
1.1442 +RTestStepAviCtrlNotAudioEnabled::RTestStepAviCtrlNotAudioEnabled(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.1443 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1444 + {
1.1445 +
1.1446 + }
1.1447 +
1.1448 +/**
1.1449 +This test step tries to get the volume and balance from a file where audio is not enabled and expect KErrNotsupported
1.1450 +*/
1.1451 +TVerdict RTestStepAviCtrlNotAudioEnabled::DoTestStepL(void)
1.1452 + {
1.1453 + TInt theNewBalance (0);
1.1454 + TTimeIntervalMicroSeconds ramp(100);
1.1455 + INFO_PRINTF1(_L("this step tests SetVolume/GetVolume() APIs of AviPlayController when audio not enabled"));
1.1456 + RMMFAudioPlayDeviceCustomCommands theAudioDevice(iController);
1.1457 + TInt maxVolume(0);
1.1458 + TInt errorCode = theAudioDevice.GetMaxVolume(maxVolume);
1.1459 + if(errorCode != KErrNotSupported)
1.1460 + {
1.1461 + INFO_PRINTF2(_L("GetMaxVolume() is failed with %d "), errorCode);
1.1462 + return EInconclusive;
1.1463 + }
1.1464 + TInt theVolume = maxVolume /2;
1.1465 + //try setting volume in Stopped State
1.1466 + errorCode =theAudioDevice.SetVolume(theVolume);
1.1467 + if(errorCode != KErrNotSupported)
1.1468 + {
1.1469 + INFO_PRINTF2(_L("SetVolume() during Stopped State is failed with %d "), errorCode);
1.1470 + return EFail;
1.1471 + }
1.1472 + TInt theNewVolume (0);
1.1473 + errorCode =theAudioDevice.GetVolume(theNewVolume);
1.1474 + if(errorCode != KErrNotSupported)
1.1475 + {
1.1476 + INFO_PRINTF2(_L("GetVolume() during Stopped State is failed with %d "), errorCode);
1.1477 + return EFail;
1.1478 + }
1.1479 + TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
1.1480 + errorCode = theAudioDevice.SetBalance(theBalance);
1.1481 + if(errorCode != KErrNotSupported)
1.1482 + {
1.1483 + INFO_PRINTF2(_L("SetBalance() during Stopped State is failed with %d "), errorCode);
1.1484 + return EFail;
1.1485 + }
1.1486 + errorCode =theAudioDevice.GetBalance(theNewBalance);
1.1487 + if(errorCode != KErrNotSupported)
1.1488 + {
1.1489 + INFO_PRINTF2(_L("GetBalance() during Stopped State is failed with %d "), errorCode);
1.1490 + return EFail;
1.1491 + }
1.1492 + errorCode =theAudioDevice.SetVolumeRamp(ramp);
1.1493 + if(errorCode != KErrNotSupported)
1.1494 + {
1.1495 + INFO_PRINTF2(_L("SetVolumeRamp() during Stopped State is failed with %d "), errorCode);
1.1496 + return EFail;
1.1497 + }
1.1498 + errorCode = iController.Prime();
1.1499 + if(errorCode)
1.1500 + {
1.1501 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1502 + return EInconclusive;
1.1503 + }
1.1504 + //try setting volume in Primed State
1.1505 + errorCode =theAudioDevice.SetVolume(theVolume);
1.1506 + if(errorCode != KErrNotSupported)
1.1507 + {
1.1508 + INFO_PRINTF2(_L("SetVolume() during Primed State is failed with %d "), errorCode);
1.1509 + return EFail;
1.1510 + }
1.1511 + errorCode =theAudioDevice.GetVolume(theNewVolume);
1.1512 + if(errorCode != KErrNotSupported)
1.1513 + {
1.1514 + INFO_PRINTF2(_L("GetVolume() during Primed State is failed with %d "), errorCode);
1.1515 + return EFail;
1.1516 + }
1.1517 + errorCode =theAudioDevice.SetVolumeRamp(ramp);
1.1518 + if(errorCode != KErrNotSupported)
1.1519 + {
1.1520 + INFO_PRINTF2(_L("SetVolumeRamp() during primed State is failed with %d "), errorCode);
1.1521 + return EFail;
1.1522 + }
1.1523 + theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
1.1524 + errorCode = theAudioDevice.SetBalance(theBalance);
1.1525 + if(errorCode != KErrNotSupported)
1.1526 + {
1.1527 + INFO_PRINTF2(_L("SetBalance() during primed State is failed with %d "), errorCode);
1.1528 + return EFail;
1.1529 + }
1.1530 + errorCode =theAudioDevice.GetBalance(theNewBalance);
1.1531 + if(errorCode != KErrNotSupported)
1.1532 + {
1.1533 + INFO_PRINTF2(_L("GetBalance() during primed State is failed with %d "), errorCode);
1.1534 + return EFail;
1.1535 + }
1.1536 + errorCode = iController.Play();
1.1537 + if(errorCode)
1.1538 + {
1.1539 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.1540 + return EInconclusive;
1.1541 + }
1.1542 + //try setting volume in Playing State
1.1543 + errorCode =theAudioDevice.SetVolume(theVolume);
1.1544 + if(errorCode!= KErrNotSupported)
1.1545 + {
1.1546 + INFO_PRINTF2(_L("SetVolume() during Playing State is failed with %d "), errorCode);
1.1547 + iController.Stop();
1.1548 + return EFail;
1.1549 + }
1.1550 + errorCode =theAudioDevice.GetVolume(theNewVolume);
1.1551 + if(errorCode!= KErrNotSupported)
1.1552 + {
1.1553 + INFO_PRINTF2(_L("GetVolume() during Playing State is failed with %d "), errorCode);
1.1554 + iController.Stop();
1.1555 + return EFail;
1.1556 + }
1.1557 + errorCode =theAudioDevice.SetVolumeRamp(ramp);
1.1558 + if(errorCode != KErrNotSupported)
1.1559 + {
1.1560 + INFO_PRINTF2(_L("SetVolumeRamp() during play State is failed with %d "), errorCode);
1.1561 + return EFail;
1.1562 + }
1.1563 + theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
1.1564 + errorCode = theAudioDevice.SetBalance(theBalance);
1.1565 + if(errorCode != KErrNotSupported)
1.1566 + {
1.1567 + INFO_PRINTF2(_L("SetBalance() during playing State is failed with %d "), errorCode);
1.1568 + return EFail;
1.1569 + }
1.1570 + errorCode =theAudioDevice.GetBalance(theNewBalance);
1.1571 + if(errorCode != KErrNotSupported)
1.1572 + {
1.1573 + INFO_PRINTF2(_L("GetBalance() during playing State is failed with %d "), errorCode);
1.1574 + return EFail;
1.1575 + }
1.1576 + //get the play completion event
1.1577 + CActiveScheduler::Start();
1.1578 + return iTestStepResult;
1.1579 + }
1.1580 +
1.1581 +/**
1.1582 +Test step constructor. It initialises its own name, input filename and the screen number.
1.1583 +*/
1.1584 +RTestStepAviPlayCtrlSetScrnPlay::RTestStepAviPlayCtrlSetScrnPlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid, TInt aScreenNumber)
1.1585 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1586 + {
1.1587 + iScreenNumber = aScreenNumber;
1.1588 + }
1.1589 +
1.1590 +//Override base class Preamble
1.1591 +TVerdict RTestStepAviPlayCtrlSetScrnPlay::DoTestStepPreambleL(void)
1.1592 + {
1.1593 + RTestStepAviCtrlBase::DoTestStepPreambleL();
1.1594 + return EPass;
1.1595 + }
1.1596 +
1.1597 +/**
1.1598 +This is from MMMFControllerEventMonitorObserver.which handles all the events from AviPlayController.
1.1599 +Base class version is overridden to avoid starting the active schedular twice.
1.1600 +*/
1.1601 +void RTestStepAviPlayCtrlSetScrnPlay::HandleEvent(const TMMFEvent& aEvent)
1.1602 + {
1.1603 + TInt errorCode = 0;
1.1604 + if (aEvent.iEventType==KMMFEventCategoryPlaybackComplete)
1.1605 + {
1.1606 + if(aEvent.iErrorCode == KErrNone)
1.1607 + {
1.1608 + INFO_PRINTF2(_L("PlayCompletion is passed with %d "), aEvent.iErrorCode);
1.1609 + iTestStepResult = EPass;
1.1610 + }
1.1611 + else
1.1612 + {
1.1613 + iTestStepResult = EFail;
1.1614 + INFO_PRINTF2(_L("PlayCompletion is failed with %d "), aEvent.iErrorCode);
1.1615 + }
1.1616 + CActiveScheduler::Stop();
1.1617 + }
1.1618 + else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
1.1619 + {
1.1620 + if((aEvent.iErrorCode == KErrNone) || (aEvent.iErrorCode == KErrEof))
1.1621 + {
1.1622 + //add code here to set display window and to update display region.
1.1623 + RMMFVideoPlayControllerCustomCommands thePlayCommander(iController);
1.1624 + errorCode = thePlayCommander.SetDisplayWindow(iScreenRect,iClipRect);
1.1625 + if(errorCode)
1.1626 + {
1.1627 + INFO_PRINTF2(_L("SetDisplayWindow failed with %d "), errorCode);
1.1628 + iTestStepResult = EFail;
1.1629 + CActiveScheduler::Stop();
1.1630 + return;
1.1631 + }
1.1632 + errorCode = thePlayCommander.UpdateDisplayRegion(iRegion);
1.1633 + if(errorCode)
1.1634 + {
1.1635 + INFO_PRINTF2(_L("UpdateDisplayRegion failed with %d "), errorCode);
1.1636 + iTestStepResult = EFail;
1.1637 + CActiveScheduler::Stop();
1.1638 + return;
1.1639 + }
1.1640 + INFO_PRINTF2(_L("Open completion is passed with %d "), aEvent.iErrorCode);
1.1641 + errorCode = thePlayCommander.Prepare();
1.1642 + if(errorCode)
1.1643 + {
1.1644 + INFO_PRINTF2(_L("Prepare failed with %d "), errorCode);
1.1645 + iTestStepResult = EFail;
1.1646 + CActiveScheduler::Stop();
1.1647 + }
1.1648 + }
1.1649 + else
1.1650 + {
1.1651 + iTestStepResult = EFail;
1.1652 + INFO_PRINTF2(_L("Video open complete is failed with %d "), aEvent.iErrorCode);
1.1653 + CActiveScheduler::Stop();
1.1654 + }
1.1655 + }
1.1656 + else if (aEvent.iEventType == KMMFEventCategoryVideoPrepareComplete)
1.1657 + {
1.1658 + if((aEvent.iErrorCode == KErrNone) || (aEvent.iErrorCode == KErrEof))
1.1659 + {
1.1660 + INFO_PRINTF2(_L("Prepare completion is passed with %d "), aEvent.iErrorCode);
1.1661 + errorCode = iController.Prime();
1.1662 + if(errorCode)
1.1663 + {
1.1664 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.1665 + iTestStepResult = EFail;
1.1666 + CActiveScheduler::Stop();
1.1667 + return;
1.1668 + }
1.1669 + errorCode = iController.Play();
1.1670 + if(errorCode)
1.1671 + {
1.1672 + INFO_PRINTF2(_L("Play() is failed with %d "), errorCode);
1.1673 + iTestStepResult = EFail;
1.1674 + CActiveScheduler::Stop();
1.1675 + }
1.1676 + }
1.1677 + else
1.1678 + {
1.1679 + iTestStepResult = EFail;
1.1680 + INFO_PRINTF2(_L("PrepareComplete is failed with %d "),aEvent.iErrorCode);
1.1681 + CActiveScheduler::Stop();
1.1682 + }
1.1683 + }
1.1684 + else
1.1685 + {
1.1686 + INFO_PRINTF1(_L("Unexpected Event from the Controller"));
1.1687 + iTestStepResult = EFail;
1.1688 + CActiveScheduler::Stop();
1.1689 + }
1.1690 +
1.1691 + }
1.1692 +
1.1693 +/**
1.1694 +This test step plays the video on the primary or secondary screen depending the value of screen number passed during its construction.
1.1695 +*/
1.1696 +TVerdict RTestStepAviPlayCtrlSetScrnPlay::DoTestStepL(void)
1.1697 + {
1.1698 + INFO_PRINTF2(_L("this step plays an avi file on screen %d using RMMFVideoSetInitScreenCustomCommands"), iScreenNumber);
1.1699 + iTestStepResult = EFail;
1.1700 + TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority);
1.1701 + if(errorCode)
1.1702 + {
1.1703 + INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode);
1.1704 + User::LeaveIfError( errorCode );
1.1705 + }
1.1706 + iControllerEventMonitor->Start();
1.1707 + if(!SetupReadFileConfigL())
1.1708 + {
1.1709 + return EInconclusive;
1.1710 + }
1.1711 + RMMFVideoSetInitScreenCustomCommands setInitScrn(iController);
1.1712 + errorCode = setInitScrn.SetInitScreenNumber(iScreenNumber);
1.1713 + if(errorCode)
1.1714 + {
1.1715 + INFO_PRINTF2(_L("SetInitScreenNumber failed with %d "), errorCode);
1.1716 + User::LeaveIfError( errorCode );
1.1717 + }
1.1718 + errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8);
1.1719 +#ifdef __EABI__ //we dont have secondary screen support on hardware. So fail gracefully.
1.1720 + if(errorCode == KErrNotSupported && iScreenNumber == KSecondaryScreenNo)
1.1721 + {
1.1722 + INFO_PRINTF1(_L("No support for secondary display"));
1.1723 + return EKnownFailure;
1.1724 + }
1.1725 +#endif
1.1726 + if(errorCode)
1.1727 + {
1.1728 + INFO_PRINTF2(_L("AddDataSink failed with %d "), errorCode);
1.1729 + User::LeaveIfError( errorCode );
1.1730 + }
1.1731 + errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1.1732 + if(errorCode)
1.1733 + {
1.1734 + INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode);
1.1735 + User::LeaveIfError( errorCode );
1.1736 + }
1.1737 + CActiveScheduler::Start();
1.1738 + return iTestStepResult;
1.1739 + }
1.1740 +
1.1741 +/**
1.1742 +Test step constructor. It initialises its own name, input filename and the screen number.
1.1743 +*/
1.1744 +RTestStepAviPlayCtrlSetInvalidScrn::RTestStepAviPlayCtrlSetInvalidScrn(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid, TInt aScreenNumber)
1.1745 +:RTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid)
1.1746 + {
1.1747 + iScreenNumber = aScreenNumber;
1.1748 + }
1.1749 +
1.1750 +//Override base class Preamble
1.1751 +TVerdict RTestStepAviPlayCtrlSetInvalidScrn::DoTestStepPreambleL(void)
1.1752 + {
1.1753 + RTestStepAviCtrlBase::DoTestStepPreambleL();
1.1754 + return EPass;
1.1755 + }
1.1756 +
1.1757 +/**
1.1758 +This test step tries to set an invalid screen on AviPlayController and expects AddDataSink to fail with KErrNotSupported..
1.1759 +*/
1.1760 +TVerdict RTestStepAviPlayCtrlSetInvalidScrn::DoTestStepL(void)
1.1761 + {
1.1762 + INFO_PRINTF1(_L("this step tries to set an invalid screen number on the AviPlayController"));
1.1763 + TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority);
1.1764 + if(errorCode)
1.1765 + {
1.1766 + INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode);
1.1767 + User::LeaveIfError( errorCode );
1.1768 + }
1.1769 + iControllerEventMonitor->Start();
1.1770 + if(!SetupReadFileConfigL())
1.1771 + {
1.1772 + return EInconclusive;
1.1773 + }
1.1774 + RMMFVideoSetInitScreenCustomCommands setInitScrn(iController);
1.1775 + errorCode = setInitScrn.SetInitScreenNumber(iScreenNumber);
1.1776 + if(errorCode)
1.1777 + {
1.1778 + INFO_PRINTF2(_L("SetInitScreenNumber failed with %d "), errorCode);
1.1779 + User::LeaveIfError( errorCode );
1.1780 + }
1.1781 + errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8);
1.1782 + if(errorCode != KErrNotSupported)
1.1783 + {
1.1784 + INFO_PRINTF2(_L("AddDataSink failed to return KErrNotSupported but returned %d with an invalid screen"), errorCode);
1.1785 + return EFail;
1.1786 + }
1.1787 + return EPass;
1.1788 + }
1.1789 +
1.1790 +/**
1.1791 +Test step constructor. It initialises its own name, input filename and the screen number.
1.1792 +*/
1.1793 +RTestStepAviPlayCtrlAddDataSinkTwice::RTestStepAviPlayCtrlAddDataSinkTwice(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid, TInt aScreenNumber)
1.1794 +:RTestStepAviPlayCtrlSetScrnPlay(aTestName, aSectName, aKeyName, aControllerUid, aScreenNumber)
1.1795 + {
1.1796 + }
1.1797 +/**
1.1798 +This test step tries to set an invalid screen after calling AddDataSink on AviController and tries playing.
1.1799 +It resets the controller after the play is successful and tries to call AddDataSink again and expects
1.1800 +it to fail with KErrNotSupported.
1.1801 +*/
1.1802 +TVerdict RTestStepAviPlayCtrlAddDataSinkTwice::DoTestStepPreambleL(void)
1.1803 + {
1.1804 + RTestStepAviCtrlBase::DoTestStepPreambleL();
1.1805 + return EPass;
1.1806 + }
1.1807 +
1.1808 +TVerdict RTestStepAviPlayCtrlAddDataSinkTwice::DoTestStepL(void)
1.1809 + {
1.1810 + INFO_PRINTF1(_L("this step tries to add data sink twice.Second time invalid screen"));
1.1811 + iTestStepResult = EFail;
1.1812 + TInt errorCode = iController.Open(KAviPlayControllerUid, iPriority);
1.1813 + if(errorCode)
1.1814 + {
1.1815 + INFO_PRINTF2(_L("Failed to load the controller %d "), errorCode);
1.1816 + User::LeaveIfError( errorCode );
1.1817 + }
1.1818 + iControllerEventMonitor->Start();
1.1819 + if(!SetupReadFileConfigL())
1.1820 + {
1.1821 + return EInconclusive;
1.1822 + }
1.1823 + errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8);
1.1824 + if(errorCode)
1.1825 + {
1.1826 + INFO_PRINTF2(_L("AddDataSink failed with %d "), errorCode);
1.1827 + User::LeaveIfError( errorCode );
1.1828 + }
1.1829 + RMMFVideoSetInitScreenCustomCommands setInitScrn(iController);
1.1830 + errorCode = setInitScrn.SetInitScreenNumber(iScreenNumber);
1.1831 + if(errorCode)
1.1832 + {
1.1833 + INFO_PRINTF2(_L("SetInitScreenNumber failed with %d "), errorCode);
1.1834 + User::LeaveIfError( errorCode );
1.1835 + }
1.1836 + errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1.1837 + if(errorCode)
1.1838 + {
1.1839 + INFO_PRINTF2(_L("AddDataSource failed with %d "), errorCode);
1.1840 + User::LeaveIfError( errorCode );
1.1841 + }
1.1842 + CActiveScheduler::Start();
1.1843 + if(iTestStepResult == EFail)
1.1844 + {
1.1845 + return iTestStepResult;
1.1846 + }
1.1847 + errorCode = iController.Reset();
1.1848 + if(errorCode)
1.1849 + {
1.1850 + INFO_PRINTF2(_L("Reset is failed with %d "), errorCode);
1.1851 + return EFail;
1.1852 + }
1.1853 + errorCode = iController.AddDataSink(KUidMmfAudioOutput,KNullDesC8);
1.1854 + if(errorCode != KErrNotSupported)
1.1855 + {
1.1856 + INFO_PRINTF2(_L("AddDataSink failed to return KErrNotSupported but returned %d with an invalid screen"), errorCode);
1.1857 + return EFail;
1.1858 + }
1.1859 + return iTestStepResult;
1.1860 + }
1.1861 +
1.1862 +
1.1863 +/**
1.1864 +Test step constructor. It initialises its own name and the input filename
1.1865 +*/
1.1866 +RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::
1.1867 +RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap(const TDesC& aTestName,
1.1868 + const TDesC& aSectName,
1.1869 + const TDesC& aKeyName,
1.1870 + TUid aControllerUid)
1.1871 + :
1.1872 + RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid),
1.1873 + iTestState(EStateDefault),
1.1874 + iRChunk(),
1.1875 + iKickoff01(NULL),
1.1876 + iKickoff02(NULL),
1.1877 + iKickoff03(NULL),
1.1878 + iKickoff04(NULL),
1.1879 + iKickoff05(NULL),
1.1880 + iKickoff06(NULL)
1.1881 + {
1.1882 + }
1.1883 +
1.1884 +
1.1885 +/**
1.1886 +Do the test step. This test check that under low memory conditions the xvid
1.1887 +codec may leave and DevVideo will be notified by the codec and and in turn
1.1888 +AviPlayController will be notified too by DevVideo using the FatalError
1.1889 +callbacks. Once the low memory conditions return to normal, the test case
1.1890 +Primes the AviPlayController and Plays an avi file to its completion and checks
1.1891 +for the proper play completion. This will prove that DevVideo is destroyed and
1.1892 +then recreated after a FatalError occurs.
1.1893 +
1.1894 +The idea here is :
1.1895 +
1.1896 +1.- To allocate enough memory with the aim of leaving around KMaxFreeRamForTest
1.1897 +bytes available for the rest of the test case.
1.1898 +
1.1899 +2.- After that, the testcase Primes the AviPlayController and Plays an avi
1.1900 +file. Play is expected to fail with KErrTooBig (in the play completion event).
1.1901 +
1.1902 +3.- Then returns memory back to the system.
1.1903 +
1.1904 +4.- Then try to play the video file again, this time everything will work
1.1905 +fine...With this we test that DevVideo's been recreated...
1.1906 +
1.1907 +*/
1.1908 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::KickoffTestL()
1.1909 + {
1.1910 + iTestState = EStateLoadKickoffTestLComplete;
1.1911 +
1.1912 + INFO_PRINTF1(_L("this step plays an avi file under low memory conditions for the xvid decoder "));
1.1913 +
1.1914 + // This will install two callbacks
1.1915 + RAsyncTestStepAviCtrlPlayBase::KickoffTestL();
1.1916 +
1.1917 + // STEP 1: The idea here is to allocate enough memory with the aim of
1.1918 + // leaving around KMaxFreeRamForTest bytes available for the rest of the
1.1919 + // step. That will make the xvid decoder to fail the frame decoding as the
1.1920 + // decoder heap will not be large enough.
1.1921 + TCallBack callback01 (AllocChunkCallBack, this);
1.1922 + delete iKickoff01;
1.1923 + iKickoff01 = NULL;
1.1924 + iKickoff01 = new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
1.1925 +
1.1926 +
1.1927 + // STEP 2: Prime the controller...
1.1928 + TCallBack callback02 (PrimeControllerCallBack, this);
1.1929 + delete iKickoff02;
1.1930 + iKickoff02 = NULL;
1.1931 + iKickoff02 = new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
1.1932 +
1.1933 + // STEP 3: play is expected to fail with KErrTooBig (in the play completion event ) ...
1.1934 + TCallBack callback03 (PlayControllerCallBack, this);
1.1935 + delete iKickoff03;
1.1936 + iKickoff03 = NULL;
1.1937 + iKickoff03 = new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
1.1938 +
1.1939 + // STEP 4: Return memory back to system here...
1.1940 + TCallBack callback04 (ReturnChunckAndStopControllerCallBack, this);
1.1941 + delete iKickoff04;
1.1942 + iKickoff04 = NULL;
1.1943 + iKickoff04 = new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
1.1944 +
1.1945 + // Repeat prime....
1.1946 + TCallBack callback05 (PrimeControllerCallBack, this);
1.1947 + delete iKickoff05;
1.1948 + iKickoff05 = NULL;
1.1949 + iKickoff05 = new (ELeave) CAsyncCallBack (callback05, CActive::EPriorityLow);
1.1950 +
1.1951 + // ...and repeat play
1.1952 + TCallBack callback06 (PlayControllerCallBack, this);
1.1953 + delete iKickoff06;
1.1954 + iKickoff06 = NULL;
1.1955 + iKickoff06 = new (ELeave) CAsyncCallBack (callback06, CActive::EPriorityLow);
1.1956 +
1.1957 + // Start allocate chunck callback.
1.1958 + iKickoff01->Call();
1.1959 + }
1.1960 +
1.1961 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::CloseTest()
1.1962 + {
1.1963 + delete iKickoff01; // no need to Cancel
1.1964 + iKickoff01 = NULL;
1.1965 + delete iKickoff02; // no need to Cancel
1.1966 + iKickoff02 = NULL;
1.1967 + delete iKickoff03; // no need to Cancel
1.1968 + iKickoff03 = NULL;
1.1969 + delete iKickoff04; // no need to Cancel
1.1970 + iKickoff04 = NULL;
1.1971 + delete iKickoff05; // no need to Cancel
1.1972 + iKickoff05 = NULL;
1.1973 + delete iKickoff06; // no need to Cancel
1.1974 + iKickoff06 = NULL;
1.1975 +
1.1976 + RAsyncTestStepAviCtrlPlayBase::CloseTest();
1.1977 + }
1.1978 +
1.1979 +
1.1980 +TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::AllocChunkCallBack(TAny* aPtr)
1.1981 + {
1.1982 + RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self =
1.1983 + static_cast<RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap*> (aPtr);
1.1984 + self->DoAllocChunkCallBack();
1.1985 + return KErrNone;
1.1986 + }
1.1987 +
1.1988 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoAllocChunkCallBack()
1.1989 + {
1.1990 + // Check simple FSM
1.1991 + if (iTestState != EStateLoadKickoffTestLComplete)
1.1992 + {
1.1993 + INFO_PRINTF1(_L("FSM error in DoAllocChunkCallBack"));
1.1994 + StopTest(KErrGeneral, EFail);
1.1995 + return;
1.1996 + }
1.1997 +
1.1998 + iTestState = EStateAllocChunkCallBackComplete;
1.1999 +
1.2000 + TInt freeRam = 0;
1.2001 +
1.2002 + TInt halError = KErrNone;
1.2003 + if ((halError = HAL::Get(HALData::EMemoryRAMFree, freeRam)) != KErrNone)
1.2004 + {
1.2005 + INFO_PRINTF1(_L("Unable to obtain the amount of free ram available "));
1.2006 + StopTest(halError, EInconclusive);
1.2007 + return;
1.2008 + }
1.2009 +
1.2010 + if (freeRam > KMaxFreeRamForTest)
1.2011 + {
1.2012 + TInt memToAllocate = freeRam - KMaxFreeRamForTest;
1.2013 + INFO_PRINTF3(_L("freeRam = %d bytes, before allocating %d bytes"),
1.2014 + freeRam, memToAllocate);
1.2015 + TInt chunkError = KErrNone;
1.2016 + //We have calculated the amount of memory to allocate
1.2017 + //start by allocating half of that amount
1.2018 +
1.2019 + if((chunkError=iRChunk[0].CreateLocal(memToAllocate/2, memToAllocate/2 + 1))!=KErrNone)
1.2020 + {
1.2021 + INFO_PRINTF3(_L("At least %d mem bytes are needed for this test (err=%d)"),
1.2022 + KMaxFreeRamForTest, chunkError);
1.2023 + StopTest(chunkError, EInconclusive);
1.2024 + return;
1.2025 + }
1.2026 + //WDP: we are allocating on paged memory. So keep allocating chunks till you are Out of Memory
1.2027 + //Now allocate smaller chunks. Only half of memToAllocate has been allocated yet
1.2028 + //In every iteration we try to allocate KMaxFreeRamForTest/2
1.2029 + //Calculate the max loop value till which we should run, add some extra iterations so that this loop goes on till OOM for sure
1.2030 + //Number of iterations is (0.5*memToAllocate)/(0.5*KMaxFreeRamForTest)
1.2031 + TInt loopValue=(memToAllocate/KMaxFreeRamForTest)+KExtraIterations;
1.2032 + if(loopValue>KMaxChunks)
1.2033 + {
1.2034 + //We should not get here.
1.2035 + INFO_PRINTF1(_L("Cannot Create so many chunks"));
1.2036 + StopTest(chunkError, EInconclusive);
1.2037 + return;
1.2038 + }
1.2039 + for(iNumAllocatedChunks=1;iNumAllocatedChunks<KMaxChunks;iNumAllocatedChunks++)
1.2040 + {
1.2041 + chunkError = KErrNone;
1.2042 + if ((chunkError = iRChunk[iNumAllocatedChunks].CreateLocal(KMaxFreeRamForTest/2, KMaxFreeRamForTest/2 + 1)) != KErrNone)
1.2043 + {
1.2044 + if(chunkError==KErrNoMemory)
1.2045 + {
1.2046 + //We have run out of memory
1.2047 + //Close the last two chunks so now you have approximately KMaxFreeRamForTest free
1.2048 + iRChunk[--iNumAllocatedChunks].Close();
1.2049 + if(iNumAllocatedChunks>0)
1.2050 + {
1.2051 + iRChunk[--iNumAllocatedChunks].Close();
1.2052 + }
1.2053 + break;
1.2054 + }
1.2055 + else
1.2056 + {
1.2057 + //Unexpected error
1.2058 + INFO_PRINTF1(_L("Received Unexpected error"));
1.2059 + StopTest(chunkError, EInconclusive);
1.2060 + return;
1.2061 + }
1.2062 + }
1.2063 + }
1.2064 + if(chunkError!=KErrNoMemory)
1.2065 + {
1.2066 + //We are out of the loop and still not out of memory. This is not expected
1.2067 + INFO_PRINTF2(_L("Expecting -4 by now but still not out of memory. Allocated chunks %d"),iNumAllocatedChunks);
1.2068 + StopTest(chunkError, EInconclusive);
1.2069 + return;
1.2070 + }
1.2071 +
1.2072 + iKickoff02->Call(); // Start prime
1.2073 + }
1.2074 + else
1.2075 + {
1.2076 + INFO_PRINTF2(_L("At least %d mem bytes are needed for this test "), KMaxFreeRamForTest);
1.2077 + StopTest(KErrGeneral, EInconclusive);
1.2078 + }
1.2079 + }
1.2080 +
1.2081 +
1.2082 +TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::PrimeControllerCallBack(TAny* aPtr)
1.2083 + {
1.2084 + RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self =
1.2085 + static_cast<RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap*> (aPtr);
1.2086 + self->DoPrimeControllerCallBack();
1.2087 + return KErrNone;
1.2088 + }
1.2089 +
1.2090 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoPrimeControllerCallBack()
1.2091 + {
1.2092 +
1.2093 + // Check simple fsm
1.2094 + switch (iTestState)
1.2095 + {
1.2096 + case EStateAllocChunkCallBackComplete:
1.2097 + {
1.2098 + iTestState = EStatePrimeControllerCallBackComplete1;
1.2099 + iKickoff03->Call(); // Start 1st playback
1.2100 + break;
1.2101 + }
1.2102 + case EStateReturnChunckAndStopControllerCallBackComplete:
1.2103 + {
1.2104 + iTestState = EStatePrimeControllerCallBackComplete2;
1.2105 + iKickoff06->Call(); // Start 2nd playback
1.2106 + break;
1.2107 + }
1.2108 + default:
1.2109 + {
1.2110 + INFO_PRINTF1(_L("FSM error in DoPrimeControllerCallBack"));
1.2111 + StopTest(KErrGeneral, EFail);
1.2112 + return;
1.2113 + }
1.2114 + };
1.2115 +
1.2116 + INFO_PRINTF1(_L("iController.Prime()"));
1.2117 +
1.2118 + TInt errorCode = iController.Prime();
1.2119 + if(errorCode)
1.2120 + {
1.2121 + INFO_PRINTF2(_L("Prime is failed with %d "), errorCode);
1.2122 + StopTest(errorCode, EFail);
1.2123 + }
1.2124 + }
1.2125 +
1.2126 +
1.2127 +TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::PlayControllerCallBack(TAny* aPtr)
1.2128 + {
1.2129 + RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self =
1.2130 + static_cast<RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap*> (aPtr);
1.2131 + self->DoPlayControllerCallBack();
1.2132 + return KErrNone;
1.2133 + }
1.2134 +
1.2135 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoPlayControllerCallBack()
1.2136 + {
1.2137 +
1.2138 + // Check simple fsm
1.2139 + switch (iTestState)
1.2140 + {
1.2141 + case EStatePrimeControllerCallBackComplete1:
1.2142 + {
1.2143 + iTestState = EStatePlayControllerCallBackComplete1;
1.2144 + break;
1.2145 + }
1.2146 + case EStatePrimeControllerCallBackComplete2:
1.2147 + {
1.2148 + iTestState = EStatePlayControllerCallBackComplete2;
1.2149 + break;
1.2150 + }
1.2151 + default:
1.2152 + {
1.2153 + INFO_PRINTF1(_L("FSM error in DoPlayControllerCallBack"));
1.2154 + StopTest(KErrGeneral, EFail);
1.2155 + return;
1.2156 + }
1.2157 + };
1.2158 +
1.2159 + INFO_PRINTF1(_L("iController.Play()"));
1.2160 +
1.2161 + TInt errorCode = iController.Play();
1.2162 + if(errorCode)
1.2163 + {
1.2164 + INFO_PRINTF2(_L("Play() failed with error %d"), errorCode);
1.2165 + StopTest(errorCode, EFail);
1.2166 + }
1.2167 + }
1.2168 +
1.2169 +TInt RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::ReturnChunckAndStopControllerCallBack(TAny* aPtr)
1.2170 + {
1.2171 + RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap* self =
1.2172 + static_cast<RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap*> (aPtr);
1.2173 + self->DoReturnChunckAndStopControllerCallBack();
1.2174 + return KErrNone;
1.2175 + }
1.2176 +
1.2177 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::DoReturnChunckAndStopControllerCallBack()
1.2178 + {
1.2179 + // Check simple fsm
1.2180 + if (iTestState != EStatePlayControllerCallBackComplete1)
1.2181 + {
1.2182 + INFO_PRINTF1(_L("FSM error in DoReturnChunckAndStopControllerCallBack"));
1.2183 + StopTest(KErrGeneral, EFail);
1.2184 + return;
1.2185 + }
1.2186 + iTestState = EStateReturnChunckAndStopControllerCallBackComplete;
1.2187 +
1.2188 + INFO_PRINTF1(_L("Returning memory back to the system"));
1.2189 +
1.2190 + for(TInt i=0;i<iNumAllocatedChunks;i++)
1.2191 + {
1.2192 + iRChunk[i].Close();
1.2193 + }
1.2194 + // Get controller back to an initial state
1.2195 + iController.Stop();
1.2196 +
1.2197 + iKickoff05->Call(); // call prime again
1.2198 + }
1.2199 +
1.2200 +
1.2201 +/**
1.2202 +This is from MMMFControllerEventMonitorObserver.which handles all the events
1.2203 +from AviPlayController. Base class version is overridden to avoid starting the
1.2204 +active schedular twice.
1.2205 +*/
1.2206 +void RTestStepAviPlayNotEnoughMemoryForXvidCodecHeap::HandleEvent(const TMMFEvent& aEvent)
1.2207 + {
1.2208 + INFO_PRINTF2(_L("HandleEvent aEvent.iEventType %d "),
1.2209 + aEvent.iEventType);
1.2210 + INFO_PRINTF2(_L("::HandleEvent aEvent.iErrorCode %d "),
1.2211 + aEvent.iErrorCode);
1.2212 +
1.2213 + if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
1.2214 + {
1.2215 + if(aEvent.iErrorCode == KErrNone)
1.2216 + {
1.2217 + iTestStepResult = EPass;
1.2218 + INFO_PRINTF2(_L("PlayCompletion is passed with %d "),
1.2219 + aEvent.iErrorCode);
1.2220 + }
1.2221 + else
1.2222 + {
1.2223 + iTestStepResult = EFail;
1.2224 + INFO_PRINTF2(_L("PlayCompletion is failed with %d "),
1.2225 + aEvent.iErrorCode);
1.2226 + }
1.2227 +
1.2228 + //
1.2229 + // Match fsm state with play completion event just processed
1.2230 + //
1.2231 + switch(iTestState)
1.2232 + {
1.2233 + case EStatePlayControllerCallBackComplete1:
1.2234 + {
1.2235 + if (iTestStepResult == EPass)
1.2236 + {
1.2237 + INFO_PRINTF1(_L("Error: completion event was expected to be failed at this point"));
1.2238 + StopTest(KErrGeneral, EFail);
1.2239 + return;
1.2240 + }
1.2241 +
1.2242 + iKickoff04->Call(); // Return memory
1.2243 + break;
1.2244 + }
1.2245 + case EStatePlayControllerCallBackComplete2:
1.2246 + {
1.2247 + if (iTestStepResult == EFail)
1.2248 + {
1.2249 + INFO_PRINTF1(_L("Error: PlayCompletion event was expected to pass at this point"));
1.2250 + StopTest(KErrGeneral, EFail);
1.2251 + return;
1.2252 + }
1.2253 + else
1.2254 + {
1.2255 + // Test has finished succesfully at this point
1.2256 + INFO_PRINTF1(_L("Test successfully completed"));
1.2257 + StopTest();
1.2258 + return;
1.2259 + }
1.2260 + }
1.2261 + default:
1.2262 + {
1.2263 + INFO_PRINTF1(_L("FSM error in HandleEvent"));
1.2264 + StopTest(KErrGeneral, EFail);
1.2265 + return;
1.2266 + }
1.2267 + };
1.2268 + }
1.2269 + else if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
1.2270 + {
1.2271 + if(aEvent.iErrorCode != KErrNone)
1.2272 + {
1.2273 + INFO_PRINTF2(_L("Video open complete is failed with %d "), aEvent.iErrorCode);
1.2274 + StopTest(KErrGeneral, EFail);
1.2275 + return;
1.2276 + }
1.2277 + }
1.2278 + else
1.2279 + {
1.2280 + INFO_PRINTF1(_L("Unexpected Event from the Controller"));
1.2281 + StopTest(KErrGeneral, EFail);
1.2282 + }
1.2283 + }
1.2284 +
1.2285 +/**
1.2286 +Test step constructor. It initialises its own name and the input filename
1.2287 +*/
1.2288 +RTestStepAviPlayCtrlMemAlloc1::RTestStepAviPlayCtrlMemAlloc1(const TDesC& aTestName,
1.2289 + const TDesC& aSectName,
1.2290 + const TDesC& aKeyName,
1.2291 + TUid aControllerUid)
1.2292 + : RTestStepAviCtrlBase(aTestName, aSectName, aKeyName, aControllerUid)
1.2293 + {
1.2294 + }
1.2295 +
1.2296 +/**
1.2297 +Do the test step. This test issue a custom command to the custom AviPlay controller
1.2298 +and runs the OOM test within the controller.
1.2299 +*/
1.2300 +TVerdict RTestStepAviPlayCtrlMemAlloc1::DoTestStepL()
1.2301 + {
1.2302 + TVerdict result = EPass;
1.2303 +
1.2304 + Log( _L("Memory Allocation Test 1") );
1.2305 +
1.2306 + Log( _L("This test checks memory allocation of the plugin") );
1.2307 +
1.2308 + TInt errorCode = iController.Open(KUidCustomTestAviPlayPlugin, iPriority);
1.2309 + User::LeaveIfError( errorCode );
1.2310 +
1.2311 + //[ send the custom command to the custom audio controller ]
1.2312 + TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId);
1.2313 +
1.2314 + //[ send memory alloc test to the custom plugin ]
1.2315 + //[ we have only ensured that the controller is loaded into memory
1.2316 + // and that all add sources etc will be don
1.2317 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2318 + KMemoryAllocTest1,
1.2319 + KNullDesC8,
1.2320 + KNullDesC8);
1.2321 +
1.2322 + //[ ensure the controller is unloaded so that it does
1.2323 + // not interfere with the following test ]
1.2324 + // There is a bug in this code and the stop followed by reset
1.2325 + // ensure the controller resources are released.
1.2326 + iController.Stop();
1.2327 + iController.Reset();
1.2328 + iController.Close();
1.2329 +
1.2330 + User::LeaveIfError( errorCode );
1.2331 + return result ;
1.2332 + }
1.2333 +
1.2334 +/**
1.2335 +This is from MMMFControllerEventMonitorObserver.which handles all the events
1.2336 +from AviPlayController. Base class version is overridden to avoid starting the
1.2337 +active schedular twice.
1.2338 +*/
1.2339 +void RTestStepAviPlayCtrlMemAlloc1::HandleEvent(const TMMFEvent& aEvent)
1.2340 + {
1.2341 + (void)aEvent;
1.2342 + };
1.2343 +
1.2344 +/**
1.2345 +Test step constructor. It initialises its own name and the input filename
1.2346 +*/
1.2347 +RTestStepAviPlayCtrlMemAlloc2::RTestStepAviPlayCtrlMemAlloc2(const TDesC& aTestName,
1.2348 + const TDesC& aSectName,
1.2349 + const TDesC& aKeyName,
1.2350 + TUid aControllerUid)
1.2351 + : RTestStepAviCtrlBase(aTestName, aSectName, aKeyName, aControllerUid)
1.2352 + {
1.2353 + }
1.2354 +
1.2355 +/**
1.2356 +Do the test step. This test issue a custom command to the custom AviPlay controller
1.2357 +and runs the OOM test within the controller.
1.2358 +*/
1.2359 +TVerdict RTestStepAviPlayCtrlMemAlloc2::DoTestStepL()
1.2360 + {
1.2361 + TVerdict result = EPass;
1.2362 +
1.2363 + Log( _L("Memory Allocation Test 2") );
1.2364 +
1.2365 + Log( _L("This test checks memory allocation of the plugin") );
1.2366 +
1.2367 + TInt errorCode = iController.Open(KUidCustomTestAviPlayPlugin, iPriority);
1.2368 + User::LeaveIfError( errorCode );
1.2369 +
1.2370 + //[ send the custom command to the custom audio controller ]
1.2371 + TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId);
1.2372 +
1.2373 + //[ set the prime OOM test mode ]
1.2374 + //[ we have only ensured that the controller is loaded into memory
1.2375 + // and that all add sources etc will be don
1.2376 + TPckgBuf<TBool> primeTestEnable(ETrue);
1.2377 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2378 + KOOMPrimeTestEnable,
1.2379 + primeTestEnable,
1.2380 + KNullDesC8);
1.2381 + if (errorCode == KErrNone)
1.2382 + {
1.2383 + TInt failCount = 1;
1.2384 + for (;;)
1.2385 + {
1.2386 + TPckgBuf<TInt> primeTestFailCount(failCount);
1.2387 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2388 + KOOMPrimeTestFailCount,
1.2389 + primeTestFailCount,
1.2390 + KNullDesC8);
1.2391 + if (errorCode != KErrNone)
1.2392 + {
1.2393 + result = EInconclusive;
1.2394 + break;
1.2395 + }
1.2396 +
1.2397 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2398 + KMemoryAllocTest2,
1.2399 + KNullDesC8,
1.2400 + KNullDesC8);
1.2401 + if (errorCode != KErrNone)
1.2402 + {
1.2403 + result = EInconclusive;
1.2404 + break;
1.2405 + }
1.2406 +
1.2407 + errorCode = iController.Prime();
1.2408 + if (errorCode == KErrNone)
1.2409 + {
1.2410 + result = EPass;
1.2411 + break;
1.2412 + }
1.2413 + else if (errorCode != KErrNoMemory)
1.2414 + {
1.2415 + result = EFail;
1.2416 + break;
1.2417 + }
1.2418 +
1.2419 + iController.Reset();
1.2420 + failCount++;
1.2421 + }
1.2422 + }
1.2423 + else
1.2424 + {
1.2425 + result = EInconclusive;
1.2426 + }
1.2427 +
1.2428 + primeTestEnable() = EFalse;
1.2429 + iController.CustomCommandSync(destinationPckg,
1.2430 + KOOMPrimeTestEnable,
1.2431 + primeTestEnable,
1.2432 + KNullDesC8);
1.2433 +
1.2434 + //[ ensure the controller is unloaded so that it does
1.2435 + // not interfere with the following test ]
1.2436 + // There is a bug in this code and the stop followed by reset
1.2437 + // ensure the controller resources are released.
1.2438 + iController.Stop();
1.2439 + iController.Reset();
1.2440 + iController.Close();
1.2441 +
1.2442 + return result ;
1.2443 + }
1.2444 +
1.2445 +/**
1.2446 +This is from MMMFControllerEventMonitorObserver.which handles all the events
1.2447 +from AviPlayController. Base class version is overridden to avoid starting the
1.2448 +active schedular twice.
1.2449 +*/
1.2450 +void RTestStepAviPlayCtrlMemAlloc2::HandleEvent(const TMMFEvent& aEvent)
1.2451 + {
1.2452 + (void)aEvent;
1.2453 + };
1.2454 +
1.2455 +/**
1.2456 +Test step constructor. It initialises its own name and the input filename
1.2457 +*/
1.2458 +RTestStepAviPlayCtrlMemAlloc3::RTestStepAviPlayCtrlMemAlloc3(const TDesC& aTestName,
1.2459 + const TDesC& aSectName,
1.2460 + const TDesC& aKeyName,
1.2461 + TUid aControllerUid)
1.2462 + : RTestStepAviCtrlBase(aTestName, aSectName, aKeyName, aControllerUid)
1.2463 + {
1.2464 + }
1.2465 +
1.2466 +/**
1.2467 +Do the test step. This test issue a custom command to the custom AviPlay controller
1.2468 +and runs the OOM test within the controller.
1.2469 +*/
1.2470 +TVerdict RTestStepAviPlayCtrlMemAlloc3::DoTestStepL()
1.2471 + {
1.2472 + TVerdict result = EPass;
1.2473 +
1.2474 + Log( _L("Memory Allocation Test 3") );
1.2475 +
1.2476 + Log( _L("This test checks memory allocation of the plugin") );
1.2477 +
1.2478 + TInt errorCode = iController.Open(KUidCustomTestAviPlayPlugin, iPriority);
1.2479 + User::LeaveIfError( errorCode );
1.2480 +
1.2481 + //[ send the custom command to the custom audio controller ]
1.2482 + TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId);
1.2483 +
1.2484 + TInt failCount = 1;
1.2485 + for (;;)
1.2486 + {
1.2487 + TPckgBuf<TInt> primeTestFailCount(failCount);
1.2488 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2489 + KOOMPrimeTestFailCount,
1.2490 + primeTestFailCount,
1.2491 + KNullDesC8);
1.2492 + if (errorCode != KErrNone)
1.2493 + {
1.2494 + result = EInconclusive;
1.2495 + break;
1.2496 + }
1.2497 +
1.2498 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2499 + KMemoryAllocTest2,
1.2500 + KNullDesC8,
1.2501 + KNullDesC8);
1.2502 + if (errorCode != KErrNone)
1.2503 + {
1.2504 + result = EInconclusive;
1.2505 + break;
1.2506 + }
1.2507 +
1.2508 + errorCode = iController.Prime();
1.2509 + if (errorCode != KErrNone)
1.2510 + {
1.2511 + result = EInconclusive;
1.2512 + break;
1.2513 + }
1.2514 +
1.2515 + errorCode = iController.CustomCommandSync(destinationPckg,
1.2516 + KMemoryAllocTest3,
1.2517 + KNullDesC8,
1.2518 + KNullDesC8);
1.2519 +
1.2520 + if (errorCode == KErrNone)
1.2521 + {
1.2522 + result = EPass;
1.2523 + break;
1.2524 + }
1.2525 + else if (errorCode != KErrNoMemory)
1.2526 + {
1.2527 + result = EFail;
1.2528 + break;
1.2529 + }
1.2530 +
1.2531 + iController.Reset();
1.2532 + failCount++;
1.2533 + }
1.2534 +
1.2535 + //[ ensure the controller is unloaded so that it does
1.2536 + // not interfere with the following test ]
1.2537 + // There is a bug in this code and the stop followed by reset
1.2538 + // ensure the controller resources are released.
1.2539 + iController.Stop();
1.2540 + iController.Reset();
1.2541 + iController.Close();
1.2542 +
1.2543 + return result ;
1.2544 + }
1.2545 +
1.2546 +/**
1.2547 +This is from MMMFControllerEventMonitorObserver.which handles all the events
1.2548 +from AviPlayController. Base class version is overridden to avoid starting the
1.2549 +active schedular twice.
1.2550 +*/
1.2551 +void RTestStepAviPlayCtrlMemAlloc3::HandleEvent(const TMMFEvent& aEvent)
1.2552 + {
1.2553 + (void)aEvent;
1.2554 + };
1.2555 +
1.2556 +#ifdef SYMBIAN_BUILD_GCE
1.2557 +
1.2558 +/**
1.2559 +Test step constructor. It initialises its own name and the input filename.
1.2560 +*/
1.2561 +RTestStepAviPlayCtrlSurfaceSupport::RTestStepAviPlayCtrlSurfaceSupport(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.2562 +:RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController)
1.2563 + {
1.2564 + }
1.2565 +
1.2566 +void RTestStepAviPlayCtrlSurfaceSupport::KickoffTestL()
1.2567 + {
1.2568 + // Allow parent to create some call backs for its initialization.
1.2569 + // Should open the video controller, set the filename, add the source and add the sink.
1.2570 + RAsyncTestStepAviCtrlPlayBase::KickoffTestL();
1.2571 +
1.2572 + iSurfaceCreated = EFalse;
1.2573 +
1.2574 + // Call UseSurfaces
1.2575 + TCallBack callbackUseSurfaces(UseSurfacesCallBack, this);
1.2576 + delete iKickoffUseSurfaces;
1.2577 + iKickoffUseSurfaces = NULL;
1.2578 + iKickoffUseSurfaces = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow);
1.2579 + iKickoffUseSurfaces->Call();
1.2580 +
1.2581 + // Call UseSurfaces again. This should not fail or cause any other subsequent step to fail.
1.2582 + delete iKickoffUseSurfaces2;
1.2583 + iKickoffUseSurfaces2 = NULL;
1.2584 + iKickoffUseSurfaces2 = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow);
1.2585 + iKickoffUseSurfaces2->Call();
1.2586 +
1.2587 + // Prime the controller
1.2588 + TCallBack callbackPrimeController(PrimeControllerCallBack, this);
1.2589 + delete iKickoffPrimeController;
1.2590 + iKickoffPrimeController = NULL;
1.2591 + iKickoffPrimeController = new (ELeave) CAsyncCallBack(callbackPrimeController, CActive::EPriorityLow);
1.2592 + iKickoffPrimeController->Call();
1.2593 +
1.2594 + TCallBack callbackPlayController(PlayControllerCallBack, this);
1.2595 + delete iKickoffPlayController;
1.2596 + iKickoffPlayController = NULL;
1.2597 + iKickoffPlayController = new (ELeave) CAsyncCallBack(callbackPlayController, CActive::EPriorityLow);
1.2598 + iKickoffPlayController->Call();
1.2599 + }
1.2600 +
1.2601 +void RTestStepAviPlayCtrlSurfaceSupport::CloseTest()
1.2602 + {
1.2603 + // no need to Cancel before deleting.
1.2604 + delete iKickoffUseSurfaces;
1.2605 + iKickoffUseSurfaces = NULL;
1.2606 + delete iKickoffUseSurfaces2;
1.2607 + iKickoffUseSurfaces2 = NULL;
1.2608 + delete iKickoffPrimeController;
1.2609 + iKickoffPrimeController = NULL;
1.2610 +
1.2611 + RAsyncTestStepAviCtrlPlayBase::CloseTest();
1.2612 + }
1.2613 +
1.2614 +/**
1.2615 +Check if we have passed the test. We need to make sure that we have received all the event
1.2616 +messages that we expect.
1.2617 +*/
1.2618 +TVerdict RTestStepAviPlayCtrlSurfaceSupport::CheckTestResult()
1.2619 + {
1.2620 + // Only report that we have not received all expected events if everything else passes.
1.2621 + // We don't expect the event generators to work properly if something else failed (and those
1.2622 + // other error codes and reasons should be more useful). We won't see these events if GCE is
1.2623 + // not enabled. So, if GCE is disabled, do not fail because we didn't see these events.
1.2624 + if (Result() == EPass && !iSurfaceCreated && iGceEnabled)
1.2625 + {
1.2626 + if (!iSurfaceCreated)
1.2627 + {
1.2628 + ERR_PRINTF1(_L("Failed to receive surface created event"));
1.2629 + }
1.2630 +
1.2631 + return EFail;
1.2632 + }
1.2633 +
1.2634 + return RAsyncTestStepAviCtrlPlayBase::CheckTestResult();
1.2635 + }
1.2636 +
1.2637 +/**
1.2638 +This is from MMMFControllerEventMonitorObserver.which handles all the events
1.2639 +from AviPlayController. Base class version is overridden to avoid starting the
1.2640 +active schedular twice.
1.2641 +*/
1.2642 +void RTestStepAviPlayCtrlSurfaceSupport::HandleEvent(const TMMFEvent& aEvent)
1.2643 + {
1.2644 + if (aEvent.iEventType == KMMFEventCategoryVideoOpenComplete)
1.2645 + {
1.2646 + if(aEvent.iErrorCode != KErrNone)
1.2647 + {
1.2648 + ERR_PRINTF2(_L("Video open complete has failed with %d "), aEvent.iErrorCode);
1.2649 + StopTest(KErrGeneral, EInconclusive);
1.2650 + return;
1.2651 + }
1.2652 + }
1.2653 + else if (aEvent.iEventType == KMMFEventCategoryVideoSurfaceCreated)
1.2654 + {
1.2655 + if (!iGceEnabled)
1.2656 + {
1.2657 + ERR_PRINTF1(_L("Surface events should not be generated when GCE is not enabled"));
1.2658 + StopTest(KErrGeneral, EFail);
1.2659 + return;
1.2660 + }
1.2661 +
1.2662 + // The error code is actually the display for which a surface has been created.
1.2663 + if (aEvent.iErrorCode != KErrNone)
1.2664 + {
1.2665 + ERR_PRINTF2(_L("Video surface created event has error %d."), aEvent.iErrorCode);
1.2666 + StopTest(KErrGeneral, EFail);
1.2667 + }
1.2668 +
1.2669 + // Now that the surface has been created we can check if can retrieve the surface parameters
1.2670 + TRect cropRect;
1.2671 + TVideoAspectRatio pixelAspectRatio;
1.2672 +
1.2673 + TInt error = iVpsCommands.GetSurfaceParameters(iSurfaceId, cropRect, pixelAspectRatio);
1.2674 + if (error)
1.2675 + {
1.2676 + ERR_PRINTF2(_L("GetSurfaceParameters failed with code %d."), error);
1.2677 + StopTest(error, EFail);
1.2678 + }
1.2679 +
1.2680 + iSurfaceCreated = ETrue;
1.2681 + }
1.2682 + else if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
1.2683 + {
1.2684 + if(aEvent.iErrorCode == KErrNone)
1.2685 + {
1.2686 + if(iGceEnabled)
1.2687 + {
1.2688 + TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId);
1.2689 + if (error)
1.2690 + {
1.2691 + ERR_PRINTF2(_L("SurfaceRemoved failed with code %d."), error);
1.2692 + StopTest(error, EFail);
1.2693 + }
1.2694 + }
1.2695 + StopTest();
1.2696 + }
1.2697 + else
1.2698 + {
1.2699 + ERR_PRINTF2(_L("Video playback complete has failed with %d "), aEvent.iErrorCode);
1.2700 + StopTest(KErrGeneral, EInconclusive);
1.2701 + }
1.2702 + }
1.2703 + else
1.2704 + {
1.2705 + ERR_PRINTF3(_L("Unexpected Event from the Controller: type %d error: %d"), aEvent.iEventType, aEvent.iErrorCode);
1.2706 + StopTest(KErrGeneral, EFail);
1.2707 + }
1.2708 + }
1.2709 +
1.2710 +TInt RTestStepAviPlayCtrlSurfaceSupport::UseSurfacesCallBack(TAny* aPtr)
1.2711 + {
1.2712 + RTestStepAviPlayCtrlSurfaceSupport* self =
1.2713 + static_cast<RTestStepAviPlayCtrlSurfaceSupport*> (aPtr);
1.2714 + self->DoUseSurfacesCallBack();
1.2715 + return KErrNone;
1.2716 + }
1.2717 +
1.2718 +void RTestStepAviPlayCtrlSurfaceSupport::DoUseSurfacesCallBack()
1.2719 + {
1.2720 + TInt error = iVpsCommands.UseSurfaces();
1.2721 +
1.2722 + if (iGceEnabled && error != KErrNone)
1.2723 + {
1.2724 + ERR_PRINTF2(_L("UseSurfaces failed with code %d."), error);
1.2725 + StopTest(error, EFail);
1.2726 + }
1.2727 + else if (!iGceEnabled && error != KErrNotSupported)
1.2728 + {
1.2729 + ERR_PRINTF2(_L("UseSurfaces failed to return KErrNotSupported. Actual result: %d."), error);
1.2730 + StopTest(error, EFail);
1.2731 + }
1.2732 + }
1.2733 +
1.2734 +TInt RTestStepAviPlayCtrlSurfaceSupport::PrimeControllerCallBack(TAny* aPtr)
1.2735 + {
1.2736 + RTestStepAviPlayCtrlSurfaceSupport* self =
1.2737 + static_cast<RTestStepAviPlayCtrlSurfaceSupport*> (aPtr);
1.2738 + self->DoPrimeControllerCallBack();
1.2739 + return KErrNone;
1.2740 + }
1.2741 +
1.2742 +void RTestStepAviPlayCtrlSurfaceSupport::DoPrimeControllerCallBack()
1.2743 + {
1.2744 + TInt error = iController.Prime();
1.2745 + if (error != KErrNone)
1.2746 + {
1.2747 + ERR_PRINTF2(_L("Prime failed with %d "), error);
1.2748 + StopTest(error, EFail);
1.2749 + }
1.2750 + }
1.2751 +
1.2752 +TInt RTestStepAviPlayCtrlSurfaceSupport::PlayControllerCallBack(TAny* aPtr)
1.2753 + {
1.2754 + RTestStepAviPlayCtrlSurfaceSupport* self =
1.2755 + static_cast<RTestStepAviPlayCtrlSurfaceSupport*> (aPtr);
1.2756 + self->DoPlayControllerCallBack();
1.2757 + return KErrNone;
1.2758 + }
1.2759 +
1.2760 +void RTestStepAviPlayCtrlSurfaceSupport::DoPlayControllerCallBack()
1.2761 + {
1.2762 + TInt error = iController.Play();
1.2763 + if (error != KErrNone)
1.2764 + {
1.2765 + ERR_PRINTF2(_L("Play failed with %d "), error);
1.2766 + StopTest(error, EFail);
1.2767 + }
1.2768 + }
1.2769 +
1.2770 +RTestStepAviPlayCtrlSurfaceRemovedNoUS::RTestStepAviPlayCtrlSurfaceRemovedNoUS(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.2771 +:RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController)
1.2772 + {
1.2773 + }
1.2774 +
1.2775 +void RTestStepAviPlayCtrlSurfaceRemovedNoUS::KickoffTestL()
1.2776 + {
1.2777 + // Allow parent to create some call backs for its initialization.
1.2778 + // Should open the video controller, set the filename, add the source and add the sink.
1.2779 + RAsyncTestStepAviCtrlPlayBase::KickoffTestL();
1.2780 +
1.2781 + // Call SurfaceRemoved
1.2782 + iSurfaceId = TSurfaceId::CreateNullId();
1.2783 +
1.2784 + TCallBack callbackSurfaceRemoved(SurfaceRemovedCallBack, this);
1.2785 + delete iKickoffSurfaceRemoved;
1.2786 + iKickoffSurfaceRemoved = NULL;
1.2787 + iKickoffSurfaceRemoved = new (ELeave) CAsyncCallBack(callbackSurfaceRemoved, CActive::EPriorityLow);
1.2788 + iKickoffSurfaceRemoved->Call();
1.2789 + }
1.2790 +
1.2791 +void RTestStepAviPlayCtrlSurfaceRemovedNoUS::CloseTest()
1.2792 + {
1.2793 + // no need to Cancel before deleting.
1.2794 + delete iKickoffSurfaceRemoved;
1.2795 + iKickoffSurfaceRemoved = NULL;
1.2796 +
1.2797 + RAsyncTestStepAviCtrlPlayBase::CloseTest();
1.2798 + }
1.2799 +
1.2800 +TInt RTestStepAviPlayCtrlSurfaceRemovedNoUS::SurfaceRemovedCallBack(TAny* aPtr)
1.2801 + {
1.2802 + RTestStepAviPlayCtrlSurfaceRemovedNoUS* self =
1.2803 + static_cast<RTestStepAviPlayCtrlSurfaceRemovedNoUS*> (aPtr);
1.2804 + self->DoSurfaceRemovedCallBack();
1.2805 + return KErrNone;
1.2806 + }
1.2807 +
1.2808 +void RTestStepAviPlayCtrlSurfaceRemovedNoUS::DoSurfaceRemovedCallBack()
1.2809 + {
1.2810 + TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId);
1.2811 +
1.2812 + if (iGceEnabled && error != KErrNotSupported)
1.2813 + {
1.2814 + ERR_PRINTF2(_L("SurfaceRemoved failed to return error KErrNotSupported. Actual error was %d "), error);
1.2815 + StopTest(KErrGeneral, EFail);
1.2816 + }
1.2817 + else if (!iGceEnabled && error != KErrNotSupported)
1.2818 + {
1.2819 + ERR_PRINTF2(_L("SurfaceRemoved failed to return KErrNotSupported. Actual result: %d."), error);
1.2820 + StopTest(error, EFail);
1.2821 + }
1.2822 + else
1.2823 + {
1.2824 + StopTest();
1.2825 + }
1.2826 + }
1.2827 +
1.2828 +RTestStepAviPlayCtrlGetSurfaceParametersNoUS::RTestStepAviPlayCtrlGetSurfaceParametersNoUS(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.2829 +:RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController)
1.2830 + {
1.2831 + }
1.2832 +
1.2833 +void RTestStepAviPlayCtrlGetSurfaceParametersNoUS::KickoffTestL()
1.2834 + {
1.2835 + // Allow parent to create some call backs for its initialization.
1.2836 + // Should open the video controller, set the filename, add the source and add the sink.
1.2837 + RAsyncTestStepAviCtrlPlayBase::KickoffTestL();
1.2838 +
1.2839 + // Get the surface parameters.
1.2840 + TCallBack callbackGetSurfaceParameters(GetSurfaceParametersCallBack, this);
1.2841 + delete iKickoffGetSurfaceParameters;
1.2842 + iKickoffGetSurfaceParameters = NULL;
1.2843 + iKickoffGetSurfaceParameters = new (ELeave) CAsyncCallBack(callbackGetSurfaceParameters, CActive::EPriorityLow);
1.2844 + iKickoffGetSurfaceParameters->Call();
1.2845 + }
1.2846 +
1.2847 +void RTestStepAviPlayCtrlGetSurfaceParametersNoUS::CloseTest()
1.2848 + {
1.2849 + // no need to Cancel before deleting.
1.2850 + delete iKickoffGetSurfaceParameters;
1.2851 + iKickoffGetSurfaceParameters = NULL;
1.2852 +
1.2853 + RAsyncTestStepAviCtrlPlayBase::CloseTest();
1.2854 + }
1.2855 +
1.2856 +TInt RTestStepAviPlayCtrlGetSurfaceParametersNoUS::GetSurfaceParametersCallBack(TAny* aPtr)
1.2857 + {
1.2858 + RTestStepAviPlayCtrlGetSurfaceParametersNoUS* self =
1.2859 + static_cast<RTestStepAviPlayCtrlGetSurfaceParametersNoUS*> (aPtr);
1.2860 + self->DoGetSurfaceParametersCallBack();
1.2861 + return KErrNone;
1.2862 + }
1.2863 +
1.2864 +void RTestStepAviPlayCtrlGetSurfaceParametersNoUS::DoGetSurfaceParametersCallBack()
1.2865 + {
1.2866 + TSurfaceId surfaceID;
1.2867 + TRect cropRect;
1.2868 + TVideoAspectRatio pixelAspectRatio;
1.2869 +
1.2870 + TInt error = iVpsCommands.GetSurfaceParameters(surfaceID, cropRect, pixelAspectRatio);
1.2871 +
1.2872 + if (iGceEnabled && error != KErrNotSupported)
1.2873 + {
1.2874 + ERR_PRINTF2(_L("GetSurfaceParameters failed to return error KErrNotSupported. Actual error was %d "), error);
1.2875 + StopTest(KErrGeneral, EFail);
1.2876 + }
1.2877 + else if (!iGceEnabled && error != KErrNotSupported)
1.2878 + {
1.2879 + ERR_PRINTF2(_L("GetSurfaceParameters failed to return KErrNotSupported. Actual result: %d."), error);
1.2880 + StopTest(error, EFail);
1.2881 + }
1.2882 + else
1.2883 + {
1.2884 + StopTest();
1.2885 + }
1.2886 + }
1.2887 +
1.2888 +RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.2889 +:RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController)
1.2890 + {
1.2891 + }
1.2892 +
1.2893 +void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::KickoffTestL()
1.2894 + {
1.2895 + // Allow parent to create some call backs for its initialization.
1.2896 + // Should open the video controller, set the filename, add the source and add the sink.
1.2897 + RAsyncTestStepAviCtrlPlayBase::KickoffTestL();
1.2898 +
1.2899 + // Call UseSurfaces
1.2900 + TCallBack callbackUseSurfaces(UseSurfacesCallBack, this);
1.2901 + delete iKickoffUseSurfaces;
1.2902 + iKickoffUseSurfaces = NULL;
1.2903 + iKickoffUseSurfaces = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow);
1.2904 + iKickoffUseSurfaces->Call();
1.2905 +
1.2906 + // Call SurfaceRemoved
1.2907 + iSurfaceId = TSurfaceId::CreateNullId();
1.2908 +
1.2909 + TCallBack callbackSurfaceRemoved(SurfaceRemovedCallBack, this);
1.2910 + delete iKickoffSurfaceRemoved;
1.2911 + iKickoffSurfaceRemoved = NULL;
1.2912 + iKickoffSurfaceRemoved = new (ELeave) CAsyncCallBack(callbackSurfaceRemoved, CActive::EPriorityLow);
1.2913 + iKickoffSurfaceRemoved->Call();
1.2914 + }
1.2915 +
1.2916 +void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::CloseTest()
1.2917 + {
1.2918 + // no need to Cancel before deleting.
1.2919 + delete iKickoffSurfaceRemoved;
1.2920 + iKickoffSurfaceRemoved = NULL;
1.2921 +
1.2922 + RAsyncTestStepAviCtrlPlayBase::CloseTest();
1.2923 + }
1.2924 +
1.2925 +TInt RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::SurfaceRemovedCallBack(TAny* aPtr)
1.2926 + {
1.2927 + RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId* self =
1.2928 + static_cast<RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId*> (aPtr);
1.2929 + self->DoSurfaceRemovedCallBack();
1.2930 + return KErrNone;
1.2931 + }
1.2932 +
1.2933 +void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::DoSurfaceRemovedCallBack()
1.2934 + {
1.2935 + TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId);
1.2936 +
1.2937 + if (iGceEnabled && error != KErrArgument)
1.2938 + {
1.2939 + ERR_PRINTF2(_L("SurfaceRemoved failed to return error KErrArgument. Actual error was %d "), error);
1.2940 + StopTest(KErrGeneral, EFail);
1.2941 + }
1.2942 + else if (!iGceEnabled && error != KErrNotSupported)
1.2943 + {
1.2944 + ERR_PRINTF2(_L("SurfaceRemoved failed to return KErrNotSupported. Actual result: %d."), error);
1.2945 + StopTest(error, EFail);
1.2946 + }
1.2947 + else
1.2948 + {
1.2949 + StopTest();
1.2950 + }
1.2951 + }
1.2952 +
1.2953 +TInt RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::UseSurfacesCallBack(TAny* aPtr)
1.2954 + {
1.2955 + RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId* self =
1.2956 + static_cast<RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId*> (aPtr);
1.2957 + self->DoUseSurfacesCallBack();
1.2958 + return KErrNone;
1.2959 + }
1.2960 +
1.2961 +void RTestStepAviPlayCtrlSurfaceRemovedNullSurfaceId::DoUseSurfacesCallBack()
1.2962 + {
1.2963 + TInt error = iVpsCommands.UseSurfaces();
1.2964 +
1.2965 + if (iGceEnabled && error != KErrNone)
1.2966 + {
1.2967 + ERR_PRINTF2(_L("UseSurfaces failed with code %d."), error);
1.2968 + StopTest(error, EFail);
1.2969 + }
1.2970 + else if (!iGceEnabled && error != KErrNotSupported)
1.2971 + {
1.2972 + ERR_PRINTF2(_L("UseSurfaces failed to return KErrNotSupported. Actual result: %d."), error);
1.2973 + StopTest(error, EFail);
1.2974 + }
1.2975 + }
1.2976 +
1.2977 +RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.2978 +:RAsyncTestStepAviCtrlPlayBase(aTestName, aSectName, aKeyName, aControllerUid), iVpsCommands(iController)
1.2979 + {
1.2980 + }
1.2981 +
1.2982 +void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::KickoffTestL()
1.2983 + {
1.2984 + // Allow parent to create some call backs for its initialization.
1.2985 + // Should open the video controller, set the filename, add the source and add the sink.
1.2986 + RAsyncTestStepAviCtrlPlayBase::KickoffTestL();
1.2987 +
1.2988 + // Call UseSurfaces
1.2989 + TCallBack callbackUseSurfaces(UseSurfacesCallBack, this);
1.2990 + delete iKickoffUseSurfaces;
1.2991 + iKickoffUseSurfaces = NULL;
1.2992 + iKickoffUseSurfaces = new (ELeave) CAsyncCallBack(callbackUseSurfaces, CActive::EPriorityLow);
1.2993 + iKickoffUseSurfaces->Call();
1.2994 +
1.2995 + // Call SurfaceRemoved
1.2996 + iSurfaceId.iInternal[0] = 1111;
1.2997 + iSurfaceId.iInternal[1] = 1111;
1.2998 + iSurfaceId.iInternal[2] = 1111;
1.2999 + iSurfaceId.iInternal[3] = 1111;
1.3000 +
1.3001 + TCallBack callbackSurfaceRemoved(SurfaceRemovedCallBack, this);
1.3002 + delete iKickoffSurfaceRemoved;
1.3003 + iKickoffSurfaceRemoved = NULL;
1.3004 + iKickoffSurfaceRemoved = new (ELeave) CAsyncCallBack(callbackSurfaceRemoved, CActive::EPriorityLow);
1.3005 + iKickoffSurfaceRemoved->Call();
1.3006 + }
1.3007 +
1.3008 +void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::CloseTest()
1.3009 + {
1.3010 + // no need to Cancel before deleting.
1.3011 + delete iKickoffSurfaceRemoved;
1.3012 + iKickoffSurfaceRemoved = NULL;
1.3013 +
1.3014 + RAsyncTestStepAviCtrlPlayBase::CloseTest();
1.3015 + }
1.3016 +
1.3017 +TInt RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::SurfaceRemovedCallBack(TAny* aPtr)
1.3018 + {
1.3019 + RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId* self =
1.3020 + static_cast<RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId*> (aPtr);
1.3021 + self->DoSurfaceRemovedCallBack();
1.3022 + return KErrNone;
1.3023 + }
1.3024 +
1.3025 +void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::DoSurfaceRemovedCallBack()
1.3026 + {
1.3027 + TInt error = iVpsCommands.SurfaceRemoved(iSurfaceId);
1.3028 +
1.3029 + if (iGceEnabled && error != KErrNotReady)
1.3030 + {
1.3031 + ERR_PRINTF2(_L("SurfaceRemoved failed to return error KErrNotReady. Actual error was %d "), error);
1.3032 + StopTest(KErrGeneral, EFail);
1.3033 + }
1.3034 + else if (!iGceEnabled && error != KErrNotSupported)
1.3035 + {
1.3036 + ERR_PRINTF2(_L("SurfaceRemoved failed to return KErrNotSupported. Actual result: %d."), error);
1.3037 + StopTest(error, EFail);
1.3038 + }
1.3039 + else
1.3040 + {
1.3041 + StopTest();
1.3042 + }
1.3043 + }
1.3044 +
1.3045 +TInt RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::UseSurfacesCallBack(TAny* aPtr)
1.3046 + {
1.3047 + RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId* self =
1.3048 + static_cast<RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId*> (aPtr);
1.3049 + self->DoUseSurfacesCallBack();
1.3050 + return KErrNone;
1.3051 + }
1.3052 +
1.3053 +void RTestStepAviPlayCtrlSurfaceRemovedInvalidSurfaceId::DoUseSurfacesCallBack()
1.3054 + {
1.3055 + TInt error = iVpsCommands.UseSurfaces();
1.3056 +
1.3057 + if (iGceEnabled && error != KErrNone)
1.3058 + {
1.3059 + ERR_PRINTF2(_L("UseSurfaces failed with code %d."), error);
1.3060 + StopTest(error, EFail);
1.3061 + }
1.3062 + else if (!iGceEnabled && error != KErrNotSupported)
1.3063 + {
1.3064 + ERR_PRINTF2(_L("UseSurfaces failed to return KErrNotSupported. Actual result: %d."), error);
1.3065 + StopTest(error, EFail);
1.3066 + }
1.3067 + }
1.3068 +
1.3069 +#endif // SYMBIAN_BUILD_GCE
1.3070 +
1.3071 +#ifdef SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT
1.3072 +
1.3073 +//
1.3074 +// RAsyncTestSubtitlePlay
1.3075 +//
1.3076 +RAsyncTestSubtitlePlay::RAsyncTestSubtitlePlay(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3077 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3078 + {
1.3079 + SetExpectedCrpReadyCount(1);
1.3080 + }
1.3081 +
1.3082 +void RAsyncTestSubtitlePlay::OnOpenCompleteL()
1.3083 + {
1.3084 + CheckAndEnableSubtitlesL();
1.3085 + AddDefaultSubtitleConfL();
1.3086 +
1.3087 + RArray<TLanguage> languages;
1.3088 + CleanupClosePushL(languages);
1.3089 + TRAPD(err, iSubtitleCommands.GetSupportedSubtitleLanguagesL(languages));
1.3090 +
1.3091 + if (err != KErrNotSupported)
1.3092 + {
1.3093 + ERR_PRINTF3(_L("GetSupportedSubtitleLanguagesL left with %d; expected %d"), err, KErrNotSupported);
1.3094 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3095 + }
1.3096 +
1.3097 + if (languages.Count() != 0)
1.3098 + {
1.3099 + ERR_PRINTF2(_L("GetSupportedSubtitleLanguagesL returned %d languages"), languages.Count());
1.3100 + User::Leave(KErrGeneral);
1.3101 + }
1.3102 +
1.3103 + CleanupStack::PopAndDestroy(); // languages
1.3104 +
1.3105 + TLanguage language = ELangNone;
1.3106 + err = iSubtitleCommands.GetSubtitleLanguage(language);
1.3107 +
1.3108 + if (err != KErrNotSupported)
1.3109 + {
1.3110 + ERR_PRINTF3(_L("GetSubtitleLanguage failed with %d; expected %d"), err, KErrNotSupported);
1.3111 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3112 + }
1.3113 +
1.3114 + if (language != ELangNone)
1.3115 + {
1.3116 + ERR_PRINTF3(_L("GetSubtitleLanguage returned %d, expected %d"), language, ELangNone);
1.3117 + User::Leave(KErrGeneral);
1.3118 + }
1.3119 +
1.3120 + err = iSubtitleCommands.SetSubtitleLanguage(ELangCanadianEnglish);
1.3121 +
1.3122 + if (err != KErrNotSupported)
1.3123 + {
1.3124 + ERR_PRINTF3(_L("SetSubtitleLanguage failed with %d, expected %d"), err, KErrNotSupported);
1.3125 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3126 + }
1.3127 +
1.3128 + StartPlaybackL();
1.3129 + }
1.3130 +
1.3131 +void RAsyncTestSubtitlePlay::OnPlayCompleteL()
1.3132 + {
1.3133 + RemoveConfigDisableL();
1.3134 + }
1.3135 +
1.3136 +//
1.3137 +// RAsyncTestSubtitleUpdateConfig
1.3138 +//
1.3139 +RAsyncTestSubtitleUpdateConfig::RAsyncTestSubtitleUpdateConfig(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3140 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3141 + {
1.3142 + SetExpectedCrpReadyCount(2);
1.3143 + }
1.3144 +
1.3145 +void RAsyncTestSubtitleUpdateConfig::OnOpenCompleteL()
1.3146 + {
1.3147 + CheckAndEnableSubtitlesL();
1.3148 + AddDefaultSubtitleConfL();
1.3149 +
1.3150 + TMMFSubtitleWindowConfig config;
1.3151 + config.iWindowId = KWindowIdValid;
1.3152 + config.iDisplayMode = EColor16MA;
1.3153 + config.iRotation = EVideoRotationClockwise90;
1.3154 + config.iWindowClipRect = KWindowClipRectAlt1;
1.3155 + TInt err = iSubtitleCommands.UpdateSubtitleConfig(config);
1.3156 +
1.3157 + if (err != KErrNone)
1.3158 + {
1.3159 + ERR_PRINTF2(_L("UpdateSubtitleConfig failed with %d"), err);
1.3160 + User::Leave(err);
1.3161 + }
1.3162 +
1.3163 + StartPlaybackL();
1.3164 + }
1.3165 +
1.3166 +void RAsyncTestSubtitleUpdateConfig::OnPlayCompleteL()
1.3167 + {
1.3168 + RemoveConfigDisableL();
1.3169 + }
1.3170 +
1.3171 +//
1.3172 +// RAsyncTestSubtitleUpdateDuring
1.3173 +//
1.3174 +
1.3175 +CCallBackTimer* CCallBackTimer::NewL(const TCallBack& aCallBack, TInt aPriority)
1.3176 + {
1.3177 + CCallBackTimer* self = new (ELeave) CCallBackTimer(aCallBack, aPriority);
1.3178 + CleanupStack::PushL(self);
1.3179 + self->ConstructL();
1.3180 + CleanupStack::Pop();
1.3181 + return self;
1.3182 + }
1.3183 +
1.3184 +CCallBackTimer::CCallBackTimer(const TCallBack& aCallBack, TInt aPriority)
1.3185 + : CTimer(aPriority), iCallBack(aCallBack)
1.3186 + {
1.3187 + CActiveScheduler::Add(this);
1.3188 + }
1.3189 +
1.3190 +void CCallBackTimer::RunL()
1.3191 + {
1.3192 + User::LeaveIfError(iCallBack.CallBack());
1.3193 + }
1.3194 +
1.3195 +RAsyncTestSubtitleUpdateDuring::RAsyncTestSubtitleUpdateDuring(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3196 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3197 + {
1.3198 + SetExpectedCrpReadyCount(2);
1.3199 + }
1.3200 +
1.3201 +void RAsyncTestSubtitleUpdateDuring::KickoffTestL()
1.3202 + {
1.3203 + TCallBack callBack(DuringPlaybackCallBack, this);
1.3204 + iCallBackTimer = CCallBackTimer::NewL(callBack, CTimer::EPriorityStandard);
1.3205 + iHasUpdated = EFalse;
1.3206 + RAsyncTestStepSubtitleBase::KickoffTestL();
1.3207 + }
1.3208 +
1.3209 +void RAsyncTestSubtitleUpdateDuring::CloseTest()
1.3210 + {
1.3211 + delete iCallBackTimer;
1.3212 + iCallBackTimer = NULL;
1.3213 + RAsyncTestStepSubtitleBase::CloseTest();
1.3214 + }
1.3215 +
1.3216 +TInt RAsyncTestSubtitleUpdateDuring::DuringPlaybackCallBack(TAny* aPtr)
1.3217 + {
1.3218 + RAsyncTestSubtitleUpdateDuring* self = static_cast<RAsyncTestSubtitleUpdateDuring*>(aPtr);
1.3219 + self->OnDuringPlayback();
1.3220 + return KErrNone;
1.3221 + }
1.3222 +
1.3223 +void RAsyncTestSubtitleUpdateDuring::OnOpenCompleteL()
1.3224 + {
1.3225 + CheckAndEnableSubtitlesL();
1.3226 + AddDefaultSubtitleConfL();
1.3227 +
1.3228 + // Start the call back timer. Will trigger the during playback handler.
1.3229 + iCallBackTimer->After(2500000);
1.3230 +
1.3231 + StartPlaybackL();
1.3232 + }
1.3233 +
1.3234 +void RAsyncTestSubtitleUpdateDuring::OnDuringPlayback()
1.3235 + {
1.3236 + TMMFSubtitleWindowConfig config;
1.3237 + config.iWindowId = KWindowIdValid;
1.3238 + config.iDisplayMode = EColor16MA;
1.3239 + config.iRotation = EVideoRotationClockwise90;
1.3240 + config.iWindowClipRect = KWindowClipRectAlt1;
1.3241 + TInt err = iSubtitleCommands.UpdateSubtitleConfig(config);
1.3242 +
1.3243 + if (err != KErrNone)
1.3244 + {
1.3245 + ERR_PRINTF2(_L("UpdateSubtitleConfig during playback failed with %d"), err);
1.3246 + StopTest(err, EFail);
1.3247 + }
1.3248 + else
1.3249 + {
1.3250 + iHasUpdated = ETrue;
1.3251 + }
1.3252 + }
1.3253 +
1.3254 +void RAsyncTestSubtitleUpdateDuring::OnPlayCompleteL()
1.3255 + {
1.3256 + RemoveConfigDisableL();
1.3257 +
1.3258 + if (!iHasUpdated)
1.3259 + {
1.3260 + ERR_PRINTF1(_L("Subtitle configuration was not updated during playback."));
1.3261 + User::Leave(KErrGeneral);
1.3262 + }
1.3263 + }
1.3264 +
1.3265 +//
1.3266 +// RAsyncTestSubtitleRemoveAdd
1.3267 +//
1.3268 +RAsyncTestSubtitleRemoveAdd::RAsyncTestSubtitleRemoveAdd(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3269 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3270 + {
1.3271 + SetExpectedCrpReadyCount(2);
1.3272 + }
1.3273 +
1.3274 +void RAsyncTestSubtitleRemoveAdd::OnOpenCompleteL()
1.3275 + {
1.3276 + CheckAndEnableSubtitlesL();
1.3277 + AddDefaultSubtitleConfL();
1.3278 +
1.3279 + TInt err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdValid);
1.3280 +
1.3281 + if (err != KErrNone)
1.3282 + {
1.3283 + ERR_PRINTF2(_L("RemoveSubtitleConfig failed with %d"), err);
1.3284 + User::Leave(err);
1.3285 + }
1.3286 +
1.3287 + TMMFSubtitleWindowConfig config;
1.3288 + config.iWindowId = KWindowIdValid;
1.3289 + config.iDisplayMode = EColor16MA;
1.3290 + config.iRotation = EVideoRotationClockwise270;
1.3291 + config.iWindowClipRect = KWindowClipRectAlt2;
1.3292 + err = iSubtitleCommands.AddSubtitleConfig(config);
1.3293 +
1.3294 + if (err != KErrNone)
1.3295 + {
1.3296 + ERR_PRINTF2(_L("AddSubtitleConfig failed with %d"), err);
1.3297 + User::Leave(err);
1.3298 + }
1.3299 +
1.3300 + StartPlaybackL();
1.3301 + }
1.3302 +
1.3303 +void RAsyncTestSubtitleRemoveAdd::OnPlayCompleteL()
1.3304 + {
1.3305 + RemoveConfigDisableL();
1.3306 + }
1.3307 +
1.3308 +//
1.3309 +// RAsyncTestSubtitleNotEnabled
1.3310 +//
1.3311 +RAsyncTestSubtitleNotEnabled::RAsyncTestSubtitleNotEnabled(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3312 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3313 + {
1.3314 + SetExpectedCrpReadyCount(0);
1.3315 + }
1.3316 +
1.3317 +void RAsyncTestSubtitleNotEnabled::OnOpenCompleteL()
1.3318 + {
1.3319 + // Make sure that subtitles are available:
1.3320 + TBool available = EFalse;
1.3321 + TInt err = iSubtitleCommands.GetSubtitlesAvailable(available);
1.3322 +
1.3323 + if (err != KErrNone)
1.3324 + {
1.3325 + ERR_PRINTF2(_L("GetSubtitlesAvailable failed with %d"), err);
1.3326 + User::Leave(err);
1.3327 + }
1.3328 +
1.3329 + if (!available)
1.3330 + {
1.3331 + ERR_PRINTF1(_L("Subtitles unavailable"));
1.3332 + User::Leave(KErrGeneral);
1.3333 + }
1.3334 +
1.3335 + // Perform severy subtitle related functions without enabling subtitles.
1.3336 + TMMFSubtitleWindowConfig config;
1.3337 + config.iWindowId = KWindowIdValid;
1.3338 + config.iDisplayMode = EColor16MA;
1.3339 + config.iRotation = EVideoRotationNone;
1.3340 + config.iWindowClipRect = KWindowClipRectFull;
1.3341 +
1.3342 + err = iSubtitleCommands.AddSubtitleConfig(config);
1.3343 + if (err != KErrNotReady)
1.3344 + {
1.3345 + ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrNotReady);
1.3346 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3347 + }
1.3348 +
1.3349 + err = iSubtitleCommands.UpdateSubtitleConfig(config);
1.3350 + if (err != KErrNotReady)
1.3351 + {
1.3352 + ERR_PRINTF3(_L("UpdateSubtitleConfig returned %d; expected %d"), err, KErrNotReady);
1.3353 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3354 + }
1.3355 +
1.3356 + RArray<TLanguage> languages;
1.3357 + TRAP(err, iSubtitleCommands.GetSupportedSubtitleLanguagesL(languages));
1.3358 + languages.Close();
1.3359 +
1.3360 + if (err != KErrNotReady)
1.3361 + {
1.3362 + ERR_PRINTF3(_L("GetSupportedSubtitleLanguagesL left with %d; expected %d"), err, KErrNotReady);
1.3363 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3364 + }
1.3365 +
1.3366 + TLanguage language = ELangNone;
1.3367 + err = iSubtitleCommands.GetSubtitleLanguage(language);
1.3368 +
1.3369 + if (err != KErrNotReady)
1.3370 + {
1.3371 + ERR_PRINTF3(_L("GetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady);
1.3372 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3373 + }
1.3374 +
1.3375 + err = iSubtitleCommands.SetSubtitleLanguage(ELangCanadianEnglish);
1.3376 +
1.3377 + if (err != KErrNotReady)
1.3378 + {
1.3379 + ERR_PRINTF3(_L("SetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady);
1.3380 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3381 + }
1.3382 +
1.3383 + StartPlaybackL();
1.3384 + }
1.3385 +
1.3386 +void RAsyncTestSubtitleNotEnabled::OnPlayCompleteL()
1.3387 + {
1.3388 + TInt err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdValid);
1.3389 +
1.3390 + if (err != KErrNotReady)
1.3391 + {
1.3392 + ERR_PRINTF3(_L("RemoveSubtitleConfig returned %d; expected %d"), err, KErrNotReady);
1.3393 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3394 + }
1.3395 +
1.3396 + err = iSubtitleCommands.DisableSubtitles();
1.3397 +
1.3398 + if (err != KErrNone)
1.3399 + {
1.3400 + ERR_PRINTF3(_L("DisableSubtitles returned %d; expected %d"), err, KErrNone);
1.3401 + User::Leave(err);
1.3402 + }
1.3403 + }
1.3404 +
1.3405 +//
1.3406 +// RAsyncTestSubtitleNotAvailable
1.3407 +//
1.3408 +RAsyncTestSubtitleNotAvailable::RAsyncTestSubtitleNotAvailable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3409 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3410 + {
1.3411 + SetExpectedCrpReadyCount(0);
1.3412 + }
1.3413 +
1.3414 +void RAsyncTestSubtitleNotAvailable::OnOpenCompleteL()
1.3415 + {
1.3416 + // Make sure that subtitles are available:
1.3417 + TBool available = EFalse;
1.3418 + TInt err = iSubtitleCommands.GetSubtitlesAvailable(available);
1.3419 +
1.3420 + if (err != KErrNone)
1.3421 + {
1.3422 + ERR_PRINTF2(_L("GetSubtitlesAvailable failed with %d"), err);
1.3423 + User::Leave(err);
1.3424 + }
1.3425 +
1.3426 + if (available)
1.3427 + {
1.3428 + ERR_PRINTF1(_L("Subtitles available, but should not be"));
1.3429 + User::Leave(KErrGeneral);
1.3430 + }
1.3431 +
1.3432 + err = iSubtitleCommands.EnableSubtitles();
1.3433 +
1.3434 + if (err != KErrNotFound)
1.3435 + {
1.3436 + ERR_PRINTF3(_L("EnableSubtitles returned %d; expected %d"), err, KErrNotFound);
1.3437 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3438 + }
1.3439 +
1.3440 + // Perform severy subtitle related functions without enabling subtitles.
1.3441 + TMMFSubtitleWindowConfig config;
1.3442 + config.iWindowId = KWindowIdValid;
1.3443 + config.iDisplayMode = EColor16MA;
1.3444 + config.iRotation = EVideoRotationNone;
1.3445 + config.iWindowClipRect = KWindowClipRectFull;
1.3446 +
1.3447 + err = iSubtitleCommands.AddSubtitleConfig(config);
1.3448 + if (err != KErrNotReady)
1.3449 + {
1.3450 + ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrNotReady);
1.3451 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3452 + }
1.3453 +
1.3454 + err = iSubtitleCommands.UpdateSubtitleConfig(config);
1.3455 + if (err != KErrNotReady)
1.3456 + {
1.3457 + ERR_PRINTF3(_L("UpdateSubtitleConfig returned %d; expected %d"), err, KErrNotReady);
1.3458 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3459 + }
1.3460 +
1.3461 + RArray<TLanguage> languages;
1.3462 + TRAP(err, iSubtitleCommands.GetSupportedSubtitleLanguagesL(languages));
1.3463 + languages.Close();
1.3464 +
1.3465 + if (err != KErrNotReady)
1.3466 + {
1.3467 + ERR_PRINTF3(_L("GetSupportedSubtitleLanguagesL left with %d; expected %d"), err, KErrNotReady);
1.3468 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3469 + }
1.3470 +
1.3471 + TLanguage language = ELangNone;
1.3472 + err = iSubtitleCommands.GetSubtitleLanguage(language);
1.3473 +
1.3474 + if (err != KErrNotReady)
1.3475 + {
1.3476 + ERR_PRINTF3(_L("GetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady);
1.3477 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3478 + }
1.3479 +
1.3480 + err = iSubtitleCommands.SetSubtitleLanguage(ELangCanadianEnglish);
1.3481 +
1.3482 + if (err != KErrNotReady)
1.3483 + {
1.3484 + ERR_PRINTF3(_L("SetSubtitleLanguage returned %d; expected %d"), err, KErrNotReady);
1.3485 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3486 + }
1.3487 +
1.3488 + StartPlaybackL();
1.3489 + }
1.3490 +
1.3491 +void RAsyncTestSubtitleNotAvailable::OnPlayCompleteL()
1.3492 + {
1.3493 + TInt err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdValid);
1.3494 +
1.3495 + if (err != KErrNotReady)
1.3496 + {
1.3497 + ERR_PRINTF3(_L("RemoveSubtitleConfig returned %d; expected %d"), err, KErrNotReady);
1.3498 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3499 + }
1.3500 +
1.3501 + err = iSubtitleCommands.DisableSubtitles();
1.3502 +
1.3503 + if (err != KErrNone)
1.3504 + {
1.3505 + ERR_PRINTF3(_L("DisableSubtitles returned %d; expected %d"), err, KErrNone);
1.3506 + User::Leave(err);
1.3507 + }
1.3508 + }
1.3509 +
1.3510 +//
1.3511 +// RAsyncTestSubtitleMismatchedId
1.3512 +//
1.3513 +RAsyncTestSubtitleMismatchedId::RAsyncTestSubtitleMismatchedId(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3514 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3515 + {
1.3516 + SetExpectedCrpReadyCount(1);
1.3517 + }
1.3518 +
1.3519 +void RAsyncTestSubtitleMismatchedId::OnOpenCompleteL()
1.3520 + {
1.3521 + CheckAndEnableSubtitlesL();
1.3522 + AddDefaultSubtitleConfL();
1.3523 +
1.3524 + TMMFSubtitleWindowConfig config;
1.3525 + config.iWindowId = KWindowIdMismatched;
1.3526 + config.iDisplayMode = EColor16MA;
1.3527 + config.iRotation = EVideoRotationClockwise90;
1.3528 + config.iWindowClipRect = KWindowClipRectAlt1;
1.3529 +
1.3530 + TInt err = iSubtitleCommands.UpdateSubtitleConfig(config);
1.3531 + if (err != KErrNotFound)
1.3532 + {
1.3533 + ERR_PRINTF3(_L("UpdateSubtitleConfig returned %d; expected %d"), err, KErrNotFound);
1.3534 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3535 + }
1.3536 +
1.3537 + err = iSubtitleCommands.RemoveSubtitleConfig(KWindowIdMismatched);
1.3538 + if (err != KErrNotFound)
1.3539 + {
1.3540 + ERR_PRINTF3(_L("RemoveSubtitleConfig returned %d; expected %d"), err, KErrNotFound);
1.3541 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3542 + }
1.3543 +
1.3544 + TWsGraphicId id(TWsGraphicId::EUninitialized);
1.3545 + TRect rect;
1.3546 + err = iSubtitleCommands.GetCrpParameters(KWindowIdMismatched, id, rect);
1.3547 + if (err != KErrNotFound)
1.3548 + {
1.3549 + ERR_PRINTF3(_L("GetCrpParameters returned %d; expected %d"), err, KErrNotFound);
1.3550 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3551 + }
1.3552 +
1.3553 + // If we haven't left yet then the test passes.
1.3554 + StopTest();
1.3555 + }
1.3556 +
1.3557 +//
1.3558 +// RAsyncTestSubtitleDoubleCall
1.3559 +//
1.3560 +RAsyncTestSubtitleDoubleCall::RAsyncTestSubtitleDoubleCall(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3561 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3562 + {
1.3563 + SetExpectedCrpReadyCount(1);
1.3564 + }
1.3565 +
1.3566 +void RAsyncTestSubtitleDoubleCall::OnOpenCompleteL()
1.3567 + {
1.3568 + TBool available = EFalse;
1.3569 +
1.3570 + TInt err = iSubtitleCommands.GetSubtitlesAvailable(available);
1.3571 +
1.3572 + if (err != KErrNone)
1.3573 + {
1.3574 + ERR_PRINTF2(_L("GetSubtitlesAvailable failed with %d"), err);
1.3575 + User::Leave(err);
1.3576 + }
1.3577 +
1.3578 + if (!available)
1.3579 + {
1.3580 + ERR_PRINTF1(_L("Subtitles unavailable"));
1.3581 + User::Leave(KErrGeneral);
1.3582 + }
1.3583 +
1.3584 + // Disable subtitles when they are not enabled.
1.3585 + err = iSubtitleCommands.DisableSubtitles();
1.3586 + if (err != KErrNone)
1.3587 + {
1.3588 + ERR_PRINTF2(_L("DisableSubtitles failed with %d"), err);
1.3589 + User::Leave(err);
1.3590 + }
1.3591 +
1.3592 + err = iSubtitleCommands.EnableSubtitles();
1.3593 + if (err != KErrNone)
1.3594 + {
1.3595 + ERR_PRINTF2(_L("EnableSubtitles failed with %d"), err);
1.3596 + User::Leave(err);
1.3597 + }
1.3598 +
1.3599 + // Enable subtitles when they are already enabled.
1.3600 + err = iSubtitleCommands.EnableSubtitles();
1.3601 + if (err != KErrInUse)
1.3602 + {
1.3603 + ERR_PRINTF3(_L("EnableSubtitles failed with %d; expecting %d when already enabled."), err, KErrInUse);
1.3604 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3605 + }
1.3606 +
1.3607 + AddDefaultSubtitleConfL();
1.3608 + StartPlaybackL();
1.3609 + }
1.3610 +
1.3611 +void RAsyncTestSubtitleDoubleCall::OnPlayCompleteL()
1.3612 + {
1.3613 + RemoveConfigDisableL();
1.3614 +
1.3615 + // Disable subtitles when they are not enabled.
1.3616 + TInt err = iSubtitleCommands.DisableSubtitles();
1.3617 + if (err != KErrNone)
1.3618 + {
1.3619 + ERR_PRINTF2(_L("DisableSubtitles failed with %d"), err);
1.3620 + User::Leave(err);
1.3621 + }
1.3622 + }
1.3623 +
1.3624 +//
1.3625 +// RAsyncTestSubtitleMultipleConfigs
1.3626 +//
1.3627 +RAsyncTestSubtitleMultipleConfigs::RAsyncTestSubtitleMultipleConfigs(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TUid aControllerUid)
1.3628 + :RAsyncTestStepSubtitleBase(aTestName, aSectName, aKeyName, aControllerUid)
1.3629 + {
1.3630 + SetExpectedCrpReadyCount(1);
1.3631 + }
1.3632 +
1.3633 +void RAsyncTestSubtitleMultipleConfigs::OnOpenCompleteL()
1.3634 + {
1.3635 + CheckAndEnableSubtitlesL();
1.3636 + AddDefaultSubtitleConfL();
1.3637 +
1.3638 + TMMFSubtitleWindowConfig config;
1.3639 + config.iWindowId = KWindowIdValid;
1.3640 + config.iDisplayMode = EColor16MA;
1.3641 + config.iRotation = EVideoRotationClockwise90;
1.3642 + config.iWindowClipRect = KWindowClipRectAlt1;
1.3643 +
1.3644 + // Add a config with the same window ID.
1.3645 + TInt err = iSubtitleCommands.AddSubtitleConfig(config);
1.3646 + if (err != KErrArgument)
1.3647 + {
1.3648 + ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrArgument);
1.3649 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3650 + }
1.3651 +
1.3652 + // Add a config with a different ID.
1.3653 + config.iWindowId = KWindowIdValidAlt;
1.3654 + err = iSubtitleCommands.AddSubtitleConfig(config);
1.3655 + if (err != KErrInUse)
1.3656 + {
1.3657 + ERR_PRINTF3(_L("AddSubtitleConfig returned %d; expected %d"), err, KErrInUse);
1.3658 + User::Leave(err == KErrNone ? KErrGeneral : err);
1.3659 + }
1.3660 +
1.3661 + // If we haven't left yet then the test passes.
1.3662 + StopTest();
1.3663 + }
1.3664 +
1.3665 +#endif //SYMBIAN_MULTIMEDIA_SUBTITLE_SUPPORT