| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script src="../../http/tests/inspector/debugger-test.js"></script> | 5 <script src="../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script src="../../http/tests/inspector/sources-test.js"></script> | 6 <script src="../../http/tests/inspector/sources-test.js"></script> |
| 7 | 7 |
| 8 <link rel="stylesheet" type="text/css" href="resources/highlight-in-source.css"> | 8 <link rel="stylesheet" type="text/css" href="resources/highlight-in-source.css"> |
| 9 <script> | 9 <script> |
| 10 | 10 |
| 11 var initialize_CSSTracker = function() { | 11 var initialize_CSSTracker = function() { |
| 12 InspectorTest.preloadModule("css_tracker"); | 12 InspectorTest.preloadModule("css_tracker"); |
| 13 } | 13 } |
| 14 | 14 |
| 15 function test() | 15 function test() |
| 16 { | 16 { |
| 17 InspectorTest.runTestSuite([ | 17 InspectorTest.runTestSuite([ |
| 18 function testMarking(next) | 18 function testMarking(next) |
| 19 { | 19 { |
| 20 var tracker = self.runtime.sharedInstance(CSSTracker.CSSTrackerView)
; | 20 var tracker = self.runtime.sharedInstance(CSSTracker.CSSTrackerView)
; |
| 21 InspectorTest.addSniffer(CSSTracker.CSSTrackerView.prototype, "_rend
erRuleUsage", printResults); | 21 InspectorTest.addSniffer(CSSTracker.CSSTrackerView.prototype, "_upda
teGutter", printResults); |
| 22 | 22 |
| 23 tracker._toggleRecording(true); | 23 tracker._toggleRecording(true); |
| 24 UI.viewManager.showView("css_tracker"); | 24 UI.viewManager.showView("css_tracker"); |
| 25 tracker._toggleRecording(false); | 25 tracker._toggleRecording(false); |
| 26 | 26 |
| 27 function printResults() | 27 function printResults() |
| 28 { | 28 { |
| 29 UI.inspectorView.showPanel("sources").then(showSource); | 29 UI.inspectorView.showPanel("sources").then(showSource); |
| 30 } | 30 } |
| 31 | 31 |
| 32 function showSource() | 32 function showSource() |
| 33 { | 33 { |
| 34 InspectorTest.showScriptSource("highlight-in-source.css", waitFo
rDecorations); | 34 InspectorTest.showScriptSource("highlight-in-source.css", waitFo
rDecorations); |
| 35 } | 35 } |
| 36 | 36 |
| 37 function waitForDecorations() | 37 function waitForDecorations() |
| 38 { | 38 { |
| 39 InspectorTest.addSniffer(CSSTracker.CSSTrackerView.LineDecorator
.prototype, "decorate", didShowDecorations); | 39 InspectorTest.addSniffer(CSSTracker.CSSTrackerView.LineDecorator
.prototype, "decorate", didShowDecorations); |
| 40 } | 40 } |
| 41 | 41 |
| 42 function didShowDecorations(sourceFrame) | 42 function didShowDecorations(sourceFrame) |
| 43 { | 43 { |
| 44 var lines = Array.prototype.map.call(document.querySelectorAll("
.text-editor-css-rule-unused-marker"), | 44 var lines = Array.prototype.map.call(document.querySelectorAll("
.text-editor-css-rule-unused-marker"), |
| 45 e => e.parentElement.pre
viousSibling.textContent); | 45 e => e.parentElement.pre
viousSibling.textContent); |
| 46 | 46 |
| 47 InspectorTest.addResult(lines); | 47 InspectorTest.addResult(lines); |
| 48 next(); | 48 next(); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 ]); | 51 ]); |
| 52 } | 52 } |
| 53 </script> | 53 </script> |
| 54 </head> | 54 </head> |
| 55 <p id="id">PASS</p> | 55 <p id="id">PASS</p> |
| 56 <body onload="runTest()"> | 56 <body onload="runTest()"> |
| 57 <p>Tests the CSS highlight in sources after the timeline recording finishes.</p> | 57 <p>Tests the CSS highlight in sources after the timeline recording finishes.</p> |
| 58 </body> | 58 </body> |
| 59 </html> | 59 </html> |
| OLD | NEW |