|
1 // Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "testvideoplayer.h" |
|
17 |
|
18 #include <e32math.h> |
|
19 #include <mmf/common/mmfvideo.h> |
|
20 #include "u32hal.h" |
|
21 |
|
22 #ifdef SYMBIAN_BUILD_GCE |
|
23 #include <gceavailable.h> |
|
24 #endif |
|
25 |
|
26 const TInt KFrameWidth = 100; |
|
27 const TInt KFrameHeight = 50; |
|
28 |
|
29 const TInt KCropRegionRectTop = 1; |
|
30 const TInt KCropRegionRectLeft = 3; |
|
31 const TInt KCropRegionRectRight = 5; |
|
32 const TInt KCropRegionRectBottom = 7; |
|
33 const TUint KCacheSize = 1000000; //1MB |
|
34 const TUint KMaxCacheSize = 30000000; //30MB |
|
35 |
|
36 // |
|
37 // RTestVclntPlayAviFile |
|
38 // |
|
39 |
|
40 /** |
|
41 * RTestVclntPlayAviFile::Constructor |
|
42 */ |
|
43 RTestVclntPlayAviFile::RTestVclntPlayAviFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay) |
|
44 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay) |
|
45 { |
|
46 iHeapSize = 2000000; //-2MB |
|
47 } |
|
48 |
|
49 /** |
|
50 * RTestVclntPlayAviFile::NewL |
|
51 */ |
|
52 RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
53 { |
|
54 RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
55 return self; |
|
56 } |
|
57 |
|
58 /** |
|
59 * RTestVclntPlayAviFile::NewLC |
|
60 */ |
|
61 RTestVclntPlayAviFile* RTestVclntPlayAviFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
62 { |
|
63 RTestVclntPlayAviFile* self = new (ELeave) RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
64 CleanupStack::PushL(self); |
|
65 return self; |
|
66 } |
|
67 |
|
68 /** |
|
69 * RTestVclntPlayAviFile::DoTestStepL |
|
70 */ |
|
71 TVerdict RTestVclntPlayAviFile::DoTestStepL() |
|
72 { |
|
73 // WDP:We are going to start the test now |
|
74 // Ensure we set paging memory to appropriate cache size for tests which need it |
|
75 //ignore other tests |
|
76 TVerdict verdict=SetCacheSize(); |
|
77 if(verdict!=EPass) |
|
78 { |
|
79 return verdict; |
|
80 } |
|
81 |
|
82 // Call the state handler from IDLE state |
|
83 FsmL(EVPIdle); |
|
84 User::LeaveIfError(iError); |
|
85 // Start the scheduler - Done only once ! |
|
86 CActiveScheduler::Start(); |
|
87 |
|
88 return iTestStepResult; |
|
89 } |
|
90 |
|
91 //Default SetCache size |
|
92 TVerdict RTestVclntPlayAviFile::SetCacheSize() |
|
93 { |
|
94 //Do not try to increase cache size for tests which dont need it |
|
95 return EPass; |
|
96 |
|
97 } |
|
98 |
|
99 /** |
|
100 * RTestVclntPlayAviFile::FsmL |
|
101 */ |
|
102 void RTestVclntPlayAviFile::FsmL(TVclntTestPlayEvents aEventCode) |
|
103 { |
|
104 if (FsmCheck(aEventCode)) |
|
105 { |
|
106 //TInt err = KErrNone; |
|
107 switch (aEventCode) |
|
108 { |
|
109 case EVPIdle: |
|
110 // Open iVideoPlayer |
|
111 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
112 TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
113 PrepareState(EVPOpenComplete, KErrNone); |
|
114 break; |
|
115 case EVPOpenComplete: |
|
116 // Prepare iVideoPlayer |
|
117 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
118 iVideoPlayer->Prepare(); |
|
119 PrepareState(EVPPrepareComplete, KErrNone); |
|
120 break; |
|
121 case EVPPrepareComplete: |
|
122 iTestStepResult = DoTestL(iVideoPlayer); |
|
123 break; |
|
124 case EVPPlayComplete: |
|
125 iTestStepResult = EPass; |
|
126 CActiveScheduler::Stop(); |
|
127 break; |
|
128 } |
|
129 } |
|
130 } |
|
131 |
|
132 /** |
|
133 * RTestVclntPlayAviFile::DoTestL |
|
134 */ |
|
135 TVerdict RTestVclntPlayAviFile::DoTestL(CVideoPlayerUtility* /*aPlayer*/) |
|
136 { |
|
137 TVerdict ret = EFail; |
|
138 |
|
139 if(iPlay) |
|
140 { |
|
141 iError = KErrTimedOut; |
|
142 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
143 PrepareState(EVPPlayComplete, KErrNone); |
|
144 iVideoPlayer->Play(); |
|
145 } |
|
146 else |
|
147 { |
|
148 CActiveScheduler::Stop(); |
|
149 ret = EPass; |
|
150 } |
|
151 |
|
152 return ret; |
|
153 } |
|
154 |
|
155 // |
|
156 // RTestVclntPlayAviDes |
|
157 // |
|
158 |
|
159 /** |
|
160 * RTestVclntPlayAviDes::Constructor |
|
161 */ |
|
162 RTestVclntPlayAviDes::RTestVclntPlayAviDes(const TDesC& aTestName,const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aPlay) |
|
163 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay) |
|
164 { |
|
165 iHeapSize = 500000; |
|
166 } |
|
167 |
|
168 /** |
|
169 * RTestVclntPlayAviDes::NewL |
|
170 */ |
|
171 RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
172 { |
|
173 RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
174 return self; |
|
175 } |
|
176 |
|
177 /** |
|
178 * RTestVclntPlayAviDes::NewLC |
|
179 */ |
|
180 RTestVclntPlayAviDes* RTestVclntPlayAviDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
181 { |
|
182 RTestVclntPlayAviDes* self = new (ELeave) RTestVclntPlayAviDes(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
183 CleanupStack::PushL(self); |
|
184 return self; |
|
185 } |
|
186 |
|
187 /** |
|
188 * RTestVclntPlayAviDes::DoTestStepPreambleL |
|
189 */ |
|
190 TVerdict RTestVclntPlayAviDes::DoTestStepPreambleL() |
|
191 { |
|
192 TVerdict preamRes; |
|
193 preamRes = EPass; |
|
194 |
|
195 // Base DoTestStepPreambleL |
|
196 preamRes = RTestVclntAviPlayerStep::DoTestStepPreambleL(); |
|
197 if (preamRes != EPass) |
|
198 { |
|
199 return preamRes; |
|
200 } |
|
201 |
|
202 RFs fs; |
|
203 RFile file; |
|
204 TInt size = 0; |
|
205 |
|
206 // connect to file system and open file |
|
207 User::LeaveIfError(fs.Connect()); |
|
208 CleanupClosePushL(fs); |
|
209 User::LeaveIfError(file.Open(fs,iFilename,EFileRead)); |
|
210 CleanupClosePushL(file); |
|
211 |
|
212 // Set HBuf size |
|
213 User::LeaveIfError(file.Size(size)); |
|
214 INFO_PRINTF2(_L("size of file = %d\n"),size);//Statement Changed under DEF105143 |
|
215 |
|
216 iVideo = HBufC8::NewMaxL(size); |
|
217 |
|
218 // read data into Hbuf |
|
219 TPtr8 bufferDes(iVideo->Des()); |
|
220 User::LeaveIfError(file.Read(bufferDes)); |
|
221 |
|
222 CleanupStack::PopAndDestroy(2); //fs, file |
|
223 |
|
224 return preamRes; |
|
225 } |
|
226 |
|
227 /** |
|
228 * RTestVclntPlayAviDes::DoTestStepPostambleL |
|
229 */ |
|
230 TVerdict RTestVclntPlayAviDes::DoTestStepPostambleL() |
|
231 { |
|
232 delete iVideo; |
|
233 iVideo = NULL; |
|
234 return RTestVclntAviPlayerStep::DoTestStepPostambleL(); |
|
235 } |
|
236 |
|
237 /** |
|
238 * Load and initialise an video descriptor. |
|
239 */ |
|
240 TVerdict RTestVclntPlayAviDes::DoTestStepL() |
|
241 { |
|
242 iTestStepResult = EFail; |
|
243 // Call the state handler from IDLE state |
|
244 TRAPD(err, FsmL(EVPIdle)); |
|
245 if (err == KErrNone) |
|
246 { |
|
247 CActiveScheduler::Start(); |
|
248 } |
|
249 // Start the scheduler - Done only once ! |
|
250 return iTestStepResult; |
|
251 } |
|
252 |
|
253 /** |
|
254 * RTestVclntPlayAviDes::FsmL |
|
255 */ |
|
256 void RTestVclntPlayAviDes::FsmL(TVclntTestPlayEvents aEventCode) |
|
257 { |
|
258 if (FsmCheck(aEventCode)) |
|
259 { |
|
260 //TInt err = KErrNone; |
|
261 switch (aEventCode) |
|
262 { |
|
263 case EVPIdle: |
|
264 // Open iVideoPlayer |
|
265 INFO_PRINTF2(_L("iVideoPlayer->OpenDesL() %S"), &iFilename); |
|
266 TRAP(iError, iVideoPlayer->OpenDesL(iVideo->Des(), ControllerUid())); |
|
267 PrepareState(EVPOpenComplete, KErrNone); |
|
268 break; |
|
269 case EVPOpenComplete: |
|
270 // Prepare iVideoPlayer |
|
271 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
272 iVideoPlayer->Prepare(); |
|
273 PrepareState(EVPPrepareComplete, KErrNone); |
|
274 break; |
|
275 case EVPPrepareComplete: |
|
276 iTestStepResult = DoTestL(iVideoPlayer); |
|
277 break; |
|
278 case EVPPlayComplete: |
|
279 iTestStepResult = EPass; |
|
280 CActiveScheduler::Stop(); |
|
281 break; |
|
282 } |
|
283 } |
|
284 } |
|
285 |
|
286 /** |
|
287 * RTestVclntPlayAviDes::DoTestL |
|
288 */ |
|
289 TVerdict RTestVclntPlayAviDes::DoTestL(CVideoPlayerUtility* aPlayer) |
|
290 { |
|
291 TVerdict ret = EFail; |
|
292 |
|
293 if(iPlay) |
|
294 { |
|
295 iError = KErrTimedOut; |
|
296 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
297 PrepareState(EVPPlayComplete, KErrNone); |
|
298 aPlayer->Play(); |
|
299 } |
|
300 else |
|
301 { |
|
302 CActiveScheduler::Stop(); |
|
303 ret = EPass; |
|
304 } |
|
305 |
|
306 return ret; |
|
307 } |
|
308 |
|
309 |
|
310 // |
|
311 // RTestVclntPlayAviUrl |
|
312 // |
|
313 |
|
314 /** |
|
315 * RTestVclntPlayAviUrl::Constructor |
|
316 */ |
|
317 |
|
318 RTestVclntPlayAviUrl::RTestVclntPlayAviUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
319 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iPlay(aPlay) |
|
320 { |
|
321 } |
|
322 |
|
323 /** |
|
324 * RTestVclntPlayAviUrl::NewL |
|
325 */ |
|
326 |
|
327 RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
328 { |
|
329 RTestVclntPlayAviUrl* self = RTestVclntPlayAviUrl::NewLC(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
330 CleanupStack::Pop(); |
|
331 return self; |
|
332 } |
|
333 |
|
334 /** |
|
335 * RTestVclntPlayAviUrl::NewLC |
|
336 */ |
|
337 |
|
338 RTestVclntPlayAviUrl* RTestVclntPlayAviUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TBool aPlay) |
|
339 { |
|
340 RTestVclntPlayAviUrl* self = new (ELeave) RTestVclntPlayAviUrl(aTestName, aSectName, aKeyName, aExpectedError, aPlay); |
|
341 CleanupStack::PushL(self); |
|
342 return self; |
|
343 } |
|
344 |
|
345 /** |
|
346 * RTestVclntPlayAviUrl::Constructor |
|
347 */ |
|
348 |
|
349 TVerdict RTestVclntPlayAviUrl::DoTestStepL() |
|
350 { |
|
351 // Call the state handler from IDLE state |
|
352 FsmL(EVPIdle); |
|
353 |
|
354 // Start the scheduler - Done only once ! |
|
355 CActiveScheduler::Start(); |
|
356 |
|
357 return iTestStepResult; |
|
358 } |
|
359 |
|
360 /** |
|
361 * RTestVclntPlayAviUrl::FsmL |
|
362 */ |
|
363 |
|
364 void RTestVclntPlayAviUrl::FsmL(TVclntTestPlayEvents aEventCode) |
|
365 { |
|
366 if (FsmCheck(aEventCode)) |
|
367 { |
|
368 switch (aEventCode) |
|
369 { |
|
370 case EVPIdle: |
|
371 // Open iVideoPlayer |
|
372 |
|
373 INFO_PRINTF2(_L("iVideoPlayer->OpenUrlL() %S"), &iFilename); |
|
374 TRAP(iError,iVideoPlayer->OpenUrlL(iFilename, KUseDefaultIap, KNullDesC8, ControllerUid())); |
|
375 PrepareState(EVPOpenComplete, KErrNone); |
|
376 break; |
|
377 case EVPOpenComplete: |
|
378 // Prepare iVideoPlayer |
|
379 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
380 iVideoPlayer->Prepare(); |
|
381 PrepareState(EVPPrepareComplete, KErrNone); |
|
382 break; |
|
383 case EVPPrepareComplete: |
|
384 iTestStepResult = DoTestL(iVideoPlayer); |
|
385 break; |
|
386 case EVPPlayComplete: |
|
387 CActiveScheduler::Stop(); |
|
388 iTestStepResult = EPass; |
|
389 break; |
|
390 } |
|
391 } |
|
392 } |
|
393 |
|
394 /** |
|
395 * RTestVclntPlayAviUrl::Constructor |
|
396 */ |
|
397 |
|
398 TVerdict RTestVclntPlayAviUrl::DoTestL(CVideoPlayerUtility* aPlayer) |
|
399 { |
|
400 TVerdict ret = EFail; |
|
401 |
|
402 if(iPlay) |
|
403 { |
|
404 iError = KErrTimedOut; |
|
405 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
406 PrepareState(EVPPlayComplete, KErrNone); |
|
407 aPlayer->Play(); |
|
408 } |
|
409 else |
|
410 { |
|
411 CActiveScheduler::Stop(); |
|
412 ret = EPass; |
|
413 } |
|
414 |
|
415 return ret; |
|
416 } |
|
417 |
|
418 |
|
419 // |
|
420 // RTestVclntEnqFrameRate |
|
421 // |
|
422 |
|
423 /** |
|
424 * RTestVclntEnqFrameRate::Constructor |
|
425 */ |
|
426 RTestVclntEnqFrameRate::RTestVclntEnqFrameRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate) |
|
427 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
428 { |
|
429 iFrameRate = aFrameRate; |
|
430 } |
|
431 |
|
432 /** |
|
433 * RTestVclntEnqFrameRate::Constructor |
|
434 */ |
|
435 RTestVclntEnqFrameRate* RTestVclntEnqFrameRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aFrameRate) |
|
436 { |
|
437 RTestVclntEnqFrameRate* self = new (ELeave) RTestVclntEnqFrameRate(aTestName, aSectName, aKeyName, aExpectedError, aFrameRate); |
|
438 return self; |
|
439 } |
|
440 |
|
441 /** |
|
442 * RTestVclntEnqFrameRate::Constructor |
|
443 */ |
|
444 TVerdict RTestVclntEnqFrameRate::DoTestL(CVideoPlayerUtility* aPlayer) |
|
445 { |
|
446 INFO_PRINTF1(_L("Test : Video Player - Enquire Frame Rate")); |
|
447 |
|
448 TVerdict ret = EFail; |
|
449 |
|
450 TReal32 theFrameRate = 0.0; |
|
451 TRAPD(err, theFrameRate = aPlayer->VideoFrameRateL()); |
|
452 INFO_PRINTF3(_L("iVideoPlayer->VideoFrameRateL() = %d...error =%d"), TInt(theFrameRate), err); |
|
453 |
|
454 // if we get here, we pass. The iVideoPlayer does not have a SetVideoFrameRate() |
|
455 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
456 PrepareState(EVPPlayComplete, KErrNone); |
|
457 aPlayer->Play(); |
|
458 |
|
459 return ret; |
|
460 } |
|
461 |
|
462 |
|
463 // |
|
464 // RTestVclntPosition |
|
465 // |
|
466 |
|
467 /** |
|
468 * RTestVclntPosition::Constructor |
|
469 */ |
|
470 RTestVclntPosition::RTestVclntPosition(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition) |
|
471 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
472 { |
|
473 iPosition = aPosition; |
|
474 } |
|
475 |
|
476 /** |
|
477 * RTestVclntPosition::NewL |
|
478 */ |
|
479 RTestVclntPosition* RTestVclntPosition::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aPosition) |
|
480 { |
|
481 RTestVclntPosition* self = new (ELeave) RTestVclntPosition(aTestName, aSectName, aKeyName, aExpectedError, aPosition); |
|
482 return self; |
|
483 } |
|
484 |
|
485 /** |
|
486 * RTestVclntPosition::DoTestL |
|
487 */ |
|
488 TVerdict RTestVclntPosition::DoTestL(CVideoPlayerUtility* aPlayer) |
|
489 { |
|
490 // NB test video controller is stubbing certain functions. May have to rewrite this |
|
491 // for AVI Controller |
|
492 |
|
493 TVerdict ret = EFail; |
|
494 TInt err = KErrNone; |
|
495 TTimeIntervalMicroSeconds pos; |
|
496 |
|
497 INFO_PRINTF1(_L("Test : Video Player - Position")); |
|
498 INFO_PRINTF3(_L("Set Position = %d, Duration = %d"), I64INT(iPosition.Int64()), I64INT(aPlayer->DurationL().Int64())); |
|
499 |
|
500 // Set position: middle of clip. |
|
501 if (I64INT(iPosition.Int64()) == 0) |
|
502 { |
|
503 iPosition = I64INT(aPlayer->DurationL().Int64()) / 2; |
|
504 } |
|
505 |
|
506 // Set position: end of clip. |
|
507 if (I64INT(iPosition.Int64()) == -1) |
|
508 { |
|
509 iPosition = aPlayer->DurationL(); |
|
510 } |
|
511 |
|
512 // Position is beyond the end of the clips duration, so check that the value is clipped. |
|
513 if(aPlayer->DurationL() < iPosition) |
|
514 { |
|
515 INFO_PRINTF2(_L("Longer than duration : Setting position to %d"), I64INT(iPosition.Int64())); |
|
516 TRAP(err, aPlayer->SetPositionL(iPosition)); |
|
517 if (err == KErrNotSupported) |
|
518 { |
|
519 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported")); |
|
520 } |
|
521 TRAP(err, pos = aPlayer->PositionL()); |
|
522 if (err == KErrNotReady) |
|
523 { |
|
524 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady")); |
|
525 } |
|
526 INFO_PRINTF3(_L("Set Position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(aPlayer->DurationL().Int64())); |
|
527 } |
|
528 |
|
529 // Position is negative, so check that the value is clipped. |
|
530 else if (I64INT(iPosition.Int64()) < 0) |
|
531 { |
|
532 INFO_PRINTF2(_L("Negative value : Setting position to %d"), I64INT(iPosition.Int64())); |
|
533 TRAP(err, aPlayer->SetPositionL(iPosition)); |
|
534 if (err == KErrNotSupported) |
|
535 { |
|
536 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported")); |
|
537 } |
|
538 TRAP(err, pos = aPlayer->PositionL()); |
|
539 if (err == KErrNotReady) |
|
540 { |
|
541 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady")); |
|
542 } |
|
543 INFO_PRINTF2(_L("Set : position = %d (if clipped : 0)"), I64INT(pos.Int64())); |
|
544 } |
|
545 else |
|
546 { |
|
547 INFO_PRINTF2(_L("Normal : Setting position to %d"), I64INT(iPosition.Int64())); |
|
548 TRAP(err, aPlayer->SetPositionL(iPosition)); |
|
549 if (err == KErrNotSupported) |
|
550 { |
|
551 INFO_PRINTF1(_L("SetPositionL() left with Error - KErrNotSupported")); |
|
552 } |
|
553 TRAP(err, pos = aPlayer->PositionL()); |
|
554 if (err == KErrNotReady) |
|
555 { |
|
556 INFO_PRINTF1(_L("PositionL() left with Error - KErrNotReady")); |
|
557 } |
|
558 INFO_PRINTF3(_L("Set : position = %d (if clipped : %d)"), I64INT(pos.Int64()), I64INT(iPosition.Int64())); |
|
559 } |
|
560 |
|
561 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
562 PrepareState(EVPPlayComplete, KErrNone); |
|
563 aPlayer->Play(); |
|
564 |
|
565 |
|
566 TRAP(err, pos = aPlayer->PositionL()); |
|
567 if (err != KErrNone) |
|
568 { |
|
569 INFO_PRINTF2(_L("PositionL() left with Error - %d"), err); |
|
570 ret = EFail; |
|
571 } |
|
572 |
|
573 return ret; |
|
574 } |
|
575 |
|
576 |
|
577 // |
|
578 // RTestVclntPriority |
|
579 // |
|
580 |
|
581 /** |
|
582 * RTestVclntPriority::Constructor |
|
583 */ |
|
584 RTestVclntPriority::RTestVclntPriority(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority) |
|
585 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
586 { |
|
587 iPriority = aPriority; |
|
588 } |
|
589 |
|
590 /** |
|
591 * RTestVclntRecordAviFile::Constructor |
|
592 */ |
|
593 RTestVclntPriority* RTestVclntPriority::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aPriority) |
|
594 { |
|
595 RTestVclntPriority* self = new (ELeave) RTestVclntPriority(aTestName, aSectName, aKeyName, aExpectedError, aPriority); |
|
596 return self; |
|
597 } |
|
598 |
|
599 /** |
|
600 * RTestVclntRecordAviFile::Constructor |
|
601 */ |
|
602 TVerdict RTestVclntPriority::DoTestL(CVideoPlayerUtility* aPlayer) |
|
603 { |
|
604 TVerdict ret = EFail; |
|
605 |
|
606 INFO_PRINTF1(_L("Test : Video Player - Priority")); |
|
607 |
|
608 aPlayer->SetPriorityL(iPriority, EMdaPriorityPreferenceNone); |
|
609 TInt thePriority = 0; |
|
610 TMdaPriorityPreference thePref; |
|
611 aPlayer->PriorityL(thePriority, thePref); |
|
612 INFO_PRINTF3(_L("Priority = %d (expecting %d)"), thePriority, iPriority); |
|
613 INFO_PRINTF3(_L("Pref = %d (expecting %d)"), thePref, EMdaPriorityPreferenceNone); |
|
614 |
|
615 if( (thePriority == iPriority) && (thePref == EMdaPriorityPreferenceNone) ) |
|
616 { |
|
617 ret = EPass; |
|
618 } |
|
619 |
|
620 CActiveScheduler::Stop(); |
|
621 |
|
622 return ret; |
|
623 } |
|
624 |
|
625 |
|
626 // |
|
627 // RTestVclntDuration |
|
628 // |
|
629 |
|
630 /** |
|
631 * RTestVclntDuration::Constructor |
|
632 */ |
|
633 RTestVclntDuration::RTestVclntDuration(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration) |
|
634 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
635 { |
|
636 iDuration = aDuration; |
|
637 } |
|
638 |
|
639 /** |
|
640 * RTestVclntDuration::Constructor |
|
641 */ |
|
642 RTestVclntDuration* RTestVclntDuration::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aDuration) |
|
643 { |
|
644 RTestVclntDuration* self = new (ELeave) RTestVclntDuration(aTestName, aSectName, aKeyName, aExpectedError, aDuration); |
|
645 return self; |
|
646 } |
|
647 |
|
648 /** |
|
649 * RTestVclntDuration::Constructor |
|
650 */ |
|
651 TVerdict RTestVclntDuration::DoTestL(CVideoPlayerUtility* aPlayer) |
|
652 { |
|
653 TVerdict ret = EFail; |
|
654 |
|
655 INFO_PRINTF1(_L("Test : Video Player - Duration")); |
|
656 |
|
657 if (I64INT(iDuration.Int64()) == 0) |
|
658 { |
|
659 TInt duration = I64INT(aPlayer->DurationL().Int64()); |
|
660 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
661 PrepareState(EVPPlayComplete, KErrNone); |
|
662 aPlayer->Play(); |
|
663 TTime start; |
|
664 start.HomeTime(); |
|
665 CActiveScheduler::Start(); |
|
666 TTime stop; |
|
667 stop.HomeTime(); |
|
668 |
|
669 TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
670 |
|
671 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"), |
|
672 iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration); |
|
673 if((iError == KErrNone) && (TimeComparison(actualDuration, duration, KExpectedDeviation))) |
|
674 { |
|
675 ret = EPass; |
|
676 } |
|
677 } |
|
678 else |
|
679 { |
|
680 if(aPlayer->DurationL() == iDuration) |
|
681 { |
|
682 ret = EPass; |
|
683 } |
|
684 } |
|
685 |
|
686 CActiveScheduler::Stop(); |
|
687 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)iCurrentCacheSize.iMinSize,(TAny*)iCurrentCacheSize.iMaxSize); |
|
688 if(CheckCacheError(error)==EInconclusive) |
|
689 { |
|
690 return EInconclusive; |
|
691 } |
|
692 INFO_PRINTF3(_L("Setting Cache Min Size to %d,Setting Cache Max Size is %d"),iCurrentCacheSize.iMinSize,iCurrentCacheSize.iMaxSize); |
|
693 return ret; |
|
694 } |
|
695 |
|
696 TVerdict RTestVclntDuration::SetCacheSize() |
|
697 { |
|
698 TVerdict ret=EPass; |
|
699 //save the default cache sizes, set the cache size back these values after the test |
|
700 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalGetCacheSize,&iCurrentCacheSize,0); |
|
701 ret=CheckCacheError(error); |
|
702 if(ret==EPass) |
|
703 { |
|
704 error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize); |
|
705 ret=CheckCacheError(error); |
|
706 } |
|
707 return ret; |
|
708 } |
|
709 |
|
710 TVerdict RTestVclntDuration::CheckCacheError(TInt aError) |
|
711 { |
|
712 TVerdict verdict=EPass; |
|
713 #ifdef __WINSCW__ |
|
714 //Winscw does not support getting cache size. Ignoring -5 error |
|
715 if(aError!=KErrNone) |
|
716 { |
|
717 if(aError!=KErrNotSupported) |
|
718 { |
|
719 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
720 return EInconclusive; |
|
721 } |
|
722 } |
|
723 #else |
|
724 if(aError!=KErrNone) |
|
725 {//For ARMV5 we stop for all errors |
|
726 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
727 return EInconclusive; |
|
728 } |
|
729 #endif |
|
730 return verdict; |
|
731 } |
|
732 |
|
733 // |
|
734 // RTestVclntVolume |
|
735 // |
|
736 |
|
737 /** |
|
738 * RTestVclntVolume::Constructor |
|
739 */ |
|
740 RTestVclntVolume::RTestVclntVolume(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume) |
|
741 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
742 { |
|
743 iVolume = aVolume; |
|
744 } |
|
745 |
|
746 /** |
|
747 * RTestVclntVolume::Constructor |
|
748 */ |
|
749 RTestVclntVolume* RTestVclntVolume::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aVolume) |
|
750 { |
|
751 RTestVclntVolume* self = new (ELeave) RTestVclntVolume(aTestName, aSectName, aKeyName, aExpectedError, aVolume); |
|
752 return self; |
|
753 } |
|
754 |
|
755 /** |
|
756 * RTestVclntVolume::Constructor |
|
757 */ |
|
758 TVerdict RTestVclntVolume::DoTestL(CVideoPlayerUtility* aPlayer) |
|
759 { |
|
760 TVerdict ret = EFail; |
|
761 TInt err; |
|
762 |
|
763 INFO_PRINTF1(_L("Test : Video Player - Volume")); |
|
764 |
|
765 // see if audio is enabled |
|
766 if (aPlayer->AudioEnabledL()) |
|
767 { |
|
768 INFO_PRINTF1(_L("AudioEnabledL() returned True")); |
|
769 } |
|
770 else |
|
771 { |
|
772 INFO_PRINTF1(_L("AudioEnabledL() returned False")); |
|
773 } |
|
774 |
|
775 // Check maxvolume function |
|
776 if(iVolume == -1) |
|
777 { |
|
778 iVolume = aPlayer->MaxVolume(); |
|
779 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
780 INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err); |
|
781 INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), aPlayer->MaxVolume()); |
|
782 if(aPlayer->Volume() == aPlayer->MaxVolume()) |
|
783 { |
|
784 ret = EPass; |
|
785 } |
|
786 } |
|
787 // Volume should truncated to maxvolume |
|
788 else if(iVolume > aPlayer->MaxVolume()) |
|
789 { |
|
790 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
791 INFO_PRINTF2(_L("Volume should be set to Max Volume. Returned with %d"), err); |
|
792 INFO_PRINTF3(_L("Volume = %d, MaxVolume = %d"), aPlayer->Volume(), aPlayer->MaxVolume()); |
|
793 if(aPlayer->Volume() == aPlayer->MaxVolume()) |
|
794 { |
|
795 ret = EPass; |
|
796 } |
|
797 } |
|
798 // Volume is truncated to 0 |
|
799 else if(iVolume < 0) |
|
800 { |
|
801 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
802 INFO_PRINTF2(_L("Volume should be set to Min Volume.Returned with %d"), err); |
|
803 INFO_PRINTF2(_L("Volume = %d (expecting 0)"), aPlayer->Volume()); |
|
804 if(aPlayer->Volume() == 0) |
|
805 { |
|
806 ret = EPass; |
|
807 } |
|
808 } |
|
809 // Set volume and check |
|
810 else |
|
811 { |
|
812 TRAP(err, aPlayer->SetVolumeL(iVolume)); |
|
813 INFO_PRINTF2(_L("Volume should be set to the desired value. Retuned with %d"), err); |
|
814 INFO_PRINTF3(_L("Volume = %d (expecting %d)"), aPlayer->Volume(), iVolume); |
|
815 if(aPlayer->Volume() == iVolume) |
|
816 { |
|
817 ret = EPass; |
|
818 } |
|
819 } |
|
820 |
|
821 CActiveScheduler::Stop(); |
|
822 |
|
823 return ret; |
|
824 } |
|
825 |
|
826 // |
|
827 // RTestVclntCloseOpen |
|
828 // |
|
829 |
|
830 /** |
|
831 * RTestVclntCloseOpen::Constructor |
|
832 */ |
|
833 RTestVclntCloseOpen::RTestVclntCloseOpen(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
834 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
835 { |
|
836 iOpenCount = 1; |
|
837 } |
|
838 |
|
839 /** |
|
840 * RTestVclntCloseOpen::Constructor |
|
841 */ |
|
842 RTestVclntCloseOpen* RTestVclntCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
843 { |
|
844 RTestVclntCloseOpen* self = new (ELeave) RTestVclntCloseOpen(aTestName, aSectName, aKeyName, aExpectedError); |
|
845 return self; |
|
846 } |
|
847 |
|
848 /** |
|
849 * RTestVclntCloseOpen::DoTestStepL |
|
850 */ |
|
851 TVerdict RTestVclntCloseOpen::DoTestStepL() |
|
852 { |
|
853 // Call the state handler from IDLE state |
|
854 FsmL(EVPIdle); |
|
855 |
|
856 // Start the scheduler - Done only once ! |
|
857 CActiveScheduler::Start(); |
|
858 |
|
859 return iTestStepResult; |
|
860 } |
|
861 |
|
862 /** |
|
863 * RTestVclntCloseOpen::FsmL |
|
864 */ |
|
865 void RTestVclntCloseOpen::FsmL(TVclntTestPlayEvents aEventCode) |
|
866 { |
|
867 if (FsmCheck(aEventCode)) |
|
868 { |
|
869 switch (aEventCode) |
|
870 { |
|
871 case EVPIdle: |
|
872 // Open iVideoPlayer First time |
|
873 iOpenCount = 1; |
|
874 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
875 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
876 PrepareState(EVPOpenComplete, KErrNone); |
|
877 break; |
|
878 case EVPOpenComplete: |
|
879 if (iOpenCount == 1) |
|
880 { |
|
881 // Prepare iVideoPlayer |
|
882 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
883 iVideoPlayer->Prepare(); |
|
884 PrepareState(EVPPrepareComplete, KErrNone); |
|
885 } |
|
886 else |
|
887 { |
|
888 CActiveScheduler::Stop(); |
|
889 iTestStepResult = EPass; |
|
890 break; |
|
891 } |
|
892 break; |
|
893 case EVPPrepareComplete: |
|
894 // Close iVideoPlayer |
|
895 CActiveScheduler::Stop(); |
|
896 INFO_PRINTF1(_L("iVideoPlayer->Close()")); |
|
897 iVideoPlayer->Close(); |
|
898 User::After(KOneSecond); |
|
899 // Open iVideoPlayer Second time |
|
900 iOpenCount = 2; |
|
901 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
902 iVideoPlayer->OpenFileL(iFilename, ControllerUid()); |
|
903 PrepareState(EVPOpenComplete, KErrNone); |
|
904 CActiveScheduler::Start(); |
|
905 break; |
|
906 } |
|
907 } |
|
908 } |
|
909 |
|
910 // |
|
911 // RTestVclntPause |
|
912 // |
|
913 |
|
914 /** |
|
915 * RTestVclntPause::Constructor |
|
916 */ |
|
917 RTestVclntPause::RTestVclntPause(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
918 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
919 {} |
|
920 |
|
921 /** |
|
922 * RTestVclntPause::NewL |
|
923 */ |
|
924 RTestVclntPause* RTestVclntPause::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
925 { |
|
926 RTestVclntPause* self = new (ELeave) RTestVclntPause(aTestName, aSectName, aKeyName, aExpectedError); |
|
927 return self; |
|
928 } |
|
929 |
|
930 /** |
|
931 * RTestVclntPause::DoTestStepL |
|
932 */ |
|
933 TVerdict RTestVclntPause::DoTestStepL() |
|
934 { |
|
935 // Call the state handler from IDLE state |
|
936 FsmL(EVPIdle); |
|
937 |
|
938 // Start the scheduler - Done only once ! |
|
939 CActiveScheduler::Start(); |
|
940 |
|
941 return iTestStepResult; |
|
942 } |
|
943 |
|
944 /** |
|
945 * RTestVclntPause::FsmL |
|
946 */ |
|
947 void RTestVclntPause::FsmL(TVclntTestPlayEvents aEventCode) |
|
948 { |
|
949 TTime stop; |
|
950 TTime start = NULL; |
|
951 |
|
952 if (FsmCheck(aEventCode)) |
|
953 { |
|
954 switch (aEventCode) |
|
955 { |
|
956 case EVPIdle: |
|
957 // Open iVideoPlayer |
|
958 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
959 TRAP(iError, iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
960 PrepareState(EVPOpenComplete, KErrNone); |
|
961 break; |
|
962 case EVPOpenComplete: |
|
963 // Prepare iVideoPlayer |
|
964 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
965 iVideoPlayer->Prepare(); |
|
966 PrepareState(EVPPrepareComplete, KErrNone); |
|
967 break; |
|
968 case EVPPrepareComplete: |
|
969 // Play iVideoPlayer |
|
970 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
971 PrepareState(EVPPlayComplete, KErrNone); |
|
972 iVideoPlayer->Play(); |
|
973 // Pause iVideoPlayer |
|
974 INFO_PRINTF1(_L("iVideoPlayer->Pause()")); |
|
975 TRAPD(err,iVideoPlayer->PauseL()); |
|
976 if (err == KErrNotSupported) |
|
977 { |
|
978 INFO_PRINTF1(_L("Pause not supported presently")); |
|
979 } |
|
980 else |
|
981 { |
|
982 INFO_PRINTF2(_L("Pause() returns with error : %d"),err); |
|
983 iTestStepResult = EFail; |
|
984 CActiveScheduler::Stop(); |
|
985 break; |
|
986 } |
|
987 // Stop iVideoPlayer |
|
988 INFO_PRINTF1(_L("iVideoPlayer->Stop()")); |
|
989 iVideoPlayer->Stop(); |
|
990 // Get the duration of the file. |
|
991 iPlayerDuration = I64INT(iVideoPlayer->DurationL().Int64()); |
|
992 // Resume play iVideoPlayer |
|
993 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
994 iVideoPlayer->Play(); |
|
995 // Note the start time |
|
996 start.HomeTime(); |
|
997 break; |
|
998 case EVPPlayComplete: |
|
999 // Note the stop time |
|
1000 stop.HomeTime(); |
|
1001 // Get the actual duration |
|
1002 iActualDuration = I64INT(stop.MicroSecondsFrom(start).Int64()); |
|
1003 INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d PlayerDuration = %d ActualDuration = %d"), |
|
1004 iError, I64INT(start.Int64()), I64INT(stop.Int64()), iPlayerDuration, iActualDuration); |
|
1005 // Check the results |
|
1006 if((iError == KErrNone) && (TimeComparison(iActualDuration, iPlayerDuration, KExpectedDeviation))) |
|
1007 { |
|
1008 iTestStepResult = EPass; |
|
1009 } |
|
1010 CActiveScheduler::Stop(); |
|
1011 break; |
|
1012 } |
|
1013 } |
|
1014 } |
|
1015 |
|
1016 // |
|
1017 // RTestVclntBalance |
|
1018 // |
|
1019 |
|
1020 /** |
|
1021 * RTestVclntBalance::Constructor |
|
1022 */ |
|
1023 RTestVclntBalance::RTestVclntBalance(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance) |
|
1024 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1025 { |
|
1026 iBalance = aBalance; |
|
1027 } |
|
1028 |
|
1029 /** |
|
1030 * RTestVclntBalance::NewL |
|
1031 */ |
|
1032 RTestVclntBalance* RTestVclntBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TInt aBalance) |
|
1033 { |
|
1034 RTestVclntBalance* self = new (ELeave) RTestVclntBalance(aTestName, aSectName, aKeyName, aExpectedError, aBalance); |
|
1035 return self; |
|
1036 } |
|
1037 |
|
1038 /** |
|
1039 * RTestVclntBalance::DoTestL |
|
1040 */ |
|
1041 TVerdict RTestVclntBalance::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1042 { |
|
1043 TVerdict ret = EFail; |
|
1044 TInt err = KErrNone; |
|
1045 |
|
1046 INFO_PRINTF1(_L("Test : Video Player - Balance")); |
|
1047 |
|
1048 // see if audio is enabled |
|
1049 if (aPlayer->AudioEnabledL()) |
|
1050 { |
|
1051 INFO_PRINTF1(_L("AudioEnabledL() returned True")); |
|
1052 } |
|
1053 else |
|
1054 { |
|
1055 INFO_PRINTF1(_L("AudioEnabledL() returned False")); |
|
1056 } |
|
1057 |
|
1058 // set the balance |
|
1059 TRAP(err, aPlayer->SetBalanceL(iBalance)); |
|
1060 INFO_PRINTF2(_L("SetBalanceL() left with Error - %d"), err); |
|
1061 |
|
1062 // check for the valid balance |
|
1063 if (iBalance < KMinBalance) |
|
1064 { |
|
1065 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMinBalance); |
|
1066 if(aPlayer->Balance() == KMinBalance) |
|
1067 { |
|
1068 ret = EPass; |
|
1069 } |
|
1070 } |
|
1071 else if (iBalance > KMaxBalance) |
|
1072 { |
|
1073 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), KMaxBalance); |
|
1074 if(aPlayer->Balance() == KMaxBalance) |
|
1075 { |
|
1076 ret = EPass; |
|
1077 } |
|
1078 } |
|
1079 else |
|
1080 { |
|
1081 INFO_PRINTF3(_L("Balance = %d (expecting %d)"), aPlayer->Balance(), iBalance); |
|
1082 if(aPlayer->Balance() == iBalance) |
|
1083 { |
|
1084 ret = EPass; |
|
1085 } |
|
1086 } |
|
1087 |
|
1088 CActiveScheduler::Stop(); |
|
1089 |
|
1090 return ret; |
|
1091 } |
|
1092 |
|
1093 |
|
1094 // |
|
1095 // RTestVclntPlayWindow |
|
1096 // |
|
1097 |
|
1098 /** |
|
1099 * RTestVclntPlayWindow::Constructor |
|
1100 */ |
|
1101 RTestVclntPlayWindow::RTestVclntPlayWindow(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd) |
|
1102 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1103 { |
|
1104 iStart = aStart; |
|
1105 iEnd = aEnd; |
|
1106 } |
|
1107 |
|
1108 /** |
|
1109 * RTestVclntPlayWindow::Constructor |
|
1110 */ |
|
1111 RTestVclntPlayWindow* RTestVclntPlayWindow::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TTimeIntervalMicroSeconds aStart, const TTimeIntervalMicroSeconds aEnd) |
|
1112 { |
|
1113 RTestVclntPlayWindow* self = new (ELeave) RTestVclntPlayWindow(aTestName, aSectName, aKeyName, aExpectedError, aStart, aEnd); |
|
1114 return self; |
|
1115 } |
|
1116 |
|
1117 /** |
|
1118 * RTestVclntPlayWindow::Constructor |
|
1119 */ |
|
1120 TVerdict RTestVclntPlayWindow::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1121 { |
|
1122 TVerdict ret = EFail; |
|
1123 |
|
1124 INFO_PRINTF1(_L("Test : Video Player - Window")); |
|
1125 |
|
1126 TPoint rectOrigin(10, 10); |
|
1127 TSize rectSize(176, 144); |
|
1128 TRect rect(rectOrigin, rectSize); |
|
1129 |
|
1130 TPoint clipOrigin(10, 10); |
|
1131 TSize clipSize(176, 144); |
|
1132 TRect clipRect(clipOrigin, clipSize); |
|
1133 |
|
1134 // first call tests creation of display instance |
|
1135 TRAPD(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect)); |
|
1136 INFO_PRINTF1(_L("Test : Made first call to SetDisplayWindowL()")); |
|
1137 if(err) |
|
1138 { |
|
1139 ERR_PRINTF2(_L("First call to SetDisplayWindowL() failed, error %d"), err); |
|
1140 CActiveScheduler::Stop(); |
|
1141 return EFail; |
|
1142 } |
|
1143 |
|
1144 // second call tests update of display instance |
|
1145 TRAP(err, aPlayer->SetDisplayWindowL(iWs, *iScreen, *iWindow, rect, clipRect)); |
|
1146 INFO_PRINTF1(_L("Test : Made second call to SetDisplayWindowL()")); |
|
1147 if(err) |
|
1148 { |
|
1149 ERR_PRINTF2(_L("Second call to SetDisplayWindowL() failed, error %d"), err); |
|
1150 ret = EFail; |
|
1151 } |
|
1152 else |
|
1153 { |
|
1154 ret = EPass; |
|
1155 } |
|
1156 |
|
1157 CActiveScheduler::Stop(); |
|
1158 return ret; |
|
1159 } |
|
1160 |
|
1161 |
|
1162 // |
|
1163 // RTestVclntMeta |
|
1164 // |
|
1165 |
|
1166 /** |
|
1167 * RTestVclntMeta::Constructor |
|
1168 */ |
|
1169 RTestVclntMeta::RTestVclntMeta(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1170 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1171 {} |
|
1172 |
|
1173 /** |
|
1174 * RTestVclntMeta::Constructor |
|
1175 */ |
|
1176 RTestVclntMeta* RTestVclntMeta::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1177 { |
|
1178 RTestVclntMeta* self = new (ELeave) RTestVclntMeta(aTestName, aSectName, aKeyName, aExpectedError); |
|
1179 return self; |
|
1180 } |
|
1181 |
|
1182 /** |
|
1183 * RTestVclntMeta::Constructor |
|
1184 */ |
|
1185 TVerdict RTestVclntMeta::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1186 { |
|
1187 INFO_PRINTF1(_L("Test : Video Player - Metadata")); |
|
1188 |
|
1189 CActiveScheduler::Stop(); |
|
1190 |
|
1191 // there are zero meta entries now. |
|
1192 TInt numOfMeta = -1; |
|
1193 TRAPD(err, numOfMeta = aPlayer->NumberOfMetaDataEntriesL() ); |
|
1194 INFO_PRINTF3(_L("Error : %d Entries = %d"), err, numOfMeta); |
|
1195 if (err != KErrNotSupported || numOfMeta != -1) |
|
1196 { |
|
1197 return EFail; |
|
1198 } |
|
1199 |
|
1200 // attempt to get an entry when no entry exists. |
|
1201 CMMFMetaDataEntry* theEntry=NULL; |
|
1202 TRAP(err, theEntry = aPlayer->MetaDataEntryL(1)); |
|
1203 INFO_PRINTF2(_L("Error : %d"), err); |
|
1204 if (err != KErrNotSupported) |
|
1205 { |
|
1206 return EFail; |
|
1207 } |
|
1208 else |
|
1209 { |
|
1210 delete theEntry; |
|
1211 return EPass; |
|
1212 } |
|
1213 } |
|
1214 |
|
1215 |
|
1216 // |
|
1217 // RTestVclntFrameSize |
|
1218 // |
|
1219 |
|
1220 /** |
|
1221 * RTestVclntFrameSize::Constructor |
|
1222 */ |
|
1223 RTestVclntFrameSize::RTestVclntFrameSize(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1224 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse) |
|
1225 { |
|
1226 iFrameSize.iWidth = 0; |
|
1227 iFrameSize.iHeight = 0; |
|
1228 } |
|
1229 |
|
1230 /** |
|
1231 * RTestVclntFrameSize::NewL |
|
1232 */ |
|
1233 RTestVclntFrameSize* RTestVclntFrameSize::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1234 { |
|
1235 RTestVclntFrameSize* self = new (ELeave) RTestVclntFrameSize(aTestName, aSectName, aKeyName, aExpectedError); |
|
1236 return self; |
|
1237 } |
|
1238 |
|
1239 /** |
|
1240 * RTestVclntFrameSize::DoTestL |
|
1241 */ |
|
1242 TVerdict RTestVclntFrameSize::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1243 { |
|
1244 TVerdict ret = EFail; |
|
1245 |
|
1246 INFO_PRINTF1(_L("Test : Video Player - Get Frame Size")); |
|
1247 TInt err; |
|
1248 TRAP(err, aPlayer->VideoFrameSizeL(iFrameSize)); |
|
1249 |
|
1250 INFO_PRINTF4(_L("Error : %d, Frame size : (%d, %d)"), err, iFrameSize.iWidth, iFrameSize.iHeight); |
|
1251 if (err == KErrNone && iFrameSize.iWidth >= 0 && iFrameSize.iHeight >= 0 ) |
|
1252 { |
|
1253 ret = EPass; |
|
1254 } |
|
1255 |
|
1256 CActiveScheduler::Stop(); |
|
1257 |
|
1258 return ret; |
|
1259 } |
|
1260 |
|
1261 // |
|
1262 // RTestVclntMimeType |
|
1263 // |
|
1264 |
|
1265 /** |
|
1266 * RTestVclntMimeType::Constructor |
|
1267 */ |
|
1268 RTestVclntMimeType::RTestVclntMimeType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1269 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1270 { |
|
1271 } |
|
1272 |
|
1273 /** |
|
1274 * RTestVclntMimeType::Constructor |
|
1275 */ |
|
1276 RTestVclntMimeType* RTestVclntMimeType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1277 { |
|
1278 RTestVclntMimeType* self = new (ELeave) RTestVclntMimeType(aTestName, aSectName, aKeyName, aExpectedError); |
|
1279 return self; |
|
1280 } |
|
1281 |
|
1282 /** |
|
1283 * RTestVclntMimeType::Constructor |
|
1284 */ |
|
1285 TVerdict RTestVclntMimeType::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1286 { |
|
1287 |
|
1288 TVerdict ret = EFail; |
|
1289 |
|
1290 INFO_PRINTF1(_L("Test : Video Player - MimeType")); |
|
1291 |
|
1292 // Get the Video Mime type |
|
1293 TPtrC8 mimeType = aPlayer->VideoFormatMimeType(); |
|
1294 |
|
1295 // take it to a 16-bit string |
|
1296 TBuf<64> mimeType16; |
|
1297 mimeType16.Copy(mimeType); |
|
1298 INFO_PRINTF2(_L("Mime type : \'%S\'"), &mimeType16); |
|
1299 |
|
1300 // Check if its valid |
|
1301 if (mimeType16.Compare(_L("XVID")) == 0) |
|
1302 { |
|
1303 INFO_PRINTF1(_L("MIME Types match")); |
|
1304 ret = EPass; |
|
1305 } |
|
1306 |
|
1307 CActiveScheduler::Stop(); |
|
1308 |
|
1309 return ret; |
|
1310 } |
|
1311 |
|
1312 // |
|
1313 // RTestVclntScale |
|
1314 // |
|
1315 |
|
1316 /** |
|
1317 * RTestVclntScale::Constructor |
|
1318 */ |
|
1319 RTestVclntScale::RTestVclntScale(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1320 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1321 { |
|
1322 } |
|
1323 |
|
1324 /** |
|
1325 * RTestVclntScale::Constructor |
|
1326 */ |
|
1327 RTestVclntScale* RTestVclntScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1328 { |
|
1329 RTestVclntScale* self = new (ELeave) RTestVclntScale(aTestName, aSectName, aKeyName, aExpectedError); |
|
1330 return self; |
|
1331 } |
|
1332 |
|
1333 /** |
|
1334 * RTestVclntScale::Constructor |
|
1335 */ |
|
1336 TVerdict RTestVclntScale::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1337 { |
|
1338 INFO_PRINTF1(_L("Test : Video Player - Scale Values test")); |
|
1339 |
|
1340 CActiveScheduler::Stop(); |
|
1341 |
|
1342 // Set the scale factor using values set #1 |
|
1343 INFO_PRINTF1(_L("iVideoPlayer->SetScaleFactorL() #1")); |
|
1344 TRAPD(err, aPlayer->SetScaleFactorL(100, 100, ETrue)); |
|
1345 |
|
1346 #ifdef SYMBIAN_BUILD_GCE |
|
1347 TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone; |
|
1348 #else |
|
1349 TInt expected = KErrNotSupported; |
|
1350 #endif |
|
1351 |
|
1352 if (err != expected) |
|
1353 { |
|
1354 ERR_PRINTF2(_L("iVideoPlayer->SetScaleFactorL() encountered error : %d"), err); |
|
1355 return EFail; |
|
1356 } |
|
1357 |
|
1358 return EPass; |
|
1359 } |
|
1360 |
|
1361 // |
|
1362 // RTestVclntCrop |
|
1363 // |
|
1364 |
|
1365 /** |
|
1366 * RTestVclntCrop::Constructor |
|
1367 */ |
|
1368 RTestVclntCrop::RTestVclntCrop(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1369 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1370 { |
|
1371 } |
|
1372 |
|
1373 /** |
|
1374 * RTestVclntCrop::Constructor |
|
1375 */ |
|
1376 RTestVclntCrop* RTestVclntCrop::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1377 { |
|
1378 RTestVclntCrop* self = new (ELeave) RTestVclntCrop(aTestName, aSectName, aKeyName, aExpectedError); |
|
1379 return self; |
|
1380 } |
|
1381 |
|
1382 /** |
|
1383 * RTestVclntCrop::Constructor |
|
1384 */ |
|
1385 TVerdict RTestVclntCrop::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1386 { |
|
1387 TRect cropRegion(KCropRegionRectLeft, KCropRegionRectTop, KCropRegionRectRight, KCropRegionRectBottom); |
|
1388 TRect region; |
|
1389 |
|
1390 INFO_PRINTF1(_L("Test : Video Player - Crop Values")); |
|
1391 |
|
1392 CActiveScheduler::Stop(); |
|
1393 |
|
1394 // Set the Crop Region |
|
1395 INFO_PRINTF1(_L("iVideoPlayer->SetCropRegionL()")); |
|
1396 TRAPD(err, aPlayer->SetCropRegionL(cropRegion)); |
|
1397 |
|
1398 #ifdef SYMBIAN_BUILD_GCE |
|
1399 TInt expected = iBinaryCompatibility || !GCEAvailable() ? KErrNotSupported : KErrNone; |
|
1400 #else |
|
1401 TInt expected = KErrNotSupported; |
|
1402 #endif |
|
1403 |
|
1404 if (err != expected) |
|
1405 { |
|
1406 ERR_PRINTF2(_L("iVideoPlayer->SetCropRegionL() encountered error : %d"), err); |
|
1407 return EFail; |
|
1408 } |
|
1409 |
|
1410 return EPass; |
|
1411 } |
|
1412 |
|
1413 #ifdef SYMBIAN_BUILD_GCE |
|
1414 |
|
1415 RTestVclntAutoScale::RTestVclntAutoScale(const TDesC& aTestName) |
|
1416 : RTestVclntPlayAviFile(aTestName, KNullDesC, KNullDesC, KErrNone, EFalse) |
|
1417 { |
|
1418 } |
|
1419 |
|
1420 /** |
|
1421 * RTestVclntCrop::Constructor |
|
1422 */ |
|
1423 RTestVclntAutoScale* RTestVclntAutoScale::NewL(const TDesC& aTestName) |
|
1424 { |
|
1425 RTestVclntAutoScale* self = new (ELeave) RTestVclntAutoScale(aTestName); |
|
1426 return self; |
|
1427 } |
|
1428 |
|
1429 /** |
|
1430 * RTestVclntCrop::Constructor |
|
1431 */ |
|
1432 TVerdict RTestVclntAutoScale::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1433 { |
|
1434 INFO_PRINTF1(_L("Test : Video Player - AutoScale Values")); |
|
1435 |
|
1436 CActiveScheduler::Stop(); |
|
1437 |
|
1438 // Set auto scale |
|
1439 INFO_PRINTF1(_L("iVideoPlayer->SetAutoScaleL()")); |
|
1440 TRAPD(err, aPlayer->SetAutoScaleL(EAutoScaleBestFit)); |
|
1441 |
|
1442 if (err != KErrNone) |
|
1443 { |
|
1444 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1445 return EFail; |
|
1446 } |
|
1447 |
|
1448 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleNone)); |
|
1449 |
|
1450 if (err != KErrNone) |
|
1451 { |
|
1452 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1453 return EFail; |
|
1454 } |
|
1455 |
|
1456 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleClip)); |
|
1457 |
|
1458 if (err != KErrNone) |
|
1459 { |
|
1460 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1461 return EFail; |
|
1462 } |
|
1463 |
|
1464 TRAP(err, aPlayer->SetAutoScaleL(EAutoScaleStretch, EHorizontalAlignLeft, EVerticalAlignBottom)); |
|
1465 |
|
1466 if (err != KErrNone) |
|
1467 { |
|
1468 ERR_PRINTF2(_L("iVideoPlayer->SetAutoScaleL() encountered error : %d"), err); |
|
1469 return EFail; |
|
1470 } |
|
1471 |
|
1472 return EPass; |
|
1473 } |
|
1474 |
|
1475 #endif // SYMBIAN_BUILD_GCE |
|
1476 |
|
1477 // |
|
1478 // RTestVclntGetFrame |
|
1479 // |
|
1480 |
|
1481 /** |
|
1482 * RTestVclntGetFrame::Constructor |
|
1483 */ |
|
1484 RTestVclntGetFrame::RTestVclntGetFrame(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI) |
|
1485 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError, EFalse), iUseIntentAPI(aUseIntentAPI) |
|
1486 { |
|
1487 } |
|
1488 |
|
1489 /** |
|
1490 * RTestVclntGetFrame::Constructor |
|
1491 */ |
|
1492 RTestVclntGetFrame* RTestVclntGetFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, TBool aUseIntentAPI) |
|
1493 { |
|
1494 RTestVclntGetFrame* self = new (ELeave) RTestVclntGetFrame(aTestName, aSectName, aKeyName, aExpectedError, aUseIntentAPI); |
|
1495 return self; |
|
1496 } |
|
1497 |
|
1498 /** |
|
1499 * RTestVclntGetFrame::DoTestStepL |
|
1500 */ |
|
1501 TVerdict RTestVclntGetFrame::DoTestStepL() |
|
1502 { |
|
1503 // Call the state handler from IDLE state |
|
1504 FsmL(EVPIdle); |
|
1505 |
|
1506 // Start the scheduler - Done only once ! |
|
1507 CActiveScheduler::Start(); |
|
1508 |
|
1509 return iTestStepResult; |
|
1510 } |
|
1511 |
|
1512 /** |
|
1513 * RTestVclntGetFrame::FsmL |
|
1514 */ |
|
1515 void RTestVclntGetFrame::FsmL(TVclntTestPlayEvents aEventCode) |
|
1516 { |
|
1517 if (FsmCheck(aEventCode)) |
|
1518 { |
|
1519 switch (aEventCode) |
|
1520 { |
|
1521 case EVPIdle: |
|
1522 // Open iVideoPlayer |
|
1523 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
1524 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
1525 PrepareState(EVPOpenComplete, KErrNone); |
|
1526 break; |
|
1527 case EVPOpenComplete: |
|
1528 // Prepare iVideoPlayer |
|
1529 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
1530 iVideoPlayer->Prepare(); |
|
1531 PrepareState(EVPPrepareComplete, KErrNone); |
|
1532 break; |
|
1533 case EVPPrepareComplete: |
|
1534 // Play iVideoPlayer |
|
1535 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1536 iVideoPlayer->Play(); |
|
1537 // Call GetFrameL |
|
1538 if (iUseIntentAPI) |
|
1539 { |
|
1540 INFO_PRINTF1(_L("iVideoPlayer->GetFrameL() with EPeek Intent")); |
|
1541 TRAP(iError, iVideoPlayer->GetFrameL(EColor16M, ContentAccess::EPeek)); |
|
1542 INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError); |
|
1543 } |
|
1544 else |
|
1545 { |
|
1546 INFO_PRINTF1(_L("iVideoPlayer->GetFrameL()")); |
|
1547 TRAP(iError, iVideoPlayer->GetFrameL(EColor16M)); |
|
1548 INFO_PRINTF2(_L("iVideoPlayer->GetFrameL() left with error - %d"), iError); |
|
1549 } |
|
1550 PrepareState(EVPFrameReady, KErrNone); |
|
1551 case EVPFrameReady: |
|
1552 // Stop iVideoPlayer |
|
1553 iVideoPlayer->Stop(); |
|
1554 CActiveScheduler::Stop(); |
|
1555 iTestStepResult = EPass; |
|
1556 break; |
|
1557 } |
|
1558 } |
|
1559 } |
|
1560 |
|
1561 /** |
|
1562 * RTestVclntGetFrame::MvpuoFrameReady |
|
1563 * Overriding the callback method here, to check the bitmap.. |
|
1564 */ |
|
1565 void RTestVclntGetFrame::MvpuoFrameReady(CFbsBitmap& aFrame, TInt aError) |
|
1566 { |
|
1567 if (aError!=KErrNone) |
|
1568 { |
|
1569 iError = aError; |
|
1570 } |
|
1571 else if (aFrame.Handle() == NULL || aFrame.SizeInPixels() != TSize(KFrameWidth, KFrameHeight) ) |
|
1572 { |
|
1573 iError = KErrArgument; |
|
1574 ERR_PRINTF1(_L("The Frame returned is either NULL or there is a mismatch in the size..")); |
|
1575 } |
|
1576 TRAP(iError, FsmL(EVPFrameReady)); |
|
1577 INFO_PRINTF2(_L("Error code : %d"),iError); |
|
1578 } |
|
1579 |
|
1580 |
|
1581 // |
|
1582 // RTestVclntRebuffering |
|
1583 // |
|
1584 |
|
1585 /** |
|
1586 * RTestVclntRebuffering::Constructor |
|
1587 */ |
|
1588 RTestVclntRebuffering::RTestVclntRebuffering(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1589 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1590 { |
|
1591 } |
|
1592 |
|
1593 /** |
|
1594 * RTestVclntRebuffering::NewL |
|
1595 */ |
|
1596 RTestVclntRebuffering* RTestVclntRebuffering::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1597 { |
|
1598 RTestVclntRebuffering* self = new (ELeave) RTestVclntRebuffering(aTestName, aSectName, aKeyName, aExpectedError); |
|
1599 return self; |
|
1600 } |
|
1601 |
|
1602 /** |
|
1603 * RTestVclntRebuffering::DoTestL |
|
1604 */ |
|
1605 TVerdict RTestVclntRebuffering::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1606 { |
|
1607 INFO_PRINTF1(_L("Test : Video Player - Rebuffering")); |
|
1608 |
|
1609 aPlayer->RegisterForVideoLoadingNotification(*this); |
|
1610 |
|
1611 INFO_PRINTF1(_L("Rebuffering request completed")); |
|
1612 |
|
1613 CActiveScheduler::Stop(); |
|
1614 |
|
1615 return EPass; |
|
1616 } |
|
1617 |
|
1618 /** |
|
1619 * RTestVclntRebuffering::MvloLoadingStarted |
|
1620 */ |
|
1621 void RTestVclntRebuffering::MvloLoadingStarted() |
|
1622 { |
|
1623 INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingStarted")); |
|
1624 } |
|
1625 |
|
1626 /** |
|
1627 * RTestVclntRebuffering::MvloLoadingComplete |
|
1628 */ |
|
1629 void RTestVclntRebuffering::MvloLoadingComplete() |
|
1630 { |
|
1631 INFO_PRINTF1(_L("RTestVclntRebuffering::MvloLoadingComplete")); |
|
1632 } |
|
1633 |
|
1634 // |
|
1635 // RTestVclntRepeat |
|
1636 // |
|
1637 |
|
1638 /** |
|
1639 * RTestVclntRepeat::Constructor |
|
1640 */ |
|
1641 RTestVclntRepeat::RTestVclntRepeat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat) |
|
1642 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1643 { |
|
1644 iRepeat = aRepeat; |
|
1645 } |
|
1646 |
|
1647 /** |
|
1648 * RTestVclntRepeat::NewL |
|
1649 */ |
|
1650 RTestVclntRepeat* RTestVclntRepeat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError,const TInt aRepeat) |
|
1651 { |
|
1652 RTestVclntRepeat* self = new (ELeave) RTestVclntRepeat(aTestName, aSectName, aKeyName, aExpectedError, aRepeat); |
|
1653 return self; |
|
1654 } |
|
1655 |
|
1656 /** |
|
1657 * RTestVclntRepeat::DoTestL |
|
1658 */ |
|
1659 //The commented lines are kept for future implementation |
|
1660 |
|
1661 TVerdict RTestVclntRepeat::DoTestL(CVideoPlayerUtility* aPlayer) |
|
1662 { |
|
1663 TVerdict ret = EFail; |
|
1664 |
|
1665 INFO_PRINTF1(_L("Test : Video Player - Repeats")); |
|
1666 iRepeat = 1; |
|
1667 INFO_PRINTF1(_L("Warning : SetRepeats() does not exist in iVideoPlayer API. Repeat count set to 1")); |
|
1668 |
|
1669 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1670 PrepareState(EVPPlayComplete, KErrNone); |
|
1671 aPlayer->Play(); |
|
1672 |
|
1673 CActiveScheduler::Start(); |
|
1674 |
|
1675 if(iError == KErrNotSupported || iRepeat == 1) |
|
1676 { |
|
1677 ret = EPass; |
|
1678 INFO_PRINTF2(_L("Repeat not supported currently : err : %d"),iError); |
|
1679 } |
|
1680 else |
|
1681 { |
|
1682 ret = EFail; |
|
1683 INFO_PRINTF2(_L("Returned with : err : %d"),iError); |
|
1684 } |
|
1685 |
|
1686 CActiveScheduler::Stop(); |
|
1687 |
|
1688 return ret; |
|
1689 } |
|
1690 |
|
1691 // |
|
1692 // RTestVclntDelete |
|
1693 // |
|
1694 |
|
1695 /** |
|
1696 * RTestVclntDelete::Constructor |
|
1697 */ |
|
1698 RTestVclntDelete::RTestVclntDelete(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1699 : RTestVclntPlayAviFile(aTestName, aSectName, aKeyName, aExpectedError,EFalse) |
|
1700 {} |
|
1701 |
|
1702 /** |
|
1703 * RTestVclntDelete::NewL |
|
1704 */ |
|
1705 RTestVclntDelete* RTestVclntDelete::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
1706 { |
|
1707 RTestVclntDelete* self = new (ELeave) RTestVclntDelete(aTestName, aSectName, aKeyName, aExpectedError); |
|
1708 return self; |
|
1709 } |
|
1710 |
|
1711 /** |
|
1712 * RTestVclntDelete::DoTestStepL |
|
1713 */ |
|
1714 TVerdict RTestVclntDelete::DoTestStepL() |
|
1715 { |
|
1716 // Call the state handler from IDLE state |
|
1717 FsmL(EVPIdle); |
|
1718 |
|
1719 // Start the scheduler - Done only once ! |
|
1720 CActiveScheduler::Start(); |
|
1721 |
|
1722 return iTestStepResult; |
|
1723 } |
|
1724 |
|
1725 /** |
|
1726 * RTestVclntDelete::FsmL |
|
1727 */ |
|
1728 void RTestVclntDelete::FsmL(TVclntTestPlayEvents aEventCode) |
|
1729 { |
|
1730 if (FsmCheck(aEventCode)) |
|
1731 { |
|
1732 switch (aEventCode) |
|
1733 { |
|
1734 case EVPIdle: |
|
1735 // Open iVideoPlayer |
|
1736 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL(%S)"), &iFilename); |
|
1737 TRAP(iError,iVideoPlayer->OpenFileL(iFilename, ControllerUid())); |
|
1738 PrepareState(EVPOpenComplete, KErrNone); |
|
1739 break; |
|
1740 case EVPOpenComplete: |
|
1741 // Prepare iVideoPlayer |
|
1742 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
1743 iVideoPlayer->Prepare(); |
|
1744 PrepareState(EVPPrepareComplete, KErrNone); |
|
1745 break; |
|
1746 case EVPPrepareComplete: |
|
1747 // Play iVideoPlayer |
|
1748 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1749 iVideoPlayer->Play(); |
|
1750 PrepareState(EVPPlayComplete, KErrNone); |
|
1751 INFO_PRINTF1(_L("delete iVideoPlayer before Play completes")); |
|
1752 |
|
1753 iVideoPlayer = NULL; |
|
1754 delete iVideoPlayer; // destroy iVideoPlayer before play has completed |
|
1755 |
|
1756 CActiveScheduler::Stop(); |
|
1757 iTestStepResult = EPass; |
|
1758 break; |
|
1759 } |
|
1760 } |
|
1761 } |
|
1762 |
|
1763 // |
|
1764 // RTestVclntPlayAviFileHandle |
|
1765 // |
|
1766 |
|
1767 /** |
|
1768 * RTestVclntPlayAviFileHandle::Constructor |
|
1769 */ |
|
1770 RTestVclntPlayAviFileHandle::RTestVclntPlayAviFileHandle(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc) |
|
1771 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iAlloc(aAlloc) |
|
1772 { |
|
1773 iIsOpen = EFalse; |
|
1774 } |
|
1775 |
|
1776 /** |
|
1777 * RTestVclntPlayAviFileHandle::NewL |
|
1778 */ |
|
1779 RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc) |
|
1780 { |
|
1781 RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc); |
|
1782 return self; |
|
1783 } |
|
1784 |
|
1785 /** |
|
1786 * RTestVclntPlayAviFileHandle::NewLC |
|
1787 */ |
|
1788 RTestVclntPlayAviFileHandle* RTestVclntPlayAviFileHandle::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError, const TBool aAlloc) |
|
1789 { |
|
1790 RTestVclntPlayAviFileHandle* self = new (ELeave) RTestVclntPlayAviFileHandle(aTestName, aSectName, aKeyName, aExpectedError, aAlloc); |
|
1791 CleanupStack::PushL(self); |
|
1792 return self; |
|
1793 } |
|
1794 |
|
1795 /** |
|
1796 * RTestVclntPlayAviFileHandle::DoTestStepL() |
|
1797 */ |
|
1798 TVerdict RTestVclntPlayAviFileHandle::DoTestStepL() |
|
1799 { |
|
1800 if(SetCacheSize()!=KErrNone) |
|
1801 { |
|
1802 return EInconclusive; |
|
1803 } |
|
1804 |
|
1805 if (iAlloc) |
|
1806 { |
|
1807 TVerdict iAllocTestStepResult=EPass; |
|
1808 TInt err = KErrNone; |
|
1809 TBool result = EFalse; |
|
1810 |
|
1811 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<< |
|
1812 if( PerformTestStepL() != EPass ) |
|
1813 { |
|
1814 err = iError; |
|
1815 } |
|
1816 |
|
1817 if (err != KErrNone) |
|
1818 { |
|
1819 INFO_PRINTF2(_L("Test error, returned error code = %d"), err); |
|
1820 User::Leave(err); |
|
1821 } |
|
1822 else |
|
1823 { |
|
1824 //Check the iAllocTestStepResult |
|
1825 if (iAllocTestStepResult != EPass) |
|
1826 { |
|
1827 result = ETrue; |
|
1828 } |
|
1829 } |
|
1830 |
|
1831 TInt failCount = 1; |
|
1832 TBool completed = EFalse; |
|
1833 iAllocTestStepResult = EPass; // XXX check?? assume pass |
|
1834 TBool reachedEnd = EFalse; // Note: declare outside loop to help with debugging |
|
1835 for(;;) |
|
1836 { |
|
1837 __UHEAP_SETFAIL(RHeap::EFailNext, failCount); |
|
1838 __MM_HEAP_MARK; |
|
1839 |
|
1840 //INFO_PRINTF2(_L("CVideoPlayerUtility: Alloc Test Loop: %d"), failCount); |
|
1841 //>>>>>>>>>>>>>>>>>>>>>>>>Test Method Call<<<<<<<<<<<<<<<<<<<<<<<<<< |
|
1842 TVerdict verdict = EFail; |
|
1843 TRAP(err, verdict = PerformTestStepL()); |
|
1844 if (err == KErrNone && verdict != EPass) |
|
1845 { |
|
1846 err = iError; |
|
1847 } |
|
1848 |
|
1849 completed = EFalse; |
|
1850 if (err == KErrNone) |
|
1851 { |
|
1852 TAny *testAlloc = User::Alloc(1); // when this fails, we passed through all allocs within test |
|
1853 if (testAlloc == NULL) |
|
1854 { |
|
1855 reachedEnd = ETrue; |
|
1856 failCount -= 1; |
|
1857 } |
|
1858 else |
|
1859 { |
|
1860 User::Free(testAlloc); |
|
1861 } |
|
1862 |
|
1863 //Check the iAllocTestStepResult |
|
1864 if (iAllocTestStepResult != EPass) |
|
1865 { |
|
1866 result = ETrue; |
|
1867 } |
|
1868 |
|
1869 completed = reachedEnd || result; |
|
1870 } |
|
1871 else if (err != KErrNoMemory) // bad error code |
|
1872 { |
|
1873 completed = ETrue; |
|
1874 result = EFail; |
|
1875 } |
|
1876 |
|
1877 __MM_HEAP_MARKEND; |
|
1878 __UHEAP_SETFAIL(RHeap::ENone, 0); |
|
1879 |
|
1880 if (completed) |
|
1881 { |
|
1882 break; // exit loop |
|
1883 } |
|
1884 |
|
1885 failCount++; |
|
1886 } |
|
1887 |
|
1888 failCount -= 1; // Failcount of 1 equates to 0 successful allocs, etc |
|
1889 |
|
1890 if (err != KErrNone || result) |
|
1891 { |
|
1892 iAllocTestStepResult = EFail; |
|
1893 TBuf<80> format; |
|
1894 if (result) |
|
1895 { |
|
1896 format.Format(_L(" Bad result with %d memory allocations tested\n"), failCount); |
|
1897 } |
|
1898 else |
|
1899 { |
|
1900 format.Format(_L(" Error(%d) with %d memory allocations tested\n"), err, failCount); |
|
1901 } |
|
1902 Log(format); |
|
1903 } |
|
1904 else |
|
1905 { |
|
1906 TBuf<80> format; |
|
1907 format.Format(_L(" Completed OK with %d memory allocations tested\n"), failCount); |
|
1908 Log(format); |
|
1909 } |
|
1910 TUint defaultCacheSize = 0; |
|
1911 //Done with the test. Setting 0 makes the cache size revert back to boot up values |
|
1912 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)defaultCacheSize,(TAny*)defaultCacheSize); |
|
1913 if(CheckCacheError(error)!=KErrNone) |
|
1914 { |
|
1915 INFO_PRINTF1(_L("Could not revert the cache size to default")); |
|
1916 iAllocTestStepResult=EInconclusive; |
|
1917 } |
|
1918 return iAllocTestStepResult; |
|
1919 } |
|
1920 else |
|
1921 { |
|
1922 return( PerformTestStepL() ); |
|
1923 } |
|
1924 } |
|
1925 |
|
1926 /** |
|
1927 * RTestVclntPlayAviFileHandle::PerformTestStepL() |
|
1928 */ |
|
1929 TVerdict RTestVclntPlayAviFileHandle::PerformTestStepL() |
|
1930 { |
|
1931 INFO_PRINTF1(_L("Test : Video Player - OpenFileL(RFile&)")); |
|
1932 |
|
1933 // Connect to RFs |
|
1934 User::LeaveIfError(iFs.Connect()); |
|
1935 User::LeaveIfError(iFs.ShareProtected()); |
|
1936 CleanupClosePushL(iFs); |
|
1937 |
|
1938 // Open RFile |
|
1939 User::LeaveIfError(iFile.Open(iFs, iFilename, EFileRead)); |
|
1940 CleanupClosePushL(iFile); |
|
1941 |
|
1942 // Call the state handler from IDLE state |
|
1943 iError = KErrNone; |
|
1944 PrepareState(EVPIdle, KErrNone); |
|
1945 FsmL(EVPIdle); |
|
1946 |
|
1947 // Start the scheduler - Done only once ! |
|
1948 CActiveScheduler::Start(); |
|
1949 |
|
1950 CleanupStack::PopAndDestroy(2); |
|
1951 |
|
1952 // Leave if the Expected error is KErrNone |
|
1953 if (iTestExpectedError == KErrNone) |
|
1954 { |
|
1955 User::LeaveIfError(iError); |
|
1956 } |
|
1957 |
|
1958 return iTestStepResult; |
|
1959 } |
|
1960 |
|
1961 |
|
1962 /** |
|
1963 * RTestVclntPlayAviFileHandle::FsmL() |
|
1964 */ |
|
1965 void RTestVclntPlayAviFileHandle::FsmL(TVclntTestPlayEvents aEventCode) |
|
1966 { |
|
1967 if (FsmCheck(aEventCode)) |
|
1968 { |
|
1969 switch (aEventCode) |
|
1970 { |
|
1971 case EVPIdle: |
|
1972 // Open iVideoPlayer |
|
1973 if ((iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-1013-HP")) == 0) || |
|
1974 (iTestStepName.Compare(_L("MM-MMF-VCLNTAVI-I-9113-HP")) == 0)) |
|
1975 { |
|
1976 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S with Invalid Controller UID"), &iFilename); |
|
1977 TRAP(iError, iVideoPlayer->OpenFileL(iFile, KVideoInvalidControllerUid)); |
|
1978 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() returned error - %d"), iError); |
|
1979 PrepareState(EVPOpenComplete, KErrNone); |
|
1980 } |
|
1981 else |
|
1982 { |
|
1983 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
1984 iVideoPlayer->OpenFileL(iFile, ControllerUid()); |
|
1985 PrepareState(EVPOpenComplete, KErrNone); |
|
1986 } |
|
1987 break; |
|
1988 case EVPOpenComplete: |
|
1989 iIsOpen = ETrue; //-set iIsOpen flag (for closing Player, in case of Underflow)... |
|
1990 // Prepare iVideoPlayer |
|
1991 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
1992 PrepareState(EVPPrepareComplete, KErrNone); |
|
1993 iVideoPlayer->Prepare(); |
|
1994 break; |
|
1995 case EVPPrepareComplete: |
|
1996 // Play iVideoPlayer |
|
1997 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
1998 iVideoPlayer->Play(); |
|
1999 PrepareState(EVPPlayComplete, KErrNone); |
|
2000 break; |
|
2001 case EVPPlayComplete: |
|
2002 iVideoPlayer->Stop(); |
|
2003 iVideoPlayer->Close(); |
|
2004 CActiveScheduler::Stop(); |
|
2005 iTestStepResult = EPass; |
|
2006 break; |
|
2007 } |
|
2008 } |
|
2009 else if(iIsOpen) |
|
2010 { |
|
2011 iVideoPlayer->Close(); |
|
2012 } |
|
2013 } |
|
2014 |
|
2015 TInt RTestVclntPlayAviFileHandle::SetCacheSize() |
|
2016 { |
|
2017 TInt error=UserSvr::HalFunction(EHalGroupVM,EVMHalSetCacheSize,(TAny*)KCacheSize,(TAny*)KMaxCacheSize); |
|
2018 TInt ret=CheckCacheError(error); |
|
2019 |
|
2020 return ret; |
|
2021 } |
|
2022 |
|
2023 TInt RTestVclntPlayAviFileHandle::CheckCacheError(TInt aError) |
|
2024 { |
|
2025 TInt ret=KErrNone; |
|
2026 #ifdef __WINSCW__ |
|
2027 //Winscw does not support getting cache size. Ignoring -5 error |
|
2028 if(aError!=KErrNone) |
|
2029 { |
|
2030 if(aError!=KErrNotSupported) |
|
2031 { |
|
2032 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
2033 ret=aError; |
|
2034 } |
|
2035 } |
|
2036 #else |
|
2037 if(aError!=KErrNone) |
|
2038 {//For ARMV5 we stop for all errors |
|
2039 INFO_PRINTF2(_L("Could not get the cache size %d"),aError); |
|
2040 ret=aError; |
|
2041 } |
|
2042 #endif |
|
2043 return ret; |
|
2044 } |
|
2045 |
|
2046 |
|
2047 // |
|
2048 // RTestVideoPlayCapabilityVelocity |
|
2049 // |
|
2050 |
|
2051 /** |
|
2052 RTestVideoPlayCapabilityVelocity::Constructor |
|
2053 */ |
|
2054 RTestVideoPlayCapabilityVelocity::RTestVideoPlayCapabilityVelocity(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2055 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError) |
|
2056 { ; |
|
2057 } |
|
2058 |
|
2059 /** |
|
2060 RTestVideoPlayCapabilityVelocity::NewL |
|
2061 */ |
|
2062 RTestVideoPlayCapabilityVelocity* RTestVideoPlayCapabilityVelocity::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2063 { |
|
2064 RTestVideoPlayCapabilityVelocity* self = new (ELeave) RTestVideoPlayCapabilityVelocity(aTestName, aSectName, aKeyName, aExpectedError); |
|
2065 return self; |
|
2066 } |
|
2067 |
|
2068 /** |
|
2069 RTestVideoPlayCapabilityVelocity::DoTestStepL() |
|
2070 */ |
|
2071 TVerdict RTestVideoPlayCapabilityVelocity::DoTestStepL() |
|
2072 { |
|
2073 // Call the state handler from IDLE state |
|
2074 TRAPD(err, FsmL(EVPIdle)); |
|
2075 if (err == KErrNone) |
|
2076 { |
|
2077 // Start the scheduler - Done only once ! |
|
2078 CActiveScheduler::Start(); |
|
2079 } |
|
2080 return iTestStepResult; |
|
2081 } |
|
2082 /** |
|
2083 RTestVideoPlayCapabilityVelocity::FsmL() |
|
2084 */ |
|
2085 void RTestVideoPlayCapabilityVelocity::FsmL(TVclntTestPlayEvents aEventCode) |
|
2086 { |
|
2087 const TUint KVelocityDefault = 100; |
|
2088 const TUint KVelocityMinPositive = 1; |
|
2089 const TInt KVelocityMinNegative = -1; |
|
2090 const TUint KVelocityPositive = 200; |
|
2091 const TUint KVelocityBigPositive = 500; |
|
2092 const TInt KVelocityNegative = -200; |
|
2093 const TInt KVelocityBigNegative= -500; |
|
2094 //Set default value for PlayRateCapability |
|
2095 iVideoPlayRateCapabilities.iStepForward = 1; |
|
2096 iVideoPlayRateCapabilities.iPlayBackward = 0; |
|
2097 if (FsmCheck(aEventCode)) |
|
2098 { |
|
2099 TInt err; |
|
2100 switch (aEventCode) |
|
2101 { |
|
2102 case EVPIdle: |
|
2103 //Calling GetPlayRateCapabilitiesL() before opening should return KErrNotReady. |
|
2104 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()")); |
|
2105 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities)); |
|
2106 if( err != KErrNotReady) |
|
2107 { |
|
2108 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned wrong err= %d"), err); |
|
2109 iTestStepResult = EFail; |
|
2110 CActiveScheduler::Stop(); |
|
2111 return; |
|
2112 } |
|
2113 iPlayVelocity = KVelocityDefault; |
|
2114 //Calling SetPlayVelocityL() before opening should return KErrNotReady. |
|
2115 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity); |
|
2116 TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity)); |
|
2117 if(KErrNotReady != err) |
|
2118 { |
|
2119 INFO_PRINTF2(_L("SetPlayVelocityL returned wrong err= %d"), err); |
|
2120 iTestStepResult = EFail; |
|
2121 CActiveScheduler::Stop(); |
|
2122 return; |
|
2123 } |
|
2124 |
|
2125 //calling PlayVelocityL before opening should result in error KErrNotReady |
|
2126 INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()")); |
|
2127 TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL()); |
|
2128 if( err != KErrNotReady) |
|
2129 { |
|
2130 INFO_PRINTF2(_L("PlayVelocityL returned wrong err= %d"), err); |
|
2131 iTestStepResult = EFail; |
|
2132 CActiveScheduler::Stop(); |
|
2133 return; |
|
2134 } |
|
2135 |
|
2136 // Open iVideoPlayer |
|
2137 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2138 iVideoPlayer->OpenFileL(iFilename); |
|
2139 PrepareState(EVPOpenComplete, KErrNone); |
|
2140 break; |
|
2141 case EVPOpenComplete: |
|
2142 //Get playrate capabilities |
|
2143 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()")); |
|
2144 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities)); |
|
2145 if( err != KErrNone) |
|
2146 { |
|
2147 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err); |
|
2148 INFO_PRINTF1(_L("invalid TPlayRateCapabilities")); |
|
2149 iTestStepResult = EFail; |
|
2150 CActiveScheduler::Stop(); |
|
2151 return; |
|
2152 } |
|
2153 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayForward= %d"), iVideoPlayRateCapabilities.iPlayForward); |
|
2154 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iPlayBackward= %d"), iVideoPlayRateCapabilities.iPlayBackward); |
|
2155 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepForward= %d"), iVideoPlayRateCapabilities.iStepForward); |
|
2156 INFO_PRINTF2(_L("iVideoPlayRateCapabilities.iStepBackward= %d"), iVideoPlayRateCapabilities.iStepBackward); |
|
2157 if ((iVideoPlayRateCapabilities.iPlayForward != 0) && (iVideoPlayRateCapabilities.iPlayForward != 1)|| |
|
2158 (iVideoPlayRateCapabilities.iPlayBackward != 0) && (iVideoPlayRateCapabilities.iPlayBackward != 1)|| |
|
2159 (iVideoPlayRateCapabilities.iStepForward != 0) && (iVideoPlayRateCapabilities.iStepForward != 1)|| |
|
2160 (iVideoPlayRateCapabilities.iStepBackward != 0) && (iVideoPlayRateCapabilities.iStepBackward != 1) ) |
|
2161 { |
|
2162 INFO_PRINTF1(_L("invalid TPlayRateCapabilities")); |
|
2163 iTestStepResult = EFail; |
|
2164 CActiveScheduler::Stop(); |
|
2165 return; |
|
2166 } |
|
2167 |
|
2168 //Get default play velocity, it shall be 100. |
|
2169 INFO_PRINTF1(_L("iVideoPlayer->PlayVelocityL()")); |
|
2170 TRAP(err, iPlayVelocity = iVideoPlayer->PlayVelocityL()); |
|
2171 if( err != KErrNone) |
|
2172 { |
|
2173 INFO_PRINTF2(_L("PlayVelocityL returned err= %d"), err); |
|
2174 INFO_PRINTF1(_L("invalid TPlayRateCapabilities")); |
|
2175 iTestStepResult = EFail; |
|
2176 CActiveScheduler::Stop(); |
|
2177 return; |
|
2178 } |
|
2179 |
|
2180 if( iPlayVelocity != KVelocityDefault ) |
|
2181 { |
|
2182 INFO_PRINTF2(_L("invalid default play velocity =%d"), iPlayVelocity); |
|
2183 iTestStepResult = EFail; |
|
2184 CActiveScheduler::Stop(); |
|
2185 return; |
|
2186 } |
|
2187 |
|
2188 // Prepare iVideoPlayer |
|
2189 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2190 PrepareState(EVPPrepareComplete, KErrNone); |
|
2191 iVideoPlayer->Prepare(); |
|
2192 break; |
|
2193 case EVPPrepareComplete: |
|
2194 //Try to set different play velocities and play. |
|
2195 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity); |
|
2196 TRAP(err, iVideoPlayer->SetPlayVelocityL(iPlayVelocity)); |
|
2197 if(KErrNotSupported == err) |
|
2198 { |
|
2199 if(iVideoPlayRateCapabilities.iPlayForward || iVideoPlayRateCapabilities.iPlayBackward) |
|
2200 { |
|
2201 INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err); |
|
2202 iTestStepResult = EFail; |
|
2203 CActiveScheduler::Stop(); |
|
2204 return; |
|
2205 } |
|
2206 INFO_PRINTF1(_L("SetPlayVelocityL returned err KErrNotSupported")); |
|
2207 } |
|
2208 else if( err != KErrNone) |
|
2209 { |
|
2210 INFO_PRINTF2(_L("SetPlayVelocityL returned err= %d"), err); |
|
2211 iTestStepResult = EFail; |
|
2212 CActiveScheduler::Stop(); |
|
2213 return; |
|
2214 } |
|
2215 // Play iVideoPlayer |
|
2216 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2217 iVideoPlayer->Play(); |
|
2218 PrepareState(EVPPlayComplete, KErrNone); |
|
2219 break; |
|
2220 case EVPPlayComplete: |
|
2221 //Try to set different play velocities and play. |
|
2222 if (iVideoPlayRateCapabilities.iPlayForward ) |
|
2223 { |
|
2224 if (iPlayVelocity == KVelocityDefault) |
|
2225 { |
|
2226 iPlayVelocity = KVelocityMinPositive; |
|
2227 } |
|
2228 else if(iPlayVelocity == KVelocityMinPositive) |
|
2229 { |
|
2230 iPlayVelocity = KVelocityPositive; |
|
2231 } |
|
2232 else if(iPlayVelocity == KVelocityPositive) |
|
2233 { |
|
2234 iPlayVelocity = KVelocityBigPositive; |
|
2235 } |
|
2236 } |
|
2237 if (iVideoPlayRateCapabilities.iPlayBackward ) |
|
2238 { |
|
2239 if (iPlayVelocity == KVelocityBigPositive) |
|
2240 { |
|
2241 iPlayVelocity = KVelocityMinNegative; |
|
2242 } |
|
2243 else if(iPlayVelocity == KVelocityMinNegative) |
|
2244 { |
|
2245 iPlayVelocity = KVelocityNegative; |
|
2246 } |
|
2247 else if(iPlayVelocity == KVelocityNegative) |
|
2248 { |
|
2249 iPlayVelocity = KVelocityBigNegative; |
|
2250 } |
|
2251 else if(iPlayVelocity == KVelocityBigNegative) |
|
2252 { |
|
2253 iVideoPlayer->Close(); |
|
2254 CActiveScheduler::Stop(); |
|
2255 iTestStepResult = EPass; |
|
2256 return; |
|
2257 } |
|
2258 } |
|
2259 |
|
2260 //Set next velocity |
|
2261 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL(%d)"),iPlayVelocity); |
|
2262 TRAP(err,iVideoPlayer->SetPlayVelocityL(iPlayVelocity)); |
|
2263 if ( err == KErrNotSupported ) |
|
2264 { |
|
2265 INFO_PRINTF1(_L("iVideoPlayer->SetPlayVelocityL returned KErrNotSupported")); |
|
2266 if( (iPlayVelocity >0) && iVideoPlayRateCapabilities.iPlayForward) |
|
2267 { |
|
2268 INFO_PRINTF1(_L("PlayVelocity and capabilities are valid, still returned KErrNotSupported!!")); |
|
2269 User::Leave(err); |
|
2270 } |
|
2271 else if( (iPlayVelocity <0) && iVideoPlayRateCapabilities.iPlayBackward) |
|
2272 { |
|
2273 INFO_PRINTF1(_L("PlayVelocity and capabilities are valid still returned KErrNotSupported!!")); |
|
2274 User::Leave(err); |
|
2275 } |
|
2276 else |
|
2277 { |
|
2278 // Play The file once again to test with different play velocity. |
|
2279 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2280 iVideoPlayer->Play(); |
|
2281 PrepareState(EVPPlayComplete, KErrNone); |
|
2282 } |
|
2283 } |
|
2284 else if (err != KErrNone) |
|
2285 { |
|
2286 INFO_PRINTF2(_L("iVideoPlayer->SetPlayVelocityL returned (%d)"),err); |
|
2287 User::Leave(err); |
|
2288 } |
|
2289 else //Success case |
|
2290 { |
|
2291 // Play The file once again to test with different play velocity. |
|
2292 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2293 iVideoPlayer->Play(); |
|
2294 PrepareState(EVPPlayComplete, KErrNone); |
|
2295 } |
|
2296 |
|
2297 if ((!iVideoPlayRateCapabilities.iPlayForward ) && (!iVideoPlayRateCapabilities.iPlayBackward )) |
|
2298 { |
|
2299 INFO_PRINTF1(_L("Both forward and backward is not supported")); |
|
2300 INFO_PRINTF1(_L("Pass the test, error checking for API SetPlayVelocity is already done.")); |
|
2301 iVideoPlayer->Close(); |
|
2302 CActiveScheduler::Stop(); |
|
2303 iTestStepResult = EPass; |
|
2304 return; |
|
2305 } |
|
2306 break; |
|
2307 } |
|
2308 } |
|
2309 } |
|
2310 |
|
2311 |
|
2312 // |
|
2313 // RTestVideoPlayStepFrame |
|
2314 // |
|
2315 |
|
2316 /** |
|
2317 RTestVideoPlayStepFrame::Constructor |
|
2318 */ |
|
2319 RTestVideoPlayStepFrame::RTestVideoPlayStepFrame(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2320 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError), iTimer(NULL) |
|
2321 { |
|
2322 } |
|
2323 |
|
2324 /** |
|
2325 RTestVideoPlayStepFrame::NewL |
|
2326 */ |
|
2327 RTestVideoPlayStepFrame* RTestVideoPlayStepFrame::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2328 { |
|
2329 RTestVideoPlayStepFrame* self = new (ELeave) RTestVideoPlayStepFrame(aTestName, aSectName, aKeyName, aExpectedError); |
|
2330 return self; |
|
2331 } |
|
2332 |
|
2333 /** |
|
2334 RTestVideoPlayStepFrame::DoTestStepL() |
|
2335 */ |
|
2336 TVerdict RTestVideoPlayStepFrame::DoTestStepL() |
|
2337 { |
|
2338 iTimer = CPeriodic::NewL(CActive::EPriorityHigh); |
|
2339 // Call the state handler from IDLE state |
|
2340 TRAPD(err, FsmL(EVPIdle)); |
|
2341 if (err == KErrNone) |
|
2342 { |
|
2343 // Start the scheduler - Done only once ! |
|
2344 CActiveScheduler::Start(); |
|
2345 } |
|
2346 delete iTimer; |
|
2347 return iTestStepResult; |
|
2348 } |
|
2349 |
|
2350 /** |
|
2351 RTestVideoPlayStepFrame::FsmL() |
|
2352 */ |
|
2353 void RTestVideoPlayStepFrame::FsmL(TVclntTestPlayEvents aEventCode) |
|
2354 { |
|
2355 if (FsmCheck(aEventCode)) |
|
2356 { |
|
2357 TInt err = KErrNone; |
|
2358 TInt frame = 0xff; |
|
2359 TBool pauseSupported = ETrue; |
|
2360 const TUint KStepForwardZeroFrame = 0; |
|
2361 const TUint KStepForwardOneFrame = 1; |
|
2362 const TInt KStepBackwardOneFrame = -1; |
|
2363 const TUint KStepForwardFourFrames = 4; |
|
2364 const TInt KStepBackwardFourFrames = -4; |
|
2365 |
|
2366 switch (aEventCode) |
|
2367 { |
|
2368 case EVPIdle: |
|
2369 // Calling StepFrameL() before Opeing file should result KErrNotReady. |
|
2370 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1); |
|
2371 TRAP(err,iVideoPlayer->StepFrameL(1)); |
|
2372 if(err != KErrNotReady) |
|
2373 { |
|
2374 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady); |
|
2375 iTestStepResult = EFail; |
|
2376 CActiveScheduler::Stop(); |
|
2377 return; |
|
2378 } |
|
2379 |
|
2380 // Open iVideoPlayer |
|
2381 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2382 iVideoPlayer->OpenFileL(iFilename); |
|
2383 PrepareState(EVPOpenComplete, KErrNone); |
|
2384 break; |
|
2385 case EVPOpenComplete: |
|
2386 //Get playrate capabilities |
|
2387 INFO_PRINTF1(_L("iVideoPlayer->GetPlayRateCapabilitiesL()")); |
|
2388 TRAP(err,iVideoPlayer->GetPlayRateCapabilitiesL(iVideoPlayRateCapabilities)); |
|
2389 if( err != KErrNone) |
|
2390 { |
|
2391 INFO_PRINTF2(_L("GetPlayRateCapabilitiesL returned err= %d"), err); |
|
2392 iTestStepResult = EFail; |
|
2393 CActiveScheduler::Stop(); |
|
2394 return; |
|
2395 } |
|
2396 // Calling StepFrameL() in non-pause state should result KErrNotReady. |
|
2397 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),1); |
|
2398 TRAP(err,iVideoPlayer->StepFrameL(1)); |
|
2399 if(err != KErrNotReady) |
|
2400 { |
|
2401 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), KErrNotReady); |
|
2402 iTestStepResult = EFail; |
|
2403 CActiveScheduler::Stop(); |
|
2404 return; |
|
2405 } |
|
2406 |
|
2407 // Prepare iVideoPlayer |
|
2408 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2409 PrepareState(EVPPrepareComplete, KErrNone); |
|
2410 iVideoPlayer->Prepare(); |
|
2411 break; |
|
2412 case EVPPrepareComplete: |
|
2413 // Play iVideoPlayer |
|
2414 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2415 iVideoPlayer->Play(); |
|
2416 |
|
2417 //wait for 1Second to pause the playback. |
|
2418 INFO_PRINTF1(_L("calling User::After(KOneSecond);")); |
|
2419 User::After(KOneSecond); |
|
2420 |
|
2421 /* |
|
2422 Pause the playback, if pause is not supported wait for play to complete. |
|
2423 In case of any other err fail the test with appropriate error code. |
|
2424 */ |
|
2425 TRAP(err, iVideoPlayer->PauseL()); |
|
2426 |
|
2427 if( err == KErrNotSupported) |
|
2428 { |
|
2429 pauseSupported = EFalse; |
|
2430 PrepareState(EVPPlayComplete, KErrNone); |
|
2431 } |
|
2432 else if( err != KErrNone) |
|
2433 { |
|
2434 INFO_PRINTF2(_L("PauseL has returned error =%d"), err); |
|
2435 iVideoPlayer->Stop(); |
|
2436 iVideoPlayer->Close(); |
|
2437 CActiveScheduler::Stop(); |
|
2438 iTestStepResult = EFail; |
|
2439 return; |
|
2440 } |
|
2441 |
|
2442 INFO_PRINTF1(_L("Playback paused")); |
|
2443 |
|
2444 //Call StepFrameL with different step values. |
|
2445 while(1) |
|
2446 { |
|
2447 if( frame == 0xff) |
|
2448 frame = KStepForwardZeroFrame; |
|
2449 else if (frame == KStepForwardZeroFrame) |
|
2450 frame = KStepForwardOneFrame; |
|
2451 else if (frame == KStepForwardOneFrame) |
|
2452 frame = KStepForwardFourFrames; |
|
2453 else if (frame == KStepForwardFourFrames) |
|
2454 frame = KStepBackwardOneFrame; |
|
2455 else if (frame == KStepBackwardOneFrame) |
|
2456 frame = KStepBackwardFourFrames; |
|
2457 else if (frame == KStepBackwardFourFrames) |
|
2458 { |
|
2459 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2460 iVideoPlayer->Stop(); |
|
2461 iVideoPlayer->Close(); |
|
2462 CActiveScheduler::Stop(); |
|
2463 iTestStepResult = EPass; |
|
2464 return; //Break the while loop |
|
2465 } |
|
2466 INFO_PRINTF2(_L("iVideoPlayer->StepFrameL(%d)"),frame); |
|
2467 TRAP(err,iVideoPlayer->StepFrameL(frame)); |
|
2468 if(err == KErrNotSupported) |
|
2469 { |
|
2470 if( ((iVideoPlayRateCapabilities.iStepForward) && (frame>0)) || |
|
2471 ((iVideoPlayRateCapabilities.iStepBackward) && (frame<0)) ) |
|
2472 { |
|
2473 INFO_PRINTF2(_L("StepFrameL returned wrong err= %d"), err); |
|
2474 iTestStepResult = EFail; |
|
2475 CActiveScheduler::Stop(); |
|
2476 return; |
|
2477 } |
|
2478 INFO_PRINTF1(_L("StepFrameL returned KErrNotSupported")); |
|
2479 continue; |
|
2480 } |
|
2481 else if( (err == KErrNotReady) && (!pauseSupported) ) |
|
2482 { |
|
2483 INFO_PRINTF1(_L("pause is not supported in controller plugin. Returned correct err(KErrNotReady)")); |
|
2484 continue; |
|
2485 } |
|
2486 else if( err != KErrNone) |
|
2487 { |
|
2488 INFO_PRINTF2(_L("StepFrameL returned err= %d"), err); |
|
2489 iTestStepResult = EFail; |
|
2490 CActiveScheduler::Stop(); |
|
2491 break; |
|
2492 } |
|
2493 } |
|
2494 break; |
|
2495 case EVPPlayComplete: |
|
2496 INFO_PRINTF1(_L("Plyback completed before pausing!!")); |
|
2497 INFO_PRINTF1(_L("Video clip is too small to run this test step")); |
|
2498 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2499 iVideoPlayer->Stop(); |
|
2500 iVideoPlayer->Close(); |
|
2501 CActiveScheduler::Stop(); |
|
2502 iTestStepResult = EInconclusive; |
|
2503 return; |
|
2504 } |
|
2505 } |
|
2506 } |
|
2507 |
|
2508 // |
|
2509 // RTestVideoPlayAudVidEnable. |
|
2510 // |
|
2511 |
|
2512 /** |
|
2513 * RTestVideoPlayAudVidEnable::Constructor |
|
2514 */ |
|
2515 RTestVideoPlayAudVidEnable::RTestVideoPlayAudVidEnable(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2516 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError) |
|
2517 { |
|
2518 } |
|
2519 |
|
2520 /** |
|
2521 * RTestVideoPlayAudVidEnable::NewL |
|
2522 */ |
|
2523 RTestVideoPlayAudVidEnable* RTestVideoPlayAudVidEnable::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2524 { |
|
2525 RTestVideoPlayAudVidEnable* self = new (ELeave) RTestVideoPlayAudVidEnable(aTestName, aSectName, aKeyName, aExpectedError); |
|
2526 return self; |
|
2527 } |
|
2528 |
|
2529 /** |
|
2530 * RTestVideoPlayAudVidEnable::DoTestStepL() |
|
2531 */ |
|
2532 TVerdict RTestVideoPlayAudVidEnable::DoTestStepL() |
|
2533 { |
|
2534 // Call the state handler from IDLE state |
|
2535 TRAPD(err, FsmL(EVPIdle)); |
|
2536 if (err == KErrNone) |
|
2537 { |
|
2538 // Start the scheduler - Done only once ! |
|
2539 CActiveScheduler::Start(); |
|
2540 } |
|
2541 return iTestStepResult; |
|
2542 } |
|
2543 /** |
|
2544 * RTestVideoPlayAudVidEnable::FsmL() |
|
2545 */ |
|
2546 void RTestVideoPlayAudVidEnable::FsmL(TVclntTestPlayEvents aEventCode) |
|
2547 { |
|
2548 if (FsmCheck(aEventCode)) |
|
2549 { |
|
2550 TInt err = KErrNone; |
|
2551 TBool enableFlag = EFalse; |
|
2552 |
|
2553 switch (aEventCode) |
|
2554 { |
|
2555 case EVPIdle: |
|
2556 //Calling SetAudioEnabledL() before opening file should return KErrNotReady |
|
2557 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2558 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2559 if (err != KErrNotReady) |
|
2560 { |
|
2561 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2562 iTestStepResult = EFail; |
|
2563 CActiveScheduler::Stop(); |
|
2564 return; |
|
2565 } |
|
2566 //Calling SetVideoEnabledL() before opening file should return KErrNotReady |
|
2567 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2568 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2569 if (err != KErrNotReady) |
|
2570 { |
|
2571 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2572 iTestStepResult = EFail; |
|
2573 CActiveScheduler::Stop(); |
|
2574 return; |
|
2575 } |
|
2576 //Calling VideoEnabledL() before opening file should return KErrNotReady |
|
2577 INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()")); |
|
2578 TRAP(err, iVideoPlayer->VideoEnabledL()); |
|
2579 if(err != KErrNotReady) |
|
2580 { |
|
2581 INFO_PRINTF2(_L("VideoEnabledL returned wrong error code= %d"), err); |
|
2582 iTestStepResult = EFail; |
|
2583 CActiveScheduler::Stop(); |
|
2584 return; |
|
2585 } |
|
2586 // Open iVideoPlayer |
|
2587 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2588 iVideoPlayer->OpenFileL(iFilename); |
|
2589 PrepareState(EVPOpenComplete, KErrNone); |
|
2590 break; |
|
2591 case EVPOpenComplete: |
|
2592 //Check that by default audio is enabled. |
|
2593 INFO_PRINTF1(_L("iVideoPlayer->AudioEnabledL()")); |
|
2594 TRAP(err,enableFlag = iVideoPlayer->AudioEnabledL()); |
|
2595 if( (err != KErrNone) || (enableFlag != (TBool)ETrue) ) |
|
2596 { |
|
2597 INFO_PRINTF3(_L("AudioEnabledL Leave err= %d, returned:%d"), err,enableFlag); |
|
2598 iTestStepResult = EFail; |
|
2599 CActiveScheduler::Stop(); |
|
2600 return; |
|
2601 } |
|
2602 |
|
2603 //Check that by default video is enabled. |
|
2604 INFO_PRINTF1(_L("iVideoPlayer->VideoEnabledL()")); |
|
2605 TRAP(err,enableFlag = iVideoPlayer->VideoEnabledL()); |
|
2606 if( (err != KErrNone) || (enableFlag != (TBool)ETrue) ) |
|
2607 { |
|
2608 INFO_PRINTF3(_L("VideoEnabledL Leave err= %d, returned:%d"), err,enableFlag); |
|
2609 iTestStepResult = EFail; |
|
2610 CActiveScheduler::Stop(); |
|
2611 return; |
|
2612 } |
|
2613 |
|
2614 //Try to disable audio, It shall leave with notsupported error. |
|
2615 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2616 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2617 if (err != KErrNotSupported) |
|
2618 { |
|
2619 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2620 iTestStepResult = EFail; |
|
2621 CActiveScheduler::Stop(); |
|
2622 return; |
|
2623 } |
|
2624 |
|
2625 //Try to disable video, It shall leave with notsupported error. |
|
2626 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2627 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2628 if (err != KErrNotSupported) |
|
2629 { |
|
2630 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2631 iTestStepResult = EFail; |
|
2632 CActiveScheduler::Stop(); |
|
2633 return; |
|
2634 } |
|
2635 |
|
2636 // Prepare iVideoPlayer |
|
2637 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2638 PrepareState(EVPPrepareComplete, KErrNone); |
|
2639 iVideoPlayer->Prepare(); |
|
2640 break; |
|
2641 case EVPPrepareComplete: |
|
2642 //Enabling/disabling audio after prepare() shall return KErrNotSupported error. |
|
2643 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2644 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2645 if(err != KErrNotSupported) |
|
2646 { |
|
2647 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2648 iTestStepResult = EFail; |
|
2649 CActiveScheduler::Stop(); |
|
2650 return; |
|
2651 } |
|
2652 |
|
2653 //Enabling/disabling video after prepare() shll return KErrNotSupported error. |
|
2654 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2655 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2656 if(err != KErrNotSupported) |
|
2657 { |
|
2658 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2659 iTestStepResult = EFail; |
|
2660 CActiveScheduler::Stop(); |
|
2661 return; |
|
2662 } |
|
2663 |
|
2664 // Play iVideoPlayer |
|
2665 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2666 iVideoPlayer->Play(); |
|
2667 PrepareState(EVPPlayComplete, KErrNone); |
|
2668 |
|
2669 //calling SetAudioEnabledL while playing should return KErrNotReady |
|
2670 INFO_PRINTF1(_L("iVideoPlayer->SetAudioEnabledL()")); |
|
2671 TRAP(err, iVideoPlayer->SetAudioEnabledL(ETrue)); |
|
2672 if (err != KErrNotReady) |
|
2673 { |
|
2674 INFO_PRINTF2(_L("SetAudioEnabledL returned wrong error code= %d"), err); |
|
2675 iTestStepResult = EFail; |
|
2676 iVideoPlayer->Stop(); |
|
2677 iVideoPlayer->Close(); |
|
2678 CActiveScheduler::Stop(); |
|
2679 return; |
|
2680 } |
|
2681 |
|
2682 //calling SetVideoEnabledL while playing should return KErrNotReady |
|
2683 INFO_PRINTF1(_L("iVideoPlayer->SetVideoEnabledL()")); |
|
2684 TRAP(err, iVideoPlayer->SetVideoEnabledL(ETrue)); |
|
2685 if (err != KErrNotReady) |
|
2686 { |
|
2687 INFO_PRINTF2(_L("SetVideoEnabledL returned wrong error code= %d"), err); |
|
2688 iTestStepResult = EFail; |
|
2689 iVideoPlayer->Stop(); |
|
2690 iVideoPlayer->Close(); |
|
2691 CActiveScheduler::Stop(); |
|
2692 return; |
|
2693 } |
|
2694 |
|
2695 break; |
|
2696 case EVPPlayComplete: |
|
2697 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2698 iVideoPlayer->Stop(); |
|
2699 iVideoPlayer->Close(); |
|
2700 CActiveScheduler::Stop(); |
|
2701 iTestStepResult = EPass; |
|
2702 break; |
|
2703 } |
|
2704 } |
|
2705 } |
|
2706 |
|
2707 |
|
2708 // |
|
2709 // RTestVideoPlayAutoScale. |
|
2710 // |
|
2711 |
|
2712 /** |
|
2713 * RTestVideoPlayAutoScale::Constructor |
|
2714 */ |
|
2715 RTestVideoPlayAutoScale::RTestVideoPlayAutoScale(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName, TInt aExpectedError) |
|
2716 : RTestVclntAviPlayerStep(aTestName, aSectName, aKeyName, aExpectedError) |
|
2717 { |
|
2718 } |
|
2719 |
|
2720 /** |
|
2721 * RTestVideoPlayAutoScale::NewL |
|
2722 */ |
|
2723 RTestVideoPlayAutoScale* RTestVideoPlayAutoScale::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TInt aExpectedError) |
|
2724 { |
|
2725 RTestVideoPlayAutoScale* self = new (ELeave) RTestVideoPlayAutoScale(aTestName, aSectName, aKeyName, aExpectedError); |
|
2726 return self; |
|
2727 } |
|
2728 |
|
2729 /** |
|
2730 * RTestVideoPlayAutoScale::DoTestStepL() |
|
2731 */ |
|
2732 TVerdict RTestVideoPlayAutoScale::DoTestStepL() |
|
2733 { |
|
2734 // Call the state handler from IDLE state |
|
2735 TRAPD(err, FsmL(EVPIdle)); |
|
2736 if (err == KErrNone) |
|
2737 { |
|
2738 // Start the scheduler - Done only once ! |
|
2739 CActiveScheduler::Start(); |
|
2740 } |
|
2741 return iTestStepResult; |
|
2742 } |
|
2743 /** |
|
2744 * RTestVideoPlayAutoScale::FsmL() |
|
2745 */ |
|
2746 void RTestVideoPlayAutoScale::FsmL(TVclntTestPlayEvents aEventCode) |
|
2747 { |
|
2748 if (FsmCheck(aEventCode)) |
|
2749 { |
|
2750 TInt err = KErrNone; |
|
2751 TAutoScaleType scaleType = EAutoScaleNone; |
|
2752 THorizontalAlign horizontalAlign = EHorizontalAlignCenter; |
|
2753 TVerticalAlign verticalAlign = EVerticalAlignCenter; |
|
2754 |
|
2755 switch (aEventCode) |
|
2756 { |
|
2757 case EVPIdle: |
|
2758 //Calling SetAutoScaleL() before opening file should return KErrNotReady error. |
|
2759 INFO_PRINTF1(_L("Calling SetAutoScaleL(EAutoScaleNone);")); |
|
2760 TRAP(err, iVideoPlayer->SetAutoScaleL(EAutoScaleNone)); |
|
2761 if( err != KErrNotReady) |
|
2762 { |
|
2763 INFO_PRINTF2(_L("SetAutoScaleL() returned wrong error=%d"),err); |
|
2764 CActiveScheduler::Stop(); |
|
2765 iTestStepResult = EFail; |
|
2766 return; |
|
2767 } |
|
2768 |
|
2769 // Open iVideoPlayer |
|
2770 INFO_PRINTF2(_L("iVideoPlayer->OpenFileL() %S"), &iFilename); |
|
2771 iVideoPlayer->OpenFileL(iFilename); |
|
2772 PrepareState(EVPOpenComplete, KErrNone); |
|
2773 break; |
|
2774 case EVPOpenComplete: |
|
2775 // Prepare iVideoPlayer |
|
2776 INFO_PRINTF1(_L("iVideoPlayer->Prepare()")); |
|
2777 PrepareState(EVPPrepareComplete, KErrNone); |
|
2778 iVideoPlayer->Prepare(); |
|
2779 break; |
|
2780 case EVPPrepareComplete: |
|
2781 // Play iVideoPlayer |
|
2782 INFO_PRINTF1(_L("iVideoPlayer->Play()")); |
|
2783 iVideoPlayer->Play(); |
|
2784 PrepareState(EVPPlayComplete, KErrNone); |
|
2785 |
|
2786 /* |
|
2787 Wait for 1/4th of a second each time and call SetAutoScaleL multiple times |
|
2788 with different scale parameters. |
|
2789 This loop tests only "void SetAutoScaleL(TAutoScaleType aScaleType);" |
|
2790 */ |
|
2791 |
|
2792 while(1) |
|
2793 { |
|
2794 switch(scaleType) |
|
2795 { |
|
2796 case EAutoScaleNone: |
|
2797 scaleType = EAutoScaleBestFit; |
|
2798 break; |
|
2799 case EAutoScaleBestFit: |
|
2800 scaleType = EAutoScaleClip; |
|
2801 break; |
|
2802 case EAutoScaleClip: |
|
2803 scaleType = EAutoScaleStretch; |
|
2804 break; |
|
2805 case EAutoScaleStretch: |
|
2806 scaleType = EAutoScaleNone; |
|
2807 break; |
|
2808 } |
|
2809 INFO_PRINTF1(_L("calling User::After(KOneSecond/4);")); |
|
2810 User::After(KOneSecond/4); |
|
2811 |
|
2812 INFO_PRINTF1(_L("Calling SetAutoScaleL();")); |
|
2813 TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType)); |
|
2814 |
|
2815 #ifdef SYMBIAN_BUILD_GCE |
|
2816 const TInt KExpected = GCEAvailable() ? KErrNone : KErrNotSupported; |
|
2817 #else |
|
2818 const TInt KExpected = KErrNotSupported; |
|
2819 #endif |
|
2820 |
|
2821 if( err == KExpected) |
|
2822 { |
|
2823 INFO_PRINTF3(_L("SetAutoScaleL(%d) successfully returned %d"), scaleType, err); |
|
2824 } |
|
2825 else |
|
2826 { |
|
2827 INFO_PRINTF4(_L("SetAutoScaleL(%d) returned error= %d. Expected %d"),scaleType, err, KExpected); |
|
2828 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2829 iVideoPlayer->Stop(); |
|
2830 iVideoPlayer->Close(); |
|
2831 CActiveScheduler::Stop(); |
|
2832 iTestStepResult = EFail; |
|
2833 return; |
|
2834 } |
|
2835 if( scaleType == EAutoScaleNone ) |
|
2836 { |
|
2837 break;//Break the forever while loop; |
|
2838 } |
|
2839 } |
|
2840 |
|
2841 /* |
|
2842 Wait for half second each time and call SetAutoScaleL multiple times |
|
2843 with all combinations of TAutoScaleType, THorizontalAlign, and TVerticalAlign. |
|
2844 */ |
|
2845 |
|
2846 while(1) |
|
2847 { |
|
2848 switch(scaleType) |
|
2849 { |
|
2850 case EAutoScaleNone: |
|
2851 scaleType = EAutoScaleBestFit; |
|
2852 break; |
|
2853 case EAutoScaleBestFit: |
|
2854 scaleType = EAutoScaleClip; |
|
2855 break; |
|
2856 case EAutoScaleClip: |
|
2857 scaleType = EAutoScaleStretch; |
|
2858 break; |
|
2859 case EAutoScaleStretch: |
|
2860 scaleType = EAutoScaleNone; |
|
2861 break; |
|
2862 } |
|
2863 while(1) |
|
2864 { |
|
2865 if( horizontalAlign == EHorizontalAlignCenter) |
|
2866 { |
|
2867 horizontalAlign = EHorizontalAlignLeft; |
|
2868 } |
|
2869 else if( horizontalAlign == EHorizontalAlignLeft) |
|
2870 { |
|
2871 horizontalAlign = EHorizontalAlignRight; |
|
2872 } |
|
2873 else if( horizontalAlign == EHorizontalAlignRight) |
|
2874 { |
|
2875 horizontalAlign = EHorizontalAlignCenter; |
|
2876 } |
|
2877 while(1) |
|
2878 { |
|
2879 if( verticalAlign == EVerticalAlignCenter) |
|
2880 { |
|
2881 verticalAlign = EVerticalAlignTop; |
|
2882 } |
|
2883 else if( verticalAlign == EVerticalAlignTop) |
|
2884 { |
|
2885 verticalAlign = EVerticalAlignBottom; |
|
2886 } |
|
2887 else if( verticalAlign == EVerticalAlignBottom) |
|
2888 { |
|
2889 verticalAlign = EVerticalAlignCenter; |
|
2890 } |
|
2891 |
|
2892 INFO_PRINTF1(_L("calling User::After(KOneSecond/4);")); |
|
2893 User::After(KOneSecond/4); |
|
2894 err = KErrNone; |
|
2895 |
|
2896 INFO_PRINTF1(_L("Calling SetAutoScaleL();")); |
|
2897 TRAP(err, iVideoPlayer->SetAutoScaleL(scaleType,horizontalAlign,verticalAlign)); |
|
2898 if( err == KErrNotSupported) |
|
2899 { |
|
2900 INFO_PRINTF4(_L("SetAutoScaleL(%d,%d, %d) returned KErrNotSupported"),scaleType, horizontalAlign,verticalAlign); |
|
2901 } |
|
2902 else if( err == KErrNone) |
|
2903 { |
|
2904 INFO_PRINTF1(_L("Success calling SetAutoScaleL()")); |
|
2905 } |
|
2906 else |
|
2907 { |
|
2908 INFO_PRINTF3(_L("SetAutoScaleL(%d) returned error= %d"),scaleType, err); |
|
2909 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2910 iVideoPlayer->Stop(); |
|
2911 iVideoPlayer->Close(); |
|
2912 CActiveScheduler::Stop(); |
|
2913 iTestStepResult = EFail; |
|
2914 return; |
|
2915 } |
|
2916 |
|
2917 if( verticalAlign == EVerticalAlignCenter ) |
|
2918 { |
|
2919 break;//Break the forever while loop; |
|
2920 } |
|
2921 } |
|
2922 if( horizontalAlign == EHorizontalAlignCenter ) |
|
2923 { |
|
2924 break;//Break the forever while loop; |
|
2925 } |
|
2926 } |
|
2927 if( scaleType == EAutoScaleNone ) |
|
2928 { |
|
2929 break;//Break the forever while loop; |
|
2930 } |
|
2931 } |
|
2932 |
|
2933 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2934 iVideoPlayer->Stop(); |
|
2935 iVideoPlayer->Close(); |
|
2936 CActiveScheduler::Stop(); |
|
2937 iTestStepResult = EPass; |
|
2938 break; |
|
2939 case EVPPlayComplete: |
|
2940 INFO_PRINTF1(_L("Clip is too small to run the test")); |
|
2941 INFO_PRINTF1(_L("iVideoPlayer->Stop")); |
|
2942 iVideoPlayer->Stop(); |
|
2943 iVideoPlayer->Close(); |
|
2944 CActiveScheduler::Stop(); |
|
2945 iTestStepResult = EInconclusive; |
|
2946 break; |
|
2947 } |
|
2948 } |
|
2949 } |