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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html

Issue 2296323002: DevTools: Add features to collect classnames from Stylesheets and DOM (Closed)
Patch Set: DevTools: Add features to collect classnames from Stylesheets and DOM Created 4 years, 3 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/inspector-protocol/dom/dom-collect-class-names.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html
new file mode 100644
index 0000000000000000000000000000000000000000..ccb090aa46a38703a5cf472fc0b1a9a98c36d2c7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html
@@ -0,0 +1,71 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script>
+
+function test()
+{
+ var rootNode;
+ var classNames= [];
+
+ InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+ InspectorTest.sendCommand("DOM.enable", {});
+ InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
+
+ function onGotDocument(msg)
+ {
+ rootNode = msg.result.root;
+ InspectorTest.sendCommandOrDie("DOM.collectClassNamesFromSubtree", { nodeId: rootNode.nodeId }, onClassNamesCollected);
+ }
+
+ function collectClassNamesFromSubtree()
+ {
+ InspectorTest.sendCommand("DOM.requestChildNodes", { nodeId: rootNode.children[0].children[1].nodeId }, null);
+ }
+
+ function setChildNodes(response)
+ {
+ var nodes = response.params.nodes;
+ InspectorTest.sendCommandOrDie("DOM.collectClassNamesFromSubtree", { nodeId: nodes[1].nodeId }, onSubtreeClassNamesCollected);
+ }
+
+ function onSubtreeClassNamesCollected(response)
+ {
+ var subtreeClassNames = response.classNames.sort();
+ InspectorTest.log("All class names: ");
+ for (var i = 0; i < classNames.length; i++)
+ InspectorTest.log(classNames[i]);
+ InspectorTest.log("Subtree class names: ");
+ for (var i = 0; i < subtreeClassNames.length; i++)
+ InspectorTest.log(subtreeClassNames[i]);
+
+ InspectorTest.completeTest();
+ }
+
+ function onClassNamesCollected(response)
+ {
+ classNames = response.classNames.sort();
+ collectClassNamesFromSubtree();
+ }
+}
+
+</script>
+</head>
+<body class="body-class">
+<div class="class1"></div>
+<div class="class2">
+ <ul class="class3">
+ <li class="class4"></li>
+ </ul>
+</div>
+<div class="class5 class6"></div>
+<div id="shadow-host"></div>
+<script type="text/javascript">
+ var host = document.querySelector("#shadow-host");
+ var root = host.createShadowRoot();
+ root.innerHTML = "<div class=\"shadow-class\"></div>";
+ runTest();
+</script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698