Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/shadow/scoped-events-by-ua-stopped.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/scoped-events-by-ua-stopped.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/scoped-events-by-ua-stopped.html |
| index a06786ced5b1d9d0a62829c87405851c346232f8..396d4b26fcc0c76e3dafe3cecb0e728304c4e8fb 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/dom/shadow/scoped-events-by-ua-stopped.html |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/scoped-events-by-ua-stopped.html |
| @@ -2,72 +2,68 @@ |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <script src="resources/shadow-dom.js"></script> |
| -<img id="img" src="../../images/resources/test-load.jpg"> |
| +<img id="img" src="../../images/resources/test-load.jpg" onload="loadScopeTest()" onerror="imgLoadTest()"> |
|
kochi
2016/01/28 07:01:12
There's still a chance that these handlers are nev
yuzuchan
2016/02/01 08:42:48
Done.
|
| <div id="sandbox"> |
| - <div id = "host"> |
| + <div id = "host" onload="loadStopTest()" onerror="errorBubbleTest()"> |
| <template> |
| - <img id="target" src="../../images/resources/test-load.jpg"> |
| + <img id="target" onload="loadStopTest()" onerror="errorBubbleTest()"> |
| </template> |
| </div> |
| </div> |
| <script> |
| -setup({ explicit_done: true }); |
| var e; |
| test(function() { |
| e = new Event('test'); |
| assert_equals(e.scoped, false); |
| -}, "A new event's scoped value should be set to false by default."); |
| +}, 'A new events scoped value should be set to false by default.'); |
|
kochi
2016/01/28 07:01:12
FYI - you can quote a single quote in a string lik
yuzuchan
2016/02/01 08:42:48
Done.
|
| test(function() { |
| e = new Event('test', { scoped: true }); |
| assert_equals(e.scoped, true); |
| }, 'Users should be able to set a scoped value.'); |
| -img.onload = function(e) { |
| +function loadScopeTest() { |
| test(function() { |
| - assert_equals(e.scoped, true); |
| - }, "UA load event's scoped should be set to true"); |
| -}; |
| + assert_equals(event.scoped, true); |
|
kochi
2016/01/28 07:01:12
Where is this |event| coming from?
s/loadScopedTe
yuzuchan
2016/02/01 08:42:49
Done.
|
| + }, 'UA load events scoped should be set to true.'); |
| +} |
| + |
| +function imgLoadTest() { |
| + test(function() { |
| + assert_true(false); |
| + }, 'Image should be loaded.'); |
| +} |
| var resultNonTrusted = []; |
| -function addEventListeners(nodes) |
| -{ |
| - for (var i = 0; i < nodes.length; ++i) { |
| - var node = getNodeInTreeOfTrees(nodes[i]); |
| - node.addEventListener('load', recordEvent, false); |
| - node.addEventListener('error', recordEvent, false); |
| +function loadStopTest() { |
| + if (event.currentTarget.id == 'host'){ |
| + test(function() { |
| + assert_true(false); |
| + }, 'Load event should be stopped if created by UAs.'); |
| + } else { |
| + test(function() { |
|
kochi
2016/01/28 07:01:12
I don't think this test addresses original concern
yuzuchan
2016/02/01 08:42:49
Done.
|
| + assert_equals(event.currentTarget.id, 'target'); |
| + }, 'Event fired in the right place.'); |
| } |
| } |
| -function recordEvent(event) |
| -{ |
| - if (event.type == 'load') { |
| - if (event.currentTarget.id == 'host'){ |
| - test(function() { |
| - assert_true(false); |
| - }, "Load event should be stopped if created by UAs."); |
| - } else { |
| - test(function() { |
| - assert_equals(event.currentTarget.id, 'target'); |
| - }, "Event fired in the right place."); |
| - } |
| - } |
| - if (event.type == 'error') { |
| - resultNonTrusted.push(event.currentTarget.id); |
| - if (resultNonTrusted.length == 2) { |
| - test(function() { |
| - assert_array_equals(resultNonTrusted, ['target', 'host']); |
| - }, "Only certain trusted events should stop in bubbling."); |
| - done(); |
| - } |
| +function errorBubbleTest() { |
| + test(function() { |
| + if (event.isTrusted) |
| + assert_true(false); |
| + }, 'Image should be loaded.'); |
| + resultNonTrusted.push(event.currentTarget.id); |
| + if (resultNonTrusted.length == 2) { |
| + test(function() { |
| + assert_array_equals(resultNonTrusted, ['target', 'host']); |
| + }, 'Only certain trusted events should stop in bubbling.'); |
| } |
| } |
| var sandbox = document.getElementById('sandbox'); |
| convertTemplatesToShadowRootsWithin(sandbox); |
| var targetImg = getNodeInTreeOfTrees('host/target'); |
| -addEventListeners(['host', 'host/target']); |
| targetImg.setAttribute('src', '../../images/resources/lenna.jpg'); |
| var userError = new Event('error'); |