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 the implementation of CTestStepToneCancelPrepare class
|
|
15 |
// that tests fix for DEF044077( - CMdaAudioToneUtility::CancelPrepare() & CancelPlay()
|
|
16 |
// do not cancel internal AO) by calling PrepareToPlayTone()->CancelPrepare()->PrepareToPlayTone().
|
|
17 |
//
|
|
18 |
//
|
|
19 |
|
|
20 |
// EPOC includes
|
|
21 |
#include <testframework.h>
|
|
22 |
|
|
23 |
#include <mdaaudiotoneplayer.h>
|
|
24 |
|
|
25 |
// Specific includes for this test suite
|
|
26 |
#include "TestStepUnitMMFAudClient.h"
|
|
27 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
28 |
|
|
29 |
// Specific includes for these test steps
|
|
30 |
#include "TestStepTone.h"
|
|
31 |
#include "mmfclienttoneplayer.h"
|
|
32 |
|
|
33 |
// --------------------------------------------
|
|
34 |
|
|
35 |
/**
|
|
36 |
*
|
|
37 |
* Static constructor for CTestStepToneCancelPrepare.
|
|
38 |
*
|
|
39 |
*
|
|
40 |
* @return "CTestStepToneCancelPrepare*"
|
|
41 |
* The constructed CTestStepToneCancelPrepare
|
|
42 |
*
|
|
43 |
* @xxxx
|
|
44 |
*
|
|
45 |
*/
|
|
46 |
CTestStepToneCancelPrepare* CTestStepToneCancelPrepare::NewL()
|
|
47 |
{
|
|
48 |
CTestStepToneCancelPrepare* self = new(ELeave) CTestStepToneCancelPrepare;
|
|
49 |
return self;
|
|
50 |
}
|
|
51 |
|
|
52 |
/**
|
|
53 |
*
|
|
54 |
* Test step constructor.
|
|
55 |
* Each test step initialises its own name.
|
|
56 |
*
|
|
57 |
* @xxxx
|
|
58 |
*
|
|
59 |
*/
|
|
60 |
CTestStepToneCancelPrepare::CTestStepToneCancelPrepare() : iError(KErrNone)
|
|
61 |
{
|
|
62 |
// store the name of this test case
|
|
63 |
// this is the name that is used by the script file
|
|
64 |
iTestStepName = _L("MM-MMF-ACLNT-U-0480-CP");
|
|
65 |
|
|
66 |
// need a bigger heap size on EKA2 HW
|
|
67 |
#if !defined __WINS__
|
|
68 |
iHeapSize = KHeapSizeToneTestEKA2;
|
|
69 |
#endif // EKA2
|
|
70 |
}
|
|
71 |
|
|
72 |
/**
|
|
73 |
*
|
|
74 |
* Test step destructor.
|
|
75 |
*
|
|
76 |
* @xxxx
|
|
77 |
*
|
|
78 |
*/
|
|
79 |
CTestStepToneCancelPrepare::~CTestStepToneCancelPrepare()
|
|
80 |
{
|
|
81 |
}
|
|
82 |
|
|
83 |
void CTestStepToneCancelPrepare::MatoPrepareComplete(TInt aError)
|
|
84 |
{
|
|
85 |
iError = aError;
|
|
86 |
CActiveScheduler::Stop();
|
|
87 |
}
|
|
88 |
|
|
89 |
void CTestStepToneCancelPrepare::MatoPlayComplete(TInt aError)
|
|
90 |
{
|
|
91 |
iError = aError;
|
|
92 |
CActiveScheduler::Stop();
|
|
93 |
}
|
|
94 |
|
|
95 |
/**
|
|
96 |
*
|
|
97 |
* Test step Preamble.
|
|
98 |
*
|
|
99 |
* @xxxx
|
|
100 |
*
|
|
101 |
*/
|
|
102 |
TVerdict CTestStepToneCancelPrepare::DoTestStepPreambleL(void)
|
|
103 |
{
|
|
104 |
TInt err = KErrNone;
|
|
105 |
|
|
106 |
// this installs the scheduler
|
|
107 |
TVerdict verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
108 |
|
|
109 |
// Printing to the console and log file
|
|
110 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0480-CP"));
|
|
111 |
INFO_PRINTF1(_L("This is a test of PrepareToPlayTone()->CancelPlay()->PrepareToPlayTone()"));
|
|
112 |
|
|
113 |
// create the Tone utility
|
|
114 |
TRAP( err, (iTone = CMMFMdaAudioToneUtility::NewL(*this)) );
|
|
115 |
if ( err != KErrNone ||
|
|
116 |
iTone->State() != EMdaAudioToneUtilityNotReady )
|
|
117 |
{
|
|
118 |
verdict = EInconclusive;
|
|
119 |
}
|
|
120 |
return verdict;
|
|
121 |
}
|
|
122 |
|
|
123 |
/**
|
|
124 |
*
|
|
125 |
* Test step Postamble.
|
|
126 |
*
|
|
127 |
* @xxxx
|
|
128 |
*
|
|
129 |
*/
|
|
130 |
TVerdict CTestStepToneCancelPrepare::DoTestStepPostambleL(void)
|
|
131 |
{
|
|
132 |
delete iTone;
|
|
133 |
iTone = NULL;
|
|
134 |
//[ Destroy the scheduler ]
|
|
135 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
136 |
}
|
|
137 |
|
|
138 |
/**
|
|
139 |
*
|
|
140 |
* Do the test step.
|
|
141 |
* Each test step must supply an implementation for DoTestStepL.
|
|
142 |
*
|
|
143 |
* @return "TVerdict"
|
|
144 |
* The result of the test step
|
|
145 |
*
|
|
146 |
* @xxxx
|
|
147 |
*
|
|
148 |
*/
|
|
149 |
TVerdict CTestStepToneCancelPrepare::DoTestStepL()
|
|
150 |
{
|
|
151 |
iTestStepResult = EPass;
|
|
152 |
|
|
153 |
INFO_PRINTF1(_L("Calling PrepareToPlayTone()"));
|
|
154 |
iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500));
|
|
155 |
|
|
156 |
// Cancel prepare
|
|
157 |
INFO_PRINTF1(_L("Calling CancelPrepare()"));
|
|
158 |
iTone->CancelPrepare();
|
|
159 |
|
|
160 |
if (iTone->State() == EMdaAudioToneUtilityPrepared)
|
|
161 |
{
|
|
162 |
INFO_PRINTF2(_L("iTone->State() == %d"), iTone->State());
|
|
163 |
return EFail;
|
|
164 |
}
|
|
165 |
|
|
166 |
// Call PrepareToPlayTone() Again.
|
|
167 |
INFO_PRINTF1(_L("Calling PrepareToPlayTone()"));
|
|
168 |
iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500));
|
|
169 |
|
|
170 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
171 |
// test steps return a result
|
|
172 |
return iTestStepResult;
|
|
173 |
}
|
|
174 |
|