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.startRuleUsageTracking", {}, () => | |
| 16 { InspectorTest.sendCommandOrDie("CSS .stopRuleUsageTracking", {}, ruleListLoaded); }); | |
| 17 | |
| 18 function ruleListLoaded(result) | |
| 19 { | |
| 20 if(!result) { | |
| 21 next(); | |
| 22 return; | |
| 23 } | |
| 24 var rules = result.ruleUsage; | |
| 25 var usedLines = rules.filter(rule => rule.used), unusedLines = r ules.filter(rule => !rule.used); | |
|
pfeldman
2016/11/03 21:23:30
Single statement per line please.
| |
| 26 | |
| 27 usedLines.sort(); | |
| 28 unusedLines.sort(); | |
| 29 InspectorTest.log("=== Size of array: " + rules.length); | |
| 30 InspectorTest.log(" Number of used Rules: " + usedLines.length ); | |
| 31 for(var i = 0; i < usedLines.length; ++i) | |
|
pfeldman
2016/11/03 21:23:30
You can use for (var line of usedLines)
| |
| 32 InspectorTest.log(usedLines[i].range.startLine); | |
| 33 | |
| 34 InspectorTest.log(" Number of unused Rules: " + unusedLines.le ngth); | |
| 35 for(var i = 0; i < unusedLines.length; ++i) | |
|
pfeldman
2016/11/03 21:23:30
ditto
| |
| 36 InspectorTest.log(unusedLines[i].range.startLine); | |
| 37 | |
| 38 next(); | |
| 39 } | |
| 40 } | |
| 41 ]; | |
| 42 } | |
| 43 | |
| 44 </script> | |
| 45 <link rel="stylesheet" href="resources/get-rule-list.css"> | |
| 46 </head> | |
| 47 <body onload="runTest();"> | |
| 48 <h1 class="class">Class Selector</h1> | |
| 49 <p id="id">ID Selector</p> | |
| 50 <div></div> | |
| 51 | |
| 52 </body> | |
| 53 </html> | |
| OLD | NEW |