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

Unified Diff: third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html

Issue 2096223002: Convert video-src-invalid* and video-src-none* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit Created 4 years, 6 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
Index: third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html
diff --git a/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html b/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html
index 790522dd0a7fc58bcc15040ffe48cd950c361968..5b4b715663a4e9f64cebddc1b3b0ba905a38147e 100644
--- a/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html
+++ b/third_party/WebKit/LayoutTests/media/video-src-invalid-remove.html
@@ -1,56 +1,24 @@
-<html>
- <head>
- <script src=media-file.js></script>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src=video-test.js></script>
-
-
- <script>
- function loadedmetadata()
- {
- failTest(relativeURL(video.currentSrc) + "loaded but should not" );
- consoleWrite("");
- }
-
- function errorEvent()
- {
- testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
-
- // "setTimeout()" is generally bad form in a layout test, but we need to verify
- // that changing the 'src' attribute does not do something that happens
- // asynchronously so we don't have a lot of options.
- setTimeout(function () { endTest(); }, 200) ;
- run("video.removeAttribute('src')");
- consoleWrite("");
- }
-
- function setup()
- {
- findMediaElement();
-
- video.src = "bogus.mov";
-
- var source = document.createElement("source");
- source.setAttribute("src", findMediaFile("video", "content/test"));
- video.appendChild(source);
-
- waitForEvent('loadedmetadata', loadedmetadata);
- waitForEvent('error', errorEvent);
- consoleWrite("");
- }
-
- </script>
- </head>
-<body onload="setup()">
-
- <video controls></video>
-
- <p>Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements</p>
-
- <script>
-
- </script>
-
-</body>
-</html>
+<!DOCTYPE html>
+<title>Test that removing "src" attribute does not trigger load of "source" elements.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+
+ video.onloadedmetadata = t.unreached_func();
+ video.onerror = t.step_func(function() {
+ assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
+
+ setTimeout(t.step_func_done(), 200);
+ video.removeAttribute("src");
+ });
+
+ video.src = "bogus.mov";
+ var source = document.createElement("source");
+ source.src = findMediaFile("video", "content/test");
+ video.appendChild(source);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698