Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-played-ranges-1.html
blob801316082e3e7c06a56f3a75f86c4aa59777b0c6
1 <html>
2 <head>
3 <title>Test of 'played' attribute</title>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
6 <script src=video-played.js></script>
7 <script>
9 var testFunctions =
11 PlayWithNoRanges,
12 JumpAndPlayFwd,
13 JumpBackAndPlayToNewRange,
14 JumpAndExtendRangeStart,
15 JumpAndExtendRangeEnd,
18 // 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 turns on detailed logging back on, which
20 // can be useful for debugging test failure.
21 disableFullTestDetailsPrinting();
23 function PlayWithNoRanges()
25 consoleWrite("<br><b><em>Test playing when there are no ranges</em></b>");
27 timeRangeCount = currentTimeRange = 0;
28 willPauseInExistingRange = false;
29 willExtendAnExistingRange = false;
31 startPlayingInNewRange();
34 function JumpAndPlayFwd()
36 consoleWrite("<br><b><em>Test jumping forward into a new range and play</em></b>");
38 var newTime = video.duration - 1.0;
39 runSilently("video.currentTime = " + (newTime.toFixed(2)));
41 currentTimeRange = 1;
42 willPauseInExistingRange = false;
43 willExtendAnExistingRange = false;
45 startPlayingInNewRange();
48 function JumpBackAndPlayToNewRange()
50 consoleWrite("<br><b><em>Test jumping backwards into a new range and play, should insert new range</em></b>");
52 var newTime = 3.00;
53 runSilently("video.currentTime = " + newTime);
55 currentTimeRange = 1;
56 willPauseInExistingRange = false;
57 willExtendAnExistingRange = false;
59 startPlayingInNewRange();
62 function JumpAndExtendRangeStart()
64 consoleWrite("<br><b><em>Test playing into an existing range, should extend range start</em></b>");
66 currentTimeRange = 1;
67 var newTime = (video.played.start(currentTimeRange) - 0.05).toFixed(2);
68 runSilently("video.currentTime = " + newTime);
70 expectedStartTimes[currentTimeRange] = newTime;
71 willPauseInExistingRange = true;
72 willExtendAnExistingRange = true;
73 startPlaying();
76 function JumpAndExtendRangeEnd()
78 consoleWrite("<br><b><em>Test jumping into an existing range and play beyond end, should extend range end</em></b>");
80 currentTimeRange = 1;
82 var newTime = (video.played.end(currentTimeRange) - 0.05).toFixed(2);
83 runSilently("video.currentTime = " + newTime);
85 willPauseInExistingRange = false;
86 willExtendAnExistingRange = true;
87 playForMillisecs(30);
90 </script>
91 </head>
93 <body onload="videoPlayedMain()">
95 <video controls></video>
96 <p>Test of the media element 'played' attribute, ranges part 1.</p>
98 </body>
99 </html>