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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/leaktests/html-collection.html

Issue 1923043002: Import web-platform-tests@028d354aba4c8ee6700def957a45f3927241d8b0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix expectations after the test harness was updated Created 4 years, 8 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/web-platform-tests/shadow-dom/leaktests/html-collection.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/leaktests/html-collection.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/leaktests/html-collection.html
new file mode 100644
index 0000000000000000000000000000000000000000..5c35f6b66010464b0f5cff6d69626dab5f5afd8c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/shadow-dom/leaktests/html-collection.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta name='author' title='Google' href='http://www.google.com'>
+<meta name='assert' content='document attributes that returns HTMLCollection should not expose nodes in shadow tree.'>
+<link rel='help' href='https://w3c.github.io/webcomponents/spec/shadow/'>
+<script src='../../../../resources/testharness.js'></script>
+<script src='../../../../resources/testharnessreport.js'></script>
+</head>
+<body>
+<template id='collection-template'>
+ <img>
+ <embed></embed>
+ <plugin></plugin>
+ <applet></applet>
+ <object type='application/x-java-applet'></object>
+ <a href='http://example.com'></a>
+ <a name='test'></a>
+ <form name='test'></form>
+ <script></script>
+</template>
+<div id='doc'></div>
+<div id='host'></div>
+</body>
+<script>
+'use strict';
+
+function fillTemplate(root, prefix) {
+ var tmpl = document.getElementById('collection-template');
+ root.appendChild(document.importNode(tmpl.content, true));
+ for (var i = 0; i < root.childNodes.length; ++i) {
+ var el = root.childNodes[i];
+ if (el.nodeType != 1)
+ continue;
+ el.id = prefix + el.tagName.toLowerCase();
+ }
+}
+
+// Construct subtree with 'doc-*' ids.
+var doc = document.getElementById('doc');
+fillTemplate(doc, 'doc-');
+
+// Construct shadow subtree with 'shadow-*' ids.
+var host = document.getElementById('host');
+var shadow = host.attachShadow({mode: 'open'});
+fillTemplate(shadow, 'shadow-');
+
+function testCollection(collection) {
+ var elements = document[collection];
+ assert_greater_than(elements.length, 0, 'document.' + collection + ' should have at least 1 element.');
+ for (var i = 0; i < elements.length; ++i) {
+ if (elements[i].id) {
+ assert_equals(elements[i].id.indexOf('shadow-'), -1, 'document.' + collection + ' should not contain elements in shadow tree.');
+ }
+ }
+}
+
+var testParams = [
+ ['document.scripts should not contain shadow nodes', 'scripts'],
+ ['document.all should not contain shadow nodes', 'all'],
+ ['document.forms should not contain shadow nodes', 'forms'],
+ ['document.images should not contain shadow nodes', 'images'],
+ ['document.links should not contain shadow nodes', 'links'],
+ ['document.anchors should not contain shadow nodes', 'anchors'],
+ ['document.embeds should not contain shadow nodes', 'embeds'],
+ ['document.plugins should not contain shadow nodes', 'plugins'],
+ ['document.applets should not contain shadow nodes', 'applets']];
+
+generate_tests(testCollection, testParams);
+
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698