imagingandcamerafws/imagingunittest/TSU_ICL_TMDAVID/src/IclMdaVidTestStep.cpp
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "IclMdaVidTestStep.h"
       
    17 
       
    18 void CheckErrorValue(TInt aError)
       
    19     {
       
    20 	if (aError != KErrNone)
       
    21 		User::Panic(_L("System error"),aError);
       
    22 	}
       
    23 
       
    24 
       
    25 CIclMdaVidTestStep* CIclMdaVidTestStep::NewL(const TDesC& aTestName)
       
    26 	{
       
    27 	CIclMdaVidTestStep* self = new(ELeave) CIclMdaVidTestStep(aTestName);
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop(self);
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 CIclMdaVidTestStep::CIclMdaVidTestStep(const TDesC& aTestName)
       
    35 	{
       
    36 	iTestStepName = aTestName;
       
    37 	
       
    38 	//Fix for DEF-043342 increased the heap size for Cedar from 320000
       
    39 	iHeapSize = 360000;
       
    40 	}
       
    41 
       
    42 CIclMdaVidTestStep::~CIclMdaVidTestStep()
       
    43 	{
       
    44 	}
       
    45 
       
    46 void CIclMdaVidTestStep::ConstructL()
       
    47 	{
       
    48 	}
       
    49 
       
    50 TVerdict CIclMdaVidTestStep::OpenL()
       
    51 	{
       
    52 	TVerdict verdict = EPass;
       
    53 
       
    54 	iScheduler = new(ELeave) CActiveScheduler;
       
    55 	CActiveScheduler::Install( iScheduler );
       
    56 
       
    57 	// Connect to bitmap server
       
    58 	User::LeaveIfError(FbsStartup());
       
    59 	TInt err = RFbsSession::Connect();
       
    60 	if (err != KErrNone)
       
    61 		{
       
    62 		ERR_PRINTF2(_L("Failed to connect to bitmap server in preamble (%d)"), err);
       
    63 		verdict = EFail;
       
    64 		}
       
    65 
       
    66 	// Create test engine
       
    67 	iEngine = CMdaCoreTestEngine::NewL(this);
       
    68 
       
    69 	return verdict;
       
    70 	}
       
    71 	
       
    72 void CIclMdaVidTestStep::Close()
       
    73 	{
       
    74 	delete iScheduler;
       
    75 	iScheduler = NULL;
       
    76 
       
    77 	// Disconnect from bitmap server
       
    78 	RFbsSession::Disconnect();
       
    79 
       
    80 	delete iEngine;
       
    81 	iEngine = NULL;
       
    82 	}
       
    83 
       
    84 TVerdict CIclMdaVidTestStep::DoTestStepL()
       
    85 	{
       
    86 	TRAPD(err, iEngine->RunTestsL());
       
    87 	if (err != KErrNone)
       
    88 		{
       
    89 		INFO_PRINTF2(_L("TMdaVid: left with error %d"), err);
       
    90 		User::Leave(err);
       
    91 		}
       
    92 	if (iEngine->TestsFailedCount())
       
    93 		{
       
    94 		INFO_PRINTF2(_L("TMdaVid: %d tests failed"), iEngine->TestsFailedCount());
       
    95 		return EFail;
       
    96 		}
       
    97 	return EPass;
       
    98 	}
       
    99 
       
   100 void CIclMdaVidTestStep::Printf(const TDesC& aDes)
       
   101 	{
       
   102 	INFO_PRINTF1(aDes);
       
   103 	}
       
   104 
       
   105 void CIclMdaVidTestStep::Printf(const TDesC& aDes, const TInt aNum)
       
   106 	{
       
   107 	INFO_PRINTF2(aDes, aNum);
       
   108 	}
       
   109