Skip to content
Permalink
Browse files
fast/dom/shadow/shadow-dom-event-dispatching.html flake
https://bugs.webkit.org/show_bug.cgi?id=103299

Reviewed by Jochen Eisinger.

This patch breaks fast/dom/shadow/shadow-dom-event-dispatching.html out
into 12 separate tests to avoid timeouts. Common logic for all these
dispatching tests is now in resources/event-dispatching.js, and each
individual test function now runs in its own HTML file.

* fast/dom/shadow/resources/event-dispatching.js: Added.
(moveMouseOver):
(recordEvent):
(dumpNode):
(dumpComposedShadowTree):
(addEventListeners):
(debugDispatchedEvent):
(moveMouse):
(showSandboxTree):
* fast/dom/shadow/shadow-dom-event-dispatching-child-of-inactive-content-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-child-of-inactive-content.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-details-summary-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-details-summary.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-child-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-child.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-text-node-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-text-node.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-fallback-nodes-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-fallback-nodes.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired-with-same-related-target-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired-with-same-related-target.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-multiple-shadow-roots-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-multiple-shadow-roots.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-nested-shadow-roots-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-nested-shadow-roots.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-non-distributed-nodes-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-non-distributed-nodes.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-svg-in-shadow-subtree-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-svg-in-shadow-subtree.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-text-node-in-shadow-root-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-text-node-in-shadow-root.html: Added.
    New tests!
* fast/dom/shadow/shadow-dom-event-dispatching-expected.txt: Removed.
* fast/dom/shadow/shadow-dom-event-dispatching.html: Removed.
* platform/chromium/TestExpectations:
    Dropped the old, monolithic test, and removed it from Chromium's
    TestExpectations file.


Canonical link: https://commits.webkit.org/128389@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mikewest committed Feb 18, 2013
1 parent 8ad4cfa commit 4e1bab0d840a9fed7310492757eedb0f01820cf5
Showing 29 changed files with 1,076 additions and 927 deletions.
@@ -1,3 +1,55 @@
2013-02-18 Mike West <mkwst@chromium.org>

fast/dom/shadow/shadow-dom-event-dispatching.html flake
https://bugs.webkit.org/show_bug.cgi?id=103299

Reviewed by Jochen Eisinger.

This patch breaks fast/dom/shadow/shadow-dom-event-dispatching.html out
into 12 separate tests to avoid timeouts. Common logic for all these
dispatching tests is now in resources/event-dispatching.js, and each
individual test function now runs in its own HTML file.

* fast/dom/shadow/resources/event-dispatching.js: Added.
(moveMouseOver):
(recordEvent):
(dumpNode):
(dumpComposedShadowTree):
(addEventListeners):
(debugDispatchedEvent):
(moveMouse):
(showSandboxTree):
* fast/dom/shadow/shadow-dom-event-dispatching-child-of-inactive-content-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-child-of-inactive-content.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-details-summary-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-details-summary.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-child-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-child.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-text-node-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-distributed-text-node.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-fallback-nodes-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-fallback-nodes.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired-with-same-related-target-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired-with-same-related-target.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-manually-fired.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-multiple-shadow-roots-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-multiple-shadow-roots.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-nested-shadow-roots-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-nested-shadow-roots.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-non-distributed-nodes-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-non-distributed-nodes.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-svg-in-shadow-subtree-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-svg-in-shadow-subtree.html: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-text-node-in-shadow-root-expected.txt: Added.
* fast/dom/shadow/shadow-dom-event-dispatching-text-node-in-shadow-root.html: Added.
New tests!
* fast/dom/shadow/shadow-dom-event-dispatching-expected.txt: Removed.
* fast/dom/shadow/shadow-dom-event-dispatching.html: Removed.
* platform/chromium/TestExpectations:
Dropped the old, monolithic test, and removed it from Chromium's
TestExpectations file.

2013-02-18 Christophe Dumez <ch.dumez@sisa.samsung.com>

Unreviewed EFL gardening.
@@ -0,0 +1,114 @@
description("Tests to ensure that event dispatching behaves as the Shadow DOM spec describes.");

var defaultPaddingSize = 40;

function moveMouseOver(element)
{
if (!window.eventSender || !window.internals)
return;

var x = element.offsetLeft + element.offsetWidth / 2;
var y;
if (element.hasChildNodes() || window.internals.shadowRoot(element))
y = element.offsetTop + defaultPaddingSize / 2;
else
y = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
}

var eventRecords = {};

function clearEventRecords()
{
eventRecords = {};
}

function dispatchedEvent(eventType)
{
var events = eventRecords[eventType];
if (!events)
return [];
return events;
}

function recordEvent(event)
{
var eventType = event.type
if (!eventRecords[eventType]) {
eventRecords[eventType] = []
}
var eventString = '';
if (event.currentTarget)
eventString += ' @' + event.currentTarget.id;
if (event.target)
eventString += ' (target: ' + event.target.id + ')';
if (event.relatedTarget)
eventString += ' (related: ' + event.relatedTarget.id + ')';
if (event.eventPhase == 1)
eventString += '(capturing phase)';
if (event.target && event.currentTarget && event.target.id == event.currentTarget.id)
shouldBe("event.eventPhase", "2", true);
eventRecords[eventType].push(eventString);
}

function dumpNode(node)
{
var output = node.nodeName + "\t";
if (node.id)
output += ' id=' + node.id;
if (node.className)
output += ' class=' + node.className;
return output;
}

function dumpComposedShadowTree(node, indent)
{
indent = indent || "";
var output = indent + dumpNode(node) + "\n";
var child;
for (child = internals.firstChildByWalker(node); child; child = internals.nextSiblingByWalker(child))
output += dumpComposedShadowTree(child, indent + "\t");
return output;
}

function addEventListeners(nodes)
{
for (var i = 0; i < nodes.length; ++i) {
var node = getNodeInShadowTreeStack(nodes[i]);
node.addEventListener('mouseover', recordEvent, false);
node.addEventListener('mouseout', recordEvent, false);
node.addEventListener('click', recordEvent, false);
// <content> might be an inactive insertion point, so style it also.
if (node.tagName == 'DIV' || node.tagName == 'DETAILS' || node.tagName == 'SUMMARY' || node.tagName == 'CONTENT')
node.setAttribute('style', 'padding-top: ' + defaultPaddingSize + 'px;');
}
}

function debugDispatchedEvent(eventType)
{
debug('\n ' + eventType);
var events = dispatchedEvent(eventType);
for (var i = 0; i < events.length; ++i)
debug(' ' + events[i])
}

function moveMouse(oldElementId, newElementId)
{
clearEventRecords();
debug('\n' + 'Moving mouse from ' + oldElementId + ' to ' + newElementId);
moveMouseOver(getNodeInShadowTreeStack(oldElementId));

clearEventRecords();
moveMouseOver(getNodeInShadowTreeStack(newElementId));

debugDispatchedEvent('mouseout');
debugDispatchedEvent('mouseover');
}

function showSandboxTree()
{
var sandbox = document.getElementById('sandbox');
sandbox.offsetLeft;
debug('\n\nComposed Shadow Tree will be:\n' + dumpComposedShadowTree(sandbox));
}

@@ -0,0 +1,35 @@
Tests to ensure that event dispatching behaves as the Shadow DOM spec describes.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".




Composed Shadow Tree will be:
DIV id=sandbox
DIV id=top
DIV id=A
DIV id=B
DIV id=parent-of-inactive-content
CONTENT id=inactive-content
DIV id=child-of-inactive-content


Moving mouse from A to child-of-inactive-content

mouseout
@A (target: A) (related: child-of-inactive-content)
@top (target: A) (related: child-of-inactive-content)

mouseover
@child-of-inactive-content (target: child-of-inactive-content) (related: A)
@inactive-content (target: child-of-inactive-content) (related: A)
@parent-of-inactive-content (target: child-of-inactive-content) (related: A)
@active-content (target: child-of-inactive-content) (related: A)
@shadow-root-B (target: child-of-inactive-content) (related: A)
@B (target: child-of-inactive-content) (related: A)
@top (target: child-of-inactive-content) (related: A)
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/shadow-dom.js"></script>
<script src="resources/event-dispatching.js"></script>
</head>
<body>
<p id="description"></p>
<div id="sandbox"></div>
<pre id="console"></pre>
<script>
var sandbox = document.getElementById('sandbox');

sandbox.appendChild(
createDOM('div', {'id': 'top'},
createDOM('div', {'id': 'A'}),
createDOM('div', {'id': 'B'},
createShadowRoot(
createDOM('content', {'id': 'active-content', 'select': '#parent-of-inactive-content'})),
createDOM('div', {'id': 'parent-of-inactive-content'},
createDOM('content', {'id': 'inactive-content'},
createDOM('div', {'id': 'child-of-inactive-content'}))))));

addEventListeners(['top', 'A', 'B', 'B/', 'B/active-content',
'parent-of-inactive-content', 'inactive-content', 'child-of-inactive-content']);
getNodeInShadowTreeStack('B/').id = 'shadow-root-B';
showSandboxTree();
moveMouse('A', 'child-of-inactive-content');
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>

@@ -0,0 +1,40 @@
Tests to ensure that event dispatching behaves as the Shadow DOM spec describes.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".




Composed Shadow Tree will be:
DIV id=sandbox
DIV id=top
DETAILS id=details
SUMMARY id=summary
DIV


Moving mouse from details to summary

mouseout
@details (target: details) (related: summary)
@top (target: details) (related: summary)

mouseover
@summary (target: summary) (related: details)
@details (target: summary) (related: details)
@top (target: summary) (related: details)

Moving mouse from summary to details

mouseout
@summary (target: summary) (related: details)
@details (target: summary) (related: details)
@top (target: summary) (related: details)

mouseover
@details (target: details) (related: summary)
@top (target: details) (related: summary)
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/shadow-dom.js"></script>
<script src="resources/event-dispatching.js"></script>
</head>
<body>
<p id="description"></p>
<div id="sandbox"></div>
<pre id="console"></pre>
<script>
var sandbox = document.getElementById('sandbox');

sandbox.appendChild(
createDOM('div', {'id': 'top'},
// 'details/summary' elements use Shadow DOM in its implementation.
createDOM('details', {'id': 'details', 'open': true},
createDOM('summary', {'id': 'summary'}))));

addEventListeners(['top', 'details', 'summary']);
showSandboxTree();

moveMouse('details', 'summary');
moveMouse('summary', 'details');
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>

@@ -0,0 +1,60 @@
Tests to ensure that event dispatching behaves as the Shadow DOM spec describes.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".




Composed Shadow Tree will be:
DIV id=sandbox
DIV id=top
DIV id=shadow-host
DIV id=distributed-light-child
DIV id=shadow-root-child


Moving mouse from shadow-host to shadow-host/shadow-root-child

mouseout

mouseover
@shadow-root-child (target: shadow-root-child) (related: shadow-host)
@shadow-root (target: shadow-root-child) (related: shadow-host)

Moving mouse from shadow-host/shadow-root-child to shadow-host

mouseout
@shadow-root-child (target: shadow-root-child) (related: shadow-host)
@shadow-root (target: shadow-root-child) (related: shadow-host)

mouseover

Moving mouse from shadow-host to distributed-light-child

mouseout
@shadow-host (target: shadow-host)
@top (target: shadow-host)

mouseover

Moving mouse from distributed-light-child to shadow-host

mouseout

mouseover

Moving mouse from shadow-host/shadow-root-child to distributed-light-child

mouseout

mouseover

Moving mouse from distributed-light-child to shadow-host/shadow-root-child

mouseout

mouseover
PASS successfullyParsed is true

TEST COMPLETE

0 comments on commit 4e1bab0

Please sign in to comment.