0
|
1 |
// Copyright (c) 2007-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 |
#include "teststepciaudiobufferprefill.h"
|
|
17 |
|
|
18 |
const TInt32 KAfterThreeSeconds = 3000000; // Three seconds
|
|
19 |
const TInt32 KEveryNinetySeconds = 90000000; // Ninety seconds
|
|
20 |
|
|
21 |
|
|
22 |
TVerdict CTestStepCISampleBuffering::DoTestStepL()
|
|
23 |
{
|
|
24 |
iTestStepResult = ETestSuiteError;
|
|
25 |
|
|
26 |
INFO_PRINTF1(_L("Initializing test CI device"));
|
|
27 |
|
|
28 |
if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0069-HP")) == 0)
|
|
29 |
{
|
|
30 |
iTestStepResult = DoTestStep0069L();
|
|
31 |
}
|
|
32 |
else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0070-HP")) == 0)
|
|
33 |
{
|
|
34 |
iTestStepResult = DoTestStep0070L();
|
|
35 |
}
|
|
36 |
else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0071-HP")) == 0)
|
|
37 |
{
|
|
38 |
iTestStepResult = DoTestStep0071L();
|
|
39 |
}
|
|
40 |
else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0072-HP")) == 0)
|
|
41 |
{
|
|
42 |
iTestStepResult = DoTestStep0072L();
|
|
43 |
}
|
|
44 |
else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0073-HP")) == 0)
|
|
45 |
{
|
|
46 |
iTestStepResult = DoTestStep0073L();
|
|
47 |
}
|
|
48 |
|
|
49 |
return iTestStepResult;
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
TVerdict CTestStepCISampleBuffering::DoTestStep0069L()
|
|
54 |
{
|
|
55 |
iTestStepResult = EFail;
|
|
56 |
|
|
57 |
INFO_PRINTF1(_L("SampleBuffering - Instantiating"));
|
|
58 |
|
|
59 |
//Initialize - with the UID of our test HwDevice
|
|
60 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
61 |
TUid testUID = {KUidSampleBufferingTestDevice};
|
|
62 |
#else
|
|
63 |
TFourCC testUID('T','0','1','2');
|
|
64 |
#endif
|
|
65 |
|
|
66 |
iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
|
|
67 |
|
|
68 |
if (iTestStepResult != EPass)
|
|
69 |
{
|
|
70 |
INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
|
|
71 |
return EInconclusive;
|
|
72 |
}
|
|
73 |
|
|
74 |
// reset the value as previous test is pass
|
|
75 |
iTestStepResult = EFail;
|
|
76 |
|
|
77 |
// KUidMMMFSampleBuffering
|
|
78 |
MMMFSampleBuffering* ptr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering));
|
|
79 |
|
|
80 |
if (ptr)
|
|
81 |
{
|
|
82 |
INFO_PRINTF1(_L("MMMFSampleBuffering instantiated successfully"));
|
|
83 |
|
|
84 |
iTestStepResult = EPass;
|
|
85 |
}
|
|
86 |
else
|
|
87 |
{
|
|
88 |
ERR_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface"));
|
|
89 |
}
|
|
90 |
|
|
91 |
return iTestStepResult;
|
|
92 |
}
|
|
93 |
|
|
94 |
|
|
95 |
TVerdict CTestStepCISampleBuffering::DoTestStep0070L()
|
|
96 |
{
|
|
97 |
iTestStepResult = EFail;
|
|
98 |
TInt result = KErrGeneral;
|
|
99 |
|
|
100 |
INFO_PRINTF1(_L("SampleBuffering - MmsbEnableSampleBufferingBeforePlayback"));
|
|
101 |
|
|
102 |
//Initialize - with the UID of our test HwDevice
|
|
103 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
104 |
TUid testUID = {KUidSampleBufferingTestDevice};
|
|
105 |
#else
|
|
106 |
TFourCC testUID('T','0','1','2');
|
|
107 |
#endif
|
|
108 |
|
|
109 |
iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
|
|
110 |
|
|
111 |
if (iTestStepResult != EPass)
|
|
112 |
{
|
|
113 |
INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
|
|
114 |
return EInconclusive;
|
|
115 |
}
|
|
116 |
|
|
117 |
// reset the value as previous test is pass
|
|
118 |
iTestStepResult = EFail;
|
|
119 |
|
|
120 |
// KUidMMMFSampleBuffering
|
|
121 |
MMMFSampleBuffering* ptr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering));
|
|
122 |
|
|
123 |
if (ptr)
|
|
124 |
{
|
|
125 |
result = ptr->MmsbEnableSampleBufferingBeforePlayback(); // call method
|
|
126 |
|
|
127 |
if (result == KErrNone)
|
|
128 |
{
|
|
129 |
INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback finished successfully"));
|
|
130 |
|
|
131 |
iTestStepResult = EPass;
|
|
132 |
}
|
|
133 |
else
|
|
134 |
{
|
|
135 |
ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback failed with result %d"), result);
|
|
136 |
}
|
|
137 |
}
|
|
138 |
else
|
|
139 |
{
|
|
140 |
INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface"));
|
|
141 |
iTestStepResult = EInconclusive;
|
|
142 |
}
|
|
143 |
|
|
144 |
return iTestStepResult;
|
|
145 |
}
|
|
146 |
|
|
147 |
|
|
148 |
TVerdict CTestStepCISampleBuffering::DoTestStep0071L()
|
|
149 |
{
|
|
150 |
iTestStepResult = EFail;
|
|
151 |
TInt result = KErrGeneral;
|
|
152 |
|
|
153 |
INFO_PRINTF1(_L("SampleBuffering - MmsbDisableSampleBufferingBeforePlayback"));
|
|
154 |
|
|
155 |
//Initialize - with the UID of our test HwDevice
|
|
156 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
157 |
TUid testUID = {KUidSampleBufferingTestDevice};
|
|
158 |
#else
|
|
159 |
TFourCC testUID('T','0','1','2');
|
|
160 |
#endif
|
|
161 |
|
|
162 |
iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
|
|
163 |
|
|
164 |
if (iTestStepResult != EPass)
|
|
165 |
{
|
|
166 |
INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
|
|
167 |
return EInconclusive;
|
|
168 |
}
|
|
169 |
|
|
170 |
// reset the value as previous test is pass
|
|
171 |
iTestStepResult = EFail;
|
|
172 |
|
|
173 |
// KUidMMMFSampleBuffering
|
|
174 |
MMMFSampleBuffering* ptr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering));
|
|
175 |
|
|
176 |
if (ptr)
|
|
177 |
{
|
|
178 |
|
|
179 |
result = ptr->MmsbDisableSampleBufferingBeforePlayback(); // call method
|
|
180 |
|
|
181 |
if (result == KErrNone)
|
|
182 |
{
|
|
183 |
INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback finished successfully"));
|
|
184 |
|
|
185 |
iTestStepResult = EPass;
|
|
186 |
}
|
|
187 |
else
|
|
188 |
{
|
|
189 |
ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback failed with result %d"), result);
|
|
190 |
}
|
|
191 |
}
|
|
192 |
else
|
|
193 |
{
|
|
194 |
INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface"));
|
|
195 |
iTestStepResult = EInconclusive;
|
|
196 |
}
|
|
197 |
|
|
198 |
return iTestStepResult;
|
|
199 |
}
|
|
200 |
|
|
201 |
|
|
202 |
TVerdict CTestStepCISampleBuffering::DoTestStep0072L()
|
|
203 |
{
|
|
204 |
iTestStepResult = EFail;
|
|
205 |
TInt err;
|
|
206 |
|
|
207 |
INFO_PRINTF1(_L("SampleBuffering - MmsbNotifyPlayStarted"));
|
|
208 |
|
|
209 |
//Initialize - with the UID of our test HwDevice
|
|
210 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
211 |
TUid testUID = {KUidSampleBufferingTestDevice};
|
|
212 |
#else
|
|
213 |
TFourCC testUID('T','0','1','2');
|
|
214 |
#endif
|
|
215 |
|
|
216 |
iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
|
|
217 |
if (iTestStepResult != EPass)
|
|
218 |
{
|
|
219 |
INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
|
|
220 |
return EInconclusive;
|
|
221 |
}
|
|
222 |
|
|
223 |
// reset the value as previous test is pass
|
|
224 |
iTestStepResult = EFail;
|
|
225 |
|
|
226 |
// KUidMMMFSampleBuffering
|
|
227 |
MMMFSampleBuffering* ptr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering));
|
|
228 |
|
|
229 |
if (ptr)
|
|
230 |
{
|
|
231 |
CActiveListener* listener = new(ELeave)CActiveListener;
|
|
232 |
|
|
233 |
listener->InitialiseActiveListener();
|
|
234 |
|
|
235 |
ptr->MmsbNotifyPlayStarted(listener->iStatus); // call method
|
|
236 |
|
|
237 |
CActiveScheduler::Start();
|
|
238 |
|
|
239 |
err = listener->iStatus.Int();
|
|
240 |
|
|
241 |
delete listener;
|
|
242 |
|
|
243 |
if (err == KErrNotSupported)
|
|
244 |
{
|
|
245 |
INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbNotifyPlayStarted finished successfully"));
|
|
246 |
|
|
247 |
iTestStepResult = EPass;
|
|
248 |
}
|
|
249 |
else
|
|
250 |
{
|
|
251 |
ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbNotifyPlayStarted failed with err %d"), err);
|
|
252 |
}
|
|
253 |
}
|
|
254 |
else
|
|
255 |
{
|
|
256 |
INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface"));
|
|
257 |
iTestStepResult = EInconclusive;
|
|
258 |
}
|
|
259 |
|
|
260 |
return iTestStepResult;
|
|
261 |
}
|
|
262 |
|
|
263 |
|
|
264 |
TVerdict CTestStepCISampleBuffering::DoTestStep0073L()
|
|
265 |
{
|
|
266 |
iTestStepResult = EFail;
|
|
267 |
TInt err;
|
|
268 |
|
|
269 |
INFO_PRINTF1(_L("SampleBuffering - MmsbCancelNotifyPlayStarted"));
|
|
270 |
|
|
271 |
TCallBack callback(CTestStepCISampleBuffering::Callback, this);
|
|
272 |
|
|
273 |
iTimer = CPeriodic::NewL(EPriorityNormal);
|
|
274 |
|
|
275 |
// Here we use periodic timer to enable us to call MmsbCancelNotifyPlayStarted() after three
|
|
276 |
// seconds of issuing MmsbNotifyPlayStarted(). Ninety seconds is long enough to stop the timer
|
|
277 |
// before sending a second MmsbCancelNotifyPlayStarted() .
|
|
278 |
iTimer->Start(KAfterThreeSeconds, KEveryNinetySeconds, callback);
|
|
279 |
|
|
280 |
//Initialize - with the UID of our test HwDevice
|
|
281 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
282 |
TUid testUID = {KUidSampleBufferingTestDevice};
|
|
283 |
#else
|
|
284 |
TFourCC testUID('T','0','1','2');
|
|
285 |
#endif
|
|
286 |
|
|
287 |
iTestStepResult = TestInitialize(testUID, EMMFStatePlaying);
|
|
288 |
|
|
289 |
if (iTestStepResult != EPass)
|
|
290 |
{
|
|
291 |
INFO_PRINTF1(_L("DevSound failed to instantiate the test device"));
|
|
292 |
return EInconclusive;
|
|
293 |
}
|
|
294 |
|
|
295 |
// reset the value as previous test is pass
|
|
296 |
iTestStepResult = EFail;
|
|
297 |
|
|
298 |
// KUidMMMFSampleBuffering
|
|
299 |
iInterfacePtr = static_cast <MMMFSampleBuffering*> (iMMFDevSound->CustomInterface(KUidSampleBuffering));
|
|
300 |
|
|
301 |
if (iInterfacePtr)
|
|
302 |
{
|
|
303 |
CActiveListener* listener = new(ELeave) CActiveListener;
|
|
304 |
listener->InitialiseActiveListener();
|
|
305 |
|
|
306 |
iInterfacePtr->MmsbNotifyPlayStarted(listener->iStatus); // call method
|
|
307 |
|
|
308 |
CActiveScheduler::Start();
|
|
309 |
|
|
310 |
err = listener->iStatus.Int();
|
|
311 |
|
|
312 |
delete listener;
|
|
313 |
|
|
314 |
if (err == KErrCancel)
|
|
315 |
{
|
|
316 |
INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbCancelNotifyPlayStarted Successfully completed"));
|
|
317 |
|
|
318 |
iTestStepResult = EPass;
|
|
319 |
}
|
|
320 |
else
|
|
321 |
{
|
|
322 |
ERR_PRINTF2(_L("Device didn't wait for the expected duration err %d"), err);
|
|
323 |
}
|
|
324 |
}
|
|
325 |
else
|
|
326 |
{
|
|
327 |
INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface"));
|
|
328 |
iTestStepResult = EInconclusive;
|
|
329 |
}
|
|
330 |
|
|
331 |
delete iTimer;
|
|
332 |
|
|
333 |
return iTestStepResult;
|
|
334 |
}
|
|
335 |
|
|
336 |
|
|
337 |
TInt CTestStepCISampleBuffering::Callback(TAny* aAny)
|
|
338 |
{
|
|
339 |
CTestStepCISampleBuffering* me = reinterpret_cast<CTestStepCISampleBuffering*>(aAny);
|
|
340 |
me->DoCallback();
|
|
341 |
return KErrNone;
|
|
342 |
}
|
|
343 |
|
|
344 |
void CTestStepCISampleBuffering::DoCallback()
|
|
345 |
{
|
|
346 |
iTimer->Cancel();
|
|
347 |
iInterfacePtr->MmsbCancelNotifyPlayStarted(); // call method
|
|
348 |
}
|