| 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.usedCSSRules, lines = []; |
| 25 |
| 26 for (var i = 0; i < rules.length; ++i) |
| 27 lines.push(rules[i].style.range.startLine); |
| 28 lines.sort(); |
| 29 InspectorTest.log("=== Size of array: " + rules.length); |
| 30 for(var i = 0; i < lines.length; ++i) |
| 31 InspectorTest.log(lines[i]); |
| 32 |
| 33 next(); |
| 34 } |
| 35 }, |
| 36 |
| 37 function testGetRuleListWithoutStartingRecording(next) |
| 38 { |
| 39 InspectorTest.sendCommandOrDie("CSS.getRuleList", {}, ruleListLoaded
); |
| 40 |
| 41 function ruleListLoaded(result) |
| 42 { |
| 43 if(!result) { |
| 44 next(); |
| 45 return; |
| 46 } |
| 47 var rules = result.usedCSSRules, lines = []; |
| 48 |
| 49 for (var i = 0; i < rules.length; ++i) |
| 50 lines.push(rules[i].style.range.startLine); |
| 51 lines.sort(); |
| 52 InspectorTest.log("=== Size of array: " + rules.length); |
| 53 for(var i = 0; i < lines.length; ++i) |
| 54 InspectorTest.log(lines[i]); |
| 55 |
| 56 next(); |
| 57 }; |
| 58 |
| 59 } |
| 60 ]; |
| 61 } |
| 62 |
| 63 </script> |
| 64 <link rel="stylesheet" href="resources/get-rule-list.css"> |
| 65 </head> |
| 66 <body onload="runTest();"> |
| 67 <h1 class="class">Class Selector</h1> |
| 68 <p id="id">ID Selector</p> |
| 69 |
| 70 </body> |
| 71 </html> |
| OLD | NEW |