Chromium Code Reviews| OLD | NEW |
|---|---|
| (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> | |
| OLD | NEW |