Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / media / media-source / mediasource-play-then-seek-back.html
blob4c7ad9319a414b05c5c97bf7780e5db3aeae630d
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/w3c/resources/testharness.js"></script>
5 <script src="/w3c/resources/testharnessreport.js"></script>
6 <script src="mediasource-util.js"></script>
7 <link rel="stylesheet" href="/w3c/resources/testharness.css">
8 </head>
9 <body>
10 <div id="log"></div>
11 <script>
13 mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
16 mediaElement.play();
17 // Append all the segments
18 test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
19 test.expectEvent(mediaElement, 'playing', 'Playing triggered');
20 sourceBuffer.appendBuffer(mediaData);
22 function confirmPlayThenEnd()
24 test.waitForCurrentTimeChange(mediaElement, function ()
26 assert_false(mediaElement.seeking, 'mediaElement is no longer seeking');
27 test.waitForCurrentTimeChange(mediaElement, function() { test.done(); });
28 });
31 function delayedPlayHandler()
33 assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.');
34 test.expectEvent(mediaElement, 'seeking', 'mediaElement');
35 test.expectEvent(mediaElement, 'seeked', 'mediaElement finished seek');
36 mediaElement.currentTime = 0.0;
37 assert_true(mediaElement.seeking, 'mediaElement is seeking');
38 assert_equals(mediaElement.currentTime, 0.0, 'Current time is 0.0');
40 test.waitForExpectedEvents(confirmPlayThenEnd);
43 test.waitForExpectedEvents(function()
45 test.waitForCurrentTimeChange(mediaElement, delayedPlayHandler);
46 });
48 }, 'Test playing then seeking back.');
49 </script>
50 </body>
51 </html>