os/ossrv/lowlevellibsandfws/apputils/test/tef/ssnd/src/ssndteststep.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @internalComponent
    19 */
    20 
    21 #ifndef __SSNDTESTSTEP_H__
    22 #define __SSNDTESTSTEP_H__
    23 
    24 #include <test/testexecutestepbase.h>
    25 #include <bassnd.h>
    26 
    27 /** CResetDbStep class resets the system sound
    28 repository to factory default condition which is
    29 an empty sound table.
    30 */
    31 _LIT(KResetDb, "ResetDb");
    32 class CResetDbStep : public CTestStep
    33 	{
    34 public:
    35 	CResetDbStep();
    36 	virtual TVerdict doTestStepL(void);
    37 	};
    38 
    39 /** This base class is common to teststeps which
    40 need to read sound data from the TEF ini file to
    41 construct the sound for testing.
    42 */
    43 class CSsndBaseStep : public CTestStep
    44 	{
    45 protected:
    46 	void ConstructSoundL(void);
    47 
    48 protected:
    49 	/** sound created with input from TEF ini file  */
    50 	TBaSystemSoundInfo iSound;
    51 	};
    52 
    53 /**
    54 CGetSoundStep class reads a sound instance from CentRep
    55 and compares with expected values.
    56 */
    57 _LIT(KGetSound, "GetSound");
    58 class CGetSoundStep : public CSsndBaseStep
    59 	{
    60 public:
    61 	CGetSoundStep();
    62 	virtual TVerdict doTestStepL(void);
    63 
    64 private:
    65 	/** sound data read from CentRep */
    66 	TBaSystemSoundInfo iReadFromRep;
    67 	};
    68 
    69 /** CSetSoundStep class sets a sound in repository.
    70 */
    71 _LIT(KSetSound, "SetSound");
    72 class CSetSoundStep : public CSsndBaseStep
    73 	{
    74 public:
    75 	CSetSoundStep();
    76 	virtual TVerdict doTestStepL(void);
    77 	};
    78 
    79 /**
    80 CCorruptSoundStep class tests GetSound able to detect
    81 corruption of the soundtype, sound cat. and path length fields.
    82 */
    83 _LIT(KCorruptSound, "CorruptSound");
    84 class CCorruptSoundStep : public CSsndBaseStep
    85 	{
    86 public:
    87 	CCorruptSoundStep();
    88 	virtual TVerdict doTestStepL(void);
    89 
    90 private:
    91 	/** sound data read from CentRep */
    92 	TBaSystemSoundInfo iReadFromRep;
    93 	};
    94 
    95 /** CSystemSoundFileTestStep class exercise the SystemSoundFile API.
    96 */
    97 _LIT(KSystemSoundFileTest, "SystemSoundFileTest");
    98 class CSystemSoundFileTestStep : public CTestStep
    99 	{
   100 public:
   101 	CSystemSoundFileTestStep();
   102 	virtual TVerdict doTestStepL(void);
   103 	};
   104 
   105 /** CGapTestStep class tests BaSystemSound can detect rogue 
   106 applications created entries which will interfere with SetSoundL.
   107 */
   108 _LIT(KGapTest, "GapTest");
   109 class CGapTestStep : public CTestStep
   110 	{
   111 public:
   112 	CGapTestStep();
   113 	virtual TVerdict doTestStepL(void);
   114 	};
   115 
   116 /** CSoundFileNoPathTestStep class tests BaSystemSound can detect rogue 
   117 applications created entries which will interfere with SetSoundL.
   118 */
   119 _LIT(KSoundFileNoPathTest, "SoundFileNoPathTest");
   120 class CSoundFileNoPathTestStep : public CTestStep
   121 	{
   122 public:
   123 	CSoundFileNoPathTestStep();
   124 	virtual TVerdict doTestStepL(void);
   125 	};
   126 
   127 /** CLockoutTestStep class exercise the SetSoundL
   128 and CBaSystemSoundArray::RestoreL APIs while backup/restore
   129 is in progress to verify server lockout is handled correctly.
   130 */
   131 _LIT(KLockoutTest, "LockoutTest");
   132 class CLockoutTestStep : public CTestStep
   133 	{
   134 public:
   135 	CLockoutTestStep();
   136 	virtual TVerdict doTestStepL(void);
   137 private:
   138 	void addSoundInstanceL(TInt32 aSequence);
   139 	void readSoundsBackL();
   140 	};
   141 
   142 /** TWorkerData struct is provided for concurrent SetSound threads
   143 to record their results.
   144 */
   145 struct TWorkerData
   146 	{
   147 	inline TWorkerData() : iTranFailCount(0), iKey(0), iDone(EFalse) {}
   148 
   149 	/** how many times the set sound transaction commit fail */
   150 	TInt	iTranFailCount;
   151 
   152 	/** the CentRep key used by (assigned to) the sound */
   153 	TUint32 iKey;
   154 
   155 	/** indicates to the master thread that the worker has
   156 	 completed the set sound task */
   157 	TBool	iDone;
   158 	};
   159 
   160 /** CConcurrentStep class tests multiple threads calling
   161 SetSoundL simultaneously. One of the threads running in paraellel
   162 is assigned the master role. It does not call SetSoundL. It just
   163 waits for the other threads to complete their calls and tallies 
   164 the results.
   165 */
   166 _LIT(KConcurrentSetSound, "ConcurrentSetSound");
   167 class CConcurrentStep : public CSsndBaseStep
   168 	{
   169 public:
   170 	CConcurrentStep();
   171 	virtual TVerdict doTestStepL();
   172 	virtual TVerdict doTestStepPostambleL();
   173 	
   174 private:
   175 	void DoMasterTaskL(TInt aNumWorkers, TBool aSsndIdAreSame);
   176 
   177 private:
   178 	/** Id of the worker threads. Also used as index to store test
   179 	 results in the global array of TWorkerData.
   180 	 @see TWorkerData
   181 	 */
   182 	TInt 	iWorkerId;
   183 	};
   184 
   185 #endif