|
1 // Copyright (c) 2005-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 // CPP file: Audio Resource Notification tests for Audio Output Stream. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file TestOutputStreamARN.cpp |
|
20 */ |
|
21 |
|
22 #include "TestAudioClientUtilitiesARN.h" |
|
23 |
|
24 const TInt KSampleRate = 8000; |
|
25 const TInt KBytesPerSample = 2; |
|
26 //------------------------------------------------------------------------------ |
|
27 //********************PREQ 797 - Audio Resource Notification******************** |
|
28 //------------------------------------------------------------------------------ |
|
29 |
|
30 // |
|
31 //CTestMdaAudioOutputStreamCallbackSupport |
|
32 // |
|
33 |
|
34 /** |
|
35 * NewL |
|
36 */ |
|
37 CTestMdaAudioOutputStreamCallbackSupport* CTestMdaAudioOutputStreamCallbackSupport::NewL(MTestAudioOutputStreamCallback& aCallback) |
|
38 { |
|
39 return new(ELeave) CTestMdaAudioOutputStreamCallbackSupport(aCallback); |
|
40 } |
|
41 |
|
42 /** |
|
43 * MaoscOpenComplete |
|
44 */ |
|
45 void CTestMdaAudioOutputStreamCallbackSupport::MaoscOpenComplete(TInt aError) |
|
46 { |
|
47 iCallback.MaoscOpenCompleteTest(aError, *this); |
|
48 } |
|
49 |
|
50 /** |
|
51 * MaoscBufferCopied |
|
52 */ |
|
53 void CTestMdaAudioOutputStreamCallbackSupport::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer) |
|
54 { |
|
55 iCallback.MaoscBufferCopiedTest(aError, aBuffer, *this); |
|
56 } |
|
57 |
|
58 /** |
|
59 * MaoscPlayComplete |
|
60 */ |
|
61 void CTestMdaAudioOutputStreamCallbackSupport::MaoscPlayComplete(TInt aError) |
|
62 { |
|
63 iCallback.MaoscPlayCompleteTest(aError, *this); |
|
64 } |
|
65 |
|
66 /** |
|
67 * MarncResourceAvailable |
|
68 */ |
|
69 void CTestMdaAudioOutputStreamCallbackSupport::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData) |
|
70 { |
|
71 iCallback.MarncResourceAvailableTest(aNotificationEventId, aNotificationData, *this); |
|
72 } |
|
73 |
|
74 /** |
|
75 * Constructor |
|
76 */ |
|
77 CTestMdaAudioOutputStreamCallbackSupport::CTestMdaAudioOutputStreamCallbackSupport(MTestAudioOutputStreamCallback& aCallback):iCallback(aCallback) |
|
78 { |
|
79 |
|
80 } |
|
81 |
|
82 // |
|
83 //CTestStepAudioOutputStreamARN |
|
84 // |
|
85 |
|
86 /** |
|
87 * Constructor |
|
88 */ |
|
89 CTestStepAudioOutputStreamARN::CTestStepAudioOutputStreamARN(const TDesC& aTestName) |
|
90 { |
|
91 iTestStepName = aTestName; |
|
92 iFileSize1 = 0; |
|
93 iFileSize2 = 0; |
|
94 iHeapSize = 3600000; |
|
95 } |
|
96 |
|
97 /** |
|
98 * MMdaAudioOutputStreamCallback->MaoscOpenComplete |
|
99 */ |
|
100 void CTestStepAudioOutputStreamARN::MaoscOpenCompleteTest(TInt aError, CTestMdaAudioOutputStreamCallbackSupport& aMdaAudioOutputStreamCallbackSupport) |
|
101 { |
|
102 if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport1) |
|
103 { |
|
104 INFO_PRINTF2(_L("iTestAudioOutputStream1::MMdaAudioOutputStreamCallback->MaoscOpenComplete (%d)"),aError); |
|
105 TRAP(iError, FsmL(EMaoscOpenComplete1, aError)); |
|
106 } |
|
107 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport2) |
|
108 { |
|
109 INFO_PRINTF2(_L("iTestAudioOutputStream2::MMdaAudioOutputStreamCallback->MaoscOpenComplete (%d)"),aError); |
|
110 TRAP(iError, FsmL(EMaoscOpenComplete2, aError)); |
|
111 } |
|
112 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport3) |
|
113 { |
|
114 INFO_PRINTF2(_L("iTestAudioOutputStream3::MMdaAudioOutputStreamCallback->MaoscOpenComplete (%d)"),aError); |
|
115 TRAP(iError, FsmL(EMaoscOpenComplete3, aError)); |
|
116 } |
|
117 } |
|
118 |
|
119 /** |
|
120 * MMdaAudioOutputStreamCallback->MaoscBufferCopied |
|
121 */ |
|
122 void CTestStepAudioOutputStreamARN::MaoscBufferCopiedTest(TInt aError, const TDesC8& /*aBuffer*/, CTestMdaAudioOutputStreamCallbackSupport& aMdaAudioOutputStreamCallbackSupport) |
|
123 { |
|
124 if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport1) |
|
125 { |
|
126 INFO_PRINTF2(_L("iTestAudioOutputStream1::MMdaAudioOutputStreamCallback->MaoscBufferCopied (%d)"),aError); |
|
127 TRAP(iError, FsmL(EMaoscBufferCopied1, aError)); |
|
128 } |
|
129 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport2) |
|
130 { |
|
131 INFO_PRINTF2(_L("iTestAudioOutputStream2::MMdaAudioOutputStreamCallback->MaoscBufferCopied (%d)"),aError); |
|
132 TRAP(iError, FsmL(EMaoscBufferCopied2, aError)); |
|
133 } |
|
134 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport3) |
|
135 { |
|
136 INFO_PRINTF2(_L("iTestAudioOutputStream3::MMdaAudioOutputStreamCallback->MaoscBufferCopied (%d)"),aError); |
|
137 TRAP(iError, FsmL(EMaoscBufferCopied3, aError)); |
|
138 } |
|
139 } |
|
140 |
|
141 /** |
|
142 * MMdaAudioOutputStreamCallback->MaoscPlayComplete |
|
143 */ |
|
144 void CTestStepAudioOutputStreamARN::MaoscPlayCompleteTest(TInt aError, CTestMdaAudioOutputStreamCallbackSupport& aMdaAudioOutputStreamCallbackSupport) |
|
145 { |
|
146 if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport1) |
|
147 { |
|
148 INFO_PRINTF2(_L("iTestAudioOutputStream1::MMdaAudioOutputStreamCallback->MaoscPlayComplete (%d)"),aError); |
|
149 TRAP(iError, FsmL(EMaoscPlayComplete1, aError)); |
|
150 } |
|
151 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport2) |
|
152 { |
|
153 INFO_PRINTF2(_L("iTestAudioOutputStream2::MMdaAudioOutputStreamCallback->MaoscPlayComplete (%d)"),aError); |
|
154 TRAP(iError, FsmL(EMaoscPlayComplete2, aError)); |
|
155 } |
|
156 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport3) |
|
157 { |
|
158 INFO_PRINTF2(_L("iTestAudioOutputStream3::MMdaAudioOutputStreamCallback->MaoscPlayComplete (%d)"),aError); |
|
159 TRAP(iError, FsmL(EMaoscPlayComplete3, aError)); |
|
160 } |
|
161 } |
|
162 |
|
163 /** |
|
164 * MMMFAudioResourceNotificationCallback->MarncResourceAvailable |
|
165 */ |
|
166 void CTestStepAudioOutputStreamARN::MarncResourceAvailableTest(TUid aNotificationEventId, const TDesC8& aNotificationData, CTestMdaAudioOutputStreamCallbackSupport& aMdaAudioOutputStreamCallbackSupport) |
|
167 { |
|
168 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) |
|
169 { |
|
170 INFO_PRINTF1(_L("iAudioOutputStream::MMMFAudioResourceNotificationCallback -> KMMFEventCategoryAudioResourceAvailable")); |
|
171 |
|
172 //Convert TDesc8 to TInt64 |
|
173 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf; |
|
174 timeIntvbuf.Copy(aNotificationData); |
|
175 TTimeIntervalMicroSeconds intPos = timeIntvbuf(); |
|
176 iPosition = intPos; |
|
177 |
|
178 if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport1) |
|
179 { |
|
180 INFO_PRINTF1(_L("iTestAudioOutputStream1 -> MMMFAudioResourceNotificationCallback NotificationReceived")); |
|
181 TRAP(iError, FsmL(EMarncResourceAvailableOS1, KErrNone)); |
|
182 } |
|
183 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport2) |
|
184 { |
|
185 INFO_PRINTF1(_L("iTestAudioOutputStream2 -> MMMFAudioResourceNotificationCallback NotificationReceived")); |
|
186 TRAP(iError, FsmL(EMarncResourceAvailableOS2, KErrNone)); |
|
187 } |
|
188 else if (&aMdaAudioOutputStreamCallbackSupport == iMdaAudioOutputStreamCallbackSupport3) |
|
189 { |
|
190 INFO_PRINTF1(_L("iTestAudioOutputStream3 -> MMMFAudioResourceNotificationCallback NotificationReceived")); |
|
191 TRAP(iError, FsmL(EMarncResourceAvailableOS3, KErrNone)); |
|
192 } |
|
193 } |
|
194 else |
|
195 { |
|
196 INFO_PRINTF1(_L("MMMFAudioResourceNotificationCallback, but NOT KMMFEventCategoryAudioResourceAvailable")); |
|
197 } |
|
198 } |
|
199 |
|
200 /** |
|
201 * DoTestStepPreambleL |
|
202 */ |
|
203 TVerdict CTestStepAudioOutputStreamARN::DoTestStepPreambleL() |
|
204 { |
|
205 // Local Variable to hold verdict |
|
206 TVerdict verdict; |
|
207 |
|
208 // Install the scheduler |
|
209 verdict = CTestMmfAclntStep::DoTestStepPreambleL(); |
|
210 |
|
211 if (verdict == EFail) |
|
212 { |
|
213 return verdict; |
|
214 } |
|
215 |
|
216 // Connect RFs session |
|
217 TInt err = iFs.Connect(); |
|
218 if (err != KErrNone) |
|
219 { |
|
220 INFO_PRINTF2(_L("Error connecting to File session (RFs) = %d"), err); |
|
221 return EFail; |
|
222 } |
|
223 |
|
224 // Initialise iTestAudioOutputStream1 |
|
225 INFO_PRINTF1(_L("Initialise CMdaAudioOutputStream1 : EMdaPriorityNormal")); |
|
226 iMdaAudioOutputStreamCallbackSupport1 = CTestMdaAudioOutputStreamCallbackSupport::NewL(*this); |
|
227 TRAP(err, iTestAudioOutputStream1 = CMdaAudioOutputStream::NewL(*iMdaAudioOutputStreamCallbackSupport1, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality)); |
|
228 if (err != KErrNone || iTestAudioOutputStream1 == NULL ) |
|
229 { |
|
230 INFO_PRINTF2(_L("Error Creating iTestAudioOutputStream1 = %d"), err); |
|
231 return EInconclusive; |
|
232 } |
|
233 |
|
234 // Open RFile#1 |
|
235 err = iFile1.Open(iFs, KStreamRawFile1, EFileRead); |
|
236 if (err != KErrNone) |
|
237 { |
|
238 INFO_PRINTF2(_L("Error opening iFile1 = %d"), err); |
|
239 return EFail; |
|
240 } |
|
241 |
|
242 // Get size of iFile1 |
|
243 err = iFile1.Size(iFileSize1); |
|
244 if (err != KErrNone) |
|
245 { |
|
246 INFO_PRINTF2(_L("Error getting size of iFile1 = %d"), err); |
|
247 return EFail; |
|
248 } |
|
249 |
|
250 // Initialise iBuf1 |
|
251 iBuf1.CreateMaxL(iFileSize1); |
|
252 |
|
253 // Initialise iTestAudioOutputStream2 |
|
254 INFO_PRINTF1(_L("Initialise CMdaAudioOutputStream2 : EMdaPriorityMax")); |
|
255 iMdaAudioOutputStreamCallbackSupport2 = CTestMdaAudioOutputStreamCallbackSupport::NewL(*this); |
|
256 TRAP(err, iTestAudioOutputStream2 = CMdaAudioOutputStream::NewL(*iMdaAudioOutputStreamCallbackSupport2, EMdaPriorityMax, EMdaPriorityPreferenceTimeAndQuality)); |
|
257 if (err != KErrNone || iTestAudioOutputStream2 == NULL ) |
|
258 { |
|
259 INFO_PRINTF2(_L("Error Creating iTestAudioOutputStream2 = %d"), err); |
|
260 return EInconclusive; |
|
261 } |
|
262 |
|
263 // Open RFile#2 |
|
264 err = iFile2.Open(iFs, KStreamRawFile2, EFileRead); |
|
265 if (err != KErrNone) |
|
266 { |
|
267 INFO_PRINTF2(_L("Error opening iFile2 = %d"), err); |
|
268 return EFail; |
|
269 } |
|
270 |
|
271 // Get size of iFile2 |
|
272 err = iFile2.Size(iFileSize2); |
|
273 if (err != KErrNone) |
|
274 { |
|
275 INFO_PRINTF2(_L("Error getting size of iFile2 = %d"), err); |
|
276 return EFail; |
|
277 } |
|
278 |
|
279 // Initialise iBuf2 |
|
280 iBuf2.CreateMaxL(iFileSize2); |
|
281 |
|
282 // Initialise iTestAudioOutputStream3 |
|
283 INFO_PRINTF1(_L("Initialise CMdaAudioOutputStream3 : EMdaPriorityMin")); |
|
284 iMdaAudioOutputStreamCallbackSupport3 = CTestMdaAudioOutputStreamCallbackSupport::NewL(*this); |
|
285 TRAP(err, iTestAudioOutputStream3 = CMdaAudioOutputStream::NewL(*iMdaAudioOutputStreamCallbackSupport3, EMdaPriorityMin, EMdaPriorityPreferenceTimeAndQuality)); |
|
286 if (err != KErrNone || iTestAudioOutputStream3 == NULL ) |
|
287 { |
|
288 INFO_PRINTF2(_L("Error Creating iTestAudioOutputStream3 = %d"), err); |
|
289 return EInconclusive; |
|
290 } |
|
291 |
|
292 // Open RFile#3 |
|
293 err = iFile3.Open(iFs, KStreamRawFile3, EFileRead); |
|
294 if (err != KErrNone) |
|
295 { |
|
296 INFO_PRINTF2(_L("Error opening iFile3 = %d"), err); |
|
297 return EFail; |
|
298 } |
|
299 |
|
300 // Get size of iFile3 |
|
301 err = iFile3.Size(iFileSize3); |
|
302 if (err != KErrNone) |
|
303 { |
|
304 INFO_PRINTF2(_L("Error getting size of iFile3 = %d"), err); |
|
305 return EFail; |
|
306 } |
|
307 |
|
308 // Initialise iBuf3 |
|
309 iBuf3.CreateMaxL(iFileSize3); |
|
310 |
|
311 // Initialise the CCallBackTimer. |
|
312 iCallBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler)); |
|
313 |
|
314 return verdict; |
|
315 } |
|
316 |
|
317 /** |
|
318 * DoTestStepPostambleL |
|
319 */ |
|
320 TVerdict CTestStepAudioOutputStreamARN::DoTestStepPostambleL() |
|
321 { |
|
322 // Delete all the iTestAudioOutputStream utilities. |
|
323 delete iTestAudioOutputStream1; |
|
324 iTestAudioOutputStream1=NULL; |
|
325 delete iTestAudioOutputStream2; |
|
326 iTestAudioOutputStream2=NULL; |
|
327 delete iTestAudioOutputStream3; |
|
328 iTestAudioOutputStream3=NULL; |
|
329 // Destroy File Handles |
|
330 iFile1.Close(); |
|
331 iFile2.Close(); |
|
332 iFile3.Close(); |
|
333 iFs.Close(); |
|
334 // Delete RBuf8 |
|
335 iBuf1.Close(); |
|
336 iBuf2.Close(); |
|
337 iBuf3.Close(); |
|
338 // Delete CTestMdaAudioOutputStreamCallbackSupport |
|
339 delete iMdaAudioOutputStreamCallbackSupport1; |
|
340 delete iMdaAudioOutputStreamCallbackSupport2; |
|
341 delete iMdaAudioOutputStreamCallbackSupport3; |
|
342 // Delete the CCallBackTimer. |
|
343 delete iCallBackTimer; |
|
344 iCallBackTimer=NULL; |
|
345 // Destroy the scheduler |
|
346 return CTestMmfAclntStep::DoTestStepPostambleL(); |
|
347 } |
|
348 |
|
349 /** |
|
350 * DoTestStepL |
|
351 */ |
|
352 TVerdict CTestStepAudioOutputStreamARN::DoTestStepL() |
|
353 { |
|
354 return( DoTestL() ); |
|
355 } |
|
356 |
|
357 /** |
|
358 * StateInit |
|
359 */ |
|
360 void CTestStepAudioOutputStreamARN::StateInit() |
|
361 { |
|
362 iExpectedEvent=EIdleOutputStream; |
|
363 iExpectedError=KErrNone; |
|
364 iState=0; |
|
365 } |
|
366 |
|
367 /** |
|
368 * StateChange |
|
369 */ |
|
370 void CTestStepAudioOutputStreamARN::StateChange(TMmfAudioOutputStreamEvents aExpectedEvent, TInt aExpectedError) |
|
371 { |
|
372 iExpectedEvent=aExpectedEvent; |
|
373 iExpectedError=aExpectedError; |
|
374 iState++; |
|
375 } |
|
376 |
|
377 /** |
|
378 * FsmCheck |
|
379 */ |
|
380 TBool CTestStepAudioOutputStreamARN::FsmCheck(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
381 { |
|
382 TBool retFsmCheck = EFalse; |
|
383 if (iExpectedEvent != aEventCode) |
|
384 { |
|
385 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
386 iTestStepResult = EFail; |
|
387 CActiveScheduler::Stop(); |
|
388 } |
|
389 else if (iExpectedError != aError) |
|
390 { |
|
391 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
392 iTestStepResult = EFail; |
|
393 CActiveScheduler::Stop(); |
|
394 } |
|
395 else |
|
396 { |
|
397 retFsmCheck = ETrue; |
|
398 } |
|
399 return retFsmCheck; |
|
400 } |
|
401 |
|
402 CTestStepAudioOutputStreamARN2::CTestStepAudioOutputStreamARN2(const TDesC& aTestName) |
|
403 { |
|
404 iTestStepName = aTestName; |
|
405 iHeapSize = 3600000; |
|
406 } |
|
407 |
|
408 /** |
|
409 * DoTestStepPreambleL |
|
410 */ |
|
411 TVerdict CTestStepAudioOutputStreamARN2::DoTestStepPreambleL() |
|
412 { |
|
413 TVerdict verdict; |
|
414 verdict = CTestMmfAclntStep::DoTestStepPreambleL(); |
|
415 if (verdict == EFail) |
|
416 { |
|
417 return verdict; |
|
418 } |
|
419 |
|
420 iClientList[1] = CFsmAudioOutputStreamClient::NewL(1, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality, this); |
|
421 iClientList[2] = CFsmAudioOutputStreamClient::NewL(2, EMdaPriorityMax, EMdaPriorityPreferenceTimeAndQuality, this); |
|
422 iClientList[3] = CFsmAudioOutputStreamClient::NewL(3, EMdaPriorityMin, EMdaPriorityPreferenceTimeAndQuality, this); |
|
423 |
|
424 // Connect RFs session |
|
425 TInt err = iFs.Connect(); |
|
426 if (err != KErrNone) |
|
427 { |
|
428 INFO_PRINTF2(_L("Error connecting to File session (RFs) = %d"), err); |
|
429 return EFail; |
|
430 } |
|
431 |
|
432 err = iFileHandle[1].Open(iFs, KStreamRawFile1, EFileRead); |
|
433 if (err != KErrNone) |
|
434 { |
|
435 INFO_PRINTF2(_L("Error opening iFile1 = %d"), err); |
|
436 return EFail; |
|
437 } |
|
438 |
|
439 err = iFileHandle[2].Open(iFs, KStreamRawFile2, EFileRead); |
|
440 if (err != KErrNone) |
|
441 { |
|
442 INFO_PRINTF2(_L("Error opening iFile2 = %d"), err); |
|
443 return EFail; |
|
444 } |
|
445 |
|
446 err = iFileHandle[3].Open(iFs, KStreamRawFile3, EFileRead); |
|
447 if (err != KErrNone) |
|
448 { |
|
449 INFO_PRINTF2(_L("Error opening iFile2 = %d"), err); |
|
450 return EFail; |
|
451 } |
|
452 |
|
453 for(TInt fileNumber=1; fileNumber<=3; fileNumber++) |
|
454 { |
|
455 err = iFileHandle[fileNumber].Size(iFileSize[fileNumber]); |
|
456 if(err != KErrNone) |
|
457 { |
|
458 INFO_PRINTF2(_L("Error getting size of iFile = %d"), err); |
|
459 return EFail; |
|
460 } |
|
461 iBuf[fileNumber].CreateMaxL(iFileSize[fileNumber]); |
|
462 } |
|
463 |
|
464 // Initialise the CCallBackTimer. |
|
465 iCallBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler)); |
|
466 |
|
467 return verdict; |
|
468 } |
|
469 |
|
470 /** |
|
471 * DoTestStepPostambleL |
|
472 */ |
|
473 TVerdict CTestStepAudioOutputStreamARN2::DoTestStepPostambleL() |
|
474 { |
|
475 iClientList.DeleteAll(); |
|
476 for(TInt fileNumber=1; fileNumber <=3; fileNumber++) |
|
477 { |
|
478 iFileHandle[fileNumber].Close(); |
|
479 } |
|
480 |
|
481 for(TInt bufNumber=1 ; bufNumber <=3; bufNumber++) |
|
482 { |
|
483 iBuf[bufNumber].Close(); |
|
484 } |
|
485 |
|
486 delete iCallBackTimer; |
|
487 return CTestMmfAclntStep::DoTestStepPostambleL(); |
|
488 } |
|
489 |
|
490 |
|
491 /** |
|
492 * DoTestStepL |
|
493 */ |
|
494 TVerdict CTestStepAudioOutputStreamARN2::DoTestStepL() |
|
495 { |
|
496 return( DoTestL() ); |
|
497 } |
|
498 |
|
499 /** |
|
500 * StateChange |
|
501 */ |
|
502 void CTestStepAudioOutputStreamARN2::StateChange(TFsmAosState aState) |
|
503 { |
|
504 iState = aState; |
|
505 } |
|
506 |
|
507 void CTestStepAudioOutputStreamARN2::StopTest() |
|
508 { |
|
509 //We can add other cleanup things here |
|
510 CActiveScheduler::Stop(); |
|
511 } |
|
512 |
|
513 void CTestStepAudioOutputStreamARN2::SetExpectedEvent(TInt aClientNumber, TInt aExpectedEvent, TInt aExpectedError) |
|
514 { |
|
515 iClientEventsToMonitor[aClientNumber]= aExpectedEvent; |
|
516 iClientError[aClientNumber] = aExpectedError; |
|
517 } |
|
518 |
|
519 /** |
|
520 * FsmCheck |
|
521 */ |
|
522 TBool CTestStepAudioOutputStreamARN2::FsmCheck(TInt aClientNumber, TInt aEventCode, TInt aError) |
|
523 { |
|
524 TBool retFsmCheck = ETrue; |
|
525 |
|
526 if (iState == EStateMonitoringEvents) /*special state to make decisions depending on clients events */ |
|
527 { |
|
528 if(iClientEventsToMonitor[aClientNumber] == aEventCode && iClientError[aClientNumber] == aError ) |
|
529 { |
|
530 StateChange(iFsmStateforClient[aClientNumber]); |
|
531 } |
|
532 else |
|
533 { |
|
534 retFsmCheck = EFalse; |
|
535 } |
|
536 |
|
537 if(retFsmCheck) |
|
538 { |
|
539 //Client event has finished |
|
540 iClientsRegistered--; |
|
541 } |
|
542 } |
|
543 else |
|
544 { |
|
545 if(iClientEventsToMonitor[aClientNumber] != aEventCode) |
|
546 { |
|
547 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
548 retFsmCheck = EFalse; |
|
549 iTestStepResult = EFail; |
|
550 } |
|
551 else if(iClientError[aClientNumber] != aError) |
|
552 { |
|
553 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
554 retFsmCheck = EFalse; |
|
555 iTestStepResult = EFail; |
|
556 } |
|
557 } |
|
558 return retFsmCheck; |
|
559 } |
|
560 |
|
561 void CTestStepAudioOutputStreamARN2::RegisterClientEventToMonitor(TInt aClientNumber, TInt aEventCode, TInt aError, TFsmAosState aFsmState) |
|
562 { |
|
563 iClientsRegistered++; |
|
564 iClientEventsToMonitor[aClientNumber] = aEventCode; |
|
565 iClientError[aClientNumber] = aError; |
|
566 iFsmStateforClient[aClientNumber] = aFsmState; |
|
567 } |
|
568 |
|
569 TBool CTestStepAudioOutputStreamARN2::IsMonitoringFinished() |
|
570 { |
|
571 if(iClientsRegistered == 0) |
|
572 { |
|
573 return ETrue; |
|
574 } |
|
575 else |
|
576 { |
|
577 return EFalse; |
|
578 } |
|
579 } |
|
580 |
|
581 CFsmAudioOutputStreamClient::CFsmAudioOutputStreamClient(TInt aClientNumber, TInt aPriority, TMdaPriorityPreference aPref, CTestStepAudioOutputStreamARN2* aParent):iClientNumber(aClientNumber),iParent(aParent) |
|
582 { |
|
583 iPriority = aPriority; |
|
584 iPref = aPref; |
|
585 } |
|
586 |
|
587 /** |
|
588 * |
|
589 * NewL |
|
590 * CFsmAudioOutputStreamClient* |
|
591 * |
|
592 */ |
|
593 CFsmAudioOutputStreamClient* CFsmAudioOutputStreamClient::NewL(TInt aClientNumber, TInt aPriority,TMdaPriorityPreference aPref, CTestStepAudioOutputStreamARN2* aParent) |
|
594 { |
|
595 CFsmAudioOutputStreamClient* s = new(ELeave) CFsmAudioOutputStreamClient(aClientNumber, aPriority, aPref, aParent); |
|
596 CleanupStack::PushL(s); |
|
597 s->ConstructL(); |
|
598 CleanupStack::Pop(); |
|
599 return s; |
|
600 } |
|
601 |
|
602 /** |
|
603 * |
|
604 * ConstructL |
|
605 * @result void |
|
606 * |
|
607 */ |
|
608 void CFsmAudioOutputStreamClient::ConstructL() |
|
609 { |
|
610 iMmfAudioOutputStream = CMdaAudioOutputStream::NewL(*this, iPriority, iPref); |
|
611 } |
|
612 |
|
613 CFsmAudioOutputStreamClient::~CFsmAudioOutputStreamClient() |
|
614 { |
|
615 delete iMmfAudioOutputStream; |
|
616 } |
|
617 |
|
618 void CFsmAudioOutputStreamClient::MaoscOpenComplete(TInt aError) |
|
619 { |
|
620 iEvent = EAudioOuputStreamOpenComplete; |
|
621 iError = aError; |
|
622 iParent->Fsm(iClientNumber, iEvent, iError); |
|
623 } |
|
624 |
|
625 void CFsmAudioOutputStreamClient::MaoscPlayComplete(TInt aError) |
|
626 { |
|
627 iEvent = EAudioOutputStreamPlayComplete; |
|
628 iError = aError; |
|
629 iParent->Fsm(iClientNumber, iEvent, iError); |
|
630 } |
|
631 |
|
632 void CFsmAudioOutputStreamClient::MaoscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/) |
|
633 { |
|
634 iEvent = EAudioOutputStreamBufferCopied; |
|
635 iError = aError; |
|
636 iParent->Fsm(iClientNumber, iEvent, iError); |
|
637 } |
|
638 |
|
639 void CFsmAudioOutputStreamClient::MarncResourceAvailable(TUid aNotificationEventId, const TDesC8& aNotificationData) |
|
640 { |
|
641 if (aNotificationEventId == KMMFEventCategoryAudioResourceAvailable) |
|
642 { |
|
643 iEvent = EAudioOutputStreamResourceAvailable; |
|
644 iError = KErrNone; |
|
645 //Convert TDesc8 to TInt64 |
|
646 TMMFTimeIntervalMicroSecondsPckg timeIntvbuf; |
|
647 timeIntvbuf.Copy(aNotificationData); |
|
648 iResumedPosition = timeIntvbuf(); |
|
649 |
|
650 iParent->Fsm(iClientNumber, iEvent, iError); |
|
651 } |
|
652 } |
|
653 |
|
654 void CFsmAudioOutputStreamClient::TestOpen() |
|
655 { |
|
656 iMmfAudioOutputStream->Open(NULL); |
|
657 } |
|
658 |
|
659 TInt CFsmAudioOutputStreamClient::TestRegisterAsClient() |
|
660 { |
|
661 return iMmfAudioOutputStream->RegisterAudioResourceNotification(*this, KMMFEventCategoryAudioResourceAvailable); |
|
662 } |
|
663 |
|
664 TInt CFsmAudioOutputStreamClient::TestWrite(const TDesC8 &aData) |
|
665 { |
|
666 TRAPD(err,iMmfAudioOutputStream->WriteL(aData)); |
|
667 return err; |
|
668 } |
|
669 |
|
670 const TTimeIntervalMicroSeconds& CFsmAudioOutputStreamClient::GetCurrentPosition() |
|
671 { |
|
672 return iMmfAudioOutputStream->Position(); |
|
673 } |
|
674 |
|
675 TTimeIntervalMicroSeconds& CFsmAudioOutputStreamClient::GetResumedPosition() |
|
676 { |
|
677 return iResumedPosition; |
|
678 } |
|
679 |
|
680 TInt CFsmAudioOutputStreamClient::BytesPlayed() |
|
681 { |
|
682 return iMmfAudioOutputStream->GetBytes(); |
|
683 } |
|
684 // |
|
685 //POSITIVE TESTS// |
|
686 // |
|
687 |
|
688 // |
|
689 //CTestMmfAclntARN8021 |
|
690 // |
|
691 |
|
692 /** |
|
693 * Constructor |
|
694 */ |
|
695 CTestMmfAclntARN8021::CTestMmfAclntARN8021(const TDesC& aTestName) |
|
696 : CTestStepAudioOutputStreamARN(aTestName) |
|
697 {} |
|
698 |
|
699 /** |
|
700 * NewL |
|
701 */ |
|
702 CTestMmfAclntARN8021* CTestMmfAclntARN8021::NewL(const TDesC& aTestName) |
|
703 { |
|
704 CTestMmfAclntARN8021* self = new (ELeave) CTestMmfAclntARN8021(aTestName); |
|
705 return self; |
|
706 } |
|
707 |
|
708 /** |
|
709 * DoTestL |
|
710 */ |
|
711 TVerdict CTestMmfAclntARN8021::DoTestL() |
|
712 { |
|
713 return( PerformTestL() ); |
|
714 } |
|
715 |
|
716 /** |
|
717 * FsmL |
|
718 */ |
|
719 void CTestMmfAclntARN8021::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
720 { |
|
721 if (FsmCheck(aEventCode, aError)) |
|
722 { |
|
723 TInt err = KErrNone; |
|
724 switch (iState) |
|
725 { |
|
726 case 0: |
|
727 // Open iTestAudioOutputStream1 |
|
728 iTestAudioOutputStream1->Open(NULL); |
|
729 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
730 // Set ExpectedEvent & ExpectedError and change the State |
|
731 StateChange(EMaoscOpenComplete1); |
|
732 break; |
|
733 case 1: |
|
734 // Register iTestAudioOutputStream1 for Notification |
|
735 err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
736 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()")); |
|
737 if( err != KErrNone ) |
|
738 { |
|
739 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
740 iTestStepResult = EFail; |
|
741 CActiveScheduler::Stop(); |
|
742 User::Leave(err); |
|
743 break; |
|
744 } |
|
745 // Open iTestAudioOutputStream2 |
|
746 iTestAudioOutputStream2->Open(NULL); |
|
747 INFO_PRINTF1(_L("iTestAudioOutputStream2->Open()")); |
|
748 // Set ExpectedEvent & ExpectedError and change the State |
|
749 StateChange(EMaoscOpenComplete2); |
|
750 break; |
|
751 case 2: |
|
752 // iFile2->Read() |
|
753 err = iFile2.Read(iBuf2); |
|
754 if (err != KErrNone) |
|
755 { |
|
756 INFO_PRINTF2(_L("Error reading file %d"), err); |
|
757 User::Leave(err); |
|
758 } |
|
759 // iTestAudioOutputStream2->WriteL() |
|
760 iTestAudioOutputStream2->WriteL(iBuf2); |
|
761 INFO_PRINTF1(_L("iTestAudioOutputStream2->WriteL()")); |
|
762 // Set ExpectedEvent & ExpectedError and change the State |
|
763 StateChange(EMaoscBufferCopied2); |
|
764 break; |
|
765 case 3: |
|
766 // Wait for PlayComplete event for iTestAudioOutputStream2 |
|
767 // Set ExpectedEvent & ExpectedError and change the State |
|
768 StateChange(EMaoscPlayComplete2, KErrUnderflow); |
|
769 break; |
|
770 case 4: |
|
771 // Timer to check if Notification Event Occurs. |
|
772 iCallBackTimer->After(2000000); |
|
773 iTestStepResult = EPass; |
|
774 // Set ExpectedEvent & ExpectedError and change the State |
|
775 StateChange(EMarncResourceAvailableOS1); |
|
776 break; |
|
777 case 5: |
|
778 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
779 INFO_PRINTF1(_L("iTestAudioOutputStream1->NotificationReceived")); |
|
780 iTestStepResult = EFail; |
|
781 CActiveScheduler::Stop(); |
|
782 break; |
|
783 } |
|
784 } |
|
785 } |
|
786 |
|
787 /** |
|
788 * PerformTestL |
|
789 */ |
|
790 TVerdict CTestMmfAclntARN8021::PerformTestL() |
|
791 { |
|
792 INFO_PRINTF1(_L("Register for notification, but make no request to play audio")); |
|
793 iTestStepResult = EFail; |
|
794 |
|
795 // Initialise the state variables |
|
796 StateInit(); |
|
797 |
|
798 // Begin the process |
|
799 FsmL(EIdleOutputStream); |
|
800 |
|
801 // Start the scheduler - Done only once ! |
|
802 CActiveScheduler::Start(); |
|
803 |
|
804 return iTestStepResult; |
|
805 } |
|
806 |
|
807 // |
|
808 //CTestMmfAclntARN8022 |
|
809 // |
|
810 |
|
811 /** |
|
812 * Constructor |
|
813 */ |
|
814 CTestMmfAclntARN8022::CTestMmfAclntARN8022(const TDesC& aTestName) |
|
815 : CTestStepAudioOutputStreamARN2(aTestName) |
|
816 {} |
|
817 |
|
818 /** |
|
819 * NewL |
|
820 */ |
|
821 CTestMmfAclntARN8022* CTestMmfAclntARN8022::NewL(const TDesC& aTestName) |
|
822 { |
|
823 CTestMmfAclntARN8022* self = new (ELeave) CTestMmfAclntARN8022(aTestName); |
|
824 return self; |
|
825 } |
|
826 |
|
827 /** |
|
828 * DoTestL |
|
829 */ |
|
830 TVerdict CTestMmfAclntARN8022::DoTestL() |
|
831 { |
|
832 return( PerformTestL() ); |
|
833 } |
|
834 |
|
835 /** |
|
836 * FsmL |
|
837 */ |
|
838 void CTestMmfAclntARN8022::Fsm(TInt aClientNumber, TInt aEventCode, TInt aError) |
|
839 { |
|
840 if (FsmCheck(aClientNumber, aEventCode, aError)) |
|
841 { |
|
842 iTestStepResult = (this->*(iStateHandlers[iState]))(); |
|
843 if(iTestStepResult != EPass) |
|
844 { |
|
845 StopTest(); |
|
846 } |
|
847 } |
|
848 } |
|
849 |
|
850 |
|
851 void CTestMmfAclntARN8022::StartTestL() |
|
852 { |
|
853 iClientList[1]->TestOpen(); |
|
854 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
855 //Wait for EAudioOuputStreamOpenComplete event |
|
856 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOuputStreamOpenComplete,KErrNone); |
|
857 StateChange(EStateOpenComplete1); |
|
858 } |
|
859 |
|
860 void CTestMmfAclntARN8022::InitTest() |
|
861 { |
|
862 iStateHandlers[EStateOpenComplete1] = &CTestMmfAclntARN8022::HandleStateOpenComplete1; |
|
863 iStateHandlers[EStateOpenComplete2] = &CTestMmfAclntARN8022::HandleStateOpenComplete2; |
|
864 iStateHandlers[EStateStreaming2] = &CTestMmfAclntARN8022::HandleStateStreaming2; |
|
865 iStateHandlers[EStateStreamingComplete1ErrInUse] = &CTestMmfAclntARN8022::HandleStateStreamingComplete1ErrInUse; |
|
866 iStateHandlers[EStateResourceAvailableOS1] = &CTestMmfAclntARN8022::HandleStateResourceAvailableOS1; |
|
867 iStateHandlers[EStateStreamingComplete2ErrUnderflow] = &CTestMmfAclntARN8022::HandleStateStreamingComplete2ErrUnderflow; |
|
868 } |
|
869 |
|
870 TVerdict CTestMmfAclntARN8022::HandleStateOpenComplete1() |
|
871 { |
|
872 // Register Client1 for Notification |
|
873 TInt err = KErrNone; |
|
874 err = iClientList[1]->TestRegisterAsClient(); |
|
875 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()")); |
|
876 if(err != KErrNone) |
|
877 { |
|
878 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
879 User::Leave(err); |
|
880 } |
|
881 iClientList[2]->TestOpen(); |
|
882 //Wait for EAudioOuputStreamOpenComplete event |
|
883 SetExpectedEvent(2,CFsmAudioOutputStreamClient::EAudioOuputStreamOpenComplete,KErrNone); |
|
884 StateChange(EStateOpenComplete2); |
|
885 return EPass; |
|
886 } |
|
887 |
|
888 TVerdict CTestMmfAclntARN8022::HandleStateOpenComplete2() |
|
889 { |
|
890 INFO_PRINTF1(_L("iTestAudioOutputStream2->Open()")); |
|
891 TInt err = iFileHandle[2].Read(iBuf[2]); |
|
892 if (err != KErrNone) |
|
893 { |
|
894 INFO_PRINTF2(_L("Error reading file %d"), err); |
|
895 User::Leave(err); |
|
896 } |
|
897 INFO_PRINTF1(_L("Pre iTestAudioOutputStream2->WriteL()")); |
|
898 err = iClientList[2]->TestWrite(iBuf[2]); |
|
899 if( err != KErrNone) |
|
900 { |
|
901 INFO_PRINTF2(_L("iTestAudioOutputStream2->WriteL failed %d"),err); |
|
902 User::Leave(err); |
|
903 } |
|
904 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
905 SetExpectedEvent(2,CFsmAudioOutputStreamClient::EAudioOutputStreamBufferCopied,KErrNone); |
|
906 StateChange(EStateStreaming2); |
|
907 return EPass; |
|
908 } |
|
909 |
|
910 TVerdict CTestMmfAclntARN8022::HandleStateStreaming2() |
|
911 { |
|
912 TInt err = KErrNone; |
|
913 err = iFileHandle[1].Read(iBuf[1]); //-synchronous |
|
914 if (err != KErrNone) |
|
915 { |
|
916 INFO_PRINTF2(_L("Error reading iFile1 %d"), err); |
|
917 return EInconclusive; |
|
918 } |
|
919 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
920 err = iClientList[1]->TestWrite(iBuf[1]); //-Should get Play Error. |
|
921 if( err != KErrNone) |
|
922 { |
|
923 INFO_PRINTF2(_L("iTestAudioOutputStream1->WriteL failed %d"),err); |
|
924 return EInconclusive; |
|
925 } |
|
926 // Set ExpectedEvent & ExpectedError and change the State |
|
927 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOutputStreamPlayComplete, KErrInUse); |
|
928 StateChange(EStateStreamingComplete1ErrInUse); |
|
929 return EPass; |
|
930 } |
|
931 |
|
932 TVerdict CTestMmfAclntARN8022::HandleStateStreamingComplete1ErrInUse() |
|
933 { |
|
934 RegisterClientEventToMonitor(1, CFsmAudioOutputStreamClient::EAudioOutputStreamResourceAvailable, KErrNone, EStateResourceAvailableOS1); |
|
935 RegisterClientEventToMonitor(2, CFsmAudioOutputStreamClient::EAudioOutputStreamPlayComplete, KErrUnderflow, EStateStreamingComplete2ErrUnderflow); |
|
936 StateChange(EStateMonitoringEvents); |
|
937 return EPass; |
|
938 } |
|
939 |
|
940 TVerdict CTestMmfAclntARN8022::HandleStateResourceAvailableOS1() |
|
941 { |
|
942 INFO_PRINTF1(_L("iTestAudioOutputStream1->NotificationReceived")); |
|
943 if(IsMonitoringFinished()) |
|
944 { |
|
945 iTestStepResult = EPass; |
|
946 StopTest(); |
|
947 } |
|
948 else |
|
949 { |
|
950 StateChange(EStateMonitoringEvents); |
|
951 } |
|
952 return EPass; |
|
953 } |
|
954 |
|
955 TVerdict CTestMmfAclntARN8022::HandleStateStreamingComplete2ErrUnderflow() |
|
956 { |
|
957 INFO_PRINTF1(_L("iTestAudioOutputStream2->PlayComplete")); |
|
958 if(IsMonitoringFinished()) |
|
959 { |
|
960 iTestStepResult = EPass; |
|
961 StopTest(); |
|
962 } |
|
963 else |
|
964 { |
|
965 StateChange(EStateMonitoringEvents); |
|
966 } |
|
967 return EPass; |
|
968 } |
|
969 |
|
970 /** |
|
971 * PerformTestL |
|
972 */ |
|
973 TVerdict CTestMmfAclntARN8022::PerformTestL() |
|
974 { |
|
975 INFO_PRINTF1(_L("Register (b4 play, after Open) and Receive Notification of a Resource Available Event.")); |
|
976 INFO_PRINTF1(_L("(when audio resource is currently unavailable and then available)")); |
|
977 iTestStepResult = EFail; |
|
978 |
|
979 InitTest(); |
|
980 StartTestL(); |
|
981 |
|
982 // Start the scheduler - Done only once ! |
|
983 CActiveScheduler::Start(); |
|
984 |
|
985 return iTestStepResult; |
|
986 } |
|
987 |
|
988 // |
|
989 //CTestMmfAclntARN8023 |
|
990 // |
|
991 |
|
992 /** |
|
993 * Constructor |
|
994 */ |
|
995 CTestMmfAclntARN8023::CTestMmfAclntARN8023(const TDesC& aTestName) |
|
996 : CTestStepAudioOutputStreamARN2(aTestName) |
|
997 {} |
|
998 |
|
999 /** |
|
1000 * NewL |
|
1001 */ |
|
1002 CTestMmfAclntARN8023* CTestMmfAclntARN8023::NewL(const TDesC& aTestName) |
|
1003 { |
|
1004 CTestMmfAclntARN8023* self = new (ELeave) CTestMmfAclntARN8023(aTestName); |
|
1005 return self; |
|
1006 } |
|
1007 |
|
1008 /** |
|
1009 * DoTestL |
|
1010 */ |
|
1011 TVerdict CTestMmfAclntARN8023::DoTestL() |
|
1012 { |
|
1013 return( PerformTestL() ); |
|
1014 } |
|
1015 |
|
1016 |
|
1017 /** |
|
1018 * FsmL |
|
1019 */ |
|
1020 void CTestMmfAclntARN8023::Fsm(TInt aClientNumber, TInt aEventCode, TInt aError) |
|
1021 { |
|
1022 if(FsmCheck(aClientNumber, aEventCode, aError)) |
|
1023 { |
|
1024 iTestStepResult = (this->*(iStateHandlers[iState]))(); |
|
1025 if(iTestStepResult != EPass) |
|
1026 { |
|
1027 StopTest(); |
|
1028 } |
|
1029 } |
|
1030 } |
|
1031 |
|
1032 void CTestMmfAclntARN8023::InitTest() |
|
1033 { |
|
1034 iStateHandlers[EStateOpenComplete1] = &CTestMmfAclntARN8023::HandleStateOpenComplete1; |
|
1035 iStateHandlers[EStateOpenComplete2] = &CTestMmfAclntARN8023::HandleStateOpenComplete2; |
|
1036 iStateHandlers[EStateStreaming1] = &CTestMmfAclntARN8023::HandleStateStreaming1; |
|
1037 iStateHandlers[EStateStreaming2] = &CTestMmfAclntARN8023::HandleStateStreaming2; |
|
1038 iStateHandlers[EStateStreamingComplete1ErrInUse] = &CTestMmfAclntARN8023::HandleStateStreamingComplete1ErrInUse; |
|
1039 iStateHandlers[EStateResourceAvailableOS1] = &CTestMmfAclntARN8023::HandleStateResourceAvailableOS1; |
|
1040 iStateHandlers[EStateStreamingComplete2ErrUnderflow] = &CTestMmfAclntARN8023::HandleStateStreamingComplete2ErrUnderflow; |
|
1041 } |
|
1042 |
|
1043 void CTestMmfAclntARN8023::StartTestL() |
|
1044 { |
|
1045 //Open Client1 |
|
1046 iClientList[1]->TestOpen(); |
|
1047 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
1048 //Wait for EAudioOuputStreamOpenComplete event |
|
1049 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOuputStreamOpenComplete,KErrNone); |
|
1050 StateChange(EStateOpenComplete1); |
|
1051 } |
|
1052 |
|
1053 TVerdict CTestMmfAclntARN8023::HandleStateOpenComplete1() |
|
1054 { |
|
1055 TInt err = KErrNone; |
|
1056 err = iFileHandle[1].Read(iBuf[1]); |
|
1057 if(err != KErrNone) |
|
1058 { |
|
1059 INFO_PRINTF2(_L("Error reading iFile1 %d"), err); |
|
1060 User::Leave(err); |
|
1061 } |
|
1062 err = iClientList[1]->TestWrite(iBuf[1]); |
|
1063 if( err != KErrNone) |
|
1064 { |
|
1065 INFO_PRINTF2(_L("iTestAudioOutputStream1->WriteL failed %d"),err); |
|
1066 User::Leave(err); |
|
1067 } |
|
1068 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
1069 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOutputStreamBufferCopied,KErrNone); |
|
1070 StateChange(EStateStreaming1); |
|
1071 return EPass; |
|
1072 } |
|
1073 |
|
1074 TVerdict CTestMmfAclntARN8023::HandleStateStreaming1() |
|
1075 { |
|
1076 TInt err = KErrNone; |
|
1077 err = iClientList[1]->TestRegisterAsClient(); |
|
1078 if(err != KErrNone) |
|
1079 { |
|
1080 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1081 return EInconclusive; |
|
1082 } |
|
1083 |
|
1084 iClientList[2]->TestOpen(); |
|
1085 //Wait for EAudioOuputStreamOpenComplete event |
|
1086 SetExpectedEvent(2,CFsmAudioOutputStreamClient::EAudioOuputStreamOpenComplete,KErrNone); |
|
1087 StateChange(EStateOpenComplete2); |
|
1088 return EPass; |
|
1089 } |
|
1090 |
|
1091 TVerdict CTestMmfAclntARN8023::HandleStateOpenComplete2() |
|
1092 { |
|
1093 TInt err = iFileHandle[2].Read(iBuf[2]); |
|
1094 if(err != KErrNone) |
|
1095 { |
|
1096 INFO_PRINTF2(_L("Error reading iFile2 %d"), err); |
|
1097 return EInconclusive; |
|
1098 } |
|
1099 err = iClientList[2]->TestWrite(iBuf[2]); |
|
1100 if( err != KErrNone) |
|
1101 { |
|
1102 INFO_PRINTF2(_L("iTestAudioOutputStream2->WriteL failed %d"),err); |
|
1103 return EInconclusive; |
|
1104 } |
|
1105 INFO_PRINTF1(_L("iTestAudioOutputStream2->WriteL()")); |
|
1106 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOutputStreamPlayComplete, KErrInUse); |
|
1107 StateChange(EStateStreamingComplete1ErrInUse); |
|
1108 return EPass; |
|
1109 } |
|
1110 |
|
1111 TVerdict CTestMmfAclntARN8023::HandleStateStreamingComplete1ErrInUse() |
|
1112 { |
|
1113 SetExpectedEvent(2,CFsmAudioOutputStreamClient::EAudioOutputStreamBufferCopied,KErrNone); |
|
1114 StateChange(EStateStreaming2); |
|
1115 return EPass; |
|
1116 } |
|
1117 |
|
1118 TVerdict CTestMmfAclntARN8023::HandleStateStreaming2() |
|
1119 { |
|
1120 RegisterClientEventToMonitor(1,CFsmAudioOutputStreamClient::EAudioOutputStreamResourceAvailable,KErrNone,EStateResourceAvailableOS1); |
|
1121 RegisterClientEventToMonitor(2,CFsmAudioOutputStreamClient::EAudioOutputStreamPlayComplete,KErrUnderflow,EStateStreamingComplete2ErrUnderflow); |
|
1122 StateChange(EStateMonitoringEvents); |
|
1123 return EPass; |
|
1124 } |
|
1125 |
|
1126 TVerdict CTestMmfAclntARN8023::HandleStateResourceAvailableOS1() |
|
1127 { |
|
1128 INFO_PRINTF1(_L("iTestAudioOutputStream1->NotificationReceived")); |
|
1129 if(IsMonitoringFinished()) |
|
1130 { |
|
1131 iTestStepResult = EPass; |
|
1132 StopTest(); |
|
1133 } |
|
1134 else |
|
1135 { |
|
1136 StateChange(EStateMonitoringEvents); |
|
1137 } |
|
1138 return EPass; |
|
1139 } |
|
1140 |
|
1141 TVerdict CTestMmfAclntARN8023::HandleStateStreamingComplete2ErrUnderflow() |
|
1142 { |
|
1143 INFO_PRINTF1(_L("iTestAudioOutputStream2->PlayComplete")); |
|
1144 if(IsMonitoringFinished()) |
|
1145 { |
|
1146 iTestStepResult = EPass; |
|
1147 StopTest(); |
|
1148 } |
|
1149 else |
|
1150 { |
|
1151 StateChange(EStateMonitoringEvents); //Didn't finish monitoring |
|
1152 } |
|
1153 return EPass; |
|
1154 } |
|
1155 |
|
1156 /** |
|
1157 * PerformTestL |
|
1158 */ |
|
1159 TVerdict CTestMmfAclntARN8023::PerformTestL() |
|
1160 { |
|
1161 INFO_PRINTF1(_L("Register (at the time of Play) and Receive Notification of a Resource Available Event.")); |
|
1162 INFO_PRINTF1(_L("(when audio resource is currently available and subsequently unavailable, and then available)")); |
|
1163 iTestStepResult = EFail; |
|
1164 |
|
1165 InitTest(); |
|
1166 |
|
1167 StartTestL(); |
|
1168 |
|
1169 // Start the scheduler - Done only once ! |
|
1170 CActiveScheduler::Start(); |
|
1171 |
|
1172 return iTestStepResult; |
|
1173 } |
|
1174 |
|
1175 // |
|
1176 //CTestMmfAclntARN8024 |
|
1177 // |
|
1178 |
|
1179 /** |
|
1180 * Constructor |
|
1181 */ |
|
1182 CTestMmfAclntARN8024::CTestMmfAclntARN8024(const TDesC& aTestName) |
|
1183 : CTestStepAudioOutputStreamARN(aTestName) |
|
1184 {} |
|
1185 |
|
1186 /** |
|
1187 * NewL |
|
1188 */ |
|
1189 CTestMmfAclntARN8024* CTestMmfAclntARN8024::NewL(const TDesC& aTestName) |
|
1190 { |
|
1191 CTestMmfAclntARN8024* self = new (ELeave) CTestMmfAclntARN8024(aTestName); |
|
1192 return self; |
|
1193 } |
|
1194 |
|
1195 /** |
|
1196 * DoTestL |
|
1197 */ |
|
1198 TVerdict CTestMmfAclntARN8024::DoTestL() |
|
1199 { |
|
1200 return( PerformTestL() ); |
|
1201 } |
|
1202 |
|
1203 /** |
|
1204 * FsmL |
|
1205 */ |
|
1206 void CTestMmfAclntARN8024::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
1207 { |
|
1208 if (FsmCheck(aEventCode, aError)) |
|
1209 { |
|
1210 TInt err = KErrNone; |
|
1211 switch (iState) |
|
1212 { |
|
1213 case 0: |
|
1214 // Open iTestAudioOutputStream1 |
|
1215 iTestAudioOutputStream1->Open(NULL); |
|
1216 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
1217 // Set ExpectedEvent & ExpectedError and change the State |
|
1218 StateChange(EMaoscOpenComplete1); |
|
1219 break; |
|
1220 case 1: |
|
1221 // iFile1->Read() |
|
1222 err = iFile1.Read(iBuf1); //-synchronous |
|
1223 if (err != KErrNone) |
|
1224 { |
|
1225 INFO_PRINTF2(_L("Error reading iFile1 %d"), err); |
|
1226 User::Leave(err); |
|
1227 } |
|
1228 // iTestAudioOutputStream1->WriteL() |
|
1229 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
1230 iTestAudioOutputStream1->WriteL(iBuf1); //-Should get Play Error. |
|
1231 // Set ExpectedEvent & ExpectedError and change the State |
|
1232 StateChange(EMaoscBufferCopied1); |
|
1233 break; |
|
1234 case 2: |
|
1235 // Open iTestAudioOutputStream2 |
|
1236 iTestAudioOutputStream2->Open(NULL); |
|
1237 INFO_PRINTF1(_L("iTestAudioOutputStream2->Open()")); |
|
1238 // Set ExpectedEvent & ExpectedError and change the State |
|
1239 StateChange(EMaoscOpenComplete2); |
|
1240 break; |
|
1241 case 3: |
|
1242 // iFile2->Read() |
|
1243 err = iFile2.Read(iBuf2); |
|
1244 if (err != KErrNone) |
|
1245 { |
|
1246 INFO_PRINTF2(_L("Error reading file %d"), err); |
|
1247 User::Leave(err); |
|
1248 } |
|
1249 // iTestAudioOutputStream2->WriteL() |
|
1250 iTestAudioOutputStream2->WriteL(iBuf2); |
|
1251 INFO_PRINTF1(_L("iTestAudioOutputStream2->WriteL()")); |
|
1252 // Set ExpectedEvent & ExpectedError and change the State |
|
1253 StateChange(EMaoscPlayComplete1, KErrInUse); |
|
1254 break; |
|
1255 case 4: |
|
1256 // Wait for BufferCopied event for iTestAudioOutputStream2 |
|
1257 // Set ExpectedEvent & ExpectedError and change the State |
|
1258 StateChange(EMaoscBufferCopied2); |
|
1259 break; |
|
1260 case 5: |
|
1261 // Cancellation of notification request for iTestAudioOutputStream1 |
|
1262 err = iTestAudioOutputStream1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable); |
|
1263 INFO_PRINTF2(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification : Return Code = %d "), err); |
|
1264 if( err != KErrNone ) |
|
1265 { |
|
1266 ERR_PRINTF2(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1267 iTestStepResult = EFail; |
|
1268 CActiveScheduler::Stop(); |
|
1269 User::Leave(err); |
|
1270 break; |
|
1271 } |
|
1272 // Wait for PlayComplete event for iTestAudioOutputStream2 |
|
1273 // Set ExpectedEvent & ExpectedError and change the State |
|
1274 StateChange(EMaoscPlayComplete2, KErrUnderflow); |
|
1275 break; |
|
1276 case 6: |
|
1277 // Timer to check if Notification Event Occurs. |
|
1278 iCallBackTimer->After(2000000); |
|
1279 iTestStepResult = EPass; |
|
1280 // Set ExpectedEvent & ExpectedError and change the State |
|
1281 StateChange(EMarncResourceAvailableOS1); |
|
1282 break; |
|
1283 case 7: |
|
1284 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1285 INFO_PRINTF1(_L("iTestAudioOutputStream1->NotificationReceived")); |
|
1286 iTestStepResult = EFail; |
|
1287 CActiveScheduler::Stop(); |
|
1288 break; |
|
1289 } |
|
1290 } |
|
1291 } |
|
1292 |
|
1293 /** |
|
1294 * PerformTestL |
|
1295 */ |
|
1296 TVerdict CTestMmfAclntARN8024::PerformTestL() |
|
1297 { |
|
1298 INFO_PRINTF1(_L("Registration (b4 File Open) and Cancellation of the notification request")); |
|
1299 iTestStepResult = EFail; |
|
1300 |
|
1301 // Initialise the state variables |
|
1302 StateInit(); |
|
1303 |
|
1304 // Register iTestAudioOutputStream1 for Notification |
|
1305 TInt err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1306 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()")); |
|
1307 if( err != KErrNone ) |
|
1308 { |
|
1309 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1310 return EFail; |
|
1311 } |
|
1312 |
|
1313 // Begin the process |
|
1314 FsmL(EIdleOutputStream); |
|
1315 |
|
1316 // Start the scheduler - Done only once ! |
|
1317 CActiveScheduler::Start(); |
|
1318 |
|
1319 return iTestStepResult; |
|
1320 } |
|
1321 |
|
1322 // |
|
1323 //CTestMmfAclntARN8025 |
|
1324 // |
|
1325 |
|
1326 /** |
|
1327 * Constructor |
|
1328 */ |
|
1329 CTestMmfAclntARN8025::CTestMmfAclntARN8025(const TDesC& aTestName) |
|
1330 : CTestStepAudioOutputStreamARN2(aTestName) |
|
1331 {} |
|
1332 |
|
1333 /** |
|
1334 * NewL |
|
1335 */ |
|
1336 CTestMmfAclntARN8025* CTestMmfAclntARN8025::NewL(const TDesC& aTestName) |
|
1337 { |
|
1338 CTestMmfAclntARN8025* self = new (ELeave) CTestMmfAclntARN8025(aTestName); |
|
1339 return self; |
|
1340 } |
|
1341 |
|
1342 /** |
|
1343 * DoTestL |
|
1344 */ |
|
1345 TVerdict CTestMmfAclntARN8025::DoTestL() |
|
1346 { |
|
1347 return( PerformTestL() ); |
|
1348 } |
|
1349 |
|
1350 |
|
1351 void CTestMmfAclntARN8025::InitTest() |
|
1352 { |
|
1353 iStateHandlers[EStateOpenComplete1] = &CTestMmfAclntARN8025::HandleStateOpenComplete1; |
|
1354 iStateHandlers[EStateOpenComplete2] = &CTestMmfAclntARN8025::HandleStateOpenComplete2; |
|
1355 iStateHandlers[EStateStreaming1] = &CTestMmfAclntARN8025::HandleStateStreaming1; |
|
1356 iStateHandlers[EStateStreaming2] = &CTestMmfAclntARN8025::HandleStateStreaming2; |
|
1357 iStateHandlers[EStateStreamingComplete1ErrInUse] = &CTestMmfAclntARN8025::HandleStateStreamingComplete1ErrInUse; |
|
1358 iStateHandlers[EStateResourceAvailableOS1] = &CTestMmfAclntARN8025::HandleStateResourceAvailableOS1; |
|
1359 iStateHandlers[EStateStreamingComplete2ErrUnderflow] = &CTestMmfAclntARN8025::HandleStateStreamingComplete2ErrUnderflow; |
|
1360 } |
|
1361 |
|
1362 /** |
|
1363 * FsmL |
|
1364 */ |
|
1365 void CTestMmfAclntARN8025::Fsm(TInt aClientNumber, TInt aEventCode, TInt aError) |
|
1366 { |
|
1367 if(FsmCheck(aClientNumber, aEventCode, aError)) |
|
1368 { |
|
1369 iTestStepResult = (this->*(iStateHandlers[iState]))(); |
|
1370 if(iTestStepResult != EPass) |
|
1371 { |
|
1372 StopTest(); |
|
1373 } |
|
1374 } |
|
1375 } |
|
1376 |
|
1377 void CTestMmfAclntARN8025::StartTestL() |
|
1378 { |
|
1379 //Open Client1 |
|
1380 iClientList[1]->TestOpen(); |
|
1381 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
1382 //Wait for EAudioOuputStreamOpenComplete event |
|
1383 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOuputStreamOpenComplete,KErrNone); |
|
1384 StateChange(EStateOpenComplete1); |
|
1385 } |
|
1386 |
|
1387 TVerdict CTestMmfAclntARN8025::HandleStateOpenComplete1() |
|
1388 { |
|
1389 TInt err = KErrNone; |
|
1390 err = iFileHandle[1].Read(iBuf[1]); |
|
1391 if(err != KErrNone) |
|
1392 { |
|
1393 INFO_PRINTF2(_L("Error reading iFile1 %d"), err); |
|
1394 User::Leave(err); |
|
1395 } |
|
1396 err = iClientList[1]->TestWrite(iBuf[1]); |
|
1397 if( err != KErrNone) |
|
1398 { |
|
1399 INFO_PRINTF2(_L("iTestAudioOutputStream1->WriteL failed %d"),err); |
|
1400 User::Leave(err); |
|
1401 } |
|
1402 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
1403 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOutputStreamBufferCopied,KErrNone); |
|
1404 StateChange(EStateStreaming1); |
|
1405 return EPass; |
|
1406 } |
|
1407 |
|
1408 TVerdict CTestMmfAclntARN8025::HandleStateStreaming1() |
|
1409 { |
|
1410 TInt err = KErrNone; |
|
1411 err = iClientList[1]->TestRegisterAsClient(); |
|
1412 if(err != KErrNone) |
|
1413 { |
|
1414 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1415 return EInconclusive; |
|
1416 } |
|
1417 |
|
1418 iClientList[2]->TestOpen(); |
|
1419 INFO_PRINTF1(_L("iTestAudioOutputStream2->Open()")); |
|
1420 //Wait for EAudioOuputStreamOpenComplete event |
|
1421 SetExpectedEvent(2,CFsmAudioOutputStreamClient::EAudioOuputStreamOpenComplete,KErrNone); |
|
1422 StateChange(EStateOpenComplete2); |
|
1423 return EPass; |
|
1424 } |
|
1425 |
|
1426 TVerdict CTestMmfAclntARN8025::HandleStateOpenComplete2() |
|
1427 { |
|
1428 TInt err = iFileHandle[2].Read(iBuf[2]); |
|
1429 if(err != KErrNone) |
|
1430 { |
|
1431 INFO_PRINTF2(_L("Error reading iFile2 %d"), err); |
|
1432 return EInconclusive; |
|
1433 } |
|
1434 err = iClientList[2]->TestWrite(iBuf[2]); |
|
1435 if( err != KErrNone) |
|
1436 { |
|
1437 INFO_PRINTF2(_L("iTestAudioOutputStream1->WriteL failed %d"),err); |
|
1438 return EInconclusive; |
|
1439 } |
|
1440 INFO_PRINTF1(_L("iTestAudioOutputStream2->WriteL()")); |
|
1441 SetExpectedEvent(1,CFsmAudioOutputStreamClient::EAudioOutputStreamPlayComplete, KErrInUse); |
|
1442 StateChange(EStateStreamingComplete1ErrInUse); |
|
1443 return EPass; |
|
1444 } |
|
1445 |
|
1446 TVerdict CTestMmfAclntARN8025::HandleStateStreamingComplete1ErrInUse() |
|
1447 { |
|
1448 iPositionStop = (static_cast<TInt64>(iClientList[1]->BytesPlayed())* KMicroSecsInOneSec)/(KSampleRate*KBytesPerSample); |
|
1449 SetExpectedEvent(2,CFsmAudioOutputStreamClient::EAudioOutputStreamBufferCopied,KErrNone); |
|
1450 StateChange(EStateStreaming2); |
|
1451 return EPass; |
|
1452 } |
|
1453 |
|
1454 TVerdict CTestMmfAclntARN8025::HandleStateStreaming2() |
|
1455 { |
|
1456 RegisterClientEventToMonitor(1,CFsmAudioOutputStreamClient::EAudioOutputStreamResourceAvailable,KErrNone,EStateResourceAvailableOS1); |
|
1457 RegisterClientEventToMonitor(2,CFsmAudioOutputStreamClient::EAudioOutputStreamPlayComplete,KErrUnderflow,EStateStreamingComplete2ErrUnderflow); |
|
1458 StateChange(EStateMonitoringEvents); |
|
1459 return EPass; |
|
1460 } |
|
1461 |
|
1462 TVerdict CTestMmfAclntARN8025::HandleStateResourceAvailableOS1() |
|
1463 { |
|
1464 INFO_PRINTF1(_L("iTestAudioOutputStream1->NotificationReceived")); |
|
1465 |
|
1466 if(IsMonitoringFinished()) |
|
1467 { |
|
1468 iTestStepResult = EPass; |
|
1469 StopTest(); |
|
1470 } |
|
1471 else |
|
1472 { |
|
1473 StateChange(EStateMonitoringEvents); |
|
1474 } |
|
1475 TTimeIntervalMicroSeconds positionResume = iClientList[1]->GetResumedPosition(); |
|
1476 iPositionResume = ((positionResume.Int64()) * KMicroSecsInOneSec / KSampleRate8000Hz); |
|
1477 if(iPositionResume == iPositionStop) |
|
1478 { |
|
1479 INFO_PRINTF3(_L("iTestAudioOutputStream1->Audio Resource Position Matches, Expected=%d, Actual=%d"), I64LOW(iPositionStop.Int64()), I64LOW(iPositionResume.Int64())); |
|
1480 iTestStepResult = EPass; |
|
1481 } |
|
1482 else |
|
1483 { |
|
1484 ERR_PRINTF3(_L("iTestAudioOutputStream1->Audio Resource Position does NOT Match, Expected=%d, Actual=%d"), I64LOW(iPositionStop.Int64()), I64LOW(iPositionResume.Int64())); |
|
1485 iTestStepResult=EFail; |
|
1486 } |
|
1487 return iTestStepResult; |
|
1488 } |
|
1489 |
|
1490 TVerdict CTestMmfAclntARN8025::HandleStateStreamingComplete2ErrUnderflow() |
|
1491 { |
|
1492 INFO_PRINTF1(_L("iTestAudioOutputStream2->PlayComplete")); |
|
1493 if(IsMonitoringFinished()) |
|
1494 { |
|
1495 iTestStepResult = EPass; |
|
1496 StopTest(); |
|
1497 } |
|
1498 else |
|
1499 { |
|
1500 StateChange(EStateMonitoringEvents); //Didn't finish monitoring |
|
1501 } |
|
1502 return EPass; |
|
1503 } |
|
1504 |
|
1505 /** |
|
1506 * PerformTestL |
|
1507 */ |
|
1508 TVerdict CTestMmfAclntARN8025::PerformTestL() |
|
1509 { |
|
1510 INFO_PRINTF1( _L("Get the actual position from where the paused audio can be resumed.")); |
|
1511 iTestStepResult = EFail; |
|
1512 |
|
1513 InitTest(); |
|
1514 |
|
1515 StartTestL(); |
|
1516 |
|
1517 // Start the scheduler - Done only once ! |
|
1518 CActiveScheduler::Start(); |
|
1519 |
|
1520 return iTestStepResult; |
|
1521 } |
|
1522 |
|
1523 // |
|
1524 //CTestMmfAclntARN8026 |
|
1525 // |
|
1526 |
|
1527 /** |
|
1528 * Constructor |
|
1529 */ |
|
1530 CTestMmfAclntARN8026::CTestMmfAclntARN8026(const TDesC& aTestName) |
|
1531 : CTestStepAudioOutputStreamARN(aTestName) |
|
1532 {} |
|
1533 |
|
1534 /** |
|
1535 * NewL |
|
1536 */ |
|
1537 CTestMmfAclntARN8026* CTestMmfAclntARN8026::NewL(const TDesC& aTestName) |
|
1538 { |
|
1539 CTestMmfAclntARN8026* self = new (ELeave) CTestMmfAclntARN8026(aTestName); |
|
1540 return self; |
|
1541 } |
|
1542 |
|
1543 /** |
|
1544 * DoTestL |
|
1545 */ |
|
1546 TVerdict CTestMmfAclntARN8026::DoTestL() |
|
1547 { |
|
1548 return( PerformTestL() ); |
|
1549 } |
|
1550 |
|
1551 /** |
|
1552 * FsmCheck |
|
1553 */ |
|
1554 TBool CTestMmfAclntARN8026::FsmCheck(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
1555 { |
|
1556 TBool retFsmCheck = EFalse; |
|
1557 if (iExpectedEvent != aEventCode) |
|
1558 { |
|
1559 if ((aEventCode == EMaoscPlayComplete2)) |
|
1560 { |
|
1561 retFsmCheck = ETrue; |
|
1562 if (iEventOccured == EMarncResourceAvailableOS1) |
|
1563 { |
|
1564 return retFsmCheck; |
|
1565 } |
|
1566 else |
|
1567 { |
|
1568 iEventOccured = EMaoscPlayComplete2; |
|
1569 } |
|
1570 } |
|
1571 else if (aEventCode == EMarncResourceAvailableOS1) |
|
1572 { |
|
1573 retFsmCheck = ETrue; |
|
1574 if (iEventOccured == EMaoscPlayComplete2) |
|
1575 { |
|
1576 return retFsmCheck; |
|
1577 } |
|
1578 else |
|
1579 { |
|
1580 iEventOccured = EMarncResourceAvailableOS1; |
|
1581 } |
|
1582 } |
|
1583 else |
|
1584 { |
|
1585 ERR_PRINTF3(_L("ExpectedEvent : %d, ActualEvent : %d"), iExpectedEvent, aEventCode); |
|
1586 iTestStepResult = EFail; |
|
1587 CActiveScheduler::Stop(); |
|
1588 } |
|
1589 } |
|
1590 else if (iExpectedError != aError) |
|
1591 { |
|
1592 ERR_PRINTF3(_L("ExpectedError : %d, ActualError : %d"), iExpectedError, aError); |
|
1593 iTestStepResult = EFail; |
|
1594 CActiveScheduler::Stop(); |
|
1595 } |
|
1596 else |
|
1597 { |
|
1598 retFsmCheck = ETrue; |
|
1599 } |
|
1600 return retFsmCheck; |
|
1601 } |
|
1602 |
|
1603 /** |
|
1604 * FsmL |
|
1605 */ |
|
1606 void CTestMmfAclntARN8026::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
1607 { |
|
1608 if (FsmCheck(aEventCode, aError)) |
|
1609 { |
|
1610 TInt err = KErrNone; |
|
1611 switch (iState) |
|
1612 { |
|
1613 case 0: |
|
1614 // Open iTestAudioOutputStream1 |
|
1615 iTestAudioOutputStream1->Open(NULL); |
|
1616 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
1617 // Set ExpectedEvent & ExpectedError and change the State |
|
1618 StateChange(EMaoscOpenComplete1); |
|
1619 break; |
|
1620 case 1: |
|
1621 // iFile1->Read() |
|
1622 err = iFile1.Read(iBuf1); //-synchronous |
|
1623 if (err != KErrNone) |
|
1624 { |
|
1625 INFO_PRINTF2(_L("Error reading iFile1 %d"), err); |
|
1626 User::Leave(err); |
|
1627 } |
|
1628 // iTestAudioOutputStream1->WriteL() |
|
1629 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
1630 iTestAudioOutputStream1->WriteL(iBuf1); //-Should get Play Error. |
|
1631 // Set ExpectedEvent & ExpectedError and change the State |
|
1632 StateChange(EMaoscBufferCopied1); |
|
1633 break; |
|
1634 case 2: |
|
1635 // Register iTestAudioOutputStream1 for Notification |
|
1636 err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1637 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()")); |
|
1638 if( err != KErrNone ) |
|
1639 { |
|
1640 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1641 iTestStepResult = EFail; |
|
1642 CActiveScheduler::Stop(); |
|
1643 User::Leave(err); |
|
1644 break; |
|
1645 } |
|
1646 // Register iTestAudioOutputStream3 for Notification |
|
1647 err = iTestAudioOutputStream3->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport3, KMMFEventCategoryAudioResourceAvailable); |
|
1648 INFO_PRINTF1(_L("iTestAudioOutputStream3->RegisterAudioResourceNotification()")); |
|
1649 if( err != KErrNone ) |
|
1650 { |
|
1651 ERR_PRINTF2(_L("iTestAudioOutputStream3->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1652 iTestStepResult = EFail; |
|
1653 CActiveScheduler::Stop(); |
|
1654 User::Leave(err); |
|
1655 break; |
|
1656 } |
|
1657 // Open iTestAudioOutputStream3 |
|
1658 iTestAudioOutputStream3->Open(NULL); |
|
1659 INFO_PRINTF1(_L("iTestAudioOutputStream3->Open()")); |
|
1660 // Set ExpectedEvent & ExpectedError and change the State |
|
1661 StateChange(EMaoscOpenComplete3); |
|
1662 break; |
|
1663 case 3: |
|
1664 // Open iTestAudioOutputStream2 |
|
1665 iTestAudioOutputStream2->Open(NULL); |
|
1666 INFO_PRINTF1(_L("iTestAudioOutputStream2->Open()")); |
|
1667 // Set ExpectedEvent & ExpectedError and change the State |
|
1668 StateChange(EMaoscOpenComplete2); |
|
1669 break; |
|
1670 case 4: |
|
1671 // iFile2->Read() |
|
1672 err = iFile2.Read(iBuf2); |
|
1673 if (err != KErrNone) |
|
1674 { |
|
1675 INFO_PRINTF2(_L("Error reading file %d"), err); |
|
1676 User::Leave(err); |
|
1677 } |
|
1678 // iTestAudioOutputStream2->WriteL() |
|
1679 iTestAudioOutputStream2->WriteL(iBuf2); |
|
1680 INFO_PRINTF1(_L("iTestAudioOutputStream2->WriteL()")); |
|
1681 // Set ExpectedEvent & ExpectedError and change the State |
|
1682 StateChange(EMaoscPlayComplete1, KErrInUse); |
|
1683 break; |
|
1684 case 5: |
|
1685 // Wait for BufferCopied event for iTestAudioOutputStream2 |
|
1686 // Set ExpectedEvent & ExpectedError and change the State |
|
1687 StateChange(EMaoscBufferCopied2); |
|
1688 break; |
|
1689 case 6: |
|
1690 // iFile3->Read() |
|
1691 err = iFile3.Read(iBuf3); //-synchronous |
|
1692 if (err != KErrNone) |
|
1693 { |
|
1694 INFO_PRINTF2(_L("Error reading iFile2 %d"), err); |
|
1695 User::Leave(err); |
|
1696 } |
|
1697 // iTestAudioOutputStream3->WriteL() |
|
1698 INFO_PRINTF1(_L("iTestAudioOutputStream3->WriteL()")); |
|
1699 iTestAudioOutputStream3->WriteL(iBuf3); |
|
1700 // Set ExpectedEvent & ExpectedError and change the State |
|
1701 StateChange(EMaoscBufferCopied3, KErrInUse); |
|
1702 break; |
|
1703 case 7: |
|
1704 // Set ExpectedEvent & ExpectedError and change the State |
|
1705 StateChange(EMaoscPlayComplete3, KErrInUse); |
|
1706 break; |
|
1707 case 8: |
|
1708 // Set ExpectedEvent & ExpectedError and change the State |
|
1709 StateChange(EMaoscPlayComplete2, KErrUnderflow); |
|
1710 break; |
|
1711 case 9: |
|
1712 // Timer to check if Notification Event Occurs. |
|
1713 iCallBackTimer->After(2000000); |
|
1714 // Set ExpectedEvent & ExpectedError and change the State |
|
1715 StateChange(EMarncResourceAvailableOS1); |
|
1716 break; |
|
1717 case 10: |
|
1718 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1719 INFO_PRINTF1(_L("iTestAudioOutputStream1->NotificationReceived")); |
|
1720 err = iTestAudioOutputStream1->WillResumePlay(); |
|
1721 INFO_PRINTF1(_L("iTestAudioOutputStream1->WillResumePlay()")); |
|
1722 if( err != KErrNone ) |
|
1723 { |
|
1724 ERR_PRINTF2(_L("iTestAudioOutputStream1->WillResumePlay() - Failed with Error : %d"), err); |
|
1725 iTestStepResult = EFail; |
|
1726 CActiveScheduler::Stop(); |
|
1727 break; |
|
1728 } |
|
1729 // Set the resume position.. or may be not, since its an offset. |
|
1730 // iTestAudioOutputStream1->SetPosition(iPosition); |
|
1731 // iTestAudioOutputStream1->WriteL() |
|
1732 iTestAudioOutputStream1->WriteL(iBuf1); |
|
1733 INFO_PRINTF1(_L("iTestAudioOutputStream1->WriteL()")); |
|
1734 StateChange(EMaoscBufferCopied1); |
|
1735 break; |
|
1736 case 11: |
|
1737 // Wait for PlayComplete event for iTestAudioOutputStream1 |
|
1738 // Set ExpectedEvent & ExpectedError and change the State |
|
1739 StateChange(EMaoscPlayComplete1, KErrUnderflow); |
|
1740 break; |
|
1741 case 12: |
|
1742 // Timer to check if Notification Event Occurs. |
|
1743 iCallBackTimer->After(2000000); |
|
1744 // Set ExpectedEvent & ExpectedError and change the State |
|
1745 StateChange(EMarncResourceAvailableOS3); |
|
1746 break; |
|
1747 case 13: |
|
1748 iCallBackTimer->Cancel(); // in case something else stopped the AS |
|
1749 INFO_PRINTF1(_L("iTestAudioOutputStream3->NotificationReceived")); |
|
1750 iTestStepResult = EPass; |
|
1751 CActiveScheduler::Stop(); |
|
1752 break; |
|
1753 } |
|
1754 } |
|
1755 } |
|
1756 |
|
1757 /** |
|
1758 * PerformTestL |
|
1759 */ |
|
1760 TVerdict CTestMmfAclntARN8026::PerformTestL() |
|
1761 { |
|
1762 INFO_PRINTF1( _L("Call WillResumePlay()")); |
|
1763 iTestStepResult = EFail; |
|
1764 |
|
1765 // Initialise the state variables |
|
1766 StateInit(); |
|
1767 |
|
1768 // Begin the process |
|
1769 FsmL(EIdleOutputStream); |
|
1770 |
|
1771 // Start the scheduler - Done only once ! |
|
1772 CActiveScheduler::Start(); |
|
1773 |
|
1774 return iTestStepResult; |
|
1775 } |
|
1776 |
|
1777 |
|
1778 // |
|
1779 //NEGATIVE TESTS// |
|
1780 // |
|
1781 |
|
1782 // |
|
1783 //CTestMmfAclntARN1321 |
|
1784 // |
|
1785 |
|
1786 /** |
|
1787 * Constructor |
|
1788 */ |
|
1789 CTestMmfAclntARN1321::CTestMmfAclntARN1321(const TDesC& aTestName) |
|
1790 : CTestStepAudioOutputStreamARN(aTestName) |
|
1791 {} |
|
1792 |
|
1793 /** |
|
1794 * NewL |
|
1795 */ |
|
1796 CTestMmfAclntARN1321* CTestMmfAclntARN1321::NewL(const TDesC& aTestName) |
|
1797 { |
|
1798 CTestMmfAclntARN1321* self = new (ELeave) CTestMmfAclntARN1321(aTestName); |
|
1799 return self; |
|
1800 } |
|
1801 |
|
1802 /** |
|
1803 * DoTestL |
|
1804 */ |
|
1805 TVerdict CTestMmfAclntARN1321::DoTestL() |
|
1806 { |
|
1807 return( PerformTestL() ); |
|
1808 } |
|
1809 |
|
1810 /** |
|
1811 * FsmL |
|
1812 */ |
|
1813 void CTestMmfAclntARN1321::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
1814 { |
|
1815 if (FsmCheck(aEventCode, aError)) |
|
1816 { |
|
1817 TInt err = KErrNone; |
|
1818 switch (iState) |
|
1819 { |
|
1820 case 0: |
|
1821 // Open iTestAudioOutputStream1 |
|
1822 iTestAudioOutputStream1->Open(NULL); |
|
1823 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
1824 // Set ExpectedEvent & ExpectedError and change the State |
|
1825 StateChange(EMaoscOpenComplete1); |
|
1826 break; |
|
1827 case 1: |
|
1828 // Register iTestAudioOutputStream1 for Notification |
|
1829 err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryPlaybackComplete); |
|
1830 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryPlaybackComplete)")); |
|
1831 if( err == KErrNotSupported ) |
|
1832 { |
|
1833 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Returned KErrNotSupported ") ); |
|
1834 iTestStepResult = EPass; |
|
1835 } |
|
1836 else |
|
1837 { |
|
1838 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1839 iTestStepResult = EFail; |
|
1840 } |
|
1841 CActiveScheduler::Stop(); |
|
1842 break; |
|
1843 } |
|
1844 } |
|
1845 } |
|
1846 |
|
1847 /** |
|
1848 * PerformTestL |
|
1849 */ |
|
1850 TVerdict CTestMmfAclntARN1321::PerformTestL() |
|
1851 { |
|
1852 INFO_PRINTF1( _L("Register for notification with an unsupported event type.")); |
|
1853 iTestStepResult = EFail; |
|
1854 |
|
1855 // Initialise the state variables |
|
1856 StateInit(); |
|
1857 |
|
1858 // Begin the process |
|
1859 FsmL(EIdleOutputStream); |
|
1860 |
|
1861 // Start the scheduler - Done only once ! |
|
1862 CActiveScheduler::Start(); |
|
1863 |
|
1864 return iTestStepResult; |
|
1865 } |
|
1866 |
|
1867 // |
|
1868 //CTestMmfAclntARN1322 |
|
1869 // |
|
1870 |
|
1871 /** |
|
1872 * Constructor |
|
1873 */ |
|
1874 CTestMmfAclntARN1322::CTestMmfAclntARN1322(const TDesC& aTestName) |
|
1875 : CTestStepAudioOutputStreamARN(aTestName) |
|
1876 {} |
|
1877 |
|
1878 /** |
|
1879 * NewL |
|
1880 */ |
|
1881 CTestMmfAclntARN1322* CTestMmfAclntARN1322::NewL(const TDesC& aTestName) |
|
1882 { |
|
1883 CTestMmfAclntARN1322* self = new (ELeave) CTestMmfAclntARN1322(aTestName); |
|
1884 return self; |
|
1885 } |
|
1886 |
|
1887 /** |
|
1888 * DoTestL |
|
1889 */ |
|
1890 TVerdict CTestMmfAclntARN1322::DoTestL() |
|
1891 { |
|
1892 return( PerformTestL() ); |
|
1893 } |
|
1894 |
|
1895 /** |
|
1896 * FsmL |
|
1897 */ |
|
1898 void CTestMmfAclntARN1322::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
1899 { |
|
1900 if (FsmCheck(aEventCode, aError)) |
|
1901 { |
|
1902 TInt err = KErrNone; |
|
1903 switch (iState) |
|
1904 { |
|
1905 case 0: |
|
1906 // Open iTestAudioOutputStream1 |
|
1907 iTestAudioOutputStream1->Open(NULL); |
|
1908 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
1909 // Set ExpectedEvent & ExpectedError and change the State |
|
1910 StateChange(EMaoscOpenComplete1); |
|
1911 break; |
|
1912 case 1: |
|
1913 // Register iTestAudioOutputStream1 for Notification |
|
1914 err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
1915 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()")); |
|
1916 if( err != KErrNone ) |
|
1917 { |
|
1918 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1919 iTestStepResult = EFail; |
|
1920 CActiveScheduler::Stop(); |
|
1921 User::Leave(err); |
|
1922 break; |
|
1923 } |
|
1924 // Cancellation of notification request for iTestAudioOutputStream1 |
|
1925 err = iTestAudioOutputStream1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete); |
|
1926 INFO_PRINTF1(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification(KMMFEventCategoryPlaybackComplete)")); |
|
1927 if( err == KErrNotSupported ) |
|
1928 { |
|
1929 INFO_PRINTF1(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification - Returned KErrNotSupported ") ); |
|
1930 iTestStepResult = EPass; |
|
1931 } |
|
1932 else |
|
1933 { |
|
1934 ERR_PRINTF2(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
1935 iTestStepResult = EFail; |
|
1936 } |
|
1937 CActiveScheduler::Stop(); |
|
1938 break; |
|
1939 } |
|
1940 } |
|
1941 } |
|
1942 |
|
1943 /** |
|
1944 * PerformTestL |
|
1945 */ |
|
1946 TVerdict CTestMmfAclntARN1322::PerformTestL() |
|
1947 { |
|
1948 INFO_PRINTF1( _L("Cancel the request for notification with an unsupported event type.")); |
|
1949 iTestStepResult = EFail; |
|
1950 |
|
1951 // Initialise the state variables |
|
1952 StateInit(); |
|
1953 |
|
1954 // Begin the process |
|
1955 FsmL(EIdleOutputStream); |
|
1956 |
|
1957 // Start the scheduler - Done only once ! |
|
1958 CActiveScheduler::Start(); |
|
1959 |
|
1960 return iTestStepResult; |
|
1961 } |
|
1962 |
|
1963 // |
|
1964 //CTestMmfAclntARN1323 |
|
1965 // |
|
1966 |
|
1967 /** |
|
1968 * Constructor |
|
1969 */ |
|
1970 CTestMmfAclntARN1323::CTestMmfAclntARN1323(const TDesC& aTestName) |
|
1971 : CTestStepAudioOutputStreamARN(aTestName) |
|
1972 {} |
|
1973 |
|
1974 /** |
|
1975 * NewL |
|
1976 */ |
|
1977 CTestMmfAclntARN1323* CTestMmfAclntARN1323::NewL(const TDesC& aTestName) |
|
1978 { |
|
1979 CTestMmfAclntARN1323* self = new (ELeave) CTestMmfAclntARN1323(aTestName); |
|
1980 return self; |
|
1981 } |
|
1982 |
|
1983 /** |
|
1984 * DoTestL |
|
1985 */ |
|
1986 TVerdict CTestMmfAclntARN1323::DoTestL() |
|
1987 { |
|
1988 return( PerformTestL() ); |
|
1989 } |
|
1990 |
|
1991 /** |
|
1992 * FsmL |
|
1993 */ |
|
1994 void CTestMmfAclntARN1323::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
1995 { |
|
1996 if (FsmCheck(aEventCode, aError)) |
|
1997 { |
|
1998 TInt err = KErrNone; |
|
1999 switch (iState) |
|
2000 { |
|
2001 case 0: |
|
2002 // Open iTestAudioOutputStream1 |
|
2003 iTestAudioOutputStream1->Open(NULL); |
|
2004 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
2005 // Set ExpectedEvent & ExpectedError and change the State |
|
2006 StateChange(EMaoscOpenComplete1); |
|
2007 break; |
|
2008 case 1: |
|
2009 // Cancellation of notification request for iTestAudioOutputStream1 |
|
2010 err = iTestAudioOutputStream1->CancelRegisterAudioResourceNotification(KMMFEventCategoryAudioResourceAvailable); |
|
2011 INFO_PRINTF1(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification()")); |
|
2012 if( err == KErrCancel ) |
|
2013 { |
|
2014 INFO_PRINTF1(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification - Returned KErrCancel ") ); |
|
2015 iTestStepResult = EPass; |
|
2016 } |
|
2017 else |
|
2018 { |
|
2019 ERR_PRINTF2(_L("iTestAudioOutputStream1->CancelRegisterAudioResourceNotification - Failed with Error : %d"), err); |
|
2020 iTestStepResult = EFail; |
|
2021 } |
|
2022 CActiveScheduler::Stop(); |
|
2023 break; |
|
2024 } |
|
2025 } |
|
2026 } |
|
2027 |
|
2028 /** |
|
2029 * PerformTestL |
|
2030 */ |
|
2031 TVerdict CTestMmfAclntARN1323::PerformTestL() |
|
2032 { |
|
2033 INFO_PRINTF1(_L("Cancel when no resource Notification is requested.")); |
|
2034 iTestStepResult = EFail; |
|
2035 |
|
2036 // Initialise the state variables |
|
2037 StateInit(); |
|
2038 |
|
2039 // Begin the process |
|
2040 FsmL(EIdleOutputStream); |
|
2041 |
|
2042 // Start the scheduler - Done only once ! |
|
2043 CActiveScheduler::Start(); |
|
2044 |
|
2045 return iTestStepResult; |
|
2046 } |
|
2047 |
|
2048 // |
|
2049 //CTestMmfAclntARN1324 |
|
2050 // |
|
2051 |
|
2052 /** |
|
2053 * Constructor |
|
2054 */ |
|
2055 CTestMmfAclntARN1324::CTestMmfAclntARN1324(const TDesC& aTestName) |
|
2056 : CTestStepAudioOutputStreamARN(aTestName) |
|
2057 {} |
|
2058 |
|
2059 /** |
|
2060 * NewL |
|
2061 */ |
|
2062 CTestMmfAclntARN1324* CTestMmfAclntARN1324::NewL(const TDesC& aTestName) |
|
2063 { |
|
2064 CTestMmfAclntARN1324* self = new (ELeave) CTestMmfAclntARN1324(aTestName); |
|
2065 return self; |
|
2066 } |
|
2067 |
|
2068 /** |
|
2069 * DoTestL |
|
2070 */ |
|
2071 TVerdict CTestMmfAclntARN1324::DoTestL() |
|
2072 { |
|
2073 return( PerformTestL() ); |
|
2074 } |
|
2075 |
|
2076 /** |
|
2077 * FsmL |
|
2078 */ |
|
2079 void CTestMmfAclntARN1324::FsmL(TMmfAudioOutputStreamEvents aEventCode, TInt aError) |
|
2080 { |
|
2081 if (FsmCheck(aEventCode, aError)) |
|
2082 { |
|
2083 TInt err = KErrNone; |
|
2084 switch (iState) |
|
2085 { |
|
2086 case 0: |
|
2087 // Open iTestAudioOutputStream1 |
|
2088 iTestAudioOutputStream1->Open(NULL); |
|
2089 INFO_PRINTF1(_L("iTestAudioOutputStream1->Open()")); |
|
2090 // Set ExpectedEvent & ExpectedError and change the State |
|
2091 StateChange(EMaoscOpenComplete1); |
|
2092 break; |
|
2093 case 1: |
|
2094 // Register iTestAudioOutputStream1 for Notification |
|
2095 err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
2096 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()#1")); |
|
2097 if( err != KErrNone ) |
|
2098 { |
|
2099 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification#1 - Failed with Error : %d"), err); |
|
2100 iTestStepResult = EFail; |
|
2101 CActiveScheduler::Stop(); |
|
2102 User::Leave(err); |
|
2103 break; |
|
2104 } |
|
2105 // Register iTestAudioOutputStream1 for Notification (again) |
|
2106 err = iTestAudioOutputStream1->RegisterAudioResourceNotification(*iMdaAudioOutputStreamCallbackSupport1, KMMFEventCategoryAudioResourceAvailable); |
|
2107 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification()#2")); |
|
2108 if( err == KErrAlreadyExists ) |
|
2109 { |
|
2110 INFO_PRINTF1(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification#2 - Returned KErrAlreadyExists ") ); |
|
2111 iTestStepResult = EPass; |
|
2112 } |
|
2113 else |
|
2114 { |
|
2115 ERR_PRINTF2(_L("iTestAudioOutputStream1->RegisterAudioResourceNotification#2 - Failed with Error : %d"), err); |
|
2116 iTestStepResult = EFail; |
|
2117 } |
|
2118 CActiveScheduler::Stop(); |
|
2119 break; |
|
2120 } |
|
2121 } |
|
2122 } |
|
2123 |
|
2124 /** |
|
2125 * PerformTestL |
|
2126 */ |
|
2127 TVerdict CTestMmfAclntARN1324::PerformTestL() |
|
2128 { |
|
2129 INFO_PRINTF1(_L("Multiple Registration for notification for the same event type.")); |
|
2130 iTestStepResult = EFail; |
|
2131 |
|
2132 // Initialise the state variables |
|
2133 StateInit(); |
|
2134 |
|
2135 // Begin the process |
|
2136 FsmL(EIdleOutputStream); |
|
2137 |
|
2138 // Start the scheduler - Done only once ! |
|
2139 CActiveScheduler::Start(); |
|
2140 |
|
2141 return iTestStepResult; |
|
2142 } |