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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/img.loadend.html

Issue 2247073006: Add loadend event when finishing loading image Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/imported/wpt/html/semantics/embedded-content/the-img-element/img.loadend.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/img.loadend.html b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/img.loadend.html
new file mode 100644
index 0000000000000000000000000000000000000000..3b0f25ecaacfefc0e427aab69d15ed11b74e9c98
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/img.loadend.html
@@ -0,0 +1,29 @@
+<!doctype html>
Mike West 2016/08/18 08:38:39 Creating a new imported test seems wrong. I'd sugg
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<img id=wrong />
+<img id=right />
+<script>
+async_test(function(t) {
+ var img = document.getElementById("wrong");
+ img.src = "wrong-img.jpg";
+ var errorevent = false;
+
+ img.addEventListener('error', t.step_func(function(){errorevent = true;}));
Mike West 2016/08/18 08:38:39 Style nit: The function should be split across lin
+ img.addEventListener('loadend', t.step_func_done(function() {
+ assert_true(errorevent, "error event fired");
+ }));
+} , "loading wrong URL as an image should silently fail, first fire error event, then fire loadend event.");
+
+async_test(function(t) {
+ var img = document.getElementById("right");
+ img.src = "image-1.jpg";
+ var loadevent = false;
+
+ img.addEventListener('load', t.step_func(function(){loadevent = true;}));
Mike West 2016/08/18 08:38:39 Style nit: Ditto.
+ img.addEventListener('loadend', t.step_func_done(function() {
+ assert_true(loadevent, "load event fired");
+ }));
+}, "loading right URL as an image should silently success, first fire load event, then fire loadend event.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698