| 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); |
| 26 var unusedLines = rules.filter(rule => !rule.used); |
| 27 |
| 28 usedLines.sort(); |
| 29 unusedLines.sort(); |
| 30 InspectorTest.log("=== Size of array: " + rules.length); |
| 31 InspectorTest.log(" Number of used Rules: " + usedLines.length
); |
| 32 for(var line of usedLines) |
| 33 InspectorTest.log(line.range.startLine); |
| 34 |
| 35 InspectorTest.log(" Number of unused Rules: " + unusedLines.le
ngth); |
| 36 for(var line of unusedLines) |
| 37 InspectorTest.log(line.range.startLine); |
| 38 |
| 39 next(); |
| 40 } |
| 41 } |
| 42 ]; |
| 43 } |
| 44 |
| 45 </script> |
| 46 <link rel="stylesheet" href="resources/get-rule-list.css"> |
| 47 </head> |
| 48 <body onload="runTest();"> |
| 49 <h1 class="class">Class Selector</h1> |
| 50 <p id="id">ID Selector</p> |
| 51 <div></div> |
| 52 |
| 53 </body> |
| 54 </html> |
| OLD | NEW |