os/graphics/egl/egltest/endpointtestsuite/automated/inc/localtestbase.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/egl/egltest/endpointtestsuite/automated/inc/localtestbase.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,125 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code
    1.23 +*/
    1.24 +
    1.25 +#if (!defined __LOCALTESTBASE_H__)
    1.26 +#define __LOCALTESTBASE_H__
    1.27 +
    1.28 +
    1.29 +#include <ecom/ecom.h>
    1.30 +#include <e32msgqueue.h>
    1.31 +#include <test/testexecuteserverbase.h>
    1.32 +//#include <test/ttmsgraphicsstep.h>
    1.33 +#include "egltest_commscommon.h"
    1.34 +
    1.35 +
    1.36 +// Entry point
    1.37 +GLDEF_C TInt E32Main();
    1.38 +
    1.39 +/**
    1.40 +CEglEndpointTestServer	Server encapsulates the functionality required to execute Test Execute based test cases for the EGL endpoint extension.
    1.41 +*/
    1.42 +class CEglEndpointTestServer : public CTestServer
    1.43 +	{
    1.44 +public:
    1.45 +	static CEglEndpointTestServer* NewL();
    1.46 +
    1.47 +	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
    1.48 +	};
    1.49 +
    1.50 +
    1.51 +/**
    1.52 +Logger used to log result of every GRAPHICS-EGL-* test to 
    1.53 +file, even in event of panic. wrapped by CLocalTestStepBase.
    1.54 +*/
    1.55 +class CTestIdResultLogger : public CBase
    1.56 +    {
    1.57 +private:
    1.58 +    typedef TBuf<8> TTestId;
    1.59 +    
    1.60 +public:
    1.61 +    static CTestIdResultLogger* NewL(CTestExecuteLogger& aLogger);
    1.62 +    ~CTestIdResultLogger();
    1.63 +    
    1.64 +    void RegisterTestIdsL(const TDesC& aTestString);
    1.65 +    void SetCurrentTestIds(const TDesC& aTestString);
    1.66 +    void LogResult(TVerdict aVerdict);
    1.67 +    
    1.68 +private:
    1.69 +    CTestIdResultLogger(CTestExecuteLogger& aLogger);
    1.70 +    void ConstructL();
    1.71 +    static TInt PanicMonitorMain(TAny* aSelf);
    1.72 +    void PanicMonitorMainL();
    1.73 +    void LogResult(CTestExecuteLogger& aLogger, const TTestId& aTestId, const TDesC& aVerdict);
    1.74 +
    1.75 +private:
    1.76 +    const TThreadId iOriginalThread;
    1.77 +    RThread iPanicMonitor;
    1.78 +    TRequestStatus* iCloseMonitor;
    1.79 +    CTestExecuteLogger& iLogger;
    1.80 +    RArray<TTestId> iRegisteredTestIds;
    1.81 +    RArray<TTestId> iCurrentTestIds;
    1.82 +    };
    1.83 +
    1.84 +
    1.85 +/**
    1.86 +Base class for Egl test steps where the testing is done in a render stage
    1.87 +*/
    1.88 +NONSHARABLE_CLASS(CLocalTestStepBase) : public CTestStep //CTTMSGraphicsStep
    1.89 +    {
    1.90 +public:
    1.91 +    // from CTestStep
    1.92 +    CLocalTestStepBase(const TTestUid aUid);
    1.93 +    IMPORT_C virtual ~CLocalTestStepBase();
    1.94 +    TVerdict doTestStepPreambleL(); //setup the queues
    1.95 +    TVerdict doTestStepPostambleL(); //close the queues
    1.96 +
    1.97 +    //Functions to control remote test.
    1.98 +    //If we are not currently in a test step (ie between StartRemoteTestStepL() and
    1.99 +    //EndRemoteTestStepL(), this includes the case where StartRemoteTestStepL() fails),
   1.100 +    //the framework does not allow running test cases. It will instead return EFail
   1.101 +    //immediately to the caller.
   1.102 +
   1.103 +    TVerdict StartRemoteTestStep(const TRemoteTestParams& aMessageIn);
   1.104 +    TVerdict RunRemoteTestCase(TInt aTestCase, const TRemoteTestParams& aMessageIn);
   1.105 +    TVerdict EndRemoteTestStep(const TRemoteTestParams& aMessageIn);
   1.106 +
   1.107 +    virtual void DoPreambleL();
   1.108 +    virtual void DoPostambleL();
   1.109 +    
   1.110 +    void RegisterTestIdsL(const TDesC& aTestString);
   1.111 +    void SetCurrentTestIds(const TDesC& aTestString);
   1.112 +    void SetTestStepResult(TVerdict aVerdict);
   1.113 +
   1.114 +public:
   1.115 +    RMsgQueue<TRemoteTestResult> iResultOutQueue;
   1.116 +    RMsgQueue<TRemoteTestParamsPacket> iParamsInQueue;
   1.117 +
   1.118 +protected:
   1.119 +    const TTestUid iTestId;
   1.120 +    TInt iCurrentTestCase;
   1.121 +    TBool iIsInTestStep;
   1.122 +    TVerdict iTestIdVerdict;
   1.123 +    TBool iHasCurrentTestIds;
   1.124 +    CTestIdResultLogger* iResultLog;
   1.125 +    };
   1.126 +
   1.127 +
   1.128 +#endif	// __EGLENDPOINTTESTSERVER_H__