1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevVideo/src/TestDevVideoPlayFour.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1397 @@
1.4 +
1.5 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of "Eclipse Public License v1.0"
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// TestDevVideoPlay.cpp
1.19 +//
1.20 +//
1.21 +
1.22 +#include "TestDevVideoPlay.h"
1.23 +#include "TestDevVideoPlayTestData.h"
1.24 +#include "TestDevVideoPlugins/decoder.h"
1.25 +#include "TestDevVideoPlugins/postproc.h"
1.26 +#include <e32math.h>
1.27 +
1.28 +void CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(TInt aError)
1.29 + {
1.30 + INFO_PRINTF2(_L("CTestDevVideoPlayGetNewPictureInfo::MdvpoInitComplete(): Error = %d"), aError);
1.31 +
1.32 + iError = aError;
1.33 + }
1.34 +
1.35 +CTestDevVideoPlayGetNewPictureInfo::CTestDevVideoPlayGetNewPictureInfo(const TDesC& aTestName, TTestType aTestType)
1.36 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.37 + {
1.38 + }
1.39 +
1.40 +CTestDevVideoPlayGetNewPictureInfo* CTestDevVideoPlayGetNewPictureInfo::NewL(const TDesC& aTestName, TTestType aTestType)
1.41 + {
1.42 + CTestDevVideoPlayGetNewPictureInfo* self = new(ELeave) CTestDevVideoPlayGetNewPictureInfo(aTestName, aTestType);
1.43 + return self;
1.44 + }
1.45 +
1.46 +TVerdict CTestDevVideoPlayGetNewPictureInfo::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.47 + {
1.48 + TVerdict ret = EFail;
1.49 +
1.50 + INFO_PRINTF1(_L("CMMFDevVideoPlay: GetNewPictureInfo"));
1.51 +
1.52 + // expected results
1.53 + if (iTestType != ETestValid)
1.54 + {
1.55 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.56 + return EInconclusive;
1.57 + }
1.58 +
1.59 + TInt err = KErrNone;
1.60 +
1.61 +// THwDeviceId hwDecoder = 0;
1.62 +// THwDeviceId hwPostProc = 0;
1.63 +
1.64 + // select decoder
1.65 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.66 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.67 + if (err != KErrNone)
1.68 + {
1.69 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.70 + return EInconclusive;
1.71 + }
1.72 +
1.73 + // select post-processor
1.74 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.75 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.76 + if (err != KErrNone)
1.77 + {
1.78 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.79 + return EInconclusive;
1.80 + }
1.81 +
1.82 + //Tell plugin to start creating pictures.
1.83 + TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse));
1.84 + if (iError != KErrNone)
1.85 + {
1.86 + ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen"));
1.87 + return EInconclusive;
1.88 + }
1.89 +
1.90 + // initialize CDevVideoPlay and wait for response
1.91 + // iError is set by the MdvpoInitComplete callback
1.92 + aDevVideoPlay.Initialize();
1.93 +
1.94 + if (iError != KErrNone)
1.95 + {
1.96 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.97 + return EInconclusive;
1.98 + }
1.99 +
1.100 + aDevVideoPlay.Start();
1.101 +
1.102 + TUint numPictures = 0;
1.103 + TTimeIntervalMicroSeconds earliestTimeStamp(0);
1.104 + TTimeIntervalMicroSeconds latestTimeStamp(0);
1.105 +
1.106 +
1.107 + aDevVideoPlay.GetNewPictureInfo(numPictures, earliestTimeStamp, latestTimeStamp);
1.108 +
1.109 + if ((numPictures == 1)
1.110 + && (earliestTimeStamp == TTimeIntervalMicroSeconds(0))
1.111 + && (latestTimeStamp == TTimeIntervalMicroSeconds(0)))
1.112 + {
1.113 + ret = EPass;
1.114 + }
1.115 +
1.116 + return ret;
1.117 + }
1.118 +//------------------------------------------------------------------
1.119 +
1.120 +void CTestDevVideoPlayNextPicture::MdvpoInitComplete(TInt aError)
1.121 + {
1.122 + INFO_PRINTF2(_L("CTestDevVideoPlayNextPicture::MdvpoInitComplete(): Error = %d"), aError);
1.123 +
1.124 + iError = aError;
1.125 + }
1.126 +
1.127 +CTestDevVideoPlayNextPicture::CTestDevVideoPlayNextPicture(const TDesC& aTestName, TTestType aTestType)
1.128 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.129 + {
1.130 + }
1.131 +
1.132 +CTestDevVideoPlayNextPicture* CTestDevVideoPlayNextPicture::NewL(const TDesC& aTestName, TTestType aTestType)
1.133 + {
1.134 + CTestDevVideoPlayNextPicture* self = new(ELeave) CTestDevVideoPlayNextPicture(aTestName, aTestType);
1.135 + return self;
1.136 + }
1.137 +
1.138 +TVerdict CTestDevVideoPlayNextPicture::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.139 + {
1.140 + TVerdict ret = EPass;
1.141 +
1.142 + INFO_PRINTF1(_L("CMMFDevVideoPlay: NextPicture"));
1.143 +
1.144 + // expected results
1.145 + if (iTestType != ETestValid)
1.146 + {
1.147 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.148 + return EInconclusive;
1.149 + }
1.150 +
1.151 + TInt err = KErrNone;
1.152 +
1.153 +// THwDeviceId hwDecoder = 0;
1.154 +// THwDeviceId hwPostProc = 0;
1.155 +
1.156 + // select decoder
1.157 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.158 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));// EABI warning removal
1.159 + if (err != KErrNone)
1.160 + {
1.161 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.162 + return EInconclusive;
1.163 + }
1.164 +
1.165 + // select post-processor
1.166 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.167 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.168 + if (err != KErrNone)
1.169 + {
1.170 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.171 + return EInconclusive;
1.172 + }
1.173 +
1.174 + //Tell plugin to start creating pictures.
1.175 + TRAP(iError, aDevVideoPlay.SetVideoDestScreenL(EFalse));
1.176 + if (iError != KErrNone)
1.177 + {
1.178 + ERR_PRINTF1(_L("Error - couldn't SetVideoDestScreen"));
1.179 + return EInconclusive;
1.180 + }
1.181 +
1.182 + // initialize CDevVideoPlay and wait for response
1.183 + // iError is set by the MdvpoInitComplete callback
1.184 + aDevVideoPlay.Initialize();
1.185 +
1.186 + if (iError != KErrNone)
1.187 + {
1.188 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.189 + return EInconclusive;
1.190 + }
1.191 +
1.192 + iDevVideoPlay = &aDevVideoPlay;
1.193 + aDevVideoPlay.Start();//Tell plugin to start creating pictures.
1.194 + // We should now get a series of NewPicture() callbacks.
1.195 +
1.196 + if (iError == KErrNone)
1.197 + {
1.198 + ret = EPass;
1.199 + }
1.200 + else
1.201 + {
1.202 + ERR_PRINTF2(_L("Error - picture processing failed with error %d"), iError);
1.203 + }
1.204 +
1.205 + return ret;
1.206 + }
1.207 +
1.208 +void CTestDevVideoPlayNextPicture::MdvpoNewPictures()
1.209 + {
1.210 + TRAP(iError, DoNewPicturesL());
1.211 + }
1.212 +
1.213 +void CTestDevVideoPlayNextPicture::CheckNewPictureInfoL(TUint aNumPictures, const TTimeIntervalMicroSeconds& aFirst, const TTimeIntervalMicroSeconds& aLast)
1.214 + {
1.215 + TUint numPictures = 0;
1.216 + TTimeIntervalMicroSeconds first(0);
1.217 + TTimeIntervalMicroSeconds last(0);
1.218 + iDevVideoPlay->GetNewPictureInfo(numPictures, first, last);
1.219 +
1.220 + if ((numPictures!=aNumPictures) || (first!=aFirst) || (last!=aLast))
1.221 + {
1.222 + User::Leave(KErrGeneral);
1.223 + }
1.224 + }
1.225 +
1.226 +void CTestDevVideoPlayNextPicture::DoNewPicturesL()
1.227 + {
1.228 + User::LeaveIfError(iError);//Don't go any further if we have an error
1.229 + switch (iCurrentPictureNumber)
1.230 + {
1.231 + case 0:
1.232 + {
1.233 + iCurrentPictureNumber++;
1.234 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0));
1.235 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.236 + CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0));
1.237 + iDevVideoPlay->ReturnPicture(picture);
1.238 + break;
1.239 + }
1.240 + case 1:
1.241 + {
1.242 + iCurrentPictureNumber++;
1.243 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(1), TTimeIntervalMicroSeconds(1));
1.244 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.245 + CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0));
1.246 + iDevVideoPlay->ReturnPicture(picture);
1.247 + break;
1.248 + }
1.249 + case 2:
1.250 + {
1.251 + iCurrentPictureNumber++;
1.252 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(2), TTimeIntervalMicroSeconds(2));
1.253 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.254 + CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0));
1.255 + iDevVideoPlay->ReturnPicture(picture);
1.256 + break;
1.257 + }
1.258 + case 3:
1.259 + {
1.260 + iCurrentPictureNumber++;
1.261 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(3), TTimeIntervalMicroSeconds(3));
1.262 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.263 + iDevVideoPlay->ReturnPicture(picture);
1.264 + break;
1.265 + }
1.266 + case 4:
1.267 + {
1.268 + iCurrentPictureNumber++;
1.269 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(4), TTimeIntervalMicroSeconds(4));
1.270 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.271 + iDevVideoPlay->ReturnPicture(picture);
1.272 + break;
1.273 + }
1.274 + case 5:
1.275 + {
1.276 + iCurrentPictureNumber++;
1.277 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(5), TTimeIntervalMicroSeconds(5));
1.278 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.279 + iDevVideoPlay->ReturnPicture(picture);
1.280 + break;
1.281 + }
1.282 + case 6:
1.283 + {
1.284 + iCurrentPictureNumber++;
1.285 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(6));
1.286 + break;
1.287 + }
1.288 + case 7:
1.289 + {
1.290 + iCurrentPictureNumber++;
1.291 + CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(7));
1.292 + break;
1.293 + }
1.294 + case 8:
1.295 + {
1.296 + iCurrentPictureNumber++;
1.297 + CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(8));
1.298 + break;
1.299 + }
1.300 + case 9:
1.301 + {
1.302 + iCurrentPictureNumber++;
1.303 + CheckNewPictureInfoL(4, TTimeIntervalMicroSeconds(6), TTimeIntervalMicroSeconds(9));
1.304 + TVideoPicture* picture = iDevVideoPlay->NextPictureL();
1.305 + iDevVideoPlay->ReturnPicture(picture);
1.306 + CheckNewPictureInfoL(3, TTimeIntervalMicroSeconds(7), TTimeIntervalMicroSeconds(9));
1.307 + picture = iDevVideoPlay->NextPictureL();
1.308 + iDevVideoPlay->ReturnPicture(picture);
1.309 + CheckNewPictureInfoL(2, TTimeIntervalMicroSeconds(8), TTimeIntervalMicroSeconds(9));
1.310 + picture = iDevVideoPlay->NextPictureL();
1.311 + iDevVideoPlay->ReturnPicture(picture);
1.312 + CheckNewPictureInfoL(1, TTimeIntervalMicroSeconds(9), TTimeIntervalMicroSeconds(9));
1.313 + picture = iDevVideoPlay->NextPictureL();
1.314 + iDevVideoPlay->ReturnPicture(picture);
1.315 + CheckNewPictureInfoL(0, TTimeIntervalMicroSeconds(0), TTimeIntervalMicroSeconds(0));
1.316 + break;
1.317 + }
1.318 + default:
1.319 + User::Leave(KErrGeneral);
1.320 + break;
1.321 + };
1.322 + }
1.323 +
1.324 +
1.325 +
1.326 +//------------------------------------------------------------------
1.327 +
1.328 +void CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(TInt aError)
1.329 + {
1.330 + INFO_PRINTF2(_L("CTestDevVideoPlayGetSnapshot::MdvpoInitComplete(): Error = %d"), aError);
1.331 +
1.332 + iError = aError;
1.333 + }
1.334 +
1.335 +CTestDevVideoPlayGetSnapshot::CTestDevVideoPlayGetSnapshot(const TDesC& aTestName, TTestType aTestType)
1.336 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.337 + {
1.338 + }
1.339 +
1.340 +CTestDevVideoPlayGetSnapshot* CTestDevVideoPlayGetSnapshot::NewL(const TDesC& aTestName, TTestType aTestType)
1.341 + {
1.342 + CTestDevVideoPlayGetSnapshot* self = new(ELeave) CTestDevVideoPlayGetSnapshot(aTestName, aTestType);
1.343 + return self;
1.344 + }
1.345 +
1.346 +TVerdict CTestDevVideoPlayGetSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.347 + {
1.348 + TVerdict ret = EFail;
1.349 +
1.350 + INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSnapshot"));
1.351 +
1.352 + // expected results
1.353 + if (iTestType != ETestValid)
1.354 + {
1.355 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.356 + return EInconclusive;
1.357 + }
1.358 +
1.359 + TInt err = KErrNone;
1.360 +
1.361 +// THwDeviceId hwDecoder = 0;
1.362 +// THwDeviceId hwPostProc = 0;
1.363 +
1.364 + // select decoder
1.365 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.366 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.367 + if (err != KErrNone)
1.368 + {
1.369 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.370 + return EInconclusive;
1.371 + }
1.372 +
1.373 + // select post-processor
1.374 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.375 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.376 + if (err != KErrNone)
1.377 + {
1.378 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.379 + return EInconclusive;
1.380 + }
1.381 +
1.382 + // initialize CDevVideoPlay and wait for response
1.383 + // iError is set by the MdvpoInitComplete callback
1.384 + aDevVideoPlay.Initialize();
1.385 +
1.386 + if (iError != KErrNone)
1.387 + {
1.388 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.389 + return EInconclusive;
1.390 + }
1.391 +
1.392 + TBool result = EFalse;
1.393 + TPictureData pictureData;
1.394 +
1.395 + TUncompressedVideoFormat format;
1.396 + format.iDataFormat = EYuvRawData;
1.397 + format.iYuvFormat = KTestYuvFormat1;
1.398 +
1.399 + TRAP(err, result = aDevVideoPlay.GetSnapshotL(pictureData, format));
1.400 +
1.401 + if (err == KErrNone)
1.402 + {
1.403 + if (result)
1.404 + {
1.405 + if ((pictureData.iDataFormat == EYuvRawData) &&
1.406 + (pictureData.iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) &&
1.407 + (pictureData.iRawData == NULL))
1.408 + {
1.409 + ret = EPass;
1.410 + }
1.411 + }
1.412 + }
1.413 +
1.414 + return ret;
1.415 + }
1.416 +//------------------------------------------------------------------
1.417 +
1.418 +void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(TInt aError)
1.419 + {
1.420 + INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoInitComplete(): Error = %d"), aError);
1.421 +
1.422 + iError = aError;
1.423 + }
1.424 +
1.425 +void CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(TInt aError,
1.426 + TPictureData* aPictureData,
1.427 + const TTimeIntervalMicroSeconds& aPresentationTimestamp,
1.428 + const TPictureId& /*aPictureId*/)
1.429 + {
1.430 + INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotTimestamp::MdvpoTimedSnapshotComplete(): Error = %d"), aError);
1.431 +
1.432 + iError = aError;
1.433 + iTimestamp = aPresentationTimestamp;
1.434 + iPictureData = aPictureData;
1.435 + }
1.436 +
1.437 +CTestDevVideoPlayGetTimedSnapshotTimestamp::CTestDevVideoPlayGetTimedSnapshotTimestamp(const TDesC& aTestName, TTestType aTestType)
1.438 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.439 + {
1.440 + }
1.441 +
1.442 +CTestDevVideoPlayGetTimedSnapshotTimestamp* CTestDevVideoPlayGetTimedSnapshotTimestamp::NewL(const TDesC& aTestName, TTestType aTestType)
1.443 + {
1.444 + CTestDevVideoPlayGetTimedSnapshotTimestamp* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotTimestamp(aTestName, aTestType);
1.445 + return self;
1.446 + }
1.447 +
1.448 +TVerdict CTestDevVideoPlayGetTimedSnapshotTimestamp::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.449 + {
1.450 + TVerdict ret = EFail;
1.451 + TInt expErr = KErrNone;
1.452 +
1.453 + INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotTimestamp"));
1.454 +
1.455 + // expected results
1.456 + if (iTestType != ETestValid)
1.457 + {
1.458 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.459 + return EInconclusive;
1.460 + }
1.461 +
1.462 + TInt err = KErrNone;
1.463 +
1.464 +// THwDeviceId hwDecoder = 0;
1.465 +// THwDeviceId hwPostProc = 0;
1.466 +
1.467 + // select decoder
1.468 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.469 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.470 + if (err != KErrNone)
1.471 + {
1.472 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.473 + return EInconclusive;
1.474 + }
1.475 +
1.476 + // select post-processor
1.477 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.478 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.479 + if (err != KErrNone)
1.480 + {
1.481 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.482 + return EInconclusive;
1.483 + }
1.484 +
1.485 + // initialize CDevVideoPlay and wait for response
1.486 + // iError is set by the MdvpoInitComplete callback
1.487 + aDevVideoPlay.Initialize();
1.488 +
1.489 + if (iError != KErrNone)
1.490 + {
1.491 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.492 + return EInconclusive;
1.493 + }
1.494 +
1.495 + TPictureData pictureData;
1.496 +
1.497 + TUncompressedVideoFormat format;
1.498 + format.iDataFormat = EYuvRawData;
1.499 + format.iYuvFormat = KTestYuvFormat1;
1.500 + TTimeIntervalMicroSeconds snapTime(KTestSnapshotTimestamp);
1.501 +
1.502 + // get a timed snapshot from the post processor
1.503 + TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapTime));
1.504 +
1.505 + // check picture and timestamp from callback
1.506 + if ((err == KErrNone) && (iError == KErrNone))
1.507 + {
1.508 + if ((iPictureData) && (iTimestamp == TTimeIntervalMicroSeconds(KTestSnapshotTimestamp)))
1.509 + {
1.510 + if ((iPictureData->iDataFormat == EYuvRawData) &&
1.511 + (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) &&
1.512 + (iPictureData->iRawData == NULL))
1.513 + {
1.514 + ret = EPass;
1.515 + }
1.516 + else
1.517 + {
1.518 + ERR_PRINTF1(_L("Error - PictureData is corrupt!"));
1.519 + }
1.520 + }
1.521 + }
1.522 + else
1.523 + {
1.524 + ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr);
1.525 + }
1.526 +
1.527 + return ret;
1.528 + }
1.529 +//------------------------------------------------------------------
1.530 +
1.531 +void CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(TInt aError)
1.532 + {
1.533 + INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoInitComplete(): Error = %d"), aError);
1.534 +
1.535 + iError = aError;
1.536 + }
1.537 +
1.538 +void CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(TInt aError,
1.539 + TPictureData* aPictureData,
1.540 + const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
1.541 + const TPictureId& aPictureId)
1.542 + {
1.543 + INFO_PRINTF2(_L("CTestDevVideoPlayGetTimedSnapshotID::MdvpoTimedSnapshotComplete(): Error = %d"), aError);
1.544 +
1.545 + iError = aError;
1.546 + iPictureId = aPictureId;
1.547 + iPictureData = aPictureData;
1.548 + }
1.549 +
1.550 +CTestDevVideoPlayGetTimedSnapshotID::CTestDevVideoPlayGetTimedSnapshotID(const TDesC& aTestName, TTestType aTestType)
1.551 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.552 + {
1.553 + }
1.554 +
1.555 +CTestDevVideoPlayGetTimedSnapshotID* CTestDevVideoPlayGetTimedSnapshotID::NewL(const TDesC& aTestName, TTestType aTestType)
1.556 + {
1.557 + CTestDevVideoPlayGetTimedSnapshotID* self = new(ELeave) CTestDevVideoPlayGetTimedSnapshotID(aTestName, aTestType);
1.558 + return self;
1.559 + }
1.560 +
1.561 +TVerdict CTestDevVideoPlayGetTimedSnapshotID::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.562 + {
1.563 + TVerdict ret = EPass;
1.564 + TInt expErr = KErrNone;
1.565 +
1.566 + INFO_PRINTF1(_L("CMMFDevVideoPlay: GetTimedSnapshotID"));
1.567 +
1.568 + // expected results
1.569 + if (iTestType != ETestValid)
1.570 + {
1.571 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.572 + return EInconclusive;
1.573 + }
1.574 +
1.575 + TInt err = KErrNone;
1.576 +
1.577 +// THwDeviceId hwDecoder = 0;
1.578 +// THwDeviceId hwPostProc = 0;
1.579 +
1.580 + // select decoder
1.581 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.582 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.583 + if (err != KErrNone)
1.584 + {
1.585 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.586 + return EInconclusive;
1.587 + }
1.588 +
1.589 + // select post-processor
1.590 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.591 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.592 + if (err != KErrNone)
1.593 + {
1.594 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.595 + return EInconclusive;
1.596 + }
1.597 +
1.598 + // initialize CDevVideoPlay and wait for response
1.599 + // iError is set by the MdvpoInitComplete callback
1.600 + aDevVideoPlay.Initialize();
1.601 +
1.602 + if (iError != KErrNone)
1.603 + {
1.604 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.605 + return EInconclusive;
1.606 + }
1.607 +
1.608 + TPictureData pictureData;
1.609 +
1.610 + TUncompressedVideoFormat format;
1.611 + format.iDataFormat = EYuvRawData;
1.612 + format.iYuvFormat = KTestYuvFormat1;
1.613 + TPictureId snapId = KTestSnapshotId;
1.614 +
1.615 + // get a timed snapshot from the post processor
1.616 + TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId));
1.617 +
1.618 + // check picture and timestamp from callback
1.619 + if ((err == KErrNone) && (iError == KErrNone))
1.620 + {
1.621 + if ( (iPictureData) && (iPictureId.iIdType == KTestSnapshotId.iIdType) &&
1.622 + (iPictureId.iId == KTestSnapshotId.iId) )
1.623 + {
1.624 + if ((iPictureData->iDataFormat == EYuvRawData) &&
1.625 + (iPictureData->iDataSize == TSize(KTestPictureDataSizeX, KTestPictureDataSizeY)) &&
1.626 + (iPictureData->iRawData == NULL))
1.627 + {
1.628 + ret = EPass;
1.629 + }
1.630 + else
1.631 + {
1.632 + ERR_PRINTF1(_L("Error - PictureData is corrupt!"));
1.633 + }
1.634 + }
1.635 + }
1.636 + else
1.637 + {
1.638 + ERR_PRINTF3(_L("GetTimedSnapshotL() gave error %d (expected %d)"),err, expErr);
1.639 + }
1.640 +
1.641 + return ret;
1.642 + }
1.643 +//------------------------------------------------------------------
1.644 +
1.645 +void CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(TInt aError)
1.646 + {
1.647 + INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoInitComplete(): Error = %d"), aError);
1.648 +
1.649 + iError = aError;
1.650 + }
1.651 +
1.652 +void CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(TInt aError,
1.653 + TPictureData* /*aPictureData*/,
1.654 + const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
1.655 + const TPictureId& /*aPictureId*/)
1.656 + {
1.657 + INFO_PRINTF2(_L("CTestDevVideoPlayCancelTimedSnapshot::MdvpoTimedSnapshotComplete(): Error = %d"), aError);
1.658 +
1.659 + iError = aError;
1.660 + }
1.661 +
1.662 +CTestDevVideoPlayCancelTimedSnapshot::CTestDevVideoPlayCancelTimedSnapshot(const TDesC& aTestName, TTestType aTestType)
1.663 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.664 + {
1.665 + }
1.666 +
1.667 +CTestDevVideoPlayCancelTimedSnapshot* CTestDevVideoPlayCancelTimedSnapshot::NewL(const TDesC& aTestName, TTestType aTestType)
1.668 + {
1.669 + CTestDevVideoPlayCancelTimedSnapshot* self = new(ELeave) CTestDevVideoPlayCancelTimedSnapshot(aTestName, aTestType);
1.670 + return self;
1.671 + }
1.672 +
1.673 +TVerdict CTestDevVideoPlayCancelTimedSnapshot::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.674 + {
1.675 + TVerdict ret = EFail;
1.676 + TInt expErr = KErrNone;
1.677 +
1.678 + INFO_PRINTF1(_L("CMMFDevVideoPlay: CancelTimedSnapshot"));
1.679 +
1.680 + // expected results
1.681 + if (iTestType != ETestValid)
1.682 + {
1.683 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.684 + return EInconclusive;
1.685 + }
1.686 +
1.687 + TInt err = KErrNone;
1.688 +
1.689 +// THwDeviceId hwDecoder = 0;
1.690 +// THwDeviceId hwPostProc = 0;
1.691 +
1.692 + // select decoder
1.693 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.694 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.695 + if (err != KErrNone)
1.696 + {
1.697 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.698 + return EInconclusive;
1.699 + }
1.700 +
1.701 + // select post-processor
1.702 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.703 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.704 + if (err != KErrNone)
1.705 + {
1.706 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.707 + return EInconclusive;
1.708 + }
1.709 +
1.710 + // initialize CDevVideoPlay and wait for response
1.711 + // iError is set by the MdvpoInitComplete callback
1.712 + aDevVideoPlay.Initialize();
1.713 +
1.714 + if (iError != KErrNone)
1.715 + {
1.716 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.717 + return EInconclusive;
1.718 + }
1.719 +
1.720 +
1.721 + TPictureData pictureData;
1.722 +
1.723 + TUncompressedVideoFormat format;
1.724 + format.iDataFormat = EYuvRawData;
1.725 + format.iYuvFormat = KTestYuvFormat1;
1.726 + TPictureId snapId = KTestSnapshotId;
1.727 +
1.728 + // get a timed snapshot from the post processor
1.729 + TRAP(err, aDevVideoPlay.GetTimedSnapshotL(&pictureData, format, snapId));
1.730 +
1.731 + // cancel the snapshot
1.732 + aDevVideoPlay.CancelTimedSnapshot();
1.733 +
1.734 + // check picture has been cancelled
1.735 + if (err == KErrNone)
1.736 + {
1.737 + if (iError == KErrAbort)
1.738 + {
1.739 + INFO_PRINTF1(_L("Timed snapshot cancelled successfully"));
1.740 + ret = EPass;
1.741 + }
1.742 + else
1.743 + {
1.744 + ERR_PRINTF3(_L("MdvpoTimedSnapshotComplete() gave error %d (expected %d)"),iError, KErrAbort);
1.745 + }
1.746 + }
1.747 + else
1.748 + {
1.749 + ERR_PRINTF3(_L("CancelTimedSnapshotL() gave error %d (expected %d)"),err, expErr);
1.750 + }
1.751 +
1.752 + return ret;
1.753 + }
1.754 +//------------------------------------------------------------------
1.755 +
1.756 +void CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(TInt aError)
1.757 + {
1.758 + INFO_PRINTF2(_L("CTestDevVideoPlayGetSupportedSnapshotFormats::MdvpoInitComplete(): Error = %d"), aError);
1.759 +
1.760 + iError = aError;
1.761 + }
1.762 +
1.763 +CTestDevVideoPlayGetSupportedSnapshotFormats::CTestDevVideoPlayGetSupportedSnapshotFormats(const TDesC& aTestName, TTestType aTestType)
1.764 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.765 + {
1.766 + }
1.767 +
1.768 +CTestDevVideoPlayGetSupportedSnapshotFormats* CTestDevVideoPlayGetSupportedSnapshotFormats::NewL(const TDesC& aTestName, TTestType aTestType)
1.769 + {
1.770 + CTestDevVideoPlayGetSupportedSnapshotFormats* self = new(ELeave) CTestDevVideoPlayGetSupportedSnapshotFormats(aTestName, aTestType);
1.771 + return self;
1.772 + }
1.773 +
1.774 +TVerdict CTestDevVideoPlayGetSupportedSnapshotFormats::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.775 + {
1.776 + TVerdict ret = EFail;
1.777 + TInt expErr = KErrNone;
1.778 +
1.779 + INFO_PRINTF1(_L("CMMFDevVideoPlay: GetSupportedSnapshotFormats"));
1.780 +
1.781 + // expected results
1.782 + if (iTestType != ETestValid)
1.783 + {
1.784 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.785 + return EInconclusive;
1.786 + }
1.787 +
1.788 + TInt err = KErrNone;
1.789 +
1.790 +// THwDeviceId hwDecoder = 0;
1.791 +// THwDeviceId hwPostProc = 0;
1.792 +
1.793 + // select decoder
1.794 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.795 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.796 + if (err != KErrNone)
1.797 + {
1.798 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.799 + return EInconclusive;
1.800 + }
1.801 +
1.802 + // select post-processor
1.803 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.804 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.805 + if (err != KErrNone)
1.806 + {
1.807 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.808 + return EInconclusive;
1.809 + }
1.810 +
1.811 + // initialize CDevVideoPlay and wait for response
1.812 + // iError is set by the MdvpoInitComplete callback
1.813 + aDevVideoPlay.Initialize();
1.814 +
1.815 + if (iError != KErrNone)
1.816 + {
1.817 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.818 + return EInconclusive;
1.819 + }
1.820 +
1.821 + RArray<TUncompressedVideoFormat> vidFormats;
1.822 +
1.823 + // get a list of supported formats from the plugin
1.824 + TRAP(err, aDevVideoPlay.GetSupportedSnapshotFormatsL(vidFormats) )
1.825 +
1.826 + // check picture and timestamp from callback
1.827 + if (err == KErrNone)
1.828 + {
1.829 + if ( vidFormats.Count() == 3)
1.830 + {
1.831 + if ((vidFormats[0] == KTestVidFormat1) &&
1.832 + (vidFormats[1] == KTestVidFormat2) &&
1.833 + (vidFormats[2] == KTestVidFormat3) )
1.834 + {
1.835 + INFO_PRINTF1(_L("Snapshot format list checks ok"));
1.836 + ret = EPass;
1.837 + }
1.838 + else
1.839 + {
1.840 + ERR_PRINTF1(_L("Error - Snapshot format list is corrupt!"));
1.841 + }
1.842 + }
1.843 + }
1.844 + else
1.845 + {
1.846 + ERR_PRINTF3(_L("GetSupportedSnapshotFormatsL() gave error %d (expected %d)"),err, expErr);
1.847 + }
1.848 +
1.849 + vidFormats.Reset();
1.850 + vidFormats.Close();
1.851 +
1.852 + return ret;
1.853 + }
1.854 +
1.855 +//------------------------------------------------------------------
1.856 +
1.857 +CTestDevVideoPlayClock::CTestDevVideoPlayClock(const TDesC& aTestName)
1.858 + {
1.859 + iTestStepName = aTestName;
1.860 + }
1.861 +
1.862 +void CTestDevVideoPlayClock::ConstructL()
1.863 + {
1.864 + }
1.865 +
1.866 +CTestDevVideoPlayClock::~CTestDevVideoPlayClock()
1.867 + {
1.868 + }
1.869 +
1.870 +CTestDevVideoPlayClock* CTestDevVideoPlayClock::NewL(const TDesC& aTestName)
1.871 + {
1.872 + CTestDevVideoPlayClock* self = new(ELeave) CTestDevVideoPlayClock(aTestName);
1.873 + CleanupStack::PushL(self);
1.874 + self->ConstructL();
1.875 + CleanupStack::Pop(self);
1.876 + return self;
1.877 + }
1.878 +
1.879 +TInt CTestDevVideoPlayClock::StartThread(TAny* aAny)
1.880 + {
1.881 + CTestDevVideoPlayClock* me = static_cast<CTestDevVideoPlayClock*>(aAny);
1.882 + me->RunThread();
1.883 +
1.884 + return KErrNone;
1.885 + }
1.886 +
1.887 +void CTestDevVideoPlayClock::RunThread()
1.888 + {
1.889 + TTimeIntervalMicroSeconds currentTime(0);
1.890 +
1.891 + while(!iShutdownSubthread)
1.892 + {
1.893 + currentTime = iClockSource->Time();
1.894 + TUint timeUint = I64LOW(currentTime.Int64());
1.895 + }
1.896 + }
1.897 +
1.898 +void CTestDevVideoPlayClock::MmcspuoTick(const TTimeIntervalMicroSeconds& aTime)
1.899 + {
1.900 + iPeriodicUtilityIteration++;
1.901 +
1.902 + TUint currentTime = I64LOW(aTime.Int64());
1.903 + TUint predictedTime = iPeriodicUtilityIteration * KTestClock2Seconds;
1.904 +
1.905 + if (!TimeComparison(currentTime, predictedTime, KTestClockBigDeviationMS))
1.906 + {
1.907 + ERR_PRINTF3(_L("Error - Periodic Utility time comparison failed: Got %u; Expected %u"), currentTime, predictedTime);
1.908 + iPeriodicUtilityTestVerdict = EFail;
1.909 + iPeriodicUtility->Stop();
1.910 + CActiveScheduler::Stop();
1.911 + }
1.912 + else
1.913 + {
1.914 + INFO_PRINTF3(_L("Periodic Utility time comparison passed: Got %u; Expected %u"), currentTime, predictedTime);
1.915 + }
1.916 +
1.917 + if (iPeriodicUtilityIteration >= 5)
1.918 + {
1.919 + iPeriodicUtility->Stop();
1.920 + CActiveScheduler::Stop();
1.921 + }
1.922 + }
1.923 +
1.924 +TVerdict CTestDevVideoPlayClock::DoTestStepL()
1.925 + {
1.926 + TVerdict ret = EPass;
1.927 + TTimeIntervalMicroSeconds testTime(0);
1.928 + TUint timeUint = 0;
1.929 +
1.930 + iClockSource = CSystemClockSource::NewL();
1.931 +
1.932 + // Construct a new thread to constantly probe the clock - to test that it'll work from multiple threads
1.933 + RThread thread;
1.934 +
1.935 + TInt error = thread.Create(_L("ClockSourceTestThread"),
1.936 + &CTestDevVideoPlayClock::StartThread,
1.937 + KDefaultStackSize,
1.938 + &User::Heap(),
1.939 + static_cast<TAny*>(this),
1.940 + EOwnerThread);
1.941 +
1.942 + if (error)
1.943 + {
1.944 + ERR_PRINTF1(_L("Error - Couldn't create periodic utility object"));
1.945 + delete iClockSource;
1.946 + return EInconclusive;
1.947 + }
1.948 +
1.949 + TRequestStatus stat;
1.950 + thread.Logon(stat);
1.951 + if (stat!=KRequestPending)
1.952 + {
1.953 + delete iClockSource;
1.954 + ERR_PRINTF2(_L("Error - Couldn't logon to the thread err=%d"), stat.Int());
1.955 + thread.LogonCancel(stat);
1.956 + User::WaitForRequest(stat);
1.957 + return EInconclusive;
1.958 + }
1.959 + thread.SetPriority(EPriorityLess);
1.960 +
1.961 + // wait for system to calm down
1.962 + User::After(KTestClock2Seconds);
1.963 +
1.964 + // reset the clock
1.965 + iClockSource->Reset();
1.966 +
1.967 + thread.Resume();
1.968 +
1.969 + // wait for 2 seconds and then check the time == 2 seconds
1.970 + User::After(KTestClock2Seconds);
1.971 + testTime = iClockSource->Time();
1.972 + timeUint = I64LOW(testTime.Int64());
1.973 +
1.974 + if (!TimeComparison(timeUint, KTestClock2Seconds, KTestClockDeviationMS))
1.975 + {
1.976 + ERR_PRINTF3(_L("Error - time comparison failed: Got %u; Expected %u"), timeUint, KTestClock2Seconds);
1.977 + ret = EFail;
1.978 + }
1.979 + else
1.980 + {
1.981 + INFO_PRINTF3(_L("Time comparison passed: Got %u; Expected %u"), timeUint, KTestClock2Seconds);
1.982 + }
1.983 +
1.984 + // reset the clock back to 2 seconds
1.985 + //testTime = KTestClock2Seconds;
1.986 + //iClockSource->Reset(testTime);
1.987 +
1.988 + // suspend timer for 2 seconds then resume for 2 seconds
1.989 + iClockSource->Suspend();
1.990 + User::After(KTestClock2Seconds);
1.991 + iClockSource->Resume();
1.992 + User::After(KTestClock2Seconds);
1.993 + testTime = iClockSource->Time();
1.994 + timeUint = I64LOW(testTime.Int64());
1.995 +
1.996 + if (!TimeComparison(timeUint, KTestClock4Seconds, KTestClockDeviationMS))
1.997 + {
1.998 + ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock4Seconds);
1.999 + ret = EFail;
1.1000 + }
1.1001 + else
1.1002 + {
1.1003 + INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock4Seconds);
1.1004 + }
1.1005 +
1.1006 + // reset clock to 18 seconds
1.1007 + testTime = KTestClock18Seconds;
1.1008 + iClockSource->Reset(testTime);
1.1009 +
1.1010 + // wait for 2 seconds and then check the time == 20 seconds
1.1011 + User::After(KTestClock2Seconds);
1.1012 + testTime = iClockSource->Time();
1.1013 + timeUint = I64LOW(testTime.Int64());
1.1014 +
1.1015 + if (!TimeComparison(timeUint, KTestClock20Seconds, KTestClockDeviationMS))
1.1016 + {
1.1017 + ERR_PRINTF3(_L("Error - Reset() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock20Seconds);
1.1018 + ret = EFail;
1.1019 + }
1.1020 + else
1.1021 + {
1.1022 + INFO_PRINTF3(_L("Reset() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock20Seconds);
1.1023 + }
1.1024 +
1.1025 + // suspend for 2 seconds then resume for 2 seconds
1.1026 + iClockSource->Suspend();
1.1027 + User::After(KTestClock2Seconds);
1.1028 + iClockSource->Resume();
1.1029 + User::After(KTestClock2Seconds);
1.1030 +
1.1031 + testTime = iClockSource->Time();
1.1032 + timeUint = I64LOW(testTime.Int64());
1.1033 +
1.1034 + if (!TimeComparison(timeUint, KTestClock22Seconds, KTestClockDeviationMS))
1.1035 + {
1.1036 + ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed: Got %u; Expected %u"), timeUint, KTestClock22Seconds);
1.1037 + ret = EFail;
1.1038 + }
1.1039 + else
1.1040 + {
1.1041 + INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed: Got %u; Expected %u"), timeUint, KTestClock22Seconds);
1.1042 + }
1.1043 +
1.1044 + // Now test the periodic utility
1.1045 + TRAPD(perError, iPeriodicUtility = CMMFClockSourcePeriodicUtility::NewL(*iClockSource, *this));
1.1046 + if (perError)
1.1047 + {
1.1048 + ERR_PRINTF1(_L("Error - Couldn't create periodic utility object"));
1.1049 + ret = EInconclusive;
1.1050 + }
1.1051 + else
1.1052 + {
1.1053 + iPeriodicUtilityTestVerdict = EPass;
1.1054 + TTimeIntervalMicroSeconds32 period = KTestClock2Seconds;
1.1055 + iClockSource->Reset();
1.1056 + iPeriodicUtility->Start(period);
1.1057 + CActiveScheduler::Start();
1.1058 + ret = iPeriodicUtilityTestVerdict;
1.1059 + }
1.1060 + delete iPeriodicUtility;
1.1061 + iPeriodicUtility = NULL;
1.1062 +
1.1063 + // Clean up the thread
1.1064 + iShutdownSubthread = ETrue;
1.1065 + User::WaitForRequest(stat);
1.1066 + thread.Close();
1.1067 +
1.1068 + delete iClockSource;
1.1069 +
1.1070 + return ret;
1.1071 + }
1.1072 +
1.1073 +//------------------------------------------------------------------
1.1074 +
1.1075 +void CTestDevVideoPlayCommit::MdvpoInitComplete(TInt aError)
1.1076 + {
1.1077 + INFO_PRINTF2(_L("CTestDevVideoPlayCommit::MdvpoInitComplete(): Error = %d"), aError);
1.1078 +
1.1079 + iError = aError;
1.1080 + }
1.1081 +
1.1082 +CTestDevVideoPlayCommit::CTestDevVideoPlayCommit(const TDesC& aTestName, TTestType aTestType)
1.1083 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.1084 + {
1.1085 + }
1.1086 +
1.1087 +CTestDevVideoPlayCommit* CTestDevVideoPlayCommit::NewL(const TDesC& aTestName, TTestType aTestType)
1.1088 + {
1.1089 + CTestDevVideoPlayCommit* self = new(ELeave) CTestDevVideoPlayCommit(aTestName, aTestType);
1.1090 + return self;
1.1091 + }
1.1092 +
1.1093 +TVerdict CTestDevVideoPlayCommit::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.1094 + {
1.1095 + TVerdict ret = EPass;
1.1096 + TInt expErr = KErrNone;
1.1097 + TBool selDec = ETrue;
1.1098 + TBool selPost = ETrue;
1.1099 +
1.1100 + INFO_PRINTF1(_L("CMMFDevVideoPlay: Commit"));
1.1101 +
1.1102 + // expected results
1.1103 + switch(iTestType)
1.1104 + {
1.1105 + case ETestValid:
1.1106 + expErr = KErrNone;
1.1107 + break;
1.1108 + case ETestDecoderOnly:
1.1109 + selPost = EFalse;
1.1110 + break;
1.1111 + case ETestPostProcOnly:
1.1112 + selDec = EFalse;
1.1113 + break;
1.1114 + default:
1.1115 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.1116 + return EInconclusive;
1.1117 + }
1.1118 +
1.1119 + TInt err = KErrNone;
1.1120 +
1.1121 +// THwDeviceId hwDecoder = 0;
1.1122 +// THwDeviceId hwPostProc = 0;
1.1123 +
1.1124 + // select decoder
1.1125 + if (selDec)
1.1126 + {
1.1127 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.1128 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.1129 + if (err != KErrNone)
1.1130 + {
1.1131 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.1132 + return EInconclusive;
1.1133 + }
1.1134 + }
1.1135 +
1.1136 + // select post-processor
1.1137 + if (selPost)
1.1138 + {
1.1139 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.1140 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.1141 + if (err != KErrNone)
1.1142 + {
1.1143 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.1144 + return EInconclusive;
1.1145 + }
1.1146 + }
1.1147 +
1.1148 + // initialize CDevVideoPlay and wait for response
1.1149 + // iError is set by the MdvpoInitComplete callback
1.1150 + aDevVideoPlay.Initialize();
1.1151 +
1.1152 + if (iError != KErrNone)
1.1153 + {
1.1154 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.1155 + return EInconclusive;
1.1156 + }
1.1157 +
1.1158 + // call CommitL on DevVideoPlay
1.1159 + TRAP(iError, aDevVideoPlay.CommitL());
1.1160 +
1.1161 + if (iError != expErr)
1.1162 + {
1.1163 + ERR_PRINTF3(_L("Commit left with error %d; Expected %d!"), iError, expErr);
1.1164 + ret = EFail;
1.1165 + }
1.1166 + else
1.1167 + INFO_PRINTF1(_L("CommitL() called successfully"));
1.1168 +
1.1169 + return ret;
1.1170 + }
1.1171 +
1.1172 +//------------------------------------------------------------------
1.1173 +
1.1174 +void CTestDevVideoPlayRevert::MdvpoInitComplete(TInt aError)
1.1175 + {
1.1176 + INFO_PRINTF2(_L("CTestDevVideoPlayRevert::MdvpoInitComplete(): Error = %d"), aError);
1.1177 +
1.1178 + iError = aError;
1.1179 + }
1.1180 +
1.1181 +CTestDevVideoPlayRevert::CTestDevVideoPlayRevert(const TDesC& aTestName, TTestType aTestType)
1.1182 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.1183 + {
1.1184 + }
1.1185 +
1.1186 +CTestDevVideoPlayRevert* CTestDevVideoPlayRevert::NewL(const TDesC& aTestName, TTestType aTestType)
1.1187 + {
1.1188 + CTestDevVideoPlayRevert* self = new(ELeave) CTestDevVideoPlayRevert(aTestName, aTestType);
1.1189 + return self;
1.1190 + }
1.1191 +
1.1192 +TVerdict CTestDevVideoPlayRevert::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.1193 + {
1.1194 + TVerdict ret = EPass;
1.1195 +// TInt expErr = KErrNone;
1.1196 + TBool selDec = ETrue;
1.1197 + TBool selPost = ETrue;
1.1198 +
1.1199 + INFO_PRINTF1(_L("CMMFDevVideoPlay: Revert"));
1.1200 +
1.1201 + // expected results
1.1202 + switch(iTestType)
1.1203 + {
1.1204 + case ETestValid:
1.1205 +// expErr = KErrNone;
1.1206 + break;
1.1207 + case ETestDecoderOnly:
1.1208 + selPost = EFalse;
1.1209 + break;
1.1210 + case ETestPostProcOnly:
1.1211 + selDec = EFalse;
1.1212 + break;
1.1213 + default:
1.1214 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.1215 + return EInconclusive;
1.1216 + }
1.1217 +
1.1218 + TInt err = KErrNone;
1.1219 +
1.1220 +// THwDeviceId hwDecoder = 0;
1.1221 +// THwDeviceId hwPostProc = 0;
1.1222 +
1.1223 + // select decoder
1.1224 + if (selDec)
1.1225 + {
1.1226 +// TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.1227 + TRAP(err, aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice)); // EABI warning removal
1.1228 + if (err != KErrNone)
1.1229 + {
1.1230 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.1231 + return EInconclusive;
1.1232 + }
1.1233 + }
1.1234 +
1.1235 + // select post-processor
1.1236 + if (selPost)
1.1237 + {
1.1238 +// TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.1239 + TRAP(err, aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice)); // EABI warning removal
1.1240 + if (err != KErrNone)
1.1241 + {
1.1242 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.1243 + return EInconclusive;
1.1244 + }
1.1245 + }
1.1246 +
1.1247 + // initialize CDevVideoPlay and wait for response
1.1248 + // iError is set by the MdvpoInitComplete callback
1.1249 + aDevVideoPlay.Initialize();
1.1250 +
1.1251 + if (iError != KErrNone)
1.1252 + {
1.1253 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.1254 + return EInconclusive;
1.1255 + }
1.1256 +
1.1257 + // call Revert on DevVideoPlay
1.1258 + aDevVideoPlay.Revert();
1.1259 +
1.1260 + // if no PANIC then test has passed...
1.1261 +
1.1262 + INFO_PRINTF1(_L("Revert() called successfully"));
1.1263 +
1.1264 + return ret;
1.1265 + }
1.1266 +
1.1267 +
1.1268 +//------------------------------------------------------------------
1.1269 +
1.1270 +CTestDevVideoPlayCustomInterface::CTestDevVideoPlayCustomInterface(const TDesC& aTestName, TTestType aTestType)
1.1271 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.1272 + {
1.1273 + }
1.1274 +
1.1275 +CTestDevVideoPlayCustomInterface* CTestDevVideoPlayCustomInterface::NewL(const TDesC& aTestName, TTestType aTestType)
1.1276 + {
1.1277 + CTestDevVideoPlayCustomInterface* self = new(ELeave) CTestDevVideoPlayCustomInterface(aTestName, aTestType);
1.1278 + return self;
1.1279 + }
1.1280 +
1.1281 +TVerdict CTestDevVideoPlayCustomInterface::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.1282 + {
1.1283 + INFO_PRINTF1(_L("CMMFDevVideoPlay: CustomInterface"));
1.1284 +
1.1285 + THwDeviceId hwDecoder = 0;
1.1286 + THwDeviceId hwPostProc = 0;
1.1287 + TInt err = KErrNone;
1.1288 +
1.1289 + TRAP(err, hwDecoder = aDevVideoPlay.SelectDecoderL(KUidDevVideoTestDecodeHwDevice));
1.1290 + if (err != KErrNone)
1.1291 + {
1.1292 + ERR_PRINTF1(_L("Error - couldn't initialize decoder"));
1.1293 + return EInconclusive;
1.1294 + }
1.1295 +
1.1296 + TRAP(err, hwPostProc = aDevVideoPlay.SelectPostProcessorL(KUidDevVideoTestPostProcHwDevice));
1.1297 + if (err != KErrNone)
1.1298 + {
1.1299 + ERR_PRINTF1(_L("Error - couldn't initialize post processor"));
1.1300 + return EInconclusive;
1.1301 + }
1.1302 +
1.1303 + // First try test uninitialized
1.1304 +
1.1305 + TAny* ciOne = NULL;
1.1306 + TAny* ciTwo = NULL;
1.1307 + TAny* ciThree = NULL;
1.1308 + TAny* ciFour = NULL;
1.1309 +
1.1310 + ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne);
1.1311 + ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo);
1.1312 + ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo);
1.1313 + ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne);
1.1314 +
1.1315 + if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL)
1.1316 + {
1.1317 + ERR_PRINTF1(_L("Test Failed - wrong interfaces returned"));
1.1318 + return EFail;
1.1319 + }
1.1320 +
1.1321 + // Next, re-perform test initialized.
1.1322 +
1.1323 + // initialize CDevVideoPlay and wait for response
1.1324 + // iError is set by the MdvpoInitComplete callback
1.1325 + aDevVideoPlay.Initialize();
1.1326 +
1.1327 + if (iError != KErrNone)
1.1328 + {
1.1329 + ERR_PRINTF1(_L("Error - couldn't initialize DevVideoPlay"));
1.1330 + return EInconclusive;
1.1331 + }
1.1332 +
1.1333 + ciOne = NULL;
1.1334 + ciTwo = NULL;
1.1335 + ciThree = NULL;
1.1336 + ciFour = NULL;
1.1337 +
1.1338 + ciOne = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceOne);
1.1339 + ciTwo = aDevVideoPlay.CustomInterface(hwDecoder, KUidCustomInterfaceTwo);
1.1340 + ciThree = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceTwo);
1.1341 + ciFour = aDevVideoPlay.CustomInterface(hwPostProc, KUidCustomInterfaceOne);
1.1342 +
1.1343 + if (ciOne==NULL || ciTwo!=NULL || ciThree==NULL || ciFour!=NULL)
1.1344 + {
1.1345 + ERR_PRINTF1(_L("Test Failed - wrong interfaces returned"));
1.1346 + return EFail;
1.1347 + }
1.1348 +
1.1349 +
1.1350 + return EPass;
1.1351 + }
1.1352 +
1.1353 +
1.1354 +
1.1355 +/*
1.1356 +//------------------------------------------------------------------
1.1357 +
1.1358 +CTestDevVideoPlayXXX::CTestDevVideoPlayXXX(const TDesC& aTestName, TTestType aTestType)
1.1359 + :CTestDevVideoPlayStep(aTestName, aTestType)
1.1360 + {
1.1361 + }
1.1362 +
1.1363 +CTestDevVideoPlayXXX* CTestDevVideoPlayXXX::NewL(const TDesC& aTestName, TTestType aTestType)
1.1364 + {
1.1365 + CTestDevVideoPlayXXX* self = new(ELeave) CTestDevVideoPlayXXX(aTestName, aTestType);
1.1366 + return self;
1.1367 + }
1.1368 +
1.1369 +TVerdict CTestDevVideoPlayXXX::DoTestL(CMMFDevVideoPlay& aDevVideoPlay)
1.1370 + {
1.1371 + TVerdict ret = EPass;
1.1372 + TInt expErr = KErrNone;
1.1373 +
1.1374 + INFO_PRINTF1(_L("CMMFDevVideoPlay: XXX"));
1.1375 +
1.1376 + // expected results
1.1377 + if (iTestType != ETestValid)
1.1378 + {
1.1379 + ERR_PRINTF1(_L("Error - invalid test step type"));
1.1380 + return EInconclusive;
1.1381 + }
1.1382 +
1.1383 + // XXXX
1.1384 +
1.1385 + TInt err = KErrNone;
1.1386 + // TRAP(err, aDevVideoPlay.API_FUNCTION_HERE() )
1.1387 +
1.1388 + if (err != expErr)
1.1389 + {
1.1390 + ERR_PRINTF3(_L("XXX() gave error %d (expected %d)"),iError, expErr);
1.1391 + ret = EFail;
1.1392 + }
1.1393 + else
1.1394 + INFO_PRINTF3(_L("XXX(), %d = %d"), iError, expErr);
1.1395 +
1.1396 + return ret;
1.1397 + }
1.1398 +
1.1399 +*/
1.1400 +