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

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

Issue 2455943003: Backend for css rule tracking (Closed)
Patch Set: Backend for CSS Rule tracking. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b0f32ccd33cd823528fb119cd7c429b820b38f68
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list.html
@@ -0,0 +1,54 @@
+<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.startRuleUsageTracking", {}, () =>
+ { InspectorTest.sendCommandOrDie("CSS.stopRuleUsageTracking", {}, ruleListLoaded); });
+
+ function ruleListLoaded(result)
+ {
+ if(!result) {
+ next();
+ return;
+ }
+ var rules = result.ruleUsage;
+ var usedLines = rules.filter(rule => rule.used);
+ var unusedLines = rules.filter(rule => !rule.used);
+
+ usedLines.sort();
+ unusedLines.sort();
+ InspectorTest.log("=== Size of array: " + rules.length);
+ InspectorTest.log(" Number of used Rules: " + usedLines.length);
+ for(var line of usedLines)
+ InspectorTest.log(line.range.startLine);
+
+ InspectorTest.log(" Number of unused Rules: " + unusedLines.length);
+ for(var line of unusedLines)
+ InspectorTest.log(line.range.startLine);
+
+ 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>
+<div></div>
+
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/css/css-get-rule-list-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698