Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: LayoutTests/http/tests/media/media-source/mediasource-seekable.html

Issue 710173004: Implement seekable() according to the MediaSource specification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some small review nits Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-seekable-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/media/media-source/mediasource-seekable.html
diff --git a/LayoutTests/http/tests/media/media-source/mediasource-seekable.html b/LayoutTests/http/tests/media/media-source/mediasource-seekable.html
new file mode 100644
index 0000000000000000000000000000000000000000..49646f9c2fb51b95cc9ad2ab0186d506e29128a5
--- /dev/null
+++ b/LayoutTests/http/tests/media/media-source/mediasource-seekable.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/w3c/resources/testharness.js"></script>
+ <script src="/w3c/resources/testharnessreport.js"></script>
+ <script src="mediasource-util.js"></script>
+ <link rel="stylesheet" href="/w3c/resources/testharness.css">
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ test.failOnEvent(mediaElement, 'error');
+ test.endOnEvent(mediaElement, 'ended');
+
+ var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE);
+
+ assertSeekableEquals(mediaElement, '{ }', 'mediaElement.seekable');
+ test.done();
+ }, 'Get seekable time ranges when the sourcebuffer is empty.');
+
+ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+ {
+ var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+ test.expectEvent(mediaElement, 'durationchange', 'mediaElement got duration');
+ sourceBuffer.appendBuffer(initSegment);
+ test.waitForExpectedEvents(function()
+ {
+ assert_equals(mediaElement.duration, 6.042);
+ assertSeekableEquals(mediaElement, '{ [0.000, 6.042) }', 'mediaElement.seekable');
+ test.done();
+ });
+ }, 'Get seekable time ranges after init segment received.');
+
+ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+ {
+ var initSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.init);
+ test.expectEvent(mediaElement, 'durationchange', 'mediaElement got duration after initsegment');
+ sourceBuffer.appendBuffer(initSegment);
+ test.waitForExpectedEvents(function()
+ {
+ test.expectEvent(mediaElement, 'durationchange', 'mediaElement got infinity duration');
+ mediaSource.duration = Infinity;
+ test.waitForExpectedEvents(function()
+ {
+ assertSeekableEquals(mediaElement, '{ }', 'mediaElement.seekable');
+
+ // Append a segment from the middle of the stream to make sure that seekable does not use buffered.start(0) or duration as first or last value
+ var midSegment = MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[2]);
+ test.expectEvent(sourceBuffer, 'update');
+ test.expectEvent(sourceBuffer, 'updateend');
+ sourceBuffer.appendBuffer(midSegment);
+ test.waitForExpectedEvents(function()
+ {
+ assert_equals(mediaElement.seekable.length, 1, 'mediaElement.seekable.length');
+ assert_equals(mediaElement.buffered.length, 1, 'mediaElement.buffered.length');
+ assert_equals(mediaElement.seekable.start(0), 0);
+ assert_not_equals(mediaElement.seekable.end(0), mediaElement.duration);
+ assert_not_equals(0, mediaElement.buffered.start(0));
+ assert_equals(mediaElement.seekable.end(0), mediaElement.buffered.end(0));
+ test.done();
+ });
+ });
+ });
+ }, 'Get seekable time ranges on an infinite stream.');
+ </script>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/media-source/mediasource-seekable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698