1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/test/tef/ssnd/src/ssndteststep.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,185 @@
1.4 +// Copyright (c) 2006-2009 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 + @internalComponent
1.22 +*/
1.23 +
1.24 +#ifndef __SSNDTESTSTEP_H__
1.25 +#define __SSNDTESTSTEP_H__
1.26 +
1.27 +#include <test/testexecutestepbase.h>
1.28 +#include <bassnd.h>
1.29 +
1.30 +/** CResetDbStep class resets the system sound
1.31 +repository to factory default condition which is
1.32 +an empty sound table.
1.33 +*/
1.34 +_LIT(KResetDb, "ResetDb");
1.35 +class CResetDbStep : public CTestStep
1.36 + {
1.37 +public:
1.38 + CResetDbStep();
1.39 + virtual TVerdict doTestStepL(void);
1.40 + };
1.41 +
1.42 +/** This base class is common to teststeps which
1.43 +need to read sound data from the TEF ini file to
1.44 +construct the sound for testing.
1.45 +*/
1.46 +class CSsndBaseStep : public CTestStep
1.47 + {
1.48 +protected:
1.49 + void ConstructSoundL(void);
1.50 +
1.51 +protected:
1.52 + /** sound created with input from TEF ini file */
1.53 + TBaSystemSoundInfo iSound;
1.54 + };
1.55 +
1.56 +/**
1.57 +CGetSoundStep class reads a sound instance from CentRep
1.58 +and compares with expected values.
1.59 +*/
1.60 +_LIT(KGetSound, "GetSound");
1.61 +class CGetSoundStep : public CSsndBaseStep
1.62 + {
1.63 +public:
1.64 + CGetSoundStep();
1.65 + virtual TVerdict doTestStepL(void);
1.66 +
1.67 +private:
1.68 + /** sound data read from CentRep */
1.69 + TBaSystemSoundInfo iReadFromRep;
1.70 + };
1.71 +
1.72 +/** CSetSoundStep class sets a sound in repository.
1.73 +*/
1.74 +_LIT(KSetSound, "SetSound");
1.75 +class CSetSoundStep : public CSsndBaseStep
1.76 + {
1.77 +public:
1.78 + CSetSoundStep();
1.79 + virtual TVerdict doTestStepL(void);
1.80 + };
1.81 +
1.82 +/**
1.83 +CCorruptSoundStep class tests GetSound able to detect
1.84 +corruption of the soundtype, sound cat. and path length fields.
1.85 +*/
1.86 +_LIT(KCorruptSound, "CorruptSound");
1.87 +class CCorruptSoundStep : public CSsndBaseStep
1.88 + {
1.89 +public:
1.90 + CCorruptSoundStep();
1.91 + virtual TVerdict doTestStepL(void);
1.92 +
1.93 +private:
1.94 + /** sound data read from CentRep */
1.95 + TBaSystemSoundInfo iReadFromRep;
1.96 + };
1.97 +
1.98 +/** CSystemSoundFileTestStep class exercise the SystemSoundFile API.
1.99 +*/
1.100 +_LIT(KSystemSoundFileTest, "SystemSoundFileTest");
1.101 +class CSystemSoundFileTestStep : public CTestStep
1.102 + {
1.103 +public:
1.104 + CSystemSoundFileTestStep();
1.105 + virtual TVerdict doTestStepL(void);
1.106 + };
1.107 +
1.108 +/** CGapTestStep class tests BaSystemSound can detect rogue
1.109 +applications created entries which will interfere with SetSoundL.
1.110 +*/
1.111 +_LIT(KGapTest, "GapTest");
1.112 +class CGapTestStep : public CTestStep
1.113 + {
1.114 +public:
1.115 + CGapTestStep();
1.116 + virtual TVerdict doTestStepL(void);
1.117 + };
1.118 +
1.119 +/** CSoundFileNoPathTestStep class tests BaSystemSound can detect rogue
1.120 +applications created entries which will interfere with SetSoundL.
1.121 +*/
1.122 +_LIT(KSoundFileNoPathTest, "SoundFileNoPathTest");
1.123 +class CSoundFileNoPathTestStep : public CTestStep
1.124 + {
1.125 +public:
1.126 + CSoundFileNoPathTestStep();
1.127 + virtual TVerdict doTestStepL(void);
1.128 + };
1.129 +
1.130 +/** CLockoutTestStep class exercise the SetSoundL
1.131 +and CBaSystemSoundArray::RestoreL APIs while backup/restore
1.132 +is in progress to verify server lockout is handled correctly.
1.133 +*/
1.134 +_LIT(KLockoutTest, "LockoutTest");
1.135 +class CLockoutTestStep : public CTestStep
1.136 + {
1.137 +public:
1.138 + CLockoutTestStep();
1.139 + virtual TVerdict doTestStepL(void);
1.140 +private:
1.141 + void addSoundInstanceL(TInt32 aSequence);
1.142 + void readSoundsBackL();
1.143 + };
1.144 +
1.145 +/** TWorkerData struct is provided for concurrent SetSound threads
1.146 +to record their results.
1.147 +*/
1.148 +struct TWorkerData
1.149 + {
1.150 + inline TWorkerData() : iTranFailCount(0), iKey(0), iDone(EFalse) {}
1.151 +
1.152 + /** how many times the set sound transaction commit fail */
1.153 + TInt iTranFailCount;
1.154 +
1.155 + /** the CentRep key used by (assigned to) the sound */
1.156 + TUint32 iKey;
1.157 +
1.158 + /** indicates to the master thread that the worker has
1.159 + completed the set sound task */
1.160 + TBool iDone;
1.161 + };
1.162 +
1.163 +/** CConcurrentStep class tests multiple threads calling
1.164 +SetSoundL simultaneously. One of the threads running in paraellel
1.165 +is assigned the master role. It does not call SetSoundL. It just
1.166 +waits for the other threads to complete their calls and tallies
1.167 +the results.
1.168 +*/
1.169 +_LIT(KConcurrentSetSound, "ConcurrentSetSound");
1.170 +class CConcurrentStep : public CSsndBaseStep
1.171 + {
1.172 +public:
1.173 + CConcurrentStep();
1.174 + virtual TVerdict doTestStepL();
1.175 + virtual TVerdict doTestStepPostambleL();
1.176 +
1.177 +private:
1.178 + void DoMasterTaskL(TInt aNumWorkers, TBool aSsndIdAreSame);
1.179 +
1.180 +private:
1.181 + /** Id of the worker threads. Also used as index to store test
1.182 + results in the global array of TWorkerData.
1.183 + @see TWorkerData
1.184 + */
1.185 + TInt iWorkerId;
1.186 + };
1.187 +
1.188 +#endif