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