sl@0: // Copyright (c) 2006-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: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef __SSNDTESTSTEP_H__ sl@0: #define __SSNDTESTSTEP_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** CResetDbStep class resets the system sound sl@0: repository to factory default condition which is sl@0: an empty sound table. sl@0: */ sl@0: _LIT(KResetDb, "ResetDb"); sl@0: class CResetDbStep : public CTestStep sl@0: { sl@0: public: sl@0: CResetDbStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: }; sl@0: sl@0: /** This base class is common to teststeps which sl@0: need to read sound data from the TEF ini file to sl@0: construct the sound for testing. sl@0: */ sl@0: class CSsndBaseStep : public CTestStep sl@0: { sl@0: protected: sl@0: void ConstructSoundL(void); sl@0: sl@0: protected: sl@0: /** sound created with input from TEF ini file */ sl@0: TBaSystemSoundInfo iSound; sl@0: }; sl@0: sl@0: /** sl@0: CGetSoundStep class reads a sound instance from CentRep sl@0: and compares with expected values. sl@0: */ sl@0: _LIT(KGetSound, "GetSound"); sl@0: class CGetSoundStep : public CSsndBaseStep sl@0: { sl@0: public: sl@0: CGetSoundStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: sl@0: private: sl@0: /** sound data read from CentRep */ sl@0: TBaSystemSoundInfo iReadFromRep; sl@0: }; sl@0: sl@0: /** CSetSoundStep class sets a sound in repository. sl@0: */ sl@0: _LIT(KSetSound, "SetSound"); sl@0: class CSetSoundStep : public CSsndBaseStep sl@0: { sl@0: public: sl@0: CSetSoundStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: }; sl@0: sl@0: /** sl@0: CCorruptSoundStep class tests GetSound able to detect sl@0: corruption of the soundtype, sound cat. and path length fields. sl@0: */ sl@0: _LIT(KCorruptSound, "CorruptSound"); sl@0: class CCorruptSoundStep : public CSsndBaseStep sl@0: { sl@0: public: sl@0: CCorruptSoundStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: sl@0: private: sl@0: /** sound data read from CentRep */ sl@0: TBaSystemSoundInfo iReadFromRep; sl@0: }; sl@0: sl@0: /** CSystemSoundFileTestStep class exercise the SystemSoundFile API. sl@0: */ sl@0: _LIT(KSystemSoundFileTest, "SystemSoundFileTest"); sl@0: class CSystemSoundFileTestStep : public CTestStep sl@0: { sl@0: public: sl@0: CSystemSoundFileTestStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: }; sl@0: sl@0: /** CGapTestStep class tests BaSystemSound can detect rogue sl@0: applications created entries which will interfere with SetSoundL. sl@0: */ sl@0: _LIT(KGapTest, "GapTest"); sl@0: class CGapTestStep : public CTestStep sl@0: { sl@0: public: sl@0: CGapTestStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: }; sl@0: sl@0: /** CSoundFileNoPathTestStep class tests BaSystemSound can detect rogue sl@0: applications created entries which will interfere with SetSoundL. sl@0: */ sl@0: _LIT(KSoundFileNoPathTest, "SoundFileNoPathTest"); sl@0: class CSoundFileNoPathTestStep : public CTestStep sl@0: { sl@0: public: sl@0: CSoundFileNoPathTestStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: }; sl@0: sl@0: /** CLockoutTestStep class exercise the SetSoundL sl@0: and CBaSystemSoundArray::RestoreL APIs while backup/restore sl@0: is in progress to verify server lockout is handled correctly. sl@0: */ sl@0: _LIT(KLockoutTest, "LockoutTest"); sl@0: class CLockoutTestStep : public CTestStep sl@0: { sl@0: public: sl@0: CLockoutTestStep(); sl@0: virtual TVerdict doTestStepL(void); sl@0: private: sl@0: void addSoundInstanceL(TInt32 aSequence); sl@0: void readSoundsBackL(); sl@0: }; sl@0: sl@0: /** TWorkerData struct is provided for concurrent SetSound threads sl@0: to record their results. sl@0: */ sl@0: struct TWorkerData sl@0: { sl@0: inline TWorkerData() : iTranFailCount(0), iKey(0), iDone(EFalse) {} sl@0: sl@0: /** how many times the set sound transaction commit fail */ sl@0: TInt iTranFailCount; sl@0: sl@0: /** the CentRep key used by (assigned to) the sound */ sl@0: TUint32 iKey; sl@0: sl@0: /** indicates to the master thread that the worker has sl@0: completed the set sound task */ sl@0: TBool iDone; sl@0: }; sl@0: sl@0: /** CConcurrentStep class tests multiple threads calling sl@0: SetSoundL simultaneously. One of the threads running in paraellel sl@0: is assigned the master role. It does not call SetSoundL. It just sl@0: waits for the other threads to complete their calls and tallies sl@0: the results. sl@0: */ sl@0: _LIT(KConcurrentSetSound, "ConcurrentSetSound"); sl@0: class CConcurrentStep : public CSsndBaseStep sl@0: { sl@0: public: sl@0: CConcurrentStep(); sl@0: virtual TVerdict doTestStepL(); sl@0: virtual TVerdict doTestStepPostambleL(); sl@0: sl@0: private: sl@0: void DoMasterTaskL(TInt aNumWorkers, TBool aSsndIdAreSame); sl@0: sl@0: private: sl@0: /** Id of the worker threads. Also used as index to store test sl@0: results in the global array of TWorkerData. sl@0: @see TWorkerData sl@0: */ sl@0: TInt iWorkerId; sl@0: }; sl@0: sl@0: #endif