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

Unified Diff: third_party/WebKit/LayoutTests/media/video-source-error-no-candidate.html

Issue 2121453003: Convert video-source-error* and video-source-inserted* 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-source-error-no-candidate.html
diff --git a/third_party/WebKit/LayoutTests/media/video-source-error-no-candidate.html b/third_party/WebKit/LayoutTests/media/video-source-error-no-candidate.html
index 487c647aa8d34073df658bc244df40f2fe3e784c..8cfdc9ed6234b79f8d7db7aace45d15a2fad5576 100644
--- a/third_party/WebKit/LayoutTests/media/video-source-error-no-candidate.html
+++ b/third_party/WebKit/LayoutTests/media/video-source-error-no-candidate.html
@@ -1,62 +1,23 @@
-<html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>&lt;video&gt; and &lt;source&gt; error test</title>
- <!-- 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>
-
- var sources = [];
- var errorCount = 0;
- var expectedErrorCount = 4;
-
- function errorEvent(evt)
- {
- consoleWrite("");
-
- var ndx;
- for (ndx = 0; ndx < sources.length; ndx++) {
- if (sources[ndx] == evt.target)
- break;
- }
-
- var src = sources[ndx].getAttribute('src') == null ? "null" : "'" + relativeURL(evt.target.src) + "'";
- if (sources[ndx] == evt.target)
- logResult(true, "EVENT(error) from &lt;source id='<em>" + evt.target.id + "</em>' src=<em>" + src + "</em>&gt;");
- else
- logResult(false, "EVENT(error) from " + evt.target);
-
- testExpected("video.error", null);
-
- if (++errorCount == expectedErrorCount) {
- consoleWrite("");
- setTimeout(endTest, 200);
- }
- }
-
- function start()
- {
- document.addEventListener("error", errorEvent, true);
-
- sources = document.getElementsByTagName('source');
-
- findMediaElement();
- }
- </script>
- </head>
-
- <body>
-
- <video onloadstart="start()" controls>
- <source id=missing-src type="video/blahblah">
- <source id=bogus-type src=content/test.ogv type="video/blahblah">
- <source id=empty-src src="" type="video/ogg">
- <source id=no-extension-no-type src=nonexistent>
- </video>
-
- <p>Test that 'error' events are fired from &lt;source&gt; element when it can not be used.</p>
-
- </body>
-</html>
+<!DOCTYPE html>
+<title>Test that "error" event is fired from "source" element when it can not be used.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<video>
+ <source id="missing-src" type="video/blahblah"></source>
+ <source id="bogus-type" src="content/test.ogv" type="video/blahblah"></source>
+ <source id="empty-src" src="" type="video/ogg"></source>
+ <source id="no-extension-no-type" src="nonexistent"></source>
+</video>
+<script>
+async_test(function(t) {
+ var errorCount = 0;
+ document.addEventListener("error", function(event) {
+ assert_true(event.target instanceof HTMLSourceElement);
+ assert_equals(document.querySelector("video").error, null);
+ assert_less_than(errorCount, 4);
+
+ if (++errorCount == 4)
+ setTimeout(t.step_func_done(), 200);
+ }, true);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698