1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicscomposition/surfaceupdate/tsrc/tsurfaceupdate.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,155 @@
1.4 +// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +
1.26 +#ifndef __TSURFACEUPDATE_H__
1.27 +#define __TSURFACEUPDATE_H__
1.28 +
1.29 +#include <test/testexecutestepbase.h>
1.30 +#include <test/tgraphicsharness.h>
1.31 +#include "surfaceupdateserver.h"
1.32 +#include "tcompositionbackend.h"
1.33 +#include "surfaceupdateclient.h"
1.34 +
1.35 +
1.36 +class CTSurfaceUpdate : public CTGraphicsBase
1.37 + {
1.38 +public:
1.39 + CTSurfaceUpdate(CTestStep* aStep);
1.40 + ~CTSurfaceUpdate();
1.41 + void ConstructL();
1.42 +protected:
1.43 +//from CTGraphicsStep
1.44 + virtual void RunTestCaseL(TInt aCurTestCase);
1.45 +private:
1.46 + // Test cases
1.47 + void TestCase1();
1.48 + void TestCase2L();
1.49 + void TestCase3L();
1.50 + void TestCase4L();
1.51 + void TestCase5L();
1.52 + void TestCase6L();
1.53 + void TestCase7L();
1.54 + void TestCase8();
1.55 + void TestCase9L();
1.56 + void TestCase10();
1.57 + void TestCase11();
1.58 + void TestCase12L();
1.59 + void TestCase13L();
1.60 + void TestCase14();
1.61 + void TestCase15();
1.62 + void TestCaseNotifyWhenAvailableGlobal();
1.63 + void TestCaseRegisterIdenticalPrioritiesL();
1.64 + void TestCaseTerminateServer();
1.65 + void TestCase16L();
1.66 + void TestCase17();
1.67 + void TestCase18();
1.68 +
1.69 + // Utility functions
1.70 + void SetupContentUpdateReceiversL();
1.71 + void ResetSusL(); //note that surface update server provider will also be updated at this point
1.72 + void GenerateMultipleUpdateWithPanic();
1.73 + static TInt PanicClientThread(TAny*);
1.74 + static TInt PanicClientThread1(TAny*);
1.75 + static TInt TestMultipleNotifyThreadL(TAny*);
1.76 + static TInt TestServerStartupTwoThreads(TAny*);
1.77 + void SetupTestCaseRegisterPanicL();
1.78 + void DoTestCaseRegisterPanicL(TThreadFunction aThreadFunction);
1.79 + void WaitUntilAllNotificationsProcessed();
1.80 + inline MSurfaceUpdateServerProvider* Provider(); //cache the pointer with care, as restarting the server will invalidate it
1.81 +private:
1.82 + RPointerArray<CTContentUpdateReceiver> iReceivers;
1.83 + CRequestOrder* iSurfaceOrder;
1.84 + };
1.85 +
1.86 +class CTSurfaceUpdateStep : public CTGraphicsStep
1.87 + {
1.88 +public:
1.89 + CTSurfaceUpdateStep();
1.90 + MSurfaceUpdateServerProvider* SurfaceUpdateProvider()
1.91 + {
1.92 + return iSurfaceUpdateProvider;
1.93 + }
1.94 + TInt StartServer();
1.95 + void TerminateServer();
1.96 +public:
1.97 + TBool iGce; //Flags that symbian_graphics_use_gce is defined
1.98 +protected:
1.99 + //from CTGraphicsStep
1.100 + virtual CTGraphicsBase* CreateTestL();
1.101 + virtual void TestSetupL();
1.102 + virtual void TestClose();
1.103 +protected:
1.104 + MSurfaceUpdateServerProvider *iSurfaceUpdateProvider;
1.105 + };
1.106 +
1.107 +_LIT(KTSurfaceUpdateStep,"TSurfaceUpdate");
1.108 +
1.109 +// Class to do improper things on client side and check that server handles them as expected
1.110 +class RMisbehavingSession : public RSessionBase
1.111 + {
1.112 +public:
1.113 + TInt Connect(TInt aMessageSlots = KDefaultMessageSlot, TBool aWrongVersion = EFalse);
1.114 + void Close();
1.115 + void NotifyWhenAvailableNoChecking(TRequestStatus& aStatus);
1.116 + void NotifyWhenDisplayedNoChecking(TRequestStatus& aStatus);
1.117 + void NotifyWhenDisplayedXTimesNoChecking(TInt aCount, TRequestStatus& aStatus);
1.118 + TInt SubmitUpdateNoChecking(TInt aScreen, const TSurfaceId& aSurfaceId,
1.119 + TInt aBuffer, const TRegion* aDirtyRegion = NULL);
1.120 + void NotifyWhenAvailable(TRequestStatus& aStatus);
1.121 + void NotifyWhenDisplayed(TRequestStatus& aStatus, TTimeStamp& aTimeStamp);
1.122 + void NotifyWhenDisplayedXTimes(TInt aCount, TRequestStatus& aStatus);
1.123 + TInt SubmitUpdate(TInt aScreen, const TSurfaceId& aSurfaceId,
1.124 + TInt aBuffer, const TRegion* aDirtyRegion = NULL);
1.125 + void CancelAllUpdateNotifications();
1.126 + void TestPassingInvalidOpcode(TInt aInvalidOpcode =500);
1.127 + void SetFailRate(TInt aFailRate);
1.128 +private:
1.129 + TVersion Version() const;
1.130 + TVersion WrongVersion() const;
1.131 +
1.132 +private:
1.133 + TRequestStatus *iStatusAvailable;
1.134 + TRequestStatus *iStatusDisplayed;
1.135 + TRequestStatus *iStatusDisplayedXTimes;
1.136 + TTimeStamp* iTimeStamp;
1.137 + TInt iCount;
1.138 + };
1.139 +
1.140 +// Class to pass status members into a thread
1.141 +class TMultipleNotify
1.142 + {
1.143 +public:
1.144 + TMultipleNotify(TRequestStatus& aStatus, TInt& aTestNum) :
1.145 + iStatus(aStatus),
1.146 + iTestNum(aTestNum)
1.147 + {}
1.148 + TRequestStatus& iStatus;
1.149 + TInt& iTestNum;
1.150 + };
1.151 +
1.152 +inline MSurfaceUpdateServerProvider* CTSurfaceUpdate::Provider()
1.153 + {
1.154 + return (static_cast <CTSurfaceUpdateStep*> (iStep)) -> SurfaceUpdateProvider();
1.155 + }
1.156 +
1.157 +
1.158 +#endif // __TSURFACEUPDATE_H__