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/fast/dom/shadow/scoped-events-by-ua-stopped.html

Issue 1641573002: Fix layout test for Event.scoped (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Styling Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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');
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698