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 <MdaAudioSamplePlayer.h>
|
|
32 |
#include <mdaaudiosampleeditor.h>
|
|
33 |
//#include <MdaAudioTonePlayer.h>
|
|
34 |
|
|
35 |
// Test system includes
|
|
36 |
#include <testframework.h>
|
|
37 |
|
|
38 |
// Specific includes for this test suite
|
|
39 |
#include "TestStepUnitMMFAudClient.h"
|
|
40 |
#include "TestSuiteUnitMMFAudClient.h"
|
|
41 |
|
|
42 |
// Specific includes for these test steps
|
|
43 |
#include "TestStepRecorder.h"
|
|
44 |
|
|
45 |
|
|
46 |
#include "MmfAudioController.h"
|
|
47 |
#include "mmfclientaudiorecorder.h"
|
|
48 |
|
|
49 |
#include "../../ctlfrm/TS_Codes.h"
|
|
50 |
|
|
51 |
|
|
52 |
/**
|
|
53 |
*
|
|
54 |
* Static constructor for CTestStepRecorderOpenUrl.
|
|
55 |
*
|
|
56 |
*
|
|
57 |
* @return "CTestStepRecorderOpenUrl*"
|
|
58 |
* The constructed CTestStepRecorderOpenUrl
|
|
59 |
*
|
|
60 |
* @xxxx
|
|
61 |
*
|
|
62 |
*/
|
|
63 |
CTestStepRecorderOpenUrl* CTestStepRecorderOpenUrl::NewL()
|
|
64 |
{
|
|
65 |
CTestStepRecorderOpenUrl* self = new(ELeave) CTestStepRecorderOpenUrl;
|
|
66 |
return self;
|
|
67 |
}
|
|
68 |
|
|
69 |
/**
|
|
70 |
*
|
|
71 |
* Test step constructor.
|
|
72 |
* Each test step initialises its own name.
|
|
73 |
*
|
|
74 |
* @xxxx
|
|
75 |
*
|
|
76 |
*/
|
|
77 |
CTestStepRecorderOpenUrl::CTestStepRecorderOpenUrl()
|
|
78 |
{
|
|
79 |
// store the name of this test case
|
|
80 |
// this is the name that is used by the script file
|
|
81 |
iTestStepName = _L("MM-MMF-ACLNT-U-0209-CP");
|
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
*
|
|
86 |
* Test step destructor.
|
|
87 |
*
|
|
88 |
* @xxxx
|
|
89 |
*
|
|
90 |
*/
|
|
91 |
CTestStepRecorderOpenUrl::~CTestStepRecorderOpenUrl()
|
|
92 |
{
|
|
93 |
}
|
|
94 |
|
|
95 |
/**
|
|
96 |
*
|
|
97 |
* Test step Preamble.
|
|
98 |
*
|
|
99 |
* @xxxx
|
|
100 |
*
|
|
101 |
*/
|
|
102 |
enum TVerdict CTestStepRecorderOpenUrl::DoTestStepPreambleL(void)
|
|
103 |
{
|
|
104 |
enum TVerdict verdict;
|
|
105 |
// this installs the scheduler
|
|
106 |
verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
107 |
|
|
108 |
// Printing to the console and log file
|
|
109 |
INFO_PRINTF1(_L("MM-MMF-ACLNT-U-0209-CP"));
|
|
110 |
INFO_PRINTF1(_L("this is a test of CMdaAudioRecorderUtility::OpenUrlL()"));
|
|
111 |
|
|
112 |
if(!GetStringFromConfig(_L("SectionOne"), _L("AudioURLTestController"), iURL) )
|
|
113 |
{
|
|
114 |
return EInconclusive;
|
|
115 |
}
|
|
116 |
|
|
117 |
if(!GetStringFromConfig(_L("SectionOne"), _L("TestControllerPAVMimeType"), iMimeType) )
|
|
118 |
{
|
|
119 |
return EInconclusive;
|
|
120 |
}
|
|
121 |
return verdict;
|
|
122 |
|
|
123 |
}
|
|
124 |
|
|
125 |
/**
|
|
126 |
*
|
|
127 |
* Test step Postamble.
|
|
128 |
*
|
|
129 |
* @xxxx
|
|
130 |
*
|
|
131 |
*/
|
|
132 |
enum TVerdict CTestStepRecorderOpenUrl::DoTestStepPostambleL(void)
|
|
133 |
{
|
|
134 |
delete iRecorder;
|
|
135 |
iRecorder = NULL;
|
|
136 |
//[ Destroy the scheduler ]
|
|
137 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL();
|
|
138 |
}
|
|
139 |
|
|
140 |
/**
|
|
141 |
*
|
|
142 |
* Callback Handle.
|
|
143 |
*
|
|
144 |
* @xxxx
|
|
145 |
*
|
|
146 |
*/
|
|
147 |
void CTestStepRecorderOpenUrl::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
148 |
TInt /*aPreviousState*/,
|
|
149 |
TInt /*aCurrentState*/,
|
|
150 |
TInt aErrorcCode)
|
|
151 |
{
|
|
152 |
iError = aErrorcCode;
|
|
153 |
CActiveScheduler::Stop();
|
|
154 |
}
|
|
155 |
|
|
156 |
|
|
157 |
/**
|
|
158 |
*
|
|
159 |
* Do the test step.
|
|
160 |
* Each test step must supply an implementation for DoTestStepL.
|
|
161 |
*
|
|
162 |
* @return "TVerdict"
|
|
163 |
* The result of the test step
|
|
164 |
*
|
|
165 |
* @xxxx
|
|
166 |
*
|
|
167 |
*/
|
|
168 |
TVerdict CTestStepRecorderOpenUrl::DoTestStepL()
|
|
169 |
{
|
|
170 |
iTestStepResult = EPass;
|
|
171 |
TInt err = KErrNone;
|
|
172 |
|
|
173 |
// create the Recorder utility
|
|
174 |
TRAP(err, iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this));
|
|
175 |
|
|
176 |
if (err != KErrNone)
|
|
177 |
return EInconclusive;
|
|
178 |
|
|
179 |
TRAP(err, SetTestMediaIdL(iRecorder));
|
|
180 |
|
|
181 |
if (err != KErrNone)
|
|
182 |
return EInconclusive;
|
|
183 |
|
|
184 |
// load matching to filename
|
|
185 |
TRAP(err,iRecorder->OpenUrlL(iURL, KTestIap ));
|
|
186 |
|
|
187 |
if (err!=KErrNone)
|
|
188 |
return EInconclusive;
|
|
189 |
|
|
190 |
CActiveScheduler::Start();
|
|
191 |
|
|
192 |
|
|
193 |
if (iRecorder == NULL ||
|
|
194 |
err != KErrNone || //since <n>yes tag used.
|
|
195 |
iError != KErrNotSupported /*||
|
|
196 |
iRecorder->State() != CMdaAudioRecorderUtility::EOpen*/)
|
|
197 |
return EFail;
|
|
198 |
|
|
199 |
// now use a special custom command to check the sending of these parameters
|
|
200 |
TUid uid = TUid::Uid(0x101f72B4);
|
|
201 |
TMMFMessageDestinationPckg destPckg(uid);
|
|
202 |
|
|
203 |
//since <n>yes tag used.
|
|
204 |
/*err = iRecorder->RecordControllerCustomCommandSync(destPckg,
|
|
205 |
EMMFTestCustomCommandCheckUrl,
|
|
206 |
KNullDesC8,
|
|
207 |
KNullDesC8);
|
|
208 |
if (err!=KErrNone)
|
|
209 |
return EFail;
|
|
210 |
*/
|
|
211 |
|
|
212 |
TBuf8<256> mimeType;
|
|
213 |
mimeType.Copy(iMimeType);
|
|
214 |
// load matching to mime type
|
|
215 |
TRAP(err,iRecorder->OpenUrlL( iURL, KTestIap, mimeType ));
|
|
216 |
|
|
217 |
if (err!=KErrNone)
|
|
218 |
return EInconclusive;
|
|
219 |
|
|
220 |
CActiveScheduler::Start();
|
|
221 |
|
|
222 |
|
|
223 |
if (iRecorder == NULL ||
|
|
224 |
err != KErrNone ||
|
|
225 |
iError != KErrNone ||
|
|
226 |
iRecorder->State() != CMdaAudioRecorderUtility::EOpen)
|
|
227 |
return EFail;
|
|
228 |
|
|
229 |
err = iRecorder->RecordControllerCustomCommandSync(destPckg,
|
|
230 |
EMMFTestCustomCommandCheckUrl,
|
|
231 |
KNullDesC8,
|
|
232 |
KNullDesC8);
|
|
233 |
if (err==KErrNone)
|
|
234 |
iTestStepResult = EPass;
|
|
235 |
else
|
|
236 |
iTestStepResult = EFail;
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
delete iRecorder;
|
|
241 |
iRecorder = NULL;
|
|
242 |
|
|
243 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
244 |
// test steps return a result
|
|
245 |
return iTestStepResult;
|
|
246 |
}
|
|
247 |
|