| 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> | 5 <script> |
| 6 function performActions(callback) | 6 function performActions() |
| 7 { | 7 { |
| 8 var callback; |
| 9 var promise = new Promise((fulfill) => callback = fulfill); |
| 8 var square = document.getElementById("square"); | 10 var square = document.getElementById("square"); |
| 9 step1(); | 11 step1(); |
| 10 | 12 |
| 11 function step1() | 13 function step1() |
| 12 { | 14 { |
| 13 square.style.backgroundColor = "red"; | 15 square.style.backgroundColor = "red"; |
| 14 testRunner.layoutAndPaintAsyncThen(step2); | 16 testRunner.layoutAndPaintAsyncThen(step2); |
| 15 } | 17 } |
| 16 | 18 |
| 17 function step2() | 19 function step2() |
| 18 { | 20 { |
| 19 square.style.backgroundColor = "black"; | 21 square.style.backgroundColor = "black"; |
| 20 testRunner.layoutAndPaintAsyncThen(callback); | 22 testRunner.layoutAndPaintAsyncThen(callback); |
| 21 } | 23 } |
| 24 return promise; |
| 22 } | 25 } |
| 23 | 26 |
| 24 function test() | 27 function test() |
| 25 { | 28 { |
| 26 var panel = WebInspector.panels.timeline; | 29 var panel = WebInspector.panels.timeline; |
| 27 | 30 |
| 28 panel._captureLayersAndPicturesSetting.set(true); | 31 panel._captureLayersAndPicturesSetting.set(true); |
| 29 panel._onModeChanged(); | 32 panel._onModeChanged(); |
| 30 | 33 |
| 31 InspectorTest.invokeAsyncWithTimeline("performActions", onRecordingDone); | 34 InspectorTest.invokeAsyncWithTimeline("performActions", onRecordingDone); |
| 32 var paintEvents = []; | 35 var paintEvents = []; |
| 33 function onRecordingDone() | 36 function onRecordingDone() |
| 34 { | 37 { |
| 35 var events = InspectorTest.timelineModel()._mainThreadEvents; | 38 var events = InspectorTest.timelineModel()._mainThreadEvents; |
| 36 for (var event of events) { | 39 for (var event of events) { |
| 37 if (event.name === WebInspector.TimelineModel.RecordType.Paint) { | 40 if (event.name === WebInspector.TimelineModel.RecordType.Paint) { |
| 38 paintEvents.push(event); | 41 paintEvents.push(event); |
| 39 if (!event.picture) | 42 if (!event.picture) |
| 40 InspectorTest.addResult("Event without picture at " + paintE
vents.length); | 43 InspectorTest.addResult("Event without picture at " + paintE
vents.length); |
| 41 } | 44 } |
| 42 } | 45 } |
| 43 | 46 |
| 44 if (paintEvents.length < 2) | 47 if (paintEvents.length < 2) |
| 45 throw new Error("FAIL: Expect at least two paint events"); | 48 throw new Error("FAIL: Expect at least two paint events"); |
| 46 | 49 |
| 47 InspectorTest.addSniffer(panel, "_appendDetailsTabsForTraceEventAndShowD
etails", onRecordDetailsReady, false); | 50 InspectorTest.addSniffer(panel, "_appendDetailsTabsForTraceEventAndShowD
etails", onRecordDetailsReady, false); |
| 48 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paintEvents[0
]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); | 51 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paintEvents[0
]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); |
| 49 } | 52 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 | 78 |
| 76 <body onload="runTest()"> | 79 <body onload="runTest()"> |
| 77 <p> | 80 <p> |
| 78 Tests that paint profiler is properly update when an event is selected in Flame
Chart | 81 Tests that paint profiler is properly update when an event is selected in Flame
Chart |
| 79 </p> | 82 </p> |
| 80 | 83 |
| 81 <div id="square" style="width: 40px; height: 40px"></div> | 84 <div id="square" style="width: 40px; height: 40px"></div> |
| 82 | 85 |
| 83 </body> | 86 </body> |
| 84 </html> | 87 </html> |
| OLD | NEW |