| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
| 5 <script> | |
| 6 function performActions(callback) | |
| 7 { | |
| 8 var square = document.getElementById("square"); | |
| 9 step1(); | |
| 10 | |
| 11 function step1() | |
| 12 { | |
| 13 square.style.backgroundColor = "red"; | |
| 14 testRunner.layoutAndPaintAsyncThen(step2); | |
| 15 } | |
| 16 | |
| 17 function step2() | |
| 18 { | |
| 19 square.style.backgroundColor = "black"; | |
| 20 testRunner.layoutAndPaintAsyncThen(callback); | |
| 21 } | |
| 22 } | |
| 23 | |
| 24 function test() | |
| 25 { | |
| 26 var panel = WebInspector.panels.timeline; | |
| 27 | |
| 28 panel._captureLayersAndPicturesSetting.set(true); | |
| 29 panel._onModeChanged(); | |
| 30 | |
| 31 InspectorTest.invokeAsyncWithTimeline("performActions", onRecordingDone); | |
| 32 var paintEvents = []; | |
| 33 function onRecordingDone() | |
| 34 { | |
| 35 var events = InspectorTest.timelineModel()._mainThreadEvents; | |
| 36 for (var event of events) { | |
| 37 if (event.name === WebInspector.TimelineModel.RecordType.Paint) { | |
| 38 paintEvents.push(event); | |
| 39 if (!event.picture) | |
| 40 InspectorTest.addResult("Event without picture at " + paintE
vents.length); | |
| 41 } | |
| 42 } | |
| 43 | |
| 44 if (paintEvents.length < 2) | |
| 45 throw new Error("FAIL: Expect at least two paint events"); | |
| 46 | |
| 47 InspectorTest.addSniffer(panel, "_appendDetailsTabsForTraceEventAndShowD
etails", onRecordDetailsReady, false); | |
| 48 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paintEvents[0
]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); | |
| 49 } | |
| 50 | |
| 51 function onRecordDetailsReady() | |
| 52 { | |
| 53 var updateCount = 0; | |
| 54 var paintProfilerView = panel._lazyPaintProfilerView._paintProfilerView; | |
| 55 InspectorTest.addSniffer(paintProfilerView, "_update", onPaintProfilerUp
date, true); | |
| 56 | |
| 57 function onPaintProfilerUpdate() | |
| 58 { | |
| 59 // No snapshot, not a real update yet -- wait for another update! | |
| 60 if (!paintProfilerView._snapshot) | |
| 61 return; | |
| 62 var logSize = paintProfilerView._log && paintProfilerView._log.lengt
h ? ">0" : "0"; | |
| 63 InspectorTest.addResult("Paint " + updateCount + " log size: " + log
Size); | |
| 64 if (updateCount++) | |
| 65 InspectorTest.completeTest(); | |
| 66 else | |
| 67 panel.select(WebInspector.TimelineSelection.fromTraceEvent(paint
Events[1]), WebInspector.TimelinePanel.DetailsTab.PaintProfiler); | |
| 68 } | |
| 69 } | |
| 70 | |
| 71 } | |
| 72 | |
| 73 </script> | |
| 74 </head> | |
| 75 | |
| 76 <body onload="runTest()"> | |
| 77 <p> | |
| 78 Tests that paint profiler is properly update when an event is selected in Flame
Chart | |
| 79 </p> | |
| 80 | |
| 81 <div id="square" style="width: 40px; height: 40px"></div> | |
| 82 | |
| 83 </body> | |
| 84 </html> | |
| OLD | NEW |