0
|
1 |
// Copyright (c) 2002-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 |
// This file contains an example Test step implementation
|
|
15 |
// This demonstrates the various functions provided
|
|
16 |
// by the CTestStep base class which are available within
|
|
17 |
// a test step
|
|
18 |
//
|
|
19 |
//
|
|
20 |
|
|
21 |
// EPOC includes
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <e32test.h>
|
|
24 |
#include <e32keys.h>
|
|
25 |
#include <c32comm.h>
|
|
26 |
#include <f32file.h>
|
|
27 |
#include <etel.h>
|
|
28 |
#include <etelmm.h>
|
|
29 |
#include <testframework.h>
|
|
30 |
|
|
31 |
#include <mda/common/resource.h>
|
|
32 |
#include <mdaaudiotoneplayer.h>
|
|
33 |
|
|
34 |
// Test system includes
|
|
35 |
#include <testframework.h>
|
|
36 |
|
|
37 |
// Specific includes for this test suite
|
|
38 |
#include "TestStepUnitMMFAudClient.h"
|
|
39 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
40 |
|
|
41 |
// Specific includes for these test steps
|
|
42 |
#include "TestStepTone.h"
|
|
43 |
|
|
44 |
|
|
45 |
//#include <mmfaudiocontroller.h>
|
|
46 |
#include "mmfclienttoneplayer.h"
|
|
47 |
//#include "MmfClientAudioPlayer.h"
|
|
48 |
//#include <mmffourcc.h>
|
|
49 |
//#include <mmfpaniccodes.h>
|
|
50 |
//#include <mmfFormatImplementationUIDs.hrh>
|
|
51 |
// --------------------------------------------
|
|
52 |
|
|
53 |
/**
|
|
54 |
*
|
|
55 |
* Static constructor for CTestStepToneSetRepeats.
|
|
56 |
*
|
|
57 |
*
|
|
58 |
* @return "CTestStepToneSetRepeats*"
|
|
59 |
* The constructed CTestStepToneSetRepeats
|
|
60 |
*
|
|
61 |
* @xxxx
|
|
62 |
*
|
|
63 |
*/
|
|
64 |
CTestStepToneSetRepeats* CTestStepToneSetRepeats::NewL()
|
|
65 |
{
|
|
66 |
CTestStepToneSetRepeats* self = new(ELeave) CTestStepToneSetRepeats;
|
|
67 |
return self;
|
|
68 |
}
|
|
69 |
|
|
70 |
/**
|
|
71 |
*
|
|
72 |
* Test step constructor.
|
|
73 |
* Each test step initialises its own name.
|
|
74 |
*
|
|
75 |
* @xxxx
|
|
76 |
*
|
|
77 |
*/
|
|
78 |
CTestStepToneSetRepeats::CTestStepToneSetRepeats() : iError(KErrNone)
|
|
79 |
{
|
|
80 |
// store the name of this test case
|
|
81 |
// this is the name that is used by the script file
|
|
82 |
iTestStepName = _L("MM-MMF-ACLNT-U-0464-CP");
|
|
83 |
}
|
|
84 |
|
|
85 |
/**
|
|
86 |
*
|
|
87 |
* Test step destructor.
|
|
88 |
*
|
|
89 |
* @xxxx
|
|
90 |
*
|
|
91 |
*/
|
|
92 |
CTestStepToneSetRepeats::~CTestStepToneSetRepeats()
|
|
93 |
{
|
|
94 |
}
|
|
95 |
|
|
96 |
void CTestStepToneSetRepeats::MatoPrepareComplete(TInt aError)
|
|
97 |
{
|
|
98 |
iError = aError;
|
|
99 |
CActiveScheduler::Stop();
|
|
100 |
}
|
|
101 |
|
|
102 |
void CTestStepToneSetRepeats::MatoPlayComplete(TInt aError)
|
|
103 |
{
|
|
104 |
iError = aError;
|
|
105 |
CActiveScheduler::Stop();
|
|
106 |
}
|
|
107 |
|
|
108 |
/**
|
|
109 |
*
|
|
110 |
* Test step Preamble.
|
|
111 |
*
|
|
112 |
* @xxxx
|
|
113 |
*
|
|
114 |
*/
|
|
115 |
enum TVerdict CTestStepToneSetRepeats::DoTestStepPreambleL(void)
|
|
116 |
{
|
|
117 |
TInt err = KErrNone;
|
|
118 |
enum TVerdict verdict;
|
|
119 |
// this installs the scheduler
|
|
120 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
121 |
|
|
122 |
// Printing to the console and log file
|
|
123 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0464-CP"));
|
|
124 |
INFO_PRINTF1(_L("this is a test of CMdaAudioToneUtility::SetRepeats() "));
|
|
125 |
|
|
126 |
// create the Recorder utility
|
|
127 |
TRAP( err, (iTone = CMMFMdaAudioToneUtility::NewL(*this)) );
|
|
128 |
if ( err != KErrNone )
|
|
129 |
return EInconclusive;
|
|
130 |
iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500000));
|
|
131 |
CActiveScheduler::Start();
|
|
132 |
|
|
133 |
if (iError != KErrNone ||
|
|
134 |
iTone->State() != EMdaAudioToneUtilityPrepared)
|
|
135 |
return EInconclusive;
|
|
136 |
|
|
137 |
return verdict;
|
|
138 |
|
|
139 |
}
|
|
140 |
|
|
141 |
/**
|
|
142 |
*
|
|
143 |
* Test step Postamble.
|
|
144 |
*
|
|
145 |
* @xxxx
|
|
146 |
*
|
|
147 |
*/
|
|
148 |
enum TVerdict CTestStepToneSetRepeats::DoTestStepPostambleL(void)
|
|
149 |
{
|
|
150 |
delete iTone;
|
|
151 |
iTone = NULL;
|
|
152 |
//[ Destroy the scheduler ]
|
|
153 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
154 |
}
|
|
155 |
|
|
156 |
/**
|
|
157 |
*
|
|
158 |
* Do the test step.
|
|
159 |
* Each test step must supply an implementation for DoTestStepL.
|
|
160 |
*
|
|
161 |
* @return "TVerdict"
|
|
162 |
* The result of the test step
|
|
163 |
*
|
|
164 |
* @xxxx
|
|
165 |
*
|
|
166 |
*/
|
|
167 |
TVerdict CTestStepToneSetRepeats::DoTestStepL()
|
|
168 |
{
|
|
169 |
iTestStepResult = EPass;
|
|
170 |
TInt err;
|
|
171 |
|
|
172 |
for (TInt rep=0; rep<=10; rep++)
|
|
173 |
{
|
|
174 |
TRAP(err, iTone->SetRepeats(rep,TTimeIntervalMicroSeconds(500000)) );
|
|
175 |
//CActiveScheduler::Start();
|
|
176 |
|
|
177 |
// check result
|
|
178 |
// we should check the internal status of the CMMFDevSound object
|
|
179 |
// but this is out of scope
|
|
180 |
if (err != KErrNone ||
|
|
181 |
iTone->State() != EMdaAudioToneUtilityPrepared)
|
|
182 |
return EFail;
|
|
183 |
}
|
|
184 |
// try also KMdaRepeatForever
|
|
185 |
TRAP(err, iTone->SetRepeats(KMdaRepeatForever,TTimeIntervalMicroSeconds(500000)) );
|
|
186 |
//CActiveScheduler::Start();
|
|
187 |
|
|
188 |
// check result
|
|
189 |
// we should check the internal status of the CMMFDevSound object
|
|
190 |
// but this is out of scope
|
|
191 |
if (err != KErrNone ||
|
|
192 |
iTone->State() != EMdaAudioToneUtilityPrepared)
|
|
193 |
return EFail;
|
|
194 |
|
|
195 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
196 |
// test steps return a result
|
|
197 |
return iTestStepResult;
|
|
198 |
}
|
|
199 |
|