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

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

Issue 2408493002: Import wpt@357b83b809e3cbc7a1805e7c3ca108a7980d782f (Closed)
Patch Set: Added one more win7-specific baseline Created 4 years, 2 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/invalid-src.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/invalid-src.html b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/invalid-src.html
index a4323da4b877321bc3315e65a30e7f9bc92724eb..f1fbe34c596879fa301e9b65e4b481f12f6f29e9 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/invalid-src.html
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-img-element/invalid-src.html
@@ -3,10 +3,11 @@
<title>Loading a non-parsing URL as an image should silently fail; triggering appropriate events</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-<img id=myimg />
+<img id=brokenurl />
+<img id=emptysrc />
<script>
async_test(function(t) {
- var img = document.getElementById("myimg");
+ var img = document.getElementById("brokenurl");
img.src = "http://also a broken url";
var errorevent = false;
@@ -16,6 +17,26 @@ async_test(function(t) {
img.addEventListener('loadend', t.step_func_done(function() {
assert_true(errorevent, "error event fired");
}));
-});
+}, 'src="http://also a broken url"');
+
+async_test(function(t) {
+ var img = document.getElementById("emptysrc");
+ img.src = "";
+ var loadendevent = false;
+
+ // Setting src to empty string triggers only error event.
+ // The errors should be queued in the event loop, so they should only trigger
+ // after this block of code finishes, not during the img.src setter itself
+ img.addEventListener('error', t.step_func(function() {
+ // Queue this check in the event loop to check there is no loadend event
+ // fired.
+ t.step_timeout(t.step_func_done(function() {
+ assert_false(loadendevent, "loadend event should not fired");
+ }), 0)
+ }));
+ img.addEventListener('loadend', t.step_func(function() {
+ loadendevent = true;
+ }));
+}, 'src=""');
</script>

Powered by Google App Engine
This is Rietveld 408576698