egl/egltest/endpointtestsuite/automated/inc/localtestbase.h
branchRCL_3
changeset 163 bbf46f59e123
equal deleted inserted replaced
150:57c618273d5c 163:bbf46f59e123
       
     1 // Copyright (c) 2005-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 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #if (!defined __LOCALTESTBASE_H__)
       
    23 #define __LOCALTESTBASE_H__
       
    24 
       
    25 
       
    26 #include <ecom/ecom.h>
       
    27 #include <e32msgqueue.h>
       
    28 #include <test/testexecuteserverbase.h>
       
    29 //#include <test/ttmsgraphicsstep.h>
       
    30 #include "egltest_commscommon.h"
       
    31 
       
    32 
       
    33 // Entry point
       
    34 GLDEF_C TInt E32Main();
       
    35 
       
    36 /**
       
    37 CEglEndpointTestServer	Server encapsulates the functionality required to execute Test Execute based test cases for the EGL endpoint extension.
       
    38 */
       
    39 class CEglEndpointTestServer : public CTestServer
       
    40 	{
       
    41 public:
       
    42 	static CEglEndpointTestServer* NewL();
       
    43 
       
    44 	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
       
    45 	};
       
    46 
       
    47 
       
    48 /**
       
    49 Logger used to log result of every GRAPHICS-EGL-* test to 
       
    50 file, even in event of panic. wrapped by CLocalTestStepBase.
       
    51 */
       
    52 class CTestIdResultLogger : public CBase
       
    53     {
       
    54 private:
       
    55     typedef TBuf<8> TTestId;
       
    56     
       
    57 public:
       
    58     static CTestIdResultLogger* NewL(CTestExecuteLogger& aLogger);
       
    59     ~CTestIdResultLogger();
       
    60     
       
    61     void RegisterTestIdsL(const TDesC& aTestString);
       
    62     void SetCurrentTestIds(const TDesC& aTestString);
       
    63     void LogResult(TVerdict aVerdict);
       
    64     
       
    65 private:
       
    66     CTestIdResultLogger(CTestExecuteLogger& aLogger);
       
    67     void ConstructL();
       
    68     static TInt PanicMonitorMain(TAny* aSelf);
       
    69     void PanicMonitorMainL();
       
    70     void LogResult(CTestExecuteLogger& aLogger, const TTestId& aTestId, const TDesC& aVerdict);
       
    71 
       
    72 private:
       
    73     const TThreadId iOriginalThread;
       
    74     RThread iPanicMonitor;
       
    75     TRequestStatus* iCloseMonitor;
       
    76     CTestExecuteLogger& iLogger;
       
    77     RArray<TTestId> iRegisteredTestIds;
       
    78     RArray<TTestId> iCurrentTestIds;
       
    79     };
       
    80 
       
    81 
       
    82 /**
       
    83 Base class for Egl test steps where the testing is done in a render stage
       
    84 */
       
    85 NONSHARABLE_CLASS(CLocalTestStepBase) : public CTestStep //CTTMSGraphicsStep
       
    86     {
       
    87 public:
       
    88     // from CTestStep
       
    89     CLocalTestStepBase(const TTestUid aUid);
       
    90     IMPORT_C virtual ~CLocalTestStepBase();
       
    91     TVerdict doTestStepPreambleL(); //setup the queues
       
    92     TVerdict doTestStepPostambleL(); //close the queues
       
    93 
       
    94     //Functions to control remote test.
       
    95     //If we are not currently in a test step (ie between StartRemoteTestStepL() and
       
    96     //EndRemoteTestStepL(), this includes the case where StartRemoteTestStepL() fails),
       
    97     //the framework does not allow running test cases. It will instead return EFail
       
    98     //immediately to the caller.
       
    99 
       
   100     TVerdict StartRemoteTestStep(const TRemoteTestParams& aMessageIn);
       
   101     TVerdict RunRemoteTestCase(TInt aTestCase, const TRemoteTestParams& aMessageIn);
       
   102     TVerdict EndRemoteTestStep(const TRemoteTestParams& aMessageIn);
       
   103 
       
   104     virtual void DoPreambleL();
       
   105     virtual void DoPostambleL();
       
   106     
       
   107     void RegisterTestIdsL(const TDesC& aTestString);
       
   108     void SetCurrentTestIds(const TDesC& aTestString);
       
   109     void SetTestStepResult(TVerdict aVerdict);
       
   110 
       
   111 public:
       
   112     RMsgQueue<TRemoteTestResult> iResultOutQueue;
       
   113     RMsgQueue<TRemoteTestParamsPacket> iParamsInQueue;
       
   114 
       
   115 protected:
       
   116     const TTestUid iTestId;
       
   117     TInt iCurrentTestCase;
       
   118     TBool iIsInTestStep;
       
   119     TVerdict iTestIdVerdict;
       
   120     TBool iHasCurrentTestIds;
       
   121     CTestIdResultLogger* iResultLog;
       
   122     };
       
   123 
       
   124 
       
   125 #endif	// __EGLENDPOINTTESTSERVER_H__