sl@0: sl@0: // Copyright (c) 2001-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: // TSI_MMFMIDICLNT.h sl@0: // Header file: Basic tests. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file TSI_MMFVCLNT.h sl@0: */ sl@0: sl@0: #ifndef TSU_MMFMIDICLNT_H__ sl@0: #define TSU_MMFMIDICLNT_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: // Uncomment this line for Jet-stream project sl@0: //#define JETSTREAM_TESTS 1 sl@0: sl@0: class CTestSuite ; sl@0: sl@0: // Flags for test step differentiation sl@0: enum TTestStepType sl@0: { sl@0: ETestValid = 0, sl@0: ETestNegative, sl@0: ETestNullMessage, sl@0: ETestInvalidMessage, sl@0: ETestInvalidId, sl@0: ETestInvalidIndex, sl@0: ETestInvalidChannel, sl@0: ETestAlreadyLoaded, sl@0: ETestNotLoaded, sl@0: ETestNotUnloadable, sl@0: ETestOutOfRangeHigh, sl@0: ETestOutOfRangeLow, sl@0: ETestTimeOutOfRangeHigh, sl@0: ETestTimeOutOfRangeLow, sl@0: ETestUnsupported, sl@0: ETestCorrupt, sl@0: ETestOverflow, sl@0: ETestNoPlugin, sl@0: ETestInvalidState, sl@0: ETestNoResource, sl@0: ETestZeroDurationOutOfRange, sl@0: ETestInvalidChannelOutOfRange, sl@0: ETestNoteHighOutOfRange, sl@0: ETestNoteLowOutOfRange, sl@0: ETestAttackHighOutOfRange, sl@0: ETestAttackLowOutOfRange, sl@0: ETestReleaseHighOutOfRange, sl@0: ETestReleaseLowOutOfRange, sl@0: ETestNoNoteAvailable, sl@0: ETestDifferentNoteVelocity, sl@0: ETestVelocityHighOutOfRange, sl@0: ETestVelocityLowOutOfRange, sl@0: ETestBeatsHighOutOfRange, sl@0: ETestBeatsLowOutOfRange, sl@0: ETestInvalidTrack, sl@0: ETestNoResourcePlaying, sl@0: ETestMicrosecondsHighOutOfRange, sl@0: ETestMicrosecondsLowOutOfRange, sl@0: ETestMicrobeatsHighOutOfRange, sl@0: ETestMicrobeatsLowOutOfRange, sl@0: ETestMicrosecondsMicrobeatsZero, sl@0: ETestVolumeHighOutOfRange, sl@0: ETestVolumeLowOutOfRange, sl@0: ETestRampDurationHighOutOfRange, sl@0: ETestRampDurationLowOutOfRange, sl@0: ETestBalanceHighOutOfRange, sl@0: ETestBalanceLowOutOfRange, sl@0: ETestPreferenceConflictsCannotBeResolved, sl@0: ETestMetaDataIndexInvalid, sl@0: ETestOutOfRange, sl@0: ETestNoStandardBanks, sl@0: ETestNoCustomBanks, sl@0: ETestCheckInterface sl@0: }; sl@0: sl@0: /** sl@0: * @ MCallbackHandlerObserver, provides an Observer sl@0: * @ for monitoring callbacks. sl@0: */ sl@0: class MCallbackHandlerObserver sl@0: { sl@0: public: sl@0: virtual void MchoComplete(TInt aID, TInt aError)=0; sl@0: }; sl@0: sl@0: /** sl@0: * sl@0: * CActiveListener provides the asynchronous operation sl@0: * of an active object sl@0: * sl@0: * @class CActiveListener sl@0: * sl@0: */ sl@0: class CActiveListener : public CActive sl@0: { sl@0: public: sl@0: CActiveListener() : CActive(CActive::EPriorityIdle) { CActiveScheduler::Add(this); } sl@0: void InitialiseActiveListener() { iStatus = KRequestPending; SetActive(); } sl@0: // From CActive, From Base Class sl@0: void RunL() { CActiveScheduler::Stop(); } sl@0: void DoCancel() {}; sl@0: }; sl@0: sl@0: /** sl@0: * Global Data used within tests sl@0: * sl@0: */ sl@0: sl@0: const TInt KTwelfthOfSec = 83333; sl@0: const TInt KTenthOfSec = 100000 ; sl@0: const TInt KOneSecond = 1000000; // Used in a time out function, 1 second (in microSeconds) sl@0: const TInt KTenSeconds = 10000000; // Used in a time out function, 10 seconds (in microSeconds) sl@0: const TInt KFiveSeconds = 5000000; // 5 seconds (in microSeconds) sl@0: const TInt KFifteenSeconds = 15000000; // 15 seconds (in microSeconds) sl@0: const TInt KExpectedDeviation = 1500000; // 1.5 second tolerance for timed tests sl@0: const TInt KNameBufSize = 25; sl@0: sl@0: const TInt KMaxBalance = 100; sl@0: const TInt KMinBalance = -100; sl@0: sl@0: const TInt KMaxVolume = 100; sl@0: sl@0: sl@0: enum TDevMidiByPass sl@0: { sl@0: EDevMidiOff = 0, sl@0: EDevMidiOn = 1 sl@0: }; sl@0: sl@0: /** sl@0: * It's a base class for all test steps. sl@0: * sl@0: * @class CTestMmfVclntStep sl@0: * @brief Test class that enables tests. sl@0: * sl@0: */ sl@0: class CTestMmfMidiClntStep : public CTestStep, public MMidiClientUtilityObserver sl@0: { sl@0: public: sl@0: CTestMmfMidiClntStep(const TDesC& aTestName, const TTestStepType aTestType); sl@0: CTestMmfMidiClntStep(); sl@0: ~CTestMmfMidiClntStep(); sl@0: //void Close(); sl@0: static void CleanUp(TAny *aPtr) ; sl@0: void SetTestSuite(const CTestSuite* aTestSuite ) { iTestSuite = aTestSuite; } sl@0: sl@0: // MMidiClientUtilityObserver sl@0: virtual void MmcuoStateChanged(TMidiState aOldState,TMidiState aNewState,const TTimeIntervalMicroSeconds& aTime,TInt aError); sl@0: virtual void MmcuoTempoChanged(TInt aMicroBeatsPerMinute); sl@0: virtual void MmcuoVolumeChanged(TInt aChannel,TReal32 aVolumeInDecibels); sl@0: virtual void MmcuoMuteChanged(TInt aChannel,TBool aMuted); sl@0: virtual void MmcuoSyncUpdate(const TTimeIntervalMicroSeconds& aMicroSeconds,TInt64 aMicroBeats); sl@0: virtual void MmcuoMetaDataEntryFound(const TInt aMetaDataEntryId,const TTimeIntervalMicroSeconds& aPosition); sl@0: virtual void MmcuoMipMessageReceived(const RArray& aEntry); sl@0: virtual void MmcuoPolyphonyChanged(TInt aNewPolyphony); sl@0: virtual void MmcuoInstrumentChanged(TInt aChannel,TInt aBankId,TInt aInstrumentId); sl@0: sl@0: protected: sl@0: void WaitWithTimeout(TRequestStatus& aStatus, TInt aNumberOfMicroSeconds); sl@0: TBool TimeComparison(const TUint aActual, const TUint aExpected, const TUint aDivation); sl@0: // tests may optionally implement pre- and post-ambles, From Base Class sl@0: virtual TVerdict DoTestStepPreambleL(); sl@0: virtual TVerdict DoTestStepPostambleL(); sl@0: virtual TVerdict DoTestStepL(); sl@0: virtual TVerdict DoTestL(CMidiClientUtility* aMidi); sl@0: void InitWservL(); sl@0: sl@0: protected: sl@0: const CTestSuite* iTestSuite ; sl@0: CActiveScheduler* iActiveScheduler; sl@0: TInt iError; sl@0: sl@0: TInt iTestType; sl@0: sl@0: CWsScreenDevice* iScreen; sl@0: RWindow* iWindow; sl@0: RWsSession iWs; sl@0: TMidiState iCurrentState; sl@0: }; sl@0: sl@0: #endif sl@0: sl@0: sl@0: sl@0: