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

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: 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..1057d017f4654081f2f7cc256683e1be1d600a4e 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
@@ -23,8 +23,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 +34,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 occur"));
philipj_slow 2016/04/27 12:36:27 I guess I would say "should not be fired" to make
wolenetz 2016/04/27 18:54:53 Done.
- 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