summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/mediasource-play.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/media-source/mediasource-play.html')
-rw-r--r--testing/web-platform/tests/media-source/mediasource-play.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/media-source/mediasource-play.html b/testing/web-platform/tests/media-source/mediasource-play.html
new file mode 100644
index 000000000..5bbfa29d7
--- /dev/null
+++ b/testing/web-platform/tests/media-source/mediasource-play.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<html>
+ <head>
+ <title>Simple MediaSource playback test case.</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="mediasource-util.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
+ {
+ mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'"));
+ mediaElement.addEventListener('ended', test.step_func_done());
+
+ test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
+ test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
+ test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+
+ sourceBuffer.appendBuffer(mediaData);
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, "updating");
+
+ sourceBuffer.remove(1, Infinity);
+
+ assert_true(sourceBuffer.updating, "updating");
+ test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer');
+ test.expectEvent(sourceBuffer, 'update', 'sourceBuffer');
+ test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer');
+ });
+
+ test.waitForExpectedEvents(function()
+ {
+ assert_false(sourceBuffer.updating, "updating");
+ assert_greater_than(mediaSource.duration, 1, "duration");
+
+ mediaSource.duration = 1;
+
+ test.expectEvent(mediaElement, "durationchange");
+ });
+
+ test.waitForExpectedEvents(function()
+ {
+ mediaSource.endOfStream();
+ mediaElement.play();
+ });
+ }, "Test normal playback case with MediaSource API");
+ </script>
+ </body>
+</html>