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

Unified Diff: third_party/WebKit/LayoutTests/media/video-source-error.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-source-error-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/video-source-error.html
diff --git a/third_party/WebKit/LayoutTests/media/video-source-error.html b/third_party/WebKit/LayoutTests/media/video-source-error.html
index 8febec3b416a857eecaf0c9b5fc14bf6f045d7c9..46a5a5495012af2cf253c0acf59edce95896f86d 100644
--- a/third_party/WebKit/LayoutTests/media/video-source-error.html
+++ b/third_party/WebKit/LayoutTests/media/video-source-error.html
@@ -1,78 +1,40 @@
-<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>
- <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>
-
- var sources = [];
-
- function loadeddata()
- {
- consoleWrite("");
- testExpected("relativeURL(video.currentSrc)", findMediaFile("video", "content/test"));
- testExpected("video.error", null);
- consoleWrite("");
- endTest();
- }
-
- function errorEvent(evt)
- {
- var ndx;
- for (ndx = 0; ndx < sources.length; ndx++) {
- if (sources[ndx] == evt.target)
- break;
- }
-
- if (sources[ndx] == evt.target)
- logResult(true, "EVENT(error) from &lt;source id='<em>" + evt.target.id + "</em>' src='<em>" + relativeURL(evt.target.src) + "</em>'&gt;");
- else
- logResult(false, "EVENT(error) from " + evt.target);
-
- testExpected("video.error", null);
- consoleWrite("");
- }
-
- function start()
- {
- findMediaElement();
-
- sources = document.getElementsByTagName('source');
-
- document.addEventListener("error", errorEvent, true);
- waitForEvent("loadstart");
- waitForEvent("waiting");
- waitForEvent("ratechange");
- waitForEvent("durationchange");
- waitForEvent("pause");
- waitForEvent("play");
- waitForEvent("playing");
-
- waitForEvent('loadeddata', loadeddata);
- }
- </script>
- </head>
-
- <body>
-
- <video controls>
- <source id=missing-src type="video/blahblah">
- <source id=bogus-type src=content/test.mp4 type="video/blahblah">
- <source id=missing-file src=content/error2.mpeg type=video/mpeg>
- <source id=format-error src="content/unsupported_track.mov">
- <source id=supported-format-mp4 src=content/test.mp4 type="video/mp4; codecs=&quot;avc1.4D400C&quot;">
- <source id=supported-format-ogv src=content/test.ogv type="video/ogg">
- </video>
-
- <p>1. Test that errors fired while evaluating/loading &lt;source&gt; elements are fired at the
- &lt;source&gt; and not at the &lt;video&gt; element.
- <br>2. Verifiy that an 'error' event fired while processing/loading a &lt;source&gt; element
- does not set the media element's 'error' attribute.</p>
-
- <script>start()</script>
- </body>
-</html>
+<!DOCTYPE html>
+<title>Test "error" event are fired on "source" elements and not on "video" while processing invalid "source" elements.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video>
+ <source id="missing-src" type="video/blahblah"></source>
+ <source id="bogus-type" src="content/test.mp4" type="video/blahblah"></source>
+ <source id="missing-file" src="content/error2.mpeg" type="video/mpeg"></source>
+ <source id="format-error" src="content/unsupported_track.mov"></source>
+ <source id="supported-format-mp4" src="content/test.mp4" type="video/mp4; codecs=&quot;avc1.4D400C&quot;"></source>
+ <source id="supported-format-ogv" src="content/test.ogv" type="video/ogg"></source>
+</video>
+<script>
+// 1. Test that errors fired while evaluating/loading "source elements are
+// fired at the "source" and not at the "video" element.
+// 2. Verifiy that an "error" event fired while processing/loading a "source" element
+// does not set the media element's "error" attribute.
+async_test(function(t) {
+ var video = document.querySelector("video");
+
+ document.addEventListener("error", function(event) {
+ assert_true(event.target instanceof HTMLSourceElement);
+ }, true);
+
+ video.onloadstart = t.step_func(function() {});
+ video.onwaiting = t.step_func(function() {});
+ video.onratechange = t.step_func(function() {});
+ video.ondurationchange = t.step_func(function() {});
+ video.onpause = t.step_func(function() {});
+ video.onplay = t.step_func(function() {});
+ video.onplaying = t.step_func(function() {});
+ video.onerror = t.unreached_func();
+
+ video.onloadeddata = t.step_func_done(function() {
+ var url = video.currentSrc;
+ assert_equals(url.substr(url.lastIndexOf("/media/") + 7), findMediaFile("video", "content/test"));
+ });
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-source-error-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698