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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js

Issue 2051373002: Rewrite and organize tests in LayoutTests/shadow-dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean-test2-3
Patch Set: clean up Created 4 years, 6 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/shadow-dom/resources/shadow-dom.js
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js b/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
index c11861a1321ad0fb2cd6a5336233d5f9105bb0b8..65d05966661db95fa33bdac1d860531750f3b652 100644
--- a/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
+++ b/third_party/WebKit/LayoutTests/shadow-dom/resources/shadow-dom.js
@@ -72,7 +72,13 @@ function createTestTree(node) {
function attachShadowFromTemplate(template) {
let parent = template.parentNode;
parent.removeChild(template);
- let shadowRoot = parent.attachShadow({mode: template.getAttribute('data-mode')});
+ let shadowRoot;
+ if (template.getAttribute('data-mode') === 'v0') {
+ // For legacy Shadow DOM
+ shadowRoot = parent.createShadowRoot();
+ } else {
+ shadowRoot = parent.attachShadow({mode: template.getAttribute('data-mode')});
+ }
let id = template.id;
if (id) {
shadowRoot.id = id;
@@ -158,6 +164,26 @@ function dispatchUAEventWithLog(nodes, target, eventType, callback) {
return log;
}
+function makeExpectedEventPathLog(path) {
+ let expectedLog = [];
+ for (let i of path) {
+ expectedLog.push([i, null, path]);
+ }
+ return expectedLog;
+}
+
+function debugEventLog(log) {
+ for (let i = 0; i < log.length; i++) {
+ console.log('[' + i + '] currentTarget: ' + log[i][0] + ' relatedTarget: ' + log[i][1] + ' composedPath(): ' + log[i][2]);
+ }
+}
+
+function debugCreateTestTree(nodes) {
+ for (let k in nodes) {
+ console.log(k + ' -> ' + nodes[k]);
+ }
+}
+
// This function assumes that testharness.js is available.
function assert_event_path_equals(actual, expected) {
assert_equals(actual.length, expected.length);

Powered by Google App Engine
This is Rietveld 408576698