graphicscomposition/surfaceupdate/tsrc/tsurfaceupdate.h
changeset 0 5d03bc08d59c
child 98 bf7481649c98
child 163 bbf46f59e123
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2006-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 
       
    23 #ifndef __TSURFACEUPDATE_H__
       
    24 #define __TSURFACEUPDATE_H__
       
    25 
       
    26 #include <test/testexecutestepbase.h>
       
    27 #include <test/tgraphicsharness.h>
       
    28 #include "surfaceupdateserver.h"
       
    29 #include "tcompositionbackend.h"
       
    30 #include "surfaceupdateclient.h"
       
    31 
       
    32 
       
    33 class CTSurfaceUpdate : public CTGraphicsBase
       
    34 	{
       
    35 public:
       
    36 	CTSurfaceUpdate(CTestStep* aStep);
       
    37 	~CTSurfaceUpdate();
       
    38 	void ConstructL();
       
    39 protected:
       
    40 //from 	CTGraphicsStep
       
    41 	virtual void RunTestCaseL(TInt aCurTestCase);
       
    42 private:
       
    43 	// Test cases
       
    44 	void TestCase1();
       
    45 	void TestCase2L();
       
    46 	void TestCase3L();
       
    47 	void TestCase4L();
       
    48 	void TestCase5L();
       
    49 	void TestCase6L();
       
    50 	void TestCase7L();
       
    51 	void TestCase8();
       
    52 	void TestCase9L();
       
    53 	void TestCase10();
       
    54 	void TestCase11();
       
    55 	void TestCase12L();
       
    56 	void TestCase13L();
       
    57 	void TestCase14();
       
    58 	void TestCase15();
       
    59 	void TestCaseNotifyWhenAvailableGlobal();
       
    60 	void TestCaseRegisterIdenticalPrioritiesL();
       
    61 	void TestCaseTerminateServer();
       
    62 	void TestCase16L();
       
    63 	void TestCase17();
       
    64 	void TestCase18();
       
    65 
       
    66 	// Utility functions
       
    67 	void SetupContentUpdateReceiversL();
       
    68 	void ResetSusL(); //note that surface update server provider will also be updated at this point 
       
    69 	void GenerateMultipleUpdateWithPanic();
       
    70 	static TInt PanicClientThread(TAny*);
       
    71 	static TInt PanicClientThread1(TAny*);
       
    72 	static TInt TestMultipleNotifyThreadL(TAny*);
       
    73 	static TInt TestServerStartupTwoThreads(TAny*);
       
    74 	void SetupTestCaseRegisterPanicL();
       
    75 	void DoTestCaseRegisterPanicL(TThreadFunction aThreadFunction);
       
    76 	void WaitUntilAllNotificationsProcessed();
       
    77 	inline MSurfaceUpdateServerProvider* Provider(); //cache the pointer with care, as restarting the server will invalidate it
       
    78 private:
       
    79 	RPointerArray<CTContentUpdateReceiver> iReceivers;
       
    80 	CRequestOrder* iSurfaceOrder;
       
    81 	};
       
    82 
       
    83 class CTSurfaceUpdateStep : public CTGraphicsStep
       
    84 	{
       
    85 public:
       
    86 	CTSurfaceUpdateStep();
       
    87 	MSurfaceUpdateServerProvider* SurfaceUpdateProvider() 
       
    88 		{
       
    89 		return iSurfaceUpdateProvider;
       
    90 		}
       
    91 	TInt StartServer();
       
    92 	void TerminateServer();
       
    93 public:
       
    94 	TBool iGce;    //Flags that symbian_graphics_use_gce is defined
       
    95 protected:	
       
    96 	//from CTGraphicsStep
       
    97 	virtual CTGraphicsBase* CreateTestL();
       
    98 	virtual void TestSetupL();
       
    99 	virtual void TestClose();
       
   100 protected:
       
   101 	MSurfaceUpdateServerProvider *iSurfaceUpdateProvider;
       
   102 	};
       
   103 
       
   104 _LIT(KTSurfaceUpdateStep,"TSurfaceUpdate");
       
   105 
       
   106 // Class to do improper things on client side and check that server handles them as expected
       
   107 class RMisbehavingSession : public RSessionBase
       
   108 	{
       
   109 public:
       
   110 	TInt Connect(TInt aMessageSlots = KDefaultMessageSlot, TBool aWrongVersion = EFalse);
       
   111 	void Close();
       
   112 	void NotifyWhenAvailableNoChecking(TRequestStatus& aStatus);
       
   113 	void NotifyWhenDisplayedNoChecking(TRequestStatus& aStatus);
       
   114 	void NotifyWhenDisplayedXTimesNoChecking(TInt aCount, TRequestStatus& aStatus);
       
   115 	TInt SubmitUpdateNoChecking(TInt aScreen, const TSurfaceId& aSurfaceId, 
       
   116 									TInt aBuffer, const TRegion* aDirtyRegion = NULL);
       
   117 	void NotifyWhenAvailable(TRequestStatus& aStatus);
       
   118 	void NotifyWhenDisplayed(TRequestStatus& aStatus, TTimeStamp& aTimeStamp);
       
   119 	void NotifyWhenDisplayedXTimes(TInt aCount, TRequestStatus& aStatus);
       
   120 	TInt SubmitUpdate(TInt aScreen, const TSurfaceId& aSurfaceId, 
       
   121 									TInt aBuffer, const TRegion* aDirtyRegion = NULL);
       
   122 	void CancelAllUpdateNotifications();
       
   123 	void TestPassingInvalidOpcode(TInt aInvalidOpcode =500);
       
   124 	void SetFailRate(TInt aFailRate);
       
   125 private:
       
   126 	TVersion Version() const;
       
   127 	TVersion WrongVersion() const;
       
   128 
       
   129 private:
       
   130 	TRequestStatus *iStatusAvailable;
       
   131 	TRequestStatus *iStatusDisplayed;
       
   132 	TRequestStatus *iStatusDisplayedXTimes;
       
   133 	TTimeStamp* iTimeStamp;
       
   134 	TInt iCount;
       
   135 	};
       
   136 
       
   137 // Class to pass status members into a thread
       
   138 class TMultipleNotify
       
   139 	{
       
   140 public:
       
   141 	TMultipleNotify(TRequestStatus& aStatus, TInt& aTestNum) :
       
   142 		iStatus(aStatus),
       
   143 		iTestNum(aTestNum)
       
   144 		{}
       
   145 	TRequestStatus& iStatus;
       
   146 	TInt& iTestNum;
       
   147 	};
       
   148 
       
   149 inline MSurfaceUpdateServerProvider* CTSurfaceUpdate::Provider()
       
   150 	{
       
   151 	return (static_cast <CTSurfaceUpdateStep*> (iStep)) -> SurfaceUpdateProvider();
       
   152 	}
       
   153 
       
   154 
       
   155 #endif	// __TSURFACEUPDATE_H__