summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/media-source/mediasource-preload.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-preload.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-preload.html')
-rw-r--r--testing/web-platform/tests/media-source/mediasource-preload.html72
1 files changed, 72 insertions, 0 deletions
diff --git a/testing/web-platform/tests/media-source/mediasource-preload.html b/testing/web-platform/tests/media-source/mediasource-preload.html
new file mode 100644
index 000000000..e387b6373
--- /dev/null
+++ b/testing/web-platform/tests/media-source/mediasource-preload.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<!-- Copyright © 2016 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). -->
+<html>
+ <head>
+ <title>Various MediaSource HTMLMediaElement preload tests.</title>
+ <link rel="author" title="Matthew Wolenetz" href="mailto:wolenetz@chromium.org"/>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+ function attachWithPreloadTest(preload)
+ {
+ async_test(function(test)
+ {
+ var video = document.createElement("video");
+ var mediaSource = new MediaSource();
+ var mediaSourceURL = URL.createObjectURL(mediaSource);
+
+ video.preload = preload;
+ document.body.appendChild(video);
+ test.add_cleanup(function() {
+ document.body.removeChild(video);
+ URL.revokeObjectURL(mediaSourceURL);
+ });
+
+ mediaSource.addEventListener("sourceopen", test.step_func_done());
+ video.src = mediaSourceURL;
+ }, "sourceopen occurs with element preload=" + preload);
+ }
+
+ attachWithPreloadTest("auto");
+ attachWithPreloadTest("metadata");
+ attachWithPreloadTest("none");
+
+ function errorWithPreloadTest(preload, bogusURLStyle)
+ {
+ async_test(function(test)
+ {
+ var mediaSource = new MediaSource();
+ var bogusURL = URL.createObjectURL(mediaSource);
+
+ if (bogusURLStyle == "corrupted") {
+ var goodURL = bogusURL;
+ test.add_cleanup(function() { URL.revokeObjectURL(goodURL); });
+ bogusURL += "0";
+ } else if (bogusURLStyle == "revoked") {
+ URL.revokeObjectURL(bogusURL);
+ } else {
+ assert_unreached("invalid case");
+ }
+
+ var video = document.createElement("video");
+ video.preload = preload;
+ document.body.appendChild(video);
+ test.add_cleanup(function() { document.body.removeChild(video); });
+
+ mediaSource.addEventListener("sourceopen", test.unreached_func("'sourceopen' should not be fired"));
+
+ video.onerror = test.step_func_done();
+ video.src = bogusURL;
+ }, "error occurs with bogus blob URL (" + bogusURLStyle + " MediaSource object URL) and element preload=" + preload);
+ }
+
+ errorWithPreloadTest("auto", "revoked");
+ errorWithPreloadTest("metadata", "revoked");
+
+ errorWithPreloadTest("auto", "corrupted");
+ errorWithPreloadTest("metadata", "corrupted");
+ </script>
+ </body>
+</html>