| Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-preload.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-preload.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-preload.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7199ccca21333b470d8ae0de24898e3d9693d7d1
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-preload.html
|
| @@ -0,0 +1,83 @@
|
| +<!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>
|
| + <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);
|
| + });
|
| +
|
| + var listener = test.step_func(function(event) { test.done(); });
|
| + mediaSource.addEventListener("sourceopen", listener);
|
| + video.src = mediaSourceURL;
|
| + }, "sourceopen occurs with element preload=" + preload);
|
| + }
|
| +
|
| + attachWithPreloadTest("auto");
|
| + attachWithPreloadTest("metadata");
|
| + attachWithPreloadTest("none");
|
| +
|
| + function errorWithPreloadTest(preload, bogusURLStyle)
|
| + {
|
| + var testURLdescription;
|
| + var mediaSource = new MediaSource();
|
| + var bogusURL;
|
| +
|
| + if (bogusURLStyle == "revoked") {
|
| + testURLdescription = "revoked MediaSource object URL";
|
| + bogusURL = URL.createObjectURL(mediaSource);
|
| + URL.revokeObjectURL(bogusURL);
|
| + } else if (bogusURLStyle == "corrupted") {
|
| + testURLdescription = "corrupted MediaSource object URL";
|
| + bogusURL = URL.createObjectURL(mediaSource);
|
| + bogusURL += "0";
|
| + } else {
|
| + testURLdescription = bogusURL = bogusURLStyle;
|
| + }
|
| +
|
| + async_test(function(test)
|
| + {
|
| + var video = document.createElement("video");
|
| +
|
| + video.preload = preload;
|
| + document.body.appendChild(video);
|
| + test.add_cleanup(function() { document.body.removeChild(video); });
|
| +
|
| + var listener = test.step_func(function(event) { test.fail(); });
|
| + mediaSource.addEventListener("sourceopen", listener);
|
| +
|
| + video.onerror = test.step_func(function(event) { test.done(); });
|
| + video.src = bogusURL;
|
| + }, "error occurs with bogus blob URL (" + testURLdescription + ") and element preload=" + preload);
|
| + }
|
| +
|
| + errorWithPreloadTest("auto", "revoked");
|
| + errorWithPreloadTest("metadata", "revoked");
|
| + errorWithPreloadTest("none", "revoked");
|
| +
|
| + errorWithPreloadTest("auto", "blob:a");
|
| + errorWithPreloadTest("metadata", "blob:a");
|
| + errorWithPreloadTest("none", "blob:a");
|
| +
|
| + errorWithPreloadTest("auto", "corrupted");
|
| + errorWithPreloadTest("metadata", "corrupted");
|
| + errorWithPreloadTest("none", "corrupted");
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|