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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/css/css-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/css/css-collect-class-names.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/css/css-collect-class-names.html b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-collect-class-names.html
new file mode 100644
index 0000000000000000000000000000000000000000..a73157a2ed01ed2d979d0bff406e5469802b8c7a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-collect-class-names.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/css-protocol-test.js"></script>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
+<script type="text/javascript">
+
+function test()
+{
+ var documentNodeId;
+ var addedStyleSheetCount = 0;
+ var styleSheetClasses = [];
+ InspectorTest.requestDocumentNodeId(onDocumentNodeId);
+ function onDocumentNodeId(nodeId)
+ {
+ InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
+ InspectorTest.sendCommandOrDie("CSS.enable", {});
+ }
+
+ function styleSheetAdded(response)
+ {
+ var styleSheetId = response.params.header.styleSheetId;
+ InspectorTest.sendCommandOrDie("CSS.collectClassNames", { styleSheetId: styleSheetId }, onClassNamesCollected);
+ }
+
+ function finalizeTest()
+ {
+ styleSheetClasses.sort();
+ for (var i = 0; i < styleSheetClasses.length; i++)
+ InspectorTest.log(styleSheetClasses[i]);
+ InspectorTest.completeTest();
+ }
+
+ function onClassNamesCollected(response)
+ {
+ var classNames = response.classNames;
+ for (var i=0; i < classNames.length; i++)
+ styleSheetClasses.push(classNames[i]);
+
+ if (++addedStyleSheetCount == 3)
+ finalizeTest();
+ }
+};
+
+window.addEventListener("DOMContentLoaded", function () {
+ runTest();
+}, false);
+
+</script>
+<link rel="stylesheet" href="resources/collect-class-names.css"/>
+<style>
+.inline1 {
+ font-size: 12px;
+}
+</style>
+</head>
+<body>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698