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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-prot ocol-test.js"></script>
5 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot ocol-test.js"></script>
6 <script type="text/javascript">
7 function test()
8 {
9 InspectorTest.sendCommandOrDie("DOM.enable", {});
10 InspectorTest.sendCommandOrDie("CSS.enable", {}, () => InspectorTest.runTest Suite(testSuite));
11
12 var testSuite = [
13 function testGetRuleListAfterStartingRecording(next)
14 {
15 InspectorTest.sendCommandOrDie("CSS.setSelectorRecording", { enable: true }, () =>
16 { InspectorTest.sendCommandOrDie("CSS .getRuleList", {}, ruleListLoaded); });
17
18 function ruleListLoaded(result)
19 {
20 if(!result) {
21 next();
22 return;
23 }
24 var rules = result.CSSRules, usedLines = [], unusedLines = [];
caseq 2016/10/31 19:06:05 nit: var usedLines = rules.filter(rule => rule.us
25
26 for (var i = 0; i < rules.length; ++i)
27 {
28 if(rules[i].status)
29 usedLines.push(rules[i].range.startLine);
30 else
31 unusedLines.push(rules[i].range.startLine);
32 }
33 usedLines.sort();
34 unusedLines.sort();
35 InspectorTest.log("=== Size of array: " + rules.length);
36 InspectorTest.log(" Number of used Rules: " + usedLines.length );
37 for(var i = 0; i < usedLines.length; ++i)
38 InspectorTest.log(usedLines[i]);
39
40 InspectorTest.log(" Number of unused Rules: " + unusedLines.le ngth);
41 for(var i = 0; i < unusedLines.length; ++i)
42 InspectorTest.log(unusedLines[i]);
43
44 next();
45 }
46 }
47 ];
48 }
49
50 </script>
51 <link rel="stylesheet" href="resources/get-rule-list.css">
52 </head>
53 <body onload="runTest();">
54 <h1 class="class">Class Selector</h1>
55 <p id="id">ID Selector</p>
56 <div></div>
57
58 </body>
59 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698