os/graphics/graphicscomposition/surfaceupdate/tsrc/tsurfaceupdate.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code 
sl@0
    20
*/
sl@0
    21
sl@0
    22
sl@0
    23
#ifndef __TSURFACEUPDATE_H__
sl@0
    24
#define __TSURFACEUPDATE_H__
sl@0
    25
sl@0
    26
#include <test/testexecutestepbase.h>
sl@0
    27
#include <test/tgraphicsharness.h>
sl@0
    28
#include "surfaceupdateserver.h"
sl@0
    29
#include "tcompositionbackend.h"
sl@0
    30
#include "surfaceupdateclient.h"
sl@0
    31
sl@0
    32
sl@0
    33
class CTSurfaceUpdate : public CTGraphicsBase
sl@0
    34
	{
sl@0
    35
public:
sl@0
    36
	CTSurfaceUpdate(CTestStep* aStep);
sl@0
    37
	~CTSurfaceUpdate();
sl@0
    38
	void ConstructL();
sl@0
    39
protected:
sl@0
    40
//from 	CTGraphicsStep
sl@0
    41
	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0
    42
private:
sl@0
    43
	// Test cases
sl@0
    44
	void TestCase1();
sl@0
    45
	void TestCase2L();
sl@0
    46
	void TestCase3L();
sl@0
    47
	void TestCase4L();
sl@0
    48
	void TestCase5L();
sl@0
    49
	void TestCase6L();
sl@0
    50
	void TestCase7L();
sl@0
    51
	void TestCase8();
sl@0
    52
	void TestCase9L();
sl@0
    53
	void TestCase10();
sl@0
    54
	void TestCase11();
sl@0
    55
    void TestCase12L();
sl@0
    56
	void TestCase13L();
sl@0
    57
	void TestCase14();
sl@0
    58
	void TestCase15();
sl@0
    59
	void TestCaseNotifyWhenAvailableGlobal();
sl@0
    60
	void TestCaseRegisterIdenticalPrioritiesL();
sl@0
    61
	void TestCaseTerminateServer();
sl@0
    62
	void TestCase16L();
sl@0
    63
	void TestCase17();
sl@0
    64
	void TestCase18();
sl@0
    65
sl@0
    66
	// Utility functions
sl@0
    67
	void SetupContentUpdateReceiversL();
sl@0
    68
	void ResetSusL(); //note that surface update server provider will also be updated at this point 
sl@0
    69
	void GenerateMultipleUpdateWithPanic();
sl@0
    70
	static TInt PanicClientThread(TAny*);
sl@0
    71
	static TInt PanicClientThread1(TAny*);
sl@0
    72
	static TInt TestMultipleNotifyThreadL(TAny*);
sl@0
    73
	static TInt TestServerStartupTwoThreads(TAny*);
sl@0
    74
	void SetupTestCaseRegisterPanicL();
sl@0
    75
	void DoTestCaseRegisterPanicL(TThreadFunction aThreadFunction);
sl@0
    76
	void WaitUntilAllNotificationsProcessed();
sl@0
    77
	inline MSurfaceUpdateServerProvider* Provider(); //cache the pointer with care, as restarting the server will invalidate it
sl@0
    78
private:
sl@0
    79
	RPointerArray<CTContentUpdateReceiver> iReceivers;
sl@0
    80
	CRequestOrder* iSurfaceOrder;
sl@0
    81
	};
sl@0
    82
sl@0
    83
class CTSurfaceUpdateStep : public CTGraphicsStep
sl@0
    84
	{
sl@0
    85
public:
sl@0
    86
	CTSurfaceUpdateStep();
sl@0
    87
	MSurfaceUpdateServerProvider* SurfaceUpdateProvider() 
sl@0
    88
		{
sl@0
    89
		return iSurfaceUpdateProvider;
sl@0
    90
		}
sl@0
    91
	TInt StartServer();
sl@0
    92
	void TerminateServer();
sl@0
    93
public:
sl@0
    94
	TBool iGce;    //Flags that symbian_graphics_use_gce is defined
sl@0
    95
protected:	
sl@0
    96
	//from CTGraphicsStep
sl@0
    97
	virtual CTGraphicsBase* CreateTestL();
sl@0
    98
	virtual void TestSetupL();
sl@0
    99
	virtual void TestClose();
sl@0
   100
protected:
sl@0
   101
	MSurfaceUpdateServerProvider *iSurfaceUpdateProvider;
sl@0
   102
	};
sl@0
   103
sl@0
   104
_LIT(KTSurfaceUpdateStep,"TSurfaceUpdate");
sl@0
   105
sl@0
   106
// Class to do improper things on client side and check that server handles them as expected
sl@0
   107
class RMisbehavingSession : public RSessionBase
sl@0
   108
	{
sl@0
   109
public:
sl@0
   110
	TInt Connect(TInt aMessageSlots = KDefaultMessageSlot, TBool aWrongVersion = EFalse);
sl@0
   111
	void Close();
sl@0
   112
	void NotifyWhenAvailableNoChecking(TRequestStatus& aStatus);
sl@0
   113
	void NotifyWhenDisplayedNoChecking(TRequestStatus& aStatus);
sl@0
   114
	void NotifyWhenDisplayedXTimesNoChecking(TInt aCount, TRequestStatus& aStatus);
sl@0
   115
	TInt SubmitUpdateNoChecking(TInt aScreen, const TSurfaceId& aSurfaceId, 
sl@0
   116
									TInt aBuffer, const TRegion* aDirtyRegion = NULL);
sl@0
   117
	void NotifyWhenAvailable(TRequestStatus& aStatus);
sl@0
   118
	void NotifyWhenDisplayed(TRequestStatus& aStatus, TTimeStamp& aTimeStamp);
sl@0
   119
	void NotifyWhenDisplayedXTimes(TInt aCount, TRequestStatus& aStatus);
sl@0
   120
	TInt SubmitUpdate(TInt aScreen, const TSurfaceId& aSurfaceId, 
sl@0
   121
									TInt aBuffer, const TRegion* aDirtyRegion = NULL);
sl@0
   122
	void CancelAllUpdateNotifications();
sl@0
   123
	void TestPassingInvalidOpcode(TInt aInvalidOpcode =500);
sl@0
   124
	void SetFailRate(TInt aFailRate);
sl@0
   125
private:
sl@0
   126
	TVersion Version() const;
sl@0
   127
	TVersion WrongVersion() const;
sl@0
   128
sl@0
   129
private:
sl@0
   130
	TRequestStatus *iStatusAvailable;
sl@0
   131
	TRequestStatus *iStatusDisplayed;
sl@0
   132
	TRequestStatus *iStatusDisplayedXTimes;
sl@0
   133
	TTimeStamp* iTimeStamp;
sl@0
   134
	TInt iCount;
sl@0
   135
	};
sl@0
   136
sl@0
   137
// Class to pass status members into a thread
sl@0
   138
class TMultipleNotify
sl@0
   139
	{
sl@0
   140
public:
sl@0
   141
	TMultipleNotify(TRequestStatus& aStatus, TInt& aTestNum) :
sl@0
   142
		iStatus(aStatus),
sl@0
   143
		iTestNum(aTestNum)
sl@0
   144
		{}
sl@0
   145
	TRequestStatus& iStatus;
sl@0
   146
	TInt& iTestNum;
sl@0
   147
	};
sl@0
   148
sl@0
   149
inline MSurfaceUpdateServerProvider* CTSurfaceUpdate::Provider()
sl@0
   150
	{
sl@0
   151
	return (static_cast <CTSurfaceUpdateStep*> (iStep)) -> SurfaceUpdateProvider();
sl@0
   152
	}
sl@0
   153
sl@0
   154
sl@0
   155
#endif	// __TSURFACEUPDATE_H__