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