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..863c0b042ab7d41cef8b9f90f0ed15cd55493386 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/media/media-source/mediasource-play-then-seek-back.html |
| @@ -0,0 +1,79 @@ |
| +<!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; |
| + assert_equals(segmentInfo.duration, 6.042, 'Expected test media duration'); |
| + 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); |
| + } |
| + |
| + function getSegment(mediaData, info) |
| + { |
| + var start = info.offset; |
| + var end = start + info.size; |
| + return mediaData.subarray(start, end); |
| + } |
| + |
| + seekBackAfterPlayingTest(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) |
| + { |
| + test.failOnEvent(mediaElement, 'error'); |
|
acolwell GONE FROM CHROMIUM
2013/07/25 23:11:31
nit: You shouldn't need this here since you have t
anandc
2013/07/26 18:49:22
Done.
|
| + |
| + mediaElement.play(); |
| + // Append all the segments |
| + test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); |
| + test.expectEvent(mediaElement, 'playing', 'Playing triggered'); |
| + sourceBuffer.appendBuffer(mediaData); |
| + |
| + function playAndSeek(test, mediaElement) |
| + { |
| + test.waitForExpectedEvents(function() |
| + { |
| + assert_greater_than(mediaElement.currentTime, 0.0, |
|
acolwell GONE FROM CHROMIUM
2013/07/25 23:11:31
nit: put this all one one line.
anandc
2013/07/26 18:49:22
Done.
|
| + 'Playback has started.'); |
|
anandc
2013/07/25 22:50:13
This is the assert that is failing.
|
| + test.expectEvent(mediaElement, 'seeking', 'mediaElement'); |
| + mediaElement.currentTime = 0.0; |
| + assert_true(mediaElement.seeking, 'mediaElement is seeking'); |
| + }); |
| + |
| + test.waitForExpectedEvents(function() |
| + { |
| + 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() |
| + { |
| + assert_true(mediaElement.waiting, 'mediaElement is waiting'); |
| + test.done(); |
| + }); |
| + |
| + } |
| + |
| + setTimeout(playAndSeek(test, mediaElement), 2000); |
|
acolwell GONE FROM CHROMIUM
2013/07/25 23:11:31
this calls playAndSeek() immediately. It isn't wai
anandc
2013/07/26 18:49:22
Thanks. Done.
|
| + |
| + }, 'Test playing then seeking back.'); |
| + </script> |
| + </body> |
| +</html> |