os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/testvideoplayer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/vclntavi/src/testvideoplayer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2949 @@
     1.4 +// Copyright (c) 2005-2010 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 "testvideoplayer.h"
    1.20 +
    1.21 +#include <e32math.h>
    1.22 +#include <mmf/common/mmfvideo.h>
    1.23 +#include "u32hal.h"
    1.24 +
    1.25 +#ifdef SYMBIAN_BUILD_GCE
    1.26 +#include <gceavailable.h>
    1.27 +#endif
    1.28 +
    1.29 +const TInt KFrameWidth = 100;
    1.30 +const TInt KFrameHeight = 50;
    1.31 +
    1.32 +const TInt KCropRegionRectTop = 1;
    1.33 +const TInt KCropRegionRectLeft = 3;
    1.34 +const TInt KCropRegionRectRight = 5;
    1.35 +const TInt KCropRegionRectBottom = 7;
    1.36 +const TUint KCacheSize = 1000000; //1MB
    1.37 +const TUint KMaxCacheSize = 30000000; //30MB
    1.38 +
    1.39 +//
    1.40 +// RTestVclntPlayAviFile
    1.41 +//
    1.42 +
    1.43 +/**
    1.44 + * RTestVclntPlayAviFile::Constructor
    1.45 + */
    1.46 +RTestVclntPlayAviFile::RTestVclntPlayAviFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay)
    1.47 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay)
    1.48 +    {
    1.49 +    iHeapSize = 2000000; //-2MB
    1.50 +    }
    1.51 +
    1.52 +/**
    1.53 + * RTestVclntPlayAviFile::NewL
    1.54 + */
    1.55 +RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
    1.56 +    {
    1.57 +    RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
    1.58 +    return self;
    1.59 +    }
    1.60 +
    1.61 +/**
    1.62 + * RTestVclntPlayAviFile::NewLC
    1.63 + */
    1.64 +RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
    1.65 +    {
    1.66 +    RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
    1.67 +    CleanupStack::PushL(self);
    1.68 +    return self;
    1.69 +    }
    1.70 +
    1.71 +/**
    1.72 + * RTestVclntPlayAviFile::DoTestStepL
    1.73 + */
    1.74 +TVerdict RTestVclntPlayAviFile::DoTestStepL()
    1.75 +    {
    1.76 +	 // WDP:We are going to start the test now
    1.77 +	 // Ensure we set paging memory to appropriate cache size for tests which need it
    1.78 +	 //ignore other tests
    1.79 +    TVerdict verdict=SetCacheSize();
    1.80 +    if(verdict!=EPass)
    1.81 +    	{
    1.82 +    	return verdict;
    1.83 +    	}
    1.84 +     
    1.85 +    // Call the state handler from IDLE state
    1.86 +    FsmL(EVPIdle);
    1.87 +    User::LeaveIfError(iError);
    1.88 +    // Start the scheduler - Done only once !
    1.89 +    CActiveScheduler::Start();
    1.90 +    
    1.91 +    return iTestStepResult;
    1.92 +    }
    1.93 +
    1.94 +//Default SetCache size
    1.95 +TVerdict RTestVclntPlayAviFile::SetCacheSize()
    1.96 +	{
    1.97 +	//Do not try to increase cache size for tests which dont need it
    1.98 +	return EPass;
    1.99 +		    
   1.100 +	}
   1.101 +
   1.102 +/**
   1.103 + * RTestVclntPlayAviFile::FsmL
   1.104 + */
   1.105 +void RTestVclntPlayAviFile::FsmL(TVclntTestPlayEvents aEventCode)
   1.106 +    {
   1.107 +    if (FsmCheck(aEventCode))
   1.108 +        {
   1.109 +        //TInt err = KErrNone;
   1.110 +        switch (aEventCode)
   1.111 +            {
   1.112 +            case EVPIdle:
   1.113 +                // Open iVideoPlayer
   1.114 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
   1.115 +                TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
   1.116 +                PrepareState(EVPOpenComplete, KErrNone);
   1.117 +                break;
   1.118 +            case EVPOpenComplete:
   1.119 +                // Prepare iVideoPlayer
   1.120 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
   1.121 +                iVideoPlayer->Prepare();
   1.122 +                PrepareState(EVPPrepareComplete, KErrNone);
   1.123 +                break;
   1.124 +            case EVPPrepareComplete:
   1.125 +                iTestStepResult = DoTestL(iVideoPlayer);
   1.126 +                break;
   1.127 +            case EVPPlayComplete:
   1.128 +                iTestStepResult = EPass;
   1.129 +                CActiveScheduler::Stop();
   1.130 +                break;
   1.131 +            }
   1.132 +        }
   1.133 +    }
   1.134 +
   1.135 +/**
   1.136 + * RTestVclntPlayAviFile::DoTestL
   1.137 + */
   1.138 +TVerdict RTestVclntPlayAviFile::DoTestL(CVideoPlayerUtility* /*aPlayer*/)
   1.139 +    {
   1.140 +    TVerdict ret = EFail;
   1.141 +
   1.142 +    if(iPlay)
   1.143 +        {
   1.144 +        iError = KErrTimedOut;
   1.145 +        INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.146 +        PrepareState(EVPPlayComplete, KErrNone);
   1.147 +        iVideoPlayer->Play();
   1.148 +        }
   1.149 +    else
   1.150 +        {
   1.151 +        CActiveScheduler::Stop();
   1.152 +        ret = EPass;
   1.153 +        }
   1.154 +        
   1.155 +    return ret;
   1.156 +    }
   1.157 +
   1.158 +//
   1.159 +// RTestVclntPlayAviDes
   1.160 +//
   1.161 +
   1.162 +/**
   1.163 + * RTestVclntPlayAviDes::Constructor
   1.164 + */
   1.165 +RTestVclntPlayAviDes::RTestVclntPlayAviDes(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay)
   1.166 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay)
   1.167 +    {
   1.168 +    iHeapSize = 500000;
   1.169 +    }
   1.170 +
   1.171 +/**
   1.172 + * RTestVclntPlayAviDes::NewL
   1.173 + */
   1.174 +RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
   1.175 +    {
   1.176 +    RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
   1.177 +    return self;
   1.178 +    }
   1.179 +
   1.180 +/**
   1.181 + * RTestVclntPlayAviDes::NewLC
   1.182 + */
   1.183 +RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
   1.184 +    {
   1.185 +    RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
   1.186 +    CleanupStack::PushL(self);
   1.187 +    return self;
   1.188 +    }
   1.189 +
   1.190 +/**
   1.191 + * RTestVclntPlayAviDes::DoTestStepPreambleL
   1.192 + */
   1.193 +TVerdict  RTestVclntPlayAviDes::DoTestStepPreambleL()
   1.194 +    {
   1.195 +    TVerdict preamRes;
   1.196 +    preamRes = EPass;
   1.197 +    
   1.198 +    // Base DoTestStepPreambleL
   1.199 +    preamRes = RTestVclntAviPlayerStep::DoTestStepPreambleL();
   1.200 +    if (preamRes != EPass)
   1.201 +        {
   1.202 +        return preamRes;
   1.203 +        }
   1.204 +    
   1.205 +    RFs fs;
   1.206 +    RFile file;
   1.207 +    TInt size = 0;
   1.208 +
   1.209 +    // connect to file system and open file
   1.210 +    User::LeaveIfError(fs.Connect());
   1.211 +    CleanupClosePushL(fs);
   1.212 +    User::LeaveIfError(file.Open(fs,iFilename,EFileRead));
   1.213 +    CleanupClosePushL(file);
   1.214 +
   1.215 +    // Set HBuf size
   1.216 +    User::LeaveIfError(file.Size(size));
   1.217 +    INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143
   1.218 +
   1.219 +	iVideo = HBufC8::NewMaxL(size);
   1.220 +
   1.221 +    // read data into Hbuf
   1.222 +    TPtr8 bufferDes(iVideo->Des());
   1.223 +    User::LeaveIfError(file.Read(bufferDes));
   1.224 +    
   1.225 +    CleanupStack::PopAndDestroy(2); //fs, file
   1.226 +    
   1.227 +    return preamRes;
   1.228 +    }
   1.229 +
   1.230 +/**
   1.231 + * RTestVclntPlayAviDes::DoTestStepPostambleL
   1.232 + */
   1.233 +TVerdict RTestVclntPlayAviDes::DoTestStepPostambleL()
   1.234 +    {
   1.235 +    delete iVideo;
   1.236 +    iVideo = NULL;
   1.237 +    return RTestVclntAviPlayerStep::DoTestStepPostambleL();
   1.238 +    }
   1.239 +
   1.240 +/**
   1.241 + * Load and initialise an video descriptor.
   1.242 + */
   1.243 +TVerdict RTestVclntPlayAviDes::DoTestStepL()
   1.244 +    {
   1.245 +    iTestStepResult = EFail;
   1.246 +    // Call the state handler from IDLE state
   1.247 +    TRAPD(err, FsmL(EVPIdle));
   1.248 +    if (err == KErrNone)
   1.249 +        {
   1.250 +        CActiveScheduler::Start();    
   1.251 +        }
   1.252 +    // Start the scheduler - Done only once !
   1.253 +    return iTestStepResult;
   1.254 +    }
   1.255 +
   1.256 +/**
   1.257 + * RTestVclntPlayAviDes::FsmL
   1.258 + */
   1.259 +void RTestVclntPlayAviDes::FsmL(TVclntTestPlayEvents aEventCode)
   1.260 +    {
   1.261 +    if (FsmCheck(aEventCode))
   1.262 +        {
   1.263 +        //TInt err = KErrNone;
   1.264 +        switch (aEventCode)
   1.265 +            {
   1.266 +            case EVPIdle:
   1.267 +                // Open iVideoPlayer
   1.268 +                INFO_PRINTF2(_L("iVideoPlayer->OpenDesL() %S"), &iFilename);
   1.269 +                TRAP(iError, iVideoPlayer->OpenDesL(iVideo->Des(), ControllerUid()));
   1.270 +                PrepareState(EVPOpenComplete, KErrNone);
   1.271 +                break;
   1.272 +            case EVPOpenComplete:
   1.273 +                // Prepare iVideoPlayer
   1.274 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
   1.275 +                iVideoPlayer->Prepare();
   1.276 +                PrepareState(EVPPrepareComplete, KErrNone);
   1.277 +                break;
   1.278 +            case EVPPrepareComplete:
   1.279 +                iTestStepResult = DoTestL(iVideoPlayer);
   1.280 +                break;
   1.281 +            case EVPPlayComplete:
   1.282 +                iTestStepResult = EPass;
   1.283 +                CActiveScheduler::Stop();
   1.284 +                break;
   1.285 +            }
   1.286 +        }
   1.287 +    }
   1.288 +
   1.289 +/**
   1.290 + * RTestVclntPlayAviDes::DoTestL
   1.291 + */
   1.292 +TVerdict RTestVclntPlayAviDes::DoTestL(CVideoPlayerUtility* aPlayer)
   1.293 +    {
   1.294 +    TVerdict ret = EFail;
   1.295 +
   1.296 +    if(iPlay)
   1.297 +        {
   1.298 +        iError = KErrTimedOut;
   1.299 +        INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.300 +        PrepareState(EVPPlayComplete, KErrNone);
   1.301 +        aPlayer->Play();
   1.302 +        }
   1.303 +    else
   1.304 +        {
   1.305 +        CActiveScheduler::Stop();
   1.306 +        ret = EPass;
   1.307 +        }
   1.308 +        
   1.309 +    return ret;
   1.310 +    }
   1.311 +
   1.312 +
   1.313 +//
   1.314 +// RTestVclntPlayAviUrl
   1.315 +//
   1.316 +
   1.317 +/**
   1.318 + * RTestVclntPlayAviUrl::Constructor
   1.319 + */
   1.320 + 
   1.321 +RTestVclntPlayAviUrl::RTestVclntPlayAviUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
   1.322 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay)
   1.323 +    {
   1.324 +    }
   1.325 +
   1.326 +/**
   1.327 + * RTestVclntPlayAviUrl::NewL
   1.328 + */
   1.329 +
   1.330 +RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
   1.331 +    {
   1.332 +    RTestVclntPlayAviUrl* self = RTestVclntPlayAviUrl::NewLC(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
   1.333 +    CleanupStack::Pop();
   1.334 +    return self;
   1.335 +    }
   1.336 +
   1.337 +/**
   1.338 + * RTestVclntPlayAviUrl::NewLC
   1.339 + */
   1.340 +
   1.341 +RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay)
   1.342 +    {
   1.343 +    RTestVclntPlayAviUrl* self = new (ELeave) RTestVclntPlayAviUrl(aTestName, aSectName, aKeyName, aExpectedError, aPlay);
   1.344 +    CleanupStack::PushL(self);
   1.345 +    return self;
   1.346 +    }
   1.347 +
   1.348 +/**
   1.349 + * RTestVclntPlayAviUrl::Constructor
   1.350 + */
   1.351 +
   1.352 +TVerdict RTestVclntPlayAviUrl::DoTestStepL()
   1.353 +    {
   1.354 +    // Call the state handler from IDLE state
   1.355 +    FsmL(EVPIdle);
   1.356 +    
   1.357 +    // Start the scheduler - Done only once !
   1.358 +    CActiveScheduler::Start();
   1.359 +    
   1.360 +    return iTestStepResult;
   1.361 +    }
   1.362 +
   1.363 +/**
   1.364 + * RTestVclntPlayAviUrl::FsmL
   1.365 + */
   1.366 + 
   1.367 +void RTestVclntPlayAviUrl::FsmL(TVclntTestPlayEvents aEventCode)
   1.368 +    {
   1.369 +    if (FsmCheck(aEventCode))
   1.370 +        {
   1.371 +        switch (aEventCode)
   1.372 +            {
   1.373 +            case EVPIdle:
   1.374 +                // Open iVideoPlayer
   1.375 +                
   1.376 +                INFO_PRINTF2(_L("iVideoPlayer->OpenUrlL() %S"), &iFilename);
   1.377 +                TRAP(iError,iVideoPlayer->OpenUrlL(iFilename, KUseDefaultIap, KNullDesC8, ControllerUid()));
   1.378 +                PrepareState(EVPOpenComplete, KErrNone);
   1.379 +                break;
   1.380 +            case EVPOpenComplete:
   1.381 +                // Prepare iVideoPlayer
   1.382 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
   1.383 +                iVideoPlayer->Prepare();
   1.384 +                PrepareState(EVPPrepareComplete, KErrNone);
   1.385 +                break;
   1.386 +            case EVPPrepareComplete:
   1.387 +                iTestStepResult = DoTestL(iVideoPlayer);
   1.388 +                break;
   1.389 +            case EVPPlayComplete:
   1.390 +                CActiveScheduler::Stop();
   1.391 +                iTestStepResult = EPass;
   1.392 +                break;
   1.393 +            }
   1.394 +        }
   1.395 +    }
   1.396 +
   1.397 +/**
   1.398 + * RTestVclntPlayAviUrl::Constructor
   1.399 + */
   1.400 + 
   1.401 +TVerdict RTestVclntPlayAviUrl::DoTestL(CVideoPlayerUtility* aPlayer)
   1.402 +    {
   1.403 +    TVerdict ret = EFail;
   1.404 +
   1.405 +    if(iPlay)
   1.406 +        {
   1.407 +        iError = KErrTimedOut;
   1.408 +        INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.409 +        PrepareState(EVPPlayComplete, KErrNone);
   1.410 +        aPlayer->Play();
   1.411 +        }
   1.412 +    else
   1.413 +        {
   1.414 +        CActiveScheduler::Stop();
   1.415 +        ret = EPass;
   1.416 +        }
   1.417 +        
   1.418 +    return ret;
   1.419 +    }
   1.420 +
   1.421 +
   1.422 +//
   1.423 +// RTestVclntEnqFrameRate
   1.424 +//
   1.425 +
   1.426 +/**
   1.427 + * RTestVclntEnqFrameRate::Constructor
   1.428 + */
   1.429 +RTestVclntEnqFrameRate::RTestVclntEnqFrameRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate)
   1.430 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
   1.431 +    {
   1.432 +    iFrameRate = aFrameRate;
   1.433 +    }
   1.434 +
   1.435 +/**
   1.436 + * RTestVclntEnqFrameRate::Constructor
   1.437 + */
   1.438 +RTestVclntEnqFrameRate* RTestVclntEnqFrameRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate)
   1.439 +    {
   1.440 +    RTestVclntEnqFrameRate* self = new (ELeave) RTestVclntEnqFrameRate(aTestName, aSectName, aKeyName, aExpectedError, aFrameRate);
   1.441 +    return self;
   1.442 +    }
   1.443 +
   1.444 +/**
   1.445 + * RTestVclntEnqFrameRate::Constructor
   1.446 + */
   1.447 +TVerdict RTestVclntEnqFrameRate::DoTestL(CVideoPlayerUtility* aPlayer)
   1.448 +    {
   1.449 +    INFO_PRINTF1(_L("Test : Video Player - Enquire Frame Rate"));
   1.450 +
   1.451 +    TVerdict ret = EFail;
   1.452 +
   1.453 +    TReal32 theFrameRate = 0.0;
   1.454 +    TRAPD(err, theFrameRate = aPlayer->VideoFrameRateL());
   1.455 +    INFO_PRINTF3(_L("iVideoPlayer->VideoFrameRateL() = %d...error =%d"), TInt(theFrameRate), err);
   1.456 +
   1.457 +    // if we get here, we pass. The iVideoPlayer does not have a SetVideoFrameRate()
   1.458 +    INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.459 +    PrepareState(EVPPlayComplete, KErrNone);
   1.460 +    aPlayer->Play();
   1.461 +
   1.462 +    return ret;
   1.463 +    }
   1.464 +
   1.465 +
   1.466 +//
   1.467 +// RTestVclntPosition
   1.468 +//
   1.469 +
   1.470 +/**
   1.471 + * RTestVclntPosition::Constructor
   1.472 + */
   1.473 +RTestVclntPosition::RTestVclntPosition(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition)
   1.474 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
   1.475 +    {
   1.476 +    iPosition = aPosition;
   1.477 +    }
   1.478 +
   1.479 +/**
   1.480 + * RTestVclntPosition::NewL
   1.481 + */
   1.482 +RTestVclntPosition* RTestVclntPosition::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition)
   1.483 +    {
   1.484 +    RTestVclntPosition* self = new (ELeave) RTestVclntPosition(aTestName, aSectName, aKeyName, aExpectedError, aPosition);
   1.485 +    return self;
   1.486 +    }
   1.487 +
   1.488 +/**
   1.489 + * RTestVclntPosition::DoTestL
   1.490 + */
   1.491 +TVerdict RTestVclntPosition::DoTestL(CVideoPlayerUtility* aPlayer)
   1.492 +    {
   1.493 +    // NB test video controller is stubbing certain functions. May have to rewrite this
   1.494 +    // for AVI Controller
   1.495 +
   1.496 +    TVerdict ret = EFail;
   1.497 +    TInt err = KErrNone;
   1.498 +    TTimeIntervalMicroSeconds pos;
   1.499 +    
   1.500 +    INFO_PRINTF1(_L("Test : Video Player - Position"));
   1.501 +    INFO_PRINTF3(_L("Set Position = %d, Duration = %d"), I64INT(iPosition.Int64()), I64INT(aPlayer->DurationL().Int64()));
   1.502 +
   1.503 +    //  Set position: middle of clip.
   1.504 +    if (I64INT(iPosition.Int64()) == 0)
   1.505 +        {
   1.506 +        iPosition = I64INT(aPlayer->DurationL().Int64()) / 2;
   1.507 +        }
   1.508 +        
   1.509 +    // Set position: end of clip.
   1.510 +    if (I64INT(iPosition.Int64()) == -1)
   1.511 +        {
   1.512 +        iPosition = aPlayer->DurationL();
   1.513 +        }
   1.514 +        
   1.515 +    // Position is beyond the end of the clips duration, so check that the value is clipped.
   1.516 +    if(aPlayer->DurationL() < iPosition)
   1.517 +        {
   1.518 +        INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64()));
   1.519 +        TRAP(err, aPlayer->SetPositionL(iPosition));
   1.520 +        if (err == KErrNotSupported)
   1.521 +            {
   1.522 +            INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported"));
   1.523 +            }
   1.524 +        TRAP(err, pos = aPlayer->PositionL());
   1.525 +        if (err == KErrNotReady)
   1.526 +            {
   1.527 +            INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady"));
   1.528 +            }
   1.529 +        INFO_PRINTF3(_L("Set Position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(aPlayer->DurationL().Int64()));
   1.530 +        }
   1.531 +    
   1.532 +    // Position is negative, so check that the value is clipped.
   1.533 +    else if (I64INT(iPosition.Int64()) < 0)
   1.534 +        {
   1.535 +        INFO_PRINTF2(_L("Negative value : Setting position to %d"), I64INT(iPosition.Int64()));
   1.536 +        TRAP(err, aPlayer->SetPositionL(iPosition));
   1.537 +        if (err == KErrNotSupported)
   1.538 +            {
   1.539 +            INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported"));
   1.540 +            }
   1.541 +        TRAP(err, pos = aPlayer->PositionL());
   1.542 +        if (err == KErrNotReady)
   1.543 +            {
   1.544 +            INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady"));
   1.545 +            }
   1.546 +        INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), I64INT(pos.Int64()));
   1.547 +        }
   1.548 +    else
   1.549 +        {
   1.550 +        INFO_PRINTF2(_L("Normal : Setting position to %d"), I64INT(iPosition.Int64()));
   1.551 +        TRAP(err, aPlayer->SetPositionL(iPosition));
   1.552 +        if (err == KErrNotSupported)
   1.553 +            {
   1.554 +            INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported"));
   1.555 +            }
   1.556 +        TRAP(err, pos = aPlayer->PositionL());
   1.557 +        if (err == KErrNotReady)
   1.558 +            {
   1.559 +            INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady"));
   1.560 +            }
   1.561 +        INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(iPosition.Int64()));
   1.562 +        }
   1.563 +
   1.564 +    INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.565 +    PrepareState(EVPPlayComplete, KErrNone);
   1.566 +    aPlayer->Play();
   1.567 +    
   1.568 +    
   1.569 +    TRAP(err, pos = aPlayer->PositionL());
   1.570 +    if (err != KErrNone)
   1.571 +        {
   1.572 +        INFO_PRINTF2(_L("PositionL() left with Error - %d"), err);
   1.573 +        ret = EFail;
   1.574 +        }
   1.575 +    
   1.576 +    return ret;
   1.577 +    }
   1.578 +
   1.579 +
   1.580 +//
   1.581 +// RTestVclntPriority
   1.582 +//
   1.583 +
   1.584 +/**
   1.585 + * RTestVclntPriority::Constructor
   1.586 + */
   1.587 +RTestVclntPriority::RTestVclntPriority(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority)
   1.588 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
   1.589 +    {
   1.590 +    iPriority = aPriority;
   1.591 +    }
   1.592 +
   1.593 +/**
   1.594 + * RTestVclntRecordAviFile::Constructor
   1.595 + */
   1.596 +RTestVclntPriority* RTestVclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority)
   1.597 +    {
   1.598 +    RTestVclntPriority* self = new (ELeave) RTestVclntPriority(aTestName, aSectName, aKeyName, aExpectedError, aPriority);
   1.599 +    return self;
   1.600 +    }
   1.601 +
   1.602 +/**
   1.603 + * RTestVclntRecordAviFile::Constructor
   1.604 + */
   1.605 +TVerdict RTestVclntPriority::DoTestL(CVideoPlayerUtility* aPlayer)
   1.606 +    {
   1.607 +    TVerdict ret = EFail;
   1.608 +
   1.609 +    INFO_PRINTF1(_L("Test : Video Player - Priority"));
   1.610 +
   1.611 +    aPlayer->SetPriorityL(iPriority, EMdaPriorityPreferenceNone);    
   1.612 +    TInt thePriority = 0;
   1.613 +    TMdaPriorityPreference thePref;
   1.614 +    aPlayer->PriorityL(thePriority, thePref);
   1.615 +    INFO_PRINTF3(_L("Priority = %d (expecting %d)"), thePriority, iPriority);
   1.616 +    INFO_PRINTF3(_L("Pref = %d (expecting %d)"), thePref, EMdaPriorityPreferenceNone);
   1.617 +    
   1.618 +    if( (thePriority == iPriority) && (thePref == EMdaPriorityPreferenceNone) )
   1.619 +        {
   1.620 +        ret = EPass;
   1.621 +        }
   1.622 +        
   1.623 +    CActiveScheduler::Stop();
   1.624 +    
   1.625 +    return ret;
   1.626 +    }
   1.627 +
   1.628 +
   1.629 +//
   1.630 +// RTestVclntDuration
   1.631 +//
   1.632 +
   1.633 +/**
   1.634 + * RTestVclntDuration::Constructor
   1.635 + */
   1.636 +RTestVclntDuration::RTestVclntDuration(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration)
   1.637 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
   1.638 +    {
   1.639 +    iDuration = aDuration;
   1.640 +    }
   1.641 +
   1.642 +/**
   1.643 + * RTestVclntDuration::Constructor
   1.644 + */
   1.645 +RTestVclntDuration* RTestVclntDuration::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration)
   1.646 +    {
   1.647 +    RTestVclntDuration* self = new (ELeave) RTestVclntDuration(aTestName, aSectName, aKeyName, aExpectedError, aDuration);
   1.648 +    return self;
   1.649 +    }
   1.650 +
   1.651 +/**
   1.652 + * RTestVclntDuration::Constructor
   1.653 + */
   1.654 +TVerdict RTestVclntDuration::DoTestL(CVideoPlayerUtility* aPlayer)
   1.655 +    {
   1.656 +    TVerdict ret = EFail;
   1.657 +    
   1.658 +    INFO_PRINTF1(_L("Test : Video Player - Duration"));
   1.659 +
   1.660 +    if (I64INT(iDuration.Int64()) == 0)
   1.661 +        {
   1.662 +        TInt duration = I64INT(aPlayer->DurationL().Int64());
   1.663 +        INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.664 +        PrepareState(EVPPlayComplete, KErrNone);
   1.665 +        aPlayer->Play();
   1.666 +        TTime start;
   1.667 +        start.HomeTime();
   1.668 +        CActiveScheduler::Start();
   1.669 +        TTime stop;
   1.670 +        stop.HomeTime();
   1.671 +
   1.672 +        TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
   1.673 +
   1.674 +        INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
   1.675 +            iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
   1.676 +        if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation)))
   1.677 +            {
   1.678 +            ret = EPass;
   1.679 +            }
   1.680 +        }
   1.681 +    else
   1.682 +        {
   1.683 +        if(aPlayer->DurationL() == iDuration)
   1.684 +            {
   1.685 +            ret = EPass;
   1.686 +            }
   1.687 +        }
   1.688 +    
   1.689 +    CActiveScheduler::Stop();
   1.690 +    TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)iCurrentCacheSize.iMinSize,(TAny*)iCurrentCacheSize.iMaxSize);
   1.691 +    if(CheckCacheError(error)==EInconclusive)
   1.692 +    	{
   1.693 +    	return EInconclusive;
   1.694 +    	}
   1.695 +    INFO_PRINTF3(_L("Setting Cache Min Size to %d,Setting Cache Max Size is %d"),iCurrentCacheSize.iMinSize,iCurrentCacheSize.iMaxSize);
   1.696 +    return ret;
   1.697 +    }
   1.698 +
   1.699 +TVerdict RTestVclntDuration::SetCacheSize()
   1.700 +	{
   1.701 +	TVerdict ret=EPass;
   1.702 +	//save the default cache sizes, set the cache size back these values after the test
   1.703 +	TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalGetCacheSize,&iCurrentCacheSize,0);
   1.704 +	ret=CheckCacheError(error);
   1.705 +	if(ret==EPass)
   1.706 +		{
   1.707 +		error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize);
   1.708 +		ret=CheckCacheError(error);
   1.709 +		}
   1.710 +	return ret;
   1.711 +	}
   1.712 +
   1.713 +TVerdict RTestVclntDuration::CheckCacheError(TInt aError)
   1.714 +	{
   1.715 +	TVerdict verdict=EPass;
   1.716 +	#ifdef __WINSCW__
   1.717 +	//Winscw does not support getting cache size. Ignoring -5 error
   1.718 +	if(aError!=KErrNone)
   1.719 +		{
   1.720 +		if(aError!=KErrNotSupported)
   1.721 +			{
   1.722 +			INFO_PRINTF2(_L("Could not get the cache size  %d"),aError);
   1.723 +			return EInconclusive;
   1.724 +			}
   1.725 +		}
   1.726 +	#else
   1.727 +	if(aError!=KErrNone)
   1.728 +		{//For ARMV5 we stop for all errors
   1.729 +		INFO_PRINTF2(_L("Could not get the cache size  %d"),aError);
   1.730 +		return EInconclusive;
   1.731 +		}
   1.732 +	#endif
   1.733 +	return verdict;
   1.734 +	}
   1.735 +
   1.736 +//
   1.737 +// RTestVclntVolume
   1.738 +//
   1.739 +
   1.740 +/**
   1.741 + * RTestVclntVolume::Constructor
   1.742 + */
   1.743 +RTestVclntVolume::RTestVclntVolume(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume)
   1.744 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
   1.745 +    {
   1.746 +    iVolume = aVolume;
   1.747 +    }
   1.748 +
   1.749 +/**
   1.750 + * RTestVclntVolume::Constructor
   1.751 + */
   1.752 +RTestVclntVolume* RTestVclntVolume::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume)
   1.753 +    {
   1.754 +    RTestVclntVolume* self = new (ELeave) RTestVclntVolume(aTestName, aSectName, aKeyName, aExpectedError, aVolume);
   1.755 +    return self;
   1.756 +    }
   1.757 +
   1.758 +/**
   1.759 + * RTestVclntVolume::Constructor
   1.760 + */
   1.761 +TVerdict RTestVclntVolume::DoTestL(CVideoPlayerUtility* aPlayer)
   1.762 +    {
   1.763 +    TVerdict ret = EFail;
   1.764 +    TInt err;
   1.765 +    
   1.766 +    INFO_PRINTF1(_L("Test : Video Player - Volume"));
   1.767 +    
   1.768 +    // see if audio is enabled
   1.769 +    if (aPlayer->AudioEnabledL())
   1.770 +        {
   1.771 +        INFO_PRINTF1(_L("AudioEnabledL() returned True"));
   1.772 +        }
   1.773 +    else
   1.774 +        {
   1.775 +        INFO_PRINTF1(_L("AudioEnabledL() returned False"));   
   1.776 +        }
   1.777 +    
   1.778 +    // Check maxvolume function
   1.779 +    if(iVolume == -1)
   1.780 +        {
   1.781 +        iVolume = aPlayer->MaxVolume();
   1.782 +        TRAP(err, aPlayer->SetVolumeL(iVolume));
   1.783 +        INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err);
   1.784 +        INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), aPlayer->MaxVolume());
   1.785 +        if(aPlayer->Volume() == aPlayer->MaxVolume())
   1.786 +            {
   1.787 +            ret = EPass;
   1.788 +            }
   1.789 +        }
   1.790 +    // Volume should truncated to maxvolume
   1.791 +    else if(iVolume > aPlayer->MaxVolume())
   1.792 +        {
   1.793 +        TRAP(err, aPlayer->SetVolumeL(iVolume));
   1.794 +        INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err);
   1.795 +        INFO_PRINTF3(_L("Volume = %d, MaxVolume = %d"), aPlayer->Volume(), aPlayer->MaxVolume());
   1.796 +        if(aPlayer->Volume() == aPlayer->MaxVolume())
   1.797 +            {
   1.798 +            ret = EPass;
   1.799 +            }
   1.800 +        }
   1.801 +    // Volume is truncated to 0
   1.802 +    else if(iVolume < 0)
   1.803 +        {
   1.804 +        TRAP(err, aPlayer->SetVolumeL(iVolume));
   1.805 +        INFO_PRINTF2(_L("Volume should be set to Min Volume.Returned with %d"), err);
   1.806 +        INFO_PRINTF2(_L("Volume = %d (expecting 0)"), aPlayer->Volume());
   1.807 +        if(aPlayer->Volume() == 0)
   1.808 +            {
   1.809 +            ret = EPass;
   1.810 +            }
   1.811 +        }
   1.812 +    // Set volume and check
   1.813 +    else
   1.814 +        {
   1.815 +        TRAP(err, aPlayer->SetVolumeL(iVolume));
   1.816 +        INFO_PRINTF2(_L("Volume should be set to the desired value. Retuned with %d"), err);
   1.817 +        INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), iVolume);
   1.818 +        if(aPlayer->Volume() == iVolume)
   1.819 +            {
   1.820 +            ret = EPass;
   1.821 +            }
   1.822 +        }
   1.823 +    
   1.824 +    CActiveScheduler::Stop();
   1.825 +    
   1.826 +    return ret;
   1.827 +    }
   1.828 +
   1.829 +//
   1.830 +// RTestVclntCloseOpen
   1.831 +//
   1.832 +
   1.833 +/**
   1.834 + * RTestVclntCloseOpen::Constructor
   1.835 + */
   1.836 +RTestVclntCloseOpen::RTestVclntCloseOpen(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.837 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
   1.838 +    {
   1.839 +    iOpenCount = 1;
   1.840 +    }
   1.841 +
   1.842 +/**
   1.843 + * RTestVclntCloseOpen::Constructor
   1.844 + */
   1.845 +RTestVclntCloseOpen* RTestVclntCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.846 +    {
   1.847 +    RTestVclntCloseOpen* self = new (ELeave) RTestVclntCloseOpen(aTestName, aSectName, aKeyName, aExpectedError);
   1.848 +    return self;
   1.849 +    }
   1.850 +
   1.851 +/**
   1.852 + * RTestVclntCloseOpen::DoTestStepL
   1.853 + */
   1.854 +TVerdict RTestVclntCloseOpen::DoTestStepL()
   1.855 +    {
   1.856 +    // Call the state handler from IDLE state
   1.857 +    FsmL(EVPIdle);
   1.858 +    
   1.859 +    // Start the scheduler - Done only once !
   1.860 +    CActiveScheduler::Start();
   1.861 +    
   1.862 +    return iTestStepResult;
   1.863 +    }
   1.864 +
   1.865 +/**
   1.866 + * RTestVclntCloseOpen::FsmL
   1.867 + */
   1.868 +void RTestVclntCloseOpen::FsmL(TVclntTestPlayEvents aEventCode)
   1.869 +    {
   1.870 +    if (FsmCheck(aEventCode))
   1.871 +        {
   1.872 +        switch (aEventCode)
   1.873 +            {
   1.874 +            case EVPIdle:
   1.875 +                // Open iVideoPlayer First time
   1.876 +                iOpenCount = 1;
   1.877 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
   1.878 +                TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
   1.879 +                PrepareState(EVPOpenComplete, KErrNone);
   1.880 +                break;
   1.881 +            case EVPOpenComplete:
   1.882 +                if (iOpenCount == 1)
   1.883 +                    {
   1.884 +                    // Prepare iVideoPlayer
   1.885 +                    INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
   1.886 +                    iVideoPlayer->Prepare();
   1.887 +                    PrepareState(EVPPrepareComplete, KErrNone);    
   1.888 +                    }
   1.889 +                else
   1.890 +                    {
   1.891 +                    CActiveScheduler::Stop();
   1.892 +                    iTestStepResult = EPass;
   1.893 +                    break;
   1.894 +                    }
   1.895 +                break;
   1.896 +            case EVPPrepareComplete:
   1.897 +                // Close iVideoPlayer
   1.898 +                CActiveScheduler::Stop();
   1.899 +                INFO_PRINTF1(_L("iVideoPlayer->Close()"));
   1.900 +                iVideoPlayer->Close();
   1.901 +                User::After(KOneSecond);
   1.902 +                // Open iVideoPlayer Second time
   1.903 +                iOpenCount = 2;
   1.904 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
   1.905 +                iVideoPlayer->OpenFileL(iFilename, ControllerUid());
   1.906 +                PrepareState(EVPOpenComplete, KErrNone);
   1.907 +                CActiveScheduler::Start();
   1.908 +                break;
   1.909 +            }
   1.910 +        }
   1.911 +    }
   1.912 +
   1.913 +//
   1.914 +// RTestVclntPause
   1.915 +//
   1.916 +
   1.917 +/**
   1.918 + * RTestVclntPause::Constructor
   1.919 + */
   1.920 +RTestVclntPause::RTestVclntPause(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.921 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
   1.922 +    {}
   1.923 +
   1.924 +/**
   1.925 + * RTestVclntPause::NewL
   1.926 + */
   1.927 +RTestVclntPause* RTestVclntPause::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
   1.928 +    {
   1.929 +    RTestVclntPause* self = new (ELeave) RTestVclntPause(aTestName, aSectName, aKeyName, aExpectedError);
   1.930 +    return self;
   1.931 +    }
   1.932 +
   1.933 +/**
   1.934 + * RTestVclntPause::DoTestStepL
   1.935 + */
   1.936 +TVerdict RTestVclntPause::DoTestStepL()
   1.937 +    {
   1.938 +    // Call the state handler from IDLE state
   1.939 +    FsmL(EVPIdle);
   1.940 +    
   1.941 +    // Start the scheduler - Done only once !
   1.942 +    CActiveScheduler::Start();
   1.943 +    
   1.944 +    return iTestStepResult;
   1.945 +    }
   1.946 +
   1.947 +/**
   1.948 + * RTestVclntPause::FsmL
   1.949 + */
   1.950 +void RTestVclntPause::FsmL(TVclntTestPlayEvents aEventCode)
   1.951 +    {
   1.952 +    TTime stop;
   1.953 +    TTime start = NULL;
   1.954 +    
   1.955 +    if (FsmCheck(aEventCode))
   1.956 +        {
   1.957 +        switch (aEventCode)
   1.958 +            {
   1.959 +            case EVPIdle:
   1.960 +                // Open iVideoPlayer
   1.961 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
   1.962 +                TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
   1.963 +                PrepareState(EVPOpenComplete, KErrNone);
   1.964 +                break;
   1.965 +            case EVPOpenComplete:
   1.966 +                // Prepare iVideoPlayer
   1.967 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
   1.968 +                iVideoPlayer->Prepare();
   1.969 +                PrepareState(EVPPrepareComplete, KErrNone);
   1.970 +                break;
   1.971 +            case EVPPrepareComplete:
   1.972 +                // Play iVideoPlayer
   1.973 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.974 +                PrepareState(EVPPlayComplete, KErrNone);
   1.975 +                iVideoPlayer->Play();
   1.976 +                // Pause iVideoPlayer
   1.977 +                INFO_PRINTF1(_L("iVideoPlayer->Pause()"));
   1.978 +                TRAPD(err,iVideoPlayer->PauseL());
   1.979 +                if (err == KErrNotSupported)
   1.980 +                    {
   1.981 +                    INFO_PRINTF1(_L("Pause not supported presently"));
   1.982 +                    }
   1.983 +                else
   1.984 +                    {
   1.985 +                    INFO_PRINTF2(_L("Pause() returns with error :  %d"),err);
   1.986 +                    iTestStepResult = EFail;
   1.987 +                    CActiveScheduler::Stop();
   1.988 +                    break;
   1.989 +                    }
   1.990 +                // Stop iVideoPlayer
   1.991 +                INFO_PRINTF1(_L("iVideoPlayer->Stop()"));
   1.992 +                iVideoPlayer->Stop();
   1.993 +                // Get the duration of the file.
   1.994 +                iPlayerDuration = I64INT(iVideoPlayer->DurationL().Int64());
   1.995 +                // Resume play iVideoPlayer
   1.996 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
   1.997 +                iVideoPlayer->Play();
   1.998 +                // Note the start time
   1.999 +                start.HomeTime();    
  1.1000 +                break;
  1.1001 +            case EVPPlayComplete:
  1.1002 +                // Note the stop time
  1.1003 +                stop.HomeTime();
  1.1004 +                // Get the actual duration
  1.1005 +                iActualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
  1.1006 +                INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d PlayerDuration = %d ActualDuration = %d"),
  1.1007 +                    iError, I64INT(start.Int64()), I64INT(stop.Int64()), iPlayerDuration, iActualDuration);
  1.1008 +                // Check the results
  1.1009 +                if((iError == KErrNone) && (TimeComparison(iActualDuration, iPlayerDuration, KExpectedDeviation)))
  1.1010 +                    {
  1.1011 +                    iTestStepResult = EPass;
  1.1012 +                    }
  1.1013 +                CActiveScheduler::Stop();
  1.1014 +                break;
  1.1015 +            }
  1.1016 +        }
  1.1017 +    }
  1.1018 +
  1.1019 +//
  1.1020 +// RTestVclntBalance
  1.1021 +//
  1.1022 +
  1.1023 +/**
  1.1024 + * RTestVclntBalance::Constructor
  1.1025 + */
  1.1026 +RTestVclntBalance::RTestVclntBalance(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance)
  1.1027 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
  1.1028 +    {
  1.1029 +    iBalance = aBalance;
  1.1030 +    }
  1.1031 +
  1.1032 +/**
  1.1033 + * RTestVclntBalance::NewL
  1.1034 + */
  1.1035 +RTestVclntBalance* RTestVclntBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance)
  1.1036 +    {
  1.1037 +    RTestVclntBalance* self = new (ELeave) RTestVclntBalance(aTestName, aSectName, aKeyName, aExpectedError, aBalance);
  1.1038 +    return self;
  1.1039 +    }
  1.1040 +
  1.1041 +/**
  1.1042 + * RTestVclntBalance::DoTestL
  1.1043 + */
  1.1044 +TVerdict RTestVclntBalance::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1045 +    {
  1.1046 +    TVerdict ret = EFail;
  1.1047 +    TInt err = KErrNone;
  1.1048 +    
  1.1049 +    INFO_PRINTF1(_L("Test : Video Player - Balance"));
  1.1050 +    
  1.1051 +    // see if audio is enabled
  1.1052 +    if (aPlayer->AudioEnabledL())
  1.1053 +        {
  1.1054 +        INFO_PRINTF1(_L("AudioEnabledL() returned True"));
  1.1055 +        }
  1.1056 +    else
  1.1057 +        {
  1.1058 +        INFO_PRINTF1(_L("AudioEnabledL() returned False"));   
  1.1059 +        }
  1.1060 +    
  1.1061 +    // set the balance
  1.1062 +    TRAP(err, aPlayer->SetBalanceL(iBalance));
  1.1063 +    INFO_PRINTF2(_L("SetBalanceL() left with Error - %d"), err);
  1.1064 +    
  1.1065 +    // check for the valid balance    
  1.1066 +    if (iBalance < KMinBalance)
  1.1067 +        {
  1.1068 +        INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMinBalance);
  1.1069 +        if(aPlayer->Balance() == KMinBalance)
  1.1070 +            {
  1.1071 +            ret = EPass;
  1.1072 +            }
  1.1073 +        }
  1.1074 +    else if (iBalance > KMaxBalance)
  1.1075 +        {
  1.1076 +        INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMaxBalance);
  1.1077 +        if(aPlayer->Balance() == KMaxBalance)
  1.1078 +            {
  1.1079 +            ret = EPass;
  1.1080 +            }
  1.1081 +        }
  1.1082 +    else
  1.1083 +        {
  1.1084 +        INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), iBalance);
  1.1085 +        if(aPlayer->Balance() == iBalance)
  1.1086 +            {
  1.1087 +            ret = EPass;
  1.1088 +            }
  1.1089 +        }
  1.1090 +    
  1.1091 +    CActiveScheduler::Stop();
  1.1092 +    
  1.1093 +    return ret;
  1.1094 +    }
  1.1095 +
  1.1096 +
  1.1097 +//
  1.1098 +// RTestVclntPlayWindow
  1.1099 +//
  1.1100 +
  1.1101 +/**
  1.1102 + * RTestVclntPlayWindow::Constructor
  1.1103 + */
  1.1104 +RTestVclntPlayWindow::RTestVclntPlayWindow(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
  1.1105 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
  1.1106 +    {
  1.1107 +    iStart = aStart;
  1.1108 +    iEnd = aEnd;
  1.1109 +    }
  1.1110 +
  1.1111 +/**
  1.1112 + * RTestVclntPlayWindow::Constructor
  1.1113 + */
  1.1114 +RTestVclntPlayWindow* RTestVclntPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd)
  1.1115 +    {
  1.1116 +    RTestVclntPlayWindow* self = new (ELeave) RTestVclntPlayWindow(aTestName, aSectName, aKeyName, aExpectedError, aStart, aEnd);
  1.1117 +    return self;
  1.1118 +    }
  1.1119 +
  1.1120 +/**
  1.1121 + * RTestVclntPlayWindow::Constructor
  1.1122 + */
  1.1123 +TVerdict RTestVclntPlayWindow::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1124 +    {
  1.1125 +    TVerdict ret = EFail;
  1.1126 +
  1.1127 +    INFO_PRINTF1(_L("Test : Video Player - Window"));
  1.1128 +
  1.1129 +    TPoint rectOrigin(10, 10);
  1.1130 +    TSize rectSize(176, 144);
  1.1131 +    TRect rect(rectOrigin, rectSize);
  1.1132 +    
  1.1133 +    TPoint clipOrigin(10, 10);
  1.1134 +    TSize clipSize(176, 144);
  1.1135 +    TRect clipRect(clipOrigin, clipSize);
  1.1136 +    
  1.1137 +    // first call tests creation of display instance
  1.1138 +    TRAPD(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect));
  1.1139 +    INFO_PRINTF1(_L("Test : Made first call to SetDisplayWindowL()"));
  1.1140 +    if(err)
  1.1141 +        {
  1.1142 +        ERR_PRINTF2(_L("First call to SetDisplayWindowL() failed, error %d"), err);
  1.1143 +        CActiveScheduler::Stop();
  1.1144 +        return EFail;
  1.1145 +        }
  1.1146 +
  1.1147 +    // second call tests update of display instance
  1.1148 +    TRAP(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect));
  1.1149 +    INFO_PRINTF1(_L("Test : Made second call to SetDisplayWindowL()"));
  1.1150 +    if(err)
  1.1151 +        {
  1.1152 +        ERR_PRINTF2(_L("Second call to SetDisplayWindowL() failed, error %d"), err);
  1.1153 +        ret = EFail;
  1.1154 +        }
  1.1155 +    else
  1.1156 +        {
  1.1157 +        ret = EPass;
  1.1158 +        }
  1.1159 +
  1.1160 +    CActiveScheduler::Stop();
  1.1161 +    return ret;
  1.1162 +    }
  1.1163 +
  1.1164 +
  1.1165 +//
  1.1166 +// RTestVclntMeta
  1.1167 +//
  1.1168 +
  1.1169 +/**
  1.1170 + * RTestVclntMeta::Constructor
  1.1171 + */
  1.1172 +RTestVclntMeta::RTestVclntMeta(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1173 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
  1.1174 +    {}
  1.1175 +
  1.1176 +/**
  1.1177 + * RTestVclntMeta::Constructor
  1.1178 + */
  1.1179 +RTestVclntMeta* RTestVclntMeta::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1180 +    {
  1.1181 +    RTestVclntMeta* self = new (ELeave) RTestVclntMeta(aTestName, aSectName, aKeyName, aExpectedError);
  1.1182 +    return self;
  1.1183 +    }
  1.1184 +
  1.1185 +/**
  1.1186 + * RTestVclntMeta::Constructor
  1.1187 + */
  1.1188 +TVerdict RTestVclntMeta::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1189 +    {
  1.1190 +    INFO_PRINTF1(_L("Test : Video Player - Metadata"));
  1.1191 +    
  1.1192 +    CActiveScheduler::Stop();
  1.1193 +    
  1.1194 +    // there are zero meta entries now.
  1.1195 +    TInt numOfMeta = -1;
  1.1196 +    TRAPD(err, numOfMeta = aPlayer->NumberOfMetaDataEntriesL() );
  1.1197 +    INFO_PRINTF3(_L("Error : %d Entries = %d"), err, numOfMeta);
  1.1198 +    if (err != KErrNotSupported || numOfMeta != -1)
  1.1199 +        {
  1.1200 +        return EFail;
  1.1201 +        }
  1.1202 +    
  1.1203 +    // attempt to get an entry when no entry exists.
  1.1204 +    CMMFMetaDataEntry* theEntry=NULL;
  1.1205 +    TRAP(err, theEntry = aPlayer->MetaDataEntryL(1));
  1.1206 +    INFO_PRINTF2(_L("Error : %d"), err);
  1.1207 +    if (err != KErrNotSupported)
  1.1208 +        {
  1.1209 +        return EFail;
  1.1210 +        }
  1.1211 +    else 
  1.1212 +        {
  1.1213 +        delete theEntry;
  1.1214 +        return EPass;
  1.1215 +        }
  1.1216 +    }
  1.1217 +
  1.1218 +
  1.1219 +//
  1.1220 +// RTestVclntFrameSize
  1.1221 +//
  1.1222 +
  1.1223 +/**
  1.1224 + * RTestVclntFrameSize::Constructor
  1.1225 + */
  1.1226 +RTestVclntFrameSize::RTestVclntFrameSize(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1227 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse)
  1.1228 +    {
  1.1229 +    iFrameSize.iWidth = 0;
  1.1230 +    iFrameSize.iHeight = 0;
  1.1231 +    }
  1.1232 +
  1.1233 +/**
  1.1234 + * RTestVclntFrameSize::NewL
  1.1235 + */
  1.1236 +RTestVclntFrameSize* RTestVclntFrameSize::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1237 +    {
  1.1238 +    RTestVclntFrameSize* self = new (ELeave) RTestVclntFrameSize(aTestName, aSectName, aKeyName, aExpectedError);
  1.1239 +    return self;
  1.1240 +    }
  1.1241 +
  1.1242 +/**
  1.1243 + * RTestVclntFrameSize::DoTestL
  1.1244 + */
  1.1245 +TVerdict RTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1246 +    {
  1.1247 +    TVerdict ret = EFail;
  1.1248 +
  1.1249 +    INFO_PRINTF1(_L("Test : Video Player - Get Frame Size"));
  1.1250 +    TInt err;
  1.1251 +    TRAP(err, aPlayer->VideoFrameSizeL(iFrameSize));
  1.1252 +
  1.1253 +    INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, iFrameSize.iWidth, iFrameSize.iHeight);
  1.1254 +    if (err == KErrNone && iFrameSize.iWidth >= 0 && iFrameSize.iHeight >= 0 )
  1.1255 +        {
  1.1256 +        ret = EPass;
  1.1257 +        }
  1.1258 +    
  1.1259 +    CActiveScheduler::Stop();
  1.1260 +    
  1.1261 +    return ret;
  1.1262 +    }
  1.1263 +
  1.1264 +//
  1.1265 +// RTestVclntMimeType
  1.1266 +//
  1.1267 +
  1.1268 +/**
  1.1269 + * RTestVclntMimeType::Constructor
  1.1270 + */
  1.1271 +RTestVclntMimeType::RTestVclntMimeType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1272 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
  1.1273 +    {
  1.1274 +    }
  1.1275 +
  1.1276 +/**
  1.1277 + * RTestVclntMimeType::Constructor
  1.1278 + */
  1.1279 +RTestVclntMimeType* RTestVclntMimeType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1280 +    {
  1.1281 +    RTestVclntMimeType* self = new (ELeave) RTestVclntMimeType(aTestName, aSectName, aKeyName, aExpectedError);
  1.1282 +    return self;
  1.1283 +    }
  1.1284 +
  1.1285 +/**
  1.1286 + * RTestVclntMimeType::Constructor
  1.1287 + */
  1.1288 +TVerdict RTestVclntMimeType::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1289 +    {
  1.1290 +        
  1.1291 +    TVerdict ret = EFail;
  1.1292 +    
  1.1293 +    INFO_PRINTF1(_L("Test : Video Player - MimeType"));
  1.1294 +
  1.1295 +    // Get the Video Mime type
  1.1296 +    TPtrC8 mimeType = aPlayer->VideoFormatMimeType();
  1.1297 +
  1.1298 +    // take it to a 16-bit string
  1.1299 +    TBuf<64> mimeType16;
  1.1300 +    mimeType16.Copy(mimeType);
  1.1301 +    INFO_PRINTF2(_L("Mime type : \'%S\'"), &mimeType16);
  1.1302 +    
  1.1303 +    // Check if its valid
  1.1304 +    if (mimeType16.Compare(_L("XVID")) == 0)
  1.1305 +        {
  1.1306 +        INFO_PRINTF1(_L("MIME Types match"));
  1.1307 +        ret = EPass;
  1.1308 +        }
  1.1309 +    
  1.1310 +    CActiveScheduler::Stop();
  1.1311 +    
  1.1312 +    return ret;
  1.1313 +    }
  1.1314 +
  1.1315 +//
  1.1316 +// RTestVclntScale
  1.1317 +//
  1.1318 +
  1.1319 +/**
  1.1320 + * RTestVclntScale::Constructor
  1.1321 + */
  1.1322 +RTestVclntScale::RTestVclntScale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1323 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
  1.1324 +    {
  1.1325 +    }
  1.1326 +
  1.1327 +/**
  1.1328 + * RTestVclntScale::Constructor
  1.1329 + */
  1.1330 +RTestVclntScale* RTestVclntScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1331 +    {
  1.1332 +    RTestVclntScale* self = new (ELeave) RTestVclntScale(aTestName, aSectName, aKeyName, aExpectedError);
  1.1333 +    return self;
  1.1334 +    }
  1.1335 +
  1.1336 +/**
  1.1337 + * RTestVclntScale::Constructor
  1.1338 + */
  1.1339 +TVerdict RTestVclntScale::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1340 +    {
  1.1341 +    INFO_PRINTF1(_L("Test : Video Player - Scale Values test"));
  1.1342 +    
  1.1343 +    CActiveScheduler::Stop();
  1.1344 +    
  1.1345 +    // Set the scale factor using values set #1
  1.1346 +    INFO_PRINTF1(_L("iVideoPlayer->SetScaleFactorL() #1"));
  1.1347 +    TRAPD(err, aPlayer->SetScaleFactorL(100, 100, ETrue));
  1.1348 +
  1.1349 +#ifdef SYMBIAN_BUILD_GCE
  1.1350 +	TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone;
  1.1351 +#else
  1.1352 +	TInt expected = KErrNotSupported;
  1.1353 +#endif
  1.1354 +
  1.1355 +    if (err != expected)
  1.1356 +        {       
  1.1357 +        ERR_PRINTF2(_L("iVideoPlayer->SetScaleFactorL() encountered error : %d"), err);
  1.1358 +        return EFail;
  1.1359 +        }
  1.1360 +
  1.1361 +    return EPass;
  1.1362 +    }
  1.1363 +
  1.1364 +//
  1.1365 +// RTestVclntCrop
  1.1366 +//
  1.1367 +
  1.1368 +/**
  1.1369 + * RTestVclntCrop::Constructor
  1.1370 + */
  1.1371 +RTestVclntCrop::RTestVclntCrop(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1372 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
  1.1373 +    {
  1.1374 +    }
  1.1375 +
  1.1376 +/**
  1.1377 + * RTestVclntCrop::Constructor
  1.1378 + */
  1.1379 +RTestVclntCrop* RTestVclntCrop::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1380 +    {
  1.1381 +    RTestVclntCrop* self = new (ELeave) RTestVclntCrop(aTestName, aSectName, aKeyName, aExpectedError);
  1.1382 +    return self;
  1.1383 +    }
  1.1384 +
  1.1385 +/**
  1.1386 + * RTestVclntCrop::Constructor
  1.1387 + */
  1.1388 +TVerdict RTestVclntCrop::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1389 +    {
  1.1390 +    TRect cropRegion(KCropRegionRectLeft, KCropRegionRectTop, KCropRegionRectRight, KCropRegionRectBottom);
  1.1391 +    TRect region;
  1.1392 +    
  1.1393 +    INFO_PRINTF1(_L("Test : Video Player - Crop Values"));
  1.1394 +    
  1.1395 +    CActiveScheduler::Stop();
  1.1396 +
  1.1397 +    // Set the Crop Region
  1.1398 +    INFO_PRINTF1(_L("iVideoPlayer->SetCropRegionL()"));
  1.1399 +    TRAPD(err, aPlayer->SetCropRegionL(cropRegion));
  1.1400 +    
  1.1401 +#ifdef SYMBIAN_BUILD_GCE
  1.1402 +	TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone;
  1.1403 +#else
  1.1404 +	TInt expected = KErrNotSupported;
  1.1405 +#endif
  1.1406 +
  1.1407 +    if (err != expected)
  1.1408 +        {       
  1.1409 +        ERR_PRINTF2(_L("iVideoPlayer->SetCropRegionL() encountered error : %d"), err);
  1.1410 +        return EFail;
  1.1411 +        }
  1.1412 +
  1.1413 +    return EPass;
  1.1414 +    }
  1.1415 +    
  1.1416 +#ifdef SYMBIAN_BUILD_GCE
  1.1417 +
  1.1418 +RTestVclntAutoScale::RTestVclntAutoScale(const TDesC& aTestName)
  1.1419 +    : RTestVclntPlayAviFile(aTestName, KNullDesC, KNullDesC, KErrNone, EFalse)
  1.1420 +    {
  1.1421 +    }
  1.1422 +
  1.1423 +/**
  1.1424 + * RTestVclntCrop::Constructor
  1.1425 + */
  1.1426 +RTestVclntAutoScale* RTestVclntAutoScale::NewL(const TDesC& aTestName)
  1.1427 +    {
  1.1428 +    RTestVclntAutoScale* self = new (ELeave) RTestVclntAutoScale(aTestName);
  1.1429 +    return self;
  1.1430 +    }
  1.1431 +
  1.1432 +/**
  1.1433 + * RTestVclntCrop::Constructor
  1.1434 + */
  1.1435 +TVerdict RTestVclntAutoScale::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1436 +    {
  1.1437 +    INFO_PRINTF1(_L("Test : Video Player - AutoScale Values"));
  1.1438 +    
  1.1439 +    CActiveScheduler::Stop();
  1.1440 +
  1.1441 +    // Set auto scale
  1.1442 +    INFO_PRINTF1(_L("iVideoPlayer->SetAutoScaleL()"));
  1.1443 +    TRAPD(err, aPlayer->SetAutoScaleL(EAutoScaleBestFit));
  1.1444 +
  1.1445 +    if (err != KErrNone)
  1.1446 +        {
  1.1447 +        ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
  1.1448 +        return EFail;
  1.1449 +        }
  1.1450 +
  1.1451 +    TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleNone));
  1.1452 +
  1.1453 +    if (err != KErrNone)
  1.1454 +        {
  1.1455 +        ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
  1.1456 +        return EFail;
  1.1457 +        }
  1.1458 +
  1.1459 +    TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleClip));
  1.1460 +
  1.1461 +    if (err != KErrNone)
  1.1462 +        {
  1.1463 +        ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
  1.1464 +        return EFail;
  1.1465 +        }
  1.1466 +
  1.1467 +    TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleStretch, EHorizontalAlignLeft, EVerticalAlignBottom));
  1.1468 +
  1.1469 +    if (err != KErrNone)
  1.1470 +        {
  1.1471 +        ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err);
  1.1472 +        return EFail;
  1.1473 +        }
  1.1474 +
  1.1475 +    return EPass;
  1.1476 +    }
  1.1477 +
  1.1478 +#endif // SYMBIAN_BUILD_GCE
  1.1479 +
  1.1480 +//
  1.1481 +// RTestVclntGetFrame
  1.1482 +//
  1.1483 +
  1.1484 +/**
  1.1485 + * RTestVclntGetFrame::Constructor
  1.1486 + */
  1.1487 +RTestVclntGetFrame::RTestVclntGetFrame(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI)
  1.1488 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse), iUseIntentAPI(aUseIntentAPI)
  1.1489 +    {
  1.1490 +    }
  1.1491 +
  1.1492 +/**
  1.1493 + * RTestVclntGetFrame::Constructor
  1.1494 + */
  1.1495 +RTestVclntGetFrame* RTestVclntGetFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI)
  1.1496 +    {
  1.1497 +    RTestVclntGetFrame* self = new (ELeave) RTestVclntGetFrame(aTestName, aSectName, aKeyName, aExpectedError, aUseIntentAPI);
  1.1498 +    return self;
  1.1499 +    }
  1.1500 +
  1.1501 +/**
  1.1502 + * RTestVclntGetFrame::DoTestStepL
  1.1503 + */
  1.1504 +TVerdict RTestVclntGetFrame::DoTestStepL()
  1.1505 +    {
  1.1506 +    // Call the state handler from IDLE state
  1.1507 +    FsmL(EVPIdle);
  1.1508 +    
  1.1509 +    // Start the scheduler - Done only once !
  1.1510 +    CActiveScheduler::Start();
  1.1511 +    
  1.1512 +    return iTestStepResult;
  1.1513 +    }
  1.1514 +
  1.1515 +/**
  1.1516 + * RTestVclntGetFrame::FsmL
  1.1517 + */
  1.1518 +void RTestVclntGetFrame::FsmL(TVclntTestPlayEvents aEventCode)
  1.1519 +    {
  1.1520 +    if (FsmCheck(aEventCode))
  1.1521 +        {
  1.1522 +        switch (aEventCode)
  1.1523 +            {
  1.1524 +            case EVPIdle:
  1.1525 +                // Open iVideoPlayer
  1.1526 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
  1.1527 +                TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
  1.1528 +                PrepareState(EVPOpenComplete, KErrNone);
  1.1529 +                break;
  1.1530 +            case EVPOpenComplete:
  1.1531 +                // Prepare iVideoPlayer
  1.1532 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.1533 +                iVideoPlayer->Prepare();
  1.1534 +                PrepareState(EVPPrepareComplete, KErrNone);
  1.1535 +                break;
  1.1536 +            case EVPPrepareComplete:
  1.1537 +                // Play iVideoPlayer
  1.1538 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.1539 +                iVideoPlayer->Play();
  1.1540 +                // Call GetFrameL
  1.1541 +                if (iUseIntentAPI)
  1.1542 +                    {
  1.1543 +                    INFO_PRINTF1(_L("iVideoPlayer->GetFrameL() with EPeek Intent"));
  1.1544 +                    TRAP(iError, iVideoPlayer->GetFrameL(EColor16M, ContentAccess::EPeek));
  1.1545 +                    INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError);
  1.1546 +                    }
  1.1547 +                else 
  1.1548 +                    {
  1.1549 +                    INFO_PRINTF1(_L("iVideoPlayer->GetFrameL()"));
  1.1550 +                    TRAP(iError, iVideoPlayer->GetFrameL(EColor16M));
  1.1551 +                    INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError);
  1.1552 +                    }
  1.1553 +                PrepareState(EVPFrameReady, KErrNone);
  1.1554 +            case EVPFrameReady:
  1.1555 +                // Stop iVideoPlayer
  1.1556 +                iVideoPlayer->Stop();
  1.1557 +                CActiveScheduler::Stop();
  1.1558 +                iTestStepResult = EPass;
  1.1559 +                break;
  1.1560 +            }
  1.1561 +        }
  1.1562 +    }
  1.1563 +
  1.1564 +/**
  1.1565 + * RTestVclntGetFrame::MvpuoFrameReady
  1.1566 + * Overriding the callback method here, to check the bitmap..
  1.1567 + */
  1.1568 +void RTestVclntGetFrame::MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError)
  1.1569 +    {
  1.1570 +    if (aError!=KErrNone)
  1.1571 +        {
  1.1572 +        iError = aError;
  1.1573 +        }
  1.1574 +    else if (aFrame.Handle() == NULL || aFrame.SizeInPixels() != TSize(KFrameWidth, KFrameHeight) )
  1.1575 +        {
  1.1576 +        iError = KErrArgument;
  1.1577 +        ERR_PRINTF1(_L("The Frame returned is either NULL or there is a mismatch in the size.."));
  1.1578 +        }
  1.1579 +    TRAP(iError, FsmL(EVPFrameReady));
  1.1580 +    INFO_PRINTF2(_L("Error code : %d"),iError);
  1.1581 +    }
  1.1582 +
  1.1583 +    
  1.1584 +//
  1.1585 +// RTestVclntRebuffering
  1.1586 +//
  1.1587 +
  1.1588 +/**
  1.1589 + * RTestVclntRebuffering::Constructor
  1.1590 + */
  1.1591 +RTestVclntRebuffering::RTestVclntRebuffering(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1592 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
  1.1593 +    {
  1.1594 +    }
  1.1595 +
  1.1596 +/**
  1.1597 + * RTestVclntRebuffering::NewL
  1.1598 + */
  1.1599 +RTestVclntRebuffering* RTestVclntRebuffering::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1600 +    {
  1.1601 +    RTestVclntRebuffering* self = new (ELeave) RTestVclntRebuffering(aTestName, aSectName, aKeyName, aExpectedError);
  1.1602 +    return self;
  1.1603 +    }
  1.1604 +
  1.1605 +/**
  1.1606 + * RTestVclntRebuffering::DoTestL
  1.1607 + */
  1.1608 +TVerdict RTestVclntRebuffering::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1609 +    {
  1.1610 +    INFO_PRINTF1(_L("Test : Video Player - Rebuffering"));
  1.1611 +
  1.1612 +    aPlayer->RegisterForVideoLoadingNotification(*this);
  1.1613 +
  1.1614 +    INFO_PRINTF1(_L("Rebuffering request completed"));
  1.1615 +    
  1.1616 +    CActiveScheduler::Stop();
  1.1617 +    
  1.1618 +    return EPass;
  1.1619 +    }
  1.1620 +
  1.1621 +/**
  1.1622 + * RTestVclntRebuffering::MvloLoadingStarted
  1.1623 + */
  1.1624 +void RTestVclntRebuffering::MvloLoadingStarted()
  1.1625 +    {
  1.1626 +    INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingStarted"));
  1.1627 +    }
  1.1628 +
  1.1629 +/**
  1.1630 + * RTestVclntRebuffering::MvloLoadingComplete
  1.1631 + */
  1.1632 +void RTestVclntRebuffering::MvloLoadingComplete()
  1.1633 +    {
  1.1634 +    INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingComplete"));
  1.1635 +    }
  1.1636 +
  1.1637 +//
  1.1638 +// RTestVclntRepeat
  1.1639 +//
  1.1640 +
  1.1641 +/**
  1.1642 + * RTestVclntRepeat::Constructor
  1.1643 + */
  1.1644 +RTestVclntRepeat::RTestVclntRepeat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat)
  1.1645 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
  1.1646 +    {
  1.1647 +    iRepeat = aRepeat;
  1.1648 +    }
  1.1649 +
  1.1650 +/**
  1.1651 + * RTestVclntRepeat::NewL
  1.1652 + */
  1.1653 +RTestVclntRepeat* RTestVclntRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat)
  1.1654 +    {
  1.1655 +    RTestVclntRepeat* self = new (ELeave) RTestVclntRepeat(aTestName, aSectName, aKeyName, aExpectedError, aRepeat);
  1.1656 +    return self;
  1.1657 +    }
  1.1658 +
  1.1659 +/**
  1.1660 + * RTestVclntRepeat::DoTestL
  1.1661 +  */
  1.1662 +  //The commented lines are kept for future implementation
  1.1663 +  
  1.1664 +TVerdict RTestVclntRepeat::DoTestL(CVideoPlayerUtility* aPlayer)
  1.1665 +    {
  1.1666 +    TVerdict ret = EFail;
  1.1667 +
  1.1668 +    INFO_PRINTF1(_L("Test : Video Player - Repeats"));
  1.1669 +    iRepeat = 1;
  1.1670 +    INFO_PRINTF1(_L("Warning : SetRepeats() does not exist in iVideoPlayer API. Repeat count set to 1"));
  1.1671 +    
  1.1672 +    INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.1673 +    PrepareState(EVPPlayComplete, KErrNone);
  1.1674 +    aPlayer->Play();
  1.1675 +    
  1.1676 +    CActiveScheduler::Start();
  1.1677 +    
  1.1678 +    if(iError == KErrNotSupported || iRepeat == 1) 
  1.1679 +        {
  1.1680 +        ret = EPass;    
  1.1681 +        INFO_PRINTF2(_L("Repeat not supported currently : err : %d"),iError);   
  1.1682 +        }
  1.1683 +    else
  1.1684 +        {
  1.1685 +        ret = EFail;
  1.1686 +        INFO_PRINTF2(_L("Returned with : err : %d"),iError);   
  1.1687 +        }    
  1.1688 +        
  1.1689 +    CActiveScheduler::Stop();
  1.1690 +    
  1.1691 +    return ret;
  1.1692 +    }
  1.1693 +
  1.1694 +//
  1.1695 +// RTestVclntDelete
  1.1696 +//
  1.1697 +
  1.1698 +/**
  1.1699 + * RTestVclntDelete::Constructor
  1.1700 + */
  1.1701 +RTestVclntDelete::RTestVclntDelete(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1702 +    : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse)
  1.1703 +    {}
  1.1704 +
  1.1705 +/**
  1.1706 + * RTestVclntDelete::NewL
  1.1707 + */
  1.1708 +RTestVclntDelete* RTestVclntDelete::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.1709 +    {
  1.1710 +    RTestVclntDelete* self = new (ELeave) RTestVclntDelete(aTestName, aSectName, aKeyName, aExpectedError);
  1.1711 +    return self;
  1.1712 +    }
  1.1713 +
  1.1714 +/**
  1.1715 + * RTestVclntDelete::DoTestStepL
  1.1716 + */
  1.1717 +TVerdict RTestVclntDelete::DoTestStepL()
  1.1718 +    {
  1.1719 +    // Call the state handler from IDLE state
  1.1720 +    FsmL(EVPIdle);
  1.1721 +    
  1.1722 +    // Start the scheduler - Done only once !
  1.1723 +    CActiveScheduler::Start();
  1.1724 +    
  1.1725 +    return iTestStepResult;
  1.1726 +    }
  1.1727 +
  1.1728 +/**
  1.1729 + * RTestVclntDelete::FsmL
  1.1730 + */
  1.1731 +void RTestVclntDelete::FsmL(TVclntTestPlayEvents aEventCode)
  1.1732 +    {
  1.1733 +    if (FsmCheck(aEventCode))
  1.1734 +        {
  1.1735 +        switch (aEventCode)
  1.1736 +            {
  1.1737 +            case EVPIdle:
  1.1738 +                // Open iVideoPlayer
  1.1739 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename);
  1.1740 +                TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid()));
  1.1741 +                PrepareState(EVPOpenComplete, KErrNone);
  1.1742 +                break;
  1.1743 +            case EVPOpenComplete:
  1.1744 +                // Prepare iVideoPlayer
  1.1745 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.1746 +                iVideoPlayer->Prepare();
  1.1747 +                PrepareState(EVPPrepareComplete, KErrNone);    
  1.1748 +                break;
  1.1749 +            case EVPPrepareComplete:
  1.1750 +                // Play iVideoPlayer
  1.1751 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.1752 +                iVideoPlayer->Play();
  1.1753 +                PrepareState(EVPPlayComplete, KErrNone);
  1.1754 +                INFO_PRINTF1(_L("delete iVideoPlayer before Play completes"));
  1.1755 +                
  1.1756 +                iVideoPlayer = NULL;
  1.1757 +                delete iVideoPlayer; // destroy iVideoPlayer before play has completed
  1.1758 +                
  1.1759 +                CActiveScheduler::Stop();
  1.1760 +                iTestStepResult = EPass;
  1.1761 +                break;
  1.1762 +            }
  1.1763 +        }
  1.1764 +    }
  1.1765 +
  1.1766 +//
  1.1767 +// RTestVclntPlayAviFileHandle
  1.1768 +//
  1.1769 +
  1.1770 +/**
  1.1771 + * RTestVclntPlayAviFileHandle::Constructor
  1.1772 + */
  1.1773 +RTestVclntPlayAviFileHandle::RTestVclntPlayAviFileHandle(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc)
  1.1774 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iAlloc(aAlloc)
  1.1775 +    {
  1.1776 +    iIsOpen = EFalse;
  1.1777 +    }
  1.1778 +
  1.1779 +/**
  1.1780 + * RTestVclntPlayAviFileHandle::NewL
  1.1781 + */
  1.1782 +RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc)
  1.1783 +    {
  1.1784 +    RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc);
  1.1785 +    return self;
  1.1786 +    }
  1.1787 +
  1.1788 +/**
  1.1789 + * RTestVclntPlayAviFileHandle::NewLC
  1.1790 + */
  1.1791 +RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc)
  1.1792 +    {
  1.1793 +    RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc);
  1.1794 +    CleanupStack::PushL(self);
  1.1795 +    return self;
  1.1796 +    }
  1.1797 +
  1.1798 +/**
  1.1799 + * RTestVclntPlayAviFileHandle::DoTestStepL()
  1.1800 + */
  1.1801 +TVerdict RTestVclntPlayAviFileHandle::DoTestStepL()
  1.1802 +    {
  1.1803 +	if(SetCacheSize()!=KErrNone)
  1.1804 +    	{
  1.1805 +    	return EInconclusive;
  1.1806 +    	}
  1.1807 +
  1.1808 +    if (iAlloc)
  1.1809 +        {
  1.1810 +        TVerdict iAllocTestStepResult=EPass;
  1.1811 +        TInt err = KErrNone;
  1.1812 +        TBool result = EFalse;
  1.1813 +        
  1.1814 +        //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
  1.1815 +        if( PerformTestStepL() != EPass )
  1.1816 +            {
  1.1817 +            err = iError;
  1.1818 +            }
  1.1819 +
  1.1820 +        if (err != KErrNone)
  1.1821 +            {
  1.1822 +            INFO_PRINTF2(_L("Test error, returned error code =  %d"), err);
  1.1823 +            User::Leave(err);
  1.1824 +            }
  1.1825 +        else
  1.1826 +            {
  1.1827 +            //Check the iAllocTestStepResult
  1.1828 +            if (iAllocTestStepResult != EPass)
  1.1829 +                {
  1.1830 +                result = ETrue;
  1.1831 +                }
  1.1832 +            }    
  1.1833 +        
  1.1834 +        TInt failCount = 1;
  1.1835 +        TBool completed = EFalse;
  1.1836 +        iAllocTestStepResult = EPass; // XXX check?? assume pass
  1.1837 +        TBool reachedEnd = EFalse; // Note: declare outside loop to help with debugging
  1.1838 +        for(;;)    
  1.1839 +            {
  1.1840 +            __UHEAP_SETFAIL(RHeap::EFailNext, failCount);
  1.1841 +            __MM_HEAP_MARK;
  1.1842 +            
  1.1843 +             //INFO_PRINTF2(_L("CVideoPlayerUtility: Alloc Test Loop: %d"), failCount);
  1.1844 +            //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<<
  1.1845 +            TVerdict verdict = EFail;
  1.1846 +            TRAP(err, verdict = PerformTestStepL());
  1.1847 +            if (err == KErrNone && verdict != EPass)
  1.1848 +                {
  1.1849 +                err = iError;
  1.1850 +                }
  1.1851 +
  1.1852 +            completed = EFalse;
  1.1853 +            if (err == KErrNone)
  1.1854 +                {
  1.1855 +                TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
  1.1856 +                if (testAlloc == NULL)
  1.1857 +                    {
  1.1858 +                    reachedEnd = ETrue;
  1.1859 +                    failCount -= 1;
  1.1860 +                    }
  1.1861 +                else
  1.1862 +                    {
  1.1863 +                    User::Free(testAlloc);    
  1.1864 +                    }            
  1.1865 +                
  1.1866 +                //Check the iAllocTestStepResult
  1.1867 +                if (iAllocTestStepResult != EPass)
  1.1868 +                    {
  1.1869 +                    result = ETrue;
  1.1870 +                    }
  1.1871 +                
  1.1872 +                completed = reachedEnd || result;
  1.1873 +                }
  1.1874 +            else if (err != KErrNoMemory) // bad error code
  1.1875 +                {
  1.1876 +                completed = ETrue;
  1.1877 +                result = EFail;
  1.1878 +                }            
  1.1879 +
  1.1880 +            __MM_HEAP_MARKEND;
  1.1881 +            __UHEAP_SETFAIL(RHeap::ENone, 0);
  1.1882 +
  1.1883 +            if (completed)
  1.1884 +                {
  1.1885 +                break; // exit loop
  1.1886 +                }
  1.1887 +
  1.1888 +            failCount++;
  1.1889 +            }
  1.1890 +
  1.1891 +        failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc
  1.1892 +
  1.1893 +        if (err != KErrNone || result)
  1.1894 +            {
  1.1895 +            iAllocTestStepResult = EFail;
  1.1896 +            TBuf<80> format;
  1.1897 +            if (result)
  1.1898 +                {
  1.1899 +                format.Format(_L("  Bad result with %d memory allocations tested\n"), failCount);
  1.1900 +                }
  1.1901 +            else
  1.1902 +                {
  1.1903 +                format.Format(_L("  Error(%d) with %d memory allocations tested\n"), err, failCount);
  1.1904 +                }
  1.1905 +            Log(format);
  1.1906 +            }
  1.1907 +        else 
  1.1908 +            {
  1.1909 +            TBuf<80> format;
  1.1910 +            format.Format(_L("  Completed OK with %d memory allocations tested\n"), failCount);
  1.1911 +            Log(format);
  1.1912 +            }
  1.1913 +    	TUint defaultCacheSize = 0; 
  1.1914 +    	//Done with the test. Setting 0 makes the cache size revert back to boot up values
  1.1915 +    	TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)defaultCacheSize,(TAny*)defaultCacheSize);
  1.1916 +        if(CheckCacheError(error)!=KErrNone)
  1.1917 +        	{
  1.1918 +        	INFO_PRINTF1(_L("Could not revert the cache size to default"));
  1.1919 +        	iAllocTestStepResult=EInconclusive;
  1.1920 +        	}
  1.1921 +        return iAllocTestStepResult;
  1.1922 +        }
  1.1923 +    else
  1.1924 +        {
  1.1925 +        return( PerformTestStepL() );    
  1.1926 +        }
  1.1927 +    }
  1.1928 +
  1.1929 +/**
  1.1930 + * RTestVclntPlayAviFileHandle::PerformTestStepL()
  1.1931 + */
  1.1932 +TVerdict RTestVclntPlayAviFileHandle::PerformTestStepL()
  1.1933 +    {
  1.1934 +    INFO_PRINTF1(_L("Test : Video Player - OpenFileL(RFile&)"));
  1.1935 +    
  1.1936 +    // Connect to RFs
  1.1937 +    User::LeaveIfError(iFs.Connect());
  1.1938 +    User::LeaveIfError(iFs.ShareProtected());
  1.1939 +    CleanupClosePushL(iFs);
  1.1940 +    
  1.1941 +    // Open RFile
  1.1942 +    User::LeaveIfError(iFile.Open(iFs, iFilename, EFileRead));
  1.1943 +    CleanupClosePushL(iFile);
  1.1944 +    
  1.1945 +    // Call the state handler from IDLE state
  1.1946 +    iError = KErrNone;
  1.1947 +    PrepareState(EVPIdle, KErrNone);
  1.1948 +    FsmL(EVPIdle);
  1.1949 +    
  1.1950 +    // Start the scheduler - Done only once !
  1.1951 +    CActiveScheduler::Start();
  1.1952 +    
  1.1953 +    CleanupStack::PopAndDestroy(2);
  1.1954 +    
  1.1955 +    // Leave if the Expected error is KErrNone    
  1.1956 +    if (iTestExpectedError == KErrNone)
  1.1957 +        {
  1.1958 +        User::LeaveIfError(iError);
  1.1959 +        }
  1.1960 +
  1.1961 +    return iTestStepResult;
  1.1962 +    }
  1.1963 +
  1.1964 +
  1.1965 +/**
  1.1966 + * RTestVclntPlayAviFileHandle::FsmL()
  1.1967 + */
  1.1968 +void RTestVclntPlayAviFileHandle::FsmL(TVclntTestPlayEvents aEventCode)
  1.1969 +    {
  1.1970 +    if (FsmCheck(aEventCode))
  1.1971 +        {
  1.1972 +        switch (aEventCode)
  1.1973 +            {
  1.1974 +            case EVPIdle:
  1.1975 +                // Open iVideoPlayer
  1.1976 +                if ((iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-1013-HP")) == 0) ||
  1.1977 +                	(iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-9113-HP")) == 0))
  1.1978 +                    {
  1.1979 +                    INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S with Invalid Controller UID"), &iFilename);
  1.1980 +                    TRAP(iError, iVideoPlayer->OpenFileL(iFile, KVideoInvalidControllerUid));
  1.1981 +                    INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() returned error - %d"), iError);
  1.1982 +                    PrepareState(EVPOpenComplete, KErrNone);
  1.1983 +                    }
  1.1984 +                else
  1.1985 +                    {
  1.1986 +                    INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
  1.1987 +                	iVideoPlayer->OpenFileL(iFile, ControllerUid());
  1.1988 +                    PrepareState(EVPOpenComplete, KErrNone);
  1.1989 +                    }
  1.1990 +                break;
  1.1991 +            case EVPOpenComplete:
  1.1992 +                iIsOpen = ETrue; //-set iIsOpen flag (for closing Player, in case of Underflow)...
  1.1993 +                // Prepare iVideoPlayer
  1.1994 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.1995 +                PrepareState(EVPPrepareComplete, KErrNone);
  1.1996 +                iVideoPlayer->Prepare();
  1.1997 +                break;
  1.1998 +            case EVPPrepareComplete:
  1.1999 +                // Play iVideoPlayer
  1.2000 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2001 +                iVideoPlayer->Play();
  1.2002 +                PrepareState(EVPPlayComplete, KErrNone);
  1.2003 +                break;
  1.2004 +            case EVPPlayComplete:
  1.2005 +                iVideoPlayer->Stop();
  1.2006 +                iVideoPlayer->Close();
  1.2007 +                CActiveScheduler::Stop();
  1.2008 +                iTestStepResult = EPass;
  1.2009 +                break;
  1.2010 +            }
  1.2011 +        }
  1.2012 +    else if(iIsOpen)
  1.2013 +        {
  1.2014 +        iVideoPlayer->Close();
  1.2015 +        }
  1.2016 +    }
  1.2017 +
  1.2018 +TInt RTestVclntPlayAviFileHandle::SetCacheSize()
  1.2019 +	{
  1.2020 +	TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize);
  1.2021 +	TInt ret=CheckCacheError(error);
  1.2022 +		
  1.2023 +	return ret;
  1.2024 +	}
  1.2025 +
  1.2026 +TInt RTestVclntPlayAviFileHandle::CheckCacheError(TInt aError)
  1.2027 +	{
  1.2028 +	TInt ret=KErrNone;
  1.2029 +	#ifdef __WINSCW__
  1.2030 +	//Winscw does not support getting cache size. Ignoring -5 error
  1.2031 +	if(aError!=KErrNone)
  1.2032 +		{
  1.2033 +		if(aError!=KErrNotSupported)
  1.2034 +			{
  1.2035 +			INFO_PRINTF2(_L("Could not get the cache size  %d"),aError);
  1.2036 +			ret=aError;
  1.2037 +			}
  1.2038 +		}
  1.2039 +	#else
  1.2040 +	if(aError!=KErrNone)
  1.2041 +		{//For ARMV5 we stop for all errors
  1.2042 +		INFO_PRINTF2(_L("Could not get the cache size  %d"),aError);
  1.2043 +		ret=aError;
  1.2044 +		}
  1.2045 +	#endif
  1.2046 +	return ret;
  1.2047 +	}
  1.2048 +
  1.2049 +
  1.2050 +//
  1.2051 +// RTestVideoPlayCapabilityVelocity
  1.2052 +//
  1.2053 +
  1.2054 +/**
  1.2055 +RTestVideoPlayCapabilityVelocity::Constructor
  1.2056 +*/
  1.2057 +RTestVideoPlayCapabilityVelocity::RTestVideoPlayCapabilityVelocity(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
  1.2058 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
  1.2059 +    { ;
  1.2060 +    }
  1.2061 +
  1.2062 +/**
  1.2063 +RTestVideoPlayCapabilityVelocity::NewL
  1.2064 +*/
  1.2065 +RTestVideoPlayCapabilityVelocity* RTestVideoPlayCapabilityVelocity::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2066 +	{
  1.2067 +    RTestVideoPlayCapabilityVelocity* self = new (ELeave) RTestVideoPlayCapabilityVelocity(aTestName, aSectName, aKeyName, aExpectedError);
  1.2068 +    return self;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  1.2069 +    }
  1.2070 +
  1.2071 +/**
  1.2072 +RTestVideoPlayCapabilityVelocity::DoTestStepL()
  1.2073 +*/
  1.2074 +TVerdict RTestVideoPlayCapabilityVelocity::DoTestStepL()
  1.2075 +    {
  1.2076 +    // Call the state handler from IDLE state
  1.2077 +    TRAPD(err, FsmL(EVPIdle));
  1.2078 +    if (err == KErrNone)
  1.2079 +        {
  1.2080 +        // Start the scheduler - Done only once !
  1.2081 +        CActiveScheduler::Start();    
  1.2082 +        }
  1.2083 +    return iTestStepResult;  
  1.2084 +    }
  1.2085 +/**
  1.2086 +RTestVideoPlayCapabilityVelocity::FsmL()
  1.2087 +*/
  1.2088 +void RTestVideoPlayCapabilityVelocity::FsmL(TVclntTestPlayEvents aEventCode)
  1.2089 +    {
  1.2090 +    const TUint KVelocityDefault = 100;
  1.2091 +    const TUint KVelocityMinPositive = 1;
  1.2092 +    const TInt KVelocityMinNegative = -1;
  1.2093 +    const TUint KVelocityPositive = 200;
  1.2094 +    const TUint KVelocityBigPositive = 500;
  1.2095 +    const TInt KVelocityNegative = -200;
  1.2096 +    const TInt KVelocityBigNegative= -500;
  1.2097 +    //Set default value for PlayRateCapability
  1.2098 +    iVideoPlayRateCapabilities.iStepForward = 1;
  1.2099 +    iVideoPlayRateCapabilities.iPlayBackward = 0;
  1.2100 +    if (FsmCheck(aEventCode))
  1.2101 +        {
  1.2102 +        TInt err;
  1.2103 +        switch (aEventCode)
  1.2104 +            {
  1.2105 +            case EVPIdle:
  1.2106 +	        	//Calling GetPlayRateCapabilitiesL() before opening should return KErrNotReady.
  1.2107 +	        	INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()"));            	
  1.2108 +	            TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities));
  1.2109 +	            if( err != KErrNotReady)
  1.2110 +	            	{
  1.2111 +	            	INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned wrong err= %d"), err);
  1.2112 +	                iTestStepResult = EFail;
  1.2113 +	                CActiveScheduler::Stop();
  1.2114 +	                return;                	
  1.2115 +	            	}
  1.2116 +	            iPlayVelocity = KVelocityDefault;
  1.2117 +	        	//Calling SetPlayVelocityL() before opening should return KErrNotReady.
  1.2118 +	        	INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity);
  1.2119 +                TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity));
  1.2120 +                if(KErrNotReady != err)
  1.2121 +                	{
  1.2122 +                	INFO_PRINTF2(_L("SetPlayVelocityL returned wrong err= %d"), err);
  1.2123 +                    iTestStepResult = EFail;
  1.2124 +                    CActiveScheduler::Stop();
  1.2125 +                    return;
  1.2126 +                	}
  1.2127 +
  1.2128 +                //calling PlayVelocityL before opening should result in error KErrNotReady
  1.2129 +            	INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()"));            	
  1.2130 +                TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL());
  1.2131 +                if( err != KErrNotReady)
  1.2132 +                	{
  1.2133 +                	INFO_PRINTF2(_L("PlayVelocityL returned wrong err= %d"), err);
  1.2134 +                    iTestStepResult = EFail;
  1.2135 +                    CActiveScheduler::Stop();
  1.2136 +                    return;
  1.2137 +                	}
  1.2138 +                
  1.2139 +                // Open iVideoPlayer
  1.2140 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
  1.2141 +                iVideoPlayer->OpenFileL(iFilename);
  1.2142 +                PrepareState(EVPOpenComplete, KErrNone);
  1.2143 +                break;
  1.2144 +            case EVPOpenComplete:
  1.2145 +            	//Get playrate capabilities
  1.2146 +            	INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()"));            	
  1.2147 +                TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities));
  1.2148 +                if( err != KErrNone)
  1.2149 +                	{
  1.2150 +                	INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err);
  1.2151 +                	INFO_PRINTF1(_L("invalid TPlayRateCapabilities"));
  1.2152 +                    iTestStepResult = EFail;
  1.2153 +                    CActiveScheduler::Stop();
  1.2154 +                    return;                	
  1.2155 +                	}
  1.2156 +            	INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayForward= %d"), iVideoPlayRateCapabilities.iPlayForward);
  1.2157 +                INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayBackward= %d"), iVideoPlayRateCapabilities.iPlayBackward);
  1.2158 +                INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepForward= %d"), iVideoPlayRateCapabilities.iStepForward);
  1.2159 +                INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepBackward= %d"), iVideoPlayRateCapabilities.iStepBackward);                
  1.2160 +                if ((iVideoPlayRateCapabilities.iPlayForward != 0) && (iVideoPlayRateCapabilities.iPlayForward != 1)||
  1.2161 +                	(iVideoPlayRateCapabilities.iPlayBackward != 0) && (iVideoPlayRateCapabilities.iPlayBackward != 1)||
  1.2162 +                	(iVideoPlayRateCapabilities.iStepForward != 0) && (iVideoPlayRateCapabilities.iStepForward != 1)||
  1.2163 +                	(iVideoPlayRateCapabilities.iStepBackward != 0) && (iVideoPlayRateCapabilities.iStepBackward != 1) )
  1.2164 +                	{
  1.2165 +                	INFO_PRINTF1(_L("invalid TPlayRateCapabilities"));
  1.2166 +                    iTestStepResult = EFail;
  1.2167 +                    CActiveScheduler::Stop();
  1.2168 +                    return;
  1.2169 +                	}
  1.2170 +                
  1.2171 +                //Get default play velocity, it shall be 100.
  1.2172 +            	INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()"));            	
  1.2173 +                TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL());
  1.2174 +                if( err != KErrNone)
  1.2175 +                	{
  1.2176 +                	INFO_PRINTF2(_L("PlayVelocityL returned err= %d"), err);
  1.2177 +                	INFO_PRINTF1(_L("invalid TPlayRateCapabilities"));
  1.2178 +                    iTestStepResult = EFail;
  1.2179 +                    CActiveScheduler::Stop();
  1.2180 +                    return;                	
  1.2181 +                	}
  1.2182 +            	
  1.2183 +            	if( iPlayVelocity != KVelocityDefault )
  1.2184 +            		{
  1.2185 +                	INFO_PRINTF2(_L("invalid default play velocity =%d"), iPlayVelocity);
  1.2186 +                    iTestStepResult = EFail;
  1.2187 +                    CActiveScheduler::Stop();
  1.2188 +                    return;
  1.2189 +            		}
  1.2190 +            	
  1.2191 +                // Prepare iVideoPlayer
  1.2192 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.2193 +                PrepareState(EVPPrepareComplete, KErrNone);
  1.2194 +                iVideoPlayer->Prepare();
  1.2195 +                break;
  1.2196 +            case EVPPrepareComplete:
  1.2197 +            	//Try to set different play velocities and play.
  1.2198 +	        	INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity);
  1.2199 +                TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity));
  1.2200 +                if(KErrNotSupported == err)
  1.2201 +                	{
  1.2202 +                	if(iVideoPlayRateCapabilities.iPlayForward || iVideoPlayRateCapabilities.iPlayBackward)
  1.2203 +                		{
  1.2204 +	                	INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err);
  1.2205 +	                    iTestStepResult = EFail;
  1.2206 +	                    CActiveScheduler::Stop();
  1.2207 +	                    return;                	
  1.2208 +                		}
  1.2209 +                	INFO_PRINTF1(_L("SetPlayVelocityL returned err KErrNotSupported"));
  1.2210 +                	}
  1.2211 +                else if( err != KErrNone)
  1.2212 +                	{
  1.2213 +                	INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err);
  1.2214 +                    iTestStepResult = EFail;
  1.2215 +                    CActiveScheduler::Stop();
  1.2216 +                    return;                	
  1.2217 +                	}	        	
  1.2218 +                // Play iVideoPlayer
  1.2219 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2220 +                iVideoPlayer->Play();
  1.2221 +                PrepareState(EVPPlayComplete, KErrNone);
  1.2222 +                break;
  1.2223 +            case EVPPlayComplete:
  1.2224 +                //Try to set different play velocities and play.
  1.2225 +                if (iVideoPlayRateCapabilities.iPlayForward )
  1.2226 +                	{
  1.2227 +	                if (iPlayVelocity == KVelocityDefault)
  1.2228 +	                	{
  1.2229 +	                	iPlayVelocity = KVelocityMinPositive;
  1.2230 +	                	}
  1.2231 +	                else if(iPlayVelocity == KVelocityMinPositive)
  1.2232 +	                	{
  1.2233 +	                	iPlayVelocity = KVelocityPositive;
  1.2234 +	                	}
  1.2235 +	                else if(iPlayVelocity == KVelocityPositive)
  1.2236 +	                	{
  1.2237 +	                	iPlayVelocity = KVelocityBigPositive;
  1.2238 +	                	}
  1.2239 +                	}
  1.2240 +                if (iVideoPlayRateCapabilities.iPlayBackward )
  1.2241 +                	{
  1.2242 +	                if (iPlayVelocity == KVelocityBigPositive)
  1.2243 +	                	{
  1.2244 +	                	iPlayVelocity = KVelocityMinNegative;
  1.2245 +	                	}
  1.2246 +	                else if(iPlayVelocity == KVelocityMinNegative)
  1.2247 +	                	{
  1.2248 +	                	iPlayVelocity = KVelocityNegative;
  1.2249 +	                	}
  1.2250 +	                else if(iPlayVelocity == KVelocityNegative)
  1.2251 +	                	{
  1.2252 +	                	iPlayVelocity = KVelocityBigNegative;
  1.2253 +	                	}
  1.2254 +	                else if(iPlayVelocity == KVelocityBigNegative)
  1.2255 +	                	{
  1.2256 +		                iVideoPlayer->Close();
  1.2257 +		                CActiveScheduler::Stop();
  1.2258 +		                iTestStepResult = EPass;
  1.2259 +		                return;
  1.2260 +	                	}
  1.2261 +                	}
  1.2262 +
  1.2263 +                //Set next velocity
  1.2264 +                INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity);
  1.2265 +                TRAP(err,iVideoPlayer->SetPlayVelocityL(iPlayVelocity));
  1.2266 +                if ( err == KErrNotSupported )
  1.2267 +                	{
  1.2268 +                		INFO_PRINTF1(_L("iVideoPlayer->SetPlayVelocityL returned KErrNotSupported"));
  1.2269 +                		if( (iPlayVelocity >0) && iVideoPlayRateCapabilities.iPlayForward)
  1.2270 +                			{
  1.2271 +                    		INFO_PRINTF1(_L("PlayVelocity and capabilities are valid, still returned KErrNotSupported!!"));
  1.2272 +                        	User::Leave(err);
  1.2273 +                			}
  1.2274 +                		else if( (iPlayVelocity <0) && iVideoPlayRateCapabilities.iPlayBackward)
  1.2275 +                			{
  1.2276 +                    		INFO_PRINTF1(_L("PlayVelocity and capabilities are valid still returned KErrNotSupported!!"));                			
  1.2277 +                        	User::Leave(err);                			
  1.2278 +                			}
  1.2279 +                		else
  1.2280 +                			{
  1.2281 +                            // Play The file once again to test with different play velocity.
  1.2282 +                            INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2283 +                            iVideoPlayer->Play();
  1.2284 +                            PrepareState(EVPPlayComplete, KErrNone);             			
  1.2285 +                			}
  1.2286 +                	}
  1.2287 +                else if (err != KErrNone)
  1.2288 +                	{
  1.2289 +                    INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL returned (%d)"),err);                	
  1.2290 +                	User::Leave(err);
  1.2291 +                	}
  1.2292 +                else //Success case
  1.2293 +                	{
  1.2294 +                    // Play The file once again to test with different play velocity.
  1.2295 +                    INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2296 +                    iVideoPlayer->Play();
  1.2297 +                    PrepareState(EVPPlayComplete, KErrNone);                	
  1.2298 +                	}
  1.2299 +                
  1.2300 +                if ((!iVideoPlayRateCapabilities.iPlayForward ) && (!iVideoPlayRateCapabilities.iPlayBackward ))
  1.2301 +                	{
  1.2302 +                    INFO_PRINTF1(_L("Both forward and backward is not supported"));
  1.2303 +                    INFO_PRINTF1(_L("Pass the test, error checking for API SetPlayVelocity is already done."));
  1.2304 +	                iVideoPlayer->Close();
  1.2305 +	                CActiveScheduler::Stop();
  1.2306 +	                iTestStepResult = EPass;
  1.2307 +	                return;                	
  1.2308 +                	}
  1.2309 +                break;
  1.2310 +            }
  1.2311 +        }
  1.2312 +    }
  1.2313 +
  1.2314 +
  1.2315 +//
  1.2316 +// RTestVideoPlayStepFrame
  1.2317 +//
  1.2318 +
  1.2319 +/**
  1.2320 +RTestVideoPlayStepFrame::Constructor
  1.2321 +*/
  1.2322 +RTestVideoPlayStepFrame::RTestVideoPlayStepFrame(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
  1.2323 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iTimer(NULL)
  1.2324 +    {
  1.2325 +    }
  1.2326 +
  1.2327 +/**
  1.2328 +RTestVideoPlayStepFrame::NewL
  1.2329 +*/
  1.2330 +RTestVideoPlayStepFrame* RTestVideoPlayStepFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2331 +	{
  1.2332 +    RTestVideoPlayStepFrame* self = new (ELeave) RTestVideoPlayStepFrame(aTestName, aSectName, aKeyName, aExpectedError);
  1.2333 +    return self;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  1.2334 +    }
  1.2335 +
  1.2336 +/**
  1.2337 +RTestVideoPlayStepFrame::DoTestStepL()
  1.2338 +*/
  1.2339 +TVerdict RTestVideoPlayStepFrame::DoTestStepL()
  1.2340 +    {
  1.2341 +	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
  1.2342 +    // Call the state handler from IDLE state
  1.2343 +    TRAPD(err, FsmL(EVPIdle));
  1.2344 +    if (err == KErrNone)
  1.2345 +        {
  1.2346 +        // Start the scheduler - Done only once !
  1.2347 +        CActiveScheduler::Start();    
  1.2348 +        }
  1.2349 +	delete iTimer;    
  1.2350 +    return iTestStepResult;
  1.2351 +    }
  1.2352 +
  1.2353 +/**
  1.2354 +RTestVideoPlayStepFrame::FsmL()
  1.2355 +*/
  1.2356 +void RTestVideoPlayStepFrame::FsmL(TVclntTestPlayEvents aEventCode)
  1.2357 +    {
  1.2358 +    if (FsmCheck(aEventCode))
  1.2359 +        {
  1.2360 +        TInt err = KErrNone;
  1.2361 +    	TInt frame = 0xff;
  1.2362 +    	TBool pauseSupported = ETrue;    	
  1.2363 +        const TUint KStepForwardZeroFrame = 0;            	
  1.2364 +        const TUint KStepForwardOneFrame = 1;
  1.2365 +        const TInt KStepBackwardOneFrame = -1;
  1.2366 +        const TUint KStepForwardFourFrames = 4;
  1.2367 +        const TInt KStepBackwardFourFrames = -4;  
  1.2368 +        
  1.2369 +        switch (aEventCode)
  1.2370 +            {
  1.2371 +            case EVPIdle:
  1.2372 +	            // Calling StepFrameL() before Opeing file should result KErrNotReady.
  1.2373 +	            INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1);
  1.2374 +	            TRAP(err,iVideoPlayer->StepFrameL(1));
  1.2375 +	            if(err != KErrNotReady)
  1.2376 +	            	{
  1.2377 +	            	INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady);
  1.2378 +	                iTestStepResult = EFail;
  1.2379 +	                CActiveScheduler::Stop();
  1.2380 +	                return;	            	
  1.2381 +	            	}
  1.2382 +            
  1.2383 +                // Open iVideoPlayer
  1.2384 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
  1.2385 +                iVideoPlayer->OpenFileL(iFilename);
  1.2386 +                PrepareState(EVPOpenComplete, KErrNone);
  1.2387 +                break;
  1.2388 +            case EVPOpenComplete:
  1.2389 +            	//Get playrate capabilities
  1.2390 +            	INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()"));            	
  1.2391 +                TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities));
  1.2392 +                if( err != KErrNone)
  1.2393 +                	{
  1.2394 +                	INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err);
  1.2395 +                    iTestStepResult = EFail;
  1.2396 +                    CActiveScheduler::Stop();
  1.2397 +                    return;
  1.2398 +                	}
  1.2399 +                // Calling StepFrameL() in non-pause state should result KErrNotReady.
  1.2400 +                INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1);
  1.2401 +	            TRAP(err,iVideoPlayer->StepFrameL(1));
  1.2402 +	            if(err != KErrNotReady)
  1.2403 +	            	{
  1.2404 +                	INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady);	            	
  1.2405 +                    iTestStepResult = EFail;
  1.2406 +                    CActiveScheduler::Stop();
  1.2407 +                    return;	            	
  1.2408 +	            	}
  1.2409 +	            	
  1.2410 +                // Prepare iVideoPlayer
  1.2411 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.2412 +                PrepareState(EVPPrepareComplete, KErrNone);
  1.2413 +                iVideoPlayer->Prepare();
  1.2414 +                break;
  1.2415 +            case EVPPrepareComplete:
  1.2416 +	            // Play iVideoPlayer
  1.2417 +	            INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2418 +	            iVideoPlayer->Play();
  1.2419 +
  1.2420 +                //wait for 1Second to pause the playback.
  1.2421 +                INFO_PRINTF1(_L("calling User::After(KOneSecond);"));
  1.2422 +                User::After(KOneSecond);
  1.2423 +                
  1.2424 +            	/* 
  1.2425 +				Pause the playback, if pause is not supported wait for play to complete.
  1.2426 +				In case of any other err fail the test with appropriate error code.
  1.2427 +				*/
  1.2428 +			    TRAP(err, iVideoPlayer->PauseL());
  1.2429 +
  1.2430 +			    if( err == KErrNotSupported)
  1.2431 +			    	{
  1.2432 +			    	pauseSupported = EFalse;			    	
  1.2433 +			    	PrepareState(EVPPlayComplete, KErrNone);
  1.2434 +			    	}
  1.2435 +			    else if( err != KErrNone)
  1.2436 +			    	{
  1.2437 +				    INFO_PRINTF2(_L("PauseL has returned error =%d"), err);
  1.2438 +		            iVideoPlayer->Stop();
  1.2439 +		            iVideoPlayer->Close();
  1.2440 +		            CActiveScheduler::Stop();
  1.2441 +		            iTestStepResult = EFail;			    	
  1.2442 +		            return;
  1.2443 +			    	}                
  1.2444 +			    
  1.2445 +			    INFO_PRINTF1(_L("Playback paused"));
  1.2446 +         	
  1.2447 +            	//Call StepFrameL with different step values.
  1.2448 +            	while(1)
  1.2449 +            		{
  1.2450 +            		if( frame == 0xff)
  1.2451 +            			frame = KStepForwardZeroFrame;
  1.2452 +            		else if (frame == KStepForwardZeroFrame)
  1.2453 +            			frame = KStepForwardOneFrame;
  1.2454 +            		else if (frame == KStepForwardOneFrame)
  1.2455 +            			frame = KStepForwardFourFrames;
  1.2456 +            		else if (frame == KStepForwardFourFrames)
  1.2457 +            			frame = KStepBackwardOneFrame;
  1.2458 +            		else if (frame == KStepBackwardOneFrame)
  1.2459 +            			frame = KStepBackwardFourFrames;
  1.2460 +            		else if (frame == KStepBackwardFourFrames)
  1.2461 +            			{
  1.2462 +                        INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2463 +                        iVideoPlayer->Stop();
  1.2464 +                        iVideoPlayer->Close();
  1.2465 +                        CActiveScheduler::Stop();
  1.2466 +                        iTestStepResult = EPass;
  1.2467 +            			return; //Break the while loop
  1.2468 +            			}
  1.2469 +	            	INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),frame);
  1.2470 +		            TRAP(err,iVideoPlayer->StepFrameL(frame));
  1.2471 +		            if(err == KErrNotSupported)
  1.2472 +		            	{
  1.2473 +		            	if( ((iVideoPlayRateCapabilities.iStepForward) && (frame>0)) ||
  1.2474 +	            			((iVideoPlayRateCapabilities.iStepBackward) && (frame<0))   )
  1.2475 +		            		{
  1.2476 +			            	INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), err);
  1.2477 +			                iTestStepResult = EFail;
  1.2478 +			                CActiveScheduler::Stop();
  1.2479 +			                return;
  1.2480 +		            		}
  1.2481 +		            	INFO_PRINTF1(_L("StepFrameL returned KErrNotSupported"));
  1.2482 +		            	continue;
  1.2483 +		            	}
  1.2484 +		            else if( (err == KErrNotReady) && (!pauseSupported) )
  1.2485 +		            	{
  1.2486 +		            	INFO_PRINTF1(_L("pause is not supported in controller plugin. Returned correct err(KErrNotReady)"));
  1.2487 +		            	continue;
  1.2488 +		            	}
  1.2489 +		            else if( err != KErrNone)
  1.2490 +                    	{
  1.2491 +                    	INFO_PRINTF2(_L("StepFrameL returned err= %d"), err);
  1.2492 +                        iTestStepResult = EFail;
  1.2493 +                        CActiveScheduler::Stop();
  1.2494 +                        break;
  1.2495 +                    	}            		
  1.2496 +            		}
  1.2497 +                break;
  1.2498 +            case EVPPlayComplete:
  1.2499 +            	INFO_PRINTF1(_L("Plyback completed before pausing!!"));
  1.2500 +            	INFO_PRINTF1(_L("Video clip is too small to run this test step"));
  1.2501 +	            INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2502 +	            iVideoPlayer->Stop();
  1.2503 +	            iVideoPlayer->Close();
  1.2504 +	            CActiveScheduler::Stop();
  1.2505 +	            iTestStepResult = EInconclusive;
  1.2506 +	            return;
  1.2507 +            }
  1.2508 +        }
  1.2509 +    }
  1.2510 +
  1.2511 +//
  1.2512 +// RTestVideoPlayAudVidEnable.
  1.2513 +//
  1.2514 +
  1.2515 +/**
  1.2516 + * RTestVideoPlayAudVidEnable::Constructor
  1.2517 + */
  1.2518 +RTestVideoPlayAudVidEnable::RTestVideoPlayAudVidEnable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
  1.2519 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
  1.2520 +    {
  1.2521 +    }
  1.2522 +
  1.2523 +/**
  1.2524 + * RTestVideoPlayAudVidEnable::NewL
  1.2525 + */
  1.2526 +RTestVideoPlayAudVidEnable* RTestVideoPlayAudVidEnable::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2527 +	{
  1.2528 +    RTestVideoPlayAudVidEnable* self = new (ELeave) RTestVideoPlayAudVidEnable(aTestName, aSectName, aKeyName, aExpectedError);
  1.2529 +    return self;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  1.2530 +    }
  1.2531 +
  1.2532 +/**
  1.2533 + * RTestVideoPlayAudVidEnable::DoTestStepL()
  1.2534 + */
  1.2535 +TVerdict RTestVideoPlayAudVidEnable::DoTestStepL()
  1.2536 +    {
  1.2537 +    // Call the state handler from IDLE state
  1.2538 +    TRAPD(err, FsmL(EVPIdle));
  1.2539 +    if (err == KErrNone)
  1.2540 +        {
  1.2541 +        // Start the scheduler - Done only once !
  1.2542 +        CActiveScheduler::Start();    
  1.2543 +        }
  1.2544 +    return iTestStepResult;  
  1.2545 +    }
  1.2546 +/**
  1.2547 + * RTestVideoPlayAudVidEnable::FsmL()
  1.2548 + */
  1.2549 +void RTestVideoPlayAudVidEnable::FsmL(TVclntTestPlayEvents aEventCode)
  1.2550 +    {
  1.2551 +    if (FsmCheck(aEventCode))
  1.2552 +        {
  1.2553 +        TInt err = KErrNone;
  1.2554 +    	TBool enableFlag = EFalse;
  1.2555 +    	
  1.2556 +        switch (aEventCode)
  1.2557 +            {
  1.2558 +            case EVPIdle:
  1.2559 +	            //Calling SetAudioEnabledL() before opening file should return KErrNotReady
  1.2560 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));            	
  1.2561 +	            TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
  1.2562 +	            if (err != KErrNotReady)
  1.2563 +	            	{
  1.2564 +	            	INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
  1.2565 +	                iTestStepResult = EFail;
  1.2566 +	                CActiveScheduler::Stop();
  1.2567 +	                return;
  1.2568 +	            	}
  1.2569 +	            //Calling SetVideoEnabledL() before opening file should return KErrNotReady
  1.2570 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));            	
  1.2571 +	            TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
  1.2572 +	            if (err != KErrNotReady)
  1.2573 +	            	{
  1.2574 +	            	INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
  1.2575 +	                iTestStepResult = EFail;
  1.2576 +	                CActiveScheduler::Stop();
  1.2577 +	                return;
  1.2578 +	            	}
  1.2579 +	            //Calling VideoEnabledL() before opening file should return KErrNotReady
  1.2580 +	        	INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()"));            	
  1.2581 +	            TRAP(err, iVideoPlayer->VideoEnabledL());
  1.2582 +	            if(err != KErrNotReady)
  1.2583 +	            	{
  1.2584 +	            	INFO_PRINTF2(_L("VideoEnabledL returned wrong error code= %d"), err);
  1.2585 +	                iTestStepResult = EFail;
  1.2586 +	                CActiveScheduler::Stop();
  1.2587 +	                return;
  1.2588 +	            	}
  1.2589 +                // Open iVideoPlayer
  1.2590 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
  1.2591 +                iVideoPlayer->OpenFileL(iFilename);
  1.2592 +                PrepareState(EVPOpenComplete, KErrNone);
  1.2593 +                break;
  1.2594 +            case EVPOpenComplete:
  1.2595 +            	//Check that by default audio is enabled.
  1.2596 +	        	INFO_PRINTF1(_L("iVideoPlayer->AudioEnabledL()"));            	
  1.2597 +	            TRAP(err,enableFlag = iVideoPlayer->AudioEnabledL());
  1.2598 +	            if( (err != KErrNone) || (enableFlag != (TBool)ETrue) )
  1.2599 +	            	{
  1.2600 +                	INFO_PRINTF3(_L("AudioEnabledL Leave err= %d, returned:%d"), err,enableFlag);
  1.2601 +                    iTestStepResult = EFail;
  1.2602 +                    CActiveScheduler::Stop();
  1.2603 +                    return;
  1.2604 +	            	}
  1.2605 +
  1.2606 +            	//Check that by default video is enabled.
  1.2607 +	        	INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()"));            	
  1.2608 +	            TRAP(err,enableFlag = iVideoPlayer->VideoEnabledL());
  1.2609 +	            if( (err != KErrNone) || (enableFlag != (TBool)ETrue) )
  1.2610 +	            	{
  1.2611 +                	INFO_PRINTF3(_L("VideoEnabledL Leave err= %d, returned:%d"), err,enableFlag);
  1.2612 +                    iTestStepResult = EFail;
  1.2613 +                    CActiveScheduler::Stop();
  1.2614 +                    return;
  1.2615 +	            	}
  1.2616 +            	
  1.2617 +	            //Try to disable audio, It shall leave with notsupported error.
  1.2618 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));            	
  1.2619 +	            TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
  1.2620 +	            if (err != KErrNotSupported)
  1.2621 +	            	{
  1.2622 +                	INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
  1.2623 +                    iTestStepResult = EFail;
  1.2624 +                    CActiveScheduler::Stop();
  1.2625 +                    return;
  1.2626 +	            	}
  1.2627 +
  1.2628 +	            //Try to disable video, It shall leave with notsupported error.
  1.2629 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));            	
  1.2630 +	            TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
  1.2631 +	            if (err != KErrNotSupported)
  1.2632 +	            	{
  1.2633 +                	INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
  1.2634 +                    iTestStepResult = EFail;
  1.2635 +                    CActiveScheduler::Stop();
  1.2636 +                    return;
  1.2637 +	            	}
  1.2638 +	            
  1.2639 +                // Prepare iVideoPlayer
  1.2640 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.2641 +                PrepareState(EVPPrepareComplete, KErrNone);
  1.2642 +                iVideoPlayer->Prepare();
  1.2643 +                break;
  1.2644 +            case EVPPrepareComplete:
  1.2645 +	            //Enabling/disabling audio after prepare() shall return KErrNotSupported error.
  1.2646 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));            	
  1.2647 +	            TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
  1.2648 +	            if(err != KErrNotSupported)
  1.2649 +	            	{
  1.2650 +	            	INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
  1.2651 +	                iTestStepResult = EFail;
  1.2652 +	                CActiveScheduler::Stop();
  1.2653 +	                return;
  1.2654 +	            	}
  1.2655 +
  1.2656 +	            //Enabling/disabling video after prepare() shll return KErrNotSupported error.
  1.2657 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));            	
  1.2658 +	            TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
  1.2659 +	            if(err != KErrNotSupported)
  1.2660 +	            	{
  1.2661 +	            	INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
  1.2662 +	                iTestStepResult = EFail;
  1.2663 +	                CActiveScheduler::Stop();
  1.2664 +	                return;
  1.2665 +	            	}
  1.2666 +
  1.2667 +                // Play iVideoPlayer
  1.2668 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2669 +                iVideoPlayer->Play();
  1.2670 +                PrepareState(EVPPlayComplete, KErrNone);
  1.2671 +
  1.2672 +                //calling SetAudioEnabledL while playing should return KErrNotReady
  1.2673 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()"));            	
  1.2674 +	            TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue));
  1.2675 +	            if (err != KErrNotReady)
  1.2676 +	            	{
  1.2677 +                	INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err);
  1.2678 +                    iTestStepResult = EFail;
  1.2679 +                    iVideoPlayer->Stop();
  1.2680 +                    iVideoPlayer->Close();                    
  1.2681 +                    CActiveScheduler::Stop();
  1.2682 +                    return;
  1.2683 +	            	}
  1.2684 +
  1.2685 +	            //calling SetVideoEnabledL while playing should return KErrNotReady
  1.2686 +	        	INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()"));            	
  1.2687 +	            TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue));
  1.2688 +	            if (err != KErrNotReady)
  1.2689 +	            	{
  1.2690 +                	INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err);
  1.2691 +                    iTestStepResult = EFail;
  1.2692 +                    iVideoPlayer->Stop();
  1.2693 +                    iVideoPlayer->Close();                    
  1.2694 +                    CActiveScheduler::Stop();
  1.2695 +                    return;
  1.2696 +	            	}
  1.2697 +
  1.2698 +	            break;
  1.2699 +            case EVPPlayComplete:
  1.2700 +                INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2701 +                iVideoPlayer->Stop();
  1.2702 +                iVideoPlayer->Close();
  1.2703 +                CActiveScheduler::Stop();
  1.2704 +                iTestStepResult = EPass;
  1.2705 +                break;
  1.2706 +            }
  1.2707 +        }
  1.2708 +    }
  1.2709 +
  1.2710 +
  1.2711 +//
  1.2712 +// RTestVideoPlayAutoScale.
  1.2713 +//
  1.2714 +
  1.2715 +/**
  1.2716 + * RTestVideoPlayAutoScale::Constructor
  1.2717 + */
  1.2718 +RTestVideoPlayAutoScale::RTestVideoPlayAutoScale(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError)
  1.2719 +    : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError)
  1.2720 +    {
  1.2721 +    }
  1.2722 +
  1.2723 +/**
  1.2724 + * RTestVideoPlayAutoScale::NewL
  1.2725 + */
  1.2726 +RTestVideoPlayAutoScale* RTestVideoPlayAutoScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError)
  1.2727 +	{
  1.2728 +    RTestVideoPlayAutoScale* self = new (ELeave) RTestVideoPlayAutoScale(aTestName, aSectName, aKeyName, aExpectedError);
  1.2729 +    return self;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
  1.2730 +    }
  1.2731 +
  1.2732 +/**
  1.2733 + * RTestVideoPlayAutoScale::DoTestStepL()
  1.2734 + */
  1.2735 +TVerdict RTestVideoPlayAutoScale::DoTestStepL()
  1.2736 +    {
  1.2737 +    // Call the state handler from IDLE state
  1.2738 +    TRAPD(err, FsmL(EVPIdle));
  1.2739 +    if (err == KErrNone)
  1.2740 +        {
  1.2741 +        // Start the scheduler - Done only once !
  1.2742 +        CActiveScheduler::Start();    
  1.2743 +        }
  1.2744 +    return iTestStepResult;  
  1.2745 +    }
  1.2746 +/**
  1.2747 + * RTestVideoPlayAutoScale::FsmL()
  1.2748 + */
  1.2749 +void RTestVideoPlayAutoScale::FsmL(TVclntTestPlayEvents aEventCode)
  1.2750 +    {
  1.2751 +    if (FsmCheck(aEventCode))
  1.2752 +        {
  1.2753 +        TInt err = KErrNone;
  1.2754 +        TAutoScaleType scaleType = EAutoScaleNone;
  1.2755 +        THorizontalAlign horizontalAlign = EHorizontalAlignCenter;
  1.2756 +        TVerticalAlign verticalAlign = EVerticalAlignCenter;
  1.2757 +        
  1.2758 +        switch (aEventCode)
  1.2759 +            {
  1.2760 +            case EVPIdle:
  1.2761 +            	//Calling SetAutoScaleL() before opening file should return KErrNotReady error.
  1.2762 +	            INFO_PRINTF1(_L("Calling SetAutoScaleL(EAutoScaleNone);"));
  1.2763 +	            TRAP(err, iVideoPlayer->SetAutoScaleL(EAutoScaleNone));
  1.2764 +	            if( err != KErrNotReady)
  1.2765 +	            	{
  1.2766 +	                INFO_PRINTF2(_L("SetAutoScaleL() returned wrong error=%d"),err);
  1.2767 +                    CActiveScheduler::Stop();
  1.2768 +                    iTestStepResult = EFail;	    	                        
  1.2769 +                    return;	                
  1.2770 +	            	}
  1.2771 +	            
  1.2772 +                // Open iVideoPlayer
  1.2773 +                INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename);
  1.2774 +                iVideoPlayer->OpenFileL(iFilename);
  1.2775 +                PrepareState(EVPOpenComplete, KErrNone);
  1.2776 +                break;
  1.2777 +            case EVPOpenComplete:
  1.2778 +                // Prepare iVideoPlayer
  1.2779 +                INFO_PRINTF1(_L("iVideoPlayer->Prepare()"));
  1.2780 +                PrepareState(EVPPrepareComplete, KErrNone);
  1.2781 +                iVideoPlayer->Prepare();
  1.2782 +                break;
  1.2783 +            case EVPPrepareComplete:
  1.2784 +                // Play iVideoPlayer
  1.2785 +                INFO_PRINTF1(_L("iVideoPlayer->Play()"));
  1.2786 +                iVideoPlayer->Play();
  1.2787 +                PrepareState(EVPPlayComplete, KErrNone);
  1.2788 +
  1.2789 +                /*
  1.2790 +                Wait for 1/4th of a second each time and call SetAutoScaleL multiple times
  1.2791 +                with different scale parameters.
  1.2792 +                This loop tests only "void SetAutoScaleL(TAutoScaleType aScaleType);"
  1.2793 +                */
  1.2794 +               
  1.2795 +                while(1)
  1.2796 +                	{
  1.2797 +    	            switch(scaleType)
  1.2798 +		            	{
  1.2799 +		            	case EAutoScaleNone:
  1.2800 +		            		scaleType = EAutoScaleBestFit;
  1.2801 +		            		break;
  1.2802 +		            	case EAutoScaleBestFit:
  1.2803 +		            		scaleType = EAutoScaleClip;
  1.2804 +		            		break;
  1.2805 +		            	case EAutoScaleClip:
  1.2806 +		            		scaleType = EAutoScaleStretch;
  1.2807 +		            		break;
  1.2808 +		            	case EAutoScaleStretch:
  1.2809 +		            		scaleType = EAutoScaleNone;		            		
  1.2810 +		            		break;
  1.2811 +		            	}
  1.2812 +                    INFO_PRINTF1(_L("calling User::After(KOneSecond/4);"));
  1.2813 +                    User::After(KOneSecond/4);
  1.2814 +                    
  1.2815 +                    INFO_PRINTF1(_L("Calling SetAutoScaleL();"));
  1.2816 +    	            TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType));
  1.2817 +    	            
  1.2818 +#ifdef SYMBIAN_BUILD_GCE
  1.2819 +    	            const TInt KExpected = GCEAvailable() ? KErrNone : KErrNotSupported;
  1.2820 +#else
  1.2821 +					const TInt KExpected = KErrNotSupported;
  1.2822 +#endif
  1.2823 +    	            
  1.2824 +    	            if( err == KExpected)
  1.2825 +    	            	{
  1.2826 +                        INFO_PRINTF3(_L("SetAutoScaleL(%d) successfully returned %d"), scaleType, err);
  1.2827 +    	            	}
  1.2828 +    	            else
  1.2829 +    	            	{
  1.2830 +                        INFO_PRINTF4(_L("SetAutoScaleL(%d) returned error= %d.  Expected %d"),scaleType, err, KExpected);
  1.2831 +                        INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2832 +                        iVideoPlayer->Stop();
  1.2833 +                        iVideoPlayer->Close();
  1.2834 +                        CActiveScheduler::Stop();
  1.2835 +                        iTestStepResult = EFail;	    	                        
  1.2836 +                        return;
  1.2837 +    	            	}
  1.2838 +    	            if( scaleType == EAutoScaleNone )
  1.2839 +    	            	{
  1.2840 +    	            	break;//Break the forever while loop;
  1.2841 +    	            	}
  1.2842 +                	}
  1.2843 +
  1.2844 +                /*
  1.2845 +                Wait for half second each time and call SetAutoScaleL multiple times
  1.2846 +                with all combinations of TAutoScaleType, THorizontalAlign, and TVerticalAlign.
  1.2847 +                */
  1.2848 +                
  1.2849 +                while(1)
  1.2850 +                	{
  1.2851 +    	            switch(scaleType)
  1.2852 +		            	{
  1.2853 +		            	case EAutoScaleNone:
  1.2854 +		            		scaleType = EAutoScaleBestFit;
  1.2855 +		            		break;
  1.2856 +		            	case EAutoScaleBestFit:
  1.2857 +		            		scaleType = EAutoScaleClip;
  1.2858 +		            		break;
  1.2859 +		            	case EAutoScaleClip:
  1.2860 +		            		scaleType = EAutoScaleStretch;
  1.2861 +		            		break;
  1.2862 +		            	case EAutoScaleStretch:
  1.2863 +		            		scaleType = EAutoScaleNone;		            		
  1.2864 +		            		break;
  1.2865 +		            	}
  1.2866 +                    while(1)
  1.2867 +                    	{
  1.2868 +		            	if( horizontalAlign == EHorizontalAlignCenter)
  1.2869 +		            		{
  1.2870 +		            		horizontalAlign = EHorizontalAlignLeft;
  1.2871 +		            		}
  1.2872 +		            	else if( horizontalAlign == EHorizontalAlignLeft)
  1.2873 +		            		{
  1.2874 +		            		horizontalAlign = EHorizontalAlignRight;
  1.2875 +		            		}
  1.2876 +		            	else if( horizontalAlign == EHorizontalAlignRight)
  1.2877 +		            		{
  1.2878 +		            		horizontalAlign = EHorizontalAlignCenter;
  1.2879 +		            		}
  1.2880 +		                while(1)
  1.2881 +	                    	{
  1.2882 +    		            	if( verticalAlign == EVerticalAlignCenter)
  1.2883 +    		            		{
  1.2884 +    		            		verticalAlign = EVerticalAlignTop;
  1.2885 +    		            		}
  1.2886 +    		            	else if( verticalAlign == EVerticalAlignTop)
  1.2887 +    		            		{
  1.2888 +    		            		verticalAlign = EVerticalAlignBottom;
  1.2889 +    		            		}
  1.2890 +    		            	else if( verticalAlign == EVerticalAlignBottom)
  1.2891 +    		            		{
  1.2892 +    		            		verticalAlign = EVerticalAlignCenter;
  1.2893 +    		            		}
  1.2894 +    		            	
  1.2895 +	    		            	INFO_PRINTF1(_L("calling User::After(KOneSecond/4);"));
  1.2896 +	    	                    User::After(KOneSecond/4);
  1.2897 +								err = KErrNone;
  1.2898 +	    	                    
  1.2899 +	    	                    INFO_PRINTF1(_L("Calling SetAutoScaleL();"));
  1.2900 +	    	    	            TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType,horizontalAlign,verticalAlign));
  1.2901 +	    	    	            if( err == KErrNotSupported)
  1.2902 +	    	    	            	{
  1.2903 +	    	                        INFO_PRINTF4(_L("SetAutoScaleL(%d,%d, %d) returned KErrNotSupported"),scaleType, horizontalAlign,verticalAlign);
  1.2904 +	    	    	            	}
  1.2905 +    							else if( err == KErrNone)
  1.2906 +    	            				{
  1.2907 +									INFO_PRINTF1(_L("Success calling SetAutoScaleL()"));
  1.2908 +	    	    	            	}
  1.2909 +	    	    	            else
  1.2910 +	    	    	            	{
  1.2911 +	    	                        INFO_PRINTF3(_L("SetAutoScaleL(%d) returned error= %d"),scaleType, err);
  1.2912 +	    	                        INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2913 +	    	                        iVideoPlayer->Stop();
  1.2914 +	    	                        iVideoPlayer->Close();
  1.2915 +	    	                        CActiveScheduler::Stop();
  1.2916 +	    	                        iTestStepResult = EFail;	    	                        
  1.2917 +	    	                        return;	    	                        
  1.2918 +	    	    	            	}
  1.2919 +    	    	            
  1.2920 +    		            	if( verticalAlign == EVerticalAlignCenter )
  1.2921 +    	    	            	{
  1.2922 +    	    	            	break;//Break the forever while loop;
  1.2923 +    	    	            	}
  1.2924 +	    		            }    		            	
  1.2925 +		            	if( horizontalAlign == EHorizontalAlignCenter )
  1.2926 +	    	            	{
  1.2927 +	    	            	break;//Break the forever while loop;
  1.2928 +	    	            	}    		            	
  1.2929 +    		            }
  1.2930 +      	            if( scaleType == EAutoScaleNone )
  1.2931 +    	            	{
  1.2932 +    	            	break;//Break the forever while loop;
  1.2933 +    	            	}
  1.2934 +                	}
  1.2935 +                
  1.2936 +                INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2937 +                iVideoPlayer->Stop();
  1.2938 +                iVideoPlayer->Close();
  1.2939 +                CActiveScheduler::Stop();
  1.2940 +                iTestStepResult = EPass;
  1.2941 +                break;
  1.2942 +            case EVPPlayComplete:
  1.2943 +            	INFO_PRINTF1(_L("Clip is too small to run the test"));
  1.2944 +                INFO_PRINTF1(_L("iVideoPlayer->Stop"));
  1.2945 +                iVideoPlayer->Stop();
  1.2946 +                iVideoPlayer->Close();
  1.2947 +                CActiveScheduler::Stop();
  1.2948 +                iTestStepResult = EInconclusive;
  1.2949 +                break;
  1.2950 +            }
  1.2951 +        }
  1.2952 +    }