|
1 // Copyright (c) 2008-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 // User includes |
|
17 #include "char_a3f_devsound_playtest.h" |
|
18 |
|
19 /* |
|
20 *======================================================================================================== |
|
21 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0001 |
|
22 */ |
|
23 RA3FDevSoundPlaySetConfigTest::RA3FDevSoundPlaySetConfigTest(const TDesC& aTestName) : |
|
24 RA3FDevSoundTestBase(aTestName), iSampleRate(0), |
|
25 iChannels(0) |
|
26 { |
|
27 } |
|
28 |
|
29 RA3FDevSoundPlaySetConfigTest* RA3FDevSoundPlaySetConfigTest::NewL(const TDesC& aTestName) |
|
30 { |
|
31 RA3FDevSoundPlaySetConfigTest* self = new (ELeave) RA3FDevSoundPlaySetConfigTest(aTestName); |
|
32 return self; |
|
33 } |
|
34 |
|
35 void RA3FDevSoundPlaySetConfigTest::DoKickoffTestL() |
|
36 { |
|
37 if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate)) |
|
38 { |
|
39 ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate); |
|
40 StopTest(KErrNotFound); |
|
41 return; |
|
42 } |
|
43 if (!GetIntFromConfig(iTestStepName, KChannel, iChannels)) |
|
44 { |
|
45 ERR_PRINTF2(KMsgErrorGetParameter, &KChannel); |
|
46 StopTest(KErrNotFound); |
|
47 return; |
|
48 } |
|
49 TPtrC fourccCode; |
|
50 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
51 { |
|
52 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
53 StopTest(KErrNotFound); |
|
54 return; |
|
55 } |
|
56 EncodingFromStringToTFourCC(fourccCode); |
|
57 } |
|
58 |
|
59 void RA3FDevSoundPlaySetConfigTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
60 { |
|
61 switch (iDevSoundState) |
|
62 { |
|
63 case EStateCreated: |
|
64 { |
|
65 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetConfigLTest"), EFsmIncorrectErrorPassed)); |
|
66 if (aDevSoundEvent == EEventInitialize) |
|
67 { |
|
68 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
69 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
70 if (err != KErrNone) |
|
71 { |
|
72 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
73 StopTest(err); |
|
74 break; |
|
75 } |
|
76 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
77 iDevSoundState = EStateInitializing; |
|
78 } |
|
79 else |
|
80 { |
|
81 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
82 StopTest(aError, EFail); |
|
83 } |
|
84 break; |
|
85 } |
|
86 case EStateInitializing: |
|
87 { |
|
88 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
89 { |
|
90 TMMFCapabilities capabilitiesSet; |
|
91 TBuf<KMaxSampleRateStringLength> stringSampleRateSet; |
|
92 TBuf<KMaxChannelsStringLength> stringChannelsSet; |
|
93 SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate); |
|
94 capabilitiesSet.iRate = iESampleRate; |
|
95 capabilitiesSet.iChannels = iChannels; |
|
96 SampleRateFromTUintToString (capabilitiesSet.iRate, stringSampleRateSet); |
|
97 ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet); |
|
98 INFO_PRINTF3(_L("Settings for Sample rate an channel mode : %S %S"), &stringSampleRateSet, &stringChannelsSet); |
|
99 INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL")); |
|
100 TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet)); |
|
101 if (err != KErrNone) |
|
102 { |
|
103 ERR_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err); |
|
104 StopTest(err); |
|
105 break; |
|
106 } |
|
107 TMMFCapabilities capabilitiesGet; |
|
108 TBuf<KMaxSampleRateStringLength> stringSampleRateGet; |
|
109 TBuf<KMaxChannelsStringLength> stringChannelsGet; |
|
110 capabilitiesGet=iMMFDevSound->Config (); |
|
111 SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet); |
|
112 ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet); |
|
113 if (capabilitiesGet.iRate != capabilitiesSet.iRate || capabilitiesGet.iChannels != capabilitiesSet.iChannels) |
|
114 { |
|
115 ERR_PRINTF3(_L("Retrieved sample rate and channel : %S %S"), &stringSampleRateGet, &stringChannelsGet); |
|
116 ERR_PRINTF3(_L("Expected %S %S"), &stringSampleRateSet, &stringChannelsSet); |
|
117 StopTest(aError, EFail); |
|
118 break; |
|
119 } |
|
120 INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); |
|
121 StopTest(); |
|
122 } |
|
123 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
124 { |
|
125 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error : %d"), aError); |
|
126 StopTest(aError); |
|
127 } |
|
128 else |
|
129 { |
|
130 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
131 StopTest(aError, EFail); |
|
132 } |
|
133 break; |
|
134 } |
|
135 default: |
|
136 { |
|
137 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
138 StopTest(aError, EFail); |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 /* |
|
144 *======================================================================================================== |
|
145 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0002 |
|
146 */ |
|
147 RA3FDevSoundPlaySetVolumeWhilePlayingTest::RA3FDevSoundPlaySetVolumeWhilePlayingTest(const TDesC& aTestName) : |
|
148 RA3FDevSoundTestBase(aTestName), iVolume(0), |
|
149 iFilename(KNullDesC) |
|
150 { |
|
151 } |
|
152 |
|
153 RA3FDevSoundPlaySetVolumeWhilePlayingTest* RA3FDevSoundPlaySetVolumeWhilePlayingTest::NewL(const TDesC& aTestName) |
|
154 { |
|
155 RA3FDevSoundPlaySetVolumeWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlaySetVolumeWhilePlayingTest(aTestName); |
|
156 return self; |
|
157 } |
|
158 |
|
159 void RA3FDevSoundPlaySetVolumeWhilePlayingTest::DoKickoffTestL() |
|
160 { |
|
161 TPtrC filename; |
|
162 // Get the filename of the audio file to play |
|
163 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
164 { |
|
165 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
166 StopTest (KErrNotFound); |
|
167 return; |
|
168 } |
|
169 // open using RFile for playback |
|
170 iFilename.Copy (filename); |
|
171 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
172 if (err != KErrNone) |
|
173 { |
|
174 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
175 iFs.Close(); |
|
176 StopTest(err); |
|
177 return; |
|
178 } |
|
179 |
|
180 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
181 |
|
182 if (!GetIntFromConfig(iTestStepName, KVolume, iVolume)) |
|
183 { |
|
184 ERR_PRINTF2(KMsgErrorGetParameter, &KVolume); |
|
185 StopTest (KErrNotFound); |
|
186 return; |
|
187 } |
|
188 TPtrC fourccCode; |
|
189 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
190 { |
|
191 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
192 StopTest(KErrNotFound); |
|
193 return; |
|
194 } |
|
195 EncodingFromStringToTFourCC(fourccCode); |
|
196 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
197 } |
|
198 |
|
199 void RA3FDevSoundPlaySetVolumeWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
200 { |
|
201 switch (iDevSoundState) |
|
202 { |
|
203 case EStateCreated: |
|
204 { |
|
205 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumePlayingTest"), EFsmIncorrectErrorPassed)); |
|
206 if (aDevSoundEvent == EEventInitialize) |
|
207 { |
|
208 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
209 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
210 if (err != KErrNone) |
|
211 { |
|
212 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error: %d"), err); |
|
213 StopTest(err); |
|
214 break; |
|
215 } |
|
216 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
217 iDevSoundState = EStateInitializing; |
|
218 } |
|
219 else |
|
220 { |
|
221 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
222 StopTest(aError, EFail); |
|
223 } |
|
224 break; |
|
225 } |
|
226 case EStateInitializing: |
|
227 { |
|
228 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
229 { |
|
230 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
231 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
232 if (err != KErrNone) |
|
233 { |
|
234 StopTest(err); |
|
235 break; |
|
236 } |
|
237 StartTimer(KMicroSecsTwoSec); |
|
238 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
239 iDevSoundState = EStatePlaying; |
|
240 } |
|
241 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
242 { |
|
243 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
244 StopTest(aError); |
|
245 } |
|
246 else |
|
247 { |
|
248 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
249 StopTest(aError, EFail); |
|
250 } |
|
251 break; |
|
252 } |
|
253 case EStatePlaying: |
|
254 { |
|
255 if (aDevSoundEvent == EEventBTBF) |
|
256 { |
|
257 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
258 TInt err = iFile.Read (buffer->Data ()); |
|
259 if (err != KErrNone) |
|
260 { |
|
261 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with: %d"), err); |
|
262 StopTest(err); |
|
263 break; |
|
264 } |
|
265 if (buffer->Data().Length ()!= buffer->RequestSize ()) |
|
266 { |
|
267 iBuffer->SetLastBuffer (ETrue); |
|
268 } |
|
269 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
270 iMMFDevSound->PlayData (); |
|
271 } |
|
272 |
|
273 else if (aDevSoundEvent == EEventTimerComplete) |
|
274 { |
|
275 INFO_PRINTF1(_L("Calling CMMFDevSound::SetVolume")); |
|
276 iMMFDevSound->SetVolume(iVolume); |
|
277 TInt volumeGet; |
|
278 volumeGet=iMMFDevSound->Volume(); |
|
279 if (volumeGet == iVolume) |
|
280 { |
|
281 INFO_PRINTF2(_L("CMMFDevSound::SetVolume during playback succeeded with %d"), volumeGet); |
|
282 } |
|
283 else |
|
284 { |
|
285 ERR_PRINTF2(_L("CMMFDevSound::SetVolume during playback failed with %d"), volumeGet); |
|
286 ERR_PRINTF2(_L("Expected value = %d"), iVolume); |
|
287 StopTest(aError, EFail); |
|
288 } |
|
289 } |
|
290 else |
|
291 { |
|
292 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
293 StopTest(aError, EFail); |
|
294 } |
|
295 break; |
|
296 } |
|
297 default: |
|
298 { |
|
299 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
300 StopTest(aError, EFail); |
|
301 } |
|
302 } |
|
303 } |
|
304 |
|
305 void RA3FDevSoundPlaySetVolumeWhilePlayingTest::DoTimerCallback() |
|
306 { |
|
307 INFO_PRINTF1(_L("TimerEvent called")); |
|
308 iTimer->Cancel(); |
|
309 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
310 Fsm (EEventTimerComplete, KErrNone); |
|
311 } |
|
312 |
|
313 /* |
|
314 *======================================================================================================== |
|
315 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0003 |
|
316 */ |
|
317 RA3FDevSoundPlaySetVolumeTest::RA3FDevSoundPlaySetVolumeTest(const TDesC& aTestName) : |
|
318 RA3FDevSoundTestBase(aTestName), iVolume(0) |
|
319 { |
|
320 } |
|
321 |
|
322 RA3FDevSoundPlaySetVolumeTest* RA3FDevSoundPlaySetVolumeTest::NewL(const TDesC& aTestName) |
|
323 { |
|
324 RA3FDevSoundPlaySetVolumeTest* self = new (ELeave) RA3FDevSoundPlaySetVolumeTest(aTestName); |
|
325 return self; |
|
326 } |
|
327 |
|
328 void RA3FDevSoundPlaySetVolumeTest::DoKickoffTestL() |
|
329 { |
|
330 if (!GetIntFromConfig(iTestStepName, KVolume, iVolume)) |
|
331 { |
|
332 ERR_PRINTF2(KMsgErrorGetParameter, &KVolume); |
|
333 StopTest(KErrNotFound); |
|
334 return; |
|
335 } |
|
336 |
|
337 TPtrC fourccCode; |
|
338 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
339 { |
|
340 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
341 StopTest(KErrNotFound); |
|
342 return; |
|
343 } |
|
344 EncodingFromStringToTFourCC(fourccCode); |
|
345 } |
|
346 |
|
347 void RA3FDevSoundPlaySetVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
348 { |
|
349 switch (iDevSoundState) |
|
350 { |
|
351 case EStateCreated: |
|
352 { |
|
353 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumeTest"), EFsmIncorrectErrorPassed)); |
|
354 if (aDevSoundEvent == EEventInitialize) |
|
355 { |
|
356 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
357 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
358 if (err != KErrNone) |
|
359 { |
|
360 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
361 StopTest(err); |
|
362 break; |
|
363 } |
|
364 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
365 iDevSoundState = EStateInitializing; |
|
366 } |
|
367 else |
|
368 { |
|
369 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
370 StopTest(aError, EFail); |
|
371 } |
|
372 break; |
|
373 } |
|
374 case EStateInitializing: |
|
375 { |
|
376 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
377 { |
|
378 INFO_PRINTF1(_L("Calling CMMFDevSound::SetVolume")); |
|
379 iMMFDevSound->SetVolume(iVolume); |
|
380 TInt volumeGet; |
|
381 volumeGet = iMMFDevSound->Volume(); |
|
382 if (volumeGet == iVolume) |
|
383 { |
|
384 INFO_PRINTF2(_L("CMMFDevSound::SetVolume succeeded with %d"), volumeGet); |
|
385 StopTest(); |
|
386 } |
|
387 else |
|
388 { |
|
389 ERR_PRINTF2(_L("CMMFDevSound::SetVolume failed with %d"), volumeGet); |
|
390 ERR_PRINTF2(_L("Expected value = %d"), iVolume); |
|
391 StopTest(aError, EFail); |
|
392 } |
|
393 } |
|
394 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
395 { |
|
396 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
397 StopTest(aError); |
|
398 } |
|
399 else |
|
400 { |
|
401 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
402 StopTest(aError, EFail); |
|
403 } |
|
404 break; |
|
405 } |
|
406 default: |
|
407 { |
|
408 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
409 StopTest(aError, EFail); |
|
410 } |
|
411 } |
|
412 } |
|
413 |
|
414 /* |
|
415 *======================================================================================================== |
|
416 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0004 |
|
417 */ |
|
418 RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest::RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest(const TDesC& aTestName) : |
|
419 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
420 iVolume(0) |
|
421 { |
|
422 } |
|
423 |
|
424 RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest* RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest::NewL(const TDesC& aTestName) |
|
425 { |
|
426 RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest* self = new (ELeave) RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest(aTestName); |
|
427 return self; |
|
428 } |
|
429 |
|
430 void RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest::DoKickoffTestL() |
|
431 { |
|
432 TPtrC filename; |
|
433 // Get the filename of the audio file to play |
|
434 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
435 { |
|
436 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
437 StopTest(KErrNotFound); |
|
438 return; |
|
439 } |
|
440 // open using RFile for playback |
|
441 iFilename.Copy(filename); |
|
442 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
443 if (err != KErrNone) |
|
444 { |
|
445 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
446 iFs.Close(); |
|
447 StopTest(err); |
|
448 return; |
|
449 } |
|
450 |
|
451 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
452 |
|
453 if (!GetIntFromConfig(iTestStepName, KVolume, iVolume)) |
|
454 { |
|
455 ERR_PRINTF2(KMsgErrorGetParameter, &KVolume); |
|
456 StopTest(KErrNotFound); |
|
457 return; |
|
458 } |
|
459 |
|
460 TPtrC fourccCode; |
|
461 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
462 { |
|
463 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
464 StopTest(KErrNotFound); |
|
465 return; |
|
466 } |
|
467 EncodingFromStringToTFourCC(fourccCode); |
|
468 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
469 } |
|
470 |
|
471 void RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
472 { |
|
473 switch (iDevSoundState) |
|
474 { |
|
475 case EStateCreated: |
|
476 { |
|
477 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest"), EFsmIncorrectErrorPassed)); |
|
478 if (aDevSoundEvent == EEventInitialize) |
|
479 { |
|
480 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
481 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
482 if (err != KErrNone) |
|
483 { |
|
484 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
485 StopTest(err); |
|
486 break; |
|
487 } |
|
488 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
489 iDevSoundState = EStateInitializing; |
|
490 } |
|
491 else |
|
492 { |
|
493 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
494 StopTest(aError, EFail); |
|
495 } |
|
496 break; |
|
497 } |
|
498 case EStateInitializing: |
|
499 { |
|
500 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
501 { |
|
502 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
503 if ( err != KErrNone) |
|
504 { |
|
505 StopTest (err); |
|
506 break; |
|
507 } |
|
508 StartTimer (KMicroSecsTwoSec); |
|
509 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
510 iDevSoundState = EStatePlaying; |
|
511 } |
|
512 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
513 { |
|
514 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
515 StopTest (aError); |
|
516 } |
|
517 else |
|
518 { |
|
519 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
520 StopTest (aError, EFail); |
|
521 } |
|
522 break; |
|
523 } |
|
524 case EStatePlaying: |
|
525 { |
|
526 if (aDevSoundEvent == EEventBTBF) |
|
527 { |
|
528 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
529 TInt err = iFile.Read (buffer->Data ()); |
|
530 if (err != KErrNone) |
|
531 { |
|
532 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
533 StopTest(err); |
|
534 break; |
|
535 } |
|
536 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
537 { |
|
538 iBuffer->SetLastBuffer (ETrue); |
|
539 } |
|
540 INFO_PRINTF1(_L("CMMFDevSound::PlayData")); |
|
541 iMMFDevSound->PlayData(); |
|
542 } |
|
543 else if (aDevSoundEvent == EEventTimerComplete) |
|
544 { |
|
545 INFO_PRINTF1(_L("Calling CMMFDevSound::Pause")); |
|
546 iMMFDevSound->Pause(); |
|
547 INFO_PRINTF1(_L("Calling CMMFDevSound::SetVolume")); |
|
548 iMMFDevSound->SetVolume(iVolume); |
|
549 TInt volumeGet; |
|
550 volumeGet=iMMFDevSound->Volume (); |
|
551 if (volumeGet == iVolume) |
|
552 { |
|
553 INFO_PRINTF2(_L("CMMFDevSound::SetVolume succeeded with %d"), volumeGet); |
|
554 StopTest(); |
|
555 } |
|
556 else |
|
557 { |
|
558 ERR_PRINTF2(_L("CMMFDevSound::SetVolume failed with %d"), volumeGet); |
|
559 ERR_PRINTF2(_L("Expected volume: %d"), iVolume); |
|
560 StopTest(aError, EFail); |
|
561 } |
|
562 } |
|
563 else |
|
564 { |
|
565 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
566 StopTest (aError, EFail); |
|
567 } |
|
568 break; |
|
569 } |
|
570 default: |
|
571 { |
|
572 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
573 StopTest(aError, EFail); |
|
574 } |
|
575 } |
|
576 } |
|
577 |
|
578 void RA3FDevSoundPlaySetVolumeWhilePausedPlayingTest::DoTimerCallback() |
|
579 { |
|
580 iTimer->Cancel(); |
|
581 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
582 Fsm (EEventTimerComplete, KErrNone); |
|
583 } |
|
584 |
|
585 /* |
|
586 *======================================================================================================== |
|
587 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0005 |
|
588 */ |
|
589 RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest::RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest(const TDesC& aTestName) : |
|
590 RA3FDevSoundTestBase(aTestName), |
|
591 iReinitialized(EFalse), iVolume(0) |
|
592 { |
|
593 } |
|
594 |
|
595 RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest* RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest::NewL(const TDesC& aTestName) |
|
596 { |
|
597 RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest * self = new (ELeave) RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest(aTestName); |
|
598 return self; |
|
599 } |
|
600 |
|
601 void RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest::DoKickoffTestL() |
|
602 { |
|
603 if (!GetIntFromConfig(iTestStepName, KVolume, iVolume)) |
|
604 { |
|
605 ERR_PRINTF2(KMsgErrorGetParameter, &KVolume); |
|
606 StopTest (KErrNotFound); |
|
607 return; |
|
608 } |
|
609 TPtrC fourccCode; |
|
610 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
611 { |
|
612 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
613 StopTest (KErrNotFound); |
|
614 return; |
|
615 } |
|
616 EncodingFromStringToTFourCC (fourccCode); |
|
617 } |
|
618 |
|
619 void RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
620 { |
|
621 switch (iDevSoundState) |
|
622 { |
|
623 case EStateCreated: |
|
624 { |
|
625 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumeInitializeToPlayAudioThenTonesTest"), EFsmIncorrectErrorPassed)); |
|
626 if (aDevSoundEvent == EEventInitialize) |
|
627 { |
|
628 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
629 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
630 if (err != KErrNone) |
|
631 { |
|
632 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
633 StopTest(err); |
|
634 break; |
|
635 } |
|
636 INFO_PRINTF1(_L("Calling CMMFDevSound::SetVolume")); |
|
637 iMMFDevSound->SetVolume(iVolume); |
|
638 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
639 iDevSoundState = EStateInitializing; |
|
640 } |
|
641 else |
|
642 { |
|
643 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
644 StopTest(aError, EFail); |
|
645 } |
|
646 break; |
|
647 } |
|
648 case EStateInitializing: |
|
649 { |
|
650 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
651 { |
|
652 if (!iReinitialized) |
|
653 { |
|
654 iReinitialized = ETrue; |
|
655 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
656 TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); |
|
657 if (err != KErrNone) |
|
658 { |
|
659 StopTest(err); |
|
660 break; |
|
661 } |
|
662 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
663 iDevSoundState = EStateInitializing; |
|
664 } |
|
665 else |
|
666 { |
|
667 TInt volumeGet; |
|
668 volumeGet=iMMFDevSound->Volume(); |
|
669 if (volumeGet == iVolume) |
|
670 { |
|
671 INFO_PRINTF2(_L("CMMFDevSound::SetVolume is kept after reinitialise Devsound. Volume = %d "), volumeGet); |
|
672 StopTest(); |
|
673 } |
|
674 else |
|
675 { |
|
676 ERR_PRINTF2(_L("CMMFDevSound::SetVolume was not kept. Volume = %d"), volumeGet); |
|
677 ERR_PRINTF2(_L("Expected value = %d"),iVolume); |
|
678 StopTest(aError, EFail); |
|
679 } |
|
680 } |
|
681 } |
|
682 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
683 { |
|
684 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
685 StopTest (aError); |
|
686 } |
|
687 else |
|
688 { |
|
689 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
690 StopTest (aError, EFail); |
|
691 } |
|
692 break; |
|
693 } |
|
694 default: |
|
695 { |
|
696 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
697 StopTest (aError, EFail); |
|
698 } |
|
699 } |
|
700 } |
|
701 |
|
702 /* |
|
703 *======================================================================================================== |
|
704 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0006 |
|
705 */ |
|
706 RA3FDevSoundPlaySetVolumeRampWhilePlayingTest::RA3FDevSoundPlaySetVolumeRampWhilePlayingTest(const TDesC& aTestName) : |
|
707 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
708 iVolumeRamp(0), iPlayInitTwice(EFalse) |
|
709 { |
|
710 } |
|
711 |
|
712 RA3FDevSoundPlaySetVolumeRampWhilePlayingTest* RA3FDevSoundPlaySetVolumeRampWhilePlayingTest::NewL(const TDesC& aTestName) |
|
713 { |
|
714 RA3FDevSoundPlaySetVolumeRampWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlaySetVolumeRampWhilePlayingTest(aTestName); |
|
715 return self; |
|
716 } |
|
717 |
|
718 void RA3FDevSoundPlaySetVolumeRampWhilePlayingTest::DoKickoffTestL() |
|
719 { |
|
720 TPtrC filename; |
|
721 // Get the filename of the audio file to play |
|
722 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
723 { |
|
724 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
725 StopTest (KErrNotFound); |
|
726 return; |
|
727 } |
|
728 // open using RFile for playback |
|
729 iFilename.Copy(filename); |
|
730 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
731 if (err != KErrNone) |
|
732 { |
|
733 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
734 iFs.Close(); |
|
735 StopTest(err); |
|
736 return; |
|
737 } |
|
738 |
|
739 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
740 |
|
741 if (!GetIntFromConfig(iTestStepName, KVolumeRamp, iVolumeRamp)) |
|
742 { |
|
743 ERR_PRINTF2(KMsgErrorGetParameter, &KVolumeRamp); |
|
744 StopTest(KErrNotFound); |
|
745 return; |
|
746 } |
|
747 |
|
748 TPtrC fourccCode; |
|
749 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
750 { |
|
751 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
752 StopTest(KErrNotFound); |
|
753 return; |
|
754 } |
|
755 EncodingFromStringToTFourCC(fourccCode); |
|
756 iTimer = CPeriodic::NewL (CActive::EPriorityHigh); |
|
757 } |
|
758 |
|
759 void RA3FDevSoundPlaySetVolumeRampWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
760 { |
|
761 switch (iDevSoundState) |
|
762 { |
|
763 case EStateCreated: |
|
764 { |
|
765 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumePlayingTest"), EFsmIncorrectErrorPassed)); |
|
766 if (aDevSoundEvent == EEventInitialize) |
|
767 { |
|
768 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
769 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
770 if (err != KErrNone) |
|
771 { |
|
772 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
773 StopTest(err); |
|
774 break; |
|
775 } |
|
776 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
777 iDevSoundState = EStateInitializing; |
|
778 } |
|
779 else |
|
780 { |
|
781 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
782 StopTest(aError, EFail); |
|
783 } |
|
784 break; |
|
785 } |
|
786 case EStateInitializing: |
|
787 { |
|
788 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
789 { |
|
790 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
791 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
792 if (err != KErrNone) |
|
793 { |
|
794 StopTest (err); |
|
795 break; |
|
796 } |
|
797 StartTimer(KMicroSecsTwoSec); |
|
798 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
799 iDevSoundState = EStatePlaying; |
|
800 } |
|
801 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
802 { |
|
803 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
804 StopTest (aError); |
|
805 } |
|
806 else |
|
807 { |
|
808 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
809 StopTest(aError, EFail); |
|
810 } |
|
811 break; |
|
812 } |
|
813 case EStatePlaying: |
|
814 { |
|
815 if (aDevSoundEvent == EEventBTBF) |
|
816 { |
|
817 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
818 TInt err = iFile.Read (buffer->Data ()); |
|
819 if (err != KErrNone) |
|
820 { |
|
821 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
822 StopTest(err); |
|
823 break; |
|
824 } |
|
825 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
826 { |
|
827 iBuffer->SetLastBuffer (ETrue); |
|
828 } |
|
829 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
830 iMMFDevSound->PlayData (); |
|
831 } |
|
832 else if (aDevSoundEvent == EEventTimerComplete) |
|
833 { |
|
834 INFO_PRINTF1(_L("Calling CMMFDevSound::SetVolumeRamp")); |
|
835 iMMFDevSound->SetVolumeRamp (iVolumeRamp*KMicroSecsInOneSec); |
|
836 } |
|
837 else |
|
838 { |
|
839 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
840 StopTest(aError, EFail); |
|
841 } |
|
842 break; |
|
843 } |
|
844 default: |
|
845 { |
|
846 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
847 StopTest(aError, EFail); |
|
848 } |
|
849 } |
|
850 } |
|
851 |
|
852 void RA3FDevSoundPlaySetVolumeRampWhilePlayingTest::DoTimerCallback() |
|
853 { |
|
854 INFO_PRINTF1(_L("TimerEvent called")); |
|
855 iTimer->Cancel(); |
|
856 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
857 Fsm(EEventTimerComplete, KErrNone); |
|
858 } |
|
859 |
|
860 void RA3FDevSoundPlaySetVolumeRampWhilePlayingTest::PlayError(TInt aError) |
|
861 { |
|
862 INFO_PRINTF1(_L("========== DevSound PlayError() callback ==========")); |
|
863 INFO_PRINTF3(KMsgErrorDevSoundCallback, &KPlayErrorText, aError); |
|
864 if (iBuffer->LastBuffer ()&& aError == KErrUnderflow) |
|
865 { |
|
866 TInt filePosition = 0; |
|
867 TInt err = iFile.Seek (ESeekStart, filePosition); |
|
868 if (err != KErrNone) |
|
869 { |
|
870 ERR_PRINTF2(_L("iFile.Seek() returned %d"), err); |
|
871 StopTest(err); |
|
872 } |
|
873 else |
|
874 { |
|
875 if (!iPlayInitTwice) |
|
876 { |
|
877 INFO_PRINTF1(_L("Playback completed normally")); |
|
878 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
879 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
880 if (err != KErrNone) |
|
881 { |
|
882 ERR_PRINTF2(_L("Calling again CMMFDevSound::PlayInitL left with error = %d"), err); |
|
883 StopTest(err); |
|
884 } |
|
885 iPlayInitTwice=ETrue; |
|
886 } |
|
887 else |
|
888 { |
|
889 StopTest(err); |
|
890 } |
|
891 } |
|
892 } |
|
893 else |
|
894 { |
|
895 INFO_PRINTF1(_L("Playback completed with error")); |
|
896 StopTest(aError, EFail); |
|
897 } |
|
898 } |
|
899 |
|
900 /* |
|
901 *======================================================================================================== |
|
902 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0007 |
|
903 */ |
|
904 RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest::RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest(const TDesC& aTestName) : |
|
905 RA3FDevSoundTestBase(aTestName) |
|
906 { |
|
907 } |
|
908 |
|
909 RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest* RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest::NewL(const TDesC& aTestName) |
|
910 { |
|
911 RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest* self = new (ELeave) RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest(aTestName); |
|
912 return self; |
|
913 } |
|
914 |
|
915 void RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest::DoKickoffTestL() |
|
916 { |
|
917 TPtrC fourccCode; |
|
918 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
919 { |
|
920 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
921 StopTest(KErrNotFound); |
|
922 return; |
|
923 } |
|
924 EncodingFromStringToTFourCC (fourccCode); |
|
925 } |
|
926 |
|
927 void RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
928 { |
|
929 switch (iDevSoundState) |
|
930 { |
|
931 case EStateCreated: |
|
932 { |
|
933 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumeBeyondMaxVolumeTest"), EFsmIncorrectErrorPassed)); |
|
934 if (aDevSoundEvent == EEventInitialize) |
|
935 { |
|
936 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
937 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
938 if (err != KErrNone) |
|
939 { |
|
940 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
941 StopTest(err); |
|
942 break; |
|
943 } |
|
944 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
945 iDevSoundState = EStateInitializing; |
|
946 } |
|
947 else |
|
948 { |
|
949 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
950 StopTest (aError, EFail); |
|
951 } |
|
952 break; |
|
953 } |
|
954 case EStateInitializing: |
|
955 { |
|
956 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
957 { |
|
958 INFO_PRINTF1(_L("Calling CMMFDevSound::SetVolume()to set volume values beyond CMMFDevSound::MaxVolume()")); |
|
959 TInt maxVolume = iMMFDevSound->MaxVolume(); |
|
960 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()+ KExtraVolume); |
|
961 TInt volumeGet = iMMFDevSound->Volume(); |
|
962 if (volumeGet == maxVolume) |
|
963 { |
|
964 INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume to set volume beyond CMMFDevSound::MaxVolume succeeded with %d"), volumeGet); |
|
965 StopTest(); |
|
966 break; |
|
967 } |
|
968 else |
|
969 { |
|
970 ERR_PRINTF2(_L("Calling CMMFDevSound::SetVolume to set volume beyond CMMFDevSound::MaxVolume failed with %d"), volumeGet); |
|
971 ERR_PRINTF2(_L("Expected value = %d"), maxVolume); |
|
972 StopTest(aError, EFail); |
|
973 break; |
|
974 } |
|
975 } |
|
976 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
977 { |
|
978 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
979 StopTest(aError); |
|
980 } |
|
981 else |
|
982 { |
|
983 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
984 StopTest(aError, EFail); |
|
985 } |
|
986 break; |
|
987 } |
|
988 default: |
|
989 { |
|
990 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
991 StopTest(aError, EFail); |
|
992 } |
|
993 } |
|
994 } |
|
995 |
|
996 /* |
|
997 *======================================================================================================== |
|
998 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0008 |
|
999 */ |
|
1000 RA3FDevSoundPlaySetVolumeToNegativeTest::RA3FDevSoundPlaySetVolumeToNegativeTest(const TDesC& aTestName) : |
|
1001 RA3FDevSoundTestBase(aTestName), |
|
1002 iVolume(0) |
|
1003 { |
|
1004 } |
|
1005 |
|
1006 RA3FDevSoundPlaySetVolumeToNegativeTest* RA3FDevSoundPlaySetVolumeToNegativeTest::NewL(const TDesC& aTestName) |
|
1007 { |
|
1008 RA3FDevSoundPlaySetVolumeToNegativeTest* self = new (ELeave) RA3FDevSoundPlaySetVolumeToNegativeTest(aTestName); |
|
1009 return self; |
|
1010 } |
|
1011 |
|
1012 void RA3FDevSoundPlaySetVolumeToNegativeTest::DoKickoffTestL() |
|
1013 { |
|
1014 if (!GetIntFromConfig(iTestStepName, KVolume, iVolume)) |
|
1015 { |
|
1016 ERR_PRINTF2(KMsgErrorGetParameter, &KVolume); |
|
1017 StopTest (KErrNotFound); |
|
1018 return; |
|
1019 } |
|
1020 TPtrC fourccCode; |
|
1021 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1022 { |
|
1023 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1024 StopTest (KErrNotFound); |
|
1025 return; |
|
1026 } |
|
1027 EncodingFromStringToTFourCC (fourccCode); |
|
1028 } |
|
1029 |
|
1030 void RA3FDevSoundPlaySetVolumeToNegativeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1031 { |
|
1032 switch (iDevSoundState) |
|
1033 { |
|
1034 case EStateCreated: |
|
1035 { |
|
1036 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumeToNegativeTest"), EFsmIncorrectErrorPassed)); |
|
1037 if (aDevSoundEvent == EEventInitialize) |
|
1038 { |
|
1039 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1040 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1041 if (err != KErrNone) |
|
1042 { |
|
1043 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1044 StopTest(err); |
|
1045 break; |
|
1046 } |
|
1047 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1048 iDevSoundState = EStateInitializing; |
|
1049 } |
|
1050 else |
|
1051 { |
|
1052 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1053 StopTest(aError, EFail); |
|
1054 } |
|
1055 break; |
|
1056 } |
|
1057 case EStateInitializing: |
|
1058 { |
|
1059 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1060 { |
|
1061 INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume to set volume value to a negative: %d"), iVolume); |
|
1062 iMMFDevSound->SetVolume (iVolume); |
|
1063 if (iMMFDevSound->Volume ()== 0) |
|
1064 { |
|
1065 INFO_PRINTF2(_L("Calling CMMFDevSound::SetVolume succeeded with %d"), iMMFDevSound->Volume()); |
|
1066 StopTest(); |
|
1067 break; |
|
1068 } |
|
1069 else |
|
1070 { |
|
1071 ERR_PRINTF2(_L("Calling CMMFDevSound::SetVolume failed with %d"), iMMFDevSound->Volume()); |
|
1072 ERR_PRINTF2(_L("Expected value = %d"), 0); |
|
1073 StopTest (aError, EFail); |
|
1074 break; |
|
1075 } |
|
1076 } |
|
1077 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1078 { |
|
1079 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1080 StopTest (aError); |
|
1081 } |
|
1082 else |
|
1083 { |
|
1084 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1085 StopTest(aError, EFail); |
|
1086 } |
|
1087 break; |
|
1088 } |
|
1089 default: |
|
1090 { |
|
1091 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1092 StopTest (aError, EFail); |
|
1093 } |
|
1094 } |
|
1095 } |
|
1096 |
|
1097 /* |
|
1098 *======================================================================================================== |
|
1099 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0009 |
|
1100 */ |
|
1101 RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest::RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest(const TDesC& aTestName) : |
|
1102 RA3FDevSoundTestBase(aTestName), |
|
1103 iLSpeakerBalance(0), iRSpeakerBalance(0) |
|
1104 { |
|
1105 } |
|
1106 |
|
1107 RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest* RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest::NewL(const TDesC& aTestName) |
|
1108 { |
|
1109 RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest* self = new (ELeave) RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest(aTestName); |
|
1110 return self; |
|
1111 } |
|
1112 |
|
1113 void RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest::DoKickoffTestL() |
|
1114 { |
|
1115 if ( !GetIntFromConfig(iTestStepName, KLSpeakerBalance, iLSpeakerBalance) ) |
|
1116 { |
|
1117 ERR_PRINTF2(KMsgErrorGetParameter, &KLSpeakerBalance); |
|
1118 StopTest(KErrNotFound); |
|
1119 return; |
|
1120 } |
|
1121 if ( !GetIntFromConfig(iTestStepName, KRSpeakerBalance, iRSpeakerBalance) ) |
|
1122 { |
|
1123 ERR_PRINTF2(KMsgErrorGetParameter, &KRSpeakerBalance); |
|
1124 StopTest(KErrNotFound); |
|
1125 return; |
|
1126 } |
|
1127 |
|
1128 TPtrC fourccCode; |
|
1129 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1130 { |
|
1131 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1132 StopTest(KErrNotFound); |
|
1133 return; |
|
1134 } |
|
1135 EncodingFromStringToTFourCC(fourccCode); |
|
1136 } |
|
1137 |
|
1138 void RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1139 { |
|
1140 switch (iDevSoundState) |
|
1141 { |
|
1142 case EStateCreated: |
|
1143 { |
|
1144 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetPlayBalanceBeyondOneHundredTest"), EFsmIncorrectErrorPassed)); |
|
1145 if (aDevSoundEvent == EEventInitialize) |
|
1146 { |
|
1147 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1148 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1149 if (err != KErrNone) |
|
1150 { |
|
1151 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1152 StopTest(err); |
|
1153 break; |
|
1154 } |
|
1155 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1156 iDevSoundState = EStateInitializing; |
|
1157 } |
|
1158 else |
|
1159 { |
|
1160 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1161 StopTest(aError, EFail); |
|
1162 } |
|
1163 break; |
|
1164 } |
|
1165 case EStateInitializing: |
|
1166 { |
|
1167 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1168 { |
|
1169 INFO_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL using left = %d right = %d values"), iLSpeakerBalance, iRSpeakerBalance); |
|
1170 TRAPD(err, iMMFDevSound->SetPlayBalanceL(iLSpeakerBalance, iRSpeakerBalance)); |
|
1171 if (err == KErrNone) |
|
1172 { |
|
1173 TInt getBalanceL, getBalanceR; |
|
1174 TRAPD(err, iMMFDevSound->GetPlayBalanceL(getBalanceL, getBalanceR)); |
|
1175 if (err == KErrNone) |
|
1176 { |
|
1177 if (getBalanceL == KMaxSpeakerBalanceValue && getBalanceR == KMaxSpeakerBalanceValue) |
|
1178 { |
|
1179 INFO_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL to set balance values beyond 100 succeeded, left = %d right = %d values"), getBalanceL, getBalanceR); |
|
1180 StopTest(); |
|
1181 } |
|
1182 else |
|
1183 { |
|
1184 ERR_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL to set balance values beyond 100 failed, left = %d right = %d values"), getBalanceL, getBalanceR); |
|
1185 ERR_PRINTF3(_L("Expected values left = %d right = %d values"), KMaxSpeakerBalanceValue, KMaxSpeakerBalanceValue); |
|
1186 StopTest (err, EFail); |
|
1187 } |
|
1188 } |
|
1189 else |
|
1190 { |
|
1191 ERR_PRINTF1(_L("Error in getting left and right play balance.")); |
|
1192 StopTest (err); |
|
1193 } |
|
1194 } |
|
1195 else |
|
1196 { |
|
1197 ERR_PRINTF1(_L("Error in setting left and right play balance.")); |
|
1198 StopTest (err); |
|
1199 } |
|
1200 } |
|
1201 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1202 { |
|
1203 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1204 StopTest (aError); |
|
1205 } |
|
1206 else |
|
1207 { |
|
1208 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1209 StopTest(aError, EFail); |
|
1210 } |
|
1211 break; |
|
1212 } |
|
1213 default: |
|
1214 { |
|
1215 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1216 StopTest(aError, EFail); |
|
1217 } |
|
1218 } |
|
1219 } |
|
1220 |
|
1221 /* |
|
1222 *======================================================================================================== |
|
1223 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0010 |
|
1224 */ |
|
1225 RA3FDevSoundPlaySetPlayBalanceToNegativeTest::RA3FDevSoundPlaySetPlayBalanceToNegativeTest(const TDesC& aTestName) : |
|
1226 RA3FDevSoundTestBase(aTestName), |
|
1227 iLSpeakerBalance(0), iRSpeakerBalance(0) |
|
1228 { |
|
1229 } |
|
1230 |
|
1231 RA3FDevSoundPlaySetPlayBalanceToNegativeTest* RA3FDevSoundPlaySetPlayBalanceToNegativeTest::NewL(const TDesC& aTestName) |
|
1232 { |
|
1233 RA3FDevSoundPlaySetPlayBalanceToNegativeTest* self = new (ELeave) RA3FDevSoundPlaySetPlayBalanceToNegativeTest(aTestName); |
|
1234 return self; |
|
1235 } |
|
1236 |
|
1237 void RA3FDevSoundPlaySetPlayBalanceToNegativeTest::DoKickoffTestL() |
|
1238 { |
|
1239 if ( !GetIntFromConfig(iTestStepName, KLSpeakerBalance, iLSpeakerBalance) ) |
|
1240 { |
|
1241 ERR_PRINTF2(KMsgErrorGetParameter, &KLSpeakerBalance); |
|
1242 StopTest(KErrNotFound); |
|
1243 return; |
|
1244 } |
|
1245 if ( !GetIntFromConfig(iTestStepName, KRSpeakerBalance, iRSpeakerBalance) ) |
|
1246 { |
|
1247 ERR_PRINTF2(KMsgErrorGetParameter, &KRSpeakerBalance); |
|
1248 StopTest(KErrNotFound); |
|
1249 return; |
|
1250 } |
|
1251 |
|
1252 TPtrC fourccCode; |
|
1253 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1254 { |
|
1255 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1256 StopTest(KErrNotFound); |
|
1257 return; |
|
1258 } |
|
1259 EncodingFromStringToTFourCC (fourccCode); |
|
1260 } |
|
1261 |
|
1262 void RA3FDevSoundPlaySetPlayBalanceToNegativeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1263 { |
|
1264 switch (iDevSoundState) |
|
1265 { |
|
1266 case EStateCreated: |
|
1267 { |
|
1268 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetPlayBalanceToNegativeTest"), EFsmIncorrectErrorPassed)); |
|
1269 if (aDevSoundEvent == EEventInitialize) |
|
1270 { |
|
1271 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1272 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1273 if (err != KErrNone) |
|
1274 { |
|
1275 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1276 StopTest(err); |
|
1277 break; |
|
1278 } |
|
1279 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1280 iDevSoundState = EStateInitializing; |
|
1281 } |
|
1282 else |
|
1283 { |
|
1284 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1285 StopTest (aError, EFail); |
|
1286 } |
|
1287 break; |
|
1288 } |
|
1289 case EStateInitializing: |
|
1290 { |
|
1291 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1292 { |
|
1293 INFO_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL using left = %d right = %d values"), iLSpeakerBalance, iRSpeakerBalance); |
|
1294 TRAPD(err, iMMFDevSound->SetPlayBalanceL(iLSpeakerBalance, iRSpeakerBalance)); |
|
1295 if (err == KErrNone) |
|
1296 { |
|
1297 TInt getBalanceL, getBalanceR; |
|
1298 TRAPD(err, iMMFDevSound->GetPlayBalanceL(getBalanceL, getBalanceR)); |
|
1299 if (err == KErrNone) |
|
1300 { |
|
1301 if (getBalanceL == KMinSpeakerBalanceValue && getBalanceR == KMinSpeakerBalanceValue) |
|
1302 { |
|
1303 INFO_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL to set balance values to negative succeeded, left = %d right = %d values"), getBalanceL, getBalanceR); |
|
1304 StopTest(); |
|
1305 } |
|
1306 else |
|
1307 { |
|
1308 ERR_PRINTF3(_L("Calling CMMFDevSound::SetPlayBalanceL to set balance values to negative failed, left = %d right = %d values"), getBalanceL, getBalanceR); |
|
1309 ERR_PRINTF3(_L("Expected values, left = %d right = %d values"), KMinSpeakerBalanceValue, KMinSpeakerBalanceValue); |
|
1310 StopTest(err, EFail); |
|
1311 } |
|
1312 } |
|
1313 else |
|
1314 { |
|
1315 ERR_PRINTF1(_L("Error in getting left and right play balance.")); |
|
1316 StopTest (err); |
|
1317 } |
|
1318 } |
|
1319 else |
|
1320 { |
|
1321 ERR_PRINTF1(_L("Error in setting left and right play balance.")); |
|
1322 StopTest (err); |
|
1323 } |
|
1324 } |
|
1325 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1326 { |
|
1327 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1328 StopTest (aError); |
|
1329 } |
|
1330 else |
|
1331 { |
|
1332 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1333 StopTest (aError, EFail); |
|
1334 } |
|
1335 break; |
|
1336 } |
|
1337 default: |
|
1338 { |
|
1339 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1340 StopTest (aError, EFail); |
|
1341 } |
|
1342 } |
|
1343 } |
|
1344 |
|
1345 /* |
|
1346 *======================================================================================================== |
|
1347 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0011 |
|
1348 */ |
|
1349 RA3FDevSoundPlaySetPrioritySettingsTest::RA3FDevSoundPlaySetPrioritySettingsTest(const TDesC& aTestName) : |
|
1350 RA3FDevSoundTestBase(aTestName), iPriority(0) |
|
1351 { |
|
1352 } |
|
1353 |
|
1354 RA3FDevSoundPlaySetPrioritySettingsTest* RA3FDevSoundPlaySetPrioritySettingsTest::NewL(const TDesC& aTestName) |
|
1355 { |
|
1356 RA3FDevSoundPlaySetPrioritySettingsTest* self = new (ELeave) RA3FDevSoundPlaySetPrioritySettingsTest(aTestName); |
|
1357 return self; |
|
1358 } |
|
1359 |
|
1360 void RA3FDevSoundPlaySetPrioritySettingsTest::DoKickoffTestL() |
|
1361 { |
|
1362 if (!GetIntFromConfig(iTestStepName, KPriority, iPriority)) |
|
1363 { |
|
1364 ERR_PRINTF2(KMsgErrorGetParameter, &KPriority); |
|
1365 StopTest(KErrNotFound); |
|
1366 return; |
|
1367 } |
|
1368 |
|
1369 TPtrC fourccCode; |
|
1370 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1371 { |
|
1372 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1373 StopTest(KErrNotFound); |
|
1374 return; |
|
1375 } |
|
1376 EncodingFromStringToTFourCC(fourccCode); |
|
1377 } |
|
1378 |
|
1379 void RA3FDevSoundPlaySetPrioritySettingsTest::Fsm( |
|
1380 TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1381 { |
|
1382 switch (iDevSoundState) |
|
1383 { |
|
1384 case EStateCreated: |
|
1385 { |
|
1386 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetPrioritySettingTest"), EFsmIncorrectErrorPassed)); |
|
1387 if (aDevSoundEvent == EEventInitialize) |
|
1388 { |
|
1389 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1390 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1391 if (err != KErrNone) |
|
1392 { |
|
1393 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1394 StopTest(err); |
|
1395 break; |
|
1396 } |
|
1397 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1398 iDevSoundState = EStateInitializing; |
|
1399 } |
|
1400 else |
|
1401 { |
|
1402 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1403 StopTest(aError, EFail); |
|
1404 } |
|
1405 break; |
|
1406 } |
|
1407 case EStateInitializing: |
|
1408 { |
|
1409 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1410 { |
|
1411 TMMFPrioritySettings priority; |
|
1412 priority.iPriority = iPriority; |
|
1413 INFO_PRINTF2(_L("Setting Priority to %d calling CMMFDevSound::SetPrioritySettings"), iPriority); |
|
1414 iMMFDevSound->SetPrioritySettings(priority); |
|
1415 INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); |
|
1416 StopTest(); |
|
1417 } |
|
1418 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1419 { |
|
1420 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1421 StopTest (aError); |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1426 StopTest (aError, EFail); |
|
1427 } |
|
1428 break; |
|
1429 } |
|
1430 default: |
|
1431 { |
|
1432 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1433 StopTest(aError, EFail); |
|
1434 } |
|
1435 } |
|
1436 } |
|
1437 |
|
1438 /* |
|
1439 *======================================================================================================== |
|
1440 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0012 |
|
1441 */ |
|
1442 RA3FDevSoundPlayCapabilitiesTest::RA3FDevSoundPlayCapabilitiesTest(const TDesC& aTestName) : |
|
1443 RA3FDevSoundTestBase(aTestName) |
|
1444 { |
|
1445 } |
|
1446 |
|
1447 RA3FDevSoundPlayCapabilitiesTest* RA3FDevSoundPlayCapabilitiesTest::NewL(const TDesC& aTestName) |
|
1448 { |
|
1449 RA3FDevSoundPlayCapabilitiesTest* self = new (ELeave) RA3FDevSoundPlayCapabilitiesTest(aTestName); |
|
1450 return self; |
|
1451 } |
|
1452 |
|
1453 void RA3FDevSoundPlayCapabilitiesTest::DoKickoffTestL() |
|
1454 { |
|
1455 if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels)) |
|
1456 { |
|
1457 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels); |
|
1458 StopTest(KErrNotFound); |
|
1459 return; |
|
1460 } |
|
1461 if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate)) |
|
1462 { |
|
1463 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate); |
|
1464 StopTest(KErrNotFound); |
|
1465 return; |
|
1466 } |
|
1467 TPtrC fourccCode; |
|
1468 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1469 { |
|
1470 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1471 StopTest (KErrNotFound); |
|
1472 return; |
|
1473 } |
|
1474 EncodingFromStringToTFourCC (fourccCode); |
|
1475 } |
|
1476 |
|
1477 void RA3FDevSoundPlayCapabilitiesTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1478 { |
|
1479 switch (iDevSoundState) |
|
1480 { |
|
1481 case EStateCreated: |
|
1482 { |
|
1483 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesTest"), EFsmIncorrectErrorPassed)); |
|
1484 if (aDevSoundEvent == EEventInitialize) |
|
1485 { |
|
1486 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1487 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1488 if (err != KErrNone) |
|
1489 { |
|
1490 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1491 StopTest(err); |
|
1492 break; |
|
1493 } |
|
1494 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1495 iDevSoundState = EStateInitializing; |
|
1496 } |
|
1497 else |
|
1498 { |
|
1499 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1500 StopTest(aError, EFail); |
|
1501 } |
|
1502 break; |
|
1503 } |
|
1504 case EStateInitializing: |
|
1505 { |
|
1506 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1507 { |
|
1508 INFO_PRINTF1(_L("Calling CMMFDevSound::Capabilities")); |
|
1509 TMMFCapabilities capabilitiesGet; |
|
1510 capabilitiesGet = iMMFDevSound->Capabilities (); |
|
1511 |
|
1512 INFO_PRINTF3(_L("Rate Sum:0x%x Channels Sum:0x%x"), capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
1513 PrintSupportedCapabilities (capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
1514 if(capabilitiesGet.iRate == iExCapRate && capabilitiesGet.iChannels == iExCapChannels) |
|
1515 { |
|
1516 INFO_PRINTF3(_L("Capabilities returned match expected capabilities which are Sum:0x%x Channels Sum:0x%x"), capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
1517 StopTest (); |
|
1518 } |
|
1519 else |
|
1520 { |
|
1521 ERR_PRINTF1(_L("Capabilities returned do not match the expected capabilities")); |
|
1522 ERR_PRINTF3(_L("Expected Rate Sum:0x%x Channels Sum:0x%x"), iExCapRate, iExCapChannels); |
|
1523 StopTest (KErrNone, EFail); |
|
1524 } |
|
1525 } |
|
1526 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1527 { |
|
1528 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1529 StopTest (aError); |
|
1530 } |
|
1531 else |
|
1532 { |
|
1533 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1534 StopTest (aError, EFail); |
|
1535 } |
|
1536 break; |
|
1537 } |
|
1538 default: |
|
1539 { |
|
1540 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1541 StopTest (aError, EFail); |
|
1542 } |
|
1543 } |
|
1544 } |
|
1545 |
|
1546 /* |
|
1547 *======================================================================================================== |
|
1548 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0013 |
|
1549 */ |
|
1550 RA3FDevSoundPlayConfigTest::RA3FDevSoundPlayConfigTest(const TDesC& aTestName) : |
|
1551 RA3FDevSoundTestBase(aTestName),iExCapRate(0), |
|
1552 iExCapChannels(0) |
|
1553 { |
|
1554 } |
|
1555 |
|
1556 RA3FDevSoundPlayConfigTest* RA3FDevSoundPlayConfigTest::NewL(const TDesC& aTestName) |
|
1557 { |
|
1558 RA3FDevSoundPlayConfigTest* self = new (ELeave) RA3FDevSoundPlayConfigTest(aTestName); |
|
1559 return self; |
|
1560 } |
|
1561 |
|
1562 void RA3FDevSoundPlayConfigTest::DoKickoffTestL() |
|
1563 { |
|
1564 if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate)) |
|
1565 { |
|
1566 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate); |
|
1567 StopTest(KErrNotFound); |
|
1568 return; |
|
1569 } |
|
1570 if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels)) |
|
1571 { |
|
1572 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels); |
|
1573 StopTest(KErrNotFound); |
|
1574 return; |
|
1575 } |
|
1576 TPtrC fourccCode; |
|
1577 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1578 { |
|
1579 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1580 StopTest (KErrNotFound); |
|
1581 return; |
|
1582 } |
|
1583 EncodingFromStringToTFourCC (fourccCode); |
|
1584 } |
|
1585 |
|
1586 void RA3FDevSoundPlayConfigTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1587 { |
|
1588 switch (iDevSoundState) |
|
1589 { |
|
1590 case EStateCreated: |
|
1591 { |
|
1592 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayConfigTest"), EFsmIncorrectErrorPassed)); |
|
1593 if (aDevSoundEvent == EEventInitialize) |
|
1594 { |
|
1595 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1596 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1597 if (err != KErrNone) |
|
1598 { |
|
1599 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1600 StopTest(err); |
|
1601 break; |
|
1602 } |
|
1603 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1604 iDevSoundState = EStateInitializing; |
|
1605 } |
|
1606 else |
|
1607 { |
|
1608 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1609 StopTest(aError, EFail); |
|
1610 } |
|
1611 break; |
|
1612 } |
|
1613 case EStateInitializing: |
|
1614 { |
|
1615 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1616 { |
|
1617 TMMFCapabilities capabilitiesGet; |
|
1618 TBuf<KMaxSampleRateStringLength> stringSampleRateGet; |
|
1619 TBuf<KMaxChannelsStringLength> stringChannelsGet; |
|
1620 TBuf<KMaxSampleRateStringLength> stringSampleRateExpected; |
|
1621 TBuf<KMaxChannelsStringLength> stringChannelsExpected; |
|
1622 INFO_PRINTF1(_L("Calling CMMFDevSound::Config while playing")); |
|
1623 capabilitiesGet=iMMFDevSound->Config (); |
|
1624 SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet); |
|
1625 ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet); |
|
1626 SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateExpected); |
|
1627 ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsExpected); |
|
1628 if (stringSampleRateExpected.Compare(stringSampleRateGet) == 0) |
|
1629 { |
|
1630 INFO_PRINTF2(_L("Sample rate value match default as expected with %S"), &stringSampleRateGet); |
|
1631 if (stringChannelsExpected.Compare(stringChannelsGet) == 0) |
|
1632 { |
|
1633 INFO_PRINTF2(_L("Channel mode value match default as expected with %S"), &stringChannelsGet); |
|
1634 StopTest(); |
|
1635 } |
|
1636 else |
|
1637 { |
|
1638 INFO_PRINTF2(_L("Channel mode value failed with %S"), &stringChannelsGet); |
|
1639 ERR_PRINTF2(_L("Expected channel mode %S"), &stringChannelsExpected); |
|
1640 StopTest(KErrNone, EFail); |
|
1641 } |
|
1642 } |
|
1643 else |
|
1644 { |
|
1645 ERR_PRINTF2(_L("Sample rate value failed with %S"), &stringSampleRateGet); |
|
1646 ERR_PRINTF2(_L("Expected sample rate %S"), &stringSampleRateExpected); |
|
1647 StopTest(KErrNone, EFail); |
|
1648 } |
|
1649 } |
|
1650 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1651 { |
|
1652 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1653 StopTest(aError); |
|
1654 } |
|
1655 else |
|
1656 { |
|
1657 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1658 StopTest(aError, EFail); |
|
1659 } |
|
1660 break; |
|
1661 } |
|
1662 default: |
|
1663 { |
|
1664 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1665 StopTest(aError, EFail); |
|
1666 } |
|
1667 } |
|
1668 } |
|
1669 |
|
1670 /* |
|
1671 *======================================================================================================== |
|
1672 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0014 |
|
1673 */ |
|
1674 RA3FDevSoundPlayGetPlayBalanceTest::RA3FDevSoundPlayGetPlayBalanceTest(const TDesC& aTestName) : |
|
1675 RA3FDevSoundTestBase(aTestName), |
|
1676 iExLSpeakerBalance(0), |
|
1677 iExRSpeakerBalance(0) |
|
1678 { |
|
1679 } |
|
1680 |
|
1681 RA3FDevSoundPlayGetPlayBalanceTest* RA3FDevSoundPlayGetPlayBalanceTest::NewL(const TDesC& aTestName) |
|
1682 { |
|
1683 RA3FDevSoundPlayGetPlayBalanceTest* self = new (ELeave) RA3FDevSoundPlayGetPlayBalanceTest(aTestName); |
|
1684 return self; |
|
1685 } |
|
1686 |
|
1687 void RA3FDevSoundPlayGetPlayBalanceTest::DoKickoffTestL() |
|
1688 { |
|
1689 if (!GetIntFromConfig(iTestStepName, KExLSpeakerBalance, iExLSpeakerBalance)) |
|
1690 { |
|
1691 ERR_PRINTF2(KMsgErrorGetParameter, &KExLSpeakerBalance); |
|
1692 StopTest(KErrNotFound); |
|
1693 return; |
|
1694 } |
|
1695 if (!GetIntFromConfig(iTestStepName, KExRSpeakerBalance, iExRSpeakerBalance)) |
|
1696 { |
|
1697 ERR_PRINTF2(KMsgErrorGetParameter, &KExRSpeakerBalance); |
|
1698 StopTest(KErrNotFound); |
|
1699 return; |
|
1700 } |
|
1701 TPtrC fourccCode; |
|
1702 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1703 { |
|
1704 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1705 StopTest (KErrNotFound); |
|
1706 return; |
|
1707 } |
|
1708 EncodingFromStringToTFourCC(fourccCode); |
|
1709 } |
|
1710 |
|
1711 void RA3FDevSoundPlayGetPlayBalanceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1712 { |
|
1713 switch (iDevSoundState) |
|
1714 { |
|
1715 case EStateCreated: |
|
1716 { |
|
1717 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayGetPlayBalanceTest"), EFsmIncorrectErrorPassed)); |
|
1718 if (aDevSoundEvent == EEventInitialize) |
|
1719 { |
|
1720 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1721 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1722 if (err != KErrNone) |
|
1723 { |
|
1724 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1725 StopTest(err); |
|
1726 break; |
|
1727 } |
|
1728 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1729 iDevSoundState = EStateInitializing; |
|
1730 } |
|
1731 else |
|
1732 { |
|
1733 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1734 StopTest (aError, EFail); |
|
1735 } |
|
1736 break; |
|
1737 } |
|
1738 case EStateInitializing: |
|
1739 { |
|
1740 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1741 { |
|
1742 TInt getBalanceL, getBalanceR; |
|
1743 INFO_PRINTF1(_L("Calling CMMFDevSound::GetPlayBalance")); |
|
1744 TRAPD(err, iMMFDevSound->GetPlayBalanceL(getBalanceL, getBalanceR)); |
|
1745 if (err == KErrNone) |
|
1746 { |
|
1747 if(getBalanceL == iExLSpeakerBalance && getBalanceR == iExRSpeakerBalance) |
|
1748 { |
|
1749 INFO_PRINTF3(_L("Balance values match expected values which are, right = %d, left = %d"), getBalanceL, getBalanceR); |
|
1750 StopTest(); |
|
1751 } |
|
1752 else |
|
1753 { |
|
1754 ERR_PRINTF3(_L("Balance values do not match expected values, left = %d right = %d"), getBalanceL, getBalanceR); |
|
1755 ERR_PRINTF3(_L("Expected values, left = %d right = %d"), iExLSpeakerBalance, iExRSpeakerBalance); |
|
1756 StopTest(KErrNone, EFail); |
|
1757 } |
|
1758 } |
|
1759 else |
|
1760 { |
|
1761 ERR_PRINTF1(_L("Error in getting left and right play balance.")); |
|
1762 StopTest(err); |
|
1763 } |
|
1764 } |
|
1765 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1766 { |
|
1767 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1768 StopTest(aError); |
|
1769 } |
|
1770 else |
|
1771 { |
|
1772 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1773 StopTest(aError, EFail); |
|
1774 } |
|
1775 break; |
|
1776 } |
|
1777 default: |
|
1778 { |
|
1779 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1780 StopTest(aError, EFail); |
|
1781 } |
|
1782 } |
|
1783 } |
|
1784 |
|
1785 /* |
|
1786 *======================================================================================================== |
|
1787 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0015 |
|
1788 */ |
|
1789 RA3FDevSoundPlayGetSupportedInputDataTypesLTest::RA3FDevSoundPlayGetSupportedInputDataTypesLTest(const TDesC& aTestName) : |
|
1790 RA3FDevSoundTestBase(aTestName), |
|
1791 iCurrentTypeInTest(0) |
|
1792 { |
|
1793 } |
|
1794 |
|
1795 RA3FDevSoundPlayGetSupportedInputDataTypesLTest* RA3FDevSoundPlayGetSupportedInputDataTypesLTest::NewL(const TDesC& aTestName) |
|
1796 { |
|
1797 RA3FDevSoundPlayGetSupportedInputDataTypesLTest* self = new (ELeave) RA3FDevSoundPlayGetSupportedInputDataTypesLTest(aTestName); |
|
1798 return self; |
|
1799 } |
|
1800 |
|
1801 void RA3FDevSoundPlayGetSupportedInputDataTypesLTest::DoKickoffTestL() |
|
1802 { |
|
1803 TPtrC fourccCode; |
|
1804 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1805 { |
|
1806 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1807 StopTest (KErrNotFound); |
|
1808 return; |
|
1809 } |
|
1810 EncodingFromStringToTFourCC(fourccCode); |
|
1811 } |
|
1812 |
|
1813 void RA3FDevSoundPlayGetSupportedInputDataTypesLTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1814 { |
|
1815 switch (iDevSoundState) |
|
1816 { |
|
1817 case EStateCreated: |
|
1818 { |
|
1819 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayGetSupportedInputDataTypesLTest"), EFsmIncorrectErrorPassed)); |
|
1820 if (aDevSoundEvent == EEventInitialize) |
|
1821 { |
|
1822 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1823 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1824 if (err != KErrNone) |
|
1825 { |
|
1826 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1827 StopTest(err); |
|
1828 break; |
|
1829 } |
|
1830 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1831 iDevSoundState = EStateInitializing; |
|
1832 } |
|
1833 else |
|
1834 { |
|
1835 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1836 StopTest(aError, EFail); |
|
1837 } |
|
1838 break; |
|
1839 } |
|
1840 case EStateInitializing: |
|
1841 { |
|
1842 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1843 { |
|
1844 if(iCurrentTypeInTest == 0) |
|
1845 { |
|
1846 TMMFPrioritySettings prioritySettings; |
|
1847 INFO_PRINTF1(_L("Calling CMMFDevSound::GetSupportedInputDataTypes")); |
|
1848 TRAPD(err,iMMFDevSound->GetSupportedInputDataTypesL(iSupportedDataTypes, prioritySettings)); |
|
1849 if (err != KErrNone) |
|
1850 { |
|
1851 ERR_PRINTF2(_L("CMMFDevSound::GetSupportedInputDataTypes data types falied ! Left with error = %d"), err); |
|
1852 StopTest (err); |
|
1853 break; |
|
1854 } |
|
1855 for(TInt x = 0; x < iSupportedDataTypes.Count (); x++) |
|
1856 { |
|
1857 TFourCC fourCC = iSupportedDataTypes[x]; |
|
1858 TBuf<KTFourCC> name; |
|
1859 for (TInt i=0; i<= KFourCCMaxBitDisplacement; i+=K8Bits) |
|
1860 { |
|
1861 name.Append ( (TUint8)(fourCC.FourCC() >> i)); |
|
1862 } |
|
1863 INFO_PRINTF3(_L("Supported Input Data types: 0x%x %S "), fourCC.FourCC(), &name); |
|
1864 } |
|
1865 } |
|
1866 |
|
1867 // Complete test when all types have been used of initialization |
|
1868 if(iCurrentTypeInTest == iSupportedDataTypes.Count()) |
|
1869 { |
|
1870 INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); |
|
1871 StopTest(); |
|
1872 } |
|
1873 else |
|
1874 { |
|
1875 TFourCC fourCC = iSupportedDataTypes[iCurrentTypeInTest]; |
|
1876 TBuf<KTFourCC> name; |
|
1877 for (TInt i=0; i<= KFourCCMaxBitDisplacement; i+=K8Bits) |
|
1878 { |
|
1879 name.Append ( (TUint8)(fourCC.FourCC() >> i)); |
|
1880 } |
|
1881 INFO_PRINTF3(_L("Initializing for Input Data type: 0x%x %S "), fourCC.FourCC(), &name); |
|
1882 TRAPD(err, iMMFDevSound->InitializeL(*this, fourCC, EMMFStatePlaying)); |
|
1883 if (err != KErrNone) |
|
1884 { |
|
1885 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1886 StopTest(err); |
|
1887 break; |
|
1888 } |
|
1889 } |
|
1890 iCurrentTypeInTest++; |
|
1891 } |
|
1892 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1893 { |
|
1894 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1895 StopTest(aError); |
|
1896 } |
|
1897 else |
|
1898 { |
|
1899 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1900 StopTest(aError, EFail); |
|
1901 } |
|
1902 break; |
|
1903 } |
|
1904 default: |
|
1905 { |
|
1906 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
1907 StopTest(aError, EFail); |
|
1908 } |
|
1909 } |
|
1910 } |
|
1911 |
|
1912 /* |
|
1913 *======================================================================================================== |
|
1914 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0016 |
|
1915 */ |
|
1916 RA3FDevSoundPlayMaxVolumeTest::RA3FDevSoundPlayMaxVolumeTest(const TDesC& aTestName) : |
|
1917 RA3FDevSoundTestBase(aTestName), iExVolume(0) |
|
1918 { |
|
1919 } |
|
1920 |
|
1921 RA3FDevSoundPlayMaxVolumeTest* RA3FDevSoundPlayMaxVolumeTest::NewL(const TDesC& aTestName) |
|
1922 { |
|
1923 RA3FDevSoundPlayMaxVolumeTest* self = new (ELeave) RA3FDevSoundPlayMaxVolumeTest(aTestName); |
|
1924 return self; |
|
1925 } |
|
1926 |
|
1927 void RA3FDevSoundPlayMaxVolumeTest::DoKickoffTestL() |
|
1928 { |
|
1929 if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume)) |
|
1930 { |
|
1931 ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume); |
|
1932 StopTest(KErrNotFound); |
|
1933 return; |
|
1934 } |
|
1935 TPtrC fourccCode; |
|
1936 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
1937 { |
|
1938 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
1939 StopTest(KErrNotFound); |
|
1940 return; |
|
1941 } |
|
1942 EncodingFromStringToTFourCC (fourccCode); |
|
1943 } |
|
1944 |
|
1945 void RA3FDevSoundPlayMaxVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
1946 { |
|
1947 switch (iDevSoundState) |
|
1948 { |
|
1949 case EStateCreated: |
|
1950 { |
|
1951 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayMaxVolumeTest"), EFsmIncorrectErrorPassed)); |
|
1952 if ( aDevSoundEvent == EEventInitialize) |
|
1953 { |
|
1954 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
1955 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
1956 if (err != KErrNone) |
|
1957 { |
|
1958 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
1959 StopTest(err); |
|
1960 break; |
|
1961 } |
|
1962 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
1963 iDevSoundState = EStateInitializing; |
|
1964 } |
|
1965 else |
|
1966 { |
|
1967 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
1968 StopTest(aError, EFail); |
|
1969 } |
|
1970 break; |
|
1971 } |
|
1972 case EStateInitializing: |
|
1973 { |
|
1974 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
1975 { |
|
1976 TInt maxVolume = iMMFDevSound->MaxVolume(); |
|
1977 INFO_PRINTF1(_L("Calling CMMFDevSound::MaxVolume")); |
|
1978 if(maxVolume == iExVolume) |
|
1979 { |
|
1980 INFO_PRINTF2(_L("Calling CMMFDevSound::MaxVolume succeeded with the expected value %d"), maxVolume); |
|
1981 StopTest(); |
|
1982 } |
|
1983 else |
|
1984 { |
|
1985 ERR_PRINTF2(_L("Calling CMMFDevSound::MaxVolume failed with value %d"), maxVolume); |
|
1986 ERR_PRINTF2(_L("Expected value = %d"), iExVolume); |
|
1987 StopTest(KErrNone, EFail); |
|
1988 } |
|
1989 } |
|
1990 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
1991 { |
|
1992 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
1993 StopTest(aError); |
|
1994 } |
|
1995 else |
|
1996 { |
|
1997 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
1998 StopTest(aError, EFail); |
|
1999 } |
|
2000 break; |
|
2001 } |
|
2002 default: |
|
2003 { |
|
2004 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2005 StopTest(aError, EFail); |
|
2006 } |
|
2007 } |
|
2008 } |
|
2009 |
|
2010 /* |
|
2011 *======================================================================================================== |
|
2012 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0017 |
|
2013 */ |
|
2014 RA3FDevSoundPlaySamplesPlayedTest::RA3FDevSoundPlaySamplesPlayedTest(const TDesC& aTestName) : |
|
2015 RA3FDevSoundTestBase(aTestName), |
|
2016 iExSamplesPlayed(0) |
|
2017 { |
|
2018 } |
|
2019 |
|
2020 RA3FDevSoundPlaySamplesPlayedTest* RA3FDevSoundPlaySamplesPlayedTest::NewL(const TDesC& aTestName) |
|
2021 { |
|
2022 RA3FDevSoundPlaySamplesPlayedTest* self = new (ELeave) RA3FDevSoundPlaySamplesPlayedTest(aTestName); |
|
2023 return self; |
|
2024 } |
|
2025 |
|
2026 void RA3FDevSoundPlaySamplesPlayedTest::DoKickoffTestL() |
|
2027 { |
|
2028 if (!GetIntFromConfig(iTestStepName, KExSamplesPlayed, iExSamplesPlayed)) |
|
2029 { |
|
2030 ERR_PRINTF2(KMsgErrorGetParameter, &KExSamplesPlayed); |
|
2031 StopTest(KErrNotFound); |
|
2032 return; |
|
2033 } |
|
2034 TPtrC fourccCode; |
|
2035 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2036 { |
|
2037 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2038 StopTest(KErrNotFound); |
|
2039 return; |
|
2040 } |
|
2041 EncodingFromStringToTFourCC(fourccCode); |
|
2042 } |
|
2043 |
|
2044 void RA3FDevSoundPlaySamplesPlayedTest::Fsm(TMmfDevSoundEvent aDevSoundEvent,TInt aError) |
|
2045 { |
|
2046 switch (iDevSoundState) |
|
2047 { |
|
2048 case EStateCreated: |
|
2049 { |
|
2050 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySamplesPlayedTest"), EFsmIncorrectErrorPassed)); |
|
2051 if (aDevSoundEvent == EEventInitialize) |
|
2052 { |
|
2053 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2054 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2055 if (err != KErrNone) |
|
2056 { |
|
2057 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2058 StopTest(err); |
|
2059 break; |
|
2060 } |
|
2061 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
2062 iDevSoundState = EStateInitializing; |
|
2063 } |
|
2064 else |
|
2065 { |
|
2066 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
2067 StopTest(aError, EFail); |
|
2068 } |
|
2069 break; |
|
2070 } |
|
2071 case EStateInitializing: |
|
2072 { |
|
2073 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
2074 { |
|
2075 INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed")); |
|
2076 TInt samplesPlayed = iMMFDevSound->SamplesPlayed(); |
|
2077 INFO_PRINTF2(_L("Samples returned by CMMFDevSound::SamplesPlayed = %d"), samplesPlayed); |
|
2078 if(samplesPlayed == iExSamplesPlayed) |
|
2079 { |
|
2080 INFO_PRINTF3(_L("Samples returned by CMMFDevSound::SamplesPlayed: %d matches the expected samples played: %d"), samplesPlayed, iExSamplesPlayed); |
|
2081 StopTest(); |
|
2082 } |
|
2083 else |
|
2084 { |
|
2085 ERR_PRINTF2(_L("Call to CMMFDevSound::SamplesPlayed do not match the expected value = %d"), samplesPlayed); |
|
2086 ERR_PRINTF2(_L("Expected Samples played value = %d"), iExSamplesPlayed); |
|
2087 StopTest(KErrNone, EFail); |
|
2088 } |
|
2089 } |
|
2090 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
2091 { |
|
2092 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
2093 StopTest(aError); |
|
2094 } |
|
2095 else |
|
2096 { |
|
2097 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
2098 StopTest(aError, EFail); |
|
2099 } |
|
2100 break; |
|
2101 } |
|
2102 default: |
|
2103 { |
|
2104 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2105 StopTest(aError, EFail); |
|
2106 } |
|
2107 } |
|
2108 } |
|
2109 |
|
2110 /* |
|
2111 *======================================================================================================== |
|
2112 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0018 |
|
2113 */ |
|
2114 RA3FDevSoundPlayVolumeTest::RA3FDevSoundPlayVolumeTest(const TDesC& aTestName) : |
|
2115 RA3FDevSoundTestBase(aTestName), |
|
2116 iExVolume(0) |
|
2117 { |
|
2118 } |
|
2119 |
|
2120 RA3FDevSoundPlayVolumeTest* RA3FDevSoundPlayVolumeTest::NewL(const TDesC& aTestName) |
|
2121 { |
|
2122 RA3FDevSoundPlayVolumeTest* self = new (ELeave) RA3FDevSoundPlayVolumeTest(aTestName); |
|
2123 return self; |
|
2124 } |
|
2125 |
|
2126 void RA3FDevSoundPlayVolumeTest::DoKickoffTestL() |
|
2127 { |
|
2128 if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume)) |
|
2129 { |
|
2130 ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume); |
|
2131 StopTest(KErrNotFound); |
|
2132 return; |
|
2133 } |
|
2134 TPtrC fourccCode; |
|
2135 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2136 { |
|
2137 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2138 StopTest(KErrNotFound); |
|
2139 return; |
|
2140 } |
|
2141 EncodingFromStringToTFourCC(fourccCode); |
|
2142 } |
|
2143 |
|
2144 void RA3FDevSoundPlayVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
2145 { |
|
2146 switch (iDevSoundState) |
|
2147 { |
|
2148 case EStateCreated: |
|
2149 { |
|
2150 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayVolumeTest"), EFsmIncorrectErrorPassed)); |
|
2151 if (aDevSoundEvent == EEventInitialize) |
|
2152 { |
|
2153 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2154 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2155 if (err != KErrNone) |
|
2156 { |
|
2157 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2158 StopTest(err); |
|
2159 break; |
|
2160 } |
|
2161 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
2162 iDevSoundState = EStateInitializing; |
|
2163 } |
|
2164 else |
|
2165 { |
|
2166 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
2167 StopTest(aError, EFail); |
|
2168 } |
|
2169 break; |
|
2170 } |
|
2171 case EStateInitializing: |
|
2172 { |
|
2173 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
2174 { |
|
2175 INFO_PRINTF1(_L("Calling CMMFDevSound::Volume")); |
|
2176 TInt volumeGet = iMMFDevSound->Volume(); |
|
2177 INFO_PRINTF2(_L("Volume returned by CMMFDevSound::Volume() = %d"), volumeGet); |
|
2178 if(volumeGet == iExVolume) |
|
2179 { |
|
2180 INFO_PRINTF3(_L("Volume returned by CMMFDevSound::Volume(): %d matches the default device volume: %d"), volumeGet, iExVolume); |
|
2181 StopTest(); |
|
2182 } |
|
2183 else |
|
2184 { |
|
2185 ERR_PRINTF2(_L("Default device volume failed with %d"), volumeGet); |
|
2186 ERR_PRINTF2(_L("Expected value = % d"), iExVolume); |
|
2187 StopTest(aError , EFail); |
|
2188 } |
|
2189 } |
|
2190 break; |
|
2191 } |
|
2192 default: |
|
2193 { |
|
2194 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2195 StopTest(aError, EFail); |
|
2196 } |
|
2197 } |
|
2198 } |
|
2199 |
|
2200 /* |
|
2201 *======================================================================================================== |
|
2202 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0019 |
|
2203 */ |
|
2204 RA3FDevSoundPlayCapabilitiesWhilePlayingTest::RA3FDevSoundPlayCapabilitiesWhilePlayingTest(const TDesC& aTestName) : |
|
2205 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
2206 iExCapChannels(0), iExCapRate(0) |
|
2207 { |
|
2208 } |
|
2209 |
|
2210 RA3FDevSoundPlayCapabilitiesWhilePlayingTest* RA3FDevSoundPlayCapabilitiesWhilePlayingTest::NewL(const TDesC& aTestName) |
|
2211 { |
|
2212 RA3FDevSoundPlayCapabilitiesWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayCapabilitiesWhilePlayingTest(aTestName); |
|
2213 return self; |
|
2214 } |
|
2215 |
|
2216 void RA3FDevSoundPlayCapabilitiesWhilePlayingTest::DoKickoffTestL() |
|
2217 { |
|
2218 if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels)) |
|
2219 { |
|
2220 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels); |
|
2221 StopTest(KErrNotFound); |
|
2222 return; |
|
2223 } |
|
2224 if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate)) |
|
2225 { |
|
2226 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate); |
|
2227 StopTest(KErrNotFound); |
|
2228 return; |
|
2229 } |
|
2230 TPtrC filename; |
|
2231 // Get the filename of the audio file to play |
|
2232 if ( !GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
2233 { |
|
2234 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
2235 StopTest(KErrNotFound); |
|
2236 return; |
|
2237 } |
|
2238 // open using RFile for playback |
|
2239 iFilename.Copy(filename); |
|
2240 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
2241 if (err != KErrNone) |
|
2242 { |
|
2243 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
2244 iFs.Close(); |
|
2245 StopTest(err); |
|
2246 return; |
|
2247 } |
|
2248 |
|
2249 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
2250 |
|
2251 TPtrC fourccCode; |
|
2252 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2253 { |
|
2254 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2255 StopTest(KErrNotFound); |
|
2256 return; |
|
2257 } |
|
2258 EncodingFromStringToTFourCC(fourccCode); |
|
2259 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2260 } |
|
2261 |
|
2262 void RA3FDevSoundPlayCapabilitiesWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
2263 { |
|
2264 switch (iDevSoundState) |
|
2265 { |
|
2266 case EStateCreated: |
|
2267 { |
|
2268 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
2269 if (aDevSoundEvent == EEventInitialize) |
|
2270 { |
|
2271 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2272 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2273 if (err != KErrNone) |
|
2274 { |
|
2275 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2276 StopTest(err); |
|
2277 break; |
|
2278 } |
|
2279 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
2280 iDevSoundState = EStateInitializing; |
|
2281 } |
|
2282 else |
|
2283 { |
|
2284 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
2285 StopTest(aError, EFail); |
|
2286 } |
|
2287 break; |
|
2288 } |
|
2289 case EStateInitializing: |
|
2290 { |
|
2291 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
2292 { |
|
2293 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); |
|
2294 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
2295 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
2296 if (err != KErrNone) |
|
2297 { |
|
2298 StopTest(err); |
|
2299 break; |
|
2300 } |
|
2301 StartTimer(KMicroSecsTwoSec); |
|
2302 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
2303 iDevSoundState = EStatePlaying; |
|
2304 } |
|
2305 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
2306 { |
|
2307 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
2308 StopTest(aError); |
|
2309 } |
|
2310 else |
|
2311 { |
|
2312 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
2313 StopTest(aError, EFail); |
|
2314 } |
|
2315 break; |
|
2316 } |
|
2317 case EStatePlaying: |
|
2318 { |
|
2319 if (aDevSoundEvent == EEventBTBF) |
|
2320 { |
|
2321 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
2322 TInt err = iFile.Read (buffer->Data ()); |
|
2323 if (err != KErrNone) |
|
2324 { |
|
2325 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
2326 StopTest(err); |
|
2327 break; |
|
2328 } |
|
2329 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
2330 { |
|
2331 iBuffer->SetLastBuffer (ETrue); |
|
2332 } |
|
2333 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
2334 iMMFDevSound->PlayData(); |
|
2335 } |
|
2336 else if (aDevSoundEvent == EEventTimerComplete) |
|
2337 { |
|
2338 TMMFCapabilities capabilitiesGet; |
|
2339 INFO_PRINTF1(_L("Calling CMMFDevSound::Capabilities while playing")); |
|
2340 capabilitiesGet = iMMFDevSound->Capabilities (); |
|
2341 INFO_PRINTF3(_L("Rate Sum:0x%x Channels Sum:0x%x"), capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
2342 PrintSupportedCapabilities (capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
2343 if(capabilitiesGet.iRate == iExCapRate && capabilitiesGet.iChannels == iExCapChannels) |
|
2344 { |
|
2345 INFO_PRINTF3(_L("Capabilities returned match expected capabilities which are Sum:0x%x Channels Sum:0x%x"), capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
2346 } |
|
2347 else |
|
2348 { |
|
2349 ERR_PRINTF3(_L("Capabilities returned do not match the expected capabilities. The total capabilities Sum:0x%x Channels Sum:0x%x "), capabilitiesGet.iRate, capabilitiesGet.iChannels); |
|
2350 ERR_PRINTF3(_L("Expected Rate Sum:0x%x Channels Sum:0x%x"), iExCapRate, iExCapChannels); |
|
2351 StopTest (KErrNone, EFail); |
|
2352 } |
|
2353 } |
|
2354 else |
|
2355 { |
|
2356 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
2357 StopTest(aError, EFail); |
|
2358 } |
|
2359 break; |
|
2360 } |
|
2361 default: |
|
2362 { |
|
2363 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2364 StopTest (aError, EFail); |
|
2365 } |
|
2366 } |
|
2367 } |
|
2368 |
|
2369 void RA3FDevSoundPlayCapabilitiesWhilePlayingTest::DoTimerCallback() |
|
2370 { |
|
2371 INFO_PRINTF1(_L("TimerEvent called")); |
|
2372 iTimer->Cancel(); |
|
2373 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
2374 Fsm(EEventTimerComplete, KErrNone); |
|
2375 } |
|
2376 |
|
2377 /* |
|
2378 *======================================================================================================== |
|
2379 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0020 |
|
2380 */ |
|
2381 RA3FDevSoundPlayConfigWhilePlayingTest::RA3FDevSoundPlayConfigWhilePlayingTest(const TDesC& aTestName) : |
|
2382 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), iExCapRate(0), |
|
2383 iExCapChannels(0) |
|
2384 { |
|
2385 } |
|
2386 |
|
2387 RA3FDevSoundPlayConfigWhilePlayingTest* RA3FDevSoundPlayConfigWhilePlayingTest::NewL(const TDesC& aTestName) |
|
2388 { |
|
2389 RA3FDevSoundPlayConfigWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayConfigWhilePlayingTest(aTestName); |
|
2390 return self; |
|
2391 } |
|
2392 |
|
2393 void RA3FDevSoundPlayConfigWhilePlayingTest::DoKickoffTestL() |
|
2394 { |
|
2395 TPtrC filename; |
|
2396 // Get the filename of the audio file to play |
|
2397 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
2398 { |
|
2399 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
2400 StopTest(KErrNotFound); |
|
2401 return; |
|
2402 } |
|
2403 // open using RFile for playback |
|
2404 iFilename.Copy(filename); |
|
2405 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
2406 if (err != KErrNone) |
|
2407 { |
|
2408 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
2409 iFs.Close(); |
|
2410 StopTest(err); |
|
2411 return; |
|
2412 } |
|
2413 |
|
2414 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
2415 |
|
2416 if (!GetIntFromConfig(iTestStepName, KExCapRate, iExCapRate)) |
|
2417 { |
|
2418 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapRate); |
|
2419 StopTest(KErrNotFound); |
|
2420 return; |
|
2421 } |
|
2422 if (!GetIntFromConfig(iTestStepName, KExCapChannels, iExCapChannels)) |
|
2423 { |
|
2424 ERR_PRINTF2(KMsgErrorGetParameter, &KExCapChannels); |
|
2425 StopTest(KErrNotFound); |
|
2426 return; |
|
2427 } |
|
2428 TPtrC fourccCode; |
|
2429 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2430 { |
|
2431 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2432 StopTest(KErrNotFound); |
|
2433 return; |
|
2434 } |
|
2435 EncodingFromStringToTFourCC(fourccCode); |
|
2436 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2437 } |
|
2438 |
|
2439 void RA3FDevSoundPlayConfigWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
2440 { |
|
2441 switch (iDevSoundState) |
|
2442 { |
|
2443 case EStateCreated: |
|
2444 { |
|
2445 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
2446 if (aDevSoundEvent == EEventInitialize) |
|
2447 { |
|
2448 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2449 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2450 if (err != KErrNone) |
|
2451 { |
|
2452 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2453 StopTest(err); |
|
2454 break; |
|
2455 } |
|
2456 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
2457 iDevSoundState = EStateInitializing; |
|
2458 } |
|
2459 else |
|
2460 { |
|
2461 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
2462 StopTest(aError, EFail); |
|
2463 } |
|
2464 break; |
|
2465 } |
|
2466 case EStateInitializing: |
|
2467 { |
|
2468 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
2469 { |
|
2470 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
2471 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
2472 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
2473 if (err != KErrNone) |
|
2474 { |
|
2475 StopTest (err); |
|
2476 break; |
|
2477 } |
|
2478 StartTimer(KMicroSecsTwoSec); |
|
2479 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
2480 iDevSoundState = EStatePlaying; |
|
2481 } |
|
2482 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
2483 { |
|
2484 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
2485 StopTest(aError); |
|
2486 } |
|
2487 else |
|
2488 { |
|
2489 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
2490 StopTest(aError, EFail); |
|
2491 } |
|
2492 break; |
|
2493 } |
|
2494 case EStatePlaying: |
|
2495 { |
|
2496 if (aDevSoundEvent == EEventBTBF) |
|
2497 { |
|
2498 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
2499 TInt err = iFile.Read (buffer->Data ()); |
|
2500 if (err != KErrNone) |
|
2501 { |
|
2502 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
2503 StopTest(err); |
|
2504 break; |
|
2505 } |
|
2506 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
2507 { |
|
2508 iBuffer->SetLastBuffer(ETrue); |
|
2509 } |
|
2510 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
2511 iMMFDevSound->PlayData (); |
|
2512 } |
|
2513 else if (aDevSoundEvent == EEventTimerComplete) |
|
2514 { |
|
2515 TMMFCapabilities capabilitiesGet; |
|
2516 TBuf<KMaxSampleRateStringLength> stringSampleRateGet; |
|
2517 TBuf<KMaxChannelsStringLength> stringChannelsGet; |
|
2518 TBuf<KMaxSampleRateStringLength> stringSampleRateExpected; |
|
2519 TBuf<KMaxChannelsStringLength> stringChannelsExpected; |
|
2520 INFO_PRINTF1(_L("Calling CMMFDevSound::Config while playing")); |
|
2521 capabilitiesGet=iMMFDevSound->Config (); |
|
2522 SampleRateFromTUintToString (capabilitiesGet.iRate, stringSampleRateGet); |
|
2523 ChannelsFromTUintToString (capabilitiesGet.iChannels, stringChannelsGet); |
|
2524 SampleRateFromTIntToTMMFSampleRate (iExCapRate, iExSampleRate); |
|
2525 SampleRateFromTUintToString (iExSampleRate, stringSampleRateExpected); |
|
2526 ChannelsFromTUintToString (iExCapChannels, stringChannelsExpected); |
|
2527 if (stringSampleRateExpected.Compare(stringSampleRateGet) == 0) |
|
2528 { |
|
2529 INFO_PRINTF2(_L("Sample rate value match default as expected with %S"), &stringSampleRateGet); |
|
2530 if (stringChannelsExpected.Compare(stringChannelsGet) == 0) |
|
2531 { |
|
2532 INFO_PRINTF2(_L("Channel mode value match default as expected with %S"), &stringChannelsGet); |
|
2533 StopTest(); |
|
2534 } |
|
2535 else |
|
2536 { |
|
2537 INFO_PRINTF2(_L("Channel mode value failed with %S"), &stringChannelsGet); |
|
2538 ERR_PRINTF2(_L("Expected channel mode %S"), &stringChannelsExpected); |
|
2539 StopTest(KErrNone, EFail); |
|
2540 } |
|
2541 } |
|
2542 else |
|
2543 { |
|
2544 ERR_PRINTF2(_L("Sample rate value failed with %S"), &stringSampleRateGet); |
|
2545 ERR_PRINTF2(_L("Expected sample rate %S"), &stringSampleRateExpected); |
|
2546 StopTest(KErrNone, EFail); |
|
2547 } |
|
2548 } |
|
2549 else |
|
2550 { |
|
2551 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
2552 StopTest(aError, EFail); |
|
2553 } |
|
2554 break; |
|
2555 } |
|
2556 default: |
|
2557 { |
|
2558 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2559 StopTest(aError, EFail); |
|
2560 } |
|
2561 } |
|
2562 } |
|
2563 |
|
2564 void RA3FDevSoundPlayConfigWhilePlayingTest::DoTimerCallback() |
|
2565 { |
|
2566 INFO_PRINTF1(_L("TimerEvent called")); |
|
2567 iTimer->Cancel(); |
|
2568 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
2569 Fsm (EEventTimerComplete, KErrNone); |
|
2570 } |
|
2571 |
|
2572 /* |
|
2573 *======================================================================================================== |
|
2574 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0021 |
|
2575 */ |
|
2576 RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest::RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest(const TDesC& aTestName) : |
|
2577 RA3FDevSoundTestBase(aTestName), |
|
2578 iFilename(KNullDesC), |
|
2579 iExLSpeakerBalance(0), |
|
2580 iExRSpeakerBalance(0) |
|
2581 { |
|
2582 } |
|
2583 |
|
2584 RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest* RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest::NewL(const TDesC& aTestName) |
|
2585 { |
|
2586 RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest(aTestName); |
|
2587 return self; |
|
2588 } |
|
2589 |
|
2590 void RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest::DoKickoffTestL() |
|
2591 { |
|
2592 if (!GetIntFromConfig(iTestStepName, KExLSpeakerBalance, iExLSpeakerBalance)) |
|
2593 { |
|
2594 ERR_PRINTF2(KMsgErrorGetParameter, &KExLSpeakerBalance); |
|
2595 StopTest(KErrNotFound); |
|
2596 return; |
|
2597 } |
|
2598 if (!GetIntFromConfig(iTestStepName, KExRSpeakerBalance, iExRSpeakerBalance)) |
|
2599 { |
|
2600 ERR_PRINTF2(KMsgErrorGetParameter, &KExRSpeakerBalance); |
|
2601 StopTest(KErrNotFound); |
|
2602 return; |
|
2603 } |
|
2604 TPtrC filename; |
|
2605 // Get the filename of the audio file to play |
|
2606 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
2607 { |
|
2608 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
2609 StopTest(KErrNotFound); |
|
2610 return; |
|
2611 } |
|
2612 // open using RFile for playback |
|
2613 iFilename.Copy (filename); |
|
2614 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
2615 if (err != KErrNone) |
|
2616 { |
|
2617 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
2618 iFs.Close(); |
|
2619 StopTest(err); |
|
2620 return; |
|
2621 } |
|
2622 |
|
2623 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
2624 |
|
2625 TPtrC fourccCode; |
|
2626 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2627 { |
|
2628 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2629 StopTest(KErrNotFound); |
|
2630 return; |
|
2631 } |
|
2632 EncodingFromStringToTFourCC(fourccCode); |
|
2633 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2634 } |
|
2635 |
|
2636 void RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
2637 { |
|
2638 switch (iDevSoundState) |
|
2639 { |
|
2640 case EStateCreated: |
|
2641 { |
|
2642 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
2643 if (aDevSoundEvent == EEventInitialize) |
|
2644 { |
|
2645 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2646 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2647 if (err != KErrNone) |
|
2648 { |
|
2649 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2650 StopTest(err); |
|
2651 break; |
|
2652 } |
|
2653 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
2654 iDevSoundState = EStateInitializing; |
|
2655 } |
|
2656 else |
|
2657 { |
|
2658 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
2659 StopTest(aError, EFail); |
|
2660 } |
|
2661 break; |
|
2662 } |
|
2663 case EStateInitializing: |
|
2664 { |
|
2665 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
2666 { |
|
2667 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); |
|
2668 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
2669 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
2670 if (err != KErrNone) |
|
2671 { |
|
2672 StopTest (err); |
|
2673 break; |
|
2674 } |
|
2675 StartTimer (KMicroSecsTwoSec); |
|
2676 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
2677 iDevSoundState = EStatePlaying; |
|
2678 } |
|
2679 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
2680 { |
|
2681 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
2682 StopTest(aError); |
|
2683 } |
|
2684 else |
|
2685 { |
|
2686 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
2687 StopTest(aError, EFail); |
|
2688 } |
|
2689 break; |
|
2690 } |
|
2691 case EStatePlaying: |
|
2692 { |
|
2693 if (aDevSoundEvent == EEventBTBF) |
|
2694 { |
|
2695 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
2696 TInt err = iFile.Read (buffer->Data ()); |
|
2697 if (err != KErrNone) |
|
2698 { |
|
2699 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
2700 StopTest(err); |
|
2701 break; |
|
2702 } |
|
2703 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
2704 { |
|
2705 iBuffer->SetLastBuffer(ETrue); |
|
2706 } |
|
2707 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
2708 iMMFDevSound->PlayData (); |
|
2709 } |
|
2710 else if (aDevSoundEvent == EEventTimerComplete) |
|
2711 { |
|
2712 TInt getBalanceL, getBalanceR; |
|
2713 INFO_PRINTF1(_L("Calling CMMFDevSound::GetPlayBalance while playing")); |
|
2714 TRAPD(err, iMMFDevSound->GetPlayBalanceL(getBalanceL, getBalanceR)); |
|
2715 INFO_PRINTF3(_L("Balance returned by CMMFDevSound::GetPlayBalance left = %d right = %d"), getBalanceL, getBalanceR); |
|
2716 if (err == KErrNone) |
|
2717 { |
|
2718 if(getBalanceL == iExLSpeakerBalance && getBalanceR == iExRSpeakerBalance) |
|
2719 { |
|
2720 INFO_PRINTF5(_L("Balance returned by CMMFDevSound::GetPlayBalance: left %d right %d matches the default device balance: left %d right %d"), getBalanceL, getBalanceR, iExLSpeakerBalance, iExRSpeakerBalance); |
|
2721 } |
|
2722 else |
|
2723 { |
|
2724 ERR_PRINTF3(_L("Balance values do not match expected values, left %d right %d"), getBalanceL, getBalanceR); |
|
2725 ERR_PRINTF3(_L("Expected values, left %d right %d"), iExLSpeakerBalance, iExRSpeakerBalance); |
|
2726 StopTest(KErrNone, EFail); |
|
2727 } |
|
2728 } |
|
2729 else |
|
2730 { |
|
2731 ERR_PRINTF1(_L("Error in getting left and right play balance.")); |
|
2732 StopTest(err); |
|
2733 } |
|
2734 } |
|
2735 else |
|
2736 { |
|
2737 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
2738 StopTest(aError, EFail); |
|
2739 } |
|
2740 break; |
|
2741 } |
|
2742 default: |
|
2743 { |
|
2744 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2745 StopTest(aError, EFail); |
|
2746 } |
|
2747 } |
|
2748 } |
|
2749 |
|
2750 void RA3FDevSoundPlayGetPlayBalanceWhilePlayingTest::DoTimerCallback() |
|
2751 { |
|
2752 INFO_PRINTF1(_L("TimerEvent called")); |
|
2753 iTimer->Cancel(); |
|
2754 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
2755 Fsm(EEventTimerComplete, KErrNone); |
|
2756 } |
|
2757 |
|
2758 /* |
|
2759 *======================================================================================================== |
|
2760 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0022 |
|
2761 */ |
|
2762 RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest::RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest(const TDesC& aTestName) : |
|
2763 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC) |
|
2764 { |
|
2765 } |
|
2766 |
|
2767 RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest* RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest::NewL(const TDesC& aTestName) |
|
2768 { |
|
2769 RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest(aTestName); |
|
2770 return self; |
|
2771 } |
|
2772 |
|
2773 void RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest::DoKickoffTestL() |
|
2774 { |
|
2775 TPtrC filename; |
|
2776 // Get the filename of the audio file to play |
|
2777 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
2778 { |
|
2779 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
2780 StopTest(KErrNotFound); |
|
2781 return; |
|
2782 } |
|
2783 // open using RFile for playback |
|
2784 iFilename.Copy(filename); |
|
2785 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
2786 if (err != KErrNone) |
|
2787 { |
|
2788 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
2789 iFs.Close(); |
|
2790 StopTest(err); |
|
2791 return; |
|
2792 } |
|
2793 |
|
2794 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
2795 |
|
2796 TPtrC fourccCode; |
|
2797 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2798 { |
|
2799 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2800 StopTest(KErrNotFound); |
|
2801 return; |
|
2802 } |
|
2803 EncodingFromStringToTFourCC(fourccCode); |
|
2804 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2805 } |
|
2806 |
|
2807 void RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
2808 { |
|
2809 switch (iDevSoundState) |
|
2810 { |
|
2811 case EStateCreated: |
|
2812 { |
|
2813 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
2814 if (aDevSoundEvent == EEventInitialize) |
|
2815 { |
|
2816 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2817 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2818 if (err != KErrNone) |
|
2819 { |
|
2820 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2821 StopTest(err); |
|
2822 break; |
|
2823 } |
|
2824 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
2825 iDevSoundState = EStateInitializing; |
|
2826 } |
|
2827 else |
|
2828 { |
|
2829 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
2830 StopTest(aError, EFail); |
|
2831 } |
|
2832 break; |
|
2833 } |
|
2834 case EStateInitializing: |
|
2835 { |
|
2836 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
2837 { |
|
2838 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume()); |
|
2839 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
2840 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
2841 if (err != KErrNone) |
|
2842 { |
|
2843 StopTest (err); |
|
2844 break; |
|
2845 } |
|
2846 StartTimer(KMicroSecsTwoSec); |
|
2847 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
2848 iDevSoundState = EStatePlaying; |
|
2849 } |
|
2850 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
2851 { |
|
2852 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
2853 StopTest(aError); |
|
2854 } |
|
2855 else |
|
2856 { |
|
2857 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
2858 StopTest(aError, EFail); |
|
2859 } |
|
2860 break; |
|
2861 } |
|
2862 case EStatePlaying: |
|
2863 { |
|
2864 if (aDevSoundEvent == EEventBTBF) |
|
2865 { |
|
2866 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
2867 TInt err = iFile.Read (buffer->Data ()); |
|
2868 if (err != KErrNone) |
|
2869 { |
|
2870 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
2871 StopTest(err); |
|
2872 break; |
|
2873 } |
|
2874 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
2875 { |
|
2876 iBuffer->SetLastBuffer (ETrue); |
|
2877 } |
|
2878 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
2879 iMMFDevSound->PlayData (); |
|
2880 } |
|
2881 else if (aDevSoundEvent == EEventTimerComplete) |
|
2882 { |
|
2883 RArray< TFourCC > supportedDataTypes; |
|
2884 TMMFPrioritySettings prioritySettings; |
|
2885 TRAPD(err,iMMFDevSound->GetSupportedInputDataTypesL(supportedDataTypes, prioritySettings)); |
|
2886 if (err != KErrNone) |
|
2887 { |
|
2888 ERR_PRINTF2(_L("Getting supported data types falied ! Left with error = %d"), err); |
|
2889 StopTest(err); |
|
2890 break; |
|
2891 } |
|
2892 for(TInt x = 0; x < supportedDataTypes.Count (); x++) |
|
2893 { |
|
2894 TFourCC fourCC = supportedDataTypes[x]; |
|
2895 TBuf<KTFourCC> name; |
|
2896 for (TInt i=0; i<= KFourCCMaxBitDisplacement; i+=K8Bits) |
|
2897 { |
|
2898 name.Append ( (TUint8)(fourCC.FourCC() >> i)); |
|
2899 } |
|
2900 INFO_PRINTF3(_L("Supported Input Data types: 0x%x %S "), fourCC.FourCC(), &name); |
|
2901 } |
|
2902 } |
|
2903 else |
|
2904 { |
|
2905 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
2906 StopTest(aError, EFail); |
|
2907 } |
|
2908 break; |
|
2909 } |
|
2910 default: |
|
2911 { |
|
2912 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
2913 StopTest(aError, EFail); |
|
2914 } |
|
2915 } |
|
2916 } |
|
2917 |
|
2918 void RA3FDevSoundPlayGetSupportedInputDataTypesWhilePlayingTest::DoTimerCallback() |
|
2919 { |
|
2920 INFO_PRINTF1(_L("TimerEvent called")); |
|
2921 iTimer->Cancel(); |
|
2922 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
2923 Fsm(EEventTimerComplete, KErrNone); |
|
2924 } |
|
2925 |
|
2926 /* |
|
2927 *======================================================================================================== |
|
2928 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0023 |
|
2929 */ |
|
2930 RA3FDevSoundPlayMaxVolumeWhilePlayingTest::RA3FDevSoundPlayMaxVolumeWhilePlayingTest(const TDesC& aTestName) : |
|
2931 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
2932 iExVolume(0) |
|
2933 { |
|
2934 } |
|
2935 |
|
2936 RA3FDevSoundPlayMaxVolumeWhilePlayingTest* RA3FDevSoundPlayMaxVolumeWhilePlayingTest::NewL( const TDesC& aTestName) |
|
2937 { |
|
2938 RA3FDevSoundPlayMaxVolumeWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayMaxVolumeWhilePlayingTest(aTestName); |
|
2939 return self; |
|
2940 } |
|
2941 |
|
2942 void RA3FDevSoundPlayMaxVolumeWhilePlayingTest::DoKickoffTestL() |
|
2943 { |
|
2944 if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume)) |
|
2945 { |
|
2946 ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume); |
|
2947 StopTest(KErrNotFound); |
|
2948 return; |
|
2949 } |
|
2950 TPtrC filename; |
|
2951 // Get the filename of the audio file to play |
|
2952 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
2953 { |
|
2954 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
2955 StopTest(KErrNotFound); |
|
2956 return; |
|
2957 } |
|
2958 // open using RFile for playback |
|
2959 iFilename.Copy(filename); |
|
2960 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
2961 if (err != KErrNone) |
|
2962 { |
|
2963 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
2964 iFs.Close(); |
|
2965 StopTest(err); |
|
2966 return; |
|
2967 } |
|
2968 |
|
2969 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
2970 |
|
2971 TPtrC fourccCode; |
|
2972 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
2973 { |
|
2974 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
2975 StopTest (KErrNotFound); |
|
2976 return; |
|
2977 } |
|
2978 EncodingFromStringToTFourCC(fourccCode); |
|
2979 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2980 } |
|
2981 |
|
2982 void RA3FDevSoundPlayMaxVolumeWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
2983 { |
|
2984 switch (iDevSoundState) |
|
2985 { |
|
2986 case EStateCreated: |
|
2987 { |
|
2988 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
2989 if ( aDevSoundEvent == EEventInitialize) |
|
2990 { |
|
2991 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
2992 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
2993 if (err != KErrNone) |
|
2994 { |
|
2995 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
2996 StopTest(err); |
|
2997 break; |
|
2998 } |
|
2999 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3000 iDevSoundState = EStateInitializing; |
|
3001 } |
|
3002 else |
|
3003 { |
|
3004 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3005 StopTest(aError, EFail); |
|
3006 } |
|
3007 break; |
|
3008 } |
|
3009 case EStateInitializing: |
|
3010 { |
|
3011 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3012 { |
|
3013 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume ()); |
|
3014 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
3015 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
3016 if (err != KErrNone) |
|
3017 { |
|
3018 StopTest(err); |
|
3019 break; |
|
3020 } |
|
3021 StartTimer(KMicroSecsTwoSec); |
|
3022 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
3023 iDevSoundState = EStatePlaying; |
|
3024 } |
|
3025 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3026 { |
|
3027 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3028 StopTest(aError); |
|
3029 } |
|
3030 else |
|
3031 { |
|
3032 ERR_PRINTF2(_L("DevSound EEventInitComplete was NOT received as expected. Received event: %d"), aDevSoundEvent); |
|
3033 StopTest(aError, EFail); |
|
3034 } |
|
3035 break; |
|
3036 } |
|
3037 case EStatePlaying: |
|
3038 { |
|
3039 if (aDevSoundEvent == EEventBTBF) |
|
3040 { |
|
3041 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
3042 TInt err = iFile.Read (buffer->Data ()); |
|
3043 if (err != KErrNone) |
|
3044 { |
|
3045 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
3046 StopTest(err); |
|
3047 break; |
|
3048 } |
|
3049 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
3050 { |
|
3051 iBuffer->SetLastBuffer(ETrue); |
|
3052 } |
|
3053 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
3054 iMMFDevSound->PlayData(); |
|
3055 } |
|
3056 else if (aDevSoundEvent == EEventTimerComplete) |
|
3057 { |
|
3058 TInt maxVolume = iMMFDevSound->MaxVolume(); |
|
3059 INFO_PRINTF1(_L("Calling CMMFDevSound::MaxVolume")); |
|
3060 if(maxVolume == iExVolume) |
|
3061 { |
|
3062 INFO_PRINTF2(_L("Call to CMMFDevSound::MaxVolume succeeded with %d"), maxVolume); |
|
3063 StopTest(); |
|
3064 } |
|
3065 else |
|
3066 { |
|
3067 ERR_PRINTF2(_L("Call to CMMFDevSound::MaxVolume failed with %d"), maxVolume); |
|
3068 ERR_PRINTF2(_L("Expected Max volume value = %d"), iExVolume); |
|
3069 StopTest(KErrNone, EFail); |
|
3070 } |
|
3071 } |
|
3072 else |
|
3073 { |
|
3074 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
3075 StopTest(aError, EFail); |
|
3076 } |
|
3077 break; |
|
3078 } |
|
3079 default: |
|
3080 { |
|
3081 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3082 StopTest(aError, EFail); |
|
3083 } |
|
3084 } |
|
3085 } |
|
3086 |
|
3087 void RA3FDevSoundPlayMaxVolumeWhilePlayingTest::DoTimerCallback() |
|
3088 { |
|
3089 INFO_PRINTF1(_L("TimerEvent called")); |
|
3090 iTimer->Cancel(); |
|
3091 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
3092 Fsm (EEventTimerComplete, KErrNone); |
|
3093 } |
|
3094 |
|
3095 /* |
|
3096 *======================================================================================================== |
|
3097 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0024 |
|
3098 */ |
|
3099 RA3FDevSoundPlaySamplesPlayedWhilePlayingTest::RA3FDevSoundPlaySamplesPlayedWhilePlayingTest(const TDesC& aTestName) : |
|
3100 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
3101 iExSamplesPlayed(0) |
|
3102 { |
|
3103 } |
|
3104 |
|
3105 RA3FDevSoundPlaySamplesPlayedWhilePlayingTest* RA3FDevSoundPlaySamplesPlayedWhilePlayingTest::NewL(const TDesC& aTestName) |
|
3106 { |
|
3107 RA3FDevSoundPlaySamplesPlayedWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlaySamplesPlayedWhilePlayingTest(aTestName); |
|
3108 return self; |
|
3109 } |
|
3110 |
|
3111 void RA3FDevSoundPlaySamplesPlayedWhilePlayingTest::DoKickoffTestL() |
|
3112 { |
|
3113 TPtrC filename; |
|
3114 // Get the filename of the audio file to play |
|
3115 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
3116 { |
|
3117 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
3118 StopTest(KErrNotFound); |
|
3119 return; |
|
3120 } |
|
3121 // open using RFile for playback |
|
3122 iFilename.Copy(filename); |
|
3123 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
3124 if (err != KErrNone) |
|
3125 { |
|
3126 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
3127 iFs.Close(); |
|
3128 StopTest(err); |
|
3129 return; |
|
3130 } |
|
3131 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
3132 TPtrC fourccCode; |
|
3133 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
3134 { |
|
3135 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
3136 StopTest(KErrNotFound); |
|
3137 return; |
|
3138 } |
|
3139 EncodingFromStringToTFourCC(fourccCode); |
|
3140 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
3141 } |
|
3142 |
|
3143 void RA3FDevSoundPlaySamplesPlayedWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
3144 { |
|
3145 switch (iDevSoundState) |
|
3146 { |
|
3147 case EStateCreated: |
|
3148 { |
|
3149 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
3150 if (aDevSoundEvent == EEventInitialize) |
|
3151 { |
|
3152 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
3153 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
3154 if (err != KErrNone) |
|
3155 { |
|
3156 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
3157 StopTest(err); |
|
3158 break; |
|
3159 } |
|
3160 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3161 iDevSoundState = EStateInitializing; |
|
3162 } |
|
3163 else |
|
3164 { |
|
3165 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3166 StopTest(aError, EFail); |
|
3167 } |
|
3168 break; |
|
3169 } |
|
3170 case EStateInitializing: |
|
3171 { |
|
3172 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3173 { |
|
3174 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); |
|
3175 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
3176 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
3177 if (err != KErrNone) |
|
3178 { |
|
3179 StopTest(err); |
|
3180 break; |
|
3181 } |
|
3182 StartTimer(KMicroSecsTwoSec); |
|
3183 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
3184 iDevSoundState = EStatePlaying; |
|
3185 } |
|
3186 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3187 { |
|
3188 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3189 StopTest(aError); |
|
3190 } |
|
3191 else |
|
3192 { |
|
3193 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
3194 StopTest(aError, EFail); |
|
3195 } |
|
3196 break; |
|
3197 } |
|
3198 case EStatePlaying: |
|
3199 { |
|
3200 if (aDevSoundEvent == EEventBTBF) |
|
3201 { |
|
3202 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
3203 TInt err = iFile.Read(buffer->Data ()); |
|
3204 if (err != KErrNone) |
|
3205 { |
|
3206 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
3207 StopTest (err); |
|
3208 break; |
|
3209 } |
|
3210 if (buffer->Data().Length()!= buffer->RequestSize()) |
|
3211 { |
|
3212 iBuffer->SetLastBuffer(ETrue); |
|
3213 } |
|
3214 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
3215 iMMFDevSound->PlayData(); |
|
3216 } |
|
3217 else if (aDevSoundEvent == EEventTimerComplete) |
|
3218 { |
|
3219 INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed")); |
|
3220 TInt samplesPlayed = iMMFDevSound->SamplesPlayed(); |
|
3221 INFO_PRINTF2(_L("Samples played so far %d"), samplesPlayed); |
|
3222 if(samplesPlayed > 0) |
|
3223 { |
|
3224 INFO_PRINTF2(_L("Samples returned by CMMFDevSound::SamplesPlayed: %d matches the expected value which is > 0"), samplesPlayed); |
|
3225 StopTest(); |
|
3226 } |
|
3227 else |
|
3228 { |
|
3229 ERR_PRINTF2(_L("Samples played returned an invalid value %d"), samplesPlayed); |
|
3230 ERR_PRINTF1(_L("Expected value must be a positive value greater than 0")); |
|
3231 StopTest(aError, EFail); |
|
3232 |
|
3233 } |
|
3234 } |
|
3235 else |
|
3236 { |
|
3237 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
3238 StopTest(aError, EFail); |
|
3239 } |
|
3240 break; |
|
3241 } |
|
3242 default: |
|
3243 { |
|
3244 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3245 StopTest(aError, EFail); |
|
3246 } |
|
3247 } |
|
3248 } |
|
3249 |
|
3250 void RA3FDevSoundPlaySamplesPlayedWhilePlayingTest::DoTimerCallback() |
|
3251 { |
|
3252 INFO_PRINTF1(_L("TimerEvent called")); |
|
3253 iTimer->Cancel(); |
|
3254 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
3255 Fsm(EEventTimerComplete, KErrNone); |
|
3256 } |
|
3257 |
|
3258 /* |
|
3259 *======================================================================================================== |
|
3260 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0025 |
|
3261 */ |
|
3262 |
|
3263 RA3FDevSoundPlayVolumeWhilePlayingTest::RA3FDevSoundPlayVolumeWhilePlayingTest(const TDesC& aTestName) : |
|
3264 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
3265 iExVolume(0) |
|
3266 { |
|
3267 } |
|
3268 |
|
3269 RA3FDevSoundPlayVolumeWhilePlayingTest* RA3FDevSoundPlayVolumeWhilePlayingTest::NewL(const TDesC& aTestName) |
|
3270 { |
|
3271 RA3FDevSoundPlayVolumeWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayVolumeWhilePlayingTest(aTestName); |
|
3272 return self; |
|
3273 } |
|
3274 |
|
3275 void RA3FDevSoundPlayVolumeWhilePlayingTest::DoKickoffTestL() |
|
3276 { |
|
3277 TPtrC filename; |
|
3278 // Get the filename of the audio file to play |
|
3279 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
3280 { |
|
3281 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
3282 StopTest(KErrNotFound); |
|
3283 return; |
|
3284 } |
|
3285 // open using RFile for playback |
|
3286 iFilename.Copy(filename); |
|
3287 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
3288 if (err != KErrNone) |
|
3289 { |
|
3290 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
3291 iFs.Close(); |
|
3292 StopTest(err); |
|
3293 return; |
|
3294 } |
|
3295 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
3296 TPtrC fourccCode; |
|
3297 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
3298 { |
|
3299 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
3300 StopTest(KErrNotFound); |
|
3301 return; |
|
3302 } |
|
3303 if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume)) |
|
3304 { |
|
3305 ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume); |
|
3306 StopTest(KErrNotFound); |
|
3307 return; |
|
3308 } |
|
3309 EncodingFromStringToTFourCC(fourccCode); |
|
3310 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
3311 } |
|
3312 |
|
3313 void RA3FDevSoundPlayVolumeWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
3314 { |
|
3315 switch (iDevSoundState) |
|
3316 { |
|
3317 case EStateCreated: |
|
3318 { |
|
3319 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
3320 if (aDevSoundEvent == EEventInitialize) |
|
3321 { |
|
3322 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
3323 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
3324 if (err != KErrNone) |
|
3325 { |
|
3326 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
3327 StopTest(err); |
|
3328 break; |
|
3329 } |
|
3330 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3331 iDevSoundState = EStateInitializing; |
|
3332 } |
|
3333 else |
|
3334 { |
|
3335 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3336 StopTest(aError, EFail); |
|
3337 } |
|
3338 break; |
|
3339 } |
|
3340 case EStateInitializing: |
|
3341 { |
|
3342 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3343 { |
|
3344 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
3345 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
3346 if (err != KErrNone) |
|
3347 { |
|
3348 StopTest(err); |
|
3349 break; |
|
3350 } |
|
3351 StartTimer (KMicroSecsTwoSec); |
|
3352 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
3353 iDevSoundState = EStatePlaying; |
|
3354 } |
|
3355 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3356 { |
|
3357 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3358 StopTest(aError); |
|
3359 } |
|
3360 else |
|
3361 { |
|
3362 ERR_PRINTF2(_L("DevSound EEventInitComplete NOT received as expected. Received event: %d"), aDevSoundEvent); |
|
3363 StopTest(aError, EFail); |
|
3364 } |
|
3365 break; |
|
3366 } |
|
3367 case EStatePlaying: |
|
3368 { |
|
3369 if (aDevSoundEvent == EEventBTBF) |
|
3370 { |
|
3371 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
3372 TInt err = iFile.Read(buffer->Data ()); |
|
3373 if (err != KErrNone) |
|
3374 { |
|
3375 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
3376 StopTest(err); |
|
3377 break; |
|
3378 } |
|
3379 if (buffer->Data().Length()!= buffer->RequestSize()) |
|
3380 { |
|
3381 iBuffer->SetLastBuffer(ETrue); |
|
3382 } |
|
3383 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
3384 iMMFDevSound->PlayData(); |
|
3385 } |
|
3386 else if (aDevSoundEvent == EEventTimerComplete) |
|
3387 { |
|
3388 INFO_PRINTF1(_L("Calling CMMFDevSound::Volume")); |
|
3389 TInt volumeGet = iMMFDevSound->Volume(); |
|
3390 if(volumeGet == iExVolume) |
|
3391 { |
|
3392 INFO_PRINTF2(_L("Default device volume succeeded with = %d"), volumeGet); |
|
3393 } |
|
3394 else |
|
3395 { |
|
3396 ERR_PRINTF2(_L("Default device volume failed with = %d"), volumeGet); |
|
3397 ERR_PRINTF2(_L("Expected value = % d"), iExVolume); |
|
3398 StopTest(aError , EFail); |
|
3399 } |
|
3400 } |
|
3401 else |
|
3402 { |
|
3403 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
3404 StopTest(aError, EFail); |
|
3405 } |
|
3406 break; |
|
3407 } |
|
3408 default: |
|
3409 { |
|
3410 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3411 StopTest(aError, EFail); |
|
3412 } |
|
3413 } |
|
3414 } |
|
3415 |
|
3416 void RA3FDevSoundPlayVolumeWhilePlayingTest::DoTimerCallback() |
|
3417 { |
|
3418 INFO_PRINTF1(_L("TimerEvent called")); |
|
3419 iTimer->Cancel(); |
|
3420 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
3421 Fsm(EEventTimerComplete, KErrNone); |
|
3422 } |
|
3423 |
|
3424 /* |
|
3425 *======================================================================================================== |
|
3426 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0026 |
|
3427 */ |
|
3428 RA3FDevSoundPlayTest::RA3FDevSoundPlayTest(const TDesC& aTestName) : |
|
3429 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC) |
|
3430 { |
|
3431 } |
|
3432 |
|
3433 RA3FDevSoundPlayTest* RA3FDevSoundPlayTest::NewL(const TDesC& aTestName) |
|
3434 { |
|
3435 RA3FDevSoundPlayTest* self = new (ELeave) RA3FDevSoundPlayTest(aTestName); |
|
3436 return self; |
|
3437 } |
|
3438 |
|
3439 void RA3FDevSoundPlayTest::DoKickoffTestL() |
|
3440 { |
|
3441 TPtrC filename; |
|
3442 // Get the filename of the audio file to play |
|
3443 if ( !GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
3444 { |
|
3445 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
3446 StopTest (KErrNotFound); |
|
3447 return; |
|
3448 } |
|
3449 // open using RFile for playback |
|
3450 iFilename.Copy (filename); |
|
3451 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
3452 if (err != KErrNone) |
|
3453 { |
|
3454 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
3455 iFs.Close(); |
|
3456 StopTest(err); |
|
3457 return; |
|
3458 } |
|
3459 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
3460 TPtrC fourccCode; |
|
3461 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
3462 { |
|
3463 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
3464 StopTest (KErrNotFound); |
|
3465 return; |
|
3466 } |
|
3467 EncodingFromStringToTFourCC (fourccCode); |
|
3468 } |
|
3469 |
|
3470 void RA3FDevSoundPlayTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
3471 { |
|
3472 switch (iDevSoundState) |
|
3473 { |
|
3474 case EStateCreated: |
|
3475 { |
|
3476 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayCapabilitiesPlayingTest"), EFsmIncorrectErrorPassed)); |
|
3477 if (aDevSoundEvent == EEventInitialize) |
|
3478 { |
|
3479 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
3480 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
3481 if (err != KErrNone) |
|
3482 { |
|
3483 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
3484 StopTest (err); |
|
3485 break; |
|
3486 } |
|
3487 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3488 iDevSoundState = EStateInitializing; |
|
3489 } |
|
3490 else |
|
3491 { |
|
3492 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3493 StopTest(aError, EFail); |
|
3494 } |
|
3495 break; |
|
3496 } |
|
3497 case EStateInitializing: |
|
3498 { |
|
3499 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3500 { |
|
3501 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
3502 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
3503 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
3504 if (err != KErrNone) |
|
3505 { |
|
3506 StopTest(err); |
|
3507 break; |
|
3508 } |
|
3509 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
3510 iDevSoundState = EStatePlaying; |
|
3511 } |
|
3512 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3513 { |
|
3514 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3515 StopTest(aError); |
|
3516 } |
|
3517 else |
|
3518 { |
|
3519 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
3520 StopTest(aError, EFail); |
|
3521 } |
|
3522 break; |
|
3523 } |
|
3524 case EStatePlaying: |
|
3525 { |
|
3526 if (aDevSoundEvent == EEventBTBF) |
|
3527 { |
|
3528 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
3529 TInt err = iFile.Read (buffer->Data ()); |
|
3530 if (err != KErrNone) |
|
3531 { |
|
3532 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
3533 StopTest(err); |
|
3534 break; |
|
3535 } |
|
3536 if (buffer->Data().Length()!= buffer->RequestSize()) |
|
3537 { |
|
3538 iBuffer->SetLastBuffer(ETrue); |
|
3539 } |
|
3540 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
3541 iMMFDevSound->PlayData(); |
|
3542 } |
|
3543 else |
|
3544 { |
|
3545 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
3546 StopTest(aError, EFail); |
|
3547 } |
|
3548 break; |
|
3549 } |
|
3550 default: |
|
3551 { |
|
3552 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3553 StopTest(aError, EFail); |
|
3554 } |
|
3555 } |
|
3556 } |
|
3557 |
|
3558 /* |
|
3559 *======================================================================================================== |
|
3560 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0027 |
|
3561 */ |
|
3562 RA3FDevSoundPlayEmptyBufferWhilePlayingTest::RA3FDevSoundPlayEmptyBufferWhilePlayingTest(const TDesC& aTestName) : |
|
3563 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC) |
|
3564 { |
|
3565 } |
|
3566 |
|
3567 RA3FDevSoundPlayEmptyBufferWhilePlayingTest* RA3FDevSoundPlayEmptyBufferWhilePlayingTest::NewL(const TDesC& aTestName) |
|
3568 { |
|
3569 RA3FDevSoundPlayEmptyBufferWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayEmptyBufferWhilePlayingTest(aTestName); |
|
3570 return self; |
|
3571 } |
|
3572 |
|
3573 void RA3FDevSoundPlayEmptyBufferWhilePlayingTest::DoKickoffTestL() |
|
3574 { |
|
3575 TPtrC filename; |
|
3576 // Get the filename of the audio file to play |
|
3577 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
3578 { |
|
3579 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
3580 StopTest(KErrNotFound); |
|
3581 return; |
|
3582 } |
|
3583 // open using RFile for playback |
|
3584 iFilename.Copy(filename); |
|
3585 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
3586 if (err != KErrNone) |
|
3587 { |
|
3588 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
3589 StopTest(err); |
|
3590 return; |
|
3591 } |
|
3592 |
|
3593 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
3594 |
|
3595 TPtrC fourccCode; |
|
3596 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
3597 { |
|
3598 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
3599 StopTest(KErrNotFound); |
|
3600 return; |
|
3601 } |
|
3602 EncodingFromStringToTFourCC(fourccCode); |
|
3603 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
3604 } |
|
3605 |
|
3606 void RA3FDevSoundPlayEmptyBufferWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
3607 { |
|
3608 switch (iDevSoundState) |
|
3609 { |
|
3610 case EStateCreated: |
|
3611 { |
|
3612 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayEmptyBufferPlayingTest"), EFsmIncorrectErrorPassed)); |
|
3613 if (aDevSoundEvent == EEventInitialize) |
|
3614 { |
|
3615 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
3616 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
3617 if (err != KErrNone) |
|
3618 { |
|
3619 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
3620 StopTest(err); |
|
3621 break; |
|
3622 } |
|
3623 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3624 iDevSoundState = EStateInitializing; |
|
3625 } |
|
3626 else |
|
3627 { |
|
3628 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3629 StopTest(aError, EFail); |
|
3630 } |
|
3631 break; |
|
3632 } |
|
3633 case EStateInitializing: |
|
3634 { |
|
3635 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3636 { |
|
3637 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
3638 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
3639 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
3640 if (err != KErrNone) |
|
3641 { |
|
3642 StopTest(err); |
|
3643 break; |
|
3644 } |
|
3645 StartTimer(KMicroSecsTwoSec); |
|
3646 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
3647 iDevSoundState = EStatePlaying; |
|
3648 } |
|
3649 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3650 { |
|
3651 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3652 StopTest(aError, EFail); |
|
3653 } |
|
3654 else |
|
3655 { |
|
3656 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
3657 StopTest(aError, EFail); |
|
3658 } |
|
3659 break; |
|
3660 } |
|
3661 case EStatePlaying: |
|
3662 { |
|
3663 if (aDevSoundEvent == EEventBTBF) |
|
3664 { |
|
3665 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
3666 TInt err = iFile.Read(buffer->Data()); |
|
3667 if (err != KErrNone) |
|
3668 { |
|
3669 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
3670 StopTest(err); |
|
3671 break; |
|
3672 } |
|
3673 if (buffer->Data().Length ()!= buffer->RequestSize ()) |
|
3674 { |
|
3675 iBuffer->SetLastBuffer(ETrue); |
|
3676 } |
|
3677 INFO_PRINTF1(_L("CMMFDevSound::PlayData()")); |
|
3678 iMMFDevSound->PlayData(); |
|
3679 } |
|
3680 else if (aDevSoundEvent == EEventTimerComplete) |
|
3681 { |
|
3682 INFO_PRINTF1(_L("Calling CMMFDevSound::EmptyBuffers()")); |
|
3683 TInt err = iMMFDevSound->EmptyBuffers(); |
|
3684 if (err == KErrNone) |
|
3685 { |
|
3686 INFO_PRINTF2(_L("Call EmptyBuffers() while playing returned error = %d"), err); |
|
3687 StopTest(); |
|
3688 break; |
|
3689 } |
|
3690 else |
|
3691 { |
|
3692 ERR_PRINTF2(_L("Call EmptyBuffers() while playing returned error = %d"), err); |
|
3693 ERR_PRINTF2(_L("Expected error = %d"), KErrNone); |
|
3694 StopTest(err); |
|
3695 break; |
|
3696 } |
|
3697 } |
|
3698 else |
|
3699 { |
|
3700 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
3701 StopTest(aError, EFail); |
|
3702 } |
|
3703 break; |
|
3704 } |
|
3705 default: |
|
3706 { |
|
3707 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3708 StopTest (aError, EFail); |
|
3709 } |
|
3710 } |
|
3711 } |
|
3712 |
|
3713 void RA3FDevSoundPlayEmptyBufferWhilePlayingTest::DoTimerCallback() |
|
3714 { |
|
3715 INFO_PRINTF1(_L("TimerEvent called")); |
|
3716 iTimer->Cancel(); |
|
3717 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
3718 Fsm(EEventTimerComplete, KErrNone); |
|
3719 } |
|
3720 |
|
3721 /* |
|
3722 *======================================================================================================== |
|
3723 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0028 |
|
3724 */ |
|
3725 RA3FDevSoundPlayEmptyBufferBeforePlayingTest::RA3FDevSoundPlayEmptyBufferBeforePlayingTest(const TDesC& aTestName) : |
|
3726 RA3FDevSoundTestBase(aTestName) |
|
3727 { |
|
3728 } |
|
3729 |
|
3730 RA3FDevSoundPlayEmptyBufferBeforePlayingTest* RA3FDevSoundPlayEmptyBufferBeforePlayingTest::NewL(const TDesC& aTestName) |
|
3731 { |
|
3732 RA3FDevSoundPlayEmptyBufferBeforePlayingTest* self = new (ELeave) RA3FDevSoundPlayEmptyBufferBeforePlayingTest(aTestName); |
|
3733 return self; |
|
3734 } |
|
3735 |
|
3736 void RA3FDevSoundPlayEmptyBufferBeforePlayingTest::DoKickoffTestL() |
|
3737 { |
|
3738 TPtrC fourccCode; |
|
3739 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
3740 { |
|
3741 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
3742 StopTest(KErrNotFound); |
|
3743 return; |
|
3744 } |
|
3745 EncodingFromStringToTFourCC(fourccCode); |
|
3746 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
3747 } |
|
3748 |
|
3749 void RA3FDevSoundPlayEmptyBufferBeforePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
3750 { |
|
3751 switch (iDevSoundState) |
|
3752 { |
|
3753 case EStateCreated: |
|
3754 { |
|
3755 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayEmptyBufferPlayingTest"), EFsmIncorrectErrorPassed)); |
|
3756 if (aDevSoundEvent == EEventInitialize) |
|
3757 { |
|
3758 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
3759 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)) ; |
|
3760 if (err != KErrNone) |
|
3761 { |
|
3762 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
3763 StopTest(err); |
|
3764 break; |
|
3765 } |
|
3766 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3767 iDevSoundState = EStateInitializing; |
|
3768 } |
|
3769 else |
|
3770 { |
|
3771 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3772 StopTest(aError, EFail); |
|
3773 } |
|
3774 break; |
|
3775 } |
|
3776 case EStateInitializing: |
|
3777 { |
|
3778 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3779 { |
|
3780 INFO_PRINTF1(_L("Calling CMMFDevSound::EmptyBuffers()")); |
|
3781 TInt err = iMMFDevSound->EmptyBuffers (); |
|
3782 if (err == KErrNotReady) |
|
3783 { |
|
3784 INFO_PRINTF2(_L("Calling CMMFDevSound::EmptyBuffers after initialization and before playback returned with the expected error = %d"), err); |
|
3785 StopTest(); |
|
3786 break; |
|
3787 } |
|
3788 else |
|
3789 { |
|
3790 ERR_PRINTF2(_L("Calling CMMFDevSound::EmptyBuffers after initialization and before playback returned with error = %d"), err); |
|
3791 ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); |
|
3792 StopTest(err, EFail); |
|
3793 } |
|
3794 } |
|
3795 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3796 { |
|
3797 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3798 StopTest(aError, EFail); |
|
3799 } |
|
3800 else |
|
3801 { |
|
3802 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
3803 StopTest(aError, EFail); |
|
3804 } |
|
3805 break; |
|
3806 } |
|
3807 default: |
|
3808 { |
|
3809 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3810 StopTest(aError, EFail); |
|
3811 } |
|
3812 } |
|
3813 } |
|
3814 |
|
3815 /* |
|
3816 *======================================================================================================== |
|
3817 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0029 |
|
3818 */ |
|
3819 RA3FDevSoundPlayPauseTest::RA3FDevSoundPlayPauseTest(const TDesC& aTestName) : |
|
3820 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
3821 iPaused(EFalse), iSamplesPlayedPaused(0) |
|
3822 { |
|
3823 } |
|
3824 |
|
3825 RA3FDevSoundPlayPauseTest* RA3FDevSoundPlayPauseTest::NewL(const TDesC& aTestName) |
|
3826 { |
|
3827 RA3FDevSoundPlayPauseTest* self = new (ELeave) RA3FDevSoundPlayPauseTest(aTestName); |
|
3828 return self; |
|
3829 } |
|
3830 |
|
3831 void RA3FDevSoundPlayPauseTest::DoKickoffTestL() |
|
3832 { |
|
3833 TPtrC filename; |
|
3834 // Get the filename of the audio file to play |
|
3835 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
3836 { |
|
3837 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
3838 StopTest(KErrNotFound); |
|
3839 return; |
|
3840 } |
|
3841 // open using RFile for playback |
|
3842 iFilename.Copy(filename); |
|
3843 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
3844 if (err != KErrNone) |
|
3845 { |
|
3846 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
3847 iFs.Close(); |
|
3848 StopTest(err); |
|
3849 return; |
|
3850 } |
|
3851 |
|
3852 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
3853 |
|
3854 TPtrC fourccCode; |
|
3855 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
3856 { |
|
3857 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
3858 StopTest(KErrNotFound); |
|
3859 return; |
|
3860 } |
|
3861 EncodingFromStringToTFourCC(fourccCode); |
|
3862 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
3863 } |
|
3864 |
|
3865 void RA3FDevSoundPlayPauseTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
3866 { |
|
3867 switch (iDevSoundState) |
|
3868 { |
|
3869 case EStateCreated: |
|
3870 { |
|
3871 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPauseTest"), EFsmIncorrectErrorPassed)); |
|
3872 if (aDevSoundEvent == EEventInitialize) |
|
3873 { |
|
3874 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
3875 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
3876 if (err != KErrNone) |
|
3877 { |
|
3878 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
3879 StopTest(err); |
|
3880 break; |
|
3881 } |
|
3882 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
3883 iDevSoundState = EStateInitializing; |
|
3884 } |
|
3885 else |
|
3886 { |
|
3887 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
3888 StopTest(aError, EFail); |
|
3889 } |
|
3890 break; |
|
3891 } |
|
3892 case EStateInitializing: |
|
3893 { |
|
3894 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
3895 { |
|
3896 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
3897 INFO_PRINTF1(_L("CMMFDevSound::PlayInitL")); |
|
3898 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
3899 if (err != KErrNone) |
|
3900 { |
|
3901 StopTest (err); |
|
3902 break; |
|
3903 } |
|
3904 StartTimer(KMicroSecsTwoSec); |
|
3905 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
3906 iDevSoundState = EStatePlaying; |
|
3907 } |
|
3908 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
3909 { |
|
3910 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
3911 StopTest(aError); |
|
3912 } |
|
3913 else |
|
3914 { |
|
3915 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
3916 StopTest(aError, EFail); |
|
3917 } |
|
3918 break; |
|
3919 } |
|
3920 case EStatePlaying: |
|
3921 { |
|
3922 if (aDevSoundEvent == EEventBTBF) |
|
3923 { |
|
3924 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
3925 TInt err = iFile.Read (buffer->Data ()); |
|
3926 if (err != KErrNone) |
|
3927 { |
|
3928 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
3929 StopTest(err); |
|
3930 break; |
|
3931 } |
|
3932 if (buffer->Data().Length()!= buffer->RequestSize()) |
|
3933 { |
|
3934 iBuffer->SetLastBuffer(ETrue); |
|
3935 } |
|
3936 INFO_PRINTF1(_L("CMMFDevSound::PlayData")); |
|
3937 iMMFDevSound->PlayData(); |
|
3938 } |
|
3939 else if (aDevSoundEvent == EEventTimerComplete) |
|
3940 { |
|
3941 INFO_PRINTF1(_L("Calling CMMFDevSound::Pause")); |
|
3942 iMMFDevSound->Pause(); |
|
3943 iDevSoundState = EStatePause; |
|
3944 INFO_PRINTF1(_L("Calling CMMFDevSound::SamplesPlayed")); |
|
3945 iSamplesPlayedPaused = iMMFDevSound->SamplesPlayed(); |
|
3946 INFO_PRINTF2(_L("The number of samples played is %d"), iSamplesPlayedPaused); |
|
3947 } |
|
3948 else |
|
3949 { |
|
3950 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
3951 StopTest(aError, EFail); |
|
3952 } |
|
3953 break; |
|
3954 } |
|
3955 case EStatePause: |
|
3956 { |
|
3957 if (aDevSoundEvent == EEventTimerComplete) |
|
3958 { |
|
3959 TInt samplesPlayed = iMMFDevSound->SamplesPlayed(); |
|
3960 INFO_PRINTF2(_L("Samples returned by CMMFDevSound::SamplesPlayed = %d"), samplesPlayed); |
|
3961 if(iSamplesPlayedPaused == samplesPlayed) |
|
3962 { |
|
3963 INFO_PRINTF3(_L("Samples returned by CMMFDevSound::SamplesPlayed: %d matches the expected samples played: %d"), samplesPlayed, iSamplesPlayedPaused); |
|
3964 StopTest(); |
|
3965 } |
|
3966 else |
|
3967 { |
|
3968 ERR_PRINTF2(_L("Call to CMMFDevSound::SamplesPlayed do not match the expected value = %d"), samplesPlayed); |
|
3969 ERR_PRINTF2(_L("Expected Samples played value = %d"), iSamplesPlayedPaused); |
|
3970 StopTest(KErrNone, EFail); |
|
3971 } |
|
3972 } |
|
3973 else |
|
3974 { |
|
3975 ERR_PRINTF2(_L("EEventTimerComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
3976 StopTest(aError, EFail); |
|
3977 } |
|
3978 break; |
|
3979 } |
|
3980 default: |
|
3981 { |
|
3982 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
3983 StopTest(aError, EFail); |
|
3984 } |
|
3985 } |
|
3986 } |
|
3987 |
|
3988 void RA3FDevSoundPlayPauseTest::DoTimerCallback() |
|
3989 { |
|
3990 INFO_PRINTF1(_L("TimerEvent called")); |
|
3991 if (!iPaused) |
|
3992 { |
|
3993 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
3994 Fsm(EEventTimerComplete, KErrNone); |
|
3995 iPaused = ETrue; |
|
3996 } |
|
3997 else |
|
3998 { |
|
3999 iTimer->Cancel(); |
|
4000 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
4001 Fsm(EEventTimerComplete, KErrNone); |
|
4002 } |
|
4003 } |
|
4004 |
|
4005 /* |
|
4006 *======================================================================================================== |
|
4007 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0030 |
|
4008 */ |
|
4009 RA3FDevSoundPlayStopTest::RA3FDevSoundPlayStopTest(const TDesC& aTestName) : |
|
4010 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), iStopped(EFalse) |
|
4011 { |
|
4012 } |
|
4013 |
|
4014 RA3FDevSoundPlayStopTest* RA3FDevSoundPlayStopTest::NewL(const TDesC& aTestName) |
|
4015 { |
|
4016 RA3FDevSoundPlayStopTest* self = new (ELeave) RA3FDevSoundPlayStopTest(aTestName); |
|
4017 return self; |
|
4018 } |
|
4019 |
|
4020 void RA3FDevSoundPlayStopTest::DoKickoffTestL() |
|
4021 { |
|
4022 TPtrC filename; |
|
4023 // Get the filename of the audio file to play |
|
4024 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
4025 { |
|
4026 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
4027 StopTest(KErrNotFound); |
|
4028 return; |
|
4029 } |
|
4030 // open using RFile for playback |
|
4031 iFilename.Copy(filename); |
|
4032 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
4033 if (err != KErrNone) |
|
4034 { |
|
4035 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
4036 iFs.Close(); |
|
4037 StopTest(err); |
|
4038 return; |
|
4039 } |
|
4040 |
|
4041 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
4042 |
|
4043 TPtrC fourccCode; |
|
4044 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
4045 { |
|
4046 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
4047 StopTest(KErrNotFound); |
|
4048 return; |
|
4049 } |
|
4050 EncodingFromStringToTFourCC(fourccCode); |
|
4051 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
4052 } |
|
4053 |
|
4054 void RA3FDevSoundPlayStopTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
4055 { |
|
4056 switch (iDevSoundState) |
|
4057 { |
|
4058 case EStateCreated: |
|
4059 { |
|
4060 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayStopTest"), EFsmIncorrectErrorPassed)); |
|
4061 if (aDevSoundEvent == EEventInitialize) |
|
4062 { |
|
4063 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
4064 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
4065 if (err != KErrNone) |
|
4066 { |
|
4067 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
4068 StopTest(err); |
|
4069 break; |
|
4070 } |
|
4071 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
4072 iDevSoundState = EStateInitializing; |
|
4073 } |
|
4074 else |
|
4075 { |
|
4076 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
4077 StopTest(aError, EFail); |
|
4078 } |
|
4079 break; |
|
4080 } |
|
4081 case EStateInitializing: |
|
4082 { |
|
4083 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
4084 { |
|
4085 if (!iStopped) |
|
4086 { |
|
4087 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); |
|
4088 INFO_PRINTF1(_L("CMMFDevSound::PlayInitL")); |
|
4089 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
4090 if (err != KErrNone) |
|
4091 { |
|
4092 StopTest(err); |
|
4093 break; |
|
4094 } |
|
4095 StartTimer(KMicroSecsTwoSec); |
|
4096 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
4097 iDevSoundState = EStatePlaying; |
|
4098 } |
|
4099 else |
|
4100 { |
|
4101 INFO_PRINTF1(_L("InitializeComplete returned KErrNone after calling CMMFDevSound::Stop then CMMFDevSound::InitializeL")); |
|
4102 StopTest(); |
|
4103 } |
|
4104 } |
|
4105 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
4106 { |
|
4107 if (!iStopped) |
|
4108 { |
|
4109 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
4110 StopTest(aError); |
|
4111 } |
|
4112 else |
|
4113 { |
|
4114 INFO_PRINTF2(_L("InitializeComplete returned %d after calling CMMFDevSound::Stop then CMMFDevSound::InitializeL"), aError); |
|
4115 StopTest(aError); |
|
4116 } |
|
4117 } |
|
4118 else |
|
4119 { |
|
4120 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
4121 StopTest(aError, EFail); |
|
4122 } |
|
4123 break; |
|
4124 } |
|
4125 case EStatePlaying: |
|
4126 { |
|
4127 if (aDevSoundEvent == EEventBTBF) |
|
4128 { |
|
4129 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
4130 TInt err = iFile.Read (buffer->Data()); |
|
4131 if (err != KErrNone) |
|
4132 { |
|
4133 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
4134 StopTest(err); |
|
4135 break; |
|
4136 } |
|
4137 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
4138 { |
|
4139 iBuffer->SetLastBuffer(ETrue); |
|
4140 } |
|
4141 INFO_PRINTF1(_L("CMMFDevSound::PlayData")); |
|
4142 iMMFDevSound->PlayData(); |
|
4143 } |
|
4144 else if (aDevSoundEvent == EEventTimerComplete) |
|
4145 { |
|
4146 INFO_PRINTF1(_L("CMMFDevSound::Stop")); |
|
4147 iMMFDevSound->Stop(); |
|
4148 } |
|
4149 else |
|
4150 { |
|
4151 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
4152 StopTest(aError, EFail); |
|
4153 } |
|
4154 break; |
|
4155 } |
|
4156 default: |
|
4157 { |
|
4158 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
4159 StopTest(aError, EFail); |
|
4160 } |
|
4161 } |
|
4162 } |
|
4163 |
|
4164 void RA3FDevSoundPlayStopTest::DoTimerCallback() |
|
4165 { |
|
4166 INFO_PRINTF1(_L("TimerEvent called")); |
|
4167 if (!iStopped) |
|
4168 { |
|
4169 INFO_PRINTF1(_L("DevSound Event: EEventTimerComplete")); |
|
4170 Fsm(EEventTimerComplete, KErrNone); |
|
4171 iStopped = ETrue; |
|
4172 } |
|
4173 else |
|
4174 { |
|
4175 iTimer->Cancel(); |
|
4176 INFO_PRINTF1(_L("Initializing again after stop successful. Hence passing the test")); |
|
4177 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
4178 if (err != KErrNone) |
|
4179 { |
|
4180 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
4181 StopTest(err); |
|
4182 } |
|
4183 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
4184 iDevSoundState = EStateInitializing; |
|
4185 } |
|
4186 } |
|
4187 |
|
4188 |
|
4189 /* |
|
4190 *======================================================================================================== |
|
4191 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0031 |
|
4192 */ |
|
4193 RA3FDevSoundPlayPreemptionTest::RA3FDevSoundPlayPreemptionTest(const TDesC& aTestName) : |
|
4194 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
4195 iOtherFilename(KNullDesC) |
|
4196 { |
|
4197 } |
|
4198 |
|
4199 RA3FDevSoundPlayPreemptionTest* RA3FDevSoundPlayPreemptionTest::NewL(const TDesC& aTestName) |
|
4200 { |
|
4201 RA3FDevSoundPlayPreemptionTest* self = new (ELeave) RA3FDevSoundPlayPreemptionTest(aTestName); |
|
4202 return self; |
|
4203 } |
|
4204 |
|
4205 void RA3FDevSoundPlayPreemptionTest::DoKickoffTestL() |
|
4206 { |
|
4207 TPtrC filename; |
|
4208 // Get the filename of the audio file to play |
|
4209 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
4210 { |
|
4211 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
4212 StopTest(KErrNotFound); |
|
4213 return; |
|
4214 } |
|
4215 // open using RFile for playback |
|
4216 iFilename.Copy(filename); |
|
4217 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
4218 if (err != KErrNone) |
|
4219 { |
|
4220 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
4221 StopTest(err); |
|
4222 return; |
|
4223 } |
|
4224 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
4225 // Get the filename of the second devsound instance |
|
4226 TPtrC tempString; |
|
4227 if (!GetStringFromConfig(iTestStepName, KOtherFilename, tempString)) |
|
4228 { |
|
4229 ERR_PRINTF2(KMsgErrorGetParameter, &KOtherFilename); |
|
4230 StopTest(KErrNotFound); |
|
4231 return; |
|
4232 } |
|
4233 iOtherFilename.Copy (tempString); |
|
4234 INFO_PRINTF2(_L("File under test -> %S"), &iOtherFilename); |
|
4235 TPtrC fourccCode; |
|
4236 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
4237 { |
|
4238 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
4239 StopTest(KErrNotFound); |
|
4240 return; |
|
4241 } |
|
4242 EncodingFromStringToTFourCC(fourccCode); |
|
4243 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
4244 iDevsoundPlayClient = CA3FDevSoundPlayClient::NewL(*this, iFourCCCode, iFs, iSuite); |
|
4245 } |
|
4246 |
|
4247 void RA3FDevSoundPlayPreemptionTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
4248 { |
|
4249 switch (iDevSoundState) |
|
4250 { |
|
4251 case EStateCreated: |
|
4252 { |
|
4253 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPreemptionTest"), EFsmIncorrectErrorPassed)); |
|
4254 if (aDevSoundEvent == EEventInitialize) |
|
4255 { |
|
4256 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
4257 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
4258 if (err != KErrNone) |
|
4259 { |
|
4260 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
4261 StopTest(err); |
|
4262 break; |
|
4263 } |
|
4264 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
4265 iDevSoundState = EStateInitializing; |
|
4266 } |
|
4267 else |
|
4268 { |
|
4269 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
4270 StopTest(aError, EFail); |
|
4271 } |
|
4272 break; |
|
4273 } |
|
4274 case EStateInitializing: |
|
4275 { |
|
4276 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
4277 { |
|
4278 TMMFPrioritySettings priority; |
|
4279 priority.iPriority = KMinimumPriority; |
|
4280 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
4281 iMMFDevSound->SetPrioritySettings (priority); |
|
4282 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
4283 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
4284 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
4285 if (err != KErrNone) |
|
4286 { |
|
4287 StopTest(err); |
|
4288 break; |
|
4289 } |
|
4290 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
4291 iDevSoundState = EStatePlaying; |
|
4292 StartTimer(KMicroSecsTwoSec); |
|
4293 } |
|
4294 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
4295 { |
|
4296 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
4297 StopTest(aError); |
|
4298 } |
|
4299 else |
|
4300 { |
|
4301 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
4302 StopTest(aError, EFail); |
|
4303 } |
|
4304 break; |
|
4305 } |
|
4306 case EStatePlaying: |
|
4307 { |
|
4308 if (aDevSoundEvent == EEventBTBF) |
|
4309 { |
|
4310 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
4311 TInt err = iFile.Read (buffer->Data ()); |
|
4312 if (err != KErrNone) |
|
4313 { |
|
4314 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
4315 StopTest (err); |
|
4316 break; |
|
4317 } |
|
4318 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
4319 { |
|
4320 iBuffer->SetLastBuffer(ETrue); |
|
4321 } |
|
4322 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
4323 iMMFDevSound->PlayData(); |
|
4324 } |
|
4325 else |
|
4326 { |
|
4327 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
4328 StopTest(aError, EFail); |
|
4329 } |
|
4330 break; |
|
4331 } |
|
4332 default: |
|
4333 { |
|
4334 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
4335 StopTest(aError, EFail); |
|
4336 } |
|
4337 } |
|
4338 } |
|
4339 |
|
4340 void RA3FDevSoundPlayPreemptionTest::DoTimerCallback() |
|
4341 { |
|
4342 INFO_PRINTF1(_L("TimerEvent called")); |
|
4343 iTimer->Cancel(); |
|
4344 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
4345 iDevsoundPlayClient->SetPriority(KMaximumPriority); |
|
4346 INFO_PRINTF1(_L("Initializing to play audio thru second devsound client")); |
|
4347 TInt err = iDevsoundPlayClient->PlayInit(iOtherFilename); |
|
4348 if (err != KErrNone) |
|
4349 { |
|
4350 ERR_PRINTF2(_L("Initializating DevSound to play audio thru second devsound client failed with error = %d"), err); |
|
4351 StopTest(err); |
|
4352 } |
|
4353 } |
|
4354 |
|
4355 void RA3FDevSoundPlayPreemptionTest::PlayError(TInt aError) |
|
4356 { |
|
4357 INFO_PRINTF1(_L("========== DevSound PlayError() callback ==========")); |
|
4358 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied) |
|
4359 { |
|
4360 INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance==========")); |
|
4361 INFO_PRINTF2(_L("First DevSound client PlayError succeeded with error = %d "), aError); |
|
4362 } |
|
4363 else |
|
4364 { |
|
4365 ERR_PRINTF2(_L("First DevSound client PlayError and failed with error = %d "), aError); |
|
4366 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
4367 StopTest(aError, EFail); |
|
4368 } |
|
4369 } |
|
4370 |
|
4371 void RA3FDevSoundPlayPreemptionTest::ClientInitializeCompleteCallback(TInt aError) |
|
4372 { |
|
4373 INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback ==========")); |
|
4374 if (aError != KErrNone) |
|
4375 { |
|
4376 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
4377 StopTest(aError); |
|
4378 } |
|
4379 else |
|
4380 { |
|
4381 INFO_PRINTF1(_L("Starting to play audio thru second devsound client")); |
|
4382 TInt err = iDevsoundPlayClient->PlayAudio(); |
|
4383 if (err != KErrNone) |
|
4384 { |
|
4385 ERR_PRINTF2(_L("Starting to play audio thru second devsound client failed with error = %d"), err); |
|
4386 StopTest(err); |
|
4387 } |
|
4388 } |
|
4389 } |
|
4390 |
|
4391 void RA3FDevSoundPlayPreemptionTest::ClientBufferToBeFilledCallback(TInt aError) |
|
4392 { |
|
4393 INFO_PRINTF1(_L("========== Second Client DevSound BufferToBeFilled() callback ==========")); |
|
4394 if (aError != KErrNone) |
|
4395 { |
|
4396 ERR_PRINTF2(_L("Second DevSound client called BufferToBeFilled and failed with error = %d"), aError); |
|
4397 StopTest(aError); |
|
4398 } |
|
4399 } |
|
4400 |
|
4401 void RA3FDevSoundPlayPreemptionTest::ClientPlayHandleOpenFileErrorInValidEventOrStateCallBack(TMmfDevSoundClientErrorCodes aError) |
|
4402 { |
|
4403 switch (aError) |
|
4404 { |
|
4405 case EInvalidClientFSMEvent: |
|
4406 ERR_PRINTF1(_L("Second devsound client received an invalid Event...")); |
|
4407 break; |
|
4408 case EInvalidClientFSMState: |
|
4409 ERR_PRINTF1(_L("Second devsound client received an invalid State...")); |
|
4410 break; |
|
4411 case EReadFileErrorInClient: |
|
4412 ERR_PRINTF1(_L("Second devsound client could not read to file...")); |
|
4413 break; |
|
4414 default: |
|
4415 break; |
|
4416 } |
|
4417 StopTest(aError, EFail); |
|
4418 } |
|
4419 |
|
4420 void RA3FDevSoundPlayPreemptionTest::ClientPlayErrorCallback(TInt aError, TBool aLastBuffer) |
|
4421 { |
|
4422 INFO_PRINTF1(_L("========== Second Client DevSound PlayError() callback ==========")); |
|
4423 |
|
4424 if (aError == KErrUnderflow && aLastBuffer) |
|
4425 { |
|
4426 INFO_PRINTF1(_L("Second DevSound client called PlayError and completed normally")); |
|
4427 StopTest(); |
|
4428 } |
|
4429 else |
|
4430 { |
|
4431 ERR_PRINTF2(_L("Second DevSound PlayError failed with error = %d"), aError); |
|
4432 ERR_PRINTF2(_L("Expected error = %d "), KErrUnderflow); |
|
4433 StopTest(aError, EFail); |
|
4434 } |
|
4435 } |
|
4436 |
|
4437 /* |
|
4438 *======================================================================================================== |
|
4439 * 3F-DEVSOUND-CHRTZ-PLAY-RAW-0032 |
|
4440 */ |
|
4441 RA3FDevSoundPlayPreemptedByToneTest::RA3FDevSoundPlayPreemptedByToneTest(const TDesC& aTestName) : |
|
4442 RA3FDevSoundTestBase(aTestName),iFilename(KNullDesC), |
|
4443 iFrequencyTone1(0), iDuration(0) |
|
4444 { |
|
4445 } |
|
4446 |
|
4447 RA3FDevSoundPlayPreemptedByToneTest* RA3FDevSoundPlayPreemptedByToneTest::NewL(const TDesC& aTestName) |
|
4448 { |
|
4449 RA3FDevSoundPlayPreemptedByToneTest* self = new (ELeave) RA3FDevSoundPlayPreemptedByToneTest(aTestName); |
|
4450 return self; |
|
4451 } |
|
4452 |
|
4453 void RA3FDevSoundPlayPreemptedByToneTest::DoKickoffTestL() |
|
4454 { |
|
4455 TPtrC filename; |
|
4456 // Get the filename of the audio file to play |
|
4457 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
4458 { |
|
4459 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
4460 StopTest(KErrNotFound); |
|
4461 return; |
|
4462 } |
|
4463 // open using RFile for playback |
|
4464 iFilename.Copy(filename); |
|
4465 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
4466 if (err != KErrNone) |
|
4467 { |
|
4468 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
4469 StopTest(err); |
|
4470 return; |
|
4471 } |
|
4472 |
|
4473 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
4474 |
|
4475 if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) |
|
4476 { |
|
4477 ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1); |
|
4478 StopTest(KErrNotFound); |
|
4479 return; |
|
4480 } |
|
4481 if (!GetIntFromConfig(iTestStepName, KDuration, iDuration)) |
|
4482 { |
|
4483 ERR_PRINTF2(KMsgErrorGetParameter, &KDuration); |
|
4484 StopTest(KErrNotFound); |
|
4485 return; |
|
4486 } |
|
4487 TPtrC fourccCode; |
|
4488 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
4489 { |
|
4490 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
4491 StopTest(KErrNotFound); |
|
4492 return; |
|
4493 } |
|
4494 EncodingFromStringToTFourCC(fourccCode); |
|
4495 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
4496 iDevsoundToneClient = CA3FDevSoundToneClient::NewL(*this); |
|
4497 } |
|
4498 |
|
4499 void RA3FDevSoundPlayPreemptedByToneTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
4500 { |
|
4501 switch (iDevSoundState) |
|
4502 { |
|
4503 case EStateCreated: |
|
4504 { |
|
4505 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPreemptedByToneTest"), EFsmIncorrectErrorPassed)); |
|
4506 if (aDevSoundEvent == EEventInitialize) |
|
4507 { |
|
4508 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
4509 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
4510 if (err != KErrNone) |
|
4511 { |
|
4512 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
4513 StopTest(err); |
|
4514 break; |
|
4515 } |
|
4516 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
4517 iDevSoundState = EStateInitializing; |
|
4518 } |
|
4519 else |
|
4520 { |
|
4521 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
4522 StopTest(aError, EFail); |
|
4523 } |
|
4524 break; |
|
4525 } |
|
4526 case EStateInitializing: |
|
4527 { |
|
4528 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
4529 { |
|
4530 TMMFPrioritySettings priority; |
|
4531 priority.iPriority = KMinimumPriority; |
|
4532 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
4533 iMMFDevSound->SetPrioritySettings (priority); |
|
4534 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
4535 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
4536 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
4537 if (err != KErrNone) |
|
4538 { |
|
4539 StopTest (err); |
|
4540 break; |
|
4541 } |
|
4542 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
4543 iDevSoundState = EStatePlaying; |
|
4544 StartTimer (KMicroSecsTwoSec); |
|
4545 } |
|
4546 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
4547 { |
|
4548 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
4549 StopTest(aError); |
|
4550 } |
|
4551 else |
|
4552 { |
|
4553 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
4554 StopTest(aError, EFail); |
|
4555 } |
|
4556 break; |
|
4557 } |
|
4558 case EStatePlaying: |
|
4559 { |
|
4560 if (aDevSoundEvent == EEventBTBF) |
|
4561 { |
|
4562 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
4563 TInt err = iFile.Read (buffer->Data()); |
|
4564 if (err != KErrNone) |
|
4565 { |
|
4566 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
4567 StopTest(err); |
|
4568 break; |
|
4569 } |
|
4570 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
4571 { |
|
4572 iBuffer->SetLastBuffer(ETrue); |
|
4573 } |
|
4574 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
4575 iMMFDevSound->PlayData(); |
|
4576 } |
|
4577 else |
|
4578 { |
|
4579 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
4580 StopTest(aError, EFail); |
|
4581 } |
|
4582 break; |
|
4583 } |
|
4584 default: |
|
4585 { |
|
4586 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
4587 StopTest(aError, EFail); |
|
4588 } |
|
4589 } |
|
4590 } |
|
4591 |
|
4592 void RA3FDevSoundPlayPreemptedByToneTest::DoTimerCallback() |
|
4593 { |
|
4594 INFO_PRINTF1(_L("TimerEvent called")); |
|
4595 iTimer->Cancel(); |
|
4596 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
4597 iDevsoundToneClient->SetPriority(KMaximumPriority); |
|
4598 INFO_PRINTF1(_L("Initializing to play tones thru second devsound client")); |
|
4599 TInt err = iDevsoundToneClient->InitTonePlay(iFrequencyTone1,iDuration*KMicroSecsInOneSec); |
|
4600 if (err != KErrNone) |
|
4601 { |
|
4602 ERR_PRINTF2(_L("Initializating DevSoud to play tones thru second devsound client failed with error = %d"), err); |
|
4603 StopTest(err); |
|
4604 } |
|
4605 } |
|
4606 |
|
4607 void RA3FDevSoundPlayPreemptedByToneTest::PlayError(TInt aError) |
|
4608 { |
|
4609 INFO_PRINTF1(_L("========== DevSound PlayError() callback ==========")); |
|
4610 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied) |
|
4611 { |
|
4612 INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance==========")); |
|
4613 INFO_PRINTF2(_L("First DevSound client PlayError succeeded with error = %d "), aError); |
|
4614 } |
|
4615 else |
|
4616 { |
|
4617 ERR_PRINTF2(_L("First DevSound client called PlayError and failed with error = %d "), aError); |
|
4618 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
4619 StopTest(aError, EFail); |
|
4620 } |
|
4621 } |
|
4622 |
|
4623 void RA3FDevSoundPlayPreemptedByToneTest::ClientInitializeCompleteCallback(TInt aError) |
|
4624 { |
|
4625 INFO_PRINTF1(_L("==========Second DevSound client called InitializeComplete()==========")); |
|
4626 if (aError == KErrNone) |
|
4627 { |
|
4628 INFO_PRINTF1(_L("Starting to play tone thru second devsound client")); |
|
4629 TInt err = iDevsoundToneClient->PlayTone (); |
|
4630 if (err != KErrNone) |
|
4631 { |
|
4632 ERR_PRINTF2(_L("Second Devsound client called PlayTone and failed with error = %d"), err); |
|
4633 StopTest(err); |
|
4634 } |
|
4635 } |
|
4636 else |
|
4637 { |
|
4638 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
4639 StopTest(aError); |
|
4640 } |
|
4641 } |
|
4642 |
|
4643 void RA3FDevSoundPlayPreemptedByToneTest::ClientToneFinishedCallback(TInt aError) |
|
4644 { |
|
4645 INFO_PRINTF1(_L("========== Second DevSound client called ToneFinished()==========")); |
|
4646 if (aError == KErrUnderflow) |
|
4647 { |
|
4648 INFO_PRINTF2(_L("Second DevSound client called ToneFinished and succeeded with error = %d"), aError); |
|
4649 StopTest(aError, EPass); |
|
4650 } |
|
4651 else |
|
4652 { |
|
4653 ERR_PRINTF2(_L("Second DevSound client called ToneFinished and failed with error = %d"), aError); |
|
4654 StopTest(aError); |
|
4655 } |
|
4656 } |
|
4657 |
|
4658 /* |
|
4659 *======================================================================================================== |
|
4660 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0033 |
|
4661 */ |
|
4662 RA3FDevSoundPlayPreemptedByRecordTest::RA3FDevSoundPlayPreemptedByRecordTest(const TDesC& aTestName) : |
|
4663 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC) |
|
4664 |
|
4665 { |
|
4666 } |
|
4667 |
|
4668 RA3FDevSoundPlayPreemptedByRecordTest* RA3FDevSoundPlayPreemptedByRecordTest::NewL(const TDesC& aTestName) |
|
4669 { |
|
4670 RA3FDevSoundPlayPreemptedByRecordTest* self = new (ELeave) RA3FDevSoundPlayPreemptedByRecordTest(aTestName); |
|
4671 return self; |
|
4672 } |
|
4673 |
|
4674 void RA3FDevSoundPlayPreemptedByRecordTest::DoKickoffTestL() |
|
4675 { |
|
4676 TPtrC filename; |
|
4677 // Get the filename of the audio file to play |
|
4678 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
4679 { |
|
4680 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
4681 StopTest(KErrNotFound); |
|
4682 return; |
|
4683 } |
|
4684 // open using RFile for playback |
|
4685 iFilename.Copy(filename); |
|
4686 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
4687 if (err != KErrNone) |
|
4688 { |
|
4689 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
4690 StopTest(err); |
|
4691 return; |
|
4692 } |
|
4693 // Get the filename of the audio file to record |
|
4694 if (!GetStringFromConfig(iTestStepName, KOtherFilename, filename)) |
|
4695 { |
|
4696 ERR_PRINTF2(KMsgErrorGetParameter, &KOtherFilename); |
|
4697 StopTest(KErrNotFound); |
|
4698 return; |
|
4699 } |
|
4700 |
|
4701 iOtherFilename.Copy(filename); |
|
4702 |
|
4703 TPtrC fourccCode; |
|
4704 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
4705 { |
|
4706 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
4707 StopTest (KErrNotFound); |
|
4708 return; |
|
4709 } |
|
4710 EncodingFromStringToTFourCC(fourccCode); |
|
4711 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
4712 iDevsoundRecordClient = CA3FDevSoundRecordClient::NewL(*this, iFourCCCode, iFs, iSuite); |
|
4713 } |
|
4714 |
|
4715 void RA3FDevSoundPlayPreemptedByRecordTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
4716 { |
|
4717 switch (iDevSoundState) |
|
4718 { |
|
4719 case EStateCreated: |
|
4720 { |
|
4721 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPreemptedByRecordTest"), EFsmIncorrectErrorPassed)); |
|
4722 if (aDevSoundEvent == EEventInitialize) |
|
4723 { |
|
4724 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
4725 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
4726 if (err != KErrNone) |
|
4727 { |
|
4728 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
4729 StopTest(err); |
|
4730 break; |
|
4731 } |
|
4732 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
4733 iDevSoundState = EStateInitializing; |
|
4734 } |
|
4735 else |
|
4736 { |
|
4737 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
4738 StopTest(aError, EFail); |
|
4739 } |
|
4740 break; |
|
4741 } |
|
4742 case EStateInitializing: |
|
4743 { |
|
4744 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
4745 { |
|
4746 TMMFPrioritySettings priority; |
|
4747 priority.iPriority = KMinimumPriority; |
|
4748 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
4749 iMMFDevSound->SetPrioritySettings (priority); |
|
4750 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
4751 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
4752 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
4753 if (err != KErrNone) |
|
4754 { |
|
4755 StopTest(err); |
|
4756 break; |
|
4757 } |
|
4758 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
4759 iDevSoundState = EStatePlaying; |
|
4760 StartTimer(KMicroSecsTwoSec); |
|
4761 } |
|
4762 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
4763 { |
|
4764 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
4765 StopTest(aError); |
|
4766 } |
|
4767 else |
|
4768 { |
|
4769 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
4770 StopTest(aError, EFail); |
|
4771 } |
|
4772 break; |
|
4773 } |
|
4774 case EStatePlaying: |
|
4775 { |
|
4776 if (aDevSoundEvent == EEventBTBF) |
|
4777 { |
|
4778 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
4779 TInt err = iFile.Read (buffer->Data ()); |
|
4780 if (err != KErrNone) |
|
4781 { |
|
4782 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
4783 StopTest(err); |
|
4784 break; |
|
4785 } |
|
4786 if (buffer->Data().Length()!= buffer->RequestSize()) |
|
4787 { |
|
4788 iBuffer->SetLastBuffer(ETrue); |
|
4789 } |
|
4790 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
4791 iMMFDevSound->PlayData(); |
|
4792 } |
|
4793 else |
|
4794 { |
|
4795 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
4796 StopTest(aError, EFail); |
|
4797 } |
|
4798 break; |
|
4799 } |
|
4800 default: |
|
4801 { |
|
4802 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
4803 StopTest(aError, EFail); |
|
4804 } |
|
4805 } |
|
4806 } |
|
4807 |
|
4808 void RA3FDevSoundPlayPreemptedByRecordTest::DoTimerCallback() |
|
4809 { |
|
4810 INFO_PRINTF1(_L("TimerEvent called")); |
|
4811 if (!iOtherClientStarted) |
|
4812 { |
|
4813 INFO_PRINTF1(_L("Initializing higher priority devsound client...")); |
|
4814 iDevsoundRecordClient->SetPriority (KMaximumPriority); |
|
4815 TInt err = iDevsoundRecordClient->InitializeRecordClient (iOtherFilename); |
|
4816 if (err != KErrNone) |
|
4817 { |
|
4818 ERR_PRINTF1(_L("Initializating DevSoud to record audio thru second devsound client failed with error = %d")); |
|
4819 StopTest(err); |
|
4820 } |
|
4821 iOtherClientStarted = ETrue; |
|
4822 } |
|
4823 else |
|
4824 { |
|
4825 iTimer->Cancel(); |
|
4826 iDevsoundRecordClient->StopRecord(); |
|
4827 StopTest(); |
|
4828 } |
|
4829 } |
|
4830 |
|
4831 void RA3FDevSoundPlayPreemptedByRecordTest::PlayError(TInt aError) |
|
4832 { |
|
4833 INFO_PRINTF1(_L("========== DevSound PlayError() callback ==========")); |
|
4834 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied) |
|
4835 { |
|
4836 INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance==========")); |
|
4837 INFO_PRINTF2(_L("First DevSound client PlayError succeeded with error = %d "), aError); |
|
4838 } |
|
4839 else |
|
4840 { |
|
4841 ERR_PRINTF2(_L("First DevSound client called PlayError and failed with error = %d "), aError); |
|
4842 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
4843 StopTest(aError, EFail); |
|
4844 } |
|
4845 } |
|
4846 |
|
4847 void RA3FDevSoundPlayPreemptedByRecordTest::ClientInitializeCompleteCallback(TInt aError) |
|
4848 { |
|
4849 INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback ==========")); |
|
4850 if (aError != KErrNone) |
|
4851 { |
|
4852 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
4853 StopTest(aError); |
|
4854 } |
|
4855 else |
|
4856 { |
|
4857 INFO_PRINTF2(_L("Second DevSound client called InitializeComplete with error = %d"), aError); |
|
4858 INFO_PRINTF1(_L("Starting to record audio thru second devsound client")); |
|
4859 TInt err = iDevsoundRecordClient->RecordAudio (); |
|
4860 if (err != KErrNone) |
|
4861 { |
|
4862 ERR_PRINTF2(_L("Starting to record audio thru second devsound client failed with error = %d"), err); |
|
4863 StopTest(err); |
|
4864 } |
|
4865 } |
|
4866 } |
|
4867 |
|
4868 void RA3FDevSoundPlayPreemptedByRecordTest::ClientBufferToBeEmptiedCallback(TInt aError) |
|
4869 { |
|
4870 INFO_PRINTF1(_L("========== Second Client DevSound ClientBufferToBeEmptied() callback ==========")); |
|
4871 switch (aError) |
|
4872 { |
|
4873 case KErrGeneral: |
|
4874 { |
|
4875 INFO_PRINTF1(_L("Second DevSound client called BufferToBeEmptied and received a NULL CMMFBuffer")); |
|
4876 StopTest(aError); |
|
4877 break; |
|
4878 } |
|
4879 case KErrUnknown: |
|
4880 { |
|
4881 INFO_PRINTF1(_L("Second DevSound client called BufferToBeEmptied: Unknown behaviour: Last buffer flag set before calling CMMFDevSound->Pause()")); |
|
4882 StopTest(aError); |
|
4883 break; |
|
4884 } |
|
4885 } |
|
4886 } |
|
4887 |
|
4888 void RA3FDevSoundPlayPreemptedByRecordTest::ClientRecordErrorCallback(TInt aError) |
|
4889 { |
|
4890 INFO_PRINTF1(_L("========== Second Client DevSound RecordError() callback ==========")); |
|
4891 if (aError == KErrUnderflow) |
|
4892 { |
|
4893 INFO_PRINTF2(_L("Second DevSound client called RecordError with error = %d"), aError); |
|
4894 StopTest(aError); |
|
4895 } |
|
4896 } |
|
4897 |
|
4898 void RA3FDevSoundPlayPreemptedByRecordTest::ClientRecordHandleOpenFileErrorInValidEventOrStateCallBack(TMmfDevSoundClientErrorCodes aError) |
|
4899 { |
|
4900 switch (aError) |
|
4901 { |
|
4902 case EInvalidClientFSMEvent: |
|
4903 { |
|
4904 ERR_PRINTF1(_L("Second devsound client received an invalid Event...")); |
|
4905 StopTest(KErrNone, EFail); |
|
4906 break; |
|
4907 } |
|
4908 case EInvalidClientFSMState: |
|
4909 { |
|
4910 ERR_PRINTF1(_L("Second devsound client received an invalid State...")); |
|
4911 StopTest(KErrNone, EFail); |
|
4912 break; |
|
4913 } |
|
4914 case EWriteFileErrorInClient: |
|
4915 { |
|
4916 ERR_PRINTF1(_L("Second devsound client could not write to file...")); |
|
4917 StopTest(KErrNone, EFail); |
|
4918 break; |
|
4919 } |
|
4920 } |
|
4921 } |
|
4922 |
|
4923 /* |
|
4924 *======================================================================================================== |
|
4925 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0034 |
|
4926 */ |
|
4927 RA3FDevSoundPlayRejectionTest::RA3FDevSoundPlayRejectionTest(const TDesC& aTestName) : |
|
4928 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
4929 iOtherFilename(KNullDesC) |
|
4930 { |
|
4931 } |
|
4932 |
|
4933 RA3FDevSoundPlayRejectionTest* RA3FDevSoundPlayRejectionTest::NewL(const TDesC& aTestName) |
|
4934 { |
|
4935 RA3FDevSoundPlayRejectionTest* self = new (ELeave) RA3FDevSoundPlayRejectionTest(aTestName); |
|
4936 return self; |
|
4937 } |
|
4938 |
|
4939 void RA3FDevSoundPlayRejectionTest::DoKickoffTestL() |
|
4940 { |
|
4941 TPtrC filename; |
|
4942 // Get the filename of the audio file to play |
|
4943 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
4944 { |
|
4945 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
4946 StopTest(KErrNotFound); |
|
4947 return; |
|
4948 } |
|
4949 // open using RFile for playback |
|
4950 iFilename.Copy(filename); |
|
4951 |
|
4952 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
4953 if (err != KErrNone) |
|
4954 { |
|
4955 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
4956 StopTest(err); |
|
4957 return; |
|
4958 } |
|
4959 |
|
4960 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
4961 |
|
4962 // Get the filename of the second devsound instance |
|
4963 TPtrC tempString; |
|
4964 if (!GetStringFromConfig(iTestStepName, KOtherFilename, tempString)) |
|
4965 { |
|
4966 ERR_PRINTF2(KMsgErrorGetParameter, &KOtherFilename); |
|
4967 StopTest(KErrNotFound); |
|
4968 return; |
|
4969 } |
|
4970 |
|
4971 iOtherFilename.Copy (tempString); |
|
4972 |
|
4973 TPtrC fourccCode; |
|
4974 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
4975 { |
|
4976 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
4977 StopTest(KErrNotFound); |
|
4978 return; |
|
4979 } |
|
4980 EncodingFromStringToTFourCC(fourccCode); |
|
4981 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
4982 iDevsoundPlayClient = CA3FDevSoundPlayClient::NewL(*this, iFourCCCode, iFs, iSuite); |
|
4983 } |
|
4984 |
|
4985 void RA3FDevSoundPlayRejectionTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
4986 { |
|
4987 switch (iDevSoundState) |
|
4988 { |
|
4989 case EStateCreated: |
|
4990 { |
|
4991 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayRejectionTest"), EFsmIncorrectErrorPassed)); |
|
4992 if (aDevSoundEvent == EEventInitialize) |
|
4993 { |
|
4994 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
4995 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
4996 if (err != KErrNone) |
|
4997 { |
|
4998 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
4999 StopTest(err); |
|
5000 break; |
|
5001 } |
|
5002 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
5003 iDevSoundState = EStateInitializing; |
|
5004 } |
|
5005 else |
|
5006 { |
|
5007 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
5008 StopTest(aError, EFail); |
|
5009 } |
|
5010 break; |
|
5011 } |
|
5012 case EStateInitializing: |
|
5013 { |
|
5014 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
5015 { |
|
5016 TMMFPrioritySettings priority; |
|
5017 priority.iPriority = KMaximumPriority; |
|
5018 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
5019 iMMFDevSound->SetPrioritySettings (priority); |
|
5020 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); |
|
5021 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
5022 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
5023 if ( err != KErrNone) |
|
5024 { |
|
5025 INFO_PRINTF2(_L("CMMFDevSound::PlayInitL left with error = %d"), err); |
|
5026 StopTest(err); |
|
5027 break; |
|
5028 } |
|
5029 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
5030 iDevSoundState = EStatePlaying; |
|
5031 StartTimer (KMicroSecsTwoSec); |
|
5032 } |
|
5033 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
5034 { |
|
5035 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
5036 StopTest(aError); |
|
5037 } |
|
5038 else |
|
5039 { |
|
5040 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
5041 StopTest(aError, EFail); |
|
5042 } |
|
5043 break; |
|
5044 } |
|
5045 case EStatePlaying: |
|
5046 { |
|
5047 if (aDevSoundEvent == EEventBTBF) |
|
5048 { |
|
5049 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
5050 TInt err = iFile.Read (buffer->Data ()); |
|
5051 if (err != KErrNone) |
|
5052 { |
|
5053 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
5054 StopTest(err); |
|
5055 break; |
|
5056 } |
|
5057 if (buffer->Data().Length()!= buffer->RequestSize()) |
|
5058 { |
|
5059 iBuffer->SetLastBuffer (ETrue); |
|
5060 } |
|
5061 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
5062 iMMFDevSound->PlayData(); |
|
5063 } |
|
5064 else |
|
5065 { |
|
5066 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
5067 StopTest(aError, EFail); |
|
5068 } |
|
5069 break; |
|
5070 } |
|
5071 default: |
|
5072 { |
|
5073 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
5074 StopTest(aError, EFail); |
|
5075 } |
|
5076 } |
|
5077 } |
|
5078 |
|
5079 void RA3FDevSoundPlayRejectionTest::DoTimerCallback() |
|
5080 { |
|
5081 INFO_PRINTF1(_L("TimerEvent called")); |
|
5082 iTimer->Cancel(); |
|
5083 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
5084 iDevsoundPlayClient->SetPriority(KMinimumPriority); |
|
5085 INFO_PRINTF1(_L("Initializing to play audio thru second devsound client")); |
|
5086 TInt err = iDevsoundPlayClient->PlayInit(iOtherFilename); |
|
5087 if (err != KErrNone) |
|
5088 { |
|
5089 ERR_PRINTF2(_L("Initialization to play audio thru second devsound client failed with %d"), err); |
|
5090 StopTest(err); |
|
5091 } |
|
5092 } |
|
5093 |
|
5094 void RA3FDevSoundPlayRejectionTest::ClientInitializeCompleteCallback(TInt aError) |
|
5095 { |
|
5096 INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback ==========")); |
|
5097 if (aError != KErrNone) |
|
5098 { |
|
5099 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
5100 StopTest(aError); |
|
5101 } |
|
5102 else |
|
5103 { |
|
5104 INFO_PRINTF2(_L("Second DevSound client called InitializeComplete with error = %d"), aError); |
|
5105 INFO_PRINTF1(_L("Starting to play audio thru second devsound client")); |
|
5106 TInt err = iDevsoundPlayClient->PlayAudio (); |
|
5107 if (err != KErrNone) |
|
5108 { |
|
5109 ERR_PRINTF2(_L("Starting to play audio thru second devsound client failed with error = %d"), err); |
|
5110 StopTest(err); |
|
5111 } |
|
5112 } |
|
5113 } |
|
5114 |
|
5115 void RA3FDevSoundPlayRejectionTest::ClientPlayHandleOpenFileErrorInValidEventOrStateCallBack(TMmfDevSoundClientErrorCodes aError) |
|
5116 { |
|
5117 switch (aError) |
|
5118 { |
|
5119 case EInvalidClientFSMEvent: |
|
5120 ERR_PRINTF1(_L("Second devsound client received an invalid Event...")); |
|
5121 break; |
|
5122 case EInvalidClientFSMState: |
|
5123 ERR_PRINTF1(_L("Second devsound client received an invalid State...")); |
|
5124 break; |
|
5125 case EReadFileErrorInClient: |
|
5126 ERR_PRINTF1(_L("Second devsound client could not read to file...")); |
|
5127 break; |
|
5128 default: |
|
5129 break; |
|
5130 } |
|
5131 StopTest(aError, EFail); |
|
5132 } |
|
5133 |
|
5134 void RA3FDevSoundPlayRejectionTest::ClientBufferToBeFilledCallback(TInt aError) |
|
5135 { |
|
5136 INFO_PRINTF2(_L("Second DevSound client should not call BufferToBeFilled in rejection. Error = %d"), aError); |
|
5137 StopTest(aError, EFail); |
|
5138 } |
|
5139 |
|
5140 void RA3FDevSoundPlayRejectionTest::ClientPlayErrorCallback(TInt aError, TBool aLastBuffer) |
|
5141 { |
|
5142 INFO_PRINTF1(_L("========== Second Client DevSound PlayError() callback ==========")); |
|
5143 |
|
5144 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied && !aLastBuffer) |
|
5145 { |
|
5146 INFO_PRINTF1(_L("========== Rejecting 2nd DevSound Instance==========")); |
|
5147 INFO_PRINTF2(_L("Second DevSound client PlayError succeeded with error = %d"), aError); |
|
5148 } |
|
5149 else |
|
5150 { |
|
5151 ERR_PRINTF2(_L("Second DevSound PlayError failed with error = %d"), aError); |
|
5152 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
5153 StopTest(aError, EFail); |
|
5154 } |
|
5155 } |
|
5156 |
|
5157 /* |
|
5158 *======================================================================================================== |
|
5159 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0035 |
|
5160 */ |
|
5161 RA3FDevSoundPlayRejectedByToneTest::RA3FDevSoundPlayRejectedByToneTest(const TDesC& aTestName) : |
|
5162 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC) |
|
5163 { |
|
5164 } |
|
5165 |
|
5166 RA3FDevSoundPlayRejectedByToneTest* RA3FDevSoundPlayRejectedByToneTest::NewL(const TDesC& aTestName) |
|
5167 { |
|
5168 RA3FDevSoundPlayRejectedByToneTest* self = new (ELeave) RA3FDevSoundPlayRejectedByToneTest(aTestName); |
|
5169 return self; |
|
5170 } |
|
5171 |
|
5172 void RA3FDevSoundPlayRejectedByToneTest::DoKickoffTestL() |
|
5173 { |
|
5174 TPtrC filename; |
|
5175 // Get the filename of the audio file to play |
|
5176 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
5177 { |
|
5178 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
5179 StopTest(KErrNotFound); |
|
5180 return; |
|
5181 } |
|
5182 // open using RFile for playback |
|
5183 iFilename.Copy (filename); |
|
5184 |
|
5185 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
5186 if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) |
|
5187 { |
|
5188 ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1); |
|
5189 StopTest(KErrNotFound); |
|
5190 return; |
|
5191 } |
|
5192 if (!GetIntFromConfig(iTestStepName, KDuration, iDuration)) |
|
5193 { |
|
5194 ERR_PRINTF2(KMsgErrorGetParameter, &KDuration); |
|
5195 StopTest(KErrNotFound); |
|
5196 return; |
|
5197 } |
|
5198 TPtrC fourccCode; |
|
5199 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
5200 { |
|
5201 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
5202 StopTest(KErrNotFound); |
|
5203 return; |
|
5204 } |
|
5205 EncodingFromStringToTFourCC(fourccCode); |
|
5206 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
5207 iDevsoundPlayClient = CA3FDevSoundPlayClient::NewL(*this, iFourCCCode, iFs, iSuite); |
|
5208 } |
|
5209 |
|
5210 void RA3FDevSoundPlayRejectedByToneTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
5211 { |
|
5212 switch (iDevSoundState) |
|
5213 { |
|
5214 case EStateCreated: |
|
5215 { |
|
5216 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayRejectedByToneTest"), EFsmIncorrectErrorPassed)); |
|
5217 if (aDevSoundEvent == EEventInitialize) |
|
5218 { |
|
5219 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
5220 TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); |
|
5221 if (err != KErrNone) |
|
5222 { |
|
5223 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
5224 StopTest(err); |
|
5225 break; |
|
5226 } |
|
5227 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
5228 iDevSoundState = EStateInitializing; |
|
5229 } |
|
5230 else |
|
5231 { |
|
5232 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
5233 StopTest(aError, EFail); |
|
5234 } |
|
5235 break; |
|
5236 } |
|
5237 case EStateInitializing: |
|
5238 { |
|
5239 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
5240 { |
|
5241 TMMFPrioritySettings priority; |
|
5242 priority.iPriority = KMinimumPriority; |
|
5243 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
5244 iMMFDevSound->SetPrioritySettings (priority); |
|
5245 iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); |
|
5246 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayToneL")); |
|
5247 TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration*KMicroSecsInOneSec)); |
|
5248 if (err != KErrNone) |
|
5249 { |
|
5250 ERR_PRINTF2(_L("CMMFDevSound::PlayToneL left with error =%d"), err); |
|
5251 StopTest(err); |
|
5252 break; |
|
5253 } |
|
5254 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
5255 iDevSoundState = EStatePlaying; |
|
5256 StartTimer(KMicroSecsTwoSec); |
|
5257 } |
|
5258 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
5259 { |
|
5260 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
5261 StopTest(aError); |
|
5262 } |
|
5263 else |
|
5264 { |
|
5265 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
5266 StopTest(aError, EFail); |
|
5267 } |
|
5268 break; |
|
5269 } |
|
5270 default: |
|
5271 { |
|
5272 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
5273 StopTest(aError, EFail); |
|
5274 } |
|
5275 } |
|
5276 } |
|
5277 |
|
5278 void RA3FDevSoundPlayRejectedByToneTest::DoTimerCallback() |
|
5279 { |
|
5280 INFO_PRINTF1(_L("TimerEvent called")); |
|
5281 iTimer->Cancel(); |
|
5282 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
5283 iDevsoundPlayClient->SetPriority(KMinimumPriority); |
|
5284 INFO_PRINTF1(_L("Initializing to play audio thru second devsound client")); |
|
5285 TInt err = iDevsoundPlayClient->PlayInit(iFilename); |
|
5286 if (err != KErrNone) |
|
5287 { |
|
5288 ERR_PRINTF2(_L("Initialization to play audio thru second devsound client failed with %d"), err); |
|
5289 StopTest(err); |
|
5290 } |
|
5291 } |
|
5292 |
|
5293 void RA3FDevSoundPlayRejectedByToneTest::ClientInitializeCompleteCallback(TInt aError) |
|
5294 { |
|
5295 INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback ==========")); |
|
5296 if (aError != KErrNone) |
|
5297 { |
|
5298 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
5299 StopTest (aError); |
|
5300 } |
|
5301 else |
|
5302 { |
|
5303 INFO_PRINTF2(_L("Second DevSound client called InitializeComplete with error = %d"), aError); |
|
5304 INFO_PRINTF1(_L("Starting to play audio thru second devsound client")); |
|
5305 TInt err = iDevsoundPlayClient->PlayAudio (); |
|
5306 if (err != KErrNone) |
|
5307 { |
|
5308 ERR_PRINTF2(_L("Starting to play audio thru second devsound client failed with error = %d"), err); |
|
5309 StopTest(err); |
|
5310 } |
|
5311 } |
|
5312 } |
|
5313 |
|
5314 void RA3FDevSoundPlayRejectedByToneTest::ClientPlayHandleOpenFileErrorInValidEventOrStateCallBack(TMmfDevSoundClientErrorCodes aError) |
|
5315 { |
|
5316 switch (aError) |
|
5317 { |
|
5318 case EInvalidClientFSMEvent: |
|
5319 ERR_PRINTF1(_L("Second devsound client received an invalid Event...")); |
|
5320 break; |
|
5321 case EInvalidClientFSMState: |
|
5322 ERR_PRINTF1(_L("Second devsound client received an invalid State...")); |
|
5323 break; |
|
5324 case EReadFileErrorInClient: |
|
5325 ERR_PRINTF1(_L("Second devsound client could not read to file...")); |
|
5326 break; |
|
5327 default: |
|
5328 break; |
|
5329 } |
|
5330 StopTest(aError, EFail); |
|
5331 } |
|
5332 |
|
5333 void RA3FDevSoundPlayRejectedByToneTest::ClientBufferToBeFilledCallback(TInt aError) |
|
5334 { |
|
5335 INFO_PRINTF2(_L("Second DevSound client should not call BufferToBeFilled in rejection. Error = %d"), aError); |
|
5336 StopTest(aError, EFail); |
|
5337 } |
|
5338 |
|
5339 void RA3FDevSoundPlayRejectedByToneTest::ClientPlayErrorCallback(TInt aError,TBool aLastBuffer) |
|
5340 { |
|
5341 INFO_PRINTF1(_L("========== Second Client DevSound PlayError() callback ==========")); |
|
5342 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied && !aLastBuffer) |
|
5343 { |
|
5344 INFO_PRINTF1(_L("========== Rejecting 2nd DevSound Instance==========")); |
|
5345 INFO_PRINTF2(_L("Second DevSound client PlayError succeeded with error = %d"), aError); |
|
5346 } |
|
5347 else |
|
5348 { |
|
5349 ERR_PRINTF2(_L("Second DevSound PlayError failed with error = %d"), aError); |
|
5350 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
5351 StopTest(aError, EFail); |
|
5352 } |
|
5353 } |
|
5354 |
|
5355 /* |
|
5356 *======================================================================================================== |
|
5357 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0036 |
|
5358 */ |
|
5359 RA3FDevSoundPlayRejectedByRecordTest::RA3FDevSoundPlayRejectedByRecordTest(const TDesC& aTestName) : |
|
5360 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
5361 iOtherFilename(KNullDesC), iOtherClientStarted(EFalse) |
|
5362 { |
|
5363 } |
|
5364 |
|
5365 RA3FDevSoundPlayRejectedByRecordTest* RA3FDevSoundPlayRejectedByRecordTest::NewL(const TDesC& aTestName) |
|
5366 { |
|
5367 RA3FDevSoundPlayRejectedByRecordTest* self = new (ELeave) RA3FDevSoundPlayRejectedByRecordTest(aTestName); |
|
5368 return self; |
|
5369 } |
|
5370 |
|
5371 void RA3FDevSoundPlayRejectedByRecordTest::DoKickoffTestL() |
|
5372 { |
|
5373 TPtrC filename; |
|
5374 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
5375 { |
|
5376 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
5377 StopTest(KErrNotFound); |
|
5378 return; |
|
5379 } |
|
5380 // Open file for recording using RFile |
|
5381 |
|
5382 iFilename.Copy (filename); |
|
5383 |
|
5384 // Get the filename of the second audio file to play |
|
5385 if (!GetStringFromConfig(iTestStepName, KOtherFilename, filename)) |
|
5386 { |
|
5387 ERR_PRINTF2(KMsgErrorGetParameter, &KOtherFilename); |
|
5388 StopTest(KErrNotFound); |
|
5389 return; |
|
5390 } |
|
5391 INFO_PRINTF2(_L("Opening file for recording %S"), &iFilename); |
|
5392 TInt err = iFile.Replace (iFs, iFilename, EFileWrite); |
|
5393 if (err != KErrNone) |
|
5394 { |
|
5395 ERR_PRINTF2(_L("Could not create output file. Error = %d"), err); |
|
5396 iFs.Close(); |
|
5397 StopTest(err); |
|
5398 return; |
|
5399 } |
|
5400 |
|
5401 iOtherFilename.Copy (filename); |
|
5402 |
|
5403 TPtrC fourccCode; |
|
5404 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
5405 { |
|
5406 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
5407 StopTest (KErrNotFound); |
|
5408 return; |
|
5409 } |
|
5410 EncodingFromStringToTFourCC(fourccCode); |
|
5411 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
5412 iDevsoundPlayClient = CA3FDevSoundPlayClient::NewL(*this, iFourCCCode, iFs, iSuite); |
|
5413 iAsyncWriteBTFAO = CAsyncWriteBufferToFile::NewL(iFile, iMMFDevSound, *this); |
|
5414 } |
|
5415 |
|
5416 void RA3FDevSoundPlayRejectedByRecordTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
5417 { |
|
5418 switch (iDevSoundState) |
|
5419 { |
|
5420 case EStateCreated: |
|
5421 { |
|
5422 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayRejectedByRecordTest"), EFsmIncorrectErrorPassed)); |
|
5423 if (aDevSoundEvent == EEventInitialize) |
|
5424 { |
|
5425 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
5426 INFO_PRINTF1(_L("iMMFDevSound->InitializeL()")); |
|
5427 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); |
|
5428 if (err != KErrNone) |
|
5429 { |
|
5430 ERR_PRINTF2(_L("Initialization of DevSound failed with error : %d!"), err); |
|
5431 StopTest(err); |
|
5432 break; |
|
5433 } |
|
5434 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
5435 iDevSoundState = EStateInitializing; |
|
5436 } |
|
5437 else |
|
5438 { |
|
5439 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
5440 StopTest(aError, EFail); |
|
5441 } |
|
5442 break; |
|
5443 } |
|
5444 case EStateInitializing: |
|
5445 { |
|
5446 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
5447 { |
|
5448 INFO_PRINTF1(_L("CMMFDevSound::RecordInitL")); |
|
5449 TRAPD(err, iMMFDevSound->RecordInitL()); |
|
5450 if (err != KErrNone) |
|
5451 { |
|
5452 ERR_PRINTF2(_L("DevSound RecordInitL left with error = %d"), err); |
|
5453 StopTest(err); |
|
5454 break; |
|
5455 } |
|
5456 StartTimer(KMicroSecsTwoSec); |
|
5457 INFO_PRINTF1(_L("DevSound State: EStateRecording")); |
|
5458 iDevSoundState = EStateRecording; |
|
5459 } |
|
5460 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
5461 { |
|
5462 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
5463 StopTest(aError); |
|
5464 } |
|
5465 else |
|
5466 { |
|
5467 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
5468 StopTest(aError, EFail); |
|
5469 } |
|
5470 break; |
|
5471 } |
|
5472 case EStateRecording: |
|
5473 { |
|
5474 if (aDevSoundEvent == EEventBTBE) |
|
5475 { |
|
5476 // Write buffer to file |
|
5477 INFO_PRINTF1(_L("Writing data to file")); |
|
5478 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
5479 iAsyncWriteBTFAO->Start(buffer); |
|
5480 } |
|
5481 else if (aDevSoundEvent == EEventTimerComplete) |
|
5482 { |
|
5483 iMMFDevSound->Pause(); |
|
5484 INFO_PRINTF1(_L("DevSound State: EStatePause")); |
|
5485 iDevSoundState = EStatePause; |
|
5486 INFO_PRINTF1(_L("Recording is Paused, waiting for the last buffer callback")); |
|
5487 } |
|
5488 else |
|
5489 { |
|
5490 ERR_PRINTF2(_L("DevSound EEventBTBE not received as expected. Received event: %d"), aDevSoundEvent); |
|
5491 StopTest(aError, EFail); |
|
5492 } |
|
5493 break; |
|
5494 } |
|
5495 case EStatePause: |
|
5496 { |
|
5497 if (aDevSoundEvent == EEventBTBE) |
|
5498 { |
|
5499 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
5500 // Continue recording data |
|
5501 iAsyncWriteBTFAO->Start (buffer); |
|
5502 } |
|
5503 else |
|
5504 { |
|
5505 ERR_PRINTF2(_L("DevSound EEventBTBE not received as expected. Received event: %d"), aDevSoundEvent); |
|
5506 StopTest(aError, EFail); |
|
5507 } |
|
5508 break; |
|
5509 } |
|
5510 default: |
|
5511 { |
|
5512 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
5513 StopTest(aError, EFail); |
|
5514 } |
|
5515 } |
|
5516 } |
|
5517 |
|
5518 void RA3FDevSoundPlayRejectedByRecordTest::DoTimerCallback() |
|
5519 { |
|
5520 INFO_PRINTF1(_L("TimerEvent called")); |
|
5521 if (!iOtherClientStarted) |
|
5522 { |
|
5523 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
5524 iDevsoundPlayClient->SetPriority(KMinimumPriority); |
|
5525 INFO_PRINTF1(_L("Initializing to play audio thru second devsound client")); |
|
5526 TInt err = iDevsoundPlayClient->PlayInit(iFilename); |
|
5527 if (err != KErrNone) |
|
5528 { |
|
5529 ERR_PRINTF2(_L("Initialization to play audio thru second devsound client failed with %d"), err); |
|
5530 StopTest(err); |
|
5531 } |
|
5532 iOtherClientStarted = ETrue; |
|
5533 } |
|
5534 else |
|
5535 { |
|
5536 iTimer->Cancel(); |
|
5537 Fsm(EEventTimerComplete, KErrNone); |
|
5538 } |
|
5539 } |
|
5540 |
|
5541 void RA3FDevSoundPlayRejectedByRecordTest::ClientInitializeCompleteCallback(TInt aError) |
|
5542 { |
|
5543 INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback ==========")); |
|
5544 if (aError != KErrNone) |
|
5545 { |
|
5546 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
5547 StopTest(aError); |
|
5548 } |
|
5549 else |
|
5550 { |
|
5551 INFO_PRINTF2(_L("Second DevSound client called InitializeComplete and with error = %d"), aError); |
|
5552 INFO_PRINTF1(_L("Starting to play audio thru second devsound client")); |
|
5553 TInt err = iDevsoundPlayClient->PlayAudio(); |
|
5554 if (err != KErrNone) |
|
5555 { |
|
5556 ERR_PRINTF2(_L("Starting to play audio thru second devsound client failed with error = %d"), err); |
|
5557 StopTest(err); |
|
5558 } |
|
5559 } |
|
5560 } |
|
5561 |
|
5562 void RA3FDevSoundPlayRejectedByRecordTest::ClientPlayHandleOpenFileErrorInValidEventOrStateCallBack(TMmfDevSoundClientErrorCodes aError) |
|
5563 { |
|
5564 switch (aError) |
|
5565 { |
|
5566 case EInvalidClientFSMEvent: |
|
5567 ERR_PRINTF1(_L("Second devsound client received an invalid Event...")); |
|
5568 break; |
|
5569 case EInvalidClientFSMState: |
|
5570 ERR_PRINTF1(_L("Second devsound client received an invalid State...")); |
|
5571 break; |
|
5572 case EReadFileErrorInClient: |
|
5573 ERR_PRINTF1(_L("Second devsound client could not read to file...")); |
|
5574 break; |
|
5575 default: |
|
5576 break; |
|
5577 } |
|
5578 StopTest(aError, EFail); |
|
5579 } |
|
5580 |
|
5581 void RA3FDevSoundPlayRejectedByRecordTest::ClientBufferToBeFilledCallback(TInt aError) |
|
5582 { |
|
5583 INFO_PRINTF2(_L("Second DevSound client should not call BufferToBeFilled in rejection. Error = %d"), aError); |
|
5584 StopTest(aError, EFail); |
|
5585 } |
|
5586 |
|
5587 void RA3FDevSoundPlayRejectedByRecordTest::ClientPlayErrorCallback(TInt aError, TBool aLastBuffer) |
|
5588 { |
|
5589 INFO_PRINTF1(_L("========== Second Client DevSound PlayError() callback ==========")); |
|
5590 |
|
5591 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied && !aLastBuffer) |
|
5592 { |
|
5593 INFO_PRINTF1(_L("========== Rejecting 2nd DevSound Instance==========")); |
|
5594 INFO_PRINTF2(_L("Second DevSound client PlayError succeeded with error = %d"), aError); |
|
5595 } |
|
5596 else |
|
5597 { |
|
5598 ERR_PRINTF2(_L("Second DevSound PlayError failed with error = %d"), aError); |
|
5599 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
5600 StopTest(aError, EFail); |
|
5601 } |
|
5602 } |
|
5603 |
|
5604 /* |
|
5605 *======================================================================================================== |
|
5606 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0037 |
|
5607 */ |
|
5608 RA3FDevSoundPlayDataBeforePlayInitTest::RA3FDevSoundPlayDataBeforePlayInitTest(const TDesC& aTestName) : |
|
5609 RA3FDevSoundTestBase(aTestName) |
|
5610 { |
|
5611 } |
|
5612 |
|
5613 RA3FDevSoundPlayDataBeforePlayInitTest* RA3FDevSoundPlayDataBeforePlayInitTest::NewL(const TDesC& aTestName) |
|
5614 { |
|
5615 RA3FDevSoundPlayDataBeforePlayInitTest* self = new (ELeave) RA3FDevSoundPlayDataBeforePlayInitTest(aTestName); |
|
5616 return self; |
|
5617 } |
|
5618 |
|
5619 void RA3FDevSoundPlayDataBeforePlayInitTest::DoKickoffTestL() |
|
5620 { |
|
5621 TPtrC fourccCode; |
|
5622 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
5623 { |
|
5624 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
5625 StopTest(KErrNotFound); |
|
5626 return; |
|
5627 } |
|
5628 EncodingFromStringToTFourCC(fourccCode); |
|
5629 } |
|
5630 |
|
5631 void RA3FDevSoundPlayDataBeforePlayInitTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
5632 { |
|
5633 switch (iDevSoundState) |
|
5634 { |
|
5635 case EStateCreated: |
|
5636 { |
|
5637 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPlayDatabeforePlayInitLTest"), EFsmIncorrectErrorPassed)); |
|
5638 if (aDevSoundEvent == EEventInitialize) |
|
5639 { |
|
5640 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
5641 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
5642 if (err != KErrNone) |
|
5643 { |
|
5644 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
5645 StopTest(err); |
|
5646 break; |
|
5647 } |
|
5648 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
5649 iDevSoundState = EStateInitializing; |
|
5650 } |
|
5651 else |
|
5652 { |
|
5653 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
5654 StopTest(aError, EFail); |
|
5655 } |
|
5656 break; |
|
5657 } |
|
5658 case EStateInitializing: |
|
5659 { |
|
5660 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
5661 { |
|
5662 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData out of sequence")); |
|
5663 iMMFDevSound->PlayData(); |
|
5664 } |
|
5665 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
5666 { |
|
5667 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
5668 StopTest(aError); |
|
5669 } |
|
5670 else |
|
5671 { |
|
5672 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
5673 StopTest(aError, EFail); |
|
5674 } |
|
5675 break; |
|
5676 } |
|
5677 default: |
|
5678 { |
|
5679 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
5680 StopTest(aError, EFail); |
|
5681 } |
|
5682 } |
|
5683 } |
|
5684 |
|
5685 /* |
|
5686 *======================================================================================================== |
|
5687 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0038 |
|
5688 */ |
|
5689 RA3FDevSoundPlayInitTwiceTest::RA3FDevSoundPlayInitTwiceTest(const TDesC& aTestName) : |
|
5690 RA3FDevSoundTestBase(aTestName),iFirstPlayInitErr(KErrGeneral), |
|
5691 iErr(KErrGeneral) |
|
5692 { |
|
5693 } |
|
5694 |
|
5695 RA3FDevSoundPlayInitTwiceTest* RA3FDevSoundPlayInitTwiceTest::NewL(const TDesC& aTestName) |
|
5696 { |
|
5697 RA3FDevSoundPlayInitTwiceTest* self = new (ELeave) RA3FDevSoundPlayInitTwiceTest(aTestName); |
|
5698 return self; |
|
5699 } |
|
5700 |
|
5701 void RA3FDevSoundPlayInitTwiceTest::DoKickoffTestL() |
|
5702 { |
|
5703 TPtrC fourccCode; |
|
5704 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
5705 { |
|
5706 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
5707 StopTest(KErrNotFound); |
|
5708 return; |
|
5709 } |
|
5710 EncodingFromStringToTFourCC (fourccCode); |
|
5711 } |
|
5712 |
|
5713 void RA3FDevSoundPlayInitTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
5714 { |
|
5715 switch (iDevSoundState) |
|
5716 { |
|
5717 case EStateCreated: |
|
5718 { |
|
5719 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPlayInitLTwiceTest"), EFsmIncorrectErrorPassed)); |
|
5720 if (aDevSoundEvent == EEventInitialize) |
|
5721 { |
|
5722 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
5723 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
5724 if (err != KErrNone) |
|
5725 { |
|
5726 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
5727 StopTest(err); |
|
5728 break; |
|
5729 } |
|
5730 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
5731 iDevSoundState = EStateInitializing; |
|
5732 } |
|
5733 else |
|
5734 { |
|
5735 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
5736 StopTest(aError, EFail); |
|
5737 } |
|
5738 break; |
|
5739 } |
|
5740 case EStateInitializing: |
|
5741 { |
|
5742 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
5743 { |
|
5744 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
5745 TRAP(iFirstPlayInitErr, iMMFDevSound->PlayInitL()); |
|
5746 if (iFirstPlayInitErr != KErrNone) |
|
5747 { |
|
5748 ERR_PRINTF2(_L("CMMFDevSound::PlayInitL left with error = %d"), iFirstPlayInitErr); |
|
5749 StopTest(iFirstPlayInitErr); |
|
5750 break; |
|
5751 } |
|
5752 INFO_PRINTF1(_L("CMMFDevSound::PlayInitL twice (more than once)")); |
|
5753 TRAP(iErr, iMMFDevSound->PlayInitL()); |
|
5754 if (iErr == KErrNotReady) |
|
5755 { |
|
5756 INFO_PRINTF2(_L("CMMFDevSound::PlayInitL left with the expected error = %d"), iErr); |
|
5757 break; |
|
5758 } |
|
5759 else |
|
5760 { |
|
5761 ERR_PRINTF2(_L("Second CMMFDevSound::PlayInitL did NOT leave with the expected error = %d"), iErr); |
|
5762 ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); |
|
5763 StopTest(iErr, EFail); |
|
5764 break; |
|
5765 } |
|
5766 } |
|
5767 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
5768 { |
|
5769 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
5770 StopTest(aError); |
|
5771 } |
|
5772 else |
|
5773 { |
|
5774 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
5775 StopTest(aError, EFail); |
|
5776 } |
|
5777 break; |
|
5778 } |
|
5779 default: |
|
5780 { |
|
5781 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
5782 StopTest(aError, EFail); |
|
5783 } |
|
5784 } |
|
5785 } |
|
5786 |
|
5787 void RA3FDevSoundPlayInitTwiceTest::BufferToBeFilled(CMMFBuffer* /*aBuffer*/) |
|
5788 { |
|
5789 INFO_PRINTF1(_L("========== DevSound BufferToBeFilled() callback ==========")); |
|
5790 if (iErr == KErrNotReady && iFirstPlayInitErr == KErrNone) |
|
5791 { |
|
5792 INFO_PRINTF1(_L("BufferToBeFilled is called because the leave generated due to second CMMFDevSound::PlayInitL is ignored")); |
|
5793 StopTest(); |
|
5794 } |
|
5795 } |
|
5796 |
|
5797 /* |
|
5798 *======================================================================================================== |
|
5799 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0039 |
|
5800 */ |
|
5801 RA3FDevSoundPlayARNTest::RA3FDevSoundPlayARNTest(const TDesC& aTestName) : |
|
5802 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC), |
|
5803 iOtherFilename(KNullDesC) |
|
5804 { |
|
5805 } |
|
5806 |
|
5807 RA3FDevSoundPlayARNTest* RA3FDevSoundPlayARNTest::NewL(const TDesC& aTestName) |
|
5808 { |
|
5809 RA3FDevSoundPlayARNTest* self = new (ELeave) RA3FDevSoundPlayARNTest(aTestName); |
|
5810 return self; |
|
5811 } |
|
5812 |
|
5813 void RA3FDevSoundPlayARNTest::DoKickoffTestL() |
|
5814 { |
|
5815 iRepeat = EFalse; |
|
5816 TPtrC filename; |
|
5817 // Get the filename of the audio file to play |
|
5818 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
5819 { |
|
5820 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
5821 StopTest(KErrNotFound); |
|
5822 return; |
|
5823 } |
|
5824 // open using RFile for playback |
|
5825 iFilename.Copy(filename); |
|
5826 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
5827 if (err != KErrNone) |
|
5828 { |
|
5829 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
5830 StopTest(err); |
|
5831 return; |
|
5832 } |
|
5833 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
5834 // Get the filename of the second devsound instance |
|
5835 TPtrC tempString; |
|
5836 if (!GetStringFromConfig(iTestStepName, KOtherFilename, tempString)) |
|
5837 { |
|
5838 ERR_PRINTF2(KMsgErrorGetParameter, &KOtherFilename); |
|
5839 StopTest(KErrNotFound); |
|
5840 return; |
|
5841 } |
|
5842 iOtherFilename.Copy (tempString); |
|
5843 INFO_PRINTF2(_L("File under test -> %S"), &iOtherFilename); |
|
5844 TPtrC fourccCode; |
|
5845 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
5846 { |
|
5847 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
5848 StopTest(KErrNotFound); |
|
5849 return; |
|
5850 } |
|
5851 EncodingFromStringToTFourCC(fourccCode); |
|
5852 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
5853 iDevsoundPlayClient = CA3FDevSoundPlayClient::NewL(*this, iFourCCCode, iFs, iSuite); |
|
5854 } |
|
5855 |
|
5856 void RA3FDevSoundPlayARNTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
5857 { |
|
5858 switch (iDevSoundState) |
|
5859 { |
|
5860 case EStateCreated: |
|
5861 { |
|
5862 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPreemptionTest"), EFsmIncorrectErrorPassed)); |
|
5863 if (aDevSoundEvent == EEventInitialize) |
|
5864 { |
|
5865 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
5866 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
5867 if (err != KErrNone) |
|
5868 { |
|
5869 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
5870 StopTest(err); |
|
5871 break; |
|
5872 } |
|
5873 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
5874 iDevSoundState = EStateInitializing; |
|
5875 } |
|
5876 else |
|
5877 { |
|
5878 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
5879 StopTest(aError, EFail); |
|
5880 } |
|
5881 break; |
|
5882 } |
|
5883 case EStateInitializing: |
|
5884 { |
|
5885 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
5886 { |
|
5887 TMMFPrioritySettings priority; |
|
5888 priority.iPriority = KMinimumPriority; |
|
5889 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
5890 iMMFDevSound->SetPrioritySettings (priority); |
|
5891 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
5892 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
5893 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
5894 if (err != KErrNone) |
|
5895 { |
|
5896 StopTest(err); |
|
5897 break; |
|
5898 } |
|
5899 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
5900 INFO_PRINTF1(_L("Registering first client")); |
|
5901 iMMFDevSound->RegisterAsClient(KMMFEventCategoryAudioResourceAvailable); |
|
5902 iDevSoundState = EStatePlaying; |
|
5903 StartTimer(KMicroSecsTwoSec); |
|
5904 } |
|
5905 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
5906 { |
|
5907 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
5908 StopTest(aError); |
|
5909 } |
|
5910 else |
|
5911 { |
|
5912 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
5913 StopTest(aError, EFail); |
|
5914 } |
|
5915 break; |
|
5916 } |
|
5917 case EStatePlaying: |
|
5918 { |
|
5919 if (aDevSoundEvent == EEventBTBF) |
|
5920 { |
|
5921 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
5922 TInt err = iFile.Read (buffer->Data ()); |
|
5923 if (err != KErrNone) |
|
5924 { |
|
5925 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
5926 StopTest (err); |
|
5927 break; |
|
5928 } |
|
5929 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
5930 { |
|
5931 iBuffer->SetLastBuffer(ETrue); |
|
5932 } |
|
5933 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
5934 iMMFDevSound->PlayData(); |
|
5935 } |
|
5936 else |
|
5937 { |
|
5938 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
5939 StopTest(aError, EFail); |
|
5940 } |
|
5941 break; |
|
5942 } |
|
5943 case EStateResumePlaying: |
|
5944 { |
|
5945 // if (aDevSoundEvent == KMMFEventCategoryAudioResourceAvailable) |
|
5946 if (aDevSoundEvent == EResourceAvailable) |
|
5947 { |
|
5948 INFO_PRINTF1(_L("First Client Received Notification as expected")); |
|
5949 //INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
5950 //iMMFDevSound->PlayData (); |
|
5951 StopTest(); |
|
5952 } |
|
5953 else |
|
5954 { |
|
5955 ERR_PRINTF2(_L("DevSound KMMFEventCategoryAudioResourceAvailable not received as expected. Received event: %d"), aDevSoundEvent); |
|
5956 StopTest(aError, EFail); |
|
5957 } |
|
5958 break; |
|
5959 } |
|
5960 default: |
|
5961 { |
|
5962 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
5963 StopTest(KErrGeneral); |
|
5964 } |
|
5965 } |
|
5966 } |
|
5967 |
|
5968 void RA3FDevSoundPlayARNTest::DoTimerCallback() |
|
5969 { |
|
5970 if(!iRepeat) |
|
5971 { |
|
5972 INFO_PRINTF1(_L("TimerEvent called")); |
|
5973 //iTimer->Cancel(); |
|
5974 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
5975 iDevsoundPlayClient->SetPriority(KMaximumPriority); |
|
5976 INFO_PRINTF1(_L("Initializing to play audio thru second devsound client")); |
|
5977 TInt err = iDevsoundPlayClient->PlayInit(iOtherFilename); |
|
5978 if (err != KErrNone) |
|
5979 { |
|
5980 ERR_PRINTF2(_L("Initializating DevSound to play audio thru second devsound client failed with error = %d"), err); |
|
5981 StopTest(err); |
|
5982 } |
|
5983 iRepeat = ETrue; |
|
5984 } |
|
5985 else |
|
5986 { |
|
5987 INFO_PRINTF1(_L("Deleting second devsound client")); |
|
5988 iDevsoundPlayClient->DeleteClient(); |
|
5989 iDevSoundState = EStateResumePlaying; |
|
5990 } |
|
5991 } |
|
5992 |
|
5993 void RA3FDevSoundPlayARNTest::PlayError(TInt aError) |
|
5994 { |
|
5995 INFO_PRINTF1(_L("========== DevSound PlayError() callback ==========")); |
|
5996 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied) |
|
5997 { |
|
5998 INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance==========")); |
|
5999 INFO_PRINTF2(_L("First DevSound client PlayError succeeded with error = %d "), aError); |
|
6000 } |
|
6001 else |
|
6002 { |
|
6003 ERR_PRINTF2(_L("First DevSound client PlayError and failed with error = %d "), aError); |
|
6004 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
6005 StopTest(aError, EFail); |
|
6006 } |
|
6007 } |
|
6008 |
|
6009 void RA3FDevSoundPlayARNTest::ClientInitializeCompleteCallback(TInt aError) |
|
6010 { |
|
6011 INFO_PRINTF1(_L("========== Second Client DevSound InitializeComplete() callback ==========")); |
|
6012 if (aError != KErrNone) |
|
6013 { |
|
6014 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
6015 StopTest(aError); |
|
6016 } |
|
6017 else |
|
6018 { |
|
6019 INFO_PRINTF1(_L("Starting to play audio thru second devsound client")); |
|
6020 TInt err = iDevsoundPlayClient->PlayAudio(); |
|
6021 if (err != KErrNone) |
|
6022 { |
|
6023 ERR_PRINTF2(_L("Starting to play audio thru second devsound client failed with error = %d"), err); |
|
6024 StopTest(err); |
|
6025 } |
|
6026 } |
|
6027 } |
|
6028 |
|
6029 void RA3FDevSoundPlayARNTest::ClientBufferToBeFilledCallback(TInt aError) |
|
6030 { |
|
6031 INFO_PRINTF1(_L("========== Second Client DevSound BufferToBeFilled() callback ==========")); |
|
6032 if (aError != KErrNone) |
|
6033 { |
|
6034 ERR_PRINTF2(_L("Second DevSound client called BufferToBeFilled and failed with error = %d"), aError); |
|
6035 StopTest(aError); |
|
6036 } |
|
6037 } |
|
6038 |
|
6039 void RA3FDevSoundPlayARNTest::ClientPlayHandleOpenFileErrorInValidEventOrStateCallBack(TMmfDevSoundClientErrorCodes aError) |
|
6040 { |
|
6041 switch (aError) |
|
6042 { |
|
6043 case EInvalidClientFSMEvent: |
|
6044 ERR_PRINTF1(_L("Second devsound client received an invalid Event...")); |
|
6045 break; |
|
6046 case EInvalidClientFSMState: |
|
6047 ERR_PRINTF1(_L("Second devsound client received an invalid State...")); |
|
6048 break; |
|
6049 case EReadFileErrorInClient: |
|
6050 ERR_PRINTF1(_L("Second devsound client could not read to file...")); |
|
6051 break; |
|
6052 default: |
|
6053 break; |
|
6054 } |
|
6055 StopTest(aError, EFail); |
|
6056 } |
|
6057 |
|
6058 void RA3FDevSoundPlayARNTest::ClientPlayErrorCallback(TInt aError, TBool aLastBuffer) |
|
6059 { |
|
6060 INFO_PRINTF1(_L("========== Second Client DevSound PlayError() callback ==========")); |
|
6061 |
|
6062 if (aError == KErrUnderflow && aLastBuffer) |
|
6063 { |
|
6064 INFO_PRINTF1(_L("Second DevSound client called PlayError and completed normally")); |
|
6065 iDevSoundState = EStateResumePlaying; |
|
6066 //StopTest(); |
|
6067 } |
|
6068 else |
|
6069 { |
|
6070 ERR_PRINTF2(_L("Second DevSound PlayError failed with error = %d"), aError); |
|
6071 ERR_PRINTF2(_L("Expected error = %d "), KErrUnderflow); |
|
6072 StopTest(aError, EFail); |
|
6073 } |
|
6074 } |
|
6075 |
|
6076 /* |
|
6077 *======================================================================================================== |
|
6078 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0040 |
|
6079 */ |
|
6080 RA3FDevSoundImmediatePauseAfterCreation::RA3FDevSoundImmediatePauseAfterCreation(const TDesC& aTestName) : |
|
6081 RA3FDevSoundTestBase(aTestName), iFilename(KNullDesC) |
|
6082 { |
|
6083 } |
|
6084 |
|
6085 RA3FDevSoundImmediatePauseAfterCreation* RA3FDevSoundImmediatePauseAfterCreation::NewL(const TDesC& aTestName) |
|
6086 { |
|
6087 RA3FDevSoundImmediatePauseAfterCreation* self = new (ELeave) RA3FDevSoundImmediatePauseAfterCreation(aTestName); |
|
6088 return self; |
|
6089 } |
|
6090 |
|
6091 void RA3FDevSoundImmediatePauseAfterCreation::DoKickoffTestL() |
|
6092 { |
|
6093 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
6094 } |
|
6095 |
|
6096 void RA3FDevSoundImmediatePauseAfterCreation::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
6097 { |
|
6098 switch (iDevSoundState) |
|
6099 { |
|
6100 case EStateCreated: |
|
6101 { |
|
6102 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundImmediatePauseAfterCreation"), EFsmIncorrectErrorPassed)); |
|
6103 if (aDevSoundEvent == EEventInitialize) |
|
6104 { |
|
6105 INFO_PRINTF1(_L("Calling CMMFDevSound::Pause")); |
|
6106 |
|
6107 iMMFDevSound->Pause(); |
|
6108 StartTimer(KMicroSecsInOneSec); |
|
6109 |
|
6110 iDevSoundState = EStatePause; |
|
6111 } |
|
6112 else |
|
6113 { |
|
6114 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
6115 StopTest(aError, EFail); |
|
6116 } |
|
6117 break; |
|
6118 } |
|
6119 |
|
6120 default: |
|
6121 { |
|
6122 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
6123 StopTest(aError, EFail); |
|
6124 } |
|
6125 } |
|
6126 } |
|
6127 |
|
6128 void RA3FDevSoundImmediatePauseAfterCreation::DoTimerCallback() |
|
6129 { |
|
6130 INFO_PRINTF1(_L("TimerEvent called")); |
|
6131 iTimer->Cancel(); |
|
6132 INFO_PRINTF1(_L("Pause did not panic DevSound")); |
|
6133 StopTest(KErrNone); |
|
6134 } |
|
6135 |
|
6136 |
|
6137 /* |
|
6138 *======================================================================================================== |
|
6139 * MM-A3F-DEVSOUND-CHRTZ-PLAY-RAW-0041 |
|
6140 */ |
|
6141 RA3FDevSoundPlayEmptyBuffersWhilePlayingTest::RA3FDevSoundPlayEmptyBuffersWhilePlayingTest(const TDesC& aTestName) : |
|
6142 RA3FDevSoundTestBase(aTestName), iVolume(0), |
|
6143 iFilename(KNullDesC) |
|
6144 { |
|
6145 } |
|
6146 |
|
6147 RA3FDevSoundPlayEmptyBuffersWhilePlayingTest* RA3FDevSoundPlayEmptyBuffersWhilePlayingTest::NewL(const TDesC& aTestName) |
|
6148 { |
|
6149 RA3FDevSoundPlayEmptyBuffersWhilePlayingTest* self = new (ELeave) RA3FDevSoundPlayEmptyBuffersWhilePlayingTest(aTestName); |
|
6150 return self; |
|
6151 } |
|
6152 |
|
6153 void RA3FDevSoundPlayEmptyBuffersWhilePlayingTest::DoKickoffTestL() |
|
6154 { |
|
6155 TPtrC filename; |
|
6156 // Get the filename of the audio file to play |
|
6157 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
6158 { |
|
6159 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
6160 StopTest (KErrNotFound); |
|
6161 return; |
|
6162 } |
|
6163 // open using RFile for playback |
|
6164 iFilename.Copy (filename); |
|
6165 TInt err = iFile.Open (iFs, iFilename, EFileRead); |
|
6166 if (err != KErrNone) |
|
6167 { |
|
6168 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
6169 iFs.Close(); |
|
6170 StopTest(err); |
|
6171 return; |
|
6172 } |
|
6173 |
|
6174 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
6175 |
|
6176 if (!GetIntFromConfig(iTestStepName, KVolume, iVolume)) |
|
6177 { |
|
6178 ERR_PRINTF2(KMsgErrorGetParameter, &KVolume); |
|
6179 StopTest (KErrNotFound); |
|
6180 return; |
|
6181 } |
|
6182 TPtrC fourccCode; |
|
6183 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
6184 { |
|
6185 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
6186 StopTest(KErrNotFound); |
|
6187 return; |
|
6188 } |
|
6189 EncodingFromStringToTFourCC(fourccCode); |
|
6190 } |
|
6191 |
|
6192 void RA3FDevSoundPlayEmptyBuffersWhilePlayingTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
6193 { |
|
6194 switch (iDevSoundState) |
|
6195 { |
|
6196 case EStateCreated: |
|
6197 { |
|
6198 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlaySetVolumePlayingTest"), EFsmIncorrectErrorPassed)); |
|
6199 if (aDevSoundEvent == EEventInitialize) |
|
6200 { |
|
6201 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
6202 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
6203 if (err != KErrNone) |
|
6204 { |
|
6205 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error: %d"), err); |
|
6206 StopTest(err); |
|
6207 break; |
|
6208 } |
|
6209 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
6210 iDevSoundState = EStateInitializing; |
|
6211 } |
|
6212 else |
|
6213 { |
|
6214 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
6215 StopTest(aError, EFail); |
|
6216 } |
|
6217 break; |
|
6218 } |
|
6219 case EStateInitializing: |
|
6220 { |
|
6221 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
6222 { |
|
6223 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
6224 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
6225 if (err != KErrNone) |
|
6226 { |
|
6227 StopTest(err); |
|
6228 break; |
|
6229 } |
|
6230 iDevSoundState = EStatePlaying; |
|
6231 } |
|
6232 else if (aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
6233 { |
|
6234 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
6235 StopTest(aError); |
|
6236 } |
|
6237 else |
|
6238 { |
|
6239 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
6240 StopTest(aError, EFail); |
|
6241 } |
|
6242 break; |
|
6243 } |
|
6244 case EStatePlaying: |
|
6245 { |
|
6246 if (aDevSoundEvent == EEventBTBF) |
|
6247 { |
|
6248 |
|
6249 if(iBtbfCount == 3) |
|
6250 { |
|
6251 INFO_PRINTF2(_L("BTBF count = %d, Calling CMMFDevSound::EmptyBuffers"),iBtbfCount); |
|
6252 iMMFDevSound->EmptyBuffers(); |
|
6253 } |
|
6254 |
|
6255 else |
|
6256 { |
|
6257 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
6258 TInt err = iFile.Read (buffer->Data ()); |
|
6259 if (err != KErrNone) |
|
6260 { |
|
6261 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with: %d"), err); |
|
6262 StopTest(err); |
|
6263 break; |
|
6264 } |
|
6265 if (buffer->Data().Length ()!= buffer->RequestSize ()) |
|
6266 { |
|
6267 iBuffer->SetLastBuffer (ETrue); |
|
6268 } |
|
6269 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
6270 iMMFDevSound->PlayData (); |
|
6271 } |
|
6272 |
|
6273 ++iBtbfCount; |
|
6274 } |
|
6275 else |
|
6276 { |
|
6277 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
6278 StopTest(aError, EFail); |
|
6279 } |
|
6280 break; |
|
6281 } |
|
6282 default: |
|
6283 { |
|
6284 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
6285 StopTest(aError, EFail); |
|
6286 } |
|
6287 } |
|
6288 } |
|
6289 |
|
6290 /* |
|
6291 *======================================================================================================== |
|
6292 * 3F-DEVSOUND-CHRTZ-PLAY-RAW-0042 |
|
6293 */ |
|
6294 RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest(const TDesC& aTestName) : |
|
6295 RA3FDevSoundTestBase(aTestName),iFilename(KNullDesC), |
|
6296 iExVolume(0), iFrequencyTone1(0), iDuration(0), |
|
6297 iSetVolume(EFalse), iResume(EFalse) |
|
6298 { |
|
6299 } |
|
6300 |
|
6301 RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest* RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::NewL(const TDesC& aTestName) |
|
6302 { |
|
6303 RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest* self = new (ELeave) RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest(aTestName); |
|
6304 return self; |
|
6305 } |
|
6306 |
|
6307 void RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::DoKickoffTestL() |
|
6308 { |
|
6309 TPtrC filename; |
|
6310 // Get the filename of the audio file to play |
|
6311 if (!GetStringFromConfig(iTestStepName, KFilename, filename)) |
|
6312 { |
|
6313 ERR_PRINTF2(KMsgErrorGetParameter, &KFilename); |
|
6314 StopTest(KErrNotFound); |
|
6315 return; |
|
6316 } |
|
6317 // open using RFile for playback |
|
6318 iFilename.Copy(filename); |
|
6319 TInt err = iFile.Open(iFs, iFilename, EFileRead); |
|
6320 if (err != KErrNone) |
|
6321 { |
|
6322 ERR_PRINTF2(_L("Could not open input file. Error = %d"), err); |
|
6323 StopTest(err); |
|
6324 return; |
|
6325 } |
|
6326 |
|
6327 INFO_PRINTF2(_L("File under test -> %S"), &iFilename); |
|
6328 |
|
6329 if (!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) |
|
6330 { |
|
6331 ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1); |
|
6332 StopTest(KErrNotFound); |
|
6333 return; |
|
6334 } |
|
6335 if (!GetIntFromConfig(iTestStepName, KDuration, iDuration)) |
|
6336 { |
|
6337 ERR_PRINTF2(KMsgErrorGetParameter, &KDuration); |
|
6338 StopTest(KErrNotFound); |
|
6339 return; |
|
6340 } |
|
6341 TPtrC fourccCode; |
|
6342 if (!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) |
|
6343 { |
|
6344 ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); |
|
6345 StopTest(KErrNotFound); |
|
6346 return; |
|
6347 } |
|
6348 |
|
6349 if (!GetIntFromConfig(iTestStepName, KExVolume, iExVolume)) |
|
6350 { |
|
6351 ERR_PRINTF2(KMsgErrorGetParameter, &KExVolume); |
|
6352 StopTest(KErrNotFound); |
|
6353 return; |
|
6354 } |
|
6355 |
|
6356 EncodingFromStringToTFourCC(fourccCode); |
|
6357 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
6358 iDevsoundToneClient = CA3FDevSoundToneClient::NewL(*this); |
|
6359 } |
|
6360 |
|
6361 void RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) |
|
6362 { |
|
6363 switch (iDevSoundState) |
|
6364 { |
|
6365 case EStateCreated: |
|
6366 { |
|
6367 __ASSERT_ALWAYS((aError == KErrNone), Panic(_L("RA3FDevSoundPlayPreemptedByToneTest"), EFsmIncorrectErrorPassed)); |
|
6368 if (aDevSoundEvent == EEventInitialize) |
|
6369 { |
|
6370 INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); |
|
6371 TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); |
|
6372 if (err != KErrNone) |
|
6373 { |
|
6374 ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); |
|
6375 StopTest(err); |
|
6376 break; |
|
6377 } |
|
6378 INFO_PRINTF1(_L("DevSound State: EStateInitializing")); |
|
6379 iDevSoundState = EStateInitializing; |
|
6380 } |
|
6381 else |
|
6382 { |
|
6383 ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); |
|
6384 StopTest(aError, EFail); |
|
6385 } |
|
6386 break; |
|
6387 } |
|
6388 case EStateInitializing: |
|
6389 { |
|
6390 if (aDevSoundEvent == EEventInitComplete && aError == KErrNone) |
|
6391 { |
|
6392 TMMFPrioritySettings priority; |
|
6393 priority.iPriority = KMinimumPriority; |
|
6394 INFO_PRINTF2(_L("Setting Priority to %d using CMMFDevSound::SetPrioritySettings"), priority.iPriority); |
|
6395 iMMFDevSound->SetPrioritySettings (priority); |
|
6396 iMMFDevSound->SetVolume (iMMFDevSound->MaxVolume ()); |
|
6397 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayInitL")); |
|
6398 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
6399 if (err != KErrNone) |
|
6400 { |
|
6401 StopTest (err); |
|
6402 break; |
|
6403 } |
|
6404 INFO_PRINTF1(_L("DevSound State: EStatePlaying")); |
|
6405 iDevSoundState = EStatePlaying; |
|
6406 StartTimer (KMicroSecsTwoSec); |
|
6407 } |
|
6408 else if ( aDevSoundEvent == EEventInitComplete && aError != KErrNone) |
|
6409 { |
|
6410 ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error: %d"), aError); |
|
6411 StopTest(aError); |
|
6412 } |
|
6413 else |
|
6414 { |
|
6415 ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); |
|
6416 StopTest(aError, EFail); |
|
6417 } |
|
6418 break; |
|
6419 } |
|
6420 case EStatePlaying: |
|
6421 { |
|
6422 if (aDevSoundEvent == EEventBTBF) |
|
6423 { |
|
6424 if(iResume) |
|
6425 { |
|
6426 INFO_PRINTF1(_L("First Client resumed after pre-emption as expected")); |
|
6427 StopTest(); |
|
6428 break; |
|
6429 } |
|
6430 |
|
6431 if(!iSetVolume) |
|
6432 { |
|
6433 iMMFDevSound->SetVolume (iExVolume); |
|
6434 iSetVolume = ETrue; |
|
6435 } |
|
6436 |
|
6437 CMMFDataBuffer* buffer = static_cast <CMMFDataBuffer*> (iBuffer); |
|
6438 TInt err = iFile.Read (buffer->Data()); |
|
6439 if (err != KErrNone) |
|
6440 { |
|
6441 ERR_PRINTF2(_L("ERROR : iFile.Read() failed with %d"), err); |
|
6442 StopTest(err); |
|
6443 break; |
|
6444 } |
|
6445 if (buffer->Data().Length ()!= buffer->RequestSize()) |
|
6446 { |
|
6447 iBuffer->SetLastBuffer(ETrue); |
|
6448 } |
|
6449 INFO_PRINTF1(_L("Calling CMMFDevSound::PlayData")); |
|
6450 iMMFDevSound->PlayData(); |
|
6451 } |
|
6452 else |
|
6453 { |
|
6454 ERR_PRINTF2(_L("DevSound EEventBTBF not received as expected. Received event: %d"), aDevSoundEvent); |
|
6455 StopTest(aError, EFail); |
|
6456 } |
|
6457 break; |
|
6458 } |
|
6459 default: |
|
6460 { |
|
6461 ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); |
|
6462 StopTest(aError, EFail); |
|
6463 } |
|
6464 } |
|
6465 } |
|
6466 |
|
6467 void RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::DoTimerCallback() |
|
6468 { |
|
6469 INFO_PRINTF1(_L("TimerEvent called")); |
|
6470 iTimer->Cancel(); |
|
6471 INFO_PRINTF1(_L("Starting higher priority devsound client")); |
|
6472 iDevsoundToneClient->SetPriority(KMaximumPriority); |
|
6473 INFO_PRINTF1(_L("Initializing to play tones thru second devsound client")); |
|
6474 TInt err = iDevsoundToneClient->InitTonePlay(iFrequencyTone1,iDuration*KMicroSecsInOneSec); |
|
6475 if (err != KErrNone) |
|
6476 { |
|
6477 ERR_PRINTF2(_L("Initializating DevSoud to play tones thru second devsound client failed with error = %d"), err); |
|
6478 StopTest(err); |
|
6479 } |
|
6480 } |
|
6481 |
|
6482 void RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::PlayError(TInt aError) |
|
6483 { |
|
6484 INFO_PRINTF1(_L("========== DevSound PlayError() callback ==========")); |
|
6485 if (aError == KErrInUse || aError == KErrDied || aError == KErrAccessDenied) |
|
6486 { |
|
6487 INFO_PRINTF1(_L("========== Preempting 1st DevSound Instance==========")); |
|
6488 INFO_PRINTF2(_L("First DevSound client PlayError succeeded with error = %d "), aError); |
|
6489 } |
|
6490 else |
|
6491 { |
|
6492 ERR_PRINTF2(_L("First DevSound client called PlayError and failed with error = %d "), aError); |
|
6493 ERR_PRINTF4(_L("Expected posibilities %d %d %d "), KErrInUse, KErrDied, KErrAccessDenied); |
|
6494 StopTest(aError, EFail); |
|
6495 } |
|
6496 } |
|
6497 |
|
6498 void RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::ClientInitializeCompleteCallback(TInt aError) |
|
6499 { |
|
6500 INFO_PRINTF1(_L("==========Second DevSound client called InitializeComplete()==========")); |
|
6501 if (aError == KErrNone) |
|
6502 { |
|
6503 INFO_PRINTF1(_L("Starting to play tone thru second devsound client")); |
|
6504 TInt err = iDevsoundToneClient->PlayTone (); |
|
6505 if (err != KErrNone) |
|
6506 { |
|
6507 ERR_PRINTF2(_L("Second Devsound client called PlayTone and failed with error = %d"), err); |
|
6508 StopTest(err); |
|
6509 } |
|
6510 } |
|
6511 else |
|
6512 { |
|
6513 ERR_PRINTF2(_L("Second Devsound InitializeComplete received an error = %d"), aError); |
|
6514 StopTest(aError); |
|
6515 } |
|
6516 } |
|
6517 |
|
6518 void RA3FDevSoundPlayPreemptedByToneAfterSetVolumeTest::ClientToneFinishedCallback(TInt aError) |
|
6519 { |
|
6520 INFO_PRINTF1(_L("========== Second DevSound client called ToneFinished()==========")); |
|
6521 if (aError == KErrUnderflow) |
|
6522 { |
|
6523 INFO_PRINTF2(_L("Second DevSound client called ToneFinished and succeeded with error = %d"), aError); |
|
6524 iDevSoundState = EStatePlaying; |
|
6525 iResume = ETrue; |
|
6526 TRAPD(err, iMMFDevSound->PlayInitL()); |
|
6527 if(err != KErrNone) |
|
6528 { |
|
6529 ERR_PRINTF2(_L("Call PlayInitL failed after Second DevSound client called ToneFinished with error = %d"), err); |
|
6530 StopTest(aError); |
|
6531 } |
|
6532 } |
|
6533 else |
|
6534 { |
|
6535 ERR_PRINTF2(_L("Second DevSound client called ToneFinished and failed with error = %d"), aError); |
|
6536 StopTest(aError); |
|
6537 } |
|
6538 } |
|
6539 |