OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Test of 'played' attribute</title> | 3 <title>Test of 'played' attribute</title> |
4 <script src=media-file.js></script> | 4 <script src=media-file.js></script> |
| 5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 6 (Please avoid writing new tests using video-test.js) --> |
5 <script src=video-test.js></script> | 7 <script src=video-test.js></script> |
6 <script src=video-played.js></script> | 8 <script src=video-played.js></script> |
7 <script> | 9 <script> |
8 | 10 |
9 var testFunctions = | 11 var testFunctions = |
10 [ | 12 [ |
11 PlayWithNoRanges, | 13 PlayWithNoRanges, |
12 JumpAndPlayFwd, | 14 JumpAndPlayFwd, |
13 JumpBackAndPlayToNewRange, | 15 JumpBackAndPlayToNewRange, |
14 JumpAndExtendRangeStart, | 16 JumpAndExtendRangeStart, |
15 JumpAndExtendRangeEnd, | 17 JumpAndExtendRangeEnd, |
16 ]; | 18 ]; |
17 | 19 |
18 // NOTE: Detailed results are not printed for this test because time
values are different from machine | 20 // NOTE: Detailed results are not printed for this test because time
values are different from machine |
19 // to machine and run to run. Commenting out the following line turn
s on detailed logging back on, which | 21 // to machine and run to run. Commenting out the following line turn
s on detailed logging back on, which |
20 // can be useful for debugging test failure. | 22 // can be useful for debugging test failure. |
21 disableFullTestDetailsPrinting(); | 23 disableFullTestDetailsPrinting(); |
22 | 24 |
23 function PlayWithNoRanges() | 25 function PlayWithNoRanges() |
24 { | 26 { |
25 consoleWrite("<br><b><em>Test playing when there are no ranges</
em></b>"); | 27 consoleWrite("<br><b><em>Test playing when there are no ranges</
em></b>"); |
26 | 28 |
27 timeRangeCount = currentTimeRange = 0; | 29 timeRangeCount = currentTimeRange = 0; |
28 willPauseInExistingRange = false; | 30 willPauseInExistingRange = false; |
29 willExtendAnExistingRange = false; | 31 willExtendAnExistingRange = false; |
30 | 32 |
31 startPlayingInNewRange(); | 33 startPlayingInNewRange(); |
32 } | 34 } |
33 | 35 |
34 function JumpAndPlayFwd() | 36 function JumpAndPlayFwd() |
35 { | 37 { |
36 consoleWrite("<br><b><em>Test jumping forward into a new range a
nd play</em></b>"); | 38 consoleWrite("<br><b><em>Test jumping forward into a new range a
nd play</em></b>"); |
37 | 39 |
38 var newTime = video.duration - 1.0; | 40 var newTime = video.duration - 1.0; |
39 runSilently("video.currentTime = " + (newTime.toFixed(2))); | 41 runSilently("video.currentTime = " + (newTime.toFixed(2))); |
40 | 42 |
41 currentTimeRange = 1; | 43 currentTimeRange = 1; |
42 willPauseInExistingRange = false; | 44 willPauseInExistingRange = false; |
43 willExtendAnExistingRange = false; | 45 willExtendAnExistingRange = false; |
44 | 46 |
45 startPlayingInNewRange(); | 47 startPlayingInNewRange(); |
46 } | 48 } |
47 | 49 |
48 function JumpBackAndPlayToNewRange() | 50 function JumpBackAndPlayToNewRange() |
49 { | 51 { |
50 consoleWrite("<br><b><em>Test jumping backwards into a new range
and play, should insert new range</em></b>"); | 52 consoleWrite("<br><b><em>Test jumping backwards into a new range
and play, should insert new range</em></b>"); |
51 | 53 |
52 var newTime = 3.00; | 54 var newTime = 3.00; |
53 runSilently("video.currentTime = " + newTime); | 55 runSilently("video.currentTime = " + newTime); |
54 | 56 |
55 currentTimeRange = 1; | 57 currentTimeRange = 1; |
56 willPauseInExistingRange = false; | 58 willPauseInExistingRange = false; |
57 willExtendAnExistingRange = false; | 59 willExtendAnExistingRange = false; |
58 | 60 |
59 startPlayingInNewRange(); | 61 startPlayingInNewRange(); |
60 } | 62 } |
61 | 63 |
62 function JumpAndExtendRangeStart() | 64 function JumpAndExtendRangeStart() |
63 { | 65 { |
64 consoleWrite("<br><b><em>Test playing into an existing range, sh
ould extend range start</em></b>"); | 66 consoleWrite("<br><b><em>Test playing into an existing range, sh
ould extend range start</em></b>"); |
65 | 67 |
66 currentTimeRange = 1; | 68 currentTimeRange = 1; |
67 var newTime = (video.played.start(currentTimeRange) - 0.05).toFi
xed(2); | 69 var newTime = (video.played.start(currentTimeRange) - 0.05).toFi
xed(2); |
68 runSilently("video.currentTime = " + newTime); | 70 runSilently("video.currentTime = " + newTime); |
69 | 71 |
70 expectedStartTimes[currentTimeRange] = newTime; | 72 expectedStartTimes[currentTimeRange] = newTime; |
71 willPauseInExistingRange = true; | 73 willPauseInExistingRange = true; |
72 willExtendAnExistingRange = true; | 74 willExtendAnExistingRange = true; |
73 startPlaying(); | 75 startPlaying(); |
74 } | 76 } |
75 | 77 |
76 function JumpAndExtendRangeEnd() | 78 function JumpAndExtendRangeEnd() |
77 { | 79 { |
78 consoleWrite("<br><b><em>Test jumping into an existing range and
play beyond end, should extend range end</em></b>"); | 80 consoleWrite("<br><b><em>Test jumping into an existing range and
play beyond end, should extend range end</em></b>"); |
79 | 81 |
80 currentTimeRange = 1; | 82 currentTimeRange = 1; |
81 | 83 |
82 var newTime = (video.played.end(currentTimeRange) - 0.05).toFixe
d(2); | 84 var newTime = (video.played.end(currentTimeRange) - 0.05).toFixe
d(2); |
83 runSilently("video.currentTime = " + newTime); | 85 runSilently("video.currentTime = " + newTime); |
84 | 86 |
85 willPauseInExistingRange = false; | 87 willPauseInExistingRange = false; |
86 willExtendAnExistingRange = true; | 88 willExtendAnExistingRange = true; |
87 playForMillisecs(30); | 89 playForMillisecs(30); |
88 } | 90 } |
89 | 91 |
90 </script> | 92 </script> |
91 </head> | 93 </head> |
92 | 94 |
93 <body onload="videoPlayedMain()"> | 95 <body onload="videoPlayedMain()"> |
94 | 96 |
95 <video controls></video> | 97 <video controls></video> |
96 <p>Test of the media element 'played' attribute, ranges part 1.</p> | 98 <p>Test of the media element 'played' attribute, ranges part 1.</p> |
97 | 99 |
98 </body> | 100 </body> |
99 </html> | 101 </html> |
OLD | NEW |