summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/mediasource-detach.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/media-source/mediasource-detach.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/media-source/mediasource-detach.html')
-rw-r--r--testing/web-platform/tests/media-source/mediasource-detach.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/media-source/mediasource-detach.html b/testing/web-platform/tests/media-source/mediasource-detach.html
new file mode 100644
index 000000000..b25b5c6f0
--- /dev/null
+++ b/testing/web-platform/tests/media-source/mediasource-detach.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="mediasource-util.js"></script>
+<script>
+ function mediasource_detach_test(testFunction, description)
+ {
+ mediasource_test(function(test, mediaElement, mediaSource)
+ {
+ var segmentInfo = MediaSourceUtil.SEGMENT_INFO;
+ var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type);
+
+ assert_equals(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING);
+ assert_equals(mediaSource.readyState, 'open');
+
+ mediaSource.addEventListener('sourceclose', test.step_func(function (event)
+ {
+ assert_equals(mediaSource.sourceBuffers.length, 0, 'sourceBuffers is empty');
+ assert_equals(mediaSource.activeSourceBuffers.length, 0, 'activeSourceBuffers is empty');
+ assert_equals(mediaSource.readyState, 'closed', 'readyState is "closed"');
+ assert_true(Number.isNaN(mediaSource.duration), 'duration is NaN');
+ test.done();
+ }));
+
+ MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData)
+ {
+ testFunction(test, mediaElement, mediaSource, sourceBuffer, mediaData);
+ });
+ }, description);
+ }
+
+ mediasource_detach_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+ {
+ mediaElement.load();
+ }, 'Test media.load() before appending data will trigger MediaSource detaching from a media element.');
+
+ mediasource_detach_test(function(test, mediaElement, mediaSource, sourceBuffer, mediaData)
+ {
+ sourceBuffer.addEventListener('updateend', test.step_func(function (event)
+ {
+ assert_greater_than(mediaElement.readyState, HTMLMediaElement.HAVE_NOTHING, 'media readyState is greater than "HAVE_NOTHING"')
+ assert_false(sourceBuffer.updating, 'updating attribute is false');
+ mediaElement.load();
+ }));
+
+ sourceBuffer.appendBuffer(mediaData);
+ }, 'Test media.load() after appending data will trigger MediaSource detaching from a media element.');
+</script>