windowing/windowserver/test/t_stress/inc/stresslet.h
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2008-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
       
    20 */
       
    21 
       
    22 #ifndef STRESSLET_H
       
    23 #define STRESSLET_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <w32std.h>
       
    27 
       
    28 class CBaseStressletAllocator;
       
    29 class MTestStepReporter;
       
    30 
       
    31 /** CStresslet base class */
       
    32 class CStresslet : public CBase
       
    33 	{
       
    34 public:
       
    35 	static void LaunchL(CStresslet* aStresslet);
       
    36 	~CStresslet();
       
    37 	virtual void HandleRedraw(TWsRedrawEvent &aEvent) = 0;
       
    38 	virtual void HandleEvent(TWsEvent &aEvent) = 0;
       
    39 	RWsSession& Session();
       
    40 	
       
    41 protected:
       
    42 	CStresslet(MTestStepReporter& aReporter);
       
    43 	virtual void StartL()=0;
       
    44 	void ConcludeNow(void);
       
    45 	CWindowGc& WindowGc();
       
    46 	MTestStepReporter& Reporter();
       
    47 	
       
    48 private:
       
    49 	void ConstructL();
       
    50 
       
    51 	/** Inner class CEventHandler */
       
    52 	class CEventHandler : public CActive
       
    53 		{
       
    54 	public:
       
    55 		static CEventHandler* NewL (CStresslet& aStresslet);
       
    56 		~CEventHandler ();
       
    57 	protected: // from CActive
       
    58 		void RunL ();
       
    59 		void DoCancel ();
       
    60 		void ConstructL ();
       
    61 	private:
       
    62 		CEventHandler (CStresslet& aStresslet);
       
    63 	private:
       
    64 		CStresslet& iStresslet;
       
    65 		TWsEvent iEvent;
       
    66 		};
       
    67 	
       
    68 	/** Inner class CRedrawHandler */	
       
    69 	class CRedrawHandler : public CActive
       
    70 		{
       
    71 	public:
       
    72 		static CRedrawHandler* NewL (CStresslet& aStresslet);
       
    73 		~CRedrawHandler ();
       
    74 	protected: // from CActive
       
    75 		void RunL ();
       
    76 		void DoCancel ();
       
    77 		void ConstructL ();
       
    78 	private:
       
    79 		CRedrawHandler (CStresslet& aStresslet);
       
    80 	private:
       
    81 		CStresslet& iStresslet;
       
    82 		TWsRedrawEvent iRedrawEvent;
       
    83 		};		
       
    84 	
       
    85 private:
       
    86 	RWsSession iWs;
       
    87 	CWindowGc* iGc;
       
    88 	CWsScreenDevice* iScreenDevice;
       
    89 	CRedrawHandler* iRedrawHandler;
       
    90 	CEventHandler* iEventHandler;
       
    91 	
       
    92 	MTestStepReporter& iReporter;
       
    93 	};
       
    94 
       
    95 #define REPORT_EVENT(value) (Reporter().LogCondition(value,(TText8*)__FILE__,__LINE__))
       
    96 #define REPORT_EVENT_WITH_TEXT(value,text) (text,Reporter().LogCondition(value,(TText8*)__FILE__,__LINE__))
       
    97 
       
    98 	
       
    99 #endif // STRESSLET_H