0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Unit tests. The client is opened with DRM intent and played.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "TestStepAudioPlayerDRM.h"
|
|
19 |
|
|
20 |
|
|
21 |
// Unique Id of the content
|
|
22 |
_LIT(KRightsPlayerUniqueId001, "AudioTestmainTstId001");
|
|
23 |
_LIT(KRightsPlayerUniqueId002, "\\Container001\\AudioTestmainTst2Id002");
|
|
24 |
_LIT(KRightsPlayerUniqueId003, "AudioTestmainTst3Id003");
|
|
25 |
|
|
26 |
_LIT(KRightsPlayerUniqueId004, "AudioTestNoRightsId001");
|
|
27 |
_LIT(KRightsPlayerInvalidUniqueId, "AudioTestInvalidUniqueId");
|
|
28 |
|
|
29 |
#define INFO_PRINTF1_IF_LOGS_ENABLED( a ) if(iEnableLogs) \
|
|
30 |
{ \
|
|
31 |
INFO_PRINTF1( a ); \
|
|
32 |
}
|
|
33 |
|
|
34 |
#define INFO_PRINTF2_IF_LOGS_ENABLED( a, b ) if(iEnableLogs) \
|
|
35 |
{ \
|
|
36 |
INFO_PRINTF2( ( a ), ( b ) ); \
|
|
37 |
}
|
|
38 |
|
|
39 |
#define INFO_PRINTF3_IF_LOGS_ENABLED( a, b, c ) if(iEnableLogs) \
|
|
40 |
{ \
|
|
41 |
INFO_PRINTF3( ( a ), ( b ), ( c ) ); \
|
|
42 |
}
|
|
43 |
|
|
44 |
#define ERR_PRINTF1_IF_LOGS_ENABLED( a ) if(iEnableLogs) \
|
|
45 |
{ \
|
|
46 |
ERR_PRINTF1( a ); \
|
|
47 |
}
|
|
48 |
|
|
49 |
#define ERR_PRINTF2_IF_LOGS_ENABLED( a, b ) if(iEnableLogs) \
|
|
50 |
{ \
|
|
51 |
ERR_PRINTF2( ( a ), ( b ) ); \
|
|
52 |
}
|
|
53 |
|
|
54 |
#define ERR_PRINTF3_IF_LOGS_ENABLED( a, b, c ) if(iEnableLogs) \
|
|
55 |
{ \
|
|
56 |
ERR_PRINTF3( ( a ), ( b ), ( c ) ); \
|
|
57 |
}
|
|
58 |
|
|
59 |
// Used in a time out function, 1 second (in microSeconds)
|
|
60 |
const TInt KOneSecond = 1000000;
|
|
61 |
|
|
62 |
// CTestMmfDRMAudioPlayerBase implementation
|
|
63 |
/**
|
|
64 |
*
|
|
65 |
* CTestMmfDRMAudioPlayerBase constructor.
|
|
66 |
*
|
|
67 |
*/
|
|
68 |
CTestMmfDRMAudioPlayerBase::CTestMmfDRMAudioPlayerBase()
|
|
69 |
{
|
|
70 |
iEnableLogs = ETrue;//By deafult log the messages
|
|
71 |
}
|
|
72 |
/**
|
|
73 |
*
|
|
74 |
* FsmL()
|
|
75 |
*
|
|
76 |
* @param TMmfAudioPlayerEvents aEvent
|
|
77 |
*
|
|
78 |
*/
|
|
79 |
void CTestMmfDRMAudioPlayerBase::FsmL(TMmfAudioPlayerEvents aEvent)
|
|
80 |
{
|
|
81 |
iTestStepResult = EFail;
|
|
82 |
switch (aEvent)
|
|
83 |
{
|
|
84 |
case EAudioOpen:
|
|
85 |
INFO_PRINTF2_IF_LOGS_ENABLED(_L("Opening the file for PLAY intent: %S"), &iFileName);
|
|
86 |
if (iTestStepName == _L("MM-MMF-ACLNT-U-0905-HP"))
|
|
87 |
{
|
|
88 |
iAudioPlayer->OpenFileL(TMMFileSource(iFileName, KRightsPlayerUniqueId002, ContentAccess::EPlay));
|
|
89 |
}
|
|
90 |
else if (iTestStepName == _L("MM-MMF-ACLNT-U-0923-HP"))
|
|
91 |
{
|
|
92 |
iAudioPlayer->OpenFileL(TMMFileSource(iFileName, KRightsPlayerUniqueId003, ContentAccess::EPlay));
|
|
93 |
}
|
|
94 |
else
|
|
95 |
{
|
|
96 |
iAudioPlayer->OpenFileL(TMMFileSource(iFileName, KRightsPlayerUniqueId001, ContentAccess::EPlay));
|
|
97 |
}
|
|
98 |
break;
|
|
99 |
|
|
100 |
case EAudioPlay:
|
|
101 |
if (iTestStepName == _L("MM-MMF-ACLNT-U-0903-HP"))
|
|
102 |
{
|
|
103 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Playing the audio file...for 2 seconds."));
|
|
104 |
iAudioPlayer->Play();
|
|
105 |
User::After(2000000);
|
|
106 |
|
|
107 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Pausing the audio file...for 1 second."));
|
|
108 |
User::LeaveIfError(iAudioPlayer->Pause());
|
|
109 |
User::After(1000000);
|
|
110 |
|
|
111 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Continuing the play of the audio file...for 2 seconds."));
|
|
112 |
iAudioPlayer->Play();
|
|
113 |
User::After(2000000);
|
|
114 |
|
|
115 |
}
|
|
116 |
else if (iTestStepName == _L("MM-MMF-ACLNT-U-0907-HP"))
|
|
117 |
{
|
|
118 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Playing of the audio file...for 2 seconds."));
|
|
119 |
iAudioPlayer->Play();
|
|
120 |
User::After(2000000);
|
|
121 |
|
|
122 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Stop the play of the audio file...."));
|
|
123 |
iAudioPlayer->Stop();
|
|
124 |
}
|
|
125 |
else if (iTestStepName == _L("MM-MMF-ACLNT-U-0909-HP"))
|
|
126 |
{
|
|
127 |
for(TInt i=0; i<=50; i++)
|
|
128 |
{
|
|
129 |
INFO_PRINTF1(_L("Playing the audio file...for 0.05 second."));
|
|
130 |
iAudioPlayer->Play();
|
|
131 |
User::After(50000);
|
|
132 |
|
|
133 |
INFO_PRINTF1(_L("Pausing the audio file...for 0.05 second."));
|
|
134 |
User::LeaveIfError(iAudioPlayer->Pause());
|
|
135 |
User::After(50000);
|
|
136 |
}
|
|
137 |
}
|
|
138 |
|
|
139 |
else
|
|
140 |
{
|
|
141 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Playing the audio file..."));
|
|
142 |
iAudioPlayer->Play();
|
|
143 |
}
|
|
144 |
break;
|
|
145 |
|
|
146 |
case EAudioPlayEnd:
|
|
147 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Audio file opened and played."));
|
|
148 |
iTestStepResult = EPass;
|
|
149 |
iAudioPlayer->Close();
|
|
150 |
CActiveScheduler::Stop();
|
|
151 |
break;
|
|
152 |
|
|
153 |
default:
|
|
154 |
INFO_PRINTF1(_L("Invalid Audio event!"));
|
|
155 |
}
|
|
156 |
|
|
157 |
};
|
|
158 |
/**
|
|
159 |
*
|
|
160 |
* FsmHandleL()
|
|
161 |
*
|
|
162 |
* @param TMmfAudioPlayerEvents aEvent
|
|
163 |
*
|
|
164 |
*/
|
|
165 |
void CTestMmfDRMAudioPlayerBase::FsmHandleL(TMmfAudioPlayerEvents aEvent)
|
|
166 |
{
|
|
167 |
iTestStepResult = EFail;
|
|
168 |
switch (aEvent)
|
|
169 |
{
|
|
170 |
case EAudioOpen:
|
|
171 |
INFO_PRINTF2_IF_LOGS_ENABLED(_L("Opening the file for PLAY intent: %S"), &iFileName);
|
|
172 |
iAudioPlayer->OpenFileL(TMMFileHandleSource(iFile, KRightsPlayerUniqueId001, ContentAccess::EPlay));
|
|
173 |
break;
|
|
174 |
|
|
175 |
case EAudioPlay:
|
|
176 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Playing the audio file..."));
|
|
177 |
iAudioPlayer->Play();
|
|
178 |
break;
|
|
179 |
|
|
180 |
case EAudioPlayEnd:
|
|
181 |
INFO_PRINTF1_IF_LOGS_ENABLED(_L("Audio file opened and played."));
|
|
182 |
iTestStepResult = EPass;
|
|
183 |
iAudioPlayer->Close();
|
|
184 |
CActiveScheduler::Stop();
|
|
185 |
break;
|
|
186 |
|
|
187 |
default:
|
|
188 |
INFO_PRINTF1(_L("Invalid Audio event!"));
|
|
189 |
}
|
|
190 |
};
|
|
191 |
/**
|
|
192 |
*
|
|
193 |
* EnableLogs()
|
|
194 |
*
|
|
195 |
* @param TBool aEnable
|
|
196 |
*
|
|
197 |
*/
|
|
198 |
inline void CTestMmfDRMAudioPlayerBase::EnableLogs(TBool aEnable)
|
|
199 |
{
|
|
200 |
iEnableLogs = aEnable;
|
|
201 |
}
|
|
202 |
/**
|
|
203 |
*
|
|
204 |
* Test step Preamble.
|
|
205 |
*
|
|
206 |
* @return enum TVerdict: The result of the test step.
|
|
207 |
*
|
|
208 |
*/
|
|
209 |
enum TVerdict CTestMmfDRMAudioPlayerBase::DoTestStepPreambleL()
|
|
210 |
{
|
|
211 |
// Install the scheduler
|
|
212 |
enum TVerdict verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL();
|
|
213 |
|
|
214 |
iError = KErrNone;
|
|
215 |
|
|
216 |
// Get the filename
|
|
217 |
// iFileName will be the content file, containing audio files
|
|
218 |
if (!GetStringFromConfig(_L("SectionDRM"), _L("AudioContent"), iFileName))
|
|
219 |
{
|
|
220 |
return EInconclusive;
|
|
221 |
}
|
|
222 |
|
|
223 |
// Create an audio player
|
|
224 |
iAudioPlayer = CMdaAudioPlayerUtility::NewL(*this);
|
|
225 |
if (iAudioPlayer == NULL)
|
|
226 |
{
|
|
227 |
return EInconclusive;
|
|
228 |
}
|
|
229 |
|
|
230 |
return verdict;
|
|
231 |
}
|
|
232 |
|
|
233 |
/**
|
|
234 |
*
|
|
235 |
* Test step Postamble.
|
|
236 |
*
|
|
237 |
* @return enum TVerdict: The result of the test step.
|
|
238 |
*
|
|
239 |
*/
|
|
240 |
enum TVerdict CTestMmfDRMAudioPlayerBase::DoTestStepPostambleL()
|
|
241 |
{
|
|
242 |
delete iAudioPlayer;
|
|
243 |
iAudioPlayer = NULL;
|
|
244 |
User::After(KOneSecond); // wait for deletion to shut down devsound
|
|
245 |
return CTestStepUnitMMFAudClient::DoTestStepPostambleL(); // Destroy the scheduler
|
|
246 |
}
|
|
247 |
|
|
248 |
/**
|
|
249 |
*
|
|
250 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
251 |
*
|
|
252 |
* @param TInt aError
|
|
253 |
*
|
|
254 |
*/
|
|
255 |
void CTestMmfDRMAudioPlayerBase::MapcInitComplete(TInt aError,
|
|
256 |
const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
257 |
{
|
|
258 |
INFO_PRINTF2_IF_LOGS_ENABLED(_L("MMdaAudioPlayerCallback Init Complete. Error = %d"), aError);
|
|
259 |
iError = aError;
|
|
260 |
if (iError != KErrNone)
|
|
261 |
{
|
|
262 |
ERR_PRINTF1_IF_LOGS_ENABLED(_L("Opening the audio file failed."));
|
|
263 |
iAudioPlayer->Close();
|
|
264 |
CActiveScheduler::Stop();
|
|
265 |
}
|
|
266 |
else
|
|
267 |
{
|
|
268 |
TRAP(iError, FsmL(EAudioPlay)); // Call to play audio
|
|
269 |
if (iError != KErrNone)
|
|
270 |
{
|
|
271 |
ERR_PRINTF2_IF_LOGS_ENABLED(_L("Got an error from the FsmL(EAudioPlay) %d."), iError);
|
|
272 |
iAudioPlayer->Close();
|
|
273 |
CActiveScheduler::Stop();
|
|
274 |
}
|
|
275 |
else
|
|
276 |
{
|
|
277 |
TRAP(iError, FsmL(EAudioPlayEnd));
|
|
278 |
if (iError != KErrNone)
|
|
279 |
{
|
|
280 |
ERR_PRINTF2_IF_LOGS_ENABLED(_L("Got an error from the FsmL(EAudioPlayEnd) %d."), iError);
|
|
281 |
}
|
|
282 |
}
|
|
283 |
}
|
|
284 |
}
|
|
285 |
|
|
286 |
/**
|
|
287 |
*
|
|
288 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
289 |
*
|
|
290 |
* @param TInt aError
|
|
291 |
*
|
|
292 |
*/
|
|
293 |
void CTestMmfDRMAudioPlayerBase::MapcPlayComplete(TInt aError)
|
|
294 |
{
|
|
295 |
INFO_PRINTF2_IF_LOGS_ENABLED(_L("MMdaAudioPlayerCallback Play Complete. Error = %d"), aError);
|
|
296 |
iError = aError;
|
|
297 |
if (iError != KErrNone)
|
|
298 |
{
|
|
299 |
ERR_PRINTF2_IF_LOGS_ENABLED(_L("Playing the audio file failed, unexpected error %d."), aError);
|
|
300 |
iAudioPlayer->Close();
|
|
301 |
CActiveScheduler::Stop();
|
|
302 |
}
|
|
303 |
else
|
|
304 |
{
|
|
305 |
TRAP(iError, FsmL(EAudioPlayEnd));
|
|
306 |
if (iError != KErrNone)
|
|
307 |
{
|
|
308 |
ERR_PRINTF2_IF_LOGS_ENABLED(_L("Got an error from the FsmL(EAudioPlayEnd) %d."), iError);
|
|
309 |
}
|
|
310 |
}
|
|
311 |
}
|
|
312 |
|
|
313 |
// Positive Tests
|
|
314 |
|
|
315 |
/**
|
|
316 |
*
|
|
317 |
* Ctor for CTestMmfDRMAudioPlayFileSource
|
|
318 |
*
|
|
319 |
* @return CTestMmfDRMAudioPlayFileSource*:
|
|
320 |
* constructed CTestMmfDRMAudioPlayFileSource object
|
|
321 |
*
|
|
322 |
*/
|
|
323 |
CTestMmfDRMAudioPlayFileSource* CTestMmfDRMAudioPlayFileSource::NewL()
|
|
324 |
{
|
|
325 |
return new (ELeave) CTestMmfDRMAudioPlayFileSource;
|
|
326 |
}
|
|
327 |
|
|
328 |
/**
|
|
329 |
*
|
|
330 |
* Test step constructor.
|
|
331 |
* Each test step initialises its own name.
|
|
332 |
*
|
|
333 |
*/
|
|
334 |
CTestMmfDRMAudioPlayFileSource::CTestMmfDRMAudioPlayFileSource()
|
|
335 |
{
|
|
336 |
// Store the name of this test case
|
|
337 |
// This is the name that is used by the script file
|
|
338 |
iTestStepName = _L("MM-MMF-ACLNT-U-0901-HP");
|
|
339 |
}
|
|
340 |
|
|
341 |
/**
|
|
342 |
*
|
|
343 |
* Do the test step.
|
|
344 |
* Each test step must supply an implementation for DoTestStepL.
|
|
345 |
*
|
|
346 |
* @return TVerdict: The result of the test step.
|
|
347 |
*
|
|
348 |
*/
|
|
349 |
TVerdict CTestMmfDRMAudioPlayFileSource::DoTestStepL()
|
|
350 |
{
|
|
351 |
INFO_PRINTF1(_L("Open and play a protected audio clip from a file for PLAY intent. (TMMFileSource)."));
|
|
352 |
iTestStepResult = EFail;
|
|
353 |
TRAPD(err, FsmL(EAudioOpen)); // Call to open the audio file
|
|
354 |
if (err == KErrNone)
|
|
355 |
{
|
|
356 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
357 |
}
|
|
358 |
return iTestStepResult;
|
|
359 |
}
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
/**
|
|
364 |
*
|
|
365 |
* Ctor for CTestMmfDRMAudioPlayFileHandleSource
|
|
366 |
*
|
|
367 |
* @return CTestMmfDRMAudioPlayFileHandleSource*:
|
|
368 |
* constructed CTestMmfDRMAudioPlayFileHandleSource object
|
|
369 |
*
|
|
370 |
*/
|
|
371 |
CTestMmfDRMAudioPlayFileHandleSource* CTestMmfDRMAudioPlayFileHandleSource::NewL()
|
|
372 |
{
|
|
373 |
return new (ELeave) CTestMmfDRMAudioPlayFileHandleSource;
|
|
374 |
}
|
|
375 |
|
|
376 |
/**
|
|
377 |
*
|
|
378 |
* Test step constructor.
|
|
379 |
* Each test step initialises its own name.
|
|
380 |
*
|
|
381 |
*/
|
|
382 |
CTestMmfDRMAudioPlayFileHandleSource::CTestMmfDRMAudioPlayFileHandleSource()
|
|
383 |
{
|
|
384 |
iTestStepName = _L("MM-MMF-ACLNT-U-0902-HP");
|
|
385 |
}
|
|
386 |
|
|
387 |
/**
|
|
388 |
*
|
|
389 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
390 |
*
|
|
391 |
* @param TInt aError
|
|
392 |
*
|
|
393 |
*/
|
|
394 |
void CTestMmfDRMAudioPlayFileHandleSource::MapcInitComplete(TInt aError,
|
|
395 |
const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
396 |
{
|
|
397 |
INFO_PRINTF2(_L("MMdaAudioPlayerCallback Init Complete. Error = %d"), aError);
|
|
398 |
iError = aError;
|
|
399 |
if (iError != KErrNone)
|
|
400 |
{
|
|
401 |
ERR_PRINTF2(_L("Opening the audio file failed, unexpected error %d."), aError);
|
|
402 |
iAudioPlayer->Close();
|
|
403 |
CActiveScheduler::Stop();
|
|
404 |
}
|
|
405 |
else
|
|
406 |
{
|
|
407 |
TRAP(iError, FsmHandleL(EAudioPlay)); // Call to play audio
|
|
408 |
}
|
|
409 |
|
|
410 |
}
|
|
411 |
|
|
412 |
/**
|
|
413 |
*
|
|
414 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
415 |
*
|
|
416 |
* @param TInt aError
|
|
417 |
*
|
|
418 |
*/
|
|
419 |
void CTestMmfDRMAudioPlayFileHandleSource::MapcPlayComplete(TInt aError)
|
|
420 |
{
|
|
421 |
INFO_PRINTF2(_L("MMdaAudioPlayerCallback Play Complete. Error = %d"), aError);
|
|
422 |
iError = aError;
|
|
423 |
if (iError != KErrNone)
|
|
424 |
{
|
|
425 |
ERR_PRINTF2(_L("Play complete returned unexpected error %d."), aError);
|
|
426 |
iAudioPlayer->Close();
|
|
427 |
CActiveScheduler::Stop();
|
|
428 |
}
|
|
429 |
else
|
|
430 |
{
|
|
431 |
TRAP(iError, FsmHandleL(EAudioPlayEnd));
|
|
432 |
}
|
|
433 |
|
|
434 |
}
|
|
435 |
|
|
436 |
/**
|
|
437 |
*
|
|
438 |
* Do the test step.
|
|
439 |
* Each test step must supply an implementation for DoTestStepL.
|
|
440 |
*
|
|
441 |
* @return TVerdict: The result of the test step.
|
|
442 |
*
|
|
443 |
*/
|
|
444 |
TVerdict CTestMmfDRMAudioPlayFileHandleSource::DoTestStepL()
|
|
445 |
{
|
|
446 |
INFO_PRINTF1(_L("Open and play a protected audio clip from a file for PLAY intent. (TMMFileHandleSource)."));
|
|
447 |
iTestStepResult = EFail;
|
|
448 |
User::LeaveIfError(iFs.Connect());
|
|
449 |
User::LeaveIfError(iFs.ShareProtected());
|
|
450 |
User::LeaveIfError(iFile.Open(iFs, iFileName, EFileRead));
|
|
451 |
|
|
452 |
TRAPD(err, FsmHandleL(EAudioOpen)); // Call to open the audio file thru file handle
|
|
453 |
if (err == KErrNone)
|
|
454 |
{
|
|
455 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
456 |
}
|
|
457 |
|
|
458 |
iFile.Close();
|
|
459 |
iFs.Close();
|
|
460 |
|
|
461 |
return iTestStepResult;
|
|
462 |
}
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
/**
|
|
467 |
*
|
|
468 |
* Ctor for CTestMmfDRMAudioPPCSFileSource
|
|
469 |
*
|
|
470 |
* @return CTestMmfDRMAudioPPCSFileSource*: constructed CTestMmfDRMAudioPPCSFileSource object
|
|
471 |
*
|
|
472 |
*/
|
|
473 |
CTestMmfDRMAudioPPCSFileSource* CTestMmfDRMAudioPPCSFileSource::NewL()
|
|
474 |
{
|
|
475 |
return new (ELeave) CTestMmfDRMAudioPPCSFileSource;
|
|
476 |
}
|
|
477 |
|
|
478 |
/**
|
|
479 |
*
|
|
480 |
* Test step constructor.
|
|
481 |
* Each test step initialises its own name.
|
|
482 |
*
|
|
483 |
*/
|
|
484 |
CTestMmfDRMAudioPPCSFileSource::CTestMmfDRMAudioPPCSFileSource()
|
|
485 |
{
|
|
486 |
iTestStepName = _L("MM-MMF-ACLNT-U-0903-HP");
|
|
487 |
}
|
|
488 |
|
|
489 |
/**
|
|
490 |
*
|
|
491 |
* Do the test step.
|
|
492 |
* Each test step must supply an implementation for DoTestStepL.
|
|
493 |
*
|
|
494 |
* @return TVerdict: The result of the test step.
|
|
495 |
*
|
|
496 |
*/
|
|
497 |
TVerdict CTestMmfDRMAudioPPCSFileSource::DoTestStepL()
|
|
498 |
{
|
|
499 |
INFO_PRINTF1(_L("Open, play, pause, continue and stop the play of the protected audio clip from a file for PLAY/PAUSE/CONTINUE/STOP intents. (TMMFileSource)."));
|
|
500 |
iTestStepResult = EFail;
|
|
501 |
TRAPD(err,FsmL(EAudioOpen)); // Call to open the audio file
|
|
502 |
if (err == KErrNone)
|
|
503 |
{
|
|
504 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
505 |
}
|
|
506 |
else
|
|
507 |
{
|
|
508 |
iError = err;
|
|
509 |
CActiveScheduler::Stop();
|
|
510 |
}
|
|
511 |
|
|
512 |
return iTestStepResult;
|
|
513 |
}
|
|
514 |
|
|
515 |
|
|
516 |
|
|
517 |
/**
|
|
518 |
*
|
|
519 |
* Ctor for CTestMmfDRMAudioPlayAllocFileSource
|
|
520 |
*
|
|
521 |
* @return CTestMmfDRMAudioPlayAllocFileSource*:
|
|
522 |
* constructed CTestMmfDRMAudioPlayAllocFileSource object
|
|
523 |
*
|
|
524 |
*/
|
|
525 |
CTestMmfDRMAudioPlayAllocFileSource* CTestMmfDRMAudioPlayAllocFileSource::NewL()
|
|
526 |
{
|
|
527 |
return new (ELeave) CTestMmfDRMAudioPlayAllocFileSource;
|
|
528 |
}
|
|
529 |
|
|
530 |
/**
|
|
531 |
*
|
|
532 |
* Test step constructor.
|
|
533 |
* Each test step initialises its own name.
|
|
534 |
*
|
|
535 |
*/
|
|
536 |
CTestMmfDRMAudioPlayAllocFileSource::CTestMmfDRMAudioPlayAllocFileSource()
|
|
537 |
{
|
|
538 |
iTestStepName = _L("MM-MMF-ACLNT-U-0904-HP");
|
|
539 |
}
|
|
540 |
|
|
541 |
/**
|
|
542 |
*
|
|
543 |
* Play audio by marking heap.
|
|
544 |
*
|
|
545 |
*/
|
|
546 |
void CTestMmfDRMAudioPlayAllocFileSource::AudioPlayAllocL()
|
|
547 |
{
|
|
548 |
__MM_HEAP_MARK;
|
|
549 |
|
|
550 |
TRAPD(err, FsmL(EAudioOpen)); // Call to open the audio file
|
|
551 |
if (err == KErrNone)
|
|
552 |
{
|
|
553 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once{
|
|
554 |
}
|
|
555 |
|
|
556 |
iAudioPlayer->Close();
|
|
557 |
|
|
558 |
__MM_HEAP_MARKEND;
|
|
559 |
}
|
|
560 |
|
|
561 |
/**
|
|
562 |
*
|
|
563 |
* Do the test step.
|
|
564 |
* Each test step must supply an implementation for DoTestStepL.
|
|
565 |
*
|
|
566 |
* @return TVerdict: The result of the test step.
|
|
567 |
*
|
|
568 |
*/
|
|
569 |
TVerdict CTestMmfDRMAudioPlayAllocFileSource::DoTestStepL()
|
|
570 |
{
|
|
571 |
INFO_PRINTF1(_L("Alloc test to open and play a protected audio clip from a file for PLAY intent. (TMMFileSource)."));
|
|
572 |
iTestStepResult = EFail;
|
|
573 |
TRAP(iError, AudioPlayAllocL());
|
|
574 |
if (iError != KErrNone)
|
|
575 |
{
|
|
576 |
INFO_PRINTF2(_L("Opening/playing the audio file failed, unexpected error %d."), iError);
|
|
577 |
return EFail;
|
|
578 |
}
|
|
579 |
|
|
580 |
iTestStepResult = EPass;
|
|
581 |
|
|
582 |
TInt failCount = 1;
|
|
583 |
TBool completed = EFalse;
|
|
584 |
TBool badResult = EFalse;
|
|
585 |
TBool reachedEnd = EFalse;
|
|
586 |
|
|
587 |
EnableLogs(EFalse);
|
|
588 |
for(;;)
|
|
589 |
{
|
|
590 |
__UHEAP_SETFAIL(RHeap::EFailNext, failCount);
|
|
591 |
__MM_HEAP_MARK;
|
|
592 |
|
|
593 |
TInt error = KErrNone;
|
|
594 |
TRAP(error, AudioPlayAllocL());
|
|
595 |
|
|
596 |
if (error != KErrNone)
|
|
597 |
{
|
|
598 |
iError = error;
|
|
599 |
}
|
|
600 |
|
|
601 |
completed = EFalse;
|
|
602 |
if (iError == KErrNone)
|
|
603 |
{
|
|
604 |
TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
|
|
605 |
if (testAlloc == NULL)
|
|
606 |
{
|
|
607 |
reachedEnd = ETrue;
|
|
608 |
failCount--;
|
|
609 |
}
|
|
610 |
else
|
|
611 |
{
|
|
612 |
User::Free(testAlloc);
|
|
613 |
testAlloc = NULL;
|
|
614 |
}
|
|
615 |
|
|
616 |
if (iTestStepResult != EPass)
|
|
617 |
{
|
|
618 |
badResult = ETrue;
|
|
619 |
}
|
|
620 |
|
|
621 |
completed = reachedEnd || badResult;
|
|
622 |
}
|
|
623 |
else if (iError != KErrNoMemory)
|
|
624 |
{
|
|
625 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
|
626 |
ERR_PRINTF2(_L("Bad error code %d"), iError);
|
|
627 |
completed = ETrue;
|
|
628 |
badResult = EFail;
|
|
629 |
}
|
|
630 |
|
|
631 |
__MM_HEAP_MARKEND;
|
|
632 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
|
633 |
|
|
634 |
if (completed)
|
|
635 |
{
|
|
636 |
break;
|
|
637 |
}
|
|
638 |
|
|
639 |
failCount++;
|
|
640 |
}
|
|
641 |
|
|
642 |
if (iError != KErrNone || badResult)
|
|
643 |
{
|
|
644 |
if (badResult)
|
|
645 |
{
|
|
646 |
INFO_PRINTF3(_L("Bad result with %d memory allocations tested. The Error returned is %d."), failCount, iError);
|
|
647 |
}
|
|
648 |
else
|
|
649 |
{
|
|
650 |
INFO_PRINTF3(_L("Error(%d) with %d memory allocations tested."), failCount, iError);
|
|
651 |
}
|
|
652 |
|
|
653 |
iTestStepResult = EFail;
|
|
654 |
}
|
|
655 |
else
|
|
656 |
{
|
|
657 |
INFO_PRINTF2(_L("Completed OK with %d memory allocations tested.\n"), failCount);
|
|
658 |
iTestStepResult = EPass;
|
|
659 |
}
|
|
660 |
|
|
661 |
return iTestStepResult;
|
|
662 |
}
|
|
663 |
|
|
664 |
|
|
665 |
|
|
666 |
/**
|
|
667 |
*
|
|
668 |
* Ctor for CTestMmfDRMAudioPlayUniqueIdFileSource
|
|
669 |
*
|
|
670 |
* @return CTestMmfDRMAudioPlayUniqueIdFileSource*:
|
|
671 |
* constructed CTestMmfDRMAudioPlayUniqueIdFileSource object
|
|
672 |
*
|
|
673 |
*/
|
|
674 |
CTestMmfDRMAudioPlayUniqueIdFileSource* CTestMmfDRMAudioPlayUniqueIdFileSource::NewL()
|
|
675 |
{
|
|
676 |
return new (ELeave) CTestMmfDRMAudioPlayUniqueIdFileSource;
|
|
677 |
}
|
|
678 |
|
|
679 |
/**
|
|
680 |
*
|
|
681 |
* Test step constructor.
|
|
682 |
* Each test step initialises its own name.
|
|
683 |
*
|
|
684 |
*/
|
|
685 |
CTestMmfDRMAudioPlayUniqueIdFileSource::CTestMmfDRMAudioPlayUniqueIdFileSource()
|
|
686 |
{
|
|
687 |
iTestStepName = _L("MM-MMF-ACLNT-U-0905-HP");
|
|
688 |
}
|
|
689 |
|
|
690 |
/**
|
|
691 |
*
|
|
692 |
* Do the test step.
|
|
693 |
* Each test step must supply an implementation for DoTestStepL.
|
|
694 |
*
|
|
695 |
* @return TVerdict: The result of the test step.
|
|
696 |
*
|
|
697 |
*/
|
|
698 |
TVerdict CTestMmfDRMAudioPlayUniqueIdFileSource::DoTestStepL()
|
|
699 |
{
|
|
700 |
INFO_PRINTF1(_L("Open and play a protected audio clip from a file for PLAY intent with Unique Id. (TMMFileSource)."));
|
|
701 |
iTestStepResult = EFail;
|
|
702 |
TRAPD(err, FsmL(EAudioOpen)); // Call to open the audio file
|
|
703 |
if (err == KErrNone)
|
|
704 |
{
|
|
705 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
706 |
}
|
|
707 |
|
|
708 |
return iTestStepResult;
|
|
709 |
}
|
|
710 |
|
|
711 |
|
|
712 |
|
|
713 |
/**
|
|
714 |
*
|
|
715 |
* Ctor for CTestMmfDRMAudioPlayAllocFileHandleSource
|
|
716 |
*
|
|
717 |
* @return CTestMmfDRMAudioPlayAllocFileHandleSource*:
|
|
718 |
* constructed CTestMmfDRMAudioPlayAllocFileHandleSource object
|
|
719 |
*
|
|
720 |
*/
|
|
721 |
CTestMmfDRMAudioPlayAllocFileHandleSource* CTestMmfDRMAudioPlayAllocFileHandleSource::NewL()
|
|
722 |
{
|
|
723 |
return new (ELeave) CTestMmfDRMAudioPlayAllocFileHandleSource;
|
|
724 |
}
|
|
725 |
|
|
726 |
/**
|
|
727 |
*
|
|
728 |
* Test step constructor.
|
|
729 |
* Each test step initialises its own name.
|
|
730 |
*
|
|
731 |
*/
|
|
732 |
CTestMmfDRMAudioPlayAllocFileHandleSource::CTestMmfDRMAudioPlayAllocFileHandleSource()
|
|
733 |
{
|
|
734 |
iTestStepName = _L("MM-MMF-ACLNT-U-0906-HP");
|
|
735 |
}
|
|
736 |
|
|
737 |
/**
|
|
738 |
*
|
|
739 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
740 |
*
|
|
741 |
* @param TInt aError
|
|
742 |
*
|
|
743 |
*/
|
|
744 |
void CTestMmfDRMAudioPlayAllocFileHandleSource::MapcInitComplete(TInt aError,
|
|
745 |
const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
746 |
{
|
|
747 |
INFO_PRINTF2_IF_LOGS_ENABLED(_L("MMdaAudioPlayerCallback Init Complete. Error = %d"), aError);
|
|
748 |
iError = aError;
|
|
749 |
if (iError != KErrNone)
|
|
750 |
{
|
|
751 |
ERR_PRINTF1_IF_LOGS_ENABLED(_L("Opening the audio file failed."));
|
|
752 |
iAudioPlayer->Close();
|
|
753 |
CActiveScheduler::Stop();
|
|
754 |
}
|
|
755 |
else
|
|
756 |
{
|
|
757 |
TRAP(iError, FsmHandleL(EAudioPlay)); // Call to play audio
|
|
758 |
}
|
|
759 |
}
|
|
760 |
|
|
761 |
/**
|
|
762 |
*
|
|
763 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
764 |
*
|
|
765 |
* @param TInt aError
|
|
766 |
*
|
|
767 |
*/
|
|
768 |
void CTestMmfDRMAudioPlayAllocFileHandleSource::MapcPlayComplete(TInt aError)
|
|
769 |
{
|
|
770 |
INFO_PRINTF2_IF_LOGS_ENABLED(_L("MMdaAudioPlayerCallback Play Complete. Error = %d"), aError);
|
|
771 |
iError = aError;
|
|
772 |
if (iError != KErrNone)
|
|
773 |
{
|
|
774 |
ERR_PRINTF2_IF_LOGS_ENABLED(_L("Audio playback failed with unexpected error %d."), aError);
|
|
775 |
iAudioPlayer->Close();
|
|
776 |
CActiveScheduler::Stop();
|
|
777 |
}
|
|
778 |
else
|
|
779 |
{
|
|
780 |
TRAP(iError, FsmHandleL(EAudioPlayEnd)); // end audio playback
|
|
781 |
}
|
|
782 |
|
|
783 |
}
|
|
784 |
|
|
785 |
/**
|
|
786 |
*
|
|
787 |
* Play audio by marking heap.
|
|
788 |
*
|
|
789 |
*/
|
|
790 |
void CTestMmfDRMAudioPlayAllocFileHandleSource::AudioPlayAllocL()
|
|
791 |
{
|
|
792 |
__MM_HEAP_MARK;
|
|
793 |
|
|
794 |
User::LeaveIfError(iFs.Connect());
|
|
795 |
User::LeaveIfError(iFs.ShareProtected());
|
|
796 |
User::LeaveIfError(iFile.Open(iFs, iFileName, EFileRead | EFileShareReadersOnly));
|
|
797 |
|
|
798 |
TRAPD(err, FsmHandleL(EAudioOpen)); // Call to open the audio file thru file handle
|
|
799 |
if (err == KErrNone)
|
|
800 |
{
|
|
801 |
CActiveScheduler::Start();
|
|
802 |
}
|
|
803 |
|
|
804 |
iAudioPlayer->Close();
|
|
805 |
|
|
806 |
iFile.Close();
|
|
807 |
iFs.Close();
|
|
808 |
|
|
809 |
__MM_HEAP_MARKEND;
|
|
810 |
}
|
|
811 |
|
|
812 |
/**
|
|
813 |
*
|
|
814 |
* Do the test step.
|
|
815 |
* Each test step must supply an implementation for DoTestStepL.
|
|
816 |
*
|
|
817 |
* @return TVerdict: The result of the test step.
|
|
818 |
*
|
|
819 |
*/
|
|
820 |
TVerdict CTestMmfDRMAudioPlayAllocFileHandleSource::DoTestStepL()
|
|
821 |
{
|
|
822 |
INFO_PRINTF1(_L("Alloc test to open and play a protected audio clip from a file for PLAY intent. (TMMFileHandleSource)."));
|
|
823 |
#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
|
|
824 |
// As a part of DEF123331, this test has been disabled for non-A3F build.
|
|
825 |
INFO_PRINTF1(_L("As a part of DEF123331, this test has been disabled for non-A3F build."));
|
|
826 |
return EPass;
|
|
827 |
#else
|
|
828 |
TRAPD(err, AudioPlayAllocL());
|
|
829 |
if(err != KErrNone)
|
|
830 |
{
|
|
831 |
iError = err;
|
|
832 |
}
|
|
833 |
|
|
834 |
if (iError != KErrNone)
|
|
835 |
{
|
|
836 |
INFO_PRINTF2(_L("Opening/playing the audio file failed, unexpected error %d."), iError);
|
|
837 |
return EFail;
|
|
838 |
}
|
|
839 |
|
|
840 |
iTestStepResult = EPass;
|
|
841 |
|
|
842 |
TInt failCount = 1;
|
|
843 |
TBool completed = EFalse;
|
|
844 |
TBool badResult = EFalse;
|
|
845 |
TBool reachedEnd = EFalse;
|
|
846 |
TInt error = KErrNone;
|
|
847 |
|
|
848 |
EnableLogs(EFalse);
|
|
849 |
for(;;)
|
|
850 |
{
|
|
851 |
__UHEAP_SETFAIL(RHeap::EFailNext, failCount);
|
|
852 |
__MM_HEAP_MARK;
|
|
853 |
|
|
854 |
TRAP(error, AudioPlayAllocL());
|
|
855 |
if (error != KErrNone)
|
|
856 |
{
|
|
857 |
iError = error;
|
|
858 |
iFile.Close();
|
|
859 |
iFs.Close();
|
|
860 |
}
|
|
861 |
|
|
862 |
|
|
863 |
completed = EFalse;
|
|
864 |
if (iError == KErrNone)
|
|
865 |
{
|
|
866 |
TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test
|
|
867 |
if (testAlloc == NULL)
|
|
868 |
{
|
|
869 |
reachedEnd = ETrue;
|
|
870 |
failCount--;
|
|
871 |
}
|
|
872 |
else
|
|
873 |
{
|
|
874 |
User::Free(testAlloc);
|
|
875 |
testAlloc = NULL;
|
|
876 |
}
|
|
877 |
|
|
878 |
if (iTestStepResult != EPass)
|
|
879 |
{
|
|
880 |
badResult = ETrue;
|
|
881 |
}
|
|
882 |
|
|
883 |
completed = reachedEnd || badResult;
|
|
884 |
}
|
|
885 |
else if (iError != KErrNoMemory)
|
|
886 |
{
|
|
887 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
|
888 |
ERR_PRINTF2(_L("Bad error code %d"), iError);
|
|
889 |
completed = ETrue;
|
|
890 |
badResult = EFail;
|
|
891 |
}
|
|
892 |
|
|
893 |
__MM_HEAP_MARKEND;
|
|
894 |
__UHEAP_SETFAIL(RHeap::ENone, 0);
|
|
895 |
|
|
896 |
if (completed)
|
|
897 |
{
|
|
898 |
break;
|
|
899 |
}
|
|
900 |
|
|
901 |
failCount++;
|
|
902 |
}
|
|
903 |
|
|
904 |
if (iError != KErrNone || badResult)
|
|
905 |
{
|
|
906 |
if (badResult)
|
|
907 |
{
|
|
908 |
INFO_PRINTF3(_L("Bad result with %d memory allocations tested. The Error returned is %d."), failCount, iError);
|
|
909 |
}
|
|
910 |
else
|
|
911 |
{
|
|
912 |
INFO_PRINTF3(_L("Error(%d) with %d memory allocations tested."), failCount, iError);
|
|
913 |
}
|
|
914 |
|
|
915 |
iTestStepResult = EFail;
|
|
916 |
}
|
|
917 |
else
|
|
918 |
{
|
|
919 |
INFO_PRINTF2(_L("Completed OK with %d memory allocations tested.\n"), failCount);
|
|
920 |
iTestStepResult = EPass;
|
|
921 |
}
|
|
922 |
|
|
923 |
return iTestStepResult;
|
|
924 |
#endif
|
|
925 |
}
|
|
926 |
|
|
927 |
|
|
928 |
|
|
929 |
// Negative Tests
|
|
930 |
|
|
931 |
/**
|
|
932 |
*
|
|
933 |
* Ctor for CTestMmfDRMAudioOpenUnknownFileSource
|
|
934 |
*
|
|
935 |
* @return CTestMmfDRMAudioOpenUnknownFileSource*:
|
|
936 |
* constructed CTestMmfDRMAudioOpenUnknownFileSource object
|
|
937 |
*
|
|
938 |
*/
|
|
939 |
CTestMmfDRMAudioOpenUnknownFileSource* CTestMmfDRMAudioOpenUnknownFileSource::NewL()
|
|
940 |
{
|
|
941 |
return new (ELeave) CTestMmfDRMAudioOpenUnknownFileSource;
|
|
942 |
}
|
|
943 |
|
|
944 |
/**
|
|
945 |
*
|
|
946 |
* Test step constructor.
|
|
947 |
* Each test step initialises its own name.
|
|
948 |
*
|
|
949 |
*/
|
|
950 |
CTestMmfDRMAudioOpenUnknownFileSource::CTestMmfDRMAudioOpenUnknownFileSource()
|
|
951 |
{
|
|
952 |
iTestStepName = _L("MM-MMF-ACLNT-U-0921-HP");
|
|
953 |
}
|
|
954 |
|
|
955 |
/**
|
|
956 |
*
|
|
957 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
958 |
*
|
|
959 |
* @param TInt aError
|
|
960 |
*
|
|
961 |
*/
|
|
962 |
void CTestMmfDRMAudioOpenUnknownFileSource::MapcInitComplete(TInt aError,
|
|
963 |
const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
964 |
{
|
|
965 |
INFO_PRINTF2(_L("MMdaAudioPlayerCallback Init Complete. Error = %d"), aError);
|
|
966 |
iError = aError;
|
|
967 |
CActiveScheduler::Stop();
|
|
968 |
}
|
|
969 |
|
|
970 |
void CTestMmfDRMAudioOpenUnknownFileSource::MapcPlayComplete(TInt /*aError*/)
|
|
971 |
{
|
|
972 |
// Not used in this test.
|
|
973 |
}
|
|
974 |
|
|
975 |
/**
|
|
976 |
*
|
|
977 |
* Do the test step.
|
|
978 |
* Each test step must supply an implementation for DoTestStepL.
|
|
979 |
*
|
|
980 |
* @return TVerdict: The result of the test step.
|
|
981 |
*
|
|
982 |
*/
|
|
983 |
TVerdict CTestMmfDRMAudioOpenUnknownFileSource::DoTestStepL()
|
|
984 |
{
|
|
985 |
INFO_PRINTF1(_L("Open a protected audio clip from a file with rights for UNKNOWN intent. (TMMFileSource)."));
|
|
986 |
|
|
987 |
iTestStepResult = EFail;
|
|
988 |
|
|
989 |
INFO_PRINTF2(_L("Opening the file for PLAY intent: %S"), &iFileName);
|
|
990 |
iAudioPlayer->OpenFileL(TMMFileSource(iFileName, KRightsPlayerUniqueId001, ContentAccess::EUnknown));
|
|
991 |
|
|
992 |
|
|
993 |
CActiveScheduler::Start();
|
|
994 |
|
|
995 |
if (iError == KErrCANoPermission)
|
|
996 |
{
|
|
997 |
INFO_PRINTF1(_L("No Permission to open the audio file for Unknown intent!"));
|
|
998 |
iTestStepResult = EPass;
|
|
999 |
}
|
|
1000 |
else
|
|
1001 |
{
|
|
1002 |
INFO_PRINTF3(_L("Unexpected error %d, expected %d."), iError, KErrCANoPermission);
|
|
1003 |
}
|
|
1004 |
|
|
1005 |
return iTestStepResult;
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
|
1010 |
/**
|
|
1011 |
*
|
|
1012 |
* Ctor for CTestMmfDRMAudioPlayNoRightsFileSource
|
|
1013 |
*
|
|
1014 |
* @return CTestMmfDRMAudioPlayNoRightsFileSource*:
|
|
1015 |
* constructed CTestMmfDRMAudioPlayNoRightsFileSource object
|
|
1016 |
*
|
|
1017 |
*/
|
|
1018 |
CTestMmfDRMAudioPlayNoRightsFileSource* CTestMmfDRMAudioPlayNoRightsFileSource::NewL()
|
|
1019 |
{
|
|
1020 |
return new (ELeave) CTestMmfDRMAudioPlayNoRightsFileSource;
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
/**
|
|
1024 |
*
|
|
1025 |
* Test step constructor.
|
|
1026 |
* Each test step initialises its own name.
|
|
1027 |
*
|
|
1028 |
*/
|
|
1029 |
CTestMmfDRMAudioPlayNoRightsFileSource::CTestMmfDRMAudioPlayNoRightsFileSource()
|
|
1030 |
{
|
|
1031 |
iTestStepName = _L("MM-MMF-ACLNT-U-0922-HP");
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
/**
|
|
1035 |
*
|
|
1036 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
1037 |
*
|
|
1038 |
* @param TInt aError
|
|
1039 |
*
|
|
1040 |
*/
|
|
1041 |
void CTestMmfDRMAudioPlayNoRightsFileSource::MapcInitComplete(TInt aError,
|
|
1042 |
const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
1043 |
{
|
|
1044 |
INFO_PRINTF2(_L("MMdaAudioPlayerCallback Init Complete. Error = %d"), aError);
|
|
1045 |
iError = aError;
|
|
1046 |
CActiveScheduler::Stop();
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
void CTestMmfDRMAudioPlayNoRightsFileSource::MapcPlayComplete(TInt /*aError*/)
|
|
1050 |
{
|
|
1051 |
// Not used in this test.
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
/**
|
|
1055 |
*
|
|
1056 |
* Do the test step.
|
|
1057 |
* Each test step must supply an implementation for DoTestStepL.
|
|
1058 |
*
|
|
1059 |
* @return TVerdict: The result of the test step.
|
|
1060 |
*
|
|
1061 |
*/
|
|
1062 |
TVerdict CTestMmfDRMAudioPlayNoRightsFileSource::DoTestStepL()
|
|
1063 |
{
|
|
1064 |
INFO_PRINTF1(_L("Open a protected audio clip from a file for PLAY intent with NO rights. (TMMFileSource)."));
|
|
1065 |
|
|
1066 |
iTestStepResult = EFail;
|
|
1067 |
|
|
1068 |
// Get the filename
|
|
1069 |
// iFileName will be the content file, containing audio files
|
|
1070 |
if (!GetStringFromConfig(_L("SectionDRM"), _L("AudioContentNoRights"), iFileName))
|
|
1071 |
{
|
|
1072 |
return EInconclusive;
|
|
1073 |
}
|
|
1074 |
|
|
1075 |
INFO_PRINTF2(_L("Opening the file for PLAY intent: %S"), &iFileName);
|
|
1076 |
iAudioPlayer->OpenFileL(TMMFileSource(iFileName, KRightsPlayerUniqueId004, ContentAccess::EPlay));
|
|
1077 |
|
|
1078 |
CActiveScheduler::Start();
|
|
1079 |
|
|
1080 |
if (iError == KErrCANoRights)
|
|
1081 |
{
|
|
1082 |
INFO_PRINTF1(_L("Expected failure: No rights."));
|
|
1083 |
iTestStepResult = EPass;
|
|
1084 |
}
|
|
1085 |
else
|
|
1086 |
{
|
|
1087 |
INFO_PRINTF3(_L("Unexpected error %d, expected %d."), iError, KErrCANoRights);
|
|
1088 |
}
|
|
1089 |
|
|
1090 |
return iTestStepResult;
|
|
1091 |
}
|
|
1092 |
|
|
1093 |
|
|
1094 |
|
|
1095 |
/**
|
|
1096 |
*
|
|
1097 |
* Ctor for CTestMmfDRMAudioPlayRightsCountFileSource
|
|
1098 |
*
|
|
1099 |
* @return CTestMmfDRMAudioPlayRightsCountFileSource*:
|
|
1100 |
* constructed CTestMmfDRMAudioPlayRightsCountFileSource object
|
|
1101 |
*
|
|
1102 |
*/
|
|
1103 |
CTestMmfDRMAudioPlayRightsCountFileSource* CTestMmfDRMAudioPlayRightsCountFileSource::NewL()
|
|
1104 |
{
|
|
1105 |
return new (ELeave) CTestMmfDRMAudioPlayRightsCountFileSource;
|
|
1106 |
}
|
|
1107 |
|
|
1108 |
/**
|
|
1109 |
*
|
|
1110 |
* Test step constructor.
|
|
1111 |
* Each test step initialises its own name.
|
|
1112 |
*
|
|
1113 |
*/
|
|
1114 |
CTestMmfDRMAudioPlayRightsCountFileSource::CTestMmfDRMAudioPlayRightsCountFileSource()
|
|
1115 |
{
|
|
1116 |
iTestStepName = _L("MM-MMF-ACLNT-U-0923-HP");
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
/**
|
|
1120 |
*
|
|
1121 |
* Do the test step.
|
|
1122 |
* Each test step must supply an implementation for DoTestStepL.
|
|
1123 |
*
|
|
1124 |
* @return TVerdict: The result of the test step.
|
|
1125 |
*
|
|
1126 |
*/
|
|
1127 |
TVerdict CTestMmfDRMAudioPlayRightsCountFileSource::DoTestStepL()
|
|
1128 |
{
|
|
1129 |
INFO_PRINTF1(_L("Open and play a protected audio clip from a file for PLAY intent 4 times with rights count set to 3. (TMMFileSource)."));
|
|
1130 |
|
|
1131 |
// Open and play the audio file for three times
|
|
1132 |
// The rights count for this protected audio file is set to 3.
|
|
1133 |
// Hence looped four times to check failure while opening for the fourth time.
|
|
1134 |
for (TInt rightscount = 1; rightscount <= 4; rightscount++)
|
|
1135 |
{
|
|
1136 |
iTestStepResult = EFail;
|
|
1137 |
INFO_PRINTF2(_L("Rights count = %d "), rightscount);
|
|
1138 |
|
|
1139 |
TRAPD(err, FsmL(EAudioOpen)); // Call to open the audio file
|
|
1140 |
if (err == KErrNone)
|
|
1141 |
{
|
|
1142 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
1143 |
}
|
|
1144 |
|
|
1145 |
if ((iError == KErrCANoPermission) && (rightscount == 4))
|
|
1146 |
{
|
|
1147 |
INFO_PRINTF1(_L("No Permission to open the audio file!"));
|
|
1148 |
iTestStepResult = EPass;
|
|
1149 |
}
|
|
1150 |
else if (iError != KErrNone)
|
|
1151 |
{
|
|
1152 |
ERR_PRINTF2(_L("Opening the audio file failed, unexpected error %d."), iError);
|
|
1153 |
return iTestStepResult;
|
|
1154 |
}
|
|
1155 |
}
|
|
1156 |
|
|
1157 |
return iTestStepResult;
|
|
1158 |
}
|
|
1159 |
|
|
1160 |
|
|
1161 |
|
|
1162 |
/**
|
|
1163 |
*
|
|
1164 |
* Ctor for CTestMmfDRMAudioPlayInvalidIdFileSource
|
|
1165 |
*
|
|
1166 |
* @return CTestMmfDRMAudioPlayInvalidIdFileSource*:
|
|
1167 |
* constructed CTestMmfDRMAudioPlayInvalidIdFileSource object
|
|
1168 |
*
|
|
1169 |
*/
|
|
1170 |
CTestMmfDRMAudioPlayInvalidIdFileSource* CTestMmfDRMAudioPlayInvalidIdFileSource::NewL()
|
|
1171 |
{
|
|
1172 |
return new (ELeave) CTestMmfDRMAudioPlayInvalidIdFileSource;
|
|
1173 |
}
|
|
1174 |
|
|
1175 |
/**
|
|
1176 |
*
|
|
1177 |
* Test step constructor.
|
|
1178 |
* Each test step initialises its own name.
|
|
1179 |
*
|
|
1180 |
*/
|
|
1181 |
CTestMmfDRMAudioPlayInvalidIdFileSource::CTestMmfDRMAudioPlayInvalidIdFileSource()
|
|
1182 |
{
|
|
1183 |
iTestStepName = _L("MM-MMF-ACLNT-U-0924-HP");
|
|
1184 |
}
|
|
1185 |
|
|
1186 |
/**
|
|
1187 |
*
|
|
1188 |
* Implementation of the MMdaAudioPlayerCallback interface function.
|
|
1189 |
*
|
|
1190 |
* @param TInt aError
|
|
1191 |
*
|
|
1192 |
*/
|
|
1193 |
void CTestMmfDRMAudioPlayInvalidIdFileSource::MapcInitComplete(TInt aError,
|
|
1194 |
const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
1195 |
{
|
|
1196 |
INFO_PRINTF2(_L("MMdaAudioPlayerCallback Init Complete. Error = %d"), aError);
|
|
1197 |
iError = aError;
|
|
1198 |
CActiveScheduler::Stop();
|
|
1199 |
}
|
|
1200 |
|
|
1201 |
void CTestMmfDRMAudioPlayInvalidIdFileSource::MapcPlayComplete(TInt /*aError*/)
|
|
1202 |
{
|
|
1203 |
// Not used in this test.
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
/**
|
|
1207 |
*
|
|
1208 |
* Do the test step.
|
|
1209 |
* Each test step must supply an implementation for DoTestStepL.
|
|
1210 |
*
|
|
1211 |
* @return TVerdict: The result of the test step.
|
|
1212 |
*
|
|
1213 |
*/
|
|
1214 |
TVerdict CTestMmfDRMAudioPlayInvalidIdFileSource::DoTestStepL()
|
|
1215 |
{
|
|
1216 |
INFO_PRINTF1(_L("Open a protected audio clip from a file for PLAY intent with INVALID Unique Id. (TMMFileSource)."));
|
|
1217 |
|
|
1218 |
iTestStepResult = EFail;
|
|
1219 |
|
|
1220 |
INFO_PRINTF2(_L("Opening the file for PLAY intent: %S"), &iFileName);
|
|
1221 |
iAudioPlayer->OpenFileL(TMMFileSource(iFileName, KRightsPlayerInvalidUniqueId, ContentAccess::EPlay));
|
|
1222 |
|
|
1223 |
CActiveScheduler::Start();
|
|
1224 |
|
|
1225 |
if (iError == KErrNotFound)
|
|
1226 |
{
|
|
1227 |
INFO_PRINTF1(_L("Expected failure: Audio file not found!"));
|
|
1228 |
iTestStepResult = EPass;
|
|
1229 |
}
|
|
1230 |
else
|
|
1231 |
{
|
|
1232 |
INFO_PRINTF3(_L("Unexpected error %d, expected %d."), iError, KErrNotFound);
|
|
1233 |
}
|
|
1234 |
|
|
1235 |
return iTestStepResult;
|
|
1236 |
}
|
|
1237 |
/**
|
|
1238 |
*
|
|
1239 |
* Ctor for CTestMmfDRMAudioPlayAndStopFileSource
|
|
1240 |
*
|
|
1241 |
* @return CTestMmfDRMAudioPlayAndStopFileSource*: constructed CTestMmfDRMAudioPlayAndStopFileSource object
|
|
1242 |
*
|
|
1243 |
*/
|
|
1244 |
CTestMmfDRMAudioPlayAndStopFileSource* CTestMmfDRMAudioPlayAndStopFileSource::NewL()
|
|
1245 |
{
|
|
1246 |
return new (ELeave) CTestMmfDRMAudioPlayAndStopFileSource;
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
/**
|
|
1250 |
*
|
|
1251 |
* Test step constructor.
|
|
1252 |
* Each test step initialises its own name.
|
|
1253 |
*
|
|
1254 |
*/
|
|
1255 |
CTestMmfDRMAudioPlayAndStopFileSource::CTestMmfDRMAudioPlayAndStopFileSource()
|
|
1256 |
{
|
|
1257 |
iTestStepName = _L("MM-MMF-ACLNT-U-0907-HP");
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
/**
|
|
1261 |
*
|
|
1262 |
* Do the test step.
|
|
1263 |
* Each test step must supply an implementation for DoTestStepL.
|
|
1264 |
*
|
|
1265 |
* @return TVerdict: The result of the test step.
|
|
1266 |
*
|
|
1267 |
*/
|
|
1268 |
TVerdict CTestMmfDRMAudioPlayAndStopFileSource::DoTestStepL()
|
|
1269 |
{
|
|
1270 |
INFO_PRINTF1(_L("Open, play, and stop the play of the protected audio clip from a file for PLAY/STOP intents. (TMMFileSource)."));
|
|
1271 |
iTestStepResult = EFail;
|
|
1272 |
TRAPD(err,FsmL(EAudioOpen)); // Call to open the audio file
|
|
1273 |
if (err == KErrNone)
|
|
1274 |
{
|
|
1275 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
1276 |
}
|
|
1277 |
else
|
|
1278 |
{
|
|
1279 |
iError = err;
|
|
1280 |
CActiveScheduler::Stop();
|
|
1281 |
}
|
|
1282 |
|
|
1283 |
return iTestStepResult;
|
|
1284 |
}
|
|
1285 |
CTestMmfDRMAudioPPCFFileSource* CTestMmfDRMAudioPPCFFileSource::NewL()
|
|
1286 |
{
|
|
1287 |
return new (ELeave) CTestMmfDRMAudioPPCFFileSource;
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
/**
|
|
1291 |
*
|
|
1292 |
* Test step constructor.
|
|
1293 |
* Each test step initialises its own name.
|
|
1294 |
*
|
|
1295 |
*/
|
|
1296 |
CTestMmfDRMAudioPPCFFileSource::CTestMmfDRMAudioPPCFFileSource()
|
|
1297 |
{
|
|
1298 |
iTestStepName = _L("MM-MMF-ACLNT-U-0909-HP");
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
/**
|
|
1302 |
*
|
|
1303 |
* Do the test step.
|
|
1304 |
* Each test step must supply an implementation for DoTestStepL.
|
|
1305 |
*
|
|
1306 |
* @return TVerdict: The result of the test step.
|
|
1307 |
*
|
|
1308 |
*/
|
|
1309 |
TVerdict CTestMmfDRMAudioPPCFFileSource::DoTestStepL()
|
|
1310 |
{
|
|
1311 |
INFO_PRINTF1(_L("Open a protected audio clip, switch the state between play and pause very quickly (0.05 second each) for PLAY/PAUSE/CONTINUE/STOP intents to test INC115501. (TMMFileSource)."));
|
|
1312 |
iTestStepResult = EFail;
|
|
1313 |
TRAPD(err,FsmL(EAudioOpen)); // Call to open the audio file
|
|
1314 |
|
|
1315 |
|
|
1316 |
if (err == KErrNone)
|
|
1317 |
{
|
|
1318 |
CActiveScheduler::Start(); // ActiveScheduler started ONLY once
|
|
1319 |
}
|
|
1320 |
else
|
|
1321 |
{
|
|
1322 |
iError = err;
|
|
1323 |
CActiveScheduler::Stop();
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
return iTestStepResult;
|
|
1327 |
}
|
|
1328 |
|