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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list.html

Issue 2455943003: Backend for css rule tracking (Closed)
Patch Set: Created 4 years, 2 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-get-rule-list.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list.html b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list.html
new file mode 100644
index 0000000000000000000000000000000000000000..deb8c47eda9a3574e5cda9f0f561b9823a2c3eec
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list.html
@@ -0,0 +1,71 @@
+<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()
+{
+ InspectorTest.sendCommandOrDie("DOM.enable", {});
+ InspectorTest.sendCommandOrDie("CSS.enable", {}, () => InspectorTest.runTestSuite(testSuite));
+
+ var testSuite = [
+ function testGetRuleListAfterStartingRecording(next)
+ {
+ InspectorTest.sendCommandOrDie("CSS.setSelectorRecording", { enable: true }, () =>
+ { InspectorTest.sendCommandOrDie("CSS.getRuleList", {}, ruleListLoaded); });
+
+ function ruleListLoaded(result)
+ {
+ if(!result) {
+ next();
+ return;
+ }
+ var rules = result.usedCSSRules, lines = [];
+
+ for (var i = 0; i < rules.length; ++i)
+ lines.push(rules[i].style.range.startLine);
+ lines.sort();
+ InspectorTest.log("=== Size of array: " + rules.length);
+ for(var i = 0; i < lines.length; ++i)
+ InspectorTest.log(lines[i]);
+
+ next();
+ }
+ },
+
+ function testGetRuleListWithoutStartingRecording(next)
+ {
+ InspectorTest.sendCommandOrDie("CSS.getRuleList", {}, ruleListLoaded);
+
+ function ruleListLoaded(result)
+ {
+ if(!result) {
+ next();
+ return;
+ }
+ var rules = result.usedCSSRules, lines = [];
+
+ for (var i = 0; i < rules.length; ++i)
+ lines.push(rules[i].style.range.startLine);
+ lines.sort();
+ InspectorTest.log("=== Size of array: " + rules.length);
+ for(var i = 0; i < lines.length; ++i)
+ InspectorTest.log(lines[i]);
+
+ next();
+ };
+
+ }
+ ];
+}
+
+</script>
+<link rel="stylesheet" href="resources/get-rule-list.css">
+</head>
+<body onload="runTest();">
+<h1 class="class">Class Selector</h1>
+<p id="id">ID Selector</p>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698