|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: DRM Player |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <StifTestInterface.h> |
|
20 #include "DRMAudioPlay.h" |
|
21 #include <caf.h> |
|
22 #include <caf/supplier.h> |
|
23 #include <caf/importfile.h> |
|
24 #include <BAUTILS.H> |
|
25 |
|
26 using namespace ContentAccess; |
|
27 |
|
28 // Constants |
|
29 const TInt CDRMAudioPlay::MAX_TESTCASE_ID = 1046; |
|
30 const TInt CDRMAudioPlay::KDefaultRepeats = 5; |
|
31 const TInt CDRMAudioPlay::KDefaultRepeatForever = -2; |
|
32 const TInt CDRMAudioPlay::KDefaultPauseDelay = 1000000; |
|
33 const TInt CDRMAudioPlay::KDefaultPlayDelay = 3000000; |
|
34 const TInt CDRMAudioPlay::KDefaultStopOpenPlayDelay = 1000000; |
|
35 const TInt CDRMAudioPlay::KDefaultReportDelay = 500000; |
|
36 |
|
37 // Taken from Oma2Agent.h |
|
38 _LIT8(KOma1XmlRoContentType, "application/vnd.oma.drm.rights+xml"); |
|
39 |
|
40 //Cases |
|
41 const TInt CDRMAudioPlay::KCaseImplementationInformation = 1001; |
|
42 const TInt CDRMAudioPlay::KCasePlayFile = 1002; |
|
43 const TInt CDRMAudioPlay::KCasePlayFileStopOpen = 1003; |
|
44 const TInt CDRMAudioPlay::KCasePlayDes = 1004; |
|
45 const TInt CDRMAudioPlay::KCasePlayDesStopOpen = 1005; |
|
46 const TInt CDRMAudioPlay::KCasePlayUrl = 1006; |
|
47 const TInt CDRMAudioPlay::KCasePlayUrlStopOpen = 1007; |
|
48 const TInt CDRMAudioPlay::KCasePlayFileWithPause = 1008; |
|
49 const TInt CDRMAudioPlay::KCasePlayFileWithPosition = 1009; |
|
50 const TInt CDRMAudioPlay::KCasePlayFileReportPosition = 1010; |
|
51 const TInt CDRMAudioPlay::KCasePlayFileReportDuration = 1011; |
|
52 const TInt CDRMAudioPlay::KCasePlayFilesWithVolumes = 1012; |
|
53 const TInt CDRMAudioPlay::KCasePlayFileWithRamp = 1013; |
|
54 const TInt CDRMAudioPlay::KCasePlayFileMetaInfo = 1014; |
|
55 const TInt CDRMAudioPlay::KCasePlayFileWindow = 1015; |
|
56 const TInt CDRMAudioPlay::KCasePlayFileClearWindow = 1016; |
|
57 const TInt CDRMAudioPlay::KCasePlayFileWithRepeats = 1017; |
|
58 const TInt CDRMAudioPlay::KCasePlayFileWithBalance = 1018; |
|
59 const TInt CDRMAudioPlay::KCasePlayFilesWithPriorities = 1019; |
|
60 const TInt CDRMAudioPlay::KCasePlayHandler = 1020; |
|
61 const TInt CDRMAudioPlay::KCasePlayHandlerStopOpen = 1021; |
|
62 const TInt CDRMAudioPlay::KCasePlayHandlerWithPause = 1022; |
|
63 const TInt CDRMAudioPlay::KCasePlayFileHandlerWithRamp = 1023; |
|
64 const TInt CDRMAudioPlay::KCasePlayFileHandlerWithSetPosition = 1024; |
|
65 const TInt CDRMAudioPlay::KCasePlayFileHandlerWithGetPosition = 1025; |
|
66 const TInt CDRMAudioPlay::KCasePlayFileHandlerWithDuration = 1026; |
|
67 const TInt CDRMAudioPlay::KCasePlayFileHandlerWithWindow = 1027; |
|
68 const TInt CDRMAudioPlay::KCasePlayFileHandlerWithClearWindow = 1028; |
|
69 const TInt CDRMAudioPlay::KCasePlayFileSetVolume = 1029; |
|
70 const TInt CDRMAudioPlay::KCasePlayFileGetBalance = 1030; |
|
71 const TInt CDRMAudioPlay::KCasePlayFileGetBitRate = 1031; |
|
72 const TInt CDRMAudioPlay::KCasePlayFileGetAudioLoadingProgress = 1032; |
|
73 const TInt CDRMAudioPlay::KCasePlayFileRegisterForAudioLoadingNotification = 1033; |
|
74 const TInt CDRMAudioPlay::KCasePlayFileImplementationInformation = 1034; |
|
75 const TInt CDRMAudioPlay::KCasePlayFileMaxVolume = 1035; |
|
76 const TInt CDRMAudioPlay::KCasePlayFileSetBalance = 1036; |
|
77 const TInt CDRMAudioPlay::KCasePlayFileSetPriority = 1037; |
|
78 const TInt CDRMAudioPlay::KCasePlayFileSetRepeats = 1038; |
|
79 const TInt CDRMAudioPlay::KCasePlayFilesGetMetaDataEntry = 1039; |
|
80 const TInt CDRMAudioPlay::KCasePlayFilesGetNumberOfMetaDataEntries = 1040; |
|
81 const TInt CDRMAudioPlay::KCasePlayRepeatDRMFile = 1041; |
|
82 const TInt CDRMAudioPlay::KCasePlayPauseRepeatDRMFile = 1042; |
|
83 const TInt CDRMAudioPlay::KCasePlayRepeatDRMFileForever = 1043; |
|
84 const TInt CDRMAudioPlay::KCasePlayRepeatDRMFileWithPlayWindow = 1044; |
|
85 const TInt CDRMAudioPlay::KCasePlayPauseRepeatDRMFileWithPlayWindow = 1045; |
|
86 const TInt CDRMAudioPlay::KCasePlayRepeatForeverDRMFileWithPlayWindow = 1046; |
|
87 |
|
88 // ** FilePlay ******************************************************* |
|
89 TInt CDRMAudioPlay::TestCasePlayFileWithPauseL(CStifSectionParser *section , TTestResult &aResult) |
|
90 { |
|
91 TPtrC FileNamePtr; |
|
92 TTimeIntervalMicroSeconds32 PauseDelay=KDefaultPauseDelay; |
|
93 TTimeIntervalMicroSeconds32 PlayDelay=KDefaultPlayDelay; |
|
94 |
|
95 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
96 { |
|
97 TFileName FileName = FileNamePtr; |
|
98 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
99 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
100 CleanupStack::PushL(sndPlayer); |
|
101 |
|
102 //********************************************* |
|
103 TBool UsingDefault; |
|
104 PauseDelay = GetTimeIntervalL(section, KTagPauseDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPauseDelay); |
|
105 if (UsingDefault) {iLogger->Log(_L("Error retrieving pause delay, using default"));} |
|
106 |
|
107 PlayDelay = GetTimeIntervalL(section, KTagPlayDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPlayDelay); |
|
108 if (UsingDefault) {iLogger->Log(_L("Error retrieving play delay, using default"));} |
|
109 |
|
110 if (PauseDelay > PlayDelay) |
|
111 { |
|
112 //Pause delay longer than play delay. Switching |
|
113 TTimeIntervalMicroSeconds32 TempDelay = PlayDelay; |
|
114 PlayDelay = PauseDelay; |
|
115 PauseDelay = TempDelay; |
|
116 } |
|
117 iLogger->Log(_L("Setting Pause and Play delays to [%d] and [%d]"), PauseDelay.Int(), PlayDelay.Int()); |
|
118 |
|
119 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
120 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
121 |
|
122 //********************************************* |
|
123 |
|
124 CParameters *pauseParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPause ); |
|
125 CleanupStack::PushL(pauseParams); |
|
126 |
|
127 CParameters *playParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPlay ); |
|
128 CleanupStack::PushL(playParams); |
|
129 |
|
130 CMediaEvent *mEventPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PlayDelay, PlayDelay, sndPlayer, playParams); |
|
131 CMediaEvent *mEventPause = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PauseDelay, PauseDelay, sndPlayer, pauseParams, CActive::EPriorityStandard+1); |
|
132 |
|
133 iLogger->Log(_L("Starting scheduler")); |
|
134 TTime StartTime, EndTime; |
|
135 StartTime.HomeTime(); |
|
136 CActiveScheduler::Start(); |
|
137 EndTime.HomeTime(); |
|
138 |
|
139 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
140 |
|
141 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
142 |
|
143 TTime ExpectedEnd = StartTime + sndPlayer->GetDuration() + PlayDelay - PauseDelay; |
|
144 TTime Range1 = ExpectedEnd - ErrorRange; |
|
145 TTime Range2 = ExpectedEnd + ErrorRange; |
|
146 |
|
147 TTimeIntervalMicroSeconds ExpectedDuration = ExpectedEnd.MicroSecondsFrom( StartTime ); |
|
148 |
|
149 iLogger->Log(_L("Perceived duration (%d)") , PerceivedDuration.Int64() ); |
|
150 |
|
151 iLogger->Log(_L("Expected duration (%d)"), ExpectedDuration.Int64() ); |
|
152 // iLogger->Log(_L("Difference = (%d)") , ExpectedEnd.MicroSecondsFrom(EndTime) ); |
|
153 |
|
154 if (mEventPlay->GetCount()<=0 || mEventPause->GetCount()<=0) |
|
155 { |
|
156 iLogger->Log( KTestCaseResultFailSkippedEvents() ); |
|
157 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
158 aResult.iResult = KErrSkippedEvents; |
|
159 } |
|
160 else if (EndTime < Range1 || Range2 < EndTime) |
|
161 { //Durations too different |
|
162 iLogger->Log(_L("The clips duration + silence duration (%d) is too different from the actual duration (%d)") , ExpectedDuration.Int64() , PerceivedDuration.Int64() ); |
|
163 aResult.iResult = KErrExpectedValueDifferent; |
|
164 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
165 } |
|
166 else if (sndPlayer->iFinalError) |
|
167 { |
|
168 aResult.iResult = sndPlayer->iFinalError; |
|
169 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
170 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
171 } |
|
172 else |
|
173 { |
|
174 iLogger->Log(_L("Test was successful")); |
|
175 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
176 } |
|
177 CleanupStack::PopAndDestroy(mEventPause); |
|
178 CleanupStack::PopAndDestroy(mEventPlay); |
|
179 CleanupStack::Pop(playParams); |
|
180 CleanupStack::Pop(pauseParams); |
|
181 CleanupStack::PopAndDestroy(sndPlayer); |
|
182 return KErrExecuted; |
|
183 |
|
184 } |
|
185 else |
|
186 { |
|
187 //The file name of the clip to play is missing |
|
188 aResult.iResultDes.Copy(KConfigInvalid()); |
|
189 aResult.iResult = KErrNotExecuted; |
|
190 return KErrConfigInvalid; |
|
191 } |
|
192 } |
|
193 |
|
194 |
|
195 TInt CDRMAudioPlay::TestCasePlayHandlerWithPauseL(CStifSectionParser *section , TTestResult &aResult) |
|
196 { |
|
197 |
|
198 TPtrC FileNamePtr; |
|
199 User::LeaveIfError(iFs.Connect()); |
|
200 iFs.ShareProtected(); |
|
201 |
|
202 TTimeIntervalMicroSeconds32 PauseDelay = KDefaultPauseDelay; |
|
203 TTimeIntervalMicroSeconds32 PlayDelay = KDefaultPlayDelay; |
|
204 |
|
205 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
206 { |
|
207 TFileName FileName = FileNamePtr; |
|
208 |
|
209 iLogger->Log(_L("Creating simple player with file handler [%S]"), &FileNamePtr); |
|
210 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
211 |
|
212 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
213 |
|
214 iFile.Close(); |
|
215 // iFs.Close(); |
|
216 |
|
217 CleanupStack::PushL(sndPlayer); |
|
218 |
|
219 //********************************************* |
|
220 TBool UsingDefault; |
|
221 PauseDelay = GetTimeIntervalL(section, KTagPauseDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPauseDelay); |
|
222 if (UsingDefault) {iLogger->Log(_L("Error retrieving pause delay, using default"));} |
|
223 |
|
224 PlayDelay = GetTimeIntervalL(section, KTagPlayDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPlayDelay); |
|
225 if (UsingDefault) {iLogger->Log(_L("Error retrieving play delay, using default"));} |
|
226 |
|
227 if (PauseDelay > PlayDelay) |
|
228 { |
|
229 //Pause delay longer than play delay. Switching |
|
230 TTimeIntervalMicroSeconds32 TempDelay = PlayDelay; |
|
231 PlayDelay = PauseDelay; |
|
232 PauseDelay = TempDelay; |
|
233 } |
|
234 iLogger->Log(_L("Setting Pause and Play delays to [%d] and [%d]"), PauseDelay.Int(), PlayDelay.Int()); |
|
235 |
|
236 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
237 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
238 |
|
239 //********************************************* |
|
240 |
|
241 CParameters *pauseParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPause ); |
|
242 CleanupStack::PushL(pauseParams); |
|
243 |
|
244 CParameters *playParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPlay ); |
|
245 CleanupStack::PushL(playParams); |
|
246 |
|
247 CMediaEvent *mEventPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PlayDelay, PlayDelay, sndPlayer, playParams); |
|
248 CMediaEvent *mEventPause = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PauseDelay, PauseDelay, sndPlayer, pauseParams, CActive::EPriorityStandard+1); |
|
249 |
|
250 iLogger->Log(_L("Starting scheduler")); |
|
251 TTime StartTime, EndTime; |
|
252 StartTime.HomeTime(); |
|
253 CActiveScheduler::Start(); |
|
254 EndTime.HomeTime(); |
|
255 |
|
256 iFs.Close(); |
|
257 |
|
258 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
259 |
|
260 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
261 |
|
262 TTime ExpectedEnd = StartTime + sndPlayer->GetDuration() + PlayDelay - PauseDelay; |
|
263 TTime Range1 = ExpectedEnd - ErrorRange; |
|
264 TTime Range2 = ExpectedEnd + ErrorRange; |
|
265 |
|
266 TTimeIntervalMicroSeconds ExpectedDuration = ExpectedEnd.MicroSecondsFrom( StartTime ); |
|
267 |
|
268 iLogger->Log(_L("Perceived duration (%d)") , PerceivedDuration.Int64() ); |
|
269 |
|
270 iLogger->Log(_L("Expected duration (%d)"), ExpectedDuration.Int64() ); |
|
271 |
|
272 // iLogger->Log(_L("Difference = (%d)") , ExpectedEnd.MicroSecondsFrom(EndTime) ); |
|
273 |
|
274 if (mEventPlay->GetCount()<=0 || mEventPause->GetCount()<=0) |
|
275 { |
|
276 iLogger->Log( KTestCaseResultFailSkippedEvents() ); |
|
277 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
278 aResult.iResult = KErrSkippedEvents; |
|
279 } |
|
280 else if (EndTime < Range1 || Range2 < EndTime) |
|
281 { //Durations too different |
|
282 iLogger->Log(_L("The clips duration + silence duration (%d) is too different from the actual duration (%d)") , ExpectedDuration.Int64() , PerceivedDuration.Int64() ); |
|
283 aResult.iResult = KErrExpectedValueDifferent; |
|
284 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
285 } |
|
286 else if (sndPlayer->iFinalError) |
|
287 { |
|
288 aResult.iResult = sndPlayer->iFinalError; |
|
289 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
290 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
291 } |
|
292 else |
|
293 { |
|
294 iLogger->Log(_L("Test was successful")); |
|
295 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
296 } |
|
297 |
|
298 CleanupStack::PopAndDestroy(mEventPause); |
|
299 CleanupStack::PopAndDestroy(mEventPlay); |
|
300 CleanupStack::Pop(playParams); |
|
301 CleanupStack::Pop(pauseParams); |
|
302 CleanupStack::PopAndDestroy(sndPlayer); |
|
303 return KErrExecuted; |
|
304 |
|
305 } |
|
306 else |
|
307 { |
|
308 //The file name of the clip to play is missing |
|
309 aResult.iResultDes.Copy(KConfigInvalid()); |
|
310 aResult.iResult = KErrNotExecuted; |
|
311 return KErrConfigInvalid; |
|
312 } |
|
313 } |
|
314 |
|
315 |
|
316 TInt CDRMAudioPlay::TestCasePlayFileL(CStifSectionParser *section , TTestResult &aResult) |
|
317 { |
|
318 TPtrC FileNamePtr; |
|
319 CStifItemParser *item; |
|
320 TInt parseError = KErrNone; |
|
321 TBool Immediate = 0; |
|
322 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
323 { |
|
324 TFileName FileName = FileNamePtr; |
|
325 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
326 item = section->GetItemLineL(KTagImmediate); |
|
327 if (item) |
|
328 { |
|
329 CleanupStack::PushL(item); |
|
330 parseError = item->GetInt(KTagImmediate, Immediate); |
|
331 CleanupStack::PopAndDestroy(item); |
|
332 } |
|
333 item = NULL; |
|
334 TBool FileType = EFalse; |
|
335 item = section->GetItemLineL(KTagFileType); |
|
336 if (item) |
|
337 { |
|
338 CleanupStack::PushL(item); |
|
339 parseError = item->GetInt(KTagFileType, FileType); |
|
340 CleanupStack::PopAndDestroy(item); |
|
341 } |
|
342 |
|
343 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger, Immediate, FileType); |
|
344 |
|
345 CleanupStack::PushL(sndPlayer); |
|
346 iLogger->Log(_L("Starting scheduler")); |
|
347 |
|
348 CActiveScheduler::Start(); |
|
349 |
|
350 |
|
351 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
352 aResult.iResult = sndPlayer->iFinalError ; |
|
353 |
|
354 TBool DontCheckExpectedDuration; |
|
355 TTimeIntervalMicroSeconds ErrorRange=GetTimeIntervalL(section, KTagErrorRange, DontCheckExpectedDuration); |
|
356 if (!DontCheckExpectedDuration && !aResult.iResult) |
|
357 { |
|
358 TBool DontUseExpectedDuration; |
|
359 TTimeIntervalMicroSeconds ExpectedDuration=GetTimeIntervalL(section, KTagExpectedDuration, DontUseExpectedDuration); |
|
360 if (!IsDurationInRange(0, (DontUseExpectedDuration ? sndPlayer->GetDuration() : ExpectedDuration), TTimeIntervalMicroSeconds(0), ErrorRange, sndPlayer->GetPlayStartTime(), sndPlayer->GetPlayStopTime() ) ) |
|
361 { |
|
362 iLogger->Log(_L("Duration too different")); |
|
363 aResult.iResult = KErrExpectedValueDifferent; |
|
364 } |
|
365 } |
|
366 |
|
367 if (aResult.iResult) |
|
368 { |
|
369 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
370 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
371 } |
|
372 else |
|
373 { |
|
374 iLogger->Log(_L("Test was successful")); |
|
375 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
376 } |
|
377 |
|
378 CleanupStack::PopAndDestroy(sndPlayer); |
|
379 return KErrExecuted; |
|
380 |
|
381 } |
|
382 else |
|
383 { |
|
384 //The file name of the clip to play is missing |
|
385 aResult.iResultDes.Copy(KConfigInvalid()); |
|
386 aResult.iResult = KErrNotExecuted; |
|
387 return KErrConfigInvalid; |
|
388 } |
|
389 } |
|
390 |
|
391 TInt CDRMAudioPlay::TestCasePlayHandlerL(CStifSectionParser *section , TTestResult &aResult) |
|
392 { |
|
393 TPtrC FileNamePtr; |
|
394 |
|
395 User::LeaveIfError(iFs.Connect()); |
|
396 iFs.ShareProtected(); |
|
397 |
|
398 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
399 { |
|
400 TFileName FileName = FileNamePtr; |
|
401 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
402 |
|
403 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
404 // TRAP(err, iAudioPlayer->OpenFileL( iFile )); |
|
405 |
|
406 // CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
407 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
408 |
|
409 iFile.Close(); |
|
410 // iFs.Close(); |
|
411 |
|
412 CleanupStack::PushL(sndPlayer); |
|
413 iLogger->Log(_L("Starting scheduler")); |
|
414 |
|
415 CActiveScheduler::Start(); |
|
416 |
|
417 iFs.Close(); |
|
418 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
419 aResult.iResult = sndPlayer->iFinalError ; |
|
420 |
|
421 TBool DontCheckExpectedDuration; |
|
422 TTimeIntervalMicroSeconds ErrorRange=GetTimeIntervalL(section, KTagErrorRange, DontCheckExpectedDuration); |
|
423 if (!DontCheckExpectedDuration && !aResult.iResult) |
|
424 { |
|
425 TBool DontUseExpectedDuration; |
|
426 TTimeIntervalMicroSeconds ExpectedDuration=GetTimeIntervalL(section, KTagExpectedDuration, DontUseExpectedDuration); |
|
427 if (!IsDurationInRange(0, (DontUseExpectedDuration ? sndPlayer->GetDuration() : ExpectedDuration), TTimeIntervalMicroSeconds(0), ErrorRange, sndPlayer->GetPlayStartTime(), sndPlayer->GetPlayStopTime() ) ) |
|
428 { |
|
429 iLogger->Log(_L("Duration too different")); |
|
430 aResult.iResult = KErrExpectedValueDifferent; |
|
431 } |
|
432 } |
|
433 |
|
434 if (aResult.iResult) |
|
435 { |
|
436 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
437 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
438 } |
|
439 else |
|
440 { |
|
441 iLogger->Log(_L("Test was successful")); |
|
442 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
443 } |
|
444 |
|
445 CleanupStack::PopAndDestroy(sndPlayer); |
|
446 return KErrExecuted; |
|
447 |
|
448 } |
|
449 else |
|
450 { |
|
451 //The file name of the clip to play is missing |
|
452 aResult.iResultDes.Copy(KConfigInvalid()); |
|
453 aResult.iResult = KErrNotExecuted; |
|
454 return KErrConfigInvalid; |
|
455 } |
|
456 } |
|
457 |
|
458 TInt CDRMAudioPlay::TestCasePlayFileWithRepeatsL(CStifSectionParser *section , TTestResult &aResult) |
|
459 { |
|
460 TPtrC FileNamePtr; |
|
461 TInt Repeats = KDefaultRepeats; |
|
462 TTimeIntervalMicroSeconds SilenceDuration = KDefaultSilenceDuration; |
|
463 TInt ParseError=KErrNone; |
|
464 CStifItemParser *item; |
|
465 |
|
466 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
467 { |
|
468 TFileName FileName = FileNamePtr; |
|
469 TBool DontCheckExpectedDuration; |
|
470 TTimeIntervalMicroSeconds ErrorRange=GetTimeIntervalL(section, KTagErrorRange, DontCheckExpectedDuration); |
|
471 |
|
472 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
473 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
474 CleanupStack::PushL(sndPlayer); |
|
475 |
|
476 //Setup repeat count |
|
477 ParseError=KErrNotFound; |
|
478 item = section->GetItemLineL(KTagRepeatTimes); |
|
479 if (item) |
|
480 { |
|
481 CleanupStack::PushL(item); |
|
482 ParseError = item->GetInt(KTagRepeatTimes, Repeats); |
|
483 CleanupStack::PopAndDestroy(item); |
|
484 } |
|
485 iLogger->Log(_L("Setting up repeat count to %d"), Repeats); |
|
486 if (ParseError) |
|
487 { |
|
488 iLogger->Log(_L("Using default value of %d"), KDefaultRepeats); Repeats=KDefaultRepeats; |
|
489 } |
|
490 |
|
491 TBool UsingDefault; |
|
492 SilenceDuration = GetTimeIntervalL(section, KTagSilenceDuration, UsingDefault, KDefaultSilenceDuration); |
|
493 // * **************************************************** |
|
494 iLogger->Log(_L("Setting interval to %d"), SilenceDuration.Int64()); |
|
495 |
|
496 if (UsingDefault) { iLogger->Log(_L("Using default of %d"), KDefaultSilenceDuration.Int64()) ; } |
|
497 sndPlayer->SetRepeats(Repeats, SilenceDuration); |
|
498 |
|
499 iLogger->Log(_L("Starting scheduler")); |
|
500 CActiveScheduler::Start(); |
|
501 |
|
502 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
503 aResult.iResult = sndPlayer->iFinalError; |
|
504 |
|
505 if (!DontCheckExpectedDuration && !aResult.iResult) |
|
506 { |
|
507 TBool DontUseExpectedDuration; |
|
508 TTimeIntervalMicroSeconds ExpectedDuration=GetTimeIntervalL(section, KTagExpectedDuration, DontUseExpectedDuration); |
|
509 if (!IsDurationInRange(Repeats, ( DontUseExpectedDuration ? sndPlayer->GetDuration() : ExpectedDuration), SilenceDuration, ErrorRange, sndPlayer->GetPlayStartTime(), sndPlayer->GetPlayStopTime() ) ) |
|
510 { |
|
511 iLogger->Log(_L("Duration too different")); |
|
512 aResult.iResult = KErrExpectedValueDifferent; |
|
513 } |
|
514 } |
|
515 |
|
516 CleanupStack::PopAndDestroy(sndPlayer); |
|
517 if (aResult.iResult) |
|
518 { |
|
519 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
520 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
521 } |
|
522 else |
|
523 { |
|
524 iLogger->Log(_L("Test was successful")); |
|
525 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
526 } |
|
527 return KErrExecuted; //aResult.iResult; |
|
528 |
|
529 } |
|
530 else |
|
531 { |
|
532 //The file name of the clip to play is missing |
|
533 aResult.iResultDes.Copy(KConfigInvalid()); |
|
534 aResult.iResult = KErrNotExecuted; |
|
535 return KErrConfigInvalid; |
|
536 } |
|
537 } |
|
538 |
|
539 TInt CDRMAudioPlay::TestCasePlayFileWithPositionL(CStifSectionParser *section, TTestResult & aResult) |
|
540 { |
|
541 TPtrC FileNamePtr; |
|
542 TTimeIntervalMicroSeconds Position = KDefaultPosition; |
|
543 |
|
544 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
545 { |
|
546 TFileName FileName = FileNamePtr; |
|
547 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
548 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
549 CleanupStack::PushL(sndPlayer); |
|
550 |
|
551 TBool UsingDefault; |
|
552 Position = GetTimeIntervalL(section, KTagPosition, UsingDefault, KDefaultPosition); |
|
553 |
|
554 iLogger->Log(_L("Seting position to: %d"), Position.Int64()); |
|
555 if (UsingDefault) {iLogger->Log(_L("Using default position duration of: (%d)") , KDefaultPosition.Int64());} |
|
556 sndPlayer->iPosition = Position; |
|
557 |
|
558 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
559 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
560 // * ************************************************************** |
|
561 |
|
562 iLogger->Log(_L("Starting scheduler")); |
|
563 TTime StartTime,EndTime; |
|
564 StartTime.HomeTime(); |
|
565 CActiveScheduler::Start(); |
|
566 EndTime.HomeTime(); |
|
567 |
|
568 |
|
569 |
|
570 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
571 |
|
572 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
573 iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() ); |
|
574 |
|
575 |
|
576 TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(sndPlayer->GetDuration().Int64()) - I64INT(Position.Int64())); |
|
577 iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() ); |
|
578 |
|
579 if ( Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() ) |
|
580 { //Durations too different |
|
581 iLogger->Log(_L("The clips duration is too different from the actual duration + position") ); |
|
582 aResult.iResult = KErrExpectedValueDifferent; |
|
583 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
584 } |
|
585 else |
|
586 { |
|
587 aResult.iResult = sndPlayer->iFinalError; |
|
588 if (aResult.iResult) |
|
589 { |
|
590 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
591 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
592 } |
|
593 else |
|
594 { |
|
595 iLogger->Log(_L("Test was successful")); |
|
596 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
597 } |
|
598 } |
|
599 CleanupStack::PopAndDestroy(sndPlayer); |
|
600 return KErrExecuted; |
|
601 } |
|
602 else |
|
603 { |
|
604 aResult.iResultDes.Copy(KConfigInvalid()); |
|
605 aResult.iResult = KErrNotExecuted; |
|
606 return KErrConfigInvalid; |
|
607 } |
|
608 } |
|
609 |
|
610 |
|
611 //FH |
|
612 TInt CDRMAudioPlay::TestCasePlayHandlerWithSetPositionL(CStifSectionParser *section, TTestResult & aResult) |
|
613 { |
|
614 |
|
615 TPtrC FileNamePtr; |
|
616 User::LeaveIfError(iFs.Connect()); |
|
617 iFs.ShareProtected(); |
|
618 |
|
619 TTimeIntervalMicroSeconds Position = KDefaultPosition; |
|
620 |
|
621 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
622 { |
|
623 TFileName FileName = FileNamePtr; |
|
624 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
625 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
626 // CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
627 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
628 iFile.Close(); |
|
629 CleanupStack::PushL(sndPlayer); |
|
630 |
|
631 TBool UsingDefault; |
|
632 Position = GetTimeIntervalL(section, KTagPosition, UsingDefault, KDefaultPosition); |
|
633 |
|
634 iLogger->Log(_L("Seting position to: %d"), Position.Int64()); |
|
635 if (UsingDefault) {iLogger->Log(_L("Using default position duration of: (%d)") , KDefaultPosition.Int64());} |
|
636 sndPlayer->iPosition = Position; |
|
637 |
|
638 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
639 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
640 // * ************************************************************** |
|
641 |
|
642 iLogger->Log(_L("Starting scheduler")); |
|
643 TTime StartTime,EndTime; |
|
644 StartTime.HomeTime(); |
|
645 CActiveScheduler::Start(); |
|
646 EndTime.HomeTime(); |
|
647 |
|
648 iFs.Close(); |
|
649 |
|
650 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
651 |
|
652 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
653 iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() ); |
|
654 |
|
655 |
|
656 TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(sndPlayer->GetDuration().Int64()) - I64INT(Position.Int64())); |
|
657 iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() ); |
|
658 |
|
659 if ( Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() ) |
|
660 { //Durations too different |
|
661 iLogger->Log(_L("The clips duration is too different from the actual duration + position") ); |
|
662 aResult.iResult = KErrExpectedValueDifferent; |
|
663 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
664 } |
|
665 else |
|
666 { |
|
667 aResult.iResult = sndPlayer->iFinalError; |
|
668 if (aResult.iResult) |
|
669 { |
|
670 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
671 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
672 } |
|
673 else |
|
674 { |
|
675 iLogger->Log(_L("Test was successful")); |
|
676 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
677 } |
|
678 } |
|
679 CleanupStack::PopAndDestroy(sndPlayer); |
|
680 return KErrExecuted; |
|
681 } |
|
682 else |
|
683 { |
|
684 aResult.iResultDes.Copy(KConfigInvalid()); |
|
685 aResult.iResult = KErrNotExecuted; |
|
686 return KErrConfigInvalid; |
|
687 } |
|
688 } |
|
689 |
|
690 TInt CDRMAudioPlay::TestCasePlayFileStopOpenL(CStifSectionParser *section , TTestResult &aResult) |
|
691 { |
|
692 TPtrC FileNamePtr; |
|
693 TTimeIntervalMicroSeconds32 StopDelay=KDefaultPauseDelay; |
|
694 TTimeIntervalMicroSeconds32 PlayDelay=KDefaultPlayDelay; |
|
695 |
|
696 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
697 { |
|
698 TFileName FileName = FileNamePtr; |
|
699 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
700 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
701 CleanupStack::PushL(sndPlayer); |
|
702 |
|
703 |
|
704 CParameters *playParams; |
|
705 if ( section->GetNextLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
706 { |
|
707 playParams = CFileNameParameters::NewLC(CSimpleSoundPlayer::KPlayerActionOpen, FileName ); |
|
708 iLogger->Log(_L("Second filename not found, using the same file twice")); |
|
709 } |
|
710 else |
|
711 { |
|
712 playParams = CFileNameParameters::NewLC(CSimpleSoundPlayer::KPlayerActionOpen, FileNamePtr ); |
|
713 iLogger->Log(_L("Second filename set to [%S]") , &FileNamePtr ); |
|
714 } |
|
715 |
|
716 //********************************************* |
|
717 TBool UsingDefault; |
|
718 StopDelay = GetTimeIntervalL(section, KTagStopDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPauseDelay); |
|
719 if (UsingDefault) |
|
720 { |
|
721 iLogger->Log(_L("Error retrieving pause delay, using default")); |
|
722 } |
|
723 |
|
724 PlayDelay = GetTimeIntervalL(section, KTagPlayDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPlayDelay); |
|
725 if (UsingDefault) {iLogger->Log(_L("Error retrieving play delay, using default"));} |
|
726 |
|
727 if (StopDelay > PlayDelay) |
|
728 { |
|
729 //Pause delay longer than play delay. Switching |
|
730 TTimeIntervalMicroSeconds32 TempDelay = PlayDelay; |
|
731 PlayDelay = StopDelay; |
|
732 StopDelay = TempDelay; |
|
733 } |
|
734 |
|
735 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
736 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
737 |
|
738 //********************************************* |
|
739 |
|
740 CParameters *stopParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionStopPlayFile ); |
|
741 CleanupStack::PushL(stopParams); |
|
742 |
|
743 CMediaEvent *mEventPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PlayDelay, PlayDelay, sndPlayer, playParams); |
|
744 CMediaEvent *mEventStop = CMediaEvent::NewLC(TestModuleIf() , *iLogger, StopDelay, StopDelay, sndPlayer, stopParams, CActive::EPriorityStandard+1); |
|
745 |
|
746 iLogger->Log(_L("Starting scheduler")); |
|
747 TTime StartTime, EndTime; |
|
748 StartTime.HomeTime(); |
|
749 CActiveScheduler::Start(); |
|
750 EndTime.HomeTime(); |
|
751 |
|
752 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
753 aResult.iResult = sndPlayer->iFinalError; |
|
754 iLogger->Log(_L("Playcount: (%d)") , mEventStop->GetCount() ); |
|
755 if (mEventStop->GetCount() <= 0) |
|
756 { |
|
757 aResult.iResult = KErrSkippedEvents; |
|
758 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
759 aResult.iResultDes.Copy(KTestCaseResultFailSkippedEvents()); |
|
760 } |
|
761 else if (sndPlayer->iFinalError) |
|
762 { |
|
763 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
764 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
765 aResult.iResult = sndPlayer->iFinalError; |
|
766 } |
|
767 else |
|
768 { |
|
769 iLogger->Log(_L("Test was successful")); |
|
770 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
771 aResult.iResult = sndPlayer->iFinalError; |
|
772 } |
|
773 |
|
774 CleanupStack::PopAndDestroy(mEventStop); |
|
775 CleanupStack::PopAndDestroy(mEventPlay); |
|
776 CleanupStack::Pop(stopParams); |
|
777 CleanupStack::Pop(playParams); |
|
778 CleanupStack::PopAndDestroy(sndPlayer); |
|
779 return KErrExecuted; |
|
780 |
|
781 } |
|
782 else |
|
783 { |
|
784 aResult.iResultDes.Copy(KConfigInvalid()); |
|
785 aResult.iResult = KErrNotExecuted; |
|
786 return KErrConfigInvalid; |
|
787 } |
|
788 } |
|
789 |
|
790 |
|
791 TInt CDRMAudioPlay::TestCasePlayHandlerStopOpenL(CStifSectionParser *section , TTestResult &aResult) |
|
792 { |
|
793 |
|
794 TPtrC FileNamePtr; |
|
795 User::LeaveIfError(iFs.Connect()); |
|
796 iFs.ShareProtected(); |
|
797 |
|
798 TTimeIntervalMicroSeconds32 StopDelay=KDefaultStopOpenPlayDelay; |
|
799 TTimeIntervalMicroSeconds32 PlayDelay=KDefaultPlayDelay; |
|
800 |
|
801 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
802 { |
|
803 TFileName FileName = FileNamePtr; |
|
804 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
805 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
806 |
|
807 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
808 |
|
809 iFile.Close(); |
|
810 CleanupStack::PushL(sndPlayer); |
|
811 |
|
812 |
|
813 CParameters *playParams; |
|
814 if ( section->GetNextLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
815 { |
|
816 playParams = CFileNameParameters::NewLC(CSimpleSoundPlayer::KPlayerActionOpenFileHandler, FileName ); |
|
817 iLogger->Log(_L("Second filename not found, using the same file twice")); |
|
818 } |
|
819 else |
|
820 { |
|
821 playParams = CFileNameParameters::NewLC(CSimpleSoundPlayer::KPlayerActionOpenFileHandler, FileNamePtr ); |
|
822 iLogger->Log(_L("Second filename set to [%S]") , &FileNamePtr ); |
|
823 } |
|
824 |
|
825 //********************************************* |
|
826 TBool UsingDefault; |
|
827 StopDelay = GetTimeIntervalL(section, KTagStopDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPauseDelay); |
|
828 if (UsingDefault) {iLogger->Log(_L("Error retrieving pause delay, using default"));} |
|
829 |
|
830 PlayDelay = GetTimeIntervalL(section, KTagPlayDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPlayDelay); |
|
831 if (UsingDefault) {iLogger->Log(_L("Error retrieving play delay, using default"));} |
|
832 |
|
833 if (StopDelay > PlayDelay) |
|
834 { |
|
835 //Pause delay longer than play delay. Switching |
|
836 TTimeIntervalMicroSeconds32 TempDelay = PlayDelay; |
|
837 PlayDelay = StopDelay; |
|
838 StopDelay = TempDelay; |
|
839 } |
|
840 |
|
841 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
842 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
843 |
|
844 //********************************************* |
|
845 |
|
846 CParameters *stopParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionStopPlayFileHandler ); |
|
847 CleanupStack::PushL(stopParams); |
|
848 |
|
849 CMediaEvent *mEventPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PlayDelay, PlayDelay, sndPlayer, playParams); |
|
850 CMediaEvent *mEventStop = CMediaEvent::NewLC(TestModuleIf() , *iLogger, StopDelay, StopDelay, sndPlayer, stopParams, CActive::EPriorityStandard+1); |
|
851 |
|
852 iLogger->Log(_L("Starting scheduler")); |
|
853 TTime StartTime, EndTime; |
|
854 StartTime.HomeTime(); |
|
855 CActiveScheduler::Start(); |
|
856 EndTime.HomeTime(); |
|
857 |
|
858 iFs.Close(); |
|
859 |
|
860 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
861 aResult.iResult = sndPlayer->iFinalError; |
|
862 iLogger->Log(_L("Playcount: (%d)") , mEventStop->GetCount() ); |
|
863 if (mEventStop->GetCount() <= 0) |
|
864 { |
|
865 aResult.iResult = KErrSkippedEvents; |
|
866 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
867 aResult.iResultDes.Copy(KTestCaseResultFailSkippedEvents()); |
|
868 } |
|
869 else if (sndPlayer->iFinalError) |
|
870 { |
|
871 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
872 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
873 aResult.iResult = sndPlayer->iFinalError; |
|
874 } |
|
875 else |
|
876 { |
|
877 iLogger->Log(_L("Test was successful")); |
|
878 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
879 aResult.iResult = sndPlayer->iFinalError; |
|
880 } |
|
881 |
|
882 CleanupStack::PopAndDestroy(mEventStop); |
|
883 CleanupStack::PopAndDestroy(mEventPlay); |
|
884 CleanupStack::Pop(stopParams); |
|
885 CleanupStack::Pop(playParams); |
|
886 CleanupStack::PopAndDestroy(sndPlayer); |
|
887 return KErrExecuted; |
|
888 |
|
889 } |
|
890 else |
|
891 { |
|
892 aResult.iResultDes.Copy(KConfigInvalid()); |
|
893 aResult.iResult = KErrNotExecuted; |
|
894 return KErrConfigInvalid; |
|
895 } |
|
896 } |
|
897 |
|
898 |
|
899 TInt CDRMAudioPlay::TestCasePlayFileWithBalanceL(CStifSectionParser *section , TTestResult &aResult) |
|
900 { |
|
901 TPtrC FileNamePtr; |
|
902 TInt Balance = KMMFBalanceCenter; |
|
903 TInt ParseError=KErrNone; |
|
904 CStifItemParser *item; |
|
905 |
|
906 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
907 { |
|
908 // TInt BalanceError=KErrNone; |
|
909 TFileName FileName = FileNamePtr; |
|
910 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
911 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
912 CleanupStack::PushL(sndPlayer); |
|
913 |
|
914 //********************* |
|
915 ParseError=KErrNotFound; |
|
916 item = section->GetItemLineL(KTagBalance); |
|
917 if (item) |
|
918 { |
|
919 CleanupStack::PushL(item); |
|
920 ParseError = item->GetInt(KTagBalance, Balance); |
|
921 CleanupStack::PopAndDestroy(item); |
|
922 } |
|
923 if (ParseError) |
|
924 { |
|
925 iLogger->Log(_L("Value for Balance not found, using default (%d)") , KMMFBalanceCenter); |
|
926 Balance = KMMFBalanceCenter; |
|
927 } |
|
928 else |
|
929 { |
|
930 iLogger->Log(_L("Setting Balance to: %d"), Balance); |
|
931 sndPlayer->iBalance = Balance; |
|
932 } |
|
933 |
|
934 sndPlayer->iSetBalance = true; |
|
935 |
|
936 // iLogger->Log(_L("Setting Balance to: %d"), Balance); |
|
937 // BalanceError = sndPlayer->SetBalance(Balance); |
|
938 // if (BalanceError) |
|
939 // { |
|
940 // iLogger->Log(_L("Error setting balance")); |
|
941 // aResult.iResult = BalanceError; |
|
942 // } |
|
943 // else |
|
944 // { |
|
945 iLogger->Log(_L("Starting scheduler")); |
|
946 CActiveScheduler::Start(); |
|
947 |
|
948 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
949 aResult.iResult = sndPlayer->iFinalError; |
|
950 // } |
|
951 |
|
952 if (aResult.iResult) |
|
953 { |
|
954 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
955 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
956 } |
|
957 else |
|
958 { |
|
959 iLogger->Log(_L("Test was successful")); |
|
960 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
961 } |
|
962 CleanupStack::PopAndDestroy(sndPlayer); |
|
963 return KErrExecuted; |
|
964 |
|
965 } |
|
966 else |
|
967 { |
|
968 //The file name of the clip to play is missing |
|
969 aResult.iResultDes.Copy(KConfigInvalid()); |
|
970 aResult.iResult = KErrNotExecuted; |
|
971 return KErrConfigInvalid; |
|
972 } |
|
973 } |
|
974 |
|
975 TInt CDRMAudioPlay::TestCasePlayDesL(CStifSectionParser *section , TTestResult &aResult) |
|
976 { |
|
977 TPtrC FileNamePtr; |
|
978 CStifItemParser *item; |
|
979 TInt parseError = KErrNone; |
|
980 TBool Immediate = 0; |
|
981 TBool DesReadOnly = 0; |
|
982 if ( !section->GetLine(KTagSoundDes, FileNamePtr, ENoTag) ) |
|
983 { |
|
984 TFileName FileName = FileNamePtr; |
|
985 |
|
986 HBufC8 *SoundFile = GetDescriptor8LC(FileName, section); |
|
987 |
|
988 item = section->GetItemLineL(KTagImmediate); |
|
989 if (item) |
|
990 { |
|
991 CleanupStack::PushL(item); |
|
992 parseError = item->GetInt(KTagImmediate, Immediate); |
|
993 CleanupStack::PopAndDestroy(item); |
|
994 } |
|
995 item = NULL; |
|
996 item = section->GetItemLineL(KTagDesReadOnly); |
|
997 if (item) |
|
998 { |
|
999 CleanupStack::PushL(item); |
|
1000 parseError = item->GetInt(KTagDesReadOnly, DesReadOnly); |
|
1001 CleanupStack::PopAndDestroy(item); |
|
1002 } |
|
1003 |
|
1004 iLogger->Log(_L("Creating simple player with descriptor from [%S]"), &FileNamePtr); |
|
1005 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( *SoundFile, TestModuleIf() , *iLogger, Immediate, DesReadOnly); |
|
1006 |
|
1007 CleanupStack::PushL(sndPlayer); |
|
1008 |
|
1009 iLogger->Log(_L("Starting scheduler")); |
|
1010 |
|
1011 CActiveScheduler::Start(); |
|
1012 |
|
1013 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1014 aResult.iResult = sndPlayer->iFinalError ; |
|
1015 |
|
1016 TBool DontCheckExpectedDuration; |
|
1017 TTimeIntervalMicroSeconds ErrorRange=GetTimeIntervalL(section, KTagErrorRange, DontCheckExpectedDuration); |
|
1018 |
|
1019 if (!DontCheckExpectedDuration && !aResult.iResult) |
|
1020 { |
|
1021 TBool DontUseExpectedDuration; |
|
1022 TTimeIntervalMicroSeconds ExpectedDuration=GetTimeIntervalL(section, KTagExpectedDuration, DontUseExpectedDuration); |
|
1023 if (!IsDurationInRange(0, (DontUseExpectedDuration |
|
1024 ? sndPlayer->GetDuration() |
|
1025 : ExpectedDuration |
|
1026 ), TTimeIntervalMicroSeconds(0), ErrorRange, sndPlayer->GetPlayStartTime(), sndPlayer->GetPlayStopTime() ) ) |
|
1027 { |
|
1028 iLogger->Log(_L("Duration too different")); |
|
1029 aResult.iResult = KErrExpectedValueDifferent; |
|
1030 } |
|
1031 } |
|
1032 |
|
1033 |
|
1034 CleanupStack::PopAndDestroy(sndPlayer); |
|
1035 |
|
1036 CleanupStack::PopAndDestroy(SoundFile); |
|
1037 |
|
1038 if (aResult.iResult) |
|
1039 { |
|
1040 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1041 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
1042 } |
|
1043 else |
|
1044 { |
|
1045 iLogger->Log(_L("Test was successful")); |
|
1046 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
1047 } |
|
1048 return KErrExecuted; |
|
1049 } |
|
1050 else |
|
1051 { |
|
1052 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1053 aResult.iResult = KErrNotExecuted; |
|
1054 |
|
1055 return KErrConfigInvalid; |
|
1056 } |
|
1057 } |
|
1058 |
|
1059 |
|
1060 TInt CDRMAudioPlay::TestCasePlayFileReportPositionL(CStifSectionParser *section , TTestResult &aResult) |
|
1061 { |
|
1062 TPtrC FileNamePtr; |
|
1063 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
1064 |
|
1065 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1066 { |
|
1067 TFileName FileName = FileNamePtr; |
|
1068 TBool UsingDefaultReportDelay; |
|
1069 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1070 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1071 CleanupStack::PushL(sndPlayer); |
|
1072 |
|
1073 //********************************************* |
|
1074 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1075 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1076 //********************************************* |
|
1077 |
|
1078 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition); |
|
1079 CleanupStack::PushL(reportParams); |
|
1080 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1081 |
|
1082 iLogger->Log(_L("Starting scheduler")); |
|
1083 CActiveScheduler::Start(); |
|
1084 |
|
1085 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
1086 CleanupStack::Pop(reportParams); |
|
1087 |
|
1088 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1089 aResult.iResult = sndPlayer->iFinalError; |
|
1090 if (aResult.iResult) |
|
1091 { |
|
1092 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1093 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 iLogger->Log(_L("Test was successful")); |
|
1098 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
1099 } |
|
1100 CleanupStack::PopAndDestroy(sndPlayer); |
|
1101 return aResult.iResult; |
|
1102 |
|
1103 } |
|
1104 else |
|
1105 { |
|
1106 //The file name of the clip to play is missing |
|
1107 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1108 aResult.iResult = KErrNotExecuted; |
|
1109 return KErrConfigInvalid; |
|
1110 } |
|
1111 } |
|
1112 |
|
1113 //FH |
|
1114 TInt CDRMAudioPlay::TestCasePlayHandlerWithGetPositionL(CStifSectionParser *section , TTestResult &aResult) |
|
1115 { |
|
1116 |
|
1117 TPtrC FileNamePtr; |
|
1118 User::LeaveIfError(iFs.Connect()); |
|
1119 iFs.ShareProtected(); |
|
1120 |
|
1121 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
1122 |
|
1123 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1124 { |
|
1125 TFileName FileName = FileNamePtr; |
|
1126 TBool UsingDefaultReportDelay; |
|
1127 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
1128 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1129 // CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1130 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
1131 iFile.Close(); |
|
1132 CleanupStack::PushL(sndPlayer); |
|
1133 |
|
1134 //********************************************* |
|
1135 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1136 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1137 //********************************************* |
|
1138 |
|
1139 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition); |
|
1140 CleanupStack::PushL(reportParams); |
|
1141 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1142 |
|
1143 iLogger->Log(_L("Starting scheduler")); |
|
1144 CActiveScheduler::Start(); |
|
1145 |
|
1146 iFs.Close(); |
|
1147 |
|
1148 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
1149 CleanupStack::Pop(reportParams); |
|
1150 |
|
1151 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1152 aResult.iResult = sndPlayer->iFinalError; |
|
1153 if (aResult.iResult) |
|
1154 { |
|
1155 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1156 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
1157 } |
|
1158 else |
|
1159 { |
|
1160 iLogger->Log(_L("Test was successful")); |
|
1161 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
1162 } |
|
1163 CleanupStack::PopAndDestroy(sndPlayer); |
|
1164 return aResult.iResult; |
|
1165 |
|
1166 } |
|
1167 else |
|
1168 { |
|
1169 //The file name of the clip to play is missing |
|
1170 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1171 aResult.iResult = KErrNotExecuted; |
|
1172 return KErrConfigInvalid; |
|
1173 } |
|
1174 } |
|
1175 |
|
1176 TInt CDRMAudioPlay::TestCasePlayFileReportDurationL(CStifSectionParser *section , TTestResult &aResult) |
|
1177 { |
|
1178 TPtrC FileNamePtr; |
|
1179 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1180 |
|
1181 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1182 { |
|
1183 TBool ExpectedDurationNotSet = EFalse, UsingDefaultReportDelay;; |
|
1184 TTimeIntervalMicroSeconds ExpectedDuration; |
|
1185 |
|
1186 TFileName FileName = FileNamePtr; |
|
1187 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1188 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1189 CleanupStack::PushL(sndPlayer); |
|
1190 |
|
1191 //********************************************* |
|
1192 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1193 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1194 //********************************************* |
|
1195 ExpectedDuration = GetTimeIntervalL( section, KTagExpectedDuration, ExpectedDurationNotSet) ; |
|
1196 //********************************************* |
|
1197 |
|
1198 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportDuration); |
|
1199 CleanupStack::PushL(reportParams); |
|
1200 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1201 |
|
1202 iLogger->Log(_L("Starting scheduler")); |
|
1203 CActiveScheduler::Start(); |
|
1204 |
|
1205 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1206 |
|
1207 aResult.iResult = sndPlayer->iFinalError; |
|
1208 |
|
1209 if (mEventReportPosition->GetCount() <= 0) |
|
1210 { |
|
1211 aResult.iResult = KErrSkippedEvents; |
|
1212 } |
|
1213 |
|
1214 if (!ExpectedDurationNotSet) |
|
1215 { |
|
1216 iLogger->Log(_L("Expected duration: (%d)") , ExpectedDuration.Int64() ); |
|
1217 |
|
1218 if ( ExpectedDuration!=sndPlayer->GetDuration() ) |
|
1219 { |
|
1220 aResult.iResult = KErrExpectedValueDifferent; |
|
1221 } |
|
1222 } |
|
1223 |
|
1224 switch (aResult.iResult) |
|
1225 { |
|
1226 case KErrNone: |
|
1227 iLogger->Log(_L("Test was successful")); |
|
1228 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1229 break; |
|
1230 case KErrExpectedValueDifferent: |
|
1231 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1232 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1233 break; |
|
1234 case KErrSkippedEvents: |
|
1235 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1236 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1237 break; |
|
1238 default: |
|
1239 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1240 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1241 } |
|
1242 |
|
1243 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
1244 CleanupStack::Pop(reportParams); |
|
1245 |
|
1246 CleanupStack::PopAndDestroy(sndPlayer); |
|
1247 return KErrNone; //aResult.iResult; |
|
1248 |
|
1249 } |
|
1250 else |
|
1251 { |
|
1252 //The file name of the clip to play is missing |
|
1253 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1254 aResult.iResult = KErrNotExecuted; |
|
1255 return KErrConfigInvalid; |
|
1256 } |
|
1257 } |
|
1258 |
|
1259 |
|
1260 TInt CDRMAudioPlay::TestCasePlayFileMaxVolumeL(CStifSectionParser *section , TTestResult &aResult) |
|
1261 { |
|
1262 TPtrC FileNamePtr; |
|
1263 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1264 |
|
1265 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1266 { |
|
1267 TBool UsingDefaultReportDelay;; |
|
1268 TFileName FileName = FileNamePtr; |
|
1269 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1270 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1271 CleanupStack::PushL(sndPlayer); |
|
1272 |
|
1273 //############################################### |
|
1274 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1275 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1276 //############################################### |
|
1277 |
|
1278 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionMaxVolume); |
|
1279 CleanupStack::PushL(reportParams); |
|
1280 CMediaEvent *mEventMaxVolume = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1281 |
|
1282 iLogger->Log(_L("Starting scheduler")); |
|
1283 CActiveScheduler::Start(); |
|
1284 |
|
1285 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1286 |
|
1287 aResult.iResult = sndPlayer->iFinalError; |
|
1288 |
|
1289 if (mEventMaxVolume->GetCount() <= 0) |
|
1290 { |
|
1291 aResult.iResult = KErrSkippedEvents; |
|
1292 } |
|
1293 |
|
1294 |
|
1295 switch (aResult.iResult) |
|
1296 { |
|
1297 case KErrNone: |
|
1298 iLogger->Log(_L("Test was successful")); |
|
1299 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1300 break; |
|
1301 case KErrExpectedValueDifferent: |
|
1302 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1303 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1304 break; |
|
1305 case KErrSkippedEvents: |
|
1306 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1307 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1308 break; |
|
1309 default: |
|
1310 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1311 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1312 } |
|
1313 |
|
1314 CleanupStack::PopAndDestroy(mEventMaxVolume); |
|
1315 CleanupStack::Pop(reportParams); |
|
1316 |
|
1317 CleanupStack::PopAndDestroy(sndPlayer); |
|
1318 return KErrNone; //aResult.iResult; |
|
1319 |
|
1320 } |
|
1321 else |
|
1322 { |
|
1323 //The file name of the clip to play is missing |
|
1324 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1325 aResult.iResult = KErrNotExecuted; |
|
1326 return KErrConfigInvalid; |
|
1327 } |
|
1328 } |
|
1329 |
|
1330 TInt CDRMAudioPlay::TestCasePlayFileSetVolumeL(CStifSectionParser *section , TTestResult &aResult) |
|
1331 { |
|
1332 TPtrC FileNamePtr; |
|
1333 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1334 |
|
1335 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1336 { |
|
1337 TBool UsingDefaultReportDelay;; |
|
1338 TFileName FileName = FileNamePtr; |
|
1339 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1340 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1341 CleanupStack::PushL(sndPlayer); |
|
1342 |
|
1343 //############################################### |
|
1344 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1345 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1346 //############################################### |
|
1347 |
|
1348 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionSetVolume); |
|
1349 CleanupStack::PushL(reportParams); |
|
1350 CMediaEvent *mEventSetVolume = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1351 |
|
1352 iLogger->Log(_L("Starting scheduler")); |
|
1353 CActiveScheduler::Start(); |
|
1354 |
|
1355 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1356 |
|
1357 aResult.iResult = sndPlayer->iFinalError; |
|
1358 |
|
1359 if (mEventSetVolume->GetCount() <= 0) |
|
1360 { |
|
1361 aResult.iResult = KErrSkippedEvents; |
|
1362 } |
|
1363 |
|
1364 switch (aResult.iResult) |
|
1365 { |
|
1366 case KErrNone: |
|
1367 iLogger->Log(_L("Test was successful")); |
|
1368 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1369 break; |
|
1370 case KErrExpectedValueDifferent: |
|
1371 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1372 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1373 break; |
|
1374 case KErrSkippedEvents: |
|
1375 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1376 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1377 break; |
|
1378 default: |
|
1379 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1380 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1381 } |
|
1382 |
|
1383 CleanupStack::PopAndDestroy(mEventSetVolume); |
|
1384 CleanupStack::Pop(reportParams); |
|
1385 |
|
1386 CleanupStack::PopAndDestroy(sndPlayer); |
|
1387 return KErrNone; //aResult.iResult; |
|
1388 |
|
1389 } |
|
1390 else |
|
1391 { |
|
1392 //The file name of the clip to play is missing |
|
1393 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1394 aResult.iResult = KErrNotExecuted; |
|
1395 return KErrConfigInvalid; |
|
1396 } |
|
1397 } |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 TInt CDRMAudioPlay::TestCasePlayFileGetBalanceL(CStifSectionParser *section , TTestResult &aResult) |
|
1403 { |
|
1404 TPtrC FileNamePtr; |
|
1405 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1406 |
|
1407 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1408 { |
|
1409 TBool UsingDefaultReportDelay;; |
|
1410 TFileName FileName = FileNamePtr; |
|
1411 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1412 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1413 CleanupStack::PushL(sndPlayer); |
|
1414 |
|
1415 //############################################### |
|
1416 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1417 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1418 //############################################### |
|
1419 |
|
1420 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionGetBalance); |
|
1421 CleanupStack::PushL(reportParams); |
|
1422 CMediaEvent *mEventGetBalance = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1423 |
|
1424 iLogger->Log(_L("Starting scheduler")); |
|
1425 CActiveScheduler::Start(); |
|
1426 |
|
1427 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1428 |
|
1429 aResult.iResult = sndPlayer->iFinalError; |
|
1430 |
|
1431 if (mEventGetBalance->GetCount() <= 0) |
|
1432 { |
|
1433 aResult.iResult = KErrSkippedEvents; |
|
1434 } |
|
1435 |
|
1436 switch (aResult.iResult) |
|
1437 { |
|
1438 case KErrNone: |
|
1439 iLogger->Log(_L("Test was successful")); |
|
1440 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1441 break; |
|
1442 case KErrExpectedValueDifferent: |
|
1443 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1444 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1445 break; |
|
1446 case KErrSkippedEvents: |
|
1447 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1448 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1449 break; |
|
1450 default: |
|
1451 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1452 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1453 } |
|
1454 |
|
1455 CleanupStack::PopAndDestroy(mEventGetBalance); |
|
1456 CleanupStack::Pop(reportParams); |
|
1457 |
|
1458 CleanupStack::PopAndDestroy(sndPlayer); |
|
1459 return KErrNone; //aResult.iResult; |
|
1460 |
|
1461 } |
|
1462 else |
|
1463 { |
|
1464 //The file name of the clip to play is missing |
|
1465 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1466 aResult.iResult = KErrNotExecuted; |
|
1467 return KErrConfigInvalid; |
|
1468 } |
|
1469 } |
|
1470 |
|
1471 |
|
1472 TInt CDRMAudioPlay::TestCasePlayFileSetBalanceL(CStifSectionParser *section , TTestResult &aResult) |
|
1473 { |
|
1474 TPtrC FileNamePtr; |
|
1475 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1476 |
|
1477 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1478 { |
|
1479 TBool UsingDefaultReportDelay;; |
|
1480 TFileName FileName = FileNamePtr; |
|
1481 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1482 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1483 CleanupStack::PushL(sndPlayer); |
|
1484 |
|
1485 //############################################### |
|
1486 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1487 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1488 //############################################### |
|
1489 |
|
1490 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionSetBalance); |
|
1491 CleanupStack::PushL(reportParams); |
|
1492 CMediaEvent *mEventSetBalance = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1493 |
|
1494 iLogger->Log(_L("Starting scheduler")); |
|
1495 CActiveScheduler::Start(); |
|
1496 |
|
1497 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1498 |
|
1499 aResult.iResult = sndPlayer->iFinalError; |
|
1500 |
|
1501 if (mEventSetBalance->GetCount() <= 0) |
|
1502 { |
|
1503 aResult.iResult = KErrSkippedEvents; |
|
1504 } |
|
1505 |
|
1506 switch (aResult.iResult) |
|
1507 { |
|
1508 case KErrNone: |
|
1509 iLogger->Log(_L("Test was successful")); |
|
1510 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1511 break; |
|
1512 case KErrExpectedValueDifferent: |
|
1513 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1514 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1515 break; |
|
1516 case KErrSkippedEvents: |
|
1517 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1518 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1519 break; |
|
1520 default: |
|
1521 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1522 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1523 } |
|
1524 |
|
1525 CleanupStack::PopAndDestroy(mEventSetBalance); |
|
1526 CleanupStack::Pop(reportParams); |
|
1527 |
|
1528 CleanupStack::PopAndDestroy(sndPlayer); |
|
1529 return KErrNone; //aResult.iResult; |
|
1530 |
|
1531 } |
|
1532 else |
|
1533 { |
|
1534 //The file name of the clip to play is missing |
|
1535 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1536 aResult.iResult = KErrNotExecuted; |
|
1537 return KErrConfigInvalid; |
|
1538 } |
|
1539 } |
|
1540 |
|
1541 |
|
1542 TInt CDRMAudioPlay::TestCasePlayFileSetPriorityL(CStifSectionParser *section , TTestResult &aResult) |
|
1543 { |
|
1544 TPtrC FileNamePtr; |
|
1545 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1546 |
|
1547 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1548 { |
|
1549 TBool UsingDefaultReportDelay;; |
|
1550 TFileName FileName = FileNamePtr; |
|
1551 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1552 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1553 CleanupStack::PushL(sndPlayer); |
|
1554 |
|
1555 //############################################### |
|
1556 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1557 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1558 //############################################### |
|
1559 |
|
1560 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionSetPriority); |
|
1561 CleanupStack::PushL(reportParams); |
|
1562 CMediaEvent *mEventGetBalance = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1563 |
|
1564 iLogger->Log(_L("Starting scheduler")); |
|
1565 CActiveScheduler::Start(); |
|
1566 |
|
1567 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1568 |
|
1569 aResult.iResult = sndPlayer->iFinalError; |
|
1570 |
|
1571 if (mEventGetBalance->GetCount() <= 0) |
|
1572 { |
|
1573 aResult.iResult = KErrSkippedEvents; |
|
1574 } |
|
1575 |
|
1576 switch (aResult.iResult) |
|
1577 { |
|
1578 case KErrNone: |
|
1579 iLogger->Log(_L("Test was successful")); |
|
1580 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1581 break; |
|
1582 case KErrExpectedValueDifferent: |
|
1583 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1584 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1585 break; |
|
1586 case KErrSkippedEvents: |
|
1587 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1588 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1589 break; |
|
1590 default: |
|
1591 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1592 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1593 } |
|
1594 |
|
1595 CleanupStack::PopAndDestroy(mEventGetBalance); |
|
1596 CleanupStack::Pop(reportParams); |
|
1597 |
|
1598 CleanupStack::PopAndDestroy(sndPlayer); |
|
1599 return KErrNone; //aResult.iResult; |
|
1600 |
|
1601 } |
|
1602 else |
|
1603 { |
|
1604 //The file name of the clip to play is missing |
|
1605 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1606 aResult.iResult = KErrNotExecuted; |
|
1607 return KErrConfigInvalid; |
|
1608 } |
|
1609 } |
|
1610 |
|
1611 |
|
1612 |
|
1613 TInt CDRMAudioPlay::TestCasePlayFileSetRepeatsL(CStifSectionParser *section , TTestResult &aResult) |
|
1614 { |
|
1615 TPtrC FileNamePtr; |
|
1616 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1617 |
|
1618 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1619 { |
|
1620 TBool UsingDefaultReportDelay;; |
|
1621 TFileName FileName = FileNamePtr; |
|
1622 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1623 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1624 sndPlayer->ControllerImplementationInformationL(); |
|
1625 CleanupStack::PushL(sndPlayer); |
|
1626 |
|
1627 //############################################### |
|
1628 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1629 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1630 //############################################### |
|
1631 |
|
1632 //CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionSetRepeats); |
|
1633 //CleanupStack::PushL(reportParams); |
|
1634 //CMediaEvent *mEventSetRepeats = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1635 |
|
1636 iLogger->Log(_L("Starting scheduler")); |
|
1637 CActiveScheduler::Start(); |
|
1638 |
|
1639 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1640 |
|
1641 aResult.iResult = sndPlayer->iFinalError; |
|
1642 |
|
1643 /*if (mEventSetRepeats->GetCount() <= 0) |
|
1644 { |
|
1645 aResult.iResult = KErrSkippedEvents; |
|
1646 }*/ |
|
1647 |
|
1648 switch (aResult.iResult) |
|
1649 { |
|
1650 case KErrNone: |
|
1651 iLogger->Log(_L("Test was successful")); |
|
1652 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1653 break; |
|
1654 case KErrExpectedValueDifferent: |
|
1655 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1656 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1657 break; |
|
1658 case KErrSkippedEvents: |
|
1659 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1660 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1661 break; |
|
1662 default: |
|
1663 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1664 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1665 } |
|
1666 |
|
1667 //CleanupStack::PopAndDestroy(mEventSetRepeats); |
|
1668 //CleanupStack::Pop(reportParams); |
|
1669 |
|
1670 CleanupStack::PopAndDestroy(sndPlayer); |
|
1671 return KErrNone; //aResult.iResult; |
|
1672 |
|
1673 } |
|
1674 else |
|
1675 { |
|
1676 //The file name of the clip to play is missing |
|
1677 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1678 aResult.iResult = KErrNotExecuted; |
|
1679 return KErrConfigInvalid; |
|
1680 } |
|
1681 } |
|
1682 |
|
1683 |
|
1684 TInt CDRMAudioPlay::TestCasePlayFilesGetMetaDataEntryL(CStifSectionParser *section , TTestResult &aResult) |
|
1685 { |
|
1686 TPtrC FileNamePtr; |
|
1687 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1688 |
|
1689 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1690 { |
|
1691 TBool UsingDefaultReportDelay;; |
|
1692 TFileName FileName = FileNamePtr; |
|
1693 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1694 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1695 CleanupStack::PushL(sndPlayer); |
|
1696 |
|
1697 //############################################### |
|
1698 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1699 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1700 //############################################### |
|
1701 |
|
1702 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionGetBalance); |
|
1703 CleanupStack::PushL(reportParams); |
|
1704 CMediaEvent *mEventGetBalance = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1705 |
|
1706 iLogger->Log(_L("Starting scheduler")); |
|
1707 CActiveScheduler::Start(); |
|
1708 |
|
1709 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1710 |
|
1711 aResult.iResult = sndPlayer->iFinalError; |
|
1712 |
|
1713 if (mEventGetBalance->GetCount() <= 0) |
|
1714 { |
|
1715 aResult.iResult = KErrSkippedEvents; |
|
1716 } |
|
1717 |
|
1718 switch (aResult.iResult) |
|
1719 { |
|
1720 case KErrNone: |
|
1721 iLogger->Log(_L("Test was successful")); |
|
1722 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1723 break; |
|
1724 case KErrExpectedValueDifferent: |
|
1725 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1726 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1727 break; |
|
1728 case KErrSkippedEvents: |
|
1729 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1730 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1731 break; |
|
1732 default: |
|
1733 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1734 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1735 } |
|
1736 |
|
1737 CleanupStack::PopAndDestroy(mEventGetBalance); |
|
1738 CleanupStack::Pop(reportParams); |
|
1739 |
|
1740 CleanupStack::PopAndDestroy(sndPlayer); |
|
1741 return KErrNone; //aResult.iResult; |
|
1742 |
|
1743 } |
|
1744 else |
|
1745 { |
|
1746 //The file name of the clip to play is missing |
|
1747 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1748 aResult.iResult = KErrNotExecuted; |
|
1749 return KErrConfigInvalid; |
|
1750 } |
|
1751 } |
|
1752 |
|
1753 |
|
1754 |
|
1755 TInt CDRMAudioPlay::TestCasePlayFilesGetNumberOfMetaDataEntriesL(CStifSectionParser *section , TTestResult &aResult) |
|
1756 { |
|
1757 TPtrC FileNamePtr; |
|
1758 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1759 |
|
1760 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1761 { |
|
1762 TBool UsingDefaultReportDelay;; |
|
1763 TFileName FileName = FileNamePtr; |
|
1764 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1765 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1766 CleanupStack::PushL(sndPlayer); |
|
1767 |
|
1768 //############################################### |
|
1769 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1770 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1771 //############################################### |
|
1772 |
|
1773 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionGetBalance); |
|
1774 CleanupStack::PushL(reportParams); |
|
1775 CMediaEvent *mEventGetBalance = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1776 |
|
1777 iLogger->Log(_L("Starting scheduler")); |
|
1778 CActiveScheduler::Start(); |
|
1779 |
|
1780 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1781 |
|
1782 aResult.iResult = sndPlayer->iFinalError; |
|
1783 |
|
1784 if (mEventGetBalance->GetCount() <= 0) |
|
1785 { |
|
1786 aResult.iResult = KErrSkippedEvents; |
|
1787 } |
|
1788 |
|
1789 switch (aResult.iResult) |
|
1790 { |
|
1791 case KErrNone: |
|
1792 iLogger->Log(_L("Test was successful")); |
|
1793 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1794 break; |
|
1795 case KErrExpectedValueDifferent: |
|
1796 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1797 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1798 break; |
|
1799 case KErrSkippedEvents: |
|
1800 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1801 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1802 break; |
|
1803 default: |
|
1804 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1805 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1806 } |
|
1807 |
|
1808 CleanupStack::PopAndDestroy(mEventGetBalance); |
|
1809 CleanupStack::Pop(reportParams); |
|
1810 |
|
1811 CleanupStack::PopAndDestroy(sndPlayer); |
|
1812 return KErrNone; //aResult.iResult; |
|
1813 |
|
1814 } |
|
1815 else |
|
1816 { |
|
1817 //The file name of the clip to play is missing |
|
1818 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1819 aResult.iResult = KErrNotExecuted; |
|
1820 return KErrConfigInvalid; |
|
1821 } |
|
1822 } |
|
1823 |
|
1824 |
|
1825 |
|
1826 TInt CDRMAudioPlay::TestCasePlayFileGetBitRateL(CStifSectionParser *section , TTestResult &aResult) |
|
1827 { |
|
1828 TPtrC FileNamePtr; |
|
1829 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1830 |
|
1831 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1832 { |
|
1833 TBool UsingDefaultReportDelay;; |
|
1834 TFileName FileName = FileNamePtr; |
|
1835 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1836 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1837 CleanupStack::PushL(sndPlayer); |
|
1838 |
|
1839 //############################################### |
|
1840 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1841 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1842 //############################################### |
|
1843 |
|
1844 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionGetBitRate); |
|
1845 CleanupStack::PushL(reportParams); |
|
1846 CMediaEvent *mEventGetBitRate = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1847 |
|
1848 iLogger->Log(_L("Starting scheduler")); |
|
1849 CActiveScheduler::Start(); |
|
1850 |
|
1851 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1852 |
|
1853 aResult.iResult = sndPlayer->iFinalError; |
|
1854 |
|
1855 if (mEventGetBitRate->GetCount() <= 0) |
|
1856 { |
|
1857 aResult.iResult = KErrSkippedEvents; |
|
1858 } |
|
1859 |
|
1860 switch (aResult.iResult) |
|
1861 { |
|
1862 case KErrNone: |
|
1863 iLogger->Log(_L("Test was successful")); |
|
1864 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1865 break; |
|
1866 case KErrExpectedValueDifferent: |
|
1867 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1868 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1869 break; |
|
1870 case KErrSkippedEvents: |
|
1871 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1872 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1873 break; |
|
1874 default: |
|
1875 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1876 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1877 } |
|
1878 |
|
1879 CleanupStack::PopAndDestroy(mEventGetBitRate); |
|
1880 CleanupStack::Pop(reportParams); |
|
1881 |
|
1882 CleanupStack::PopAndDestroy(sndPlayer); |
|
1883 return KErrNone; //aResult.iResult; |
|
1884 |
|
1885 } |
|
1886 else |
|
1887 { |
|
1888 //The file name of the clip to play is missing |
|
1889 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1890 aResult.iResult = KErrNotExecuted; |
|
1891 return KErrConfigInvalid; |
|
1892 } |
|
1893 } |
|
1894 |
|
1895 |
|
1896 |
|
1897 TInt CDRMAudioPlay::TestCasePlayFilesImplementationInformation(CStifSectionParser *section , TTestResult &aResult) |
|
1898 { |
|
1899 TPtrC FileNamePtr; |
|
1900 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1901 |
|
1902 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1903 { |
|
1904 TBool UsingDefaultReportDelay;; |
|
1905 TFileName FileName = FileNamePtr; |
|
1906 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1907 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1908 CleanupStack::PushL(sndPlayer); |
|
1909 |
|
1910 //############################################### |
|
1911 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1912 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1913 //############################################### |
|
1914 |
|
1915 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionControllerImplementationInformation); |
|
1916 CleanupStack::PushL(reportParams); |
|
1917 CMediaEvent *mEventImplementationInformation = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1918 |
|
1919 iLogger->Log(_L("Starting scheduler")); |
|
1920 CActiveScheduler::Start(); |
|
1921 |
|
1922 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1923 |
|
1924 aResult.iResult = sndPlayer->iFinalError; |
|
1925 |
|
1926 if (mEventImplementationInformation->GetCount() <= 0) |
|
1927 { |
|
1928 aResult.iResult = KErrSkippedEvents; |
|
1929 } |
|
1930 |
|
1931 switch (aResult.iResult) |
|
1932 { |
|
1933 case KErrNone: |
|
1934 iLogger->Log(_L("Test was successful")); |
|
1935 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
1936 break; |
|
1937 case KErrExpectedValueDifferent: |
|
1938 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1939 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
1940 break; |
|
1941 case KErrSkippedEvents: |
|
1942 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1943 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
1944 break; |
|
1945 default: |
|
1946 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
1947 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
1948 } |
|
1949 |
|
1950 CleanupStack::PopAndDestroy(mEventImplementationInformation); |
|
1951 CleanupStack::Pop(reportParams); |
|
1952 |
|
1953 CleanupStack::PopAndDestroy(sndPlayer); |
|
1954 return KErrNone; //aResult.iResult; |
|
1955 |
|
1956 } |
|
1957 else |
|
1958 { |
|
1959 //The file name of the clip to play is missing |
|
1960 aResult.iResultDes.Copy(KConfigInvalid()); |
|
1961 aResult.iResult = KErrNotExecuted; |
|
1962 return KErrConfigInvalid; |
|
1963 } |
|
1964 } |
|
1965 |
|
1966 TInt CDRMAudioPlay::TestCasePlayFilesRegisterForAudioLoadingNotification(CStifSectionParser *section , TTestResult &aResult) |
|
1967 { |
|
1968 TPtrC FileNamePtr; |
|
1969 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
1970 |
|
1971 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
1972 { |
|
1973 TBool UsingDefaultReportDelay;; |
|
1974 TFileName FileName = FileNamePtr; |
|
1975 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
1976 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
1977 CleanupStack::PushL(sndPlayer); |
|
1978 |
|
1979 //############################################### |
|
1980 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
1981 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
1982 //############################################### |
|
1983 |
|
1984 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionRegisterForAudioLoadingNotification); |
|
1985 CleanupStack::PushL(reportParams); |
|
1986 CMediaEvent *mEventRegisterForAudioLoadingNotification = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
1987 |
|
1988 iLogger->Log(_L("Starting scheduler")); |
|
1989 CActiveScheduler::Start(); |
|
1990 |
|
1991 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
1992 |
|
1993 aResult.iResult = sndPlayer->iFinalError; |
|
1994 |
|
1995 if (mEventRegisterForAudioLoadingNotification->GetCount() <= 0) |
|
1996 { |
|
1997 aResult.iResult = KErrSkippedEvents; |
|
1998 } |
|
1999 |
|
2000 switch (aResult.iResult) |
|
2001 { |
|
2002 case KErrNone: |
|
2003 iLogger->Log(_L("Test was successful")); |
|
2004 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
2005 break; |
|
2006 case KErrExpectedValueDifferent: |
|
2007 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2008 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
2009 break; |
|
2010 case KErrSkippedEvents: |
|
2011 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2012 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
2013 break; |
|
2014 default: |
|
2015 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2016 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
2017 } |
|
2018 |
|
2019 CleanupStack::PopAndDestroy(mEventRegisterForAudioLoadingNotification); |
|
2020 CleanupStack::Pop(reportParams); |
|
2021 |
|
2022 CleanupStack::PopAndDestroy(sndPlayer); |
|
2023 return KErrNone; //aResult.iResult; |
|
2024 |
|
2025 } |
|
2026 else |
|
2027 { |
|
2028 //The file name of the clip to play is missing |
|
2029 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2030 aResult.iResult = KErrNotExecuted; |
|
2031 return KErrConfigInvalid; |
|
2032 } |
|
2033 } |
|
2034 |
|
2035 TInt CDRMAudioPlay::TestCasePlayFilesGetAudioLoadingProgress(CStifSectionParser *section , TTestResult &aResult) |
|
2036 { |
|
2037 TPtrC FileNamePtr; |
|
2038 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
2039 |
|
2040 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2041 { |
|
2042 TBool UsingDefaultReportDelay;; |
|
2043 TFileName FileName = FileNamePtr; |
|
2044 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2045 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2046 CleanupStack::PushL(sndPlayer); |
|
2047 |
|
2048 //############################################### |
|
2049 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
2050 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
2051 //############################################### |
|
2052 |
|
2053 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KplayerActionGetAudioLoadingProgress); |
|
2054 CleanupStack::PushL(reportParams); |
|
2055 CMediaEvent *mEventGetAudioLoadingProgress = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2056 |
|
2057 iLogger->Log(_L("Starting scheduler")); |
|
2058 CActiveScheduler::Start(); |
|
2059 |
|
2060 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2061 |
|
2062 aResult.iResult = sndPlayer->iFinalError; |
|
2063 |
|
2064 if (mEventGetAudioLoadingProgress->GetCount() <= 0) |
|
2065 { |
|
2066 aResult.iResult = KErrSkippedEvents; |
|
2067 } |
|
2068 |
|
2069 switch (aResult.iResult) |
|
2070 { |
|
2071 case KErrNone: |
|
2072 iLogger->Log(_L("Test was successful")); |
|
2073 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
2074 break; |
|
2075 case KErrExpectedValueDifferent: |
|
2076 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2077 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
2078 break; |
|
2079 case KErrSkippedEvents: |
|
2080 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2081 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
2082 break; |
|
2083 default: |
|
2084 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2085 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
2086 } |
|
2087 |
|
2088 CleanupStack::PopAndDestroy(mEventGetAudioLoadingProgress); |
|
2089 CleanupStack::Pop(reportParams); |
|
2090 |
|
2091 CleanupStack::PopAndDestroy(sndPlayer); |
|
2092 return KErrNone; //aResult.iResult; |
|
2093 |
|
2094 } |
|
2095 else |
|
2096 { |
|
2097 //The file name of the clip to play is missing |
|
2098 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2099 aResult.iResult = KErrNotExecuted; |
|
2100 return KErrConfigInvalid; |
|
2101 } |
|
2102 } |
|
2103 |
|
2104 |
|
2105 //FH |
|
2106 TInt CDRMAudioPlay::TestCasePlayHandlerWithDurationL(CStifSectionParser *section , TTestResult &aResult) |
|
2107 { |
|
2108 |
|
2109 TPtrC FileNamePtr; |
|
2110 User::LeaveIfError(iFs.Connect()); |
|
2111 iFs.ShareProtected(); |
|
2112 |
|
2113 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
2114 |
|
2115 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2116 { |
|
2117 TBool ExpectedDurationNotSet = EFalse, UsingDefaultReportDelay;; |
|
2118 TTimeIntervalMicroSeconds ExpectedDuration; |
|
2119 |
|
2120 TFileName FileName = FileNamePtr; |
|
2121 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
2122 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2123 // CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2124 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
2125 iFile.Close(); |
|
2126 CleanupStack::PushL(sndPlayer); |
|
2127 |
|
2128 //********************************************* |
|
2129 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
2130 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
2131 //********************************************* |
|
2132 ExpectedDuration = GetTimeIntervalL( section, KTagExpectedDuration, ExpectedDurationNotSet) ; |
|
2133 //********************************************* |
|
2134 |
|
2135 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportDuration); |
|
2136 CleanupStack::PushL(reportParams); |
|
2137 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2138 |
|
2139 iLogger->Log(_L("Starting scheduler")); |
|
2140 CActiveScheduler::Start(); |
|
2141 iFs.Close(); |
|
2142 |
|
2143 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2144 |
|
2145 aResult.iResult = sndPlayer->iFinalError; |
|
2146 |
|
2147 if (mEventReportPosition->GetCount() <= 0) |
|
2148 { |
|
2149 aResult.iResult = KErrSkippedEvents; |
|
2150 } |
|
2151 |
|
2152 if (!ExpectedDurationNotSet) |
|
2153 { |
|
2154 iLogger->Log(_L("Expected duration: (%d)") , ExpectedDuration.Int64() ); |
|
2155 |
|
2156 if ( ExpectedDuration!=sndPlayer->GetDuration() ) |
|
2157 { |
|
2158 aResult.iResult = KErrExpectedValueDifferent; |
|
2159 } |
|
2160 } |
|
2161 |
|
2162 switch (aResult.iResult) |
|
2163 { |
|
2164 case KErrNone: |
|
2165 iLogger->Log(_L("Test was successful")); |
|
2166 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
2167 break; |
|
2168 case KErrExpectedValueDifferent: |
|
2169 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2170 aResult.iResultDes.Copy( KTestCaseResultFailExpectedValueDifferent() ); |
|
2171 break; |
|
2172 case KErrSkippedEvents: |
|
2173 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2174 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
2175 break; |
|
2176 default: |
|
2177 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2178 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
2179 } |
|
2180 |
|
2181 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2182 CleanupStack::Pop(reportParams); |
|
2183 |
|
2184 CleanupStack::PopAndDestroy(sndPlayer); |
|
2185 return KErrNone; //aResult.iResult; |
|
2186 |
|
2187 } |
|
2188 else |
|
2189 { |
|
2190 //The file name of the clip to play is missing |
|
2191 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2192 aResult.iResult = KErrNotExecuted; |
|
2193 return KErrConfigInvalid; |
|
2194 } |
|
2195 } |
|
2196 |
|
2197 TInt CDRMAudioPlay::TestCasePlayFileWindowL(CStifSectionParser *section , TTestResult &aResult) |
|
2198 { |
|
2199 TPtrC FileNamePtr; |
|
2200 TTimeIntervalMicroSeconds StartPosition = KDefaultPosition; |
|
2201 TTimeIntervalMicroSeconds EndPosition = KDefaultPosition; |
|
2202 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
2203 TBool UsingDefault; |
|
2204 |
|
2205 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2206 { |
|
2207 TBool UsingStartDefault, UsingEndDefault, UsingDefaultReportDelay; |
|
2208 TFileName FileName = FileNamePtr; |
|
2209 // TInt WindowError; |
|
2210 |
|
2211 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2212 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2213 CleanupStack::PushL(sndPlayer); |
|
2214 |
|
2215 //********************* |
|
2216 StartPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
2217 EndPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
2218 |
|
2219 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
2220 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
2221 |
|
2222 |
|
2223 sndPlayer->iStartPosition = StartPosition; |
|
2224 sndPlayer->iEndPosition = EndPosition; |
|
2225 sndPlayer->iPlayWindow = true; |
|
2226 |
|
2227 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
2228 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
2229 |
|
2230 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition); |
|
2231 CleanupStack::PushL(reportParams); |
|
2232 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2233 |
|
2234 iLogger->Log(_L("Starting scheduler")); |
|
2235 TTime StartTime,EndTime; |
|
2236 StartTime.HomeTime(); |
|
2237 CActiveScheduler::Start(); |
|
2238 EndTime.HomeTime(); |
|
2239 |
|
2240 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
2241 |
|
2242 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2243 iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() ); |
|
2244 |
|
2245 |
|
2246 TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(EndPosition.Int64()) - I64INT(StartPosition.Int64())); |
|
2247 iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() ); |
|
2248 |
|
2249 if ( Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() ) |
|
2250 { //Durations too different |
|
2251 iLogger->Log(_L("The clips duration is too different from the actual duration + position") ); |
|
2252 aResult.iResult = KErrExpectedValueDifferent; |
|
2253 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
2254 } |
|
2255 else if (aResult.iResult = sndPlayer->iFinalError , aResult.iResult) |
|
2256 { |
|
2257 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2258 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
2259 } |
|
2260 else |
|
2261 { |
|
2262 iLogger->Log(_L("Test was successful")); |
|
2263 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2264 } |
|
2265 |
|
2266 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2267 CleanupStack::Pop(reportParams); |
|
2268 CleanupStack::PopAndDestroy(sndPlayer); |
|
2269 return KErrExecuted; |
|
2270 |
|
2271 } |
|
2272 else |
|
2273 { |
|
2274 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2275 aResult.iResult = KErrNotExecuted; |
|
2276 return KErrConfigInvalid; |
|
2277 } |
|
2278 } |
|
2279 |
|
2280 //FH |
|
2281 TInt CDRMAudioPlay::TestCasePlayHandlerWithWindowL(CStifSectionParser *section , TTestResult &aResult) |
|
2282 { |
|
2283 |
|
2284 TPtrC FileNamePtr; |
|
2285 User::LeaveIfError(iFs.Connect()); |
|
2286 iFs.ShareProtected(); |
|
2287 |
|
2288 TTimeIntervalMicroSeconds StartPosition = KDefaultPosition; |
|
2289 TTimeIntervalMicroSeconds EndPosition = KDefaultPosition; |
|
2290 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
2291 TBool UsingDefault; |
|
2292 |
|
2293 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2294 { |
|
2295 TBool UsingStartDefault, UsingEndDefault, UsingDefaultReportDelay; |
|
2296 TFileName FileName = FileNamePtr; |
|
2297 // TInt WindowError; |
|
2298 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
2299 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2300 // CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2301 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
2302 iFile.Close(); |
|
2303 CleanupStack::PushL(sndPlayer); |
|
2304 |
|
2305 //********************* |
|
2306 StartPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
2307 EndPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
2308 |
|
2309 TTimeIntervalMicroSeconds ErrorRange = GetTimeIntervalL(section, KTagErrorRange, UsingDefault, KDefaultErrorRange); |
|
2310 if (UsingDefault) {iLogger->Log(_L("Using default error range"));} |
|
2311 |
|
2312 |
|
2313 sndPlayer->iStartPosition = StartPosition; |
|
2314 sndPlayer->iEndPosition = EndPosition; |
|
2315 sndPlayer->iPlayWindow = true; |
|
2316 |
|
2317 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
2318 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
2319 |
|
2320 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition); |
|
2321 CleanupStack::PushL(reportParams); |
|
2322 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2323 |
|
2324 iLogger->Log(_L("Starting scheduler")); |
|
2325 TTime StartTime,EndTime; |
|
2326 StartTime.HomeTime(); |
|
2327 CActiveScheduler::Start(); |
|
2328 EndTime.HomeTime(); |
|
2329 iFs.Close(); |
|
2330 TTimeIntervalMicroSeconds PerceivedDuration = EndTime.MicroSecondsFrom( StartTime ); |
|
2331 |
|
2332 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2333 iLogger->Log(_L("Perceived duration: %d") , PerceivedDuration.Int64() ); |
|
2334 |
|
2335 |
|
2336 TTimeIntervalMicroSeconds ExpectedDuration = TTimeIntervalMicroSeconds(I64INT(EndPosition.Int64()) - I64INT(StartPosition.Int64())); |
|
2337 iLogger->Log(_L("ExpectedDuration: %d") ,ExpectedDuration.Int64() ); |
|
2338 |
|
2339 if ( Abs(ExpectedDuration.Int64() - PerceivedDuration.Int64()) > ErrorRange.Int64() ) |
|
2340 { //Durations too different |
|
2341 iLogger->Log(_L("The clips duration is too different from the actual duration + position") ); |
|
2342 aResult.iResult = KErrExpectedValueDifferent; |
|
2343 aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
2344 } |
|
2345 else if (aResult.iResult = sndPlayer->iFinalError , aResult.iResult) |
|
2346 { |
|
2347 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2348 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
2349 } |
|
2350 else |
|
2351 { |
|
2352 iLogger->Log(_L("Test was successful")); |
|
2353 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2354 } |
|
2355 |
|
2356 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2357 CleanupStack::Pop(reportParams); |
|
2358 CleanupStack::PopAndDestroy(sndPlayer); |
|
2359 return KErrExecuted; |
|
2360 |
|
2361 } |
|
2362 else |
|
2363 { |
|
2364 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2365 aResult.iResult = KErrNotExecuted; |
|
2366 return KErrConfigInvalid; |
|
2367 } |
|
2368 } |
|
2369 |
|
2370 TInt CDRMAudioPlay::TestCasePlayFileWindowClearL(CStifSectionParser *section , TTestResult &aResult) |
|
2371 { |
|
2372 TPtrC FileNamePtr; |
|
2373 TTimeIntervalMicroSeconds StartPosition = KDefaultPosition; |
|
2374 TTimeIntervalMicroSeconds EndPosition = KDefaultPosition; |
|
2375 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
2376 |
|
2377 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2378 { |
|
2379 TBool UsingStartDefault, UsingEndDefault, UsingDefaultReportDelay; |
|
2380 TFileName FileName = FileNamePtr; |
|
2381 |
|
2382 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2383 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2384 CleanupStack::PushL(sndPlayer); |
|
2385 |
|
2386 //********************* |
|
2387 StartPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
2388 EndPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
2389 |
|
2390 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
2391 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
2392 |
|
2393 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition); |
|
2394 CleanupStack::PushL(reportParams); |
|
2395 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2396 |
|
2397 sndPlayer->iStartPosition = StartPosition; |
|
2398 sndPlayer->iEndPosition = EndPosition; |
|
2399 sndPlayer->iPlayWindow = true; |
|
2400 sndPlayer->iClearWindow = true; |
|
2401 |
|
2402 |
|
2403 iLogger->Log(_L("Starting scheduler")); |
|
2404 CActiveScheduler::Start(); |
|
2405 |
|
2406 TBool PositionReset=ETrue; |
|
2407 TTimeIntervalMicroSeconds position; |
|
2408 TInt PosError = sndPlayer->GetPosition(position); |
|
2409 if ( !PosError && (position!=TTimeIntervalMicroSeconds(0) ) ) |
|
2410 { |
|
2411 iLogger->Log(_L("Position not reset to zero, position is (%d)") , position.Int64() ); |
|
2412 PositionReset=EFalse; |
|
2413 } |
|
2414 if (PosError) |
|
2415 { |
|
2416 iLogger->Log(_L("Error (%d) obtaining clip position"), PosError ); |
|
2417 } |
|
2418 |
|
2419 |
|
2420 if (!PositionReset) |
|
2421 { |
|
2422 iLogger->Log(_L("Error clearing PlayWindow, position not reset to zero") ); |
|
2423 aResult.iResult = KErrExpectedValueDifferent; |
|
2424 aResult.iResultDes.Copy(KTestCaseResultFail() ); |
|
2425 } |
|
2426 else if (aResult.iResult = sndPlayer->iFinalError , aResult.iResult) |
|
2427 { |
|
2428 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2429 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
2430 } |
|
2431 else |
|
2432 { |
|
2433 iLogger->Log(_L("Test was successful")); |
|
2434 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2435 } |
|
2436 |
|
2437 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2438 CleanupStack::Pop(reportParams); |
|
2439 CleanupStack::PopAndDestroy(sndPlayer); |
|
2440 return KErrExecuted; |
|
2441 |
|
2442 } |
|
2443 else |
|
2444 { |
|
2445 //The file name of the clip to play is missing |
|
2446 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2447 aResult.iResult = KErrNotExecuted; |
|
2448 return KErrConfigInvalid; |
|
2449 } |
|
2450 } |
|
2451 |
|
2452 //FH |
|
2453 TInt CDRMAudioPlay::TestCasePlayHandlerWithClearWindowL(CStifSectionParser *section , TTestResult &aResult) |
|
2454 { |
|
2455 |
|
2456 TPtrC FileNamePtr; |
|
2457 User::LeaveIfError(iFs.Connect()); |
|
2458 iFs.ShareProtected(); |
|
2459 |
|
2460 TTimeIntervalMicroSeconds StartPosition = KDefaultPosition; |
|
2461 TTimeIntervalMicroSeconds EndPosition = KDefaultPosition; |
|
2462 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
2463 |
|
2464 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2465 { |
|
2466 TBool UsingStartDefault, UsingEndDefault, UsingDefaultReportDelay; |
|
2467 TFileName FileName = FileNamePtr; |
|
2468 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
2469 |
|
2470 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2471 // CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2472 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
2473 iFile.Close(); |
|
2474 CleanupStack::PushL(sndPlayer); |
|
2475 |
|
2476 //********************* |
|
2477 StartPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
2478 EndPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
2479 |
|
2480 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultReportDelay, (TTimeIntervalMicroSeconds32)KDefaultReportDelay); |
|
2481 iLogger->Log(_L("Setting delays to report position to [%d]"), ReportDelay.Int()); |
|
2482 |
|
2483 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportPosition); |
|
2484 CleanupStack::PushL(reportParams); |
|
2485 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2486 |
|
2487 sndPlayer->iStartPosition = StartPosition; |
|
2488 sndPlayer->iEndPosition = EndPosition; |
|
2489 sndPlayer->iPlayWindow = true; |
|
2490 sndPlayer->iClearWindow = true; |
|
2491 |
|
2492 |
|
2493 iLogger->Log(_L("Starting scheduler")); |
|
2494 CActiveScheduler::Start(); |
|
2495 |
|
2496 iFs.Close(); |
|
2497 TBool PositionReset=ETrue; |
|
2498 TTimeIntervalMicroSeconds position; |
|
2499 TInt PosError = sndPlayer->GetPosition(position); |
|
2500 if ( !PosError && (position!=TTimeIntervalMicroSeconds(0) ) ) |
|
2501 { |
|
2502 iLogger->Log(_L("Position not reset to zero, position is (%d)") , position.Int64() ); |
|
2503 PositionReset=EFalse; |
|
2504 } |
|
2505 if (PosError) |
|
2506 { |
|
2507 iLogger->Log(_L("Error (%d) obtaining clip position"), PosError ); |
|
2508 } |
|
2509 |
|
2510 |
|
2511 if (!PositionReset) |
|
2512 { |
|
2513 iLogger->Log(_L("Error clearing PlayWindow, position not reset to zero") ); |
|
2514 aResult.iResult = KErrExpectedValueDifferent; |
|
2515 aResult.iResultDes.Copy(KTestCaseResultFail() ); |
|
2516 } |
|
2517 else if (aResult.iResult = sndPlayer->iFinalError , aResult.iResult) |
|
2518 { |
|
2519 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2520 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
2521 } |
|
2522 else |
|
2523 { |
|
2524 iLogger->Log(_L("Test was successful")); |
|
2525 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2526 } |
|
2527 |
|
2528 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2529 CleanupStack::Pop(reportParams); |
|
2530 CleanupStack::PopAndDestroy(sndPlayer); |
|
2531 return KErrExecuted; |
|
2532 |
|
2533 } |
|
2534 else |
|
2535 { |
|
2536 //The file name of the clip to play is missing |
|
2537 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2538 aResult.iResult = KErrNotExecuted; |
|
2539 return KErrConfigInvalid; |
|
2540 } |
|
2541 } |
|
2542 |
|
2543 TInt CDRMAudioPlay::TestCasePlayDesStopOpenL(CStifSectionParser *section , TTestResult &aResult) |
|
2544 { |
|
2545 TPtrC FileNamePtr; |
|
2546 |
|
2547 if ( !section->GetLine(KTagSoundDes, FileNamePtr, ENoTag) ) |
|
2548 { |
|
2549 TFileName FileName = FileNamePtr; |
|
2550 iLogger->Log(_L("Creating simple player with descriptor from [%S]"), &FileName); |
|
2551 //********************************************* |
|
2552 //Open descriptor |
|
2553 HBufC8 *SoundFile = GetDescriptor8LC(FileName, section); |
|
2554 HBufC8 *SoundFile2; |
|
2555 |
|
2556 //********************************************* |
|
2557 //FileName of second file to play |
|
2558 CParameters *stopParams ; |
|
2559 if ( section->GetNextLine(KTagSoundDes, FileNamePtr, ENoTag) ) |
|
2560 { //Using same filename |
|
2561 SoundFile2 = SoundFile->AllocLC(); |
|
2562 stopParams = CDes8Parameters::NewLC(CSimpleSoundPlayer::KPlayerActionStopPlayDes, *SoundFile2 ); |
|
2563 iLogger->Log(_L("Second descriptor filename not found, using the same file twice")); |
|
2564 } |
|
2565 else |
|
2566 { //Found second filename |
|
2567 FileName=FileNamePtr; |
|
2568 SoundFile2 = GetDescriptor8LC(FileName, section); |
|
2569 stopParams = CDes8Parameters::NewLC(CSimpleSoundPlayer::KPlayerActionStopPlayDes, *SoundFile2 ); |
|
2570 iLogger->Log(_L("Second descriptor from [%S]") , &FileName ); |
|
2571 } |
|
2572 |
|
2573 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewLC( *SoundFile, TestModuleIf() , *iLogger); |
|
2574 |
|
2575 TBool UsingDefault; |
|
2576 TTimeIntervalMicroSeconds32 StopDelay = GetTimeIntervalL(section, KTagDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultStopOpenPlayDelay); |
|
2577 if (UsingDefault) {iLogger->Log(_L("Error retrieving stop delay, using default"));} |
|
2578 iLogger->Log(_L("Setting delays to stop and open descriptor to [%d]"), StopDelay.Int()); |
|
2579 //********************************************* |
|
2580 |
|
2581 CMediaEvent *mEventStopPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, StopDelay, StopDelay, sndPlayer, stopParams); |
|
2582 |
|
2583 iLogger->Log(_L("Starting scheduler")); |
|
2584 CActiveScheduler::Start(); |
|
2585 |
|
2586 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2587 |
|
2588 //]TBool DontCheckExpectedDuration; |
|
2589 //]TTimeIntervalMicroSeconds ErrorRange=GetTimeIntervalL(section, KTagErrorRange, DontCheckExpectedDuration); |
|
2590 //]TBool DontUseExpectedDuration; |
|
2591 //]TTimeIntervalMicroSeconds ExpectedDuration=GetTimeIntervalL(section, KTagExpectedDuration, DontUseExpectedDuration); |
|
2592 |
|
2593 if (mEventStopPlay->GetCount() <= 0) |
|
2594 { |
|
2595 aResult.iResult = KErrSkippedEvents; |
|
2596 aResult.iResultDes.Copy(KTestCaseResultFailSkippedEvents); |
|
2597 iLogger->Log(KTestCaseResultFailSkippedEvents() ); |
|
2598 } |
|
2599 else if ( sndPlayer->iFinalError) |
|
2600 { |
|
2601 aResult.iResult = sndPlayer->iFinalError; |
|
2602 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2603 aResult.iResultDes.Copy(KTestCaseResultFail() ); |
|
2604 } |
|
2605 else |
|
2606 { |
|
2607 //]aResult.iResult = KErrNone; |
|
2608 //]if (!DontCheckExpectedDuration && !DontUseExpectedDuration) |
|
2609 //] { |
|
2610 //] if (!IsDurationInRange(0, ExpectedDuration, TTimeIntervalMicroSeconds(0), ErrorRange, sndPlayer->GetPlayStartTime(), sndPlayer->GetPlayStopTime() ) ) |
|
2611 //] { |
|
2612 //] iLogger->Log(_L("Duration too different")); |
|
2613 //] aResult.iResult = KErrExpectedValueDifferent; |
|
2614 //] } |
|
2615 //] } |
|
2616 //]if (aResult.iResult) |
|
2617 //] { |
|
2618 //] aResult.iResultDes.Copy(KTestCaseResultFailExpectedValueDifferent()); |
|
2619 //] } |
|
2620 //]else |
|
2621 //] { |
|
2622 iLogger->Log(_L("Test was successful")); |
|
2623 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2624 //] } |
|
2625 } |
|
2626 |
|
2627 CleanupStack::PopAndDestroy(mEventStopPlay); |
|
2628 CleanupStack::PopAndDestroy(sndPlayer); |
|
2629 CleanupStack::Pop(stopParams); |
|
2630 CleanupStack::PopAndDestroy(SoundFile2); |
|
2631 CleanupStack::PopAndDestroy(SoundFile); |
|
2632 return KErrExecuted; |
|
2633 } |
|
2634 else |
|
2635 { |
|
2636 //The file name of the clip to play is missing |
|
2637 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2638 aResult.iResult = KErrNotExecuted; |
|
2639 return KErrConfigInvalid; |
|
2640 } |
|
2641 } |
|
2642 |
|
2643 TInt CDRMAudioPlay::TestCasePlayFileWithVolumeRampL(CStifSectionParser *section , TTestResult &aResult) |
|
2644 { |
|
2645 TPtrC FileNamePtr; |
|
2646 TTimeIntervalMicroSeconds RampDuration = KDefaultRampDuration; |
|
2647 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
2648 |
|
2649 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2650 { |
|
2651 TFileName FileName = FileNamePtr; |
|
2652 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2653 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2654 CleanupStack::PushL(sndPlayer); |
|
2655 |
|
2656 //********************* |
|
2657 TBool UsingReportDefault, UsingRampDefault; |
|
2658 RampDuration = GetTimeIntervalL(section, KTagRampDuration, UsingRampDefault, KDefaultRampDuration); |
|
2659 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingReportDefault, (TTimeIntervalMicroSeconds32)KDefaultReportDelay ); |
|
2660 |
|
2661 // ****************************************** |
|
2662 iLogger->Log(_L("Seting up volume ramp with duration: %d"), RampDuration.Int64()); |
|
2663 if (UsingRampDefault) {iLogger->Log(_L("Using default Ramp duration of: %d") , KDefaultRampDuration.Int64());} |
|
2664 |
|
2665 sndPlayer->SetVolumeRamp(RampDuration); |
|
2666 |
|
2667 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportVolume); |
|
2668 CleanupStack::PushL(reportParams); |
|
2669 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2670 |
|
2671 iLogger->Log(_L("Starting scheduler")); |
|
2672 CActiveScheduler::Start(); |
|
2673 |
|
2674 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2675 aResult.iResult = sndPlayer->iFinalError; |
|
2676 |
|
2677 if (mEventReportPosition->GetCount() <= 0) |
|
2678 { |
|
2679 aResult.iResult = KErrSkippedEvents; |
|
2680 } |
|
2681 |
|
2682 switch (aResult.iResult) |
|
2683 { |
|
2684 case KErrNone: |
|
2685 iLogger->Log(_L("Test was successful")); |
|
2686 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
2687 break; |
|
2688 case KErrSkippedEvents: |
|
2689 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2690 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
2691 break; |
|
2692 default: |
|
2693 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2694 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
2695 } |
|
2696 |
|
2697 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2698 CleanupStack::Pop(reportParams); |
|
2699 CleanupStack::PopAndDestroy(sndPlayer); |
|
2700 return aResult.iResult; |
|
2701 |
|
2702 } |
|
2703 else |
|
2704 { |
|
2705 //The file name of the clip to play is missing |
|
2706 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2707 aResult.iResult = KErrNotExecuted; |
|
2708 return KErrConfigInvalid; |
|
2709 } |
|
2710 } |
|
2711 |
|
2712 //FH |
|
2713 TInt CDRMAudioPlay::TestCasePlayHandlerWithRampL(CStifSectionParser *section , TTestResult &aResult) |
|
2714 { |
|
2715 |
|
2716 TPtrC FileNamePtr; |
|
2717 User::LeaveIfError(iFs.Connect()); |
|
2718 iFs.ShareProtected(); |
|
2719 |
|
2720 TTimeIntervalMicroSeconds RampDuration = KDefaultRampDuration; |
|
2721 TTimeIntervalMicroSeconds32 ReportDelay=KDefaultReportDelay; |
|
2722 |
|
2723 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2724 { |
|
2725 TFileName FileName = FileNamePtr; |
|
2726 iLogger->Log(_L("Creating simple player with file [%S]"), &FileNamePtr); |
|
2727 User::LeaveIfError(iFile.Open( iFs, FileName, EFileRead)); |
|
2728 |
|
2729 //CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( FileName, TestModuleIf() , *iLogger); |
|
2730 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
2731 iFile.Close(); |
|
2732 CleanupStack::PushL(sndPlayer); |
|
2733 |
|
2734 //********************* |
|
2735 TBool UsingReportDefault, UsingRampDefault; |
|
2736 RampDuration = GetTimeIntervalL(section, KTagRampDuration, UsingRampDefault, KDefaultRampDuration); |
|
2737 ReportDelay = GetTimeIntervalL(section, KTagDelay, UsingReportDefault, (TTimeIntervalMicroSeconds32)KDefaultReportDelay ); |
|
2738 |
|
2739 // ****************************************** |
|
2740 iLogger->Log(_L("Seting up volume ramp with duration: %d"), RampDuration.Int64()); |
|
2741 if (UsingRampDefault) {iLogger->Log(_L("Using default Ramp duration of: %d") , KDefaultRampDuration.Int64());} |
|
2742 |
|
2743 sndPlayer->SetVolumeRamp(RampDuration); |
|
2744 |
|
2745 CParameters *reportParams = new(ELeave)CParameters(CSimpleSoundPlayer::KPlayerActionReportVolume); |
|
2746 CleanupStack::PushL(reportParams); |
|
2747 CMediaEvent *mEventReportPosition = CMediaEvent::NewLC(TestModuleIf() , *iLogger, ReportDelay, ReportDelay, sndPlayer, reportParams); |
|
2748 |
|
2749 iLogger->Log(_L("Starting scheduler")); |
|
2750 CActiveScheduler::Start(); |
|
2751 iFs.Close(); |
|
2752 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
2753 aResult.iResult = sndPlayer->iFinalError; |
|
2754 |
|
2755 if (mEventReportPosition->GetCount() <= 0) |
|
2756 { |
|
2757 aResult.iResult = KErrSkippedEvents; |
|
2758 } |
|
2759 |
|
2760 switch (aResult.iResult) |
|
2761 { |
|
2762 case KErrNone: |
|
2763 iLogger->Log(_L("Test was successful")); |
|
2764 aResult.iResultDes.Copy( KTestCaseResultSuccess() ); |
|
2765 break; |
|
2766 case KErrSkippedEvents: |
|
2767 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2768 aResult.iResultDes.Copy( KTestCaseResultFailSkippedEvents() ); |
|
2769 break; |
|
2770 default: |
|
2771 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2772 aResult.iResultDes.Copy( KTestCaseResultFail() ); |
|
2773 } |
|
2774 |
|
2775 CleanupStack::PopAndDestroy(mEventReportPosition); |
|
2776 CleanupStack::Pop(reportParams); |
|
2777 CleanupStack::PopAndDestroy(sndPlayer); |
|
2778 return aResult.iResult; |
|
2779 |
|
2780 } |
|
2781 else |
|
2782 { |
|
2783 //The file name of the clip to play is missing |
|
2784 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2785 aResult.iResult = KErrNotExecuted; |
|
2786 return KErrConfigInvalid; |
|
2787 } |
|
2788 } |
|
2789 |
|
2790 |
|
2791 TInt CDRMAudioPlay::TestCasePlayFilesWithPrioritiesL(CStifSectionParser *section , TTestResult &aResult) |
|
2792 { |
|
2793 TPtrC FileNamePtr; |
|
2794 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2795 { |
|
2796 TInt PriorityLow = EMdaPriorityNormal+1; |
|
2797 TInt PriorityHigh = EMdaPriorityNormal+20; |
|
2798 |
|
2799 TBool UsingDefaultPriority; |
|
2800 PriorityHigh = GetIntL(section, KTagPriority, UsingDefaultPriority, PriorityHigh); |
|
2801 PriorityLow = GetIntL(section, KTagPriority, UsingDefaultPriority, PriorityLow, ETrue); |
|
2802 |
|
2803 if (PriorityHigh < PriorityLow) |
|
2804 { |
|
2805 TInt tempPriority = PriorityHigh; |
|
2806 PriorityHigh = PriorityLow; |
|
2807 PriorityLow = tempPriority; |
|
2808 } |
|
2809 |
|
2810 TBool UsingDefaultPriorityPreference; |
|
2811 TInt tmpPrefHigh = GetIntL(section, KTagPriorityPreference, UsingDefaultPriorityPreference, -1); |
|
2812 TInt tmpPrefLow = GetIntL(section, KTagPriorityPreference, UsingDefaultPriorityPreference, tmpPrefHigh, ETrue); |
|
2813 |
|
2814 TMdaPriorityPreference prefHigh; |
|
2815 switch (tmpPrefHigh) |
|
2816 { |
|
2817 case 0: |
|
2818 prefHigh = EMdaPriorityPreferenceNone; break; |
|
2819 case 1: |
|
2820 prefHigh = EMdaPriorityPreferenceTime; break; |
|
2821 case 2: |
|
2822 prefHigh = EMdaPriorityPreferenceQuality; break; |
|
2823 case 3: |
|
2824 default: |
|
2825 prefHigh = EMdaPriorityPreferenceTimeAndQuality; break; |
|
2826 } |
|
2827 TMdaPriorityPreference prefLow; |
|
2828 switch (tmpPrefLow) |
|
2829 { |
|
2830 case 0: |
|
2831 prefLow = EMdaPriorityPreferenceNone; break; |
|
2832 case 1: |
|
2833 prefLow = EMdaPriorityPreferenceTime; break; |
|
2834 case 2: |
|
2835 prefLow = EMdaPriorityPreferenceQuality; break; |
|
2836 case 3: |
|
2837 default: |
|
2838 prefLow = EMdaPriorityPreferenceTimeAndQuality; break; |
|
2839 } |
|
2840 |
|
2841 TFileName FileName = FileNamePtr; |
|
2842 TObjectCountDown counter; |
|
2843 |
|
2844 iLogger->Log(_L("Creating playerHigh with file [%S]"), &FileName); |
|
2845 CSimpleSoundPlayer *sndPlayerHigh = CSimpleSoundPlayer::NewLC( FileName, TestModuleIf() , *iLogger); |
|
2846 |
|
2847 if ( section->GetNextLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2848 { |
|
2849 iLogger->Log(_L("Second filename not found, using the same file twice")); |
|
2850 } |
|
2851 else |
|
2852 { |
|
2853 FileName=FileNamePtr; |
|
2854 iLogger->Log(_L("Second filename set to [%S]") , &FileName ); |
|
2855 } |
|
2856 |
|
2857 // *************** |
|
2858 iLogger->Log(_L("Creating playerLow with file [%S]"), &FileName); |
|
2859 CSimpleSoundPlayer *sndPlayerLow = CSimpleSoundPlayer::NewLC( FileName, TestModuleIf() , *iLogger); |
|
2860 |
|
2861 iLogger->Log(_L("Setting playerLow priority to (%d)"), PriorityLow); |
|
2862 sndPlayerLow->SetPriority( PriorityLow, prefLow); |
|
2863 |
|
2864 iLogger->Log(_L("Setting playerHigh priority to (%d)"), PriorityHigh); |
|
2865 sndPlayerHigh->SetPriority( PriorityHigh, prefHigh); |
|
2866 |
|
2867 sndPlayerLow->SetSupervisor(&counter); |
|
2868 sndPlayerHigh->SetSupervisor(&counter); |
|
2869 |
|
2870 iLogger->Log(_L("Starting scheduler")); |
|
2871 CActiveScheduler::Start(); |
|
2872 |
|
2873 iLogger->Log(_L("Returned from playerHigh, errorcode: (%d)"), sndPlayerHigh->iFinalError ); |
|
2874 iLogger->Log(_L("Returned from playerLow, errorcode: (%d)"), sndPlayerLow->iFinalError ); |
|
2875 |
|
2876 aResult.iResult = sndPlayerHigh->iFinalError ; |
|
2877 if (aResult.iResult) |
|
2878 { |
|
2879 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2880 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
2881 } |
|
2882 else |
|
2883 { |
|
2884 iLogger->Log(_L("Test was successful")); |
|
2885 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2886 } |
|
2887 CleanupStack::PopAndDestroy(sndPlayerLow); |
|
2888 CleanupStack::PopAndDestroy(sndPlayerHigh); |
|
2889 return KErrExecuted; |
|
2890 } |
|
2891 else |
|
2892 { |
|
2893 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2894 aResult.iResult = KErrNotExecuted; |
|
2895 return KErrConfigInvalid; |
|
2896 } |
|
2897 } |
|
2898 |
|
2899 TInt CDRMAudioPlay::TestCasePlayFilesWithVolumesL(CStifSectionParser *section , TTestResult &aResult) |
|
2900 { |
|
2901 TPtrC FileNamePtr; |
|
2902 if ( !section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2903 { |
|
2904 TFileName FileName = FileNamePtr; |
|
2905 TObjectCountDown counter; |
|
2906 |
|
2907 CSimpleSoundPlayer *sndPlayerHigh = CSimpleSoundPlayer::NewLC( FileName, TestModuleIf() , *iLogger); |
|
2908 // TInt VolumeHigh; |
|
2909 // sndPlayerHigh->SetVolume(VolumeHigh=sndPlayerHigh->MaxVolume()); |
|
2910 // iLogger->Log(_L("Creating player 1 (playerHigh) with file [%S] and volume (%d), max=(%d)"), &FileName, VolumeHigh, sndPlayerHigh->MaxVolume() ); |
|
2911 iLogger->Log(_L("Creating player 1 (playerHigh) with file [%S] "), &FileName); |
|
2912 |
|
2913 sndPlayerHigh->iPlayVolume = true; |
|
2914 |
|
2915 if ( section->GetNextLine(KTagSoundFile, FileNamePtr, ENoTag) ) |
|
2916 { |
|
2917 iLogger->Log(_L("Second filename not found, using the same file twice")); |
|
2918 } |
|
2919 else |
|
2920 { |
|
2921 FileName=FileNamePtr; |
|
2922 iLogger->Log(_L("Second filename set to [%S]") , &FileName ); |
|
2923 } |
|
2924 |
|
2925 // *************** |
|
2926 CSimpleSoundPlayer *sndPlayerLow = CSimpleSoundPlayer::NewLC( FileName , TestModuleIf() , *iLogger , EFalse); |
|
2927 // TInt VolumeLow; |
|
2928 // sndPlayerLow->SetVolume(VolumeLow=sndPlayerLow->MaxVolume()/2); |
|
2929 // iLogger->Log(_L("Creating player 2 (playerLow) with file [%S] and volume (%d), max=(%d)"), &FileName, VolumeLow, sndPlayerLow->MaxVolume() ); |
|
2930 iLogger->Log(_L("Creating player 2 (playerHigh) with file [%S] "), &FileName); |
|
2931 sndPlayerLow->iPlayVolume = true; |
|
2932 |
|
2933 CParameters *mPlayParameters = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPlay ); |
|
2934 CleanupStack::PushL(mPlayParameters); |
|
2935 |
|
2936 sndPlayerHigh->SetPlayCompleteTarget(sndPlayerLow, mPlayParameters); |
|
2937 |
|
2938 sndPlayerLow->SetSupervisor(&counter); |
|
2939 sndPlayerHigh->SetSupervisor(&counter); |
|
2940 |
|
2941 iLogger->Log(_L("Starting scheduler")); |
|
2942 |
|
2943 |
|
2944 CActiveScheduler::Start(); |
|
2945 |
|
2946 |
|
2947 iLogger->Log(_L("Returned from playerHigh, errorcode: (%d)"), sndPlayerHigh->iFinalError ); |
|
2948 iLogger->Log(_L("Returned from playerLow, errorcode: (%d)"), sndPlayerLow->iFinalError ); |
|
2949 |
|
2950 aResult.iResult = sndPlayerHigh->iFinalError ; |
|
2951 |
|
2952 if (!sndPlayerHigh->iFinalError && !sndPlayerLow->iFinalError) |
|
2953 { |
|
2954 iLogger->Log(_L("Test was successful")); |
|
2955 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
2956 aResult.iResult = KErrNone; |
|
2957 } |
|
2958 else |
|
2959 { |
|
2960 if (sndPlayerHigh->iFinalError) |
|
2961 { |
|
2962 aResult.iResult = sndPlayerHigh->iFinalError; |
|
2963 } |
|
2964 if (sndPlayerLow->iFinalError) |
|
2965 { |
|
2966 aResult.iResult = sndPlayerLow->iFinalError; |
|
2967 } |
|
2968 |
|
2969 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
2970 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
2971 } |
|
2972 CleanupStack::PopAndDestroy(mPlayParameters); |
|
2973 CleanupStack::PopAndDestroy(sndPlayerLow); |
|
2974 CleanupStack::PopAndDestroy(sndPlayerHigh); |
|
2975 return KErrExecuted; |
|
2976 } |
|
2977 else |
|
2978 { |
|
2979 aResult.iResultDes.Copy(KConfigInvalid()); |
|
2980 aResult.iResult = KErrNotExecuted; |
|
2981 return KErrConfigInvalid; |
|
2982 } |
|
2983 } |
|
2984 |
|
2985 TInt CDRMAudioPlay::TestCasePlayUrlL(CStifSectionParser *section , TTestResult &aResult) |
|
2986 { |
|
2987 TPtrC UrlPtr; |
|
2988 if ( !section->GetLine(KTagSoundUrl, UrlPtr, ENoTag) ) |
|
2989 { |
|
2990 CStifItemParser *item; |
|
2991 HBufC *Url = UrlPtr.AllocLC(); |
|
2992 TInt IapId = KUseDefaultIap; |
|
2993 TPtrC MimePtr; |
|
2994 HBufC *Mime; |
|
2995 HBufC8 *Mime8; |
|
2996 if ( ! section->GetLine(KTagMime, MimePtr, ENoTag) ) |
|
2997 { |
|
2998 Mime = MimePtr.AllocLC(); |
|
2999 } |
|
3000 else |
|
3001 { |
|
3002 Mime = KNullDesC().AllocLC(); |
|
3003 } |
|
3004 |
|
3005 if ( item=section->GetItemLineL(KTagIapId) , item) |
|
3006 { |
|
3007 CleanupStack::PushL(item); |
|
3008 TInt newVal; |
|
3009 if ( ! item->GetInt(KTagIapId, newVal) ) |
|
3010 { |
|
3011 IapId = newVal; |
|
3012 } |
|
3013 CleanupStack::PopAndDestroy(item); |
|
3014 } |
|
3015 |
|
3016 Mime8 = HBufC8::NewLC( Mime->Length() ); |
|
3017 TPtr8 Mime8Ptr = Mime8->Des(); |
|
3018 |
|
3019 for (TInt x=0 ; x < Mime->Length() ; x++) |
|
3020 { |
|
3021 //TUint8 tmp8 = (TUint8)( (*Mime)[x]); |
|
3022 //TBufC8<10> tmp( &tmp8 ); |
|
3023 TUint8 tmp8Array[2] = {0, 0}; |
|
3024 //tmp8Array[1]=0; |
|
3025 tmp8Array[0]=(TUint8)( (*Mime)[x] ); |
|
3026 TBufC8<10> tmp( tmp8Array ); |
|
3027 Mime8Ptr += tmp.Left(1); |
|
3028 } |
|
3029 |
|
3030 iLogger->Log(_L("Creating simple player with url [%S], IapId [%d] "), Url, IapId); |
|
3031 iLogger->Log(_L8(" and MIME Type [%S]L(%d)") , Mime8, Mime8->Length() ); |
|
3032 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewUrlLC( *Url, IapId, *Mime8, TestModuleIf() , *iLogger); |
|
3033 |
|
3034 iLogger->Log(_L("Starting scheduler")); |
|
3035 CActiveScheduler::Start(); |
|
3036 |
|
3037 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3038 aResult.iResult = sndPlayer->iFinalError ; |
|
3039 if (aResult.iResult) |
|
3040 { |
|
3041 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3042 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3043 } |
|
3044 else |
|
3045 { |
|
3046 iLogger->Log(_L("Test was successful")); |
|
3047 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3048 } |
|
3049 CleanupStack::PopAndDestroy(sndPlayer); |
|
3050 CleanupStack::PopAndDestroy(Mime8); |
|
3051 CleanupStack::PopAndDestroy(Mime); |
|
3052 CleanupStack::PopAndDestroy(Url); |
|
3053 return KErrExecuted; |
|
3054 |
|
3055 } |
|
3056 else |
|
3057 { |
|
3058 //The file name of the clip to play is missing |
|
3059 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3060 aResult.iResult = KErrNotExecuted; |
|
3061 return KErrConfigInvalid; |
|
3062 } |
|
3063 } |
|
3064 |
|
3065 TInt CDRMAudioPlay::TestCasePlayUrlStopOpenL(CStifSectionParser *section , TTestResult &aResult) |
|
3066 { |
|
3067 TPtrC UrlPtr; |
|
3068 TTimeIntervalMicroSeconds32 StopDelay=KDefaultStopOpenPlayDelay; |
|
3069 |
|
3070 if ( !section->GetLine(KTagSoundUrl, UrlPtr, ENoTag) ) |
|
3071 { |
|
3072 CStifItemParser *item; |
|
3073 TInt IapId = KUseDefaultIap; |
|
3074 TInt IapIdB = KUseDefaultIap; |
|
3075 |
|
3076 TPtrC MimePtr; |
|
3077 HBufC *Mime; |
|
3078 HBufC8 *Mime8; |
|
3079 |
|
3080 HBufC *MimeB; |
|
3081 HBufC8 *Mime8B; |
|
3082 |
|
3083 HBufC *Url = UrlPtr.AllocLC(); |
|
3084 if ( ! section->GetLine(KTagMime, MimePtr, ENoTag) ) |
|
3085 { |
|
3086 Mime = MimePtr.AllocLC(); |
|
3087 } |
|
3088 else |
|
3089 { |
|
3090 Mime = KNullDesC().AllocLC(); |
|
3091 } |
|
3092 |
|
3093 Mime8 = HBufC8::NewLC( Mime->Length() ); |
|
3094 TPtr8 Mime8Ptr = Mime8->Des(); |
|
3095 TInt x; |
|
3096 for (x=0 ; x < Mime->Length() ; x++) |
|
3097 { |
|
3098 TUint8 tmp8[2]; |
|
3099 tmp8[0] = (TUint8)( (*Mime)[x]); |
|
3100 tmp8[1] = '\0'; |
|
3101 TBufC8<10> tmp( tmp8 ); |
|
3102 Mime8Ptr += tmp.Left(1); |
|
3103 } |
|
3104 |
|
3105 if ( item=section->GetItemLineL(KTagIapId) , item) |
|
3106 { |
|
3107 CleanupStack::PushL(item); |
|
3108 TInt newVal; |
|
3109 if ( ! item->GetInt(KTagIapId, newVal) ) |
|
3110 { |
|
3111 IapId = newVal; |
|
3112 } |
|
3113 CleanupStack::PopAndDestroy(item); |
|
3114 } |
|
3115 |
|
3116 iLogger->Log(_L("Creating simple player with url [%S], IapId [%d] "), Url, IapId); |
|
3117 iLogger->Log(_L8(" and MIME Type [%S]L(%d)") , Mime8, Mime8->Length() ); |
|
3118 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewUrlLC( *Url, IapId, *Mime8, TestModuleIf() , *iLogger); |
|
3119 |
|
3120 //********************************************* |
|
3121 //Url of second file to play |
|
3122 HBufC *UrlB; |
|
3123 if ( ! section->GetLine(KTagMime, MimePtr, ENoTag) ) |
|
3124 { |
|
3125 MimeB = MimePtr.AllocLC(); |
|
3126 } |
|
3127 else |
|
3128 { |
|
3129 MimeB = KNullDesC().AllocLC(); |
|
3130 } |
|
3131 |
|
3132 Mime8B = HBufC8::NewLC( MimeB->Length() ); |
|
3133 TPtr8 Mime8PtrB = Mime8B->Des(); |
|
3134 for (x=0 ; x < MimeB->Length() ; x++) |
|
3135 { |
|
3136 TUint8 tmp8B = (TUint8)( (*MimeB)[x]); |
|
3137 TBufC8<10> tmpB( &tmp8B ); |
|
3138 Mime8PtrB += tmpB.Left(1); |
|
3139 } |
|
3140 |
|
3141 if ( item=section->GetItemLineL(KTagIapId) , item) |
|
3142 { |
|
3143 CleanupStack::PushL(item); |
|
3144 TInt newValB; |
|
3145 if ( ! item->GetInt(KTagIapId, newValB) ) |
|
3146 { |
|
3147 IapIdB = newValB; |
|
3148 } |
|
3149 CleanupStack::PopAndDestroy(item); |
|
3150 } |
|
3151 |
|
3152 CUrlParameters *stopParams ; |
|
3153 if ( section->GetNextLine(KTagSoundUrl, UrlPtr, ENoTag) ) |
|
3154 { |
|
3155 iLogger->Log(_L("Second url not found, using the same file twice")); |
|
3156 UrlB = Url->AllocLC(); |
|
3157 } |
|
3158 else |
|
3159 { |
|
3160 iLogger->Log(_L("Second url set to [%S]") , &UrlPtr ); |
|
3161 UrlB = UrlPtr.AllocLC(); |
|
3162 } |
|
3163 |
|
3164 stopParams = new(ELeave) CUrlParameters (CSimpleSoundPlayer::KPlayerActionStopPlayUrl, *UrlB, IapIdB, *Mime8B); |
|
3165 CleanupStack::PushL(stopParams); |
|
3166 |
|
3167 TBool UsingDefaultDelay=EFalse; |
|
3168 StopDelay = GetTimeIntervalL(section, KTagDelay, UsingDefaultDelay, (TTimeIntervalMicroSeconds32)KDefaultStopOpenPlayDelay); |
|
3169 |
|
3170 iLogger->Log(_L("Setting delays to stop and open url to [%d]"), StopDelay.Int()); |
|
3171 //********************************************* |
|
3172 |
|
3173 CMediaEvent *mEventStopPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, StopDelay, StopDelay, sndPlayer, stopParams); |
|
3174 |
|
3175 iLogger->Log(_L("Starting scheduler")); |
|
3176 CActiveScheduler::Start(); |
|
3177 |
|
3178 CleanupStack::PopAndDestroy(mEventStopPlay); |
|
3179 CleanupStack::Pop(stopParams); |
|
3180 |
|
3181 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3182 aResult.iResult = sndPlayer->iFinalError; |
|
3183 if (aResult.iResult) |
|
3184 { |
|
3185 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3186 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3187 } |
|
3188 else |
|
3189 { |
|
3190 iLogger->Log(_L("Test was successful")); |
|
3191 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3192 } |
|
3193 |
|
3194 CleanupStack::PopAndDestroy(UrlB); |
|
3195 CleanupStack::PopAndDestroy(Mime8B); |
|
3196 CleanupStack::PopAndDestroy(MimeB); |
|
3197 CleanupStack::PopAndDestroy(sndPlayer); |
|
3198 |
|
3199 CleanupStack::PopAndDestroy(Mime8); |
|
3200 CleanupStack::PopAndDestroy(Mime); |
|
3201 |
|
3202 CleanupStack::PopAndDestroy(Url); |
|
3203 return KErrExecuted; |
|
3204 |
|
3205 } |
|
3206 else |
|
3207 { |
|
3208 //The file name of the clip to play is missing |
|
3209 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3210 aResult.iResult = KErrNotExecuted; |
|
3211 return KErrConfigInvalid; |
|
3212 } |
|
3213 } |
|
3214 |
|
3215 // ** Module ***************************************************************** |
|
3216 HBufC8 *CDRMAudioPlay::GetDescriptor8LC(const TFileName &aFileName, CStifSectionParser *section) |
|
3217 { |
|
3218 TInt FileError, SoundSize=0; |
|
3219 RFile file; |
|
3220 RFs FsSession; |
|
3221 HBufC8 *SoundFile; |
|
3222 |
|
3223 |
|
3224 TInt MimeUsed = 0; |
|
3225 CStifItemParser *item; |
|
3226 item = section->GetItemLineL(KTagMime); |
|
3227 if (item) |
|
3228 { |
|
3229 CleanupStack::PushL(item); |
|
3230 item->GetInt(KTagMime, MimeUsed) ; |
|
3231 CleanupStack::PopAndDestroy(item); |
|
3232 } |
|
3233 |
|
3234 iLogger->Log(_L("Connecting to File Server Session") ); |
|
3235 FileError = FsSession.Connect(); |
|
3236 if (FileError) |
|
3237 { |
|
3238 iLogger->Log(_L("File error FsSession.Connect() (%d)") , FileError); |
|
3239 User::LeaveIfError(FileError); |
|
3240 } |
|
3241 |
|
3242 iLogger->Log(_L("Opening file to get size") ); |
|
3243 FileError = file.Open(FsSession, aFileName, EFileStream); |
|
3244 if (FileError) |
|
3245 { |
|
3246 iLogger->Log(_L("File error file.Open() (%d)") , FileError); |
|
3247 User::LeaveIfError(FileError); |
|
3248 } |
|
3249 FileError = file.Size(SoundSize); |
|
3250 iLogger->Log(_L("File Size (%d)") , SoundSize); |
|
3251 if (FileError) |
|
3252 { |
|
3253 iLogger->Log(_L("Error getting size") ); |
|
3254 User::LeaveIfError(FileError); |
|
3255 } |
|
3256 |
|
3257 // TPtr8 helper; |
|
3258 |
|
3259 if (MimeUsed == 1) |
|
3260 { |
|
3261 _LIT(MP3MIME,"zzaudio/mpeg"); |
|
3262 SoundFile = HBufC8::NewLC(SoundSize+12); |
|
3263 |
|
3264 TPtr8 helper(SoundFile->Des()); |
|
3265 helper.Append (MP3MIME); |
|
3266 helper.AppendFill (0x00, 1); |
|
3267 TPtr8 helper1(&helper[12], SoundSize); |
|
3268 User::LeaveIfError(file.Read(helper1, SoundSize)); |
|
3269 helper.SetLength (SoundSize+12); |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 } |
|
3275 else |
|
3276 { |
|
3277 SoundFile = HBufC8::NewLC(SoundSize); |
|
3278 |
|
3279 // TPtr8 helper = SoundFile->Des(); |
|
3280 TPtr8 helper(SoundFile->Des()); |
|
3281 // FileError = file.Read( helper ); |
|
3282 User::LeaveIfError(file.Read(helper, SoundSize)); |
|
3283 |
|
3284 |
|
3285 } |
|
3286 |
|
3287 iLogger->Log(_L("Descriptor length [%d]") , SoundFile->Size() ); |
|
3288 file.Close(); |
|
3289 FsSession.Close(); |
|
3290 return SoundFile; |
|
3291 } |
|
3292 |
|
3293 TTimeIntervalMicroSeconds CDRMAudioPlay::GetTimeIntervalL(CStifSectionParser *aSection, const TDesC &aTag, TBool &aUsingDefaults, const TTimeIntervalMicroSeconds &aDefaultInterval) |
|
3294 { |
|
3295 TInt TempInterval1=0 , TempInterval2=0; |
|
3296 TInt64 tmp=0; |
|
3297 TInt ParseError=KErrNotFound; |
|
3298 TTimeIntervalMicroSeconds ReturnValue = aDefaultInterval; |
|
3299 aUsingDefaults = ETrue; |
|
3300 |
|
3301 CStifItemParser *item = aSection->GetItemLineL(aTag); |
|
3302 if (item) |
|
3303 { |
|
3304 CleanupStack::PushL(item); |
|
3305 ParseError = item->GetInt(aTag, TempInterval1) ; |
|
3306 if (!ParseError) |
|
3307 { |
|
3308 //First delay found. |
|
3309 aUsingDefaults = EFalse; |
|
3310 tmp = TempInterval1*1000000; //convert from seconds to microseconds |
|
3311 |
|
3312 if ( ! item->GetNextInt(TempInterval2) ) |
|
3313 { |
|
3314 tmp += TempInterval2*1000; //add miliseconds |
|
3315 if ( ! item->GetNextInt(TempInterval2) ) |
|
3316 { |
|
3317 tmp += TempInterval2; |
|
3318 } |
|
3319 } |
|
3320 ReturnValue = tmp; |
|
3321 } |
|
3322 CleanupStack::PopAndDestroy(item); |
|
3323 } |
|
3324 if (ParseError) {iLogger->Log(_L("Error retrieving interval, [%S] not found"), &aTag);} |
|
3325 iLogger->Log(_L("Interval retrieved: (%d)") , ReturnValue.Int64()); |
|
3326 return ReturnValue; |
|
3327 } |
|
3328 |
|
3329 /*TTimeIntervalMicroSeconds CDRMAudioPlay::GetDelayL(CStifSectionParser *aSection, const TDesC &aTag) |
|
3330 {return 0;}*/ |
|
3331 |
|
3332 TTimeIntervalMicroSeconds32 CDRMAudioPlay::GetTimeIntervalL(CStifSectionParser *aSection, const TDesC &aTag, TBool &aUsingDefault, const TTimeIntervalMicroSeconds32 &aDefaultDelay) |
|
3333 { |
|
3334 TInt ParseError=KErrNotFound; |
|
3335 TInt TempDelay=0; |
|
3336 TTimeIntervalMicroSeconds32 ReturnValue=aDefaultDelay; |
|
3337 CStifItemParser *item = aSection->GetItemLineL(aTag); |
|
3338 if (item) |
|
3339 { |
|
3340 CleanupStack::PushL(item); |
|
3341 ParseError = item->GetInt(aTag, TempDelay) ; |
|
3342 if (ParseError) |
|
3343 { //Delay not found, using defaults |
|
3344 aUsingDefault=ETrue; |
|
3345 } |
|
3346 else |
|
3347 { //Delay found. |
|
3348 aUsingDefault=EFalse; |
|
3349 ReturnValue=TempDelay; |
|
3350 } |
|
3351 CleanupStack::PopAndDestroy(item); |
|
3352 } |
|
3353 if (ParseError) {iLogger->Log(_L("Error retrieving report delay, [%S] not found") , &aTag);} |
|
3354 return ReturnValue; |
|
3355 } |
|
3356 |
|
3357 TInt CDRMAudioPlay::RunTestCaseFunctionL(TInt id , CStifSectionParser *section , TTestResult &aResult) |
|
3358 { |
|
3359 switch (id) |
|
3360 { |
|
3361 case KCasePlayFile: |
|
3362 return TestCasePlayFileL(section, aResult); |
|
3363 case KCasePlayFileWithRamp: |
|
3364 return TestCasePlayFileWithVolumeRampL(section, aResult); |
|
3365 case KCasePlayFileWithRepeats: |
|
3366 return TestCasePlayFileWithRepeatsL(section, aResult); |
|
3367 case KCasePlayFileWithPause: |
|
3368 return TestCasePlayFileWithPauseL(section, aResult); |
|
3369 case KCasePlayFileWithPosition: |
|
3370 return TestCasePlayFileWithPositionL(section, aResult); |
|
3371 case KCasePlayFileWithBalance: |
|
3372 return TestCasePlayFileWithBalanceL(section, aResult); |
|
3373 case KCasePlayFileStopOpen: |
|
3374 return TestCasePlayFileStopOpenL(section, aResult); |
|
3375 case KCasePlayFileReportDuration: |
|
3376 return TestCasePlayFileReportDurationL(section, aResult); |
|
3377 case KCasePlayFileMaxVolume: |
|
3378 return TestCasePlayFileMaxVolumeL(section, aResult); |
|
3379 case KCasePlayFileSetVolume: |
|
3380 return TestCasePlayFileSetVolumeL(section, aResult); |
|
3381 case KCasePlayFileSetBalance: |
|
3382 return TestCasePlayFileSetBalanceL(section, aResult); |
|
3383 case KCasePlayFileGetBalance: |
|
3384 return TestCasePlayFileGetBalanceL(section, aResult); |
|
3385 case KCasePlayFileGetBitRate: |
|
3386 return TestCasePlayFileGetBitRateL(section, aResult); |
|
3387 case KCasePlayFileSetPriority: |
|
3388 return TestCasePlayFileSetPriorityL(section, aResult); |
|
3389 case KCasePlayFileSetRepeats: |
|
3390 return TestCasePlayFileSetRepeatsL(section, aResult); |
|
3391 case KCasePlayFileReportPosition: |
|
3392 return TestCasePlayFileReportPositionL(section, aResult); |
|
3393 case KCasePlayFileWindow: |
|
3394 return TestCasePlayFileWindowL(section, aResult); |
|
3395 case KCasePlayFileClearWindow: |
|
3396 return TestCasePlayFileWindowClearL(section, aResult); |
|
3397 case KCasePlayFilesWithPriorities: |
|
3398 return TestCasePlayFilesWithPrioritiesL(section, aResult); |
|
3399 case KCasePlayFilesWithVolumes: |
|
3400 return TestCasePlayFilesWithVolumesL(section, aResult); |
|
3401 case KCasePlayFilesGetMetaDataEntry: |
|
3402 return TestCasePlayFilesGetMetaDataEntryL(section, aResult); |
|
3403 case KCasePlayFilesGetNumberOfMetaDataEntries: |
|
3404 return TestCasePlayFilesGetNumberOfMetaDataEntriesL(section, aResult); |
|
3405 case KCasePlayDes: |
|
3406 return TestCasePlayDesL(section, aResult); |
|
3407 case KCasePlayDesStopOpen: |
|
3408 return TestCasePlayDesStopOpenL(section, aResult); |
|
3409 case KCasePlayUrl: |
|
3410 return TestCasePlayUrlL(section, aResult); |
|
3411 case KCasePlayUrlStopOpen: |
|
3412 return TestCasePlayUrlStopOpenL(section, aResult); |
|
3413 case KCasePlayFileMetaInfo: |
|
3414 return TestCasePlayFileMetaInfoL(section, aResult); |
|
3415 case KCaseImplementationInformation: |
|
3416 return TestCasePlayFileFormatsL(section, aResult); |
|
3417 case KCasePlayHandler: |
|
3418 return TestCasePlayHandlerL(section, aResult); |
|
3419 case KCasePlayHandlerStopOpen: |
|
3420 return TestCasePlayHandlerStopOpenL(section, aResult); |
|
3421 case KCasePlayHandlerWithPause: |
|
3422 return TestCasePlayHandlerWithPauseL(section, aResult); |
|
3423 case KCasePlayFileHandlerWithRamp: |
|
3424 return TestCasePlayHandlerWithRampL(section, aResult); |
|
3425 case KCasePlayFileHandlerWithSetPosition: |
|
3426 return TestCasePlayHandlerWithSetPositionL(section, aResult); |
|
3427 case KCasePlayFileHandlerWithGetPosition: |
|
3428 return TestCasePlayHandlerWithGetPositionL(section, aResult); |
|
3429 case KCasePlayFileHandlerWithDuration: |
|
3430 return TestCasePlayHandlerWithDurationL(section, aResult); |
|
3431 case KCasePlayFileHandlerWithWindow: |
|
3432 return TestCasePlayHandlerWithWindowL(section, aResult); |
|
3433 case KCasePlayFileHandlerWithClearWindow: |
|
3434 return TestCasePlayHandlerWithClearWindowL(section, aResult); |
|
3435 case KCasePlayFileGetAudioLoadingProgress: |
|
3436 return TestCasePlayFilesGetAudioLoadingProgress(section, aResult); |
|
3437 case KCasePlayFileRegisterForAudioLoadingNotification: |
|
3438 return TestCasePlayFilesRegisterForAudioLoadingNotification(section, aResult); |
|
3439 case KCasePlayFileImplementationInformation: |
|
3440 return TestCasePlayFilesImplementationInformation(section, aResult); |
|
3441 case KCasePlayRepeatDRMFile: |
|
3442 return TestCasePlayRepeatDRMFile(section, aResult); |
|
3443 case KCasePlayPauseRepeatDRMFile: |
|
3444 return TestCasePlayPauseRepeatDRMFile(section, aResult); |
|
3445 case KCasePlayRepeatDRMFileForever: |
|
3446 return TestCasePlayRepeatDRMFileForever(section, aResult); |
|
3447 case KCasePlayRepeatDRMFileWithPlayWindow: |
|
3448 return TestCasePlayRepeatDRMFileWithPlayWindow(section, aResult); |
|
3449 case KCasePlayPauseRepeatDRMFileWithPlayWindow: |
|
3450 return TestCasePlayPauseRepeatDRMFileWithPlayWindow(section, aResult); |
|
3451 case KCasePlayRepeatForeverDRMFileWithPlayWindow: |
|
3452 return TestCasePlayRepeatForeverDRMFileWithPlayWindow(section, aResult); |
|
3453 } |
|
3454 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3455 aResult.iResult = KErrNotExecuted; |
|
3456 return KErrConfigInvalid; |
|
3457 } |
|
3458 |
|
3459 TBool CDRMAudioPlay::IsDurationInRange |
|
3460 ( TInt aRepeatTimes, TTimeIntervalMicroSeconds aToneDuration, TTimeIntervalMicroSeconds aRepeatSilence, |
|
3461 TTimeIntervalMicroSeconds aErrorRange , TTime aStartTime , TTime aEndTime ) |
|
3462 { |
|
3463 TInt64 tmp=aToneDuration.Int64(); |
|
3464 TInt64 tmp2=aRepeatSilence.Int64(); |
|
3465 |
|
3466 tmp*=(aRepeatTimes+1); tmp2*=(aRepeatTimes); |
|
3467 TTimeIntervalMicroSeconds ExpectedDuration = tmp+tmp2; |
|
3468 |
|
3469 TTime EndTimeRange1 = aStartTime; |
|
3470 EndTimeRange1+= ExpectedDuration; |
|
3471 TTime EndTimeRange2 = EndTimeRange1; |
|
3472 EndTimeRange1-=aErrorRange; |
|
3473 EndTimeRange2+=aErrorRange; |
|
3474 |
|
3475 iLogger->Log(_L("Actual play duration (%d)") , (aEndTime.MicroSecondsFrom(aStartTime)).Int64() ); |
|
3476 iLogger->Log(_L("Expected duration (%d)") , ExpectedDuration.Int64()); |
|
3477 iLogger->Log(_L("Error range (%d)") , aErrorRange.Int64()); |
|
3478 return (EndTimeRange1<aEndTime && aEndTime<EndTimeRange2) ; |
|
3479 } |
|
3480 |
|
3481 void CDRMAudioPlay::TestCasePreCheck(CStifSectionParser *section, TFileName& aFileName) |
|
3482 { |
|
3483 TPtrC FileNamePtr; |
|
3484 TPtrC RightsPtr; |
|
3485 RFs rightsFs; |
|
3486 RFile rightsFile; |
|
3487 RFs contentFs; |
|
3488 RFile contentFile; |
|
3489 if (( ! section->GetLine(KTagSoundFile, FileNamePtr, ENoTag) ) && ( ! section->GetLine(KTagRightsFile, RightsPtr, ENoTag) )) |
|
3490 { |
|
3491 User::LeaveIfError(rightsFs.Connect()); |
|
3492 rightsFs.ShareProtected(); |
|
3493 TFileName rightsFileName = RightsPtr; |
|
3494 iLogger->Log(_L("Rights file location [%S] "), &rightsFileName); |
|
3495 if (! BaflUtils::FileExists(rightsFs, rightsFileName)) |
|
3496 { |
|
3497 iLogger->Log(_L("Rights file [%S] doesn't exits !!! "), &rightsFileName); |
|
3498 User::Leave(KErrNotFound); |
|
3499 } |
|
3500 #ifdef __WINSCW__ |
|
3501 // copy the DRM rights file to the destination folder (\private\DRM_AGENT_SID\Import) only for WINSCW |
|
3502 if (! BaflUtils::PathExists(rightsFs, KTagOMADRMRightsDir)) |
|
3503 { |
|
3504 TRAPD(err, rightsFs.MkDirAll(KTagOMADRMRightsDir)); |
|
3505 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
|
3506 { |
|
3507 iLogger->Log(_L("Unable to create the path [%S] Err[%d]"), &KTagOMADRMRightsDir, err); |
|
3508 User::Leave(err); |
|
3509 } |
|
3510 } |
|
3511 iLogger->Log(_L("Copying Rights file [%S] to [%S] "),&rightsFileName, &KTagOMADRMRightsDir); |
|
3512 BaflUtils::CopyFile(rightsFs, rightsFileName, KTagOMADRMRightsDir); |
|
3513 #endif |
|
3514 rightsFs.Close(); |
|
3515 User::LeaveIfError(rightsFs.Connect()); |
|
3516 rightsFs.ShareProtected(); |
|
3517 User::LeaveIfError(rightsFile.Open( rightsFs, rightsFileName, EFileRead)); |
|
3518 HBufC8* rContent = HBufC8::NewL(2048); // incase the drm rights file size is more than 2kb then this size must be altered accordingly |
|
3519 CleanupStack::PushL(rContent); |
|
3520 TPtr8 rightsContentPtr = rContent->Des(); |
|
3521 rightsFile.Read(rightsContentPtr); |
|
3522 ProcessRightsL(rightsContentPtr); |
|
3523 CleanupStack::PopAndDestroy(rContent); // HBufC8* |
|
3524 rightsFile.Close(); |
|
3525 rightsFs.Close(); |
|
3526 |
|
3527 // copy the DRM content file to the destination folder (\private\DRM_AGENT_SID\DRM_AGENT_NAME) |
|
3528 User::LeaveIfError(contentFs.Connect()); |
|
3529 contentFs.ShareProtected(); |
|
3530 TFileName contentFileName = FileNamePtr; |
|
3531 iLogger->Log(_L("Audio file location [%S] "), &contentFileName); |
|
3532 if (! BaflUtils::FileExists(contentFs, contentFileName)) |
|
3533 { |
|
3534 iLogger->Log(_L("Content file [%S] doesn't exits !!! "), &contentFileName); |
|
3535 User::Leave(KErrNotFound); |
|
3536 } |
|
3537 if (! BaflUtils::PathExists(contentFs, KTagOMADRMContentDir)) |
|
3538 { |
|
3539 TRAPD(err, contentFs.MkDirAll(KTagOMADRMContentDir)); |
|
3540 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
|
3541 { |
|
3542 iLogger->Log(_L("Unable to create the path [%S] Err[%d]"), &KTagOMADRMContentDir, err); |
|
3543 User::Leave(err); |
|
3544 } |
|
3545 } |
|
3546 iLogger->Log(_L("Copying Content file [%S] to [%S] "),&contentFileName, &KTagOMADRMContentDir); |
|
3547 BaflUtils::CopyFile(contentFs, contentFileName, KTagOMADRMContentDir); |
|
3548 contentFs.Close(); |
|
3549 User::LeaveIfError(contentFs.Connect()); |
|
3550 contentFs.ShareProtected(); |
|
3551 User::LeaveIfError(contentFile.Open( contentFs, contentFileName, EFileRead)); |
|
3552 TFileName contentFileNameWithExt; |
|
3553 contentFile.Name(contentFileNameWithExt); |
|
3554 aFileName.Append(KTagOMADRMContentDir); |
|
3555 aFileName.Append(contentFileNameWithExt); |
|
3556 iLogger->Log(_L("contentFileNameWithExt [%S]"), &contentFileNameWithExt); |
|
3557 contentFile.Close(); |
|
3558 contentFs.Close(); |
|
3559 iDRMPreCheckPassed = ETrue; |
|
3560 } |
|
3561 else |
|
3562 { |
|
3563 iDRMPreCheckPassed = EFalse; |
|
3564 } |
|
3565 } |
|
3566 |
|
3567 _LIT(KDirectoryPath, "C:\\private\\12345678\\"); |
|
3568 void CDRMAudioPlay::ProcessRightsL(const TDesC8& aRightsXMLContent) |
|
3569 { |
|
3570 iLogger->Log(_L("ProcessRightsL <===")); |
|
3571 TInt err = KErrNone; |
|
3572 TFileName fileName; |
|
3573 TPath outputFileName; |
|
3574 CSupplier *mySupplier = CSupplier::NewL(); |
|
3575 CleanupStack::PushL(mySupplier); |
|
3576 iLogger->Log(_L("ProcessRightsL: Supplier created ... ")); |
|
3577 CMetaDataArray* metaDataArray = CMetaDataArray::NewL(); |
|
3578 iLogger->Log(_L("ProcessRightsL: MetaDataArray created ... ")); |
|
3579 CleanupStack::PushL(metaDataArray); |
|
3580 metaDataArray->AddL(_L("Content Type"),_L("application/vnd.oma.drm.rights+xml")); |
|
3581 // Create the import object |
|
3582 CImportFile* import = mySupplier->ImportFileL(KOma1XmlRoContentType, *metaDataArray); |
|
3583 iLogger->Log(_L("ProcessRightsL: ImportFile created ... ")); |
|
3584 CleanupStack::PushL(import); |
|
3585 err = import->WriteData(aRightsXMLContent); |
|
3586 iLogger->Log(_L("ProcessRightsL: Wrote the rightsfile to ImportData err[%d] "), err); |
|
3587 while(err == KErrCANewFileHandleRequired) |
|
3588 { |
|
3589 iLogger->Log(_L("ProcessRightsL: KErrCANewFileHandleRequired")); |
|
3590 RFs newfs; |
|
3591 RFile newFile; |
|
3592 User::LeaveIfError(newfs.Connect()); |
|
3593 import->GetSuggestedOutputFileName(fileName); |
|
3594 outputFileName.Copy(KDirectoryPath); |
|
3595 outputFileName.Append(fileName); |
|
3596 newFile.Open(newfs, outputFileName, EFileWrite); |
|
3597 err = import->ContinueWithNewOutputFile(newFile, outputFileName); |
|
3598 newFile.Close(); // agent makes a copy so we don't need to keep our file handle |
|
3599 newfs.Close(); |
|
3600 } |
|
3601 iLogger->Log(_L("ProcessRightsL: Error after the Writing ImportFile [%d]"), err); |
|
3602 // tell CAF (and hence the agent) it's now got the entire file |
|
3603 if (err == KErrNone) |
|
3604 { |
|
3605 err = import->WriteDataComplete(); |
|
3606 iLogger->Log(_L("ProcessRightsL: Error after the ImportFile WriteDataComplete [%d]"), err); |
|
3607 if (err == KErrNone) |
|
3608 { |
|
3609 // Look at the output of the import operation |
|
3610 for(TInt i = 0; i < import->OutputFileCountL(); i++) |
|
3611 { |
|
3612 // for this example only add content output files |
|
3613 // (absorb any rights in the original attachment 'silently') |
|
3614 if(import->OutputFileL(i).OutputType() == EContent) |
|
3615 { |
|
3616 // Add file to list of attachments for this message |
|
3617 iLogger->Log(_L("FileName [%S]"),(import->OutputFileL(i).FileName().Ptr())); |
|
3618 } |
|
3619 } |
|
3620 } |
|
3621 } |
|
3622 // Error handling |
|
3623 if (err != KErrNone) |
|
3624 { |
|
3625 if (err == KErrNotReady) |
|
3626 { |
|
3627 iLogger->Log(_L("Agent not ready for import")); |
|
3628 } |
|
3629 else if (err == KErrCACorruptContent) |
|
3630 { |
|
3631 iLogger->Log(_L("Content data is corrupt")); |
|
3632 } |
|
3633 else |
|
3634 { |
|
3635 iLogger->Log(_L("Unexpected error: %d"), err); |
|
3636 } |
|
3637 } |
|
3638 // Finished |
|
3639 CleanupStack::PopAndDestroy(3); // mySupplier, metaDataArray, import |
|
3640 iLogger->Log(_L("ProcessRightsL ===>")); |
|
3641 } |
|
3642 |
|
3643 TInt CDRMAudioPlay::TestCasePlayRepeatDRMFile(CStifSectionParser *section , TTestResult &aResult) |
|
3644 { |
|
3645 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
3646 TTimeIntervalMicroSeconds repeatSilenceTimer = KDefaultSilenceDuration; |
|
3647 TInt repeatCount = 0; |
|
3648 TFileName fileName; |
|
3649 iDRMPreCheckPassed = EFalse; |
|
3650 TestCasePreCheck(section, fileName); |
|
3651 if (iDRMPreCheckPassed) |
|
3652 { |
|
3653 TBool UsingRepeatCountDefault, UsingRepeatSilencerDefault; |
|
3654 repeatCount = GetIntL(section, KTagRepeatTimes, UsingRepeatCountDefault, KDefaultRepeats); |
|
3655 repeatSilenceTimer = GetTimeIntervalL(section, KTagSilenceDuration, UsingRepeatSilencerDefault, KDefaultSilenceDuration); |
|
3656 iLogger->Log(_L("Repeat count [%d] Silence timer [%d]"), repeatCount, I64LOW(repeatSilenceTimer.Int64())); |
|
3657 User::LeaveIfError(iFs.Connect()); |
|
3658 iFs.ShareProtected(); |
|
3659 User::LeaveIfError(iFile.Open( iFs, fileName, EFileRead)); |
|
3660 iLogger->Log(_L("Creating simple player with file [%S]"), &fileName); |
|
3661 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
3662 CleanupStack::PushL(sndPlayer); |
|
3663 sndPlayer->iDontPlayAudioClip = ETrue; // don't start the play back after initialize complete |
|
3664 CActiveScheduler::Start(); |
|
3665 sndPlayer->SetRepeats(repeatCount, TTimeIntervalMicroSeconds(repeatSilenceTimer)); |
|
3666 sndPlayer->SetVolumeRamp(100000); |
|
3667 sndPlayer->Play(); // Start the playback |
|
3668 iLogger->Log(_L("Starting scheduler")); |
|
3669 CActiveScheduler::Start(); |
|
3670 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3671 aResult.iResult = sndPlayer->iFinalError; |
|
3672 sndPlayer->SetRepeats(0,0); |
|
3673 if ((aResult.iResult != KErrNone) && (aResult.iResult != KErrCANoRights)) |
|
3674 { |
|
3675 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3676 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3677 } |
|
3678 else |
|
3679 { |
|
3680 iLogger->Log(_L("Test was successful")); |
|
3681 if (aResult.iResult == KErrCANoRights) |
|
3682 aResult.iResult = KErrNone; |
|
3683 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3684 } |
|
3685 iFile.Close(); |
|
3686 iFs.Close(); |
|
3687 CleanupStack::PopAndDestroy(sndPlayer); |
|
3688 return KErrExecuted; |
|
3689 } |
|
3690 else |
|
3691 { |
|
3692 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3693 aResult.iResult = KErrNotExecuted; |
|
3694 iFs.Close(); |
|
3695 return KErrConfigInvalid; |
|
3696 } |
|
3697 } |
|
3698 |
|
3699 TInt CDRMAudioPlay::TestCasePlayPauseRepeatDRMFile(CStifSectionParser *section , TTestResult &aResult) |
|
3700 { |
|
3701 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
3702 TInt repeatCount = 0; |
|
3703 TTimeIntervalMicroSeconds repeatSilenceTimer = KDefaultSilenceDuration; |
|
3704 TTimeIntervalMicroSeconds32 PauseDelay=KDefaultPauseDelay; |
|
3705 TTimeIntervalMicroSeconds32 PlayDelay=KDefaultPlayDelay; |
|
3706 TFileName fileName; |
|
3707 iDRMPreCheckPassed = EFalse; |
|
3708 TestCasePreCheck(section, fileName); |
|
3709 if (iDRMPreCheckPassed) |
|
3710 { |
|
3711 TBool UsingRepeatCountDefault, UsingRepeatSilencerDefault, UsingDefault; |
|
3712 repeatCount = GetIntL(section, KTagRepeatTimes, UsingRepeatCountDefault, KDefaultRepeats); |
|
3713 repeatSilenceTimer = GetTimeIntervalL(section, KTagSilenceDuration, UsingRepeatSilencerDefault, KDefaultSilenceDuration); |
|
3714 iLogger->Log(_L("Repeat count [%d] Silence timer [%d]"), repeatCount, I64LOW(repeatSilenceTimer.Int64())); |
|
3715 User::LeaveIfError(iFs.Connect()); |
|
3716 iFs.ShareProtected(); |
|
3717 User::LeaveIfError(iFile.Open( iFs, fileName, EFileRead)); |
|
3718 iLogger->Log(_L("Creating simple player with file [%S]"), &fileName); |
|
3719 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
3720 CleanupStack::PushL(sndPlayer); |
|
3721 PauseDelay = GetTimeIntervalL(section, KTagPauseDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPauseDelay); |
|
3722 if (UsingDefault) {iLogger->Log(_L("Error retrieving pause delay, using default"));} |
|
3723 PlayDelay = GetTimeIntervalL(section, KTagPlayDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPlayDelay); |
|
3724 if (UsingDefault) {iLogger->Log(_L("Error retrieving play delay, using default"));} |
|
3725 iLogger->Log(_L("Setting Pause and Play delays to [%d] and [%d]"), PauseDelay.Int(), PlayDelay.Int()); |
|
3726 sndPlayer->SetRepeats(repeatCount, TTimeIntervalMicroSeconds(repeatSilenceTimer)); |
|
3727 sndPlayer->SetVolumeRamp(100000); |
|
3728 sndPlayer->iDontPlayAudioClip = ETrue; // don't start the play back after initialize complete |
|
3729 iLogger->Log(_L("Starting scheduler")); |
|
3730 CActiveScheduler::Start(); // initialize the player and wait for the intialize complete event |
|
3731 TTimeIntervalMicroSeconds dur = sndPlayer->GetDuration(); |
|
3732 sndPlayer->Play(); // Start the loop play in the play window |
|
3733 /*********************************************/ |
|
3734 /* For generating the Pause event during playback */ |
|
3735 /*********************************************/ |
|
3736 TTimeIntervalMicroSeconds32 interval = TTimeIntervalMicroSeconds32(dur.Int64() + repeatSilenceTimer.Int64() + (PlayDelay.Int() - PauseDelay.Int())); |
|
3737 CParameters *pauseParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPause ); |
|
3738 CleanupStack::PushL(pauseParams); |
|
3739 CParameters *playParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPlay ); |
|
3740 CleanupStack::PushL(playParams); |
|
3741 CMediaEvent* mEventPause = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PauseDelay, interval, sndPlayer, pauseParams); |
|
3742 CMediaEvent* mEventPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PlayDelay, interval, sndPlayer, playParams); |
|
3743 CActiveScheduler::Start(); // start the playback in the play window and loop play |
|
3744 sndPlayer->SetRepeats(0,0); |
|
3745 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3746 aResult.iResult = sndPlayer->iFinalError; |
|
3747 if ((aResult.iResult != KErrNone) && (aResult.iResult != KErrCANoRights)) |
|
3748 { |
|
3749 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3750 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3751 } |
|
3752 else |
|
3753 { |
|
3754 iLogger->Log(_L("Test was successful")); |
|
3755 if (aResult.iResult == KErrCANoRights) |
|
3756 aResult.iResult = KErrNone; |
|
3757 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3758 } |
|
3759 iFile.Close(); |
|
3760 iFs.Close(); |
|
3761 CleanupStack::PopAndDestroy(mEventPlay); |
|
3762 CleanupStack::PopAndDestroy(mEventPause); |
|
3763 CleanupStack::Pop(playParams); |
|
3764 CleanupStack::Pop(pauseParams); |
|
3765 CleanupStack::PopAndDestroy(sndPlayer); |
|
3766 return KErrExecuted; |
|
3767 } |
|
3768 else |
|
3769 { |
|
3770 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3771 aResult.iResult = KErrNotExecuted; |
|
3772 return KErrConfigInvalid; |
|
3773 } |
|
3774 } |
|
3775 |
|
3776 TInt CDRMAudioPlay::TestCasePlayRepeatDRMFileForever(CStifSectionParser *section , TTestResult &aResult) |
|
3777 { |
|
3778 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
3779 TInt repeatCount = 0; |
|
3780 TTimeIntervalMicroSeconds repeatSilenceTimer = 0; |
|
3781 TFileName fileName; |
|
3782 iDRMPreCheckPassed = EFalse; |
|
3783 TestCasePreCheck(section, fileName); |
|
3784 if (iDRMPreCheckPassed) |
|
3785 { |
|
3786 TBool UsingRepeatCountDefault, UsingRepeatSilencerDefault; |
|
3787 User::LeaveIfError(iFs.Connect()); |
|
3788 iFs.ShareProtected(); |
|
3789 User::LeaveIfError(iFile.Open( iFs, fileName, EFileRead)); |
|
3790 iLogger->Log(_L("Creating simple player with file [%S]"), &fileName); |
|
3791 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
3792 CleanupStack::PushL(sndPlayer); |
|
3793 repeatCount = GetIntL(section, KTagRepeatTimes, UsingRepeatCountDefault, KDefaultRepeats); |
|
3794 if (repeatCount != KDefaultRepeatForever) |
|
3795 repeatCount = KDefaultRepeatForever; |
|
3796 repeatSilenceTimer = GetTimeIntervalL(section, KTagSilenceDuration, UsingRepeatSilencerDefault, (TTimeIntervalMicroSeconds)KDefaultSilenceDuration); |
|
3797 sndPlayer->SetRepeats(repeatCount, repeatSilenceTimer); |
|
3798 sndPlayer->SetVolumeRamp(100000); |
|
3799 CActiveScheduler::Start(); |
|
3800 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3801 aResult.iResult = sndPlayer->iFinalError; |
|
3802 sndPlayer->SetRepeats(0,0); |
|
3803 CleanupStack::PopAndDestroy(sndPlayer); |
|
3804 if ((aResult.iResult != KErrNone) && (aResult.iResult != KErrCANoRights)) |
|
3805 { |
|
3806 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3807 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3808 } |
|
3809 else |
|
3810 { |
|
3811 iLogger->Log(_L("Test was successful")); |
|
3812 if (aResult.iResult == KErrCANoRights) |
|
3813 aResult.iResult = KErrNone; |
|
3814 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3815 } |
|
3816 iFile.Close(); |
|
3817 iFs.Close(); |
|
3818 return KErrExecuted; |
|
3819 } |
|
3820 else |
|
3821 { |
|
3822 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3823 aResult.iResult = KErrNotExecuted; |
|
3824 return KErrConfigInvalid; |
|
3825 } |
|
3826 } |
|
3827 |
|
3828 TInt CDRMAudioPlay::TestCasePlayRepeatDRMFileWithPlayWindow(CStifSectionParser *section , TTestResult &aResult) |
|
3829 { |
|
3830 TTimeIntervalMicroSeconds startPosition = KDefaultPosition; |
|
3831 TTimeIntervalMicroSeconds endPosition = KDefaultPosition; |
|
3832 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
3833 TInt repeatCount = 0; |
|
3834 TTimeIntervalMicroSeconds repeatSilenceTimer = 0; |
|
3835 TFileName fileName; |
|
3836 iDRMPreCheckPassed = EFalse; |
|
3837 TestCasePreCheck(section, fileName); |
|
3838 if (iDRMPreCheckPassed) |
|
3839 { |
|
3840 TBool UsingStartDefault, UsingEndDefault, UsingRepeatCountDefault, UsingRepeatSilencerDefault; |
|
3841 User::LeaveIfError(iFs.Connect()); |
|
3842 iFs.ShareProtected(); |
|
3843 User::LeaveIfError(iFile.Open( iFs, fileName, EFileRead)); |
|
3844 iLogger->Log(_L("Creating simple player with file [%S]"), &fileName); |
|
3845 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
3846 CleanupStack::PushL(sndPlayer); |
|
3847 repeatCount = GetIntL(section, KTagRepeatTimes, UsingRepeatCountDefault, KDefaultRepeats); |
|
3848 repeatSilenceTimer = GetTimeIntervalL(section, KTagSilenceDuration, UsingRepeatSilencerDefault, (TTimeIntervalMicroSeconds)KDefaultSilenceDuration); |
|
3849 startPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
3850 endPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
3851 // sndPlayer->iDontPlayAudioClip = ETrue; // don't start the play back after initialize complete |
|
3852 iLogger->Log(_L("Starting scheduler")); |
|
3853 sndPlayer->SetRepeats(repeatCount, repeatSilenceTimer); |
|
3854 sndPlayer->SetVolumeRamp(100000); |
|
3855 sndPlayer->iPlayWindow = ETrue; |
|
3856 sndPlayer->iStartPosition = startPosition; |
|
3857 sndPlayer->iEndPosition = endPosition; |
|
3858 iLogger->Log(_L("Starting scheduler")); |
|
3859 CActiveScheduler::Start(); // initialize the player and wait for the intialize complete event |
|
3860 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3861 aResult.iResult = sndPlayer->iFinalError; |
|
3862 sndPlayer->SetRepeats(0,0); |
|
3863 sndPlayer->iPlayWindow = EFalse; |
|
3864 sndPlayer->ClearPlayWindow(); |
|
3865 CleanupStack::PopAndDestroy(sndPlayer); |
|
3866 if ((aResult.iResult != KErrNone) && (aResult.iResult != KErrCANoRights)) |
|
3867 { |
|
3868 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3869 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3870 } |
|
3871 else |
|
3872 { |
|
3873 iLogger->Log(_L("Test was successful")); |
|
3874 if (aResult.iResult == KErrCANoRights) |
|
3875 aResult.iResult = KErrNone; |
|
3876 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3877 } |
|
3878 iFile.Close(); |
|
3879 iFs.Close(); |
|
3880 return KErrExecuted; |
|
3881 } |
|
3882 else |
|
3883 { |
|
3884 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3885 aResult.iResult = KErrNotExecuted; |
|
3886 return KErrConfigInvalid; |
|
3887 } |
|
3888 } |
|
3889 |
|
3890 TInt CDRMAudioPlay::TestCasePlayPauseRepeatDRMFileWithPlayWindow(CStifSectionParser *section , TTestResult &aResult) |
|
3891 { |
|
3892 TTimeIntervalMicroSeconds startPosition = KDefaultPosition; |
|
3893 TTimeIntervalMicroSeconds endPosition = KDefaultPosition; |
|
3894 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
3895 TTimeIntervalMicroSeconds32 PauseDelay=KDefaultPauseDelay; |
|
3896 TTimeIntervalMicroSeconds32 PlayDelay=KDefaultPlayDelay; |
|
3897 TInt repeatCount = 0; |
|
3898 TTimeIntervalMicroSeconds repeatSilenceTimer = 0; |
|
3899 TFileName fileName; |
|
3900 iDRMPreCheckPassed = EFalse; |
|
3901 TestCasePreCheck(section, fileName); |
|
3902 if (iDRMPreCheckPassed) |
|
3903 { |
|
3904 TBool UsingStartDefault, UsingEndDefault, UsingRepeatCountDefault, UsingRepeatSilencerDefault, UsingDefault; |
|
3905 User::LeaveIfError(iFs.Connect()); |
|
3906 iFs.ShareProtected(); |
|
3907 User::LeaveIfError(iFile.Open( iFs, fileName, EFileRead)); |
|
3908 iLogger->Log(_L("Creating simple player with file [%S]"), &fileName); |
|
3909 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
3910 CleanupStack::PushL(sndPlayer); |
|
3911 repeatCount = GetIntL(section, KTagRepeatTimes, UsingRepeatCountDefault, KDefaultRepeats); |
|
3912 repeatSilenceTimer = GetTimeIntervalL(section, KTagSilenceDuration, UsingRepeatSilencerDefault, (TTimeIntervalMicroSeconds)KDefaultSilenceDuration); |
|
3913 startPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
3914 endPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
3915 PauseDelay = GetTimeIntervalL(section, KTagPauseDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPauseDelay); |
|
3916 if (UsingDefault) {iLogger->Log(_L("Error retrieving pause delay, using default"));} |
|
3917 PlayDelay = GetTimeIntervalL(section, KTagPlayDelay, UsingDefault, (TTimeIntervalMicroSeconds32)KDefaultPlayDelay); |
|
3918 if (UsingDefault) {iLogger->Log(_L("Error retrieving play delay, using default"));} |
|
3919 iLogger->Log(_L("Setting Pause and Play delays to [%d] and [%d]"), PauseDelay.Int(), PlayDelay.Int()); |
|
3920 sndPlayer->iDontPlayAudioClip = ETrue; // don't start the play back after initialize complete |
|
3921 sndPlayer->SetRepeats(repeatCount, repeatSilenceTimer); |
|
3922 sndPlayer->SetVolumeRamp(100000); |
|
3923 sndPlayer->iPlayWindow = ETrue; |
|
3924 sndPlayer->iStartPosition = startPosition; |
|
3925 sndPlayer->iEndPosition = endPosition; |
|
3926 iLogger->Log(_L("Starting scheduler")); |
|
3927 CActiveScheduler::Start(); // initialize the player and wait for the intialize complete event |
|
3928 TTimeIntervalMicroSeconds dur = sndPlayer->GetDuration(); |
|
3929 TTimeIntervalMicroSeconds32 interval = TTimeIntervalMicroSeconds32((endPosition.Int64() - startPosition.Int64()) + repeatSilenceTimer.Int64() + (PlayDelay.Int() - PauseDelay.Int())); |
|
3930 sndPlayer->Play(); // Start the loop play in the play window |
|
3931 // sndPlayer->SetPlayWindow(startPosition, endPosition); |
|
3932 /*********************************************/ |
|
3933 /* For generating the Pause event during playback */ |
|
3934 /*********************************************/ |
|
3935 CParameters *pauseParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPause ); |
|
3936 CleanupStack::PushL(pauseParams); |
|
3937 CParameters *playParams = new (ELeave) CParameters( CSimpleSoundPlayer::KPlayerActionPlay ); |
|
3938 CleanupStack::PushL(playParams); |
|
3939 CMediaEvent* mEventPause = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PauseDelay, interval, sndPlayer, pauseParams); |
|
3940 CMediaEvent* mEventPlay = CMediaEvent::NewLC(TestModuleIf() , *iLogger, PlayDelay, interval, sndPlayer, playParams); |
|
3941 CActiveScheduler::Start(); // start the playback in the play window and loop play |
|
3942 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
3943 aResult.iResult = sndPlayer->iFinalError; |
|
3944 if ((aResult.iResult != KErrNone) && (aResult.iResult != KErrCANoRights)) |
|
3945 { |
|
3946 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
3947 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
3948 } |
|
3949 else |
|
3950 { |
|
3951 iLogger->Log(_L("Test was successful")); |
|
3952 if (aResult.iResult == KErrCANoRights) |
|
3953 aResult.iResult = KErrNone; |
|
3954 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
3955 } |
|
3956 sndPlayer->SetRepeats(0,0); |
|
3957 sndPlayer->iPlayWindow = EFalse; |
|
3958 sndPlayer->ClearPlayWindow(); |
|
3959 CleanupStack::PopAndDestroy(mEventPlay); |
|
3960 CleanupStack::PopAndDestroy(mEventPause); |
|
3961 CleanupStack::Pop(playParams); |
|
3962 CleanupStack::Pop(pauseParams); |
|
3963 CleanupStack::PopAndDestroy(sndPlayer); |
|
3964 iFile.Close(); |
|
3965 iFs.Close(); |
|
3966 return KErrExecuted; |
|
3967 } |
|
3968 else |
|
3969 { |
|
3970 aResult.iResultDes.Copy(KConfigInvalid()); |
|
3971 aResult.iResult = KErrNotExecuted; |
|
3972 return KErrConfigInvalid; |
|
3973 } |
|
3974 } |
|
3975 |
|
3976 TInt CDRMAudioPlay::TestCasePlayRepeatForeverDRMFileWithPlayWindow(CStifSectionParser *section , TTestResult &aResult) |
|
3977 { |
|
3978 TTimeIntervalMicroSeconds startPosition = KDefaultPosition; |
|
3979 TTimeIntervalMicroSeconds endPosition = KDefaultPosition; |
|
3980 TTimeIntervalMicroSeconds32 ReportDelay = KDefaultReportDelay; |
|
3981 TInt repeatCount = 0; |
|
3982 TTimeIntervalMicroSeconds repeatSilenceTimer = 0; |
|
3983 TFileName fileName; |
|
3984 iDRMPreCheckPassed = EFalse; |
|
3985 TestCasePreCheck(section, fileName); |
|
3986 if (iDRMPreCheckPassed) |
|
3987 { |
|
3988 TBool UsingStartDefault, UsingEndDefault, UsingRepeatCountDefault, UsingRepeatSilencerDefault; |
|
3989 User::LeaveIfError(iFs.Connect()); |
|
3990 iFs.ShareProtected(); |
|
3991 User::LeaveIfError(iFile.Open( iFs, fileName, EFileRead)); |
|
3992 iLogger->Log(_L("Creating simple player with file [%S]"), &fileName); |
|
3993 CSimpleSoundPlayer *sndPlayer = CSimpleSoundPlayer::NewL( iFile, TestModuleIf() , *iLogger); |
|
3994 CleanupStack::PushL(sndPlayer); |
|
3995 repeatCount = GetIntL(section, KTagRepeatTimes, UsingRepeatCountDefault, KDefaultRepeats); |
|
3996 if (repeatCount != KDefaultRepeatForever) |
|
3997 repeatCount = KDefaultRepeatForever; |
|
3998 repeatSilenceTimer = GetTimeIntervalL(section, KTagSilenceDuration, UsingRepeatSilencerDefault, (TTimeIntervalMicroSeconds)KDefaultSilenceDuration); |
|
3999 startPosition = GetTimeIntervalL(section, KTagWindowStart, UsingStartDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()-1E6)); |
|
4000 endPosition = GetTimeIntervalL(section, KTagWindowEnd, UsingEndDefault, (TTimeIntervalMicroSeconds)(KDefaultPosition.Int64()+1E6)); |
|
4001 sndPlayer->SetRepeats(repeatCount, repeatSilenceTimer); |
|
4002 sndPlayer->SetVolumeRamp(100000); |
|
4003 sndPlayer->iPlayWindow = ETrue; |
|
4004 sndPlayer->iStartPosition = startPosition; |
|
4005 sndPlayer->iEndPosition = endPosition; |
|
4006 sndPlayer->iDontPlayAudioClip = ETrue; // don't start the play back after initialize complete |
|
4007 iLogger->Log(_L("Starting scheduler")); |
|
4008 CActiveScheduler::Start(); // initialize the player and wait for the intialize complete event |
|
4009 sndPlayer->Play(); // Start the loop play in the play window |
|
4010 CActiveScheduler::Start(); |
|
4011 iLogger->Log(_L("Returned from player, errorcode: %d"), sndPlayer->iFinalError ); |
|
4012 aResult.iResult = sndPlayer->iFinalError; |
|
4013 sndPlayer->SetRepeats(0,0); |
|
4014 sndPlayer->iPlayWindow = EFalse; |
|
4015 sndPlayer->ClearPlayWindow(); |
|
4016 CleanupStack::PopAndDestroy(sndPlayer); |
|
4017 if ((aResult.iResult != KErrNone) && (aResult.iResult != KErrCANoRights)) |
|
4018 { |
|
4019 iLogger->Log(_L("Test failed, error code %d"), aResult.iResult); |
|
4020 aResult.iResultDes.Copy(KTestCaseResultFail()); |
|
4021 } |
|
4022 else |
|
4023 { |
|
4024 iLogger->Log(_L("Test was successful")); |
|
4025 if (aResult.iResult == KErrCANoRights) |
|
4026 aResult.iResult = KErrNone; |
|
4027 aResult.iResultDes.Copy(KTestCaseResultSuccess()); |
|
4028 } |
|
4029 iFile.Close(); |
|
4030 iFs.Close(); |
|
4031 return KErrExecuted; |
|
4032 } |
|
4033 else |
|
4034 { |
|
4035 aResult.iResultDes.Copy(KConfigInvalid()); |
|
4036 aResult.iResult = KErrNotExecuted; |
|
4037 return KErrConfigInvalid; |
|
4038 } |
|
4039 } |