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> |