sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef TESTGCEHARNESS_H sl@0: #define TESTGCEHARNESS_H sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // The default processing delay for displaty and available events. Test specific delays can be set using sl@0: // SetBufferEventProcessingDelay(). sl@0: static const TInt KDefaultDisplayedProcessingDelay = 2000; sl@0: static const TInt KDefaultAvailableProcessingDelay = 2000; sl@0: sl@0: class CTestGCEHarness : public CBase sl@0: { sl@0: public: sl@0: class CTestTimer; sl@0: sl@0: enum TRendererEvent sl@0: { sl@0: EEventDisplayed, sl@0: EEventAvailable, sl@0: EEventAll sl@0: }; sl@0: sl@0: // The following functions are for use by the testframework test steps only sl@0: sl@0: // Create global instance sl@0: static CTestGCEHarness* NewL(TInt aNumBuffers); sl@0: sl@0: // Remove global instance - object must have ben closed first. Video Renderer destruction calls sl@0: // RSurfaceUpdateSession::Close() whihc in turn calls CTestGCEHarness::Close() sl@0: static void Remove(); sl@0: sl@0: // Resets object to use the supplied number of buffers sl@0: static void ResetBuffersL(TInt aNumBuffers); sl@0: sl@0: // Resets global pointer to NULL - used in test pre amble. Required because Panic tests leave the sl@0: // pointer hanging which if left causes the following test to crash. sl@0: static void ResetGlobalPointer(); sl@0: sl@0: // Allows delay to be set on a per test basis. If used before call to NewL() will fail silently. sl@0: static void SetBufferEventProcessingDelay(TRendererEvent aEventType, TTimeIntervalMicroSeconds32 aDelay); sl@0: sl@0: // The following functions are for use by the test RSurfaceUpdateSession implementation only sl@0: sl@0: // Returns pointer to global pointer - leaves if object has not been created previously sl@0: static CTestGCEHarness* RetrieveL(); sl@0: sl@0: // The following are called directly from same named functions in test RSurfaceUpdateSession implementation sl@0: TInt Connect(); sl@0: void Close(); sl@0: void CancelAllNotifications(); sl@0: TInt SubmitUpdate(TInt aBuffer); sl@0: void NotifyWhenAvailable(TRequestStatus& aStatus); sl@0: void NotifyWhenDisplayed(TRequestStatus& aStatus, TTimeStamp& aTimeStamp); sl@0: sl@0: // destructor sl@0: ~CTestGCEHarness(); sl@0: sl@0: // data per buffer sl@0: struct TBufferUpdateData sl@0: { sl@0: TTimeIntervalMicroSeconds32 iDisplayedProcessingDelay; sl@0: TTimeIntervalMicroSeconds32 iAvailableProcessingDelay; sl@0: TInt iDisplayedCompleteReason; sl@0: TInt iAvailableCompleteReason; sl@0: TBool iDisplayedInProgress; sl@0: TBool iAvailableInProgress; sl@0: CTestTimer* iDisplayedTimer; sl@0: CTestTimer* iAvailableTimer; sl@0: TRequestStatus *iStatusAvailable; sl@0: }; sl@0: sl@0: private: sl@0: CTestGCEHarness(); sl@0: void ConstructL(TInt aNumBuffers); sl@0: sl@0: TRequestStatus *iStatusAvailable; sl@0: TRequestStatus *iStatusDisplayed; sl@0: TTimeStamp* iTimeStamp; sl@0: RArray iUpdateArray; sl@0: TInt iLastPosted; sl@0: TInt iResetBuffers; sl@0: sl@0: void OnTimer(TInt aBufferId, TRendererEvent aEvent); sl@0: sl@0: class CTestTimer : public CTimer sl@0: { sl@0: public: sl@0: static CTestTimer* NewL(CTestGCEHarness& aContainer, TInt aBufferId, TRendererEvent aEvent); sl@0: CTestTimer(CTestGCEHarness& aContainer, TInt aBufferId, TRendererEvent aEvent):CTimer(EPriorityStandard),iContainer(aContainer),iBufferId(aBufferId), iEvent(aEvent) sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: protected: sl@0: void RunL() sl@0: { sl@0: iContainer.OnTimer(iBufferId, iEvent); sl@0: } sl@0: private: sl@0: CTestGCEHarness& iContainer; sl@0: TInt iBufferId; sl@0: TRendererEvent iEvent; sl@0: }; sl@0: }; sl@0: sl@0: #endif // TESTGCEHARNESS_H