graphicstest/uibench/s60/src/te_conestepbase.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 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 #ifndef __TE_CONESTEPBASE__
       
    23 #define __TE_CONESTEPBASE__
       
    24 
       
    25 
       
    26 #include "te_graphicsperformanceSuiteStepBase.h"
       
    27 
       
    28 #include <coemain.h>
       
    29 #include <eikappui.h>
       
    30 #include <eikenv.h>
       
    31 
       
    32 
       
    33 /**
       
    34 Base class for tests steps which require CONE. In addition to CTe_graphicsperformanceSuiteStepBase's virtuals,
       
    35 subclasses must implement void InitUIL() in order to initialise CONE controls on the screen.
       
    36 
       
    37 The execution scenario:
       
    38 1. doTestStepPreambleL() is executed in main test step's thread - creates and starts new CONE thread.
       
    39 1a. InitUIL() is run in CONE thread.
       
    40 1b. CONE's active scheduler is started in CONE thread.
       
    41 2. doTestStepL() is executed in main test step's thread.
       
    42 3. doTestStepPostambleL() is executed in main test step's thread
       
    43 3a. CONE thread is stopped
       
    44 */
       
    45 class CTe_ConeStepBase : public CTe_graphicsperformanceSuiteStepBase
       
    46 	{
       
    47 	friend class CConeThreadStopper;
       
    48 	
       
    49 public:
       
    50 	inline RThread* ConeThread();
       
    51 	
       
    52 protected:
       
    53 	// From CTe_graphicsperformanceSuiteStepBase
       
    54 	virtual TVerdict doTestStepPreambleL(); 
       
    55 	virtual TVerdict doTestStepPostambleL();
       
    56 	
       
    57 	virtual void InitUIL(CCoeEnv* aCoeEnv) = 0; // implementation must call aCoeEnv->SetAppUi(appUi)
       
    58 	
       
    59 private:
       
    60 	static TInt ConeThreadFunction(TAny* aParams);
       
    61 	
       
    62 	CCoeEnv* ConstructControlEnvironment();
       
    63 	TInt StartControlEnvironment();
       
    64 	void StopControlEnvironment();
       
    65 	
       
    66 private:    
       
    67     RThread iConeThread;
       
    68 	RSemaphore iInitUISemaphore;
       
    69 	TRequestStatus* iTestCompletionStatus;
       
    70 	};
       
    71 
       
    72 /**
       
    73  * Stops CONE basing on given TRequestStatus. TRequestStatus is updated in doTestStepPostambleL, which
       
    74  * stops the CONE thread.
       
    75  */
       
    76 class CConeThreadStopper : public CActive
       
    77     {
       
    78 public:
       
    79     ~CConeThreadStopper();
       
    80     CConeThreadStopper(CTe_ConeStepBase& aTestStep);
       
    81     void Start(TRequestStatus *&aStopStatus);
       
    82     
       
    83 private:
       
    84     // From CActive
       
    85     void DoCancel();
       
    86     void RunL();
       
    87     
       
    88 private:
       
    89     CTe_ConeStepBase& iTestStep;
       
    90     };
       
    91 
       
    92 
       
    93 inline RThread* CTe_ConeStepBase::ConeThread() 
       
    94     {
       
    95     return &iConeThread;
       
    96     }
       
    97 
       
    98 
       
    99 #endif