Chromium Code Reviews| Index: LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html |
| diff --git a/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..45e0dd5df8989e85f3ea1f81f18e287f0058aa36 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html |
| @@ -0,0 +1,82 @@ |
| +<!DOCTYPE html> |
| +<html> |
| + <head> |
| + <script src="/w3c/resources/testharness.js"></script> |
| + <script src="/w3c/resources/testharnessreport.js"></script> |
| + <script src="mediasource-util.js"></script> |
| + <script src="/media/resources/media-source/webm/segment-info.js"></script> |
| + <link rel="stylesheet" href="/w3c/resources/testharness.css"> |
| + </head> |
| + <body> |
| + <div id='log'></div> |
| + |
| + <script> |
| + |
| + function seekBackAfterPlayingTest(testFunction, description, options) |
| + { |
| + mediasource_test(function(test, mediaElement, mediaSource) |
| + { |
| + var segmentInfo = WebMSegmentInfo.testWebM; |
| + test.failOnEvent(mediaElement, 'error'); |
| + |
| + var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type); |
| + MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData) |
| + { |
| + testFunction(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData); |
| + }); |
| + }, description, options); |
| + } |
| + |
| + seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + |
| + mediaElement.play(); |
| + // Append all the segments |
| + test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); |
| + test.expectEvent(mediaElement, 'playing', 'Playing triggered'); |
| + sourceBuffer.appendBuffer(mediaData); |
| + |
| + function confirmPlayThenEnd() |
| + { |
| + function delayedPlayHandlerThatEnds() |
| + { |
| + assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started after seek.'); |
| + test.done(); |
| + } |
| + test.expectDelayedCallback(delayedPlayHandlerThatEnds); |
| + } |
| + |
| + function finishSeekThenPlay() |
| + { |
| + assert_true(mediaElement.seeking, 'mediaElement is seeking'); |
| + assert_equals(mediaElement.currentTime, 0.0, 'Current time is 0.0'); |
| + test.expectEvent(mediaElement, 'timeupdate', 'timeupdate fired.'); |
| + test.expectEvent(mediaElement, 'seeked', 'mediaElement finished seek'); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + confirmPlayThenEnd(); |
| + }); |
| + } |
| + |
| + function delayedPlayHandler() |
| + { |
| + assert_greater_than(mediaElement.currentTime, 0.0, 'Playback has started.'); |
| + test.expectEvent(mediaElement, 'seeking', 'mediaElement'); |
| + mediaElement.currentTime = 0.0; |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + finishSeekThenPlay(); |
| + }); |
| + } |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + test.expectDelayedCallback(delayedPlayHandler); |
|
acolwell GONE FROM CHROMIUM
2013/08/06 18:42:37
After looking at this some more, it seems line wha
wolenetz
2013/08/06 21:28:58
If going this route, please use a separate mechani
anandc
2013/08/06 21:30:51
This is a good idea, thanks. PTAL at the new waitF
|
| + }); |
| + |
| + }, 'Test playing then seeking back.'); |
| + </script> |
| + </body> |
| +</html> |