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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-preload.html

Issue 1920383002: MSE: Clean up the mediasource-preload layout test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses all remaining comments Created 4 years, 8 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 7199ccca21333b470d8ae0de24898e3d9693d7d1..9a9a6014c290d2b712175005b5e9c3933b56ecee 100644
--- 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
@@ -3,8 +3,6 @@
<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>
@@ -23,8 +21,7 @@
URL.revokeObjectURL(mediaSourceURL);
});
- var listener = test.step_func(function(event) { test.done(); });
- mediaSource.addEventListener("sourceopen", listener);
+ mediaSource.addEventListener("sourceopen", test.step_func_done());
video.src = mediaSourceURL;
}, "sourceopen occurs with element preload=" + preload);
}
@@ -35,46 +32,37 @@
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");
+ 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); });
- var listener = test.step_func(function(event) { test.fail(); });
- mediaSource.addEventListener("sourceopen", listener);
+ mediaSource.addEventListener("sourceopen", test.unreached_func("'sourceopen' should not be fired"));
- video.onerror = test.step_func(function(event) { test.done(); });
+ video.onerror = test.step_func_done();
video.src = bogusURL;
- }, "error occurs with bogus blob URL (" + testURLdescription + ") and element preload=" + preload);
+ }, "error occurs with bogus blob URL (" + bogusURLStyle + " MediaSource object URL) 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");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698