| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/timeline-test.js"></script> | 5 <script src="../../../http/tests/inspector/timeline-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 function display(callback) | 7 function display() |
| 8 { | 8 { |
| 9 var callback; |
| 10 var promise = new Promise((fulfill) => callback = fulfill); |
| 9 requestAnimationFrame(function() { | 11 requestAnimationFrame(function() { |
| 10 var testElements = document.body.getElementsByClassName("testElement"); | 12 var testElements = document.body.getElementsByClassName("testElement"); |
| 11 for (var i = 0; i < testElements.length; i++) { | 13 for (var i = 0; i < testElements.length; i++) { |
| 12 testElements[i].style.color = "red"; | 14 testElements[i].style.color = "red"; |
| 13 testElements[i].style.backgroundColor = "blue"; | 15 testElements[i].style.backgroundColor = "blue"; |
| 14 } | 16 } |
| 15 if (window.testRunner) | 17 if (window.testRunner) |
| 16 testRunner.layoutAndPaintAsyncThen(callback); | 18 testRunner.layoutAndPaintAsyncThen(callback); |
| 17 }); | 19 }); |
| 20 return promise; |
| 18 } | 21 } |
| 19 | 22 |
| 20 function test() | 23 function test() |
| 21 { | 24 { |
| 22 var currentPanel = WebInspector.inspectorView.currentPanel(); | 25 var currentPanel = WebInspector.inspectorView.currentPanel(); |
| 23 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); | 26 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); |
| 24 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | 27 Runtime.experiments.enableForTest("timelineInvalidationTracking"); |
| 25 | 28 |
| 26 InspectorTest.invokeAsyncWithTimeline("display", function() { | 29 InspectorTest.invokeAsyncWithTimeline("display", function() { |
| 27 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint); | 30 var record = InspectorTest.findFirstTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint); |
| 28 InspectorTest.addArray(record._event.invalidationTrackingEvents, Inspect
orTest.InvalidationFormatters, "", "paint invalidations"); | 31 InspectorTest.addArray(record._event.invalidationTrackingEvents, Inspect
orTest.InvalidationFormatters, "", "paint invalidations"); |
| 29 | 32 |
| 30 var linkifier = new WebInspector.Linkifier(); | 33 var linkifier = new WebInspector.Linkifier(); |
| 31 var event = record.traceEvent(); | 34 var event = record.traceEvent(); |
| 32 var target = InspectorTest.timelineModel().targetByEvent(event); | 35 var target = InspectorTest.timelineModel().targetByEvent(event); |
| 33 var contentHelper = new WebInspector.TimelineDetailsContentHelper(target
, linkifier, true); | 36 var contentHelper = new WebInspector.TimelineDetailsContentHelper(target
, linkifier, true); |
| 34 WebInspector.TimelineUIUtils._generateCauses(event, target, null, conten
tHelper); | 37 WebInspector.TimelineUIUtils._generateCauses(event, target, null, conten
tHelper); |
| 35 var invalidationsTree = contentHelper.element.getElementsByClassName("in
validations-tree")[0]; | 38 var invalidationsTree = contentHelper.element.getElementsByClassName("in
validations-tree")[0]; |
| 36 var invalidations = invalidationsTree.shadowRoot.textContent; | 39 var invalidations = invalidationsTree.shadowRoot.textContent; |
| 37 checkStringContains(invalidations, "Inline CSS style declaration was mut
ated for [ DIV class='testElement' ], [ DIV class='testElement' ], and 2 others.
(anonymous function) @ timeline-grouped-invalidations.html:12"); | 40 checkStringContains(invalidations, "Inline CSS style declaration was mut
ated for [ DIV class='testElement' ], [ DIV class='testElement' ], and 2 others.
(anonymous function) @ timeline-grouped-invalidations.html:14"); |
| 38 checkStringContains(invalidations, "Inline CSS style declaration was mut
ated for [ DIV class='testElement' ], [ DIV class='testElement' ], and 2 others.
(anonymous function) @ timeline-grouped-invalidations.html:13"); | 41 checkStringContains(invalidations, "Inline CSS style declaration was mut
ated for [ DIV class='testElement' ], [ DIV class='testElement' ], and 2 others.
(anonymous function) @ timeline-grouped-invalidations.html:15"); |
| 39 InspectorTest.completeTest(); | 42 InspectorTest.completeTest(); |
| 40 }); | 43 }); |
| 41 | 44 |
| 42 function checkStringContains(string, contains) | 45 function checkStringContains(string, contains) |
| 43 { | 46 { |
| 44 var doesContain = string.indexOf(contains) >= 0; | 47 var doesContain = string.indexOf(contains) >= 0; |
| 45 InspectorTest.check(doesContain, contains + " should be present in " + s
tring); | 48 InspectorTest.check(doesContain, contains + " should be present in " + s
tring); |
| 46 InspectorTest.addResult("PASS - record contained " + contains); | 49 InspectorTest.addResult("PASS - record contained " + contains); |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 </script> | 52 </script> |
| 50 </head> | 53 </head> |
| 51 <body onload="runTest()"> | 54 <body onload="runTest()"> |
| 52 <p>Tests grouped invalidations on the timeline.</p> | 55 <p>Tests grouped invalidations on the timeline.</p> |
| 53 <div class="testElement">P</div><div class="testElement">A</div> | 56 <div class="testElement">P</div><div class="testElement">A</div> |
| 54 <div class="testElement">S</div><div class="testElement">S</div> | 57 <div class="testElement">S</div><div class="testElement">S</div> |
| 55 </body> | 58 </body> |
| 56 </html> | 59 </html> |
| OLD | NEW |